1 {"version":3,"file":"mapillary.js","sources":["../node_modules/rxjs/node_modules/tslib/tslib.es6.js","../node_modules/rxjs/src/internal/util/isFunction.ts","../node_modules/rxjs/src/internal/util/createErrorClass.ts","../node_modules/rxjs/src/internal/util/UnsubscriptionError.ts","../node_modules/rxjs/src/internal/util/arrRemove.ts","../node_modules/rxjs/src/internal/Subscription.ts","../node_modules/rxjs/src/internal/config.ts","../node_modules/rxjs/src/internal/scheduler/timeoutProvider.ts","../node_modules/rxjs/src/internal/util/reportUnhandledError.ts","../node_modules/rxjs/src/internal/util/noop.ts","../node_modules/rxjs/src/internal/NotificationFactories.ts","../node_modules/rxjs/src/internal/util/errorContext.ts","../node_modules/rxjs/src/internal/Subscriber.ts","../node_modules/rxjs/src/internal/symbol/observable.ts","../node_modules/rxjs/src/internal/util/identity.ts","../node_modules/rxjs/src/internal/util/pipe.ts","../node_modules/rxjs/src/internal/Observable.ts","../node_modules/rxjs/src/internal/util/lift.ts","../node_modules/rxjs/src/internal/operators/OperatorSubscriber.ts","../node_modules/rxjs/src/internal/operators/refCount.ts","../node_modules/rxjs/src/internal/observable/ConnectableObservable.ts","../node_modules/rxjs/src/internal/util/ObjectUnsubscribedError.ts","../node_modules/rxjs/src/internal/Subject.ts","../node_modules/rxjs/src/internal/BehaviorSubject.ts","../node_modules/rxjs/src/internal/scheduler/dateTimestampProvider.ts","../node_modules/rxjs/src/internal/ReplaySubject.ts","../node_modules/rxjs/src/internal/scheduler/Action.ts","../node_modules/rxjs/src/internal/scheduler/intervalProvider.ts","../node_modules/rxjs/src/internal/scheduler/AsyncAction.ts","../node_modules/rxjs/src/internal/Scheduler.ts","../node_modules/rxjs/src/internal/scheduler/async.ts","../node_modules/rxjs/src/internal/scheduler/AsyncScheduler.ts","../node_modules/rxjs/src/internal/observable/empty.ts","../node_modules/rxjs/src/internal/scheduled/scheduleArray.ts","../node_modules/rxjs/src/internal/util/isArrayLike.ts","../node_modules/rxjs/src/internal/util/isPromise.ts","../node_modules/rxjs/src/internal/symbol/iterator.ts","../node_modules/rxjs/src/internal/util/caughtSchedule.ts","../node_modules/rxjs/src/internal/scheduled/scheduleAsyncIterable.ts","../node_modules/rxjs/src/internal/util/isInteropObservable.ts","../node_modules/rxjs/src/internal/util/isIterable.ts","../node_modules/rxjs/src/internal/util/isAsyncIterable.ts","../node_modules/rxjs/src/internal/util/throwUnobservableError.ts","../node_modules/rxjs/src/internal/util/isReadableStreamLike.ts","../node_modules/rxjs/src/internal/scheduled/scheduled.ts","../node_modules/rxjs/src/internal/scheduled/scheduleObservable.ts","../node_modules/rxjs/src/internal/scheduled/schedulePromise.ts","../node_modules/rxjs/src/internal/scheduled/scheduleIterable.ts","../node_modules/rxjs/src/internal/scheduled/scheduleReadableStreamLike.ts","../node_modules/rxjs/src/internal/observable/from.ts","../node_modules/rxjs/src/internal/observable/fromArray.ts","../node_modules/rxjs/src/internal/util/isScheduler.ts","../node_modules/rxjs/src/internal/util/args.ts","../node_modules/rxjs/src/internal/observable/of.ts","../node_modules/rxjs/src/internal/observable/throwError.ts","../node_modules/rxjs/src/internal/util/EmptyError.ts","../node_modules/rxjs/src/internal/util/isDate.ts","../node_modules/rxjs/src/internal/operators/timeout.ts","../node_modules/rxjs/src/internal/operators/map.ts","../node_modules/rxjs/src/internal/util/mapOneOrManyArgs.ts","../node_modules/rxjs/src/internal/util/argsArgArrayOrObject.ts","../node_modules/rxjs/src/internal/util/createObject.ts","../node_modules/rxjs/src/internal/observable/combineLatest.ts","../node_modules/rxjs/src/internal/operators/mergeInternals.ts","../node_modules/rxjs/src/internal/operators/mergeMap.ts","../node_modules/rxjs/src/internal/operators/mergeAll.ts","../node_modules/rxjs/src/internal/operators/concatAll.ts","../node_modules/rxjs/src/internal/observable/concat.ts","../node_modules/rxjs/src/internal/observable/fromEvent.ts","../node_modules/rxjs/src/internal/observable/timer.ts","../node_modules/rxjs/src/internal/observable/merge.ts","../node_modules/rxjs/src/internal/util/argsOrArgArray.ts","../node_modules/rxjs/src/internal/operators/filter.ts","../node_modules/rxjs/src/internal/observable/zip.ts","../node_modules/rxjs/src/internal/operators/auditTime.ts","../node_modules/rxjs/src/internal/operators/audit.ts","../node_modules/rxjs/src/internal/operators/bufferCount.ts","../node_modules/rxjs/src/internal/operators/catchError.ts","../node_modules/rxjs/src/internal/operators/scanInternals.ts","../node_modules/rxjs/src/internal/operators/reduce.ts","../node_modules/rxjs/src/internal/operators/concatMap.ts","../node_modules/rxjs/src/internal/operators/connect.ts","../node_modules/rxjs/src/internal/observable/fromSubscribable.ts","../node_modules/rxjs/src/internal/operators/debounceTime.ts","../node_modules/rxjs/src/internal/operators/defaultIfEmpty.ts","../node_modules/rxjs/src/internal/operators/take.ts","../node_modules/rxjs/src/internal/operators/distinctUntilChanged.ts","../node_modules/rxjs/src/internal/operators/throwIfEmpty.ts","../node_modules/rxjs/src/internal/operators/expand.ts","../node_modules/rxjs/src/internal/operators/finalize.ts","../node_modules/rxjs/src/internal/operators/first.ts","../node_modules/rxjs/src/internal/operators/takeLast.ts","../node_modules/rxjs/src/internal/operators/last.ts","../node_modules/rxjs/src/internal/operators/multicast.ts","../node_modules/rxjs/src/internal/operators/pairwise.ts","../node_modules/rxjs/src/internal/operators/publish.ts","../node_modules/rxjs/src/internal/operators/publishReplay.ts","../node_modules/rxjs/src/internal/operators/retry.ts","../node_modules/rxjs/src/internal/operators/scan.ts","../node_modules/rxjs/src/internal/operators/share.ts","../node_modules/rxjs/src/internal/operators/skip.ts","../node_modules/rxjs/src/internal/operators/skipWhile.ts","../node_modules/rxjs/src/internal/operators/startWith.ts","../node_modules/rxjs/src/internal/operators/switchMap.ts","../node_modules/rxjs/src/internal/operators/takeUntil.ts","../node_modules/rxjs/src/internal/operators/takeWhile.ts","../node_modules/rxjs/src/internal/operators/tap.ts","../node_modules/rxjs/src/internal/operators/withLatestFrom.ts","../src/graph/FilterCreator.ts","../node_modules/three/build/three.module.js","../src/geo/GeoCoords.ts","../src/graph/GraphCalculator.ts","../src/graph/Image.ts","../src/graph/ImageCache.ts","../src/graph/Sequence.ts","../src/graph/edge/EdgeCalculatorCoefficients.ts","../src/graph/edge/NavigationDirection.ts","../src/graph/edge/EdgeCalculatorDirections.ts","../src/graph/edge/EdgeCalculatorSettings.ts","../src/error/MapillaryError.ts","../src/error/ArgumentMapillaryError.ts","../src/geo/Spatial.ts","../src/geo/Geo.ts","../src/graph/edge/EdgeCalculator.ts","../src/error/GraphMapillaryError.ts","../src/graph/Graph.ts","../src/component/marker/MarkerSet.ts","../node_modules/quickselect/index.js","../node_modules/rbush/index.js","../src/geo/GeoRBush.ts","../src/component/ComponentService.ts","../node_modules/x-is-array/index.js","../node_modules/virtual-dom/vnode/vpatch.js","../node_modules/virtual-dom/vnode/is-vnode.js","../node_modules/virtual-dom/vnode/is-vtext.js","../node_modules/virtual-dom/vnode/is-widget.js","../node_modules/virtual-dom/vnode/is-thunk.js","../node_modules/virtual-dom/vnode/handle-thunk.js","../node_modules/is-object/index.js","../node_modules/virtual-dom/vnode/is-vhook.js","../node_modules/virtual-dom/vtree/diff-props.js","../node_modules/virtual-dom/vtree/diff.js","../node_modules/virtual-dom/diff.js","../node_modules/dom-walk/index.js","../node_modules/min-document/dom-comment.js","../node_modules/min-document/dom-text.js","../node_modules/min-document/event/dispatch-event.js","../node_modules/min-document/event/add-event-listener.js","../node_modules/min-document/event/remove-event-listener.js","../node_modules/min-document/serialize.js","../node_modules/min-document/dom-element.js","../node_modules/min-document/dom-fragment.js","../node_modules/min-document/event.js","../node_modules/min-document/document.js","../node_modules/min-document/index.js","../node_modules/global/document.js","../node_modules/virtual-dom/vdom/apply-properties.js","../node_modules/virtual-dom/vdom/create-element.js","../node_modules/virtual-dom/vdom/dom-index.js","../node_modules/virtual-dom/vdom/update-widget.js","../node_modules/virtual-dom/vdom/patch-op.js","../node_modules/virtual-dom/vdom/patch.js","../node_modules/virtual-dom/patch.js","../node_modules/virtual-dom/vnode/vnode.js","../node_modules/virtual-dom/vnode/vtext.js","../node_modules/browser-split/index.js","../node_modules/virtual-dom/virtual-hyperscript/parse-tag.js","../node_modules/virtual-dom/virtual-hyperscript/hooks/soft-set-hook.js","../node_modules/individual/index.js","../node_modules/individual/one-version.js","../node_modules/ev-store/index.js","../node_modules/virtual-dom/virtual-hyperscript/hooks/ev-hook.js","../node_modules/virtual-dom/virtual-hyperscript/index.js","../node_modules/virtual-dom/h.js","../src/component/cover/CoverState.ts","../src/component/util/ComponentSize.ts","../node_modules/virtual-dom/index.js","../node_modules/virtual-dom/create-element.js","../src/util/EventEmitter.ts","../src/util/SubscriptionHolder.ts","../src/component/Component.ts","../src/component/cover/CoverComponent.ts","../src/component/attribution/AttributionComponent.ts","../src/geo/ViewportCoords.ts","../src/component/bearing/BearingComponent.ts","../src/component/cache/CacheComponent.ts","../src/error/CancelMapillaryError.ts","../src/component/direction/DirectionDOMCalculator.ts","../src/component/direction/DirectionDOMRenderer.ts","../src/component/direction/DirectionComponent.ts","../src/component/shaders/Shaders.ts","../src/component/shaders/fisheye.fragment.glsl.ts","../src/component/shaders/fisheye.vertex.glsl.ts","../src/component/shaders/fisheye_curtain.fragment.glsl.ts","../src/component/shaders/fisheye_curtain.vertex.glsl.ts","../src/component/shaders/perspective.fragment.glsl.ts","../src/component/shaders/perspective.vertex.glsl.ts","../src/component/shaders/perspective_curtain.fragment.glsl.ts","../src/component/shaders/perspective_curtain.vertex.glsl.ts","../src/component/shaders/perspective_distorted.fragment.glsl.ts","../src/component/shaders/perspective_distorted.vertex.glsl.ts","../src/component/shaders/perspective_distorted_curtain.fragment.glsl.ts","../src/component/shaders/perspective_distorted_curtain.vertex.glsl.ts","../src/component/shaders/spherical.fragment.glsl.ts","../src/component/shaders/spherical.vertex.glsl.ts","../src/component/shaders/spherical_curtain.fragment.glsl.ts","../src/component/shaders/spherical_curtain.vertex.glsl.ts","../src/component/util/MeshFactory.ts","../src/component/util/MeshScene.ts","../src/component/image/ImageGLRenderer.ts","../src/render/RenderPass.ts","../src/tile/TileLoader.ts","../src/tile/TileStore.ts","../src/tile/RegionOfInterestCalculator.ts","../src/tile/TileMath.ts","../src/tile/interfaces/TileTypes.ts","../src/tile/TextureProvider.ts","../src/state/State.ts","../src/graph/GraphMode.ts","../src/component/sequence/SequenceMode.ts","../src/component/interfaces/SliderConfiguration.ts","../src/component/image/ImageComponent.ts","../src/component/util/HandlerBase.ts","../src/component/keyboard/KeySequenceNavigationHandler.ts","../src/component/keyboard/KeySpatialNavigationHandler.ts","../src/component/keyboard/KeyZoomHandler.ts","../src/component/keyboard/KeyPlayHandler.ts","../src/component/keyboard/KeyboardComponent.ts","../src/component/marker/MarkerScene.ts","../src/component/marker/MarkerComponent.ts","../src/geo/Lines.ts","../src/component/pointer/ImageBoundary.ts","../src/component/pointer/BounceHandler.ts","../src/component/util/MouseOperator.ts","../src/component/pointer/DragPanHandler.ts","../node_modules/rxjs/src/internal/operators/sample.ts","../src/component/pointer/EarthControlHandler.ts","../src/component/pointer/ScrollZoomHandler.ts","../src/component/pointer/TouchZoomHandler.ts","../src/component/pointer/PointerComponent.ts","../src/util/DOM.ts","../src/component/popup/PopupComponent.ts","../src/component/sequence/SequenceDOMRenderer.ts","../src/component/sequence/SequenceComponent.ts","../src/geo/Transform.ts","../src/component/slider/SliderGLRenderer.ts","../src/component/slider/SliderDOMRenderer.ts","../src/component/slider/SliderComponent.ts","../src/viewer/PlayService.ts","../src/component/spatial/enums/CameraVisualizationMode.ts","../src/component/spatial/enums/OriginalPositionMode.ts","../src/component/spatial/scene/ClusterPoints.ts","../src/component/spatial/scene/CellLine.ts","../src/component/spatial/scene/SpatialOctreeMath.ts","../src/component/spatial/scene/SpatialOctreeNode.ts","../src/component/spatial/scene/SpatialOctree.ts","../src/component/spatial/scene/SpatialIntersection.ts","../src/component/spatial/scene/PositionLine.ts","../src/component/spatial/scene/CameraFrameBase.ts","../src/component/spatial/scene/SphericalCameraFrame.ts","../src/component/spatial/scene/PerspectiveCameraFrame.ts","../src/component/spatial/SpatialCommon.ts","../src/component/spatial/scene/SpatialCell.ts","../src/component/spatial/scene/SpatialAssets.ts","../src/component/spatial/Modes.ts","../src/component/spatial/enums/PointVisualizationMode.ts","../src/component/spatial/SpatialScene.ts","../src/component/spatial/SpatialCache.ts","../src/api/CellMath.ts","../src/component/spatial/SpatialComponent.ts","../src/component/tag/geometry/Geometry.ts","../src/component/tag/error/GeometryTagError.ts","../src/component/tag/geometry/PointsGeometry.ts","../src/component/tag/tag/CreateTag.ts","../node_modules/earcut/src/earcut.js","../node_modules/polylabel/node_modules/tinyqueue/index.js","../node_modules/polylabel/polylabel.js","../node_modules/splaytree/index.js","../node_modules/martinez-polygon-clipping/src/compute_fields.js","../node_modules/martinez-polygon-clipping/src/operation.js","../node_modules/martinez-polygon-clipping/src/edge_type.js","../node_modules/martinez-polygon-clipping/src/sweep_event.js","../node_modules/martinez-polygon-clipping/src/equals.js","../node_modules/robust-predicates/esm/util.js","../node_modules/robust-predicates/esm/orient2d.js","../node_modules/martinez-polygon-clipping/src/signed_area.js","../node_modules/martinez-polygon-clipping/src/compare_events.js","../node_modules/martinez-polygon-clipping/src/divide_segment.js","../node_modules/martinez-polygon-clipping/src/segment_intersection.js","../node_modules/martinez-polygon-clipping/src/possible_intersection.js","../node_modules/martinez-polygon-clipping/src/compare_segments.js","../node_modules/martinez-polygon-clipping/src/contour.js","../node_modules/martinez-polygon-clipping/src/connect_edges.js","../node_modules/tinyqueue/index.js","../node_modules/martinez-polygon-clipping/src/fill_queue.js","../node_modules/martinez-polygon-clipping/src/index.js","../node_modules/martinez-polygon-clipping/src/subdivide_segments.js","../src/component/tag/geometry/VertexGeometry.ts","../node_modules/martinez-polygon-clipping/index.js","../src/component/tag/geometry/RectGeometry.ts","../src/component/tag/tag/ExtremePointCreateTag.ts","../src/component/tag/geometry/PolygonGeometry.ts","../src/component/tag/tag/OutlineCreateTag.ts","../src/component/tag/TagCreator.ts","../src/component/tag/TagDOMRenderer.ts","../src/component/tag/TagScene.ts","../src/component/tag/TagMode.ts","../src/component/tag/TagOperation.ts","../src/component/tag/tag/TagDomain.ts","../src/viewer/enums/Alignment.ts","../src/component/tag/tag/RenderTag.ts","../src/component/tag/tag/OutlineRenderTagBase.ts","../src/component/tag/tag/ExtremePointRenderTag.ts","../src/component/tag/tag/Tag.ts","../src/component/tag/tag/ExtremePointTag.ts","../src/component/tag/tag/OutlineRenderTag.ts","../src/component/tag/tag/OutlineTag.ts","../src/component/tag/tag/SpotRenderTag.ts","../src/component/tag/tag/SpotTag.ts","../src/component/tag/TagSet.ts","../src/component/tag/geometry/PointGeometry.ts","../src/component/tag/handlers/TagHandlerBase.ts","../src/component/tag/handlers/CreateHandlerBase.ts","../src/component/tag/handlers/CreatePointHandler.ts","../src/component/tag/handlers/CreateVertexHandler.ts","../src/component/tag/handlers/CreatePointsHandler.ts","../src/component/tag/handlers/CreatePolygonHandler.ts","../src/component/tag/handlers/CreateRectHandler.ts","../src/component/tag/handlers/CreateRectDragHandler.ts","../src/component/tag/handlers/EditVertexHandler.ts","../src/component/tag/TagComponent.ts","../src/component/zoom/ZoomComponent.ts","../src/component/fallback/image/ImageFallbackComponent.ts","../src/component/fallback/navigation/NavigationFallbackComponent.ts","../node_modules/pako/dist/pako.esm.mjs","../node_modules/ieee754/index.js","../node_modules/pbf/index.js","../src/api/Common.ts","../src/api/DataProviderBase.ts","../src/api/GeometryProviderBase.ts","../node_modules/long/dist/long.js","../node_modules/s2-geometry/src/s2geometry.js","../src/api/S2GeometryProvider.ts","../src/api/provider/GraphConverter.ts","../src/api/provider/GraphQueryCreator.ts","../src/api/provider/GraphDataProvider.ts","../src/component/marker/marker/Marker.ts","../src/util/Support.ts","../src/viewer/enums/CameraControls.ts","../src/render/RenderMode.ts","../src/state/TransitionMode.ts","../src/viewer/enums/RenderPass.ts","../src/viewer/ComponentController.ts","../src/render/DOMRenderer.ts","../node_modules/rxjs/src/internal/operators/pluck.ts","../src/render/GLRenderer.ts","../src/geo/Camera.ts","../src/render/RenderCamera.ts","../src/render/RenderService.ts","../src/viewer/KeyboardService.ts","../src/viewer/MouseService.ts","../src/viewer/SpriteService.ts","../src/viewer/TouchService.ts","../node_modules/rxjs/src/internal/operators/bufferWhen.ts","../src/viewer/ConfigurationService.ts","../src/viewer/Container.ts","../src/viewer/CacheService.ts","../src/viewer/LoadingService.ts","../src/viewer/PanService.ts","../src/api/APIWrapper.ts","../src/graph/GraphService.ts","../src/state/FrameGenerator.ts","../src/state/state/StateBase.ts","../src/state/state/CustomState.ts","../src/state/state/EarthState.ts","../src/state/state/EulerRotationDelta.ts","../src/state/state/InteractiveStateBase.ts","../src/state/state/InteractiveWaitingState.ts","../src/state/state/TraversingState.ts","../src/state/state/WaitingState.ts","../src/state/StateTransitionMatrix.ts","../src/state/StateContext.ts","../src/state/StateService.ts","../src/viewer/Modes.ts","../src/viewer/Navigator.ts","../src/viewer/Projection.ts","../src/viewer/Observer.ts","../src/viewer/CustomRenderer.ts","../src/viewer/CustomCameraControls.ts","../src/mapillary.ts","../src/component/marker/marker/CircleMarker.ts","../src/component/popup/popup/Popup.ts","../src/component/marker/marker/SimpleMarker.ts","../src/viewer/Viewer.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\r\n to[j] = from[i];\r\n return to;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n * Returns true if the object is a function.\n * @param value The value to check\n */\nexport function isFunction(value: any): value is (...args: any[]) => any {\n return typeof value === 'function';\n}\n","/**\n * Used to create Error subclasses until the community moves away from ES5.\n *\n * This is because compiling from TypeScript down to ES5 has issues with subclassing Errors\n * as well as other built-in types: https://github.com/Microsoft/TypeScript/issues/12123\n *\n * @param createImpl A factory function to create the actual constructor implementation. The returned\n * function should be a named function that calls `_super` internally.\n */\nexport function createErrorClass<T>(createImpl: (_super: any) => any): T {\n const _super = (instance: any) => {\n Error.call(instance);\n instance.stack = new Error().stack;\n };\n\n const ctorFunc = createImpl(_super);\n ctorFunc.prototype = Object.create(Error.prototype);\n ctorFunc.prototype.constructor = ctorFunc;\n return ctorFunc;\n}\n","import { createErrorClass } from './createErrorClass';\n\nexport interface UnsubscriptionError extends Error {\n readonly errors: any[];\n}\n\nexport interface UnsubscriptionErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (errors: any[]): UnsubscriptionError;\n}\n\n/**\n * An error thrown when one or more errors have occurred during the\n * `unsubscribe` of a {@link Subscription}.\n */\nexport const UnsubscriptionError: UnsubscriptionErrorCtor = createErrorClass(\n (_super) =>\n function UnsubscriptionErrorImpl(this: any, errors: (Error | string)[]) {\n _super(this);\n this.message = errors\n ? `${errors.length} errors occurred during unsubscription:\n${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\\n ')}`\n : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n }\n);\n","/**\n * Removes an item from an array, mutating it.\n * @param arr The array to remove the item from\n * @param item The item to remove\n */\nexport function arrRemove<T>(arr: T[] | undefined | null, item: T) {\n if (arr) {\n const index = arr.indexOf(item);\n 0 <= index && arr.splice(index, 1);\n }\n}\n","import { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nimport { SubscriptionLike, TeardownLogic, Unsubscribable } from './types';\nimport { arrRemove } from './util/arrRemove';\n\n/**\n * Represents a disposable resource, such as the execution of an Observable. A\n * Subscription has one important method, `unsubscribe`, that takes no argument\n * and just disposes the resource held by the subscription.\n *\n * Additionally, subscriptions may be grouped together through the `add()`\n * method, which will attach a child Subscription to the current Subscription.\n * When a Subscription is unsubscribed, all its children (and its grandchildren)\n * will be unsubscribed as well.\n *\n * @class Subscription\n */\nexport class Subscription implements SubscriptionLike {\n /** @nocollapse */\n public static EMPTY = (() => {\n const empty = new Subscription();\n empty.closed = true;\n return empty;\n })();\n\n /**\n * A flag to indicate whether this Subscription has already been unsubscribed.\n */\n public closed = false;\n\n private _parentage: Subscription[] | Subscription | null = null;\n\n /**\n * The list of registered teardowns to execute upon unsubscription. Adding and removing from this\n * list occurs in the {@link #add} and {@link #remove} methods.\n */\n private _teardowns: Exclude<TeardownLogic, void>[] | null = null;\n\n /**\n * @param initialTeardown A function executed first as part of the teardown\n * process that is kicked off when {@link #unsubscribe} is called.\n */\n constructor(private initialTeardown?: () => void) {}\n\n /**\n * Disposes the resources held by the subscription. May, for instance, cancel\n * an ongoing Observable execution or cancel any other type of work that\n * started when the Subscription was created.\n * @return {void}\n */\n unsubscribe(): void {\n let errors: any[] | undefined;\n\n if (!this.closed) {\n this.closed = true;\n\n // Remove this from it's parents.\n const { _parentage } = this;\n if (_parentage) {\n this._parentage = null;\n if (Array.isArray(_parentage)) {\n for (const parent of _parentage) {\n parent.remove(this);\n }\n } else {\n _parentage.remove(this);\n }\n }\n\n const { initialTeardown } = this;\n if (isFunction(initialTeardown)) {\n try {\n initialTeardown();\n } catch (e) {\n errors = e instanceof UnsubscriptionError ? e.errors : [e];\n }\n }\n\n const { _teardowns } = this;\n if (_teardowns) {\n this._teardowns = null;\n for (const teardown of _teardowns) {\n try {\n execTeardown(teardown);\n } catch (err) {\n errors = errors ?? [];\n if (err instanceof UnsubscriptionError) {\n errors = [...errors, ...err.errors];\n } else {\n errors.push(err);\n }\n }\n }\n }\n\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n }\n }\n\n /**\n * Adds a teardown to this subscription, so that teardown will be unsubscribed/called\n * when this subscription is unsubscribed. If this subscription is already {@link #closed},\n * because it has already been unsubscribed, then whatever teardown is passed to it\n * will automatically be executed (unless the teardown itself is also a closed subscription).\n *\n * Closed Subscriptions cannot be added as teardowns to any subscription. Adding a closed\n * subscription to a any subscription will result in no operation. (A noop).\n *\n * Adding a subscription to itself, or adding `null` or `undefined` will not perform any\n * operation at all. (A noop).\n *\n * `Subscription` instances that are added to this instance will automatically remove themselves\n * if they are unsubscribed. Functions and {@link Unsubscribable} objects that you wish to remove\n * will need to be removed manually with {@link #remove}\n *\n * @param teardown The teardown logic to add to this subscription.\n */\n add(teardown: TeardownLogic): void {\n // Only add the teardown if it's not undefined\n // and don't add a subscription to itself.\n if (teardown && teardown !== this) {\n if (this.closed) {\n // If this subscription is already closed,\n // execute whatever teardown is handed to it automatically.\n execTeardown(teardown);\n } else {\n if (teardown instanceof Subscription) {\n // We don't add closed subscriptions, and we don't add the same subscription\n // twice. Subscription unsubscribe is idempotent.\n if (teardown.closed || teardown._hasParent(this)) {\n return;\n }\n teardown._addParent(this);\n }\n (this._teardowns = this._teardowns ?? []).push(teardown);\n }\n }\n }\n\n /**\n * Checks to see if a this subscription already has a particular parent.\n * This will signal that this subscription has already been added to the parent in question.\n * @param parent the parent to check for\n */\n private _hasParent(parent: Subscription) {\n const { _parentage } = this;\n return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));\n }\n\n /**\n * Adds a parent to this subscription so it can be removed from the parent if it\n * unsubscribes on it's own.\n *\n * NOTE: THIS ASSUMES THAT {@link _hasParent} HAS ALREADY BEEN CHECKED.\n * @param parent The parent subscription to add\n */\n private _addParent(parent: Subscription) {\n const { _parentage } = this;\n this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;\n }\n\n /**\n * Called on a child when it is removed via {@link #remove}.\n * @param parent The parent to remove\n */\n private _removeParent(parent: Subscription) {\n const { _parentage } = this;\n if (_parentage === parent) {\n this._parentage = null;\n } else if (Array.isArray(_parentage)) {\n arrRemove(_parentage, parent);\n }\n }\n\n /**\n * Removes a teardown from this subscription that was previously added with the {@link #add} method.\n *\n * Note that `Subscription` instances, when unsubscribed, will automatically remove themselves\n * from every other `Subscription` they have been added to. This means that using the `remove` method\n * is not a common thing and should be used thoughtfully.\n *\n * If you add the same teardown instance of a function or an unsubscribable object to a `Subcription` instance\n * more than once, you will need to call `remove` the same number of times to remove all instances.\n *\n * All teardown instances are removed to free up memory upon unsubscription.\n *\n * @param teardown The teardown to remove from this subscription\n */\n remove(teardown: Exclude<TeardownLogic, void>): void {\n const { _teardowns } = this;\n _teardowns && arrRemove(_teardowns, teardown);\n\n if (teardown instanceof Subscription) {\n teardown._removeParent(this);\n }\n }\n}\n\nexport const EMPTY_SUBSCRIPTION = Subscription.EMPTY;\n\nexport function isSubscription(value: any): value is Subscription {\n return (\n value instanceof Subscription ||\n (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe))\n );\n}\n\nfunction execTeardown(teardown: Unsubscribable | (() => void)) {\n if (isFunction(teardown)) {\n teardown();\n } else {\n teardown.unsubscribe();\n }\n}\n","import { Subscriber } from './Subscriber';\nimport { ObservableNotification } from './types';\n\n/**\n * The {@link GlobalConfig} object for RxJS. It is used to configure things\n * like how to react on unhandled errors.\n */\nexport const config: GlobalConfig = {\n onUnhandledError: null,\n onStoppedNotification: null,\n Promise: undefined,\n useDeprecatedSynchronousErrorHandling: false,\n useDeprecatedNextContext: false,\n};\n\n/**\n * The global configuration object for RxJS, used to configure things\n * like how to react on unhandled errors. Accessible via {@link config}\n * object.\n */\nexport interface GlobalConfig {\n /**\n * A registration point for unhandled errors from RxJS. These are errors that\n * cannot were not handled by consuming code in the usual subscription path. For\n * example, if you have this configured, and you subscribe to an observable without\n * providing an error handler, errors from that subscription will end up here. This\n * will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onUnhandledError: ((err: any) => void) | null;\n\n /**\n * A registration point for notifications that cannot be sent to subscribers because they\n * have completed, errored or have been explicitly unsubscribed. By default, next, complete\n * and error notifications sent to stopped subscribers are noops. However, sometimes callers\n * might want a different behavior. For example, with sources that attempt to report errors\n * to stopped subscribers, a caller can configure RxJS to throw an unhandled error instead.\n * This will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onStoppedNotification: ((notification: ObservableNotification<any>, subscriber: Subscriber<any>) => void) | null;\n\n /**\n * The promise constructor used by default for {@link Observable#toPromise toPromise} and {@link Observable#forEach forEach}\n * methods.\n *\n * @deprecated As of version 8, RxJS will no longer support this sort of injection of a\n * Promise constructor. If you need a Promise implementation other than native promises,\n * please polyfill/patch Promise as you see appropriate. Will be removed in v8.\n */\n Promise?: PromiseConstructorLike;\n\n /**\n * If true, turns on synchronous error rethrowing, which is a deprecated behavior\n * in v6 and higher. This behavior enables bad patterns like wrapping a subscribe\n * call in a try/catch block. It also enables producer interference, a nasty bug\n * where a multicast can be broken for all observers by a downstream consumer with\n * an unhandled error. DO NOT USE THIS FLAG UNLESS IT'S NEEDED TO BUY TIME\n * FOR MIGRATION REASONS.\n *\n * @deprecated As of version 8, RxJS will no longer support synchronous throwing\n * of unhandled errors. All errors will be thrown on a separate call stack to prevent bad\n * behaviors described above. Will be removed in v8.\n */\n useDeprecatedSynchronousErrorHandling: boolean;\n\n /**\n * If true, enables an as-of-yet undocumented feature from v5: The ability to access\n * `unsubscribe()` via `this` context in `next` functions created in observers passed\n * to `subscribe`.\n *\n * This is being removed because the performance was severely problematic, and it could also cause\n * issues when types other than POJOs are passed to subscribe as subscribers, as they will likely have\n * their `this` context overwritten.\n *\n * @deprecated As of version 8, RxJS will no longer support altering the\n * context of next functions provided as part of an observer to Subscribe. Instead,\n * you will have access to a subscription or a signal or token that will allow you to do things like\n * unsubscribe and test closed status. Will be removed in v8.\n */\n useDeprecatedNextContext: boolean;\n}\n","type SetTimeoutFunction = (handler: () => void, timeout?: number, ...args: any[]) => number;\ntype ClearTimeoutFunction = (handle: number) => void;\n\ninterface TimeoutProvider {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n delegate:\n | {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n }\n | undefined;\n}\n\nexport const timeoutProvider: TimeoutProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n setTimeout(...args) {\n const { delegate } = timeoutProvider;\n return (delegate?.setTimeout || setTimeout)(...args);\n },\n clearTimeout(handle) {\n const { delegate } = timeoutProvider;\n return (delegate?.clearTimeout || clearTimeout)(handle);\n },\n delegate: undefined,\n};\n","import { config } from '../config';\nimport { timeoutProvider } from '../scheduler/timeoutProvider';\n\n/**\n * Handles an error on another job either with the user-configured {@link onUnhandledError},\n * or by throwing it on that new job so it can be picked up by `window.onerror`, `process.on('error')`, etc.\n *\n * This should be called whenever there is an error that is out-of-band with the subscription\n * or when an error hits a terminal boundary of the subscription and no error handler was provided.\n *\n * @param err the error to report\n */\nexport function reportUnhandledError(err: any) {\n timeoutProvider.setTimeout(() => {\n const { onUnhandledError } = config;\n if (onUnhandledError) {\n // Execute the user-configured error handler.\n onUnhandledError(err);\n } else {\n // Throw so it is picked up by the runtime's uncaught error mechanism.\n throw err;\n }\n });\n}\n","/* tslint:disable:no-empty */\nexport function noop() { }\n","import { CompleteNotification, NextNotification, ErrorNotification } from './types';\n\n/**\n * A completion object optimized for memory use and created to be the\n * same \"shape\" as other notifications in v8.\n * @internal\n */\nexport const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined) as CompleteNotification)();\n\n/**\n * Internal use only. Creates an optimized error notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function errorNotification(error: any): ErrorNotification {\n return createNotification('E', undefined, error) as any;\n}\n\n/**\n * Internal use only. Creates an optimized next notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function nextNotification<T>(value: T) {\n return createNotification('N', value, undefined) as NextNotification<T>;\n}\n\n/**\n * Ensures that all notifications created internally have the same \"shape\" in v8.\n *\n * TODO: This is only exported to support a crazy legacy test in `groupBy`.\n * @internal\n */\nexport function createNotification(kind: 'N' | 'E' | 'C', value: any, error: any) {\n return {\n kind,\n value,\n error,\n };\n}\n","import { config } from '../config';\n\nlet context: { errorThrown: boolean; error: any } | null = null;\n\n/**\n * Handles dealing with errors for super-gross mode. Creates a context, in which\n * any synchronously thrown errors will be passed to {@link captureError}. Which\n * will record the error such that it will be rethrown after the call back is complete.\n * TODO: Remove in v8\n * @param cb An immediately executed function.\n */\nexport function errorContext(cb: () => void) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n const isRoot = !context;\n if (isRoot) {\n context = { errorThrown: false, error: null };\n }\n cb();\n if (isRoot) {\n const { errorThrown, error } = context!;\n context = null;\n if (errorThrown) {\n throw error;\n }\n }\n } else {\n // This is the general non-deprecated path for everyone that\n // isn't crazy enough to use super-gross mode (useDeprecatedSynchronousErrorHandling)\n cb();\n }\n}\n\n/**\n * Captures errors only in super-gross mode.\n * @param err the error to capture\n */\nexport function captureError(err: any) {\n if (config.useDeprecatedSynchronousErrorHandling && context) {\n context.errorThrown = true;\n context.error = err;\n }\n}\n","import { isFunction } from './util/isFunction';\nimport { Observer, ObservableNotification } from './types';\nimport { isSubscription, Subscription } from './Subscription';\nimport { config } from './config';\nimport { reportUnhandledError } from './util/reportUnhandledError';\nimport { noop } from './util/noop';\nimport { nextNotification, errorNotification, COMPLETE_NOTIFICATION } from './NotificationFactories';\nimport { timeoutProvider } from './scheduler/timeoutProvider';\nimport { captureError } from './util/errorContext';\n\n/**\n * Implements the {@link Observer} interface and extends the\n * {@link Subscription} class. While the {@link Observer} is the public API for\n * consuming the values of an {@link Observable}, all Observers get converted to\n * a Subscriber, in order to provide Subscription-like capabilities such as\n * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for\n * implementing operators, but it is rarely used as a public API.\n *\n * @class Subscriber<T>\n */\nexport class Subscriber<T> extends Subscription implements Observer<T> {\n /**\n * A static factory for a Subscriber, given a (potentially partial) definition\n * of an Observer.\n * @param next The `next` callback of an Observer.\n * @param error The `error` callback of an\n * Observer.\n * @param complete The `complete` callback of an\n * Observer.\n * @return A Subscriber wrapping the (partially defined)\n * Observer represented by the given arguments.\n * @nocollapse\n * @deprecated Do not use. Will be removed in v8. There is no replacement for this\n * method, and there is no reason to be creating instances of `Subscriber` directly.\n * If you have a specific use case, please file an issue.\n */\n static create<T>(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber<T> {\n return new SafeSubscriber(next, error, complete);\n }\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected isStopped: boolean = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected destination: Subscriber<any> | Observer<any>; // this `any` is the escape hatch to erase extra type param (e.g. R)\n\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n * There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.\n */\n constructor(destination?: Subscriber<any> | Observer<any>) {\n super();\n if (destination) {\n this.destination = destination;\n // Automatically chain subscriptions together here.\n // if destination is a Subscription, then it is a Subscriber.\n if (isSubscription(destination)) {\n destination.add(this);\n }\n } else {\n this.destination = EMPTY_OBSERVER;\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `next` from\n * the Observable, with a value. The Observable may call this method 0 or more\n * times.\n * @param {T} [value] The `next` value.\n * @return {void}\n */\n next(value?: T): void {\n if (this.isStopped) {\n handleStoppedNotification(nextNotification(value), this);\n } else {\n this._next(value!);\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `error` from\n * the Observable, with an attached `Error`. Notifies the Observer that\n * the Observable has experienced an error condition.\n * @param {any} [err] The `error` exception.\n * @return {void}\n */\n error(err?: any): void {\n if (this.isStopped) {\n handleStoppedNotification(errorNotification(err), this);\n } else {\n this.isStopped = true;\n this._error(err);\n }\n }\n\n /**\n * The {@link Observer} callback to receive a valueless notification of type\n * `complete` from the Observable. Notifies the Observer that the Observable\n * has finished sending push-based notifications.\n * @return {void}\n */\n complete(): void {\n if (this.isStopped) {\n handleStoppedNotification(COMPLETE_NOTIFICATION, this);\n } else {\n this.isStopped = true;\n this._complete();\n }\n }\n\n unsubscribe(): void {\n if (!this.closed) {\n this.isStopped = true;\n super.unsubscribe();\n this.destination = null!;\n }\n }\n\n protected _next(value: T): void {\n this.destination.next(value);\n }\n\n protected _error(err: any): void {\n try {\n this.destination.error(err);\n } finally {\n this.unsubscribe();\n }\n }\n\n protected _complete(): void {\n try {\n this.destination.complete();\n } finally {\n this.unsubscribe();\n }\n }\n}\n\nexport class SafeSubscriber<T> extends Subscriber<T> {\n constructor(\n observerOrNext?: Partial<Observer<T>> | ((value: T) => void) | null,\n error?: ((e?: any) => void) | null,\n complete?: (() => void) | null\n ) {\n super();\n\n let next: ((value: T) => void) | undefined;\n if (isFunction(observerOrNext)) {\n // The first argument is a function, not an observer. The next\n // two arguments *could* be observers, or they could be empty.\n next = observerOrNext;\n } else if (observerOrNext) {\n // The first argument is an observer object, we have to pull the handlers\n // off and capture the owner object as the context. That is because we're\n // going to put them all in a new destination with ensured methods\n // for `next`, `error`, and `complete`. That's part of what makes this\n // the \"Safe\" Subscriber.\n ({ next, error, complete } = observerOrNext);\n let context: any;\n if (this && config.useDeprecatedNextContext) {\n // This is a deprecated path that made `this.unsubscribe()` available in\n // next handler functions passed to subscribe. This only exists behind a flag\n // now, as it is *very* slow.\n context = Object.create(observerOrNext);\n context.unsubscribe = () => this.unsubscribe();\n } else {\n context = observerOrNext;\n }\n next = next?.bind(context);\n error = error?.bind(context);\n complete = complete?.bind(context);\n }\n\n // Once we set the destination, the superclass `Subscriber` will\n // do it's magic in the `_next`, `_error`, and `_complete` methods.\n this.destination = {\n next: next ? wrapForErrorHandling(next, this) : noop,\n error: wrapForErrorHandling(error ?? defaultErrorHandler, this),\n complete: complete ? wrapForErrorHandling(complete, this) : noop,\n };\n }\n}\n\n/**\n * Wraps a user-provided handler (or our {@link defaultErrorHandler} in one case) to\n * ensure that any thrown errors are caught and handled appropriately.\n *\n * @param handler The handler to wrap\n * @param instance The SafeSubscriber instance we're going to mark if there's an error.\n */\nfunction wrapForErrorHandling(handler: (arg?: any) => void, instance: SafeSubscriber<any>) {\n return (...args: any[]) => {\n try {\n handler(...args);\n } catch (err) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n captureError(err);\n } else {\n // Ideal path, we report this as an unhandled error,\n // which is thrown on a new call stack.\n reportUnhandledError(err);\n }\n }\n };\n}\n/**\n * An error handler used when no error handler was supplied\n * to the SafeSubscriber -- meaning no error handler was supplied\n * do the `subscribe` call on our observable.\n * @param err The error to handle\n */\nfunction defaultErrorHandler(err: any) {\n throw err;\n}\n\n/**\n * A handler for notifications that cannot be sent to a stopped subscriber.\n * @param notification The notification being sent\n * @param subscriber The stopped subscriber\n */\nfunction handleStoppedNotification(notification: ObservableNotification<any>, subscriber: Subscriber<any>) {\n const { onStoppedNotification } = config;\n onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));\n}\n\n/**\n * The observer used as a stub for subscriptions where the user did not\n * pass any arguments to `subscribe`. Comes with the default error handling\n * behavior.\n */\nexport const EMPTY_OBSERVER: Readonly<Observer<any>> & { closed: true } = {\n closed: true,\n next: noop,\n error: defaultErrorHandler,\n complete: noop,\n};\n","/** Symbol.observable or a string \"@@observable\". Used for interop */\nexport const observable: string | symbol = (() => (typeof Symbol === 'function' && Symbol.observable) || '@@observable')();\n","export function identity<T>(x: T): T {\n return x;\n}\n","import { identity } from './identity';\nimport { UnaryFunction } from '../types';\n\nexport function pipe(): typeof identity;\nexport function pipe<T, A>(fn1: UnaryFunction<T, A>): UnaryFunction<T, A>;\nexport function pipe<T, A, B>(fn1: UnaryFunction<T, A>, fn2: UnaryFunction<A, B>): UnaryFunction<T, B>;\nexport function pipe<T, A, B, C>(fn1: UnaryFunction<T, A>, fn2: UnaryFunction<A, B>, fn3: UnaryFunction<B, C>): UnaryFunction<T, C>;\nexport function pipe<T, A, B, C, D>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>\n): UnaryFunction<T, D>;\nexport function pipe<T, A, B, C, D, E>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>,\n fn5: UnaryFunction<D, E>\n): UnaryFunction<T, E>;\nexport function pipe<T, A, B, C, D, E, F>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>,\n fn5: UnaryFunction<D, E>,\n fn6: UnaryFunction<E, F>\n): UnaryFunction<T, F>;\nexport function pipe<T, A, B, C, D, E, F, G>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>,\n fn5: UnaryFunction<D, E>,\n fn6: UnaryFunction<E, F>,\n fn7: UnaryFunction<F, G>\n): UnaryFunction<T, G>;\nexport function pipe<T, A, B, C, D, E, F, G, H>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>,\n fn5: UnaryFunction<D, E>,\n fn6: UnaryFunction<E, F>,\n fn7: UnaryFunction<F, G>,\n fn8: UnaryFunction<G, H>\n): UnaryFunction<T, H>;\nexport function pipe<T, A, B, C, D, E, F, G, H, I>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>,\n fn5: UnaryFunction<D, E>,\n fn6: UnaryFunction<E, F>,\n fn7: UnaryFunction<F, G>,\n fn8: UnaryFunction<G, H>,\n fn9: UnaryFunction<H, I>\n): UnaryFunction<T, I>;\nexport function pipe<T, A, B, C, D, E, F, G, H, I>(\n fn1: UnaryFunction<T, A>,\n fn2: UnaryFunction<A, B>,\n fn3: UnaryFunction<B, C>,\n fn4: UnaryFunction<C, D>,\n fn5: UnaryFunction<D, E>,\n fn6: UnaryFunction<E, F>,\n fn7: UnaryFunction<F, G>,\n fn8: UnaryFunction<G, H>,\n fn9: UnaryFunction<H, I>,\n ...fns: UnaryFunction<any, any>[]\n): UnaryFunction<T, unknown>;\n\nexport function pipe(...fns: Array<UnaryFunction<any, any>>): UnaryFunction<any, any> {\n return pipeFromArray(fns);\n}\n\n/** @internal */\nexport function pipeFromArray<T, R>(fns: Array<UnaryFunction<T, R>>): UnaryFunction<T, R> {\n if (fns.length === 0) {\n return identity as UnaryFunction<any, any>;\n }\n\n if (fns.length === 1) {\n return fns[0];\n }\n\n return function piped(input: T): R {\n return fns.reduce((prev: any, fn: UnaryFunction<T, R>) => fn(prev), input as any);\n };\n}\n","/**\n * @prettier\n */\nimport { Operator } from './Operator';\nimport { SafeSubscriber, Subscriber } from './Subscriber';\nimport { isSubscription, Subscription } from './Subscription';\nimport { TeardownLogic, OperatorFunction, Subscribable, Observer } from './types';\nimport { observable as Symbol_observable } from './symbol/observable';\nimport { pipeFromArray } from './util/pipe';\nimport { config } from './config';\nimport { isFunction } from './util/isFunction';\nimport { errorContext } from './util/errorContext';\n\n/**\n * A representation of any set of values over any amount of time. This is the most basic building block\n * of RxJS.\n *\n * @class Observable<T>\n */\nexport class Observable<T> implements Subscribable<T> {\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n */\n source: Observable<any> | undefined;\n\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n */\n operator: Operator<any, T> | undefined;\n\n /**\n * @constructor\n * @param {Function} subscribe the function that is called when the Observable is\n * initially subscribed to. This function is given a Subscriber, to which new values\n * can be `next`ed, or an `error` method can be called to raise an error, or\n * `complete` can be called to notify of a successful completion.\n */\n constructor(subscribe?: (this: Observable<T>, subscriber: Subscriber<T>) => TeardownLogic) {\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n\n // HACK: Since TypeScript inherits static properties too, we have to\n // fight against TypeScript here so Subject can have a different static create signature\n /**\n * Creates a new Observable by calling the Observable constructor\n * @owner Observable\n * @method create\n * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor\n * @return {Observable} a new observable\n * @nocollapse\n * @deprecated Use `new Observable()` instead. Will be removed in v8.\n */\n static create: (...args: any[]) => any = <T>(subscribe?: (subscriber: Subscriber<T>) => TeardownLogic) => {\n return new Observable<T>(subscribe);\n };\n\n /**\n * Creates a new Observable, with this Observable instance as the source, and the passed\n * operator defined as the new observable's operator.\n * @method lift\n * @param operator the operator defining the operation to take on the observable\n * @return a new observable with the Operator applied\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n * If you have implemented an operator using `lift`, it is recommended that you create an\n * operator by simply returning `new Observable()` directly. See \"Creating new operators from\n * scratch\" section here: https://rxjs.dev/guide/operators\n */\n lift<R>(operator?: Operator<T, R>): Observable<R> {\n const observable = new Observable<R>();\n observable.source = this;\n observable.operator = operator;\n return observable;\n }\n\n subscribe(observer?: Partial<Observer<T>>): Subscription;\n subscribe(next: (value: T) => void): Subscription;\n /** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */\n subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription;\n /**\n * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.\n *\n * <span class=\"informal\">Use it when you have all these Observables, but still nothing is happening.</span>\n *\n * `subscribe` is not a regular operator, but a method that calls Observable's internal `subscribe` function. It\n * might be for example a function that you passed to Observable's constructor, but most of the time it is\n * a library implementation, which defines what will be emitted by an Observable, and when it be will emitted. This means\n * that calling `subscribe` is actually the moment when Observable starts its work, not when it is created, as it is often\n * the thought.\n *\n * Apart from starting the execution of an Observable, this method allows you to listen for values\n * that an Observable emits, as well as for when it completes or errors. You can achieve this in two\n * of the following ways.\n *\n * The first way is creating an object that implements {@link Observer} interface. It should have methods\n * defined by that interface, but note that it should be just a regular JavaScript object, which you can create\n * yourself in any way you want (ES6 class, classic function constructor, object literal etc.). In particular, do\n * not attempt to use any RxJS implementation details to create Observers - you don't need them. Remember also\n * that your object does not have to implement all methods. If you find yourself creating a method that doesn't\n * do anything, you can simply omit it. Note however, if the `error` method is not provided and an error happens,\n * it will be thrown asynchronously. Errors thrown asynchronously cannot be caught using `try`/`catch`. Instead,\n * use the {@link onUnhandledError} configuration option or use a runtime handler (like `window.onerror` or\n * `process.on('error)`) to be notified of unhandled errors. Because of this, it's recommended that you provide\n * an `error` method to avoid missing thrown errors.\n *\n * The second way is to give up on Observer object altogether and simply provide callback functions in place of its methods.\n * This means you can provide three functions as arguments to `subscribe`, where the first function is equivalent\n * of a `next` method, the second of an `error` method and the third of a `complete` method. Just as in case of an Observer,\n * if you do not need to listen for something, you can omit a function by passing `undefined` or `null`,\n * since `subscribe` recognizes these functions by where they were placed in function call. When it comes\n * to the `error` function, as with an Observer, if not provided, errors emitted by an Observable will be thrown asynchronously.\n *\n * You can, however, subscribe with no parameters at all. This may be the case where you're not interested in terminal events\n * and you also handled emissions internally by using operators (e.g. using `tap`).\n *\n * Whichever style of calling `subscribe` you use, in both cases it returns a Subscription object.\n * This object allows you to call `unsubscribe` on it, which in turn will stop the work that an Observable does and will clean\n * up all resources that an Observable used. Note that cancelling a subscription will not call `complete` callback\n * provided to `subscribe` function, which is reserved for a regular completion signal that comes from an Observable.\n *\n * Remember that callbacks provided to `subscribe` are not guaranteed to be called asynchronously.\n * It is an Observable itself that decides when these functions will be called. For example {@link of}\n * by default emits all its values synchronously. Always check documentation for how given Observable\n * will behave when subscribed and if its default behavior can be modified with a `scheduler`.\n *\n * ## Example\n * ### Subscribe with an Observer\n * ```ts\n * import { of } from 'rxjs';\n *\n * const sumObserver = {\n * sum: 0,\n * next(value) {\n * console.log('Adding: ' + value);\n * this.sum = this.sum + value;\n * },\n * error() {\n * // We actually could just remove this method,\n * // since we do not really care about errors right now.\n * },\n * complete() {\n * console.log('Sum equals: ' + this.sum);\n * }\n * };\n *\n * of(1, 2, 3) // Synchronously emits 1, 2, 3 and then completes.\n * .subscribe(sumObserver);\n *\n * // Logs:\n * // \"Adding: 1\"\n * // \"Adding: 2\"\n * // \"Adding: 3\"\n * // \"Sum equals: 6\"\n * ```\n *\n * ### Subscribe with functions\n * ```ts\n * import { of } from 'rxjs'\n *\n * let sum = 0;\n *\n * of(1, 2, 3).subscribe(\n * value => {\n * console.log('Adding: ' + value);\n * sum = sum + value;\n * },\n * undefined,\n * () => console.log('Sum equals: ' + sum)\n * );\n *\n * // Logs:\n * // \"Adding: 1\"\n * // \"Adding: 2\"\n * // \"Adding: 3\"\n * // \"Sum equals: 6\"\n * ```\n *\n * ### Cancel a subscription\n * ```ts\n * import { interval } from 'rxjs';\n *\n * const subscription = interval(1000).subscribe({\n * next(num) {\n * console.log(num)\n * },\n * complete() {\n * // Will not be called, even when cancelling subscription.\n * console.log('completed!');\n * }\n * });\n *\n * setTimeout(() => {\n * subscription.unsubscribe();\n * console.log('unsubscribed!');\n * }, 2500);\n *\n * // Logs:\n * // 0 after 1s\n * // 1 after 2s\n * // \"unsubscribed!\" after 2.5s\n * ```\n *\n * @param {Observer|Function} observerOrNext (optional) Either an observer with methods to be called,\n * or the first of three possible handlers, which is the handler for each value emitted from the subscribed\n * Observable.\n * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided,\n * the error will be thrown asynchronously as unhandled.\n * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion.\n * @return {Subscription} a subscription reference to the registered handlers\n * @method subscribe\n */\n subscribe(\n observerOrNext?: Partial<Observer<T>> | ((value: T) => void) | null,\n error?: ((error: any) => void) | null,\n complete?: (() => void) | null\n ): Subscription {\n const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);\n\n errorContext(() => {\n const { operator, source } = this;\n subscriber.add(\n operator\n ? // We're dealing with a subscription in the\n // operator chain to one of our lifted operators.\n operator.call(subscriber, source)\n : source\n ? // If `source` has a value, but `operator` does not, something that\n // had intimate knowledge of our API, like our `Subject`, must have\n // set it. We're going to just call `_subscribe` directly.\n this._subscribe(subscriber)\n : // In all other cases, we're likely wrapping a user-provided initializer\n // function, so we need to catch errors and handle them appropriately.\n this._trySubscribe(subscriber)\n );\n });\n\n return subscriber;\n }\n\n /** @internal */\n protected _trySubscribe(sink: Subscriber<T>): TeardownLogic {\n try {\n return this._subscribe(sink);\n } catch (err) {\n // We don't need to return anything in this case,\n // because it's just going to try to `add()` to a subscription\n // above.\n sink.error(err);\n }\n }\n\n /**\n * Used as a NON-CANCELLABLE means of subscribing to an observable, for use with\n * APIs that expect promises, like `async/await`. You cannot unsubscribe from this.\n *\n * **WARNING**: Only use this with observables you *know* will complete. If the source\n * observable does not complete, you will end up with a promise that is hung up, and\n * potentially all of the state of an async function hanging out in memory. To avoid\n * this situation, look into adding something like {@link timeout}, {@link take},\n * {@link takeWhile}, or {@link takeUntil} amongst others.\n *\n * ### Example:\n *\n * ```ts\n * import { interval } from 'rxjs';\n * import { take } from 'rxjs/operators';\n *\n * const source$ = interval(1000).pipe(take(4));\n *\n * async function getTotal() {\n * let total = 0;\n *\n * await source$.forEach(value => {\n * total += value;\n * console.log('observable -> ', value);\n * });\n *\n * return total;\n * }\n *\n * getTotal().then(\n * total => console.log('Total:', total)\n * )\n *\n * // Expected:\n * // \"observable -> 0\"\n * // \"observable -> 1\"\n * // \"observable -> 2\"\n * // \"observable -> 3\"\n * // \"Total: 6\"\n * ```\n * @param next a handler for each value emitted by the observable\n * @return a promise that either resolves on observable completion or\n * rejects with the handled error\n */\n forEach(next: (value: T) => void): Promise<void>;\n\n /**\n * @param next a handler for each value emitted by the observable\n * @param promiseCtor a constructor function used to instantiate the Promise\n * @return a promise that either resolves on observable completion or\n * rejects with the handled error\n * @deprecated Passing a Promise constructor will no longer be available\n * in upcoming versions of RxJS. This is because it adds weight to the library, for very\n * little benefit. If you need this functionality, it is recommended that you either\n * polyfill Promise, or you create an adapter to convert the returned native promise\n * to whatever promise implementation you wanted. Will be removed in v8.\n */\n forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise<void>;\n\n forEach(next: (value: T) => void, promiseCtor?: PromiseConstructorLike): Promise<void> {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor<void>((resolve, reject) => {\n // Must be declared in a separate statement to avoid a ReferenceError when\n // accessing subscription below in the closure due to Temporal Dead Zone.\n let subscription: Subscription;\n subscription = this.subscribe(\n (value) => {\n try {\n next(value);\n } catch (err) {\n reject(err);\n subscription?.unsubscribe();\n }\n },\n reject,\n resolve\n );\n }) as Promise<void>;\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber<any>): TeardownLogic {\n return this.source?.subscribe(subscriber);\n }\n\n /**\n * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable\n * @method Symbol.observable\n * @return {Observable} this instance of the observable\n */\n [Symbol_observable]() {\n return this;\n }\n\n /* tslint:disable:max-line-length */\n pipe(): Observable<T>;\n pipe<A>(op1: OperatorFunction<T, A>): Observable<A>;\n pipe<A, B>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>): Observable<B>;\n pipe<A, B, C>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): Observable<C>;\n pipe<A, B, C, D>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>\n ): Observable<D>;\n pipe<A, B, C, D, E>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>,\n op5: OperatorFunction<D, E>\n ): Observable<E>;\n pipe<A, B, C, D, E, F>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>,\n op5: OperatorFunction<D, E>,\n op6: OperatorFunction<E, F>\n ): Observable<F>;\n pipe<A, B, C, D, E, F, G>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>,\n op5: OperatorFunction<D, E>,\n op6: OperatorFunction<E, F>,\n op7: OperatorFunction<F, G>\n ): Observable<G>;\n pipe<A, B, C, D, E, F, G, H>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>,\n op5: OperatorFunction<D, E>,\n op6: OperatorFunction<E, F>,\n op7: OperatorFunction<F, G>,\n op8: OperatorFunction<G, H>\n ): Observable<H>;\n pipe<A, B, C, D, E, F, G, H, I>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>,\n op5: OperatorFunction<D, E>,\n op6: OperatorFunction<E, F>,\n op7: OperatorFunction<F, G>,\n op8: OperatorFunction<G, H>,\n op9: OperatorFunction<H, I>\n ): Observable<I>;\n pipe<A, B, C, D, E, F, G, H, I>(\n op1: OperatorFunction<T, A>,\n op2: OperatorFunction<A, B>,\n op3: OperatorFunction<B, C>,\n op4: OperatorFunction<C, D>,\n op5: OperatorFunction<D, E>,\n op6: OperatorFunction<E, F>,\n op7: OperatorFunction<F, G>,\n op8: OperatorFunction<G, H>,\n op9: OperatorFunction<H, I>,\n ...operations: OperatorFunction<any, any>[]\n ): Observable<unknown>;\n /* tslint:enable:max-line-length */\n\n /**\n * Used to stitch together functional operators into a chain.\n * @method pipe\n * @return {Observable} the Observable result of all of the operators having\n * been called in the order they were passed in.\n *\n * ### Example\n * ```ts\n * import { interval } from 'rxjs';\n * import { map, filter, scan } from 'rxjs/operators';\n *\n * interval(1000)\n * .pipe(\n * filter(x => x % 2 === 0),\n * map(x => x + x),\n * scan((acc, x) => acc + x)\n * )\n * .subscribe(x => console.log(x))\n * ```\n */\n pipe(...operations: OperatorFunction<any, any>[]): Observable<any> {\n return pipeFromArray(operations)(this);\n }\n\n /* tslint:disable:max-line-length */\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(): Promise<T | undefined>;\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(PromiseCtor: typeof Promise): Promise<T | undefined>;\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(PromiseCtor: PromiseConstructorLike): Promise<T | undefined>;\n /* tslint:enable:max-line-length */\n\n /**\n * Subscribe to this Observable and get a Promise resolving on\n * `complete` with the last emission (if any).\n *\n * **WARNING**: Only use this with observables you *know* will complete. If the source\n * observable does not complete, you will end up with a promise that is hung up, and\n * potentially all of the state of an async function hanging out in memory. To avoid\n * this situation, look into adding something like {@link timeout}, {@link take},\n * {@link takeWhile}, or {@link takeUntil} amongst others.\n *\n * @method toPromise\n * @param [promiseCtor] a constructor function used to instantiate\n * the Promise\n * @return A Promise that resolves with the last value emit, or\n * rejects on an error. If there were no emissions, Promise\n * resolves with undefined.\n * @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise\n */\n toPromise(promiseCtor?: PromiseConstructorLike): Promise<T | undefined> {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor((resolve, reject) => {\n let value: T | undefined;\n this.subscribe(\n (x: T) => (value = x),\n (err: any) => reject(err),\n () => resolve(value)\n );\n }) as Promise<T | undefined>;\n }\n}\n\n/**\n * Decides between a passed promise constructor from consuming code,\n * A default configured promise constructor, and the native promise\n * constructor and returns it. If nothing can be found, it will throw\n * an error.\n * @param promiseCtor The optional promise constructor to passed by consuming code\n */\nfunction getPromiseCtor(promiseCtor: PromiseConstructorLike | undefined) {\n return promiseCtor ?? config.Promise ?? Promise;\n}\n\nfunction isObserver<T>(value: any): value is Observer<T> {\n return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);\n}\n\nfunction isSubscriber<T>(value: any): value is Subscriber<T> {\n return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));\n}\n","import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { OperatorFunction } from '../types';\nimport { isFunction } from './isFunction';\n\n/**\n * Used to determine if an object is an Observable with a lift function.\n */\nexport function hasLift(source: any): source is { lift: InstanceType<typeof Observable>['lift'] } {\n return isFunction(source?.lift);\n}\n\n/**\n * Creates an `OperatorFunction`. Used to define operators throughout the library in a concise way.\n * @param init The logic to connect the liftedSource to the subscriber at the moment of subscription.\n */\nexport function operate<T, R>(\n init: (liftedSource: Observable<T>, subscriber: Subscriber<R>) => (() => void) | void\n): OperatorFunction<T, R> {\n return (source: Observable<T>) => {\n if (hasLift(source)) {\n return source.lift(function (this: Subscriber<R>, liftedSource: Observable<T>) {\n try {\n return init(liftedSource, this);\n } catch (err) {\n this.error(err);\n }\n });\n }\n throw new TypeError('Unable to lift unknown Observable type');\n };\n}\n","import { Subscriber } from '../Subscriber';\n\n/**\n * A generic helper for allowing operators to be created with a Subscriber and\n * use closures to capture necessary state from the operator function itself.\n */\nexport class OperatorSubscriber<T> extends Subscriber<T> {\n /**\n * Creates an instance of an `OperatorSubscriber`.\n * @param destination The downstream subscriber.\n * @param onNext Handles next values, only called if this subscriber is not stopped or closed. Any\n * error that occurs in this function is caught and sent to the `error` method of this subscriber.\n * @param onError Handles errors from the subscription, any errors that occur in this handler are caught\n * and send to the `destination` error handler.\n * @param onComplete Handles completion notification from the subscription. Any errors that occur in\n * this handler are sent to the `destination` error handler.\n * @param onFinalize Additional teardown logic here. This will only be called on teardown if the\n * subscriber itself is not already closed. This is called after all other teardown logic is executed.\n */\n constructor(\n destination: Subscriber<any>,\n onNext?: (value: T) => void,\n onComplete?: () => void,\n onError?: (err: any) => void,\n private onFinalize?: () => void\n ) {\n // It's important - for performance reasons - that all of this class's\n // members are initialized and that they are always initialized in the same\n // order. This will ensure that all OperatorSubscriber instances have the\n // same hidden class in V8. This, in turn, will help keep the number of\n // hidden classes involved in property accesses within the base class as\n // low as possible. If the number of hidden classes involved exceeds four,\n // the property accesses will become megamorphic and performance penalties\n // will be incurred - i.e. inline caches won't be used.\n //\n // The reasons for ensuring all instances have the same hidden class are\n // further discussed in this blog post from Benedikt Meurer:\n // https://benediktmeurer.de/2018/03/23/impact-of-polymorphism-on-component-based-frameworks-like-react/\n super(destination);\n this._next = onNext\n ? function (this: OperatorSubscriber<T>, value: T) {\n try {\n onNext(value);\n } catch (err) {\n destination.error(err);\n }\n }\n : super._next;\n this._error = onError\n ? function (this: OperatorSubscriber<T>, err: any) {\n try {\n onError(err);\n } catch (err) {\n // Send any errors that occur down stream.\n destination.error(err);\n } finally {\n // Ensure teardown.\n this.unsubscribe();\n }\n }\n : super._error;\n this._complete = onComplete\n ? function (this: OperatorSubscriber<T>) {\n try {\n onComplete();\n } catch (err) {\n // Send any errors that occur down stream.\n destination.error(err);\n } finally {\n // Ensure teardown.\n this.unsubscribe();\n }\n }\n : super._complete;\n }\n\n unsubscribe() {\n const { closed } = this;\n super.unsubscribe();\n // Execute additional teardown if we have any and we didn't already do so.\n !closed && this.onFinalize?.();\n }\n}\n","import { ConnectableObservable } from '../observable/ConnectableObservable';\nimport { Subscription } from '../Subscription';\nimport { MonoTypeOperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Make a {@link ConnectableObservable} behave like a ordinary observable and automates the way\n * you can connect to it.\n *\n * Internally it counts the subscriptions to the observable and subscribes (only once) to the source if\n * the number of subscriptions is larger than 0. If the number of subscriptions is smaller than 1, it\n * unsubscribes from the source. This way you can make sure that everything before the *published*\n * refCount has only a single subscription independently of the number of subscribers to the target\n * observable.\n *\n * Note that using the {@link share} operator is exactly the same as using the `multicast(() => new Subject())` operator\n * (making the observable hot) and the *refCount* operator in a sequence.\n *\n * ![](refCount.png)\n *\n * ## Example\n *\n * In the following example there are two intervals turned into connectable observables\n * by using the *publish* operator. The first one uses the *refCount* operator, the\n * second one does not use it. You will notice that a connectable observable does nothing\n * until you call its connect function.\n *\n * ```ts\n * import { interval } from 'rxjs';\n * import { tap, publish, refCount } from 'rxjs/operators';\n *\n * // Turn the interval observable into a ConnectableObservable (hot)\n * const refCountInterval = interval(400).pipe(\n * tap((num) => console.log(`refCount ${num}`)),\n * publish(),\n * refCount()\n * );\n *\n * const publishedInterval = interval(400).pipe(\n * tap((num) => console.log(`publish ${num}`)),\n * publish()\n * );\n *\n * refCountInterval.subscribe();\n * refCountInterval.subscribe();\n * // 'refCount 0' -----> 'refCount 1' -----> etc\n * // All subscriptions will receive the same value and the tap (and\n * // every other operator) before the publish operator will be executed\n * // only once per event independently of the number of subscriptions.\n *\n * publishedInterval.subscribe();\n * // Nothing happens until you call .connect() on the observable.\n * ```\n *\n * @return A function that returns an Observable that automates the connection\n * to ConnectableObservable.\n * @see {@link ConnectableObservable}\n * @see {@link share}\n * @see {@link publish}\n * @deprecated Replaced with the {@link share} operator. How `share` is used\n * will depend on the connectable observable you created just prior to the\n * `refCount` operator.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function refCount<T>(): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let connection: Subscription | null = null;\n\n (source as any)._refCount++;\n\n const refCounter = new OperatorSubscriber(subscriber, undefined, undefined, undefined, () => {\n if (!source || (source as any)._refCount <= 0 || 0 < --(source as any)._refCount) {\n connection = null;\n return;\n }\n\n ///\n // Compare the local RefCountSubscriber's connection Subscription to the\n // connection Subscription on the shared ConnectableObservable. In cases\n // where the ConnectableObservable source synchronously emits values, and\n // the RefCountSubscriber's downstream Observers synchronously unsubscribe,\n // execution continues to here before the RefCountOperator has a chance to\n // supply the RefCountSubscriber with the shared connection Subscription.\n // For example:\n // ```\n // range(0, 10).pipe(\n // publish(),\n // refCount(),\n // take(5),\n // )\n // .subscribe();\n // ```\n // In order to account for this case, RefCountSubscriber should only dispose\n // the ConnectableObservable's shared connection Subscription if the\n // connection Subscription exists, *and* either:\n // a. RefCountSubscriber doesn't have a reference to the shared connection\n // Subscription yet, or,\n // b. RefCountSubscriber's connection Subscription reference is identical\n // to the shared connection Subscription\n ///\n\n const sharedConnection = (source as any)._connection;\n const conn = connection;\n connection = null;\n\n if (sharedConnection && (!conn || sharedConnection === conn)) {\n sharedConnection.unsubscribe();\n }\n\n subscriber.unsubscribe();\n });\n\n source.subscribe(refCounter);\n\n if (!refCounter.closed) {\n connection = (source as ConnectableObservable<T>).connect();\n }\n });\n}\n","import { Subject } from '../Subject';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { refCount as higherOrderRefCount } from '../operators/refCount';\nimport { OperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { hasLift } from '../util/lift';\n\n/**\n * @class ConnectableObservable<T>\n * @deprecated Will be removed in v8. Use {@link connectable} to create a connectable observable.\n * If you are using the `refCount` method of `ConnectableObservable`, use the {@link share} operator\n * instead.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport class ConnectableObservable<T> extends Observable<T> {\n protected _subject: Subject<T> | null = null;\n protected _refCount: number = 0;\n protected _connection: Subscription | null = null;\n\n /**\n * @param source The source observable\n * @param subjectFactory The factory that creates the subject used internally.\n * @deprecated Will be removed in v8. Use {@link connectable} to create a connectable observable.\n * `new ConnectableObservable(source, factory)` is equivalent to\n * `connectable(source, { connector: factory })`.\n * When the `refCount()` method is needed, the {@link share} operator should be used instead:\n * `new ConnectableObservable(source, factory).refCount()` is equivalent to\n * `source.pipe(share({ connector: factory }))`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\n constructor(public source: Observable<T>, protected subjectFactory: () => Subject<T>) {\n super();\n // If we have lift, monkey patch that here. This is done so custom observable\n // types will compose through multicast. Otherwise the resulting observable would\n // simply be an instance of `ConnectableObservable`.\n if (hasLift(source)) {\n this.lift = source.lift;\n }\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber<T>) {\n return this.getSubject().subscribe(subscriber);\n }\n\n protected getSubject(): Subject<T> {\n const subject = this._subject;\n if (!subject || subject.isStopped) {\n this._subject = this.subjectFactory();\n }\n return this._subject!;\n }\n\n protected _teardown() {\n this._refCount = 0;\n const { _connection } = this;\n this._subject = this._connection = null;\n _connection?.unsubscribe();\n }\n\n /**\n * @deprecated {@link ConnectableObservable} will be removed in v8. Use {@link connectable} instead.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\n connect(): Subscription {\n let connection = this._connection;\n if (!connection) {\n connection = this._connection = new Subscription();\n const subject = this.getSubject();\n connection.add(\n this.source.subscribe(\n new OperatorSubscriber(\n subject as any,\n undefined,\n () => {\n this._teardown();\n subject.complete();\n },\n (err) => {\n this._teardown();\n subject.error(err);\n },\n () => this._teardown()\n )\n )\n );\n\n if (connection.closed) {\n this._connection = null;\n connection = Subscription.EMPTY;\n }\n }\n return connection;\n }\n\n /**\n * @deprecated {@link ConnectableObservable} will be removed in v8. Use the {@link share} operator instead.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\n refCount(): Observable<T> {\n return higherOrderRefCount()(this) as Observable<T>;\n }\n}\n","import { createErrorClass } from './createErrorClass';\n\nexport interface ObjectUnsubscribedError extends Error {}\n\nexport interface ObjectUnsubscribedErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (): ObjectUnsubscribedError;\n}\n\n/**\n * An error thrown when an action is invalid because the object has been\n * unsubscribed.\n *\n * @see {@link Subject}\n * @see {@link BehaviorSubject}\n *\n * @class ObjectUnsubscribedError\n */\nexport const ObjectUnsubscribedError: ObjectUnsubscribedErrorCtor = createErrorClass(\n (_super) =>\n function ObjectUnsubscribedErrorImpl(this: any) {\n _super(this);\n this.name = 'ObjectUnsubscribedError';\n this.message = 'object unsubscribed';\n }\n);\n","import { Operator } from './Operator';\nimport { Observable } from './Observable';\nimport { Subscriber } from './Subscriber';\nimport { Subscription, EMPTY_SUBSCRIPTION } from './Subscription';\nimport { Observer, SubscriptionLike, TeardownLogic } from './types';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { arrRemove } from './util/arrRemove';\nimport { errorContext } from './util/errorContext';\n\n/**\n * A Subject is a special type of Observable that allows values to be\n * multicasted to many Observers. Subjects are like EventEmitters.\n *\n * Every Subject is an Observable and an Observer. You can subscribe to a\n * Subject, and you can call next to feed values as well as error and complete.\n */\nexport class Subject<T> extends Observable<T> implements SubscriptionLike {\n closed = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n observers: Observer<T>[] = [];\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n isStopped = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n hasError = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n thrownError: any = null;\n\n /**\n * Creates a \"subject\" by basically gluing an observer to an observable.\n *\n * @nocollapse\n * @deprecated Recommended you do not use. Will be removed at some point in the future. Plans for replacement still under discussion.\n */\n static create: (...args: any[]) => any = <T>(destination: Observer<T>, source: Observable<T>): AnonymousSubject<T> => {\n return new AnonymousSubject<T>(destination, source);\n };\n\n constructor() {\n // NOTE: This must be here to obscure Observable's constructor.\n super();\n }\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n lift<R>(operator: Operator<T, R>): Observable<R> {\n const subject = new AnonymousSubject(this, this);\n subject.operator = operator as any;\n return subject as any;\n }\n\n /** @internal */\n protected _throwIfClosed() {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n }\n\n next(value: T) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n const copy = this.observers.slice();\n for (const observer of copy) {\n observer.next(value);\n }\n }\n });\n }\n\n error(err: any) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.hasError = this.isStopped = true;\n this.thrownError = err;\n const { observers } = this;\n while (observers.length) {\n observers.shift()!.error(err);\n }\n }\n });\n }\n\n complete() {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.isStopped = true;\n const { observers } = this;\n while (observers.length) {\n observers.shift()!.complete();\n }\n }\n });\n }\n\n unsubscribe() {\n this.isStopped = this.closed = true;\n this.observers = null!;\n }\n\n get observed() {\n return this.observers?.length > 0;\n }\n\n /** @internal */\n protected _trySubscribe(subscriber: Subscriber<T>): TeardownLogic {\n this._throwIfClosed();\n return super._trySubscribe(subscriber);\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber<T>): Subscription {\n this._throwIfClosed();\n this._checkFinalizedStatuses(subscriber);\n return this._innerSubscribe(subscriber);\n }\n\n /** @internal */\n protected _innerSubscribe(subscriber: Subscriber<any>) {\n const { hasError, isStopped, observers } = this;\n return hasError || isStopped\n ? EMPTY_SUBSCRIPTION\n : (observers.push(subscriber), new Subscription(() => arrRemove(observers, subscriber)));\n }\n\n /** @internal */\n protected _checkFinalizedStatuses(subscriber: Subscriber<any>) {\n const { hasError, thrownError, isStopped } = this;\n if (hasError) {\n subscriber.error(thrownError);\n } else if (isStopped) {\n subscriber.complete();\n }\n }\n\n /**\n * Creates a new Observable with this Subject as the source. You can do this\n * to create customize Observer-side logic of the Subject and conceal it from\n * code that uses the Observable.\n * @return {Observable} Observable that the Subject casts to\n */\n asObservable(): Observable<T> {\n const observable: any = new Observable<T>();\n observable.source = this;\n return observable;\n }\n}\n\n/**\n * @class AnonymousSubject<T>\n */\nexport class AnonymousSubject<T> extends Subject<T> {\n constructor(\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n public destination?: Observer<T>,\n source?: Observable<T>\n ) {\n super();\n this.source = source;\n }\n\n next(value: T) {\n this.destination?.next?.(value);\n }\n\n error(err: any) {\n this.destination?.error?.(err);\n }\n\n complete() {\n this.destination?.complete?.();\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber<T>): Subscription {\n return this.source?.subscribe(subscriber) ?? EMPTY_SUBSCRIPTION;\n }\n}\n","import { Subject } from './Subject';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\n\n/**\n * A variant of Subject that requires an initial value and emits its current\n * value whenever it is subscribed to.\n *\n * @class BehaviorSubject<T>\n */\nexport class BehaviorSubject<T> extends Subject<T> {\n constructor(private _value: T) {\n super();\n }\n\n get value(): T {\n return this.getValue();\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber<T>): Subscription {\n const subscription = super._subscribe(subscriber);\n !subscription.closed && subscriber.next(this._value);\n return subscription;\n }\n\n getValue(): T {\n const { hasError, thrownError, _value } = this;\n if (hasError) {\n throw thrownError;\n }\n this._throwIfClosed();\n return _value;\n }\n\n next(value: T): void {\n super.next((this._value = value));\n }\n}\n","import { TimestampProvider } from '../types';\n\ninterface DateTimestampProvider extends TimestampProvider {\n delegate: TimestampProvider | undefined;\n}\n\nexport const dateTimestampProvider: DateTimestampProvider = {\n now() {\n // Use the variable rather than `this` so that the function can be called\n // without being bound to the provider.\n return (dateTimestampProvider.delegate || Date).now();\n },\n delegate: undefined,\n};\n","import { Subject } from './Subject';\nimport { TimestampProvider } from './types';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\nimport { dateTimestampProvider } from './scheduler/dateTimestampProvider';\n\n/**\n * A variant of {@link Subject} that \"replays\" old values to new subscribers by emitting them when they first subscribe.\n *\n * `ReplaySubject` has an internal buffer that will store a specified number of values that it has observed. Like `Subject`,\n * `ReplaySubject` \"observes\" values by having them passed to its `next` method. When it observes a value, it will store that\n * value for a time determined by the configuration of the `ReplaySubject`, as passed to its constructor.\n *\n * When a new subscriber subscribes to the `ReplaySubject` instance, it will synchronously emit all values in its buffer in\n * a First-In-First-Out (FIFO) manner. The `ReplaySubject` will also complete, if it has observed completion; and it will\n * error if it has observed an error.\n *\n * There are two main configuration items to be concerned with:\n *\n * 1. `bufferSize` - This will determine how many items are stored in the buffer, defaults to infinite.\n * 2. `windowTime` - The amount of time to hold a value in the buffer before removing it from the buffer.\n *\n * Both configurations may exist simultaneously. So if you would like to buffer a maximum of 3 values, as long as the values\n * are less than 2 seconds old, you could do so with a `new ReplaySubject(3, 2000)`.\n *\n * ### Differences with BehaviorSubject\n *\n * `BehaviorSubject` is similar to `new ReplaySubject(1)`, with a couple fo exceptions:\n *\n * 1. `BehaviorSubject` comes \"primed\" with a single value upon construction.\n * 2. `ReplaySubject` will replay values, even after observing an error, where `BehaviorSubject` will not.\n *\n * @see {@link Subject}\n * @see {@link BehaviorSubject}\n * @see {@link shareReplay}\n */\nexport class ReplaySubject<T> extends Subject<T> {\n private _buffer: (T | number)[] = [];\n private _infiniteTimeWindow = true;\n\n /**\n * @param bufferSize The size of the buffer to replay on subscription\n * @param windowTime The amount of time the buffered items will say buffered\n * @param timestampProvider An object with a `now()` method that provides the current timestamp. This is used to\n * calculate the amount of time something has been buffered.\n */\n constructor(\n private _bufferSize = Infinity,\n private _windowTime = Infinity,\n private _timestampProvider: TimestampProvider = dateTimestampProvider\n ) {\n super();\n this._infiniteTimeWindow = _windowTime === Infinity;\n this._bufferSize = Math.max(1, _bufferSize);\n this._windowTime = Math.max(1, _windowTime);\n }\n\n next(value: T): void {\n const { isStopped, _buffer, _infiniteTimeWindow, _timestampProvider, _windowTime } = this;\n if (!isStopped) {\n _buffer.push(value);\n !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);\n }\n this._trimBuffer();\n super.next(value);\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber<T>): Subscription {\n this._throwIfClosed();\n this._trimBuffer();\n\n const subscription = this._innerSubscribe(subscriber);\n\n const { _infiniteTimeWindow, _buffer } = this;\n // We use a copy here, so reentrant code does not mutate our array while we're\n // emitting it to a new subscriber.\n const copy = _buffer.slice();\n for (let i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {\n subscriber.next(copy[i] as T);\n }\n\n this._checkFinalizedStatuses(subscriber);\n\n return subscription;\n }\n\n private _trimBuffer() {\n const { _bufferSize, _timestampProvider, _buffer, _infiniteTimeWindow } = this;\n // If we don't have an infinite buffer size, and we're over the length,\n // use splice to truncate the old buffer values off. Note that we have to\n // double the size for instances where we're not using an infinite time window\n // because we're storing the values and the timestamps in the same array.\n const adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;\n _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);\n\n // Now, if we're not in an infinite time window, remove all values where the time is\n // older than what is allowed.\n if (!_infiniteTimeWindow) {\n const now = _timestampProvider.now();\n let last = 0;\n // Search the array for the first timestamp that isn't expired and\n // truncate the buffer up to that point.\n for (let i = 1; i < _buffer.length && (_buffer[i] as number) <= now; i += 2) {\n last = i;\n }\n last && _buffer.splice(0, last + 1);\n }\n }\n}\n","import { Scheduler } from '../Scheduler';\nimport { Subscription } from '../Subscription';\nimport { SchedulerAction } from '../types';\n\n/**\n * A unit of work to be executed in a `scheduler`. An action is typically\n * created from within a {@link SchedulerLike} and an RxJS user does not need to concern\n * themselves about creating and manipulating an Action.\n *\n * ```ts\n * class Action<T> extends Subscription {\n * new (scheduler: Scheduler, work: (state?: T) => void);\n * schedule(state?: T, delay: number = 0): Subscription;\n * }\n * ```\n *\n * @class Action<T>\n */\nexport class Action<T> extends Subscription {\n constructor(scheduler: Scheduler, work: (this: SchedulerAction<T>, state?: T) => void) {\n super();\n }\n /**\n * Schedules this action on its parent {@link SchedulerLike} for execution. May be passed\n * some context object, `state`. May happen at some point in the future,\n * according to the `delay` parameter, if specified.\n * @param {T} [state] Some contextual data that the `work` function uses when\n * called by the Scheduler.\n * @param {number} [delay] Time to wait before executing the work, where the\n * time unit is implicit and defined by the Scheduler.\n * @return {void}\n */\n public schedule(state?: T, delay: number = 0): Subscription {\n return this;\n }\n}\n","type SetIntervalFunction = (handler: () => void, timeout?: number, ...args: any[]) => number;\ntype ClearIntervalFunction = (handle: number) => void;\n\ninterface IntervalProvider {\n setInterval: SetIntervalFunction;\n clearInterval: ClearIntervalFunction;\n delegate:\n | {\n setInterval: SetIntervalFunction;\n clearInterval: ClearIntervalFunction;\n }\n | undefined;\n}\n\nexport const intervalProvider: IntervalProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n setInterval(...args) {\n const { delegate } = intervalProvider;\n return (delegate?.setInterval || setInterval)(...args);\n },\n clearInterval(handle) {\n const { delegate } = intervalProvider;\n return (delegate?.clearInterval || clearInterval)(handle);\n },\n delegate: undefined,\n};\n","import { Action } from './Action';\nimport { SchedulerAction } from '../types';\nimport { Subscription } from '../Subscription';\nimport { AsyncScheduler } from './AsyncScheduler';\nimport { intervalProvider } from './intervalProvider';\nimport { arrRemove } from '../util/arrRemove';\n\nexport class AsyncAction<T> extends Action<T> {\n public id: any;\n public state?: T;\n // @ts-ignore: Property has no initializer and is not definitely assigned\n public delay: number;\n protected pending: boolean = false;\n\n constructor(protected scheduler: AsyncScheduler, protected work: (this: SchedulerAction<T>, state?: T) => void) {\n super(scheduler, work);\n }\n\n public schedule(state?: T, delay: number = 0): Subscription {\n if (this.closed) {\n return this;\n }\n\n // Always replace the current state with the new state.\n this.state = state;\n\n const id = this.id;\n const scheduler = this.scheduler;\n\n //\n // Important implementation note:\n //\n // Actions only execute once by default, unless rescheduled from within the\n // scheduled callback. This allows us to implement single and repeat\n // actions via the same code path, without adding API surface area, as well\n // as mimic traditional recursion but across asynchronous boundaries.\n //\n // However, JS runtimes and timers distinguish between intervals achieved by\n // serial `setTimeout` calls vs. a single `setInterval` call. An interval of\n // serial `setTimeout` calls can be individually delayed, which delays\n // scheduling the next `setTimeout`, and so on. `setInterval` attempts to\n // guarantee the interval callback will be invoked more precisely to the\n // interval period, regardless of load.\n //\n // Therefore, we use `setInterval` to schedule single and repeat actions.\n // If the action reschedules itself with the same delay, the interval is not\n // canceled. If the action doesn't reschedule, or reschedules with a\n // different delay, the interval will be canceled after scheduled callback\n // execution.\n //\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, delay);\n }\n\n // Set the pending flag indicating that this action has been scheduled, or\n // has recursively rescheduled itself.\n this.pending = true;\n\n this.delay = delay;\n // If this action has already an async Id, don't request a new one.\n this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);\n\n return this;\n }\n\n protected requestAsyncId(scheduler: AsyncScheduler, _id?: any, delay: number = 0): any {\n return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);\n }\n\n protected recycleAsyncId(_scheduler: AsyncScheduler, id: any, delay: number | null = 0): any {\n // If this action is rescheduled with the same delay time, don't clear the interval id.\n if (delay != null && this.delay === delay && this.pending === false) {\n return id;\n }\n // Otherwise, if the action's delay time is different from the current delay,\n // or the action has been rescheduled before it's executed, clear the interval id\n intervalProvider.clearInterval(id);\n return undefined;\n }\n\n /**\n * Immediately executes this action and the `work` it contains.\n * @return {any}\n */\n public execute(state: T, delay: number): any {\n if (this.closed) {\n return new Error('executing a cancelled action');\n }\n\n this.pending = false;\n const error = this._execute(state, delay);\n if (error) {\n return error;\n } else if (this.pending === false && this.id != null) {\n // Dequeue if the action didn't reschedule itself. Don't call\n // unsubscribe(), because the action could reschedule later.\n // For example:\n // ```\n // scheduler.schedule(function doWork(counter) {\n // /* ... I'm a busy worker bee ... */\n // var originalAction = this;\n // /* wait 100ms before rescheduling the action */\n // setTimeout(function () {\n // originalAction.schedule(counter + 1);\n // }, 100);\n // }, 1000);\n // ```\n this.id = this.recycleAsyncId(this.scheduler, this.id, null);\n }\n }\n\n protected _execute(state: T, _delay: number): any {\n let errored: boolean = false;\n let errorValue: any;\n try {\n this.work(state);\n } catch (e) {\n errored = true;\n errorValue = (!!e && e) || new Error(e);\n }\n if (errored) {\n this.unsubscribe();\n return errorValue;\n }\n }\n\n unsubscribe() {\n if (!this.closed) {\n const { id, scheduler } = this;\n const { actions } = scheduler;\n\n this.work = this.state = this.scheduler = null!;\n this.pending = false;\n\n arrRemove(actions, this);\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, null);\n }\n\n this.delay = null!;\n super.unsubscribe();\n }\n }\n}\n","import { Action } from './scheduler/Action';\nimport { Subscription } from './Subscription';\nimport { SchedulerLike, SchedulerAction } from './types';\nimport { dateTimestampProvider } from './scheduler/dateTimestampProvider';\n\n/**\n * An execution context and a data structure to order tasks and schedule their\n * execution. Provides a notion of (potentially virtual) time, through the\n * `now()` getter method.\n *\n * Each unit of work in a Scheduler is called an `Action`.\n *\n * ```ts\n * class Scheduler {\n * now(): number;\n * schedule(work, delay?, state?): Subscription;\n * }\n * ```\n *\n * @class Scheduler\n * @deprecated Scheduler is an internal implementation detail of RxJS, and\n * should not be used directly. Rather, create your own class and implement\n * {@link SchedulerLike}. Will be made internal in v8.\n */\nexport class Scheduler implements SchedulerLike {\n public static now: () => number = dateTimestampProvider.now;\n\n constructor(private schedulerActionCtor: typeof Action, now: () => number = Scheduler.now) {\n this.now = now;\n }\n\n /**\n * A getter method that returns a number representing the current time\n * (at the time this function was called) according to the scheduler's own\n * internal clock.\n * @return {number} A number that represents the current time. May or may not\n * have a relation to wall-clock time. May or may not refer to a time unit\n * (e.g. milliseconds).\n */\n public now: () => number;\n\n /**\n * Schedules a function, `work`, for execution. May happen at some point in\n * the future, according to the `delay` parameter, if specified. May be passed\n * some context object, `state`, which will be passed to the `work` function.\n *\n * The given arguments will be processed an stored as an Action object in a\n * queue of actions.\n *\n * @param {function(state: ?T): ?Subscription} work A function representing a\n * task, or some unit of work to be executed by the Scheduler.\n * @param {number} [delay] Time to wait before executing the work, where the\n * time unit is implicit and defined by the Scheduler itself.\n * @param {T} [state] Some contextual data that the `work` function uses when\n * called by the Scheduler.\n * @return {Subscription} A subscription in order to be able to unsubscribe\n * the scheduled work.\n */\n public schedule<T>(work: (this: SchedulerAction<T>, state?: T) => void, delay: number = 0, state?: T): Subscription {\n return new this.schedulerActionCtor<T>(this, work).schedule(state, delay);\n }\n}\n","import { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\n\n/**\n *\n * Async Scheduler\n *\n * <span class=\"informal\">Schedule task as if you used setTimeout(task, duration)</span>\n *\n * `async` scheduler schedules tasks asynchronously, by putting them on the JavaScript\n * event loop queue. It is best used to delay tasks in time or to schedule tasks repeating\n * in intervals.\n *\n * If you just want to \"defer\" task, that is to perform it right after currently\n * executing synchronous code ends (commonly achieved by `setTimeout(deferredTask, 0)`),\n * better choice will be the {@link asapScheduler} scheduler.\n *\n * ## Examples\n * Use async scheduler to delay task\n * ```ts\n * import { asyncScheduler } from 'rxjs';\n *\n * const task = () => console.log('it works!');\n *\n * asyncScheduler.schedule(task, 2000);\n *\n * // After 2 seconds logs:\n * // \"it works!\"\n * ```\n *\n * Use async scheduler to repeat task in intervals\n * ```ts\n * import { asyncScheduler } from 'rxjs';\n *\n * function task(state) {\n * console.log(state);\n * this.schedule(state + 1, 1000); // `this` references currently executing Action,\n * // which we reschedule with new state and delay\n * }\n *\n * asyncScheduler.schedule(task, 3000, 0);\n *\n * // Logs:\n * // 0 after 3s\n * // 1 after 4s\n * // 2 after 5s\n * // 3 after 6s\n * ```\n */\n\nexport const asyncScheduler = new AsyncScheduler(AsyncAction);\n\n/**\n * @deprecated Renamed to {@link asyncScheduler}. Will be removed in v8.\n */\nexport const async = asyncScheduler;\n","import { Scheduler } from '../Scheduler';\nimport { Action } from './Action';\nimport { AsyncAction } from './AsyncAction';\n\nexport class AsyncScheduler extends Scheduler {\n public actions: Array<AsyncAction<any>> = [];\n /**\n * A flag to indicate whether the Scheduler is currently executing a batch of\n * queued actions.\n * @type {boolean}\n * @internal\n */\n public _active: boolean = false;\n /**\n * An internal ID used to track the latest asynchronous task such as those\n * coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and\n * others.\n * @type {any}\n * @internal\n */\n public _scheduled: any = undefined;\n\n constructor(SchedulerAction: typeof Action, now: () => number = Scheduler.now) {\n super(SchedulerAction, now);\n }\n\n public flush(action: AsyncAction<any>): void {\n const { actions } = this;\n\n if (this._active) {\n actions.push(action);\n return;\n }\n\n let error: any;\n this._active = true;\n\n do {\n if ((error = action.execute(action.state, action.delay))) {\n break;\n }\n } while ((action = actions.shift()!)); // exhaust the scheduler queue\n\n this._active = false;\n\n if (error) {\n while ((action = actions.shift()!)) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n","import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\n\n/**\n * The same Observable instance returned by any call to {@link empty} without a\n * `scheduler`. It is preferable to use this over `empty()`.\n *\n * <span class=\"informal\">Just emits 'complete', and nothing else.</span>\n *\n * ![](empty.png)\n *\n * ## Examples\n *\n * ### Log complete notification\n *\n * ```ts\n * import { EMPTY } from 'rxjs';\n *\n * EMPTY.subscribe({\n * next: () => console.log('Next'),\n * complete: () => console.log('Complete!')\n * });\n *\n * // Outputs\n * // Complete!\n * ```\n */\nexport const EMPTY = new Observable<never>((subscriber) => subscriber.complete());\n\n/**\n * Creates an Observable that emits no items to the Observer and immediately\n * emits a complete notification.\n *\n * <span class=\"informal\">Just emits 'complete', and nothing else.</span>\n *\n * ![](empty.png)\n *\n * This static operator is useful for creating a simple Observable that only\n * emits the complete notification. It can be used for composing with other\n * Observables, such as in a {@link mergeMap}.\n *\n * ## Examples\n *\n * ### Emit the number 7, then complete\n *\n * ```ts\n * import { empty } from 'rxjs';\n * import { startWith } from 'rxjs/operators';\n *\n * const result = empty().pipe(startWith(7));\n * result.subscribe(x => console.log(x));\n *\n * // Outputs\n * // 7\n * ```\n *\n * ### Map and flatten only odd numbers to the sequence 'a', 'b', 'c'\n *\n * ```ts\n * import { empty, interval, of } from 'rxjs';\n * import { mergeMap } from 'rxjs/operators';\n *\n * const interval$ = interval(1000);\n * const result = interval$.pipe(\n * mergeMap(x => x % 2 === 1 ? of('a', 'b', 'c') : empty()),\n * );\n * result.subscribe(x => console.log(x));\n *\n * // Results in the following to the console:\n * // x is equal to the count on the interval, e.g. (0, 1, 2, 3, ...)\n * // x will occur every 1000ms\n * // if x % 2 is equal to 1, print a, b, c (each on its own)\n * // if x % 2 is not equal to 1, nothing will be output\n * ```\n *\n * @see {@link Observable}\n * @see {@link never}\n * @see {@link of}\n * @see {@link throwError}\n *\n * @param scheduler A {@link SchedulerLike} to use for scheduling\n * the emission of the complete notification.\n * @return An \"empty\" Observable: emits only the complete\n * notification.\n * @deprecated Replaced with the {@link EMPTY} constant or {@link scheduled} (e.g. `scheduled([], scheduler)`). Will be removed in v8.\n */\nexport function empty(scheduler?: SchedulerLike) {\n return scheduler ? emptyScheduled(scheduler) : EMPTY;\n}\n\nfunction emptyScheduled(scheduler: SchedulerLike) {\n return new Observable<never>((subscriber) => scheduler.schedule(() => subscriber.complete()));\n}\n","import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\n\nexport function scheduleArray<T>(input: ArrayLike<T>, scheduler: SchedulerLike) {\n return new Observable<T>((subscriber) => {\n // The current array index.\n let i = 0;\n // Start iterating over the array like on a schedule.\n return scheduler.schedule(function () {\n if (i === input.length) {\n // If we have hit the end of the array like in the\n // previous job, we can complete.\n subscriber.complete();\n } else {\n // Otherwise let's next the value at the current index,\n // then increment our index.\n subscriber.next(input[i++]);\n // If the last emission didn't cause us to close the subscriber\n // (via take or some side effect), reschedule the job and we'll\n // make another pass.\n if (!subscriber.closed) {\n this.schedule();\n }\n }\n });\n });\n}\n","export const isArrayLike = (<T>(x: any): x is ArrayLike<T> => x && typeof x.length === 'number' && typeof x !== 'function');","import { isFunction } from \"./isFunction\";\n\n/**\n * Tests to see if the object is \"thennable\".\n * @param value the object to test\n */\nexport function isPromise(value: any): value is PromiseLike<any> {\n return isFunction(value?.then);\n}\n","export function getSymbolIterator(): symbol {\n if (typeof Symbol !== 'function' || !Symbol.iterator) {\n return '@@iterator' as any;\n }\n\n return Symbol.iterator;\n}\n\nexport const iterator = getSymbolIterator();\n","import { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { SchedulerAction, SchedulerLike } from '../types';\n\nexport function caughtSchedule(\n subscriber: Subscriber<any>,\n scheduler: SchedulerLike,\n execute: (this: SchedulerAction<any>) => void,\n delay = 0\n): Subscription {\n const subscription = scheduler.schedule(function () {\n try {\n execute.call(this);\n } catch (err) {\n subscriber.error(err);\n }\n }, delay);\n subscriber.add(subscription);\n return subscription;\n}\n","import { SchedulerLike } from '../types';\nimport { Observable } from '../Observable';\nimport { Subscription } from '../Subscription';\n\nexport function scheduleAsyncIterable<T>(input: AsyncIterable<T>, scheduler: SchedulerLike) {\n if (!input) {\n throw new Error('Iterable cannot be null');\n }\n return new Observable<T>(subscriber => {\n const sub = new Subscription();\n sub.add(\n scheduler.schedule(() => {\n const iterator = input[Symbol.asyncIterator]();\n sub.add(scheduler.schedule(function () {\n iterator.next().then(result => {\n if (result.done) {\n subscriber.complete();\n } else {\n subscriber.next(result.value);\n this.schedule();\n }\n });\n }));\n })\n );\n return sub;\n });\n}\n","import { InteropObservable } from '../types';\nimport { observable as Symbol_observable } from '../symbol/observable';\nimport { isFunction } from './isFunction';\n\n/** Identifies an input as being Observable (but not necessary an Rx Observable) */\nexport function isInteropObservable(input: any): input is InteropObservable<any> {\n return isFunction(input[Symbol_observable]);\n}\n","import { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { isFunction } from './isFunction';\n\n/** Identifies an input as being an Iterable */\nexport function isIterable(input: any): input is Iterable<any> {\n return isFunction(input?.[Symbol_iterator]);\n}\n","import { isFunction } from './isFunction';\n\nexport function isAsyncIterable<T>(obj: any): obj is AsyncIterable<T> {\n return Symbol.asyncIterator && isFunction(obj?.[Symbol.asyncIterator]);\n}\n","/**\n * Creates the TypeError to throw if an invalid object is passed to `from` or `scheduled`.\n * @param input The object that was passed.\n */\nexport function createInvalidObservableTypeError(input: any) {\n // TODO: We should create error codes that can be looked up, so this can be less verbose.\n return new TypeError(\n `You provided ${\n input !== null && typeof input === 'object' ? 'an invalid object' : `'${input}'`\n } where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`\n );\n}\n","import { ReadableStreamLike } from '../types';\nimport { isFunction } from './isFunction';\n\nexport async function* readableStreamLikeToAsyncGenerator<T>(readableStream: ReadableStreamLike<T>): AsyncGenerator<T> {\n const reader = readableStream.getReader();\n try {\n while (true) {\n const { value, done } = await reader.read();\n if (done) {\n return;\n }\n yield value!;\n }\n } finally {\n reader.releaseLock();\n }\n}\n\nexport function isReadableStreamLike<T>(obj: any): obj is ReadableStreamLike<T> {\n // We don't want to use instanceof checks because they would return\n // false for instances from another Realm, like an <iframe>.\n return isFunction(obj?.getReader);\n}\n","import { scheduleObservable } from './scheduleObservable';\nimport { schedulePromise } from './schedulePromise';\nimport { scheduleArray } from './scheduleArray';\nimport { scheduleIterable } from './scheduleIterable';\nimport { scheduleAsyncIterable } from './scheduleAsyncIterable';\nimport { isInteropObservable } from '../util/isInteropObservable';\nimport { isPromise } from '../util/isPromise';\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isIterable } from '../util/isIterable';\nimport { ObservableInput, SchedulerLike } from '../types';\nimport { Observable } from '../Observable';\nimport { isAsyncIterable } from '../util/isAsyncIterable';\nimport { createInvalidObservableTypeError } from '../util/throwUnobservableError';\nimport { isReadableStreamLike } from '../util/isReadableStreamLike';\nimport { scheduleReadableStreamLike } from './scheduleReadableStreamLike';\n\n/**\n * Converts from a common {@link ObservableInput} type to an observable where subscription and emissions\n * are scheduled on the provided scheduler.\n *\n * @see {@link from}\n * @see {@link of}\n *\n * @param input The observable, array, promise, iterable, etc you would like to schedule\n * @param scheduler The scheduler to use to schedule the subscription and emissions from\n * the returned observable.\n */\nexport function scheduled<T>(input: ObservableInput<T>, scheduler: SchedulerLike): Observable<T> {\n if (input != null) {\n if (isInteropObservable(input)) {\n return scheduleObservable(input, scheduler);\n }\n if (isArrayLike(input)) {\n return scheduleArray(input, scheduler);\n }\n if (isPromise(input)) {\n return schedulePromise(input, scheduler);\n }\n if (isAsyncIterable(input)) {\n return scheduleAsyncIterable(input, scheduler);\n }\n if (isIterable(input)) {\n return scheduleIterable(input, scheduler);\n }\n if (isReadableStreamLike(input)) {\n return scheduleReadableStreamLike(input, scheduler);\n }\n }\n throw createInvalidObservableTypeError(input);\n}\n","import { Observable } from '../Observable';\nimport { Subscription } from '../Subscription';\nimport { observable as Symbol_observable } from '../symbol/observable';\nimport { InteropObservable, SchedulerLike, Subscribable } from '../types';\n\nexport function scheduleObservable<T>(input: InteropObservable<T>, scheduler: SchedulerLike) {\n return new Observable<T>(subscriber => {\n const sub = new Subscription();\n sub.add(scheduler.schedule(() => {\n const observable: Subscribable<T> = (input as any)[Symbol_observable]();\n sub.add(observable.subscribe({\n next(value) { sub.add(scheduler.schedule(() => subscriber.next(value))); },\n error(err) { sub.add(scheduler.schedule(() => subscriber.error(err))); },\n complete() { sub.add(scheduler.schedule(() => subscriber.complete())); },\n }));\n }));\n return sub;\n });\n}\n","import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\n\nexport function schedulePromise<T>(input: PromiseLike<T>, scheduler: SchedulerLike) {\n return new Observable<T>((subscriber) => {\n return scheduler.schedule(() =>\n input.then(\n (value) => {\n subscriber.add(\n scheduler.schedule(() => {\n subscriber.next(value);\n subscriber.add(scheduler.schedule(() => subscriber.complete()));\n })\n );\n },\n (err) => {\n subscriber.add(scheduler.schedule(() => subscriber.error(err)));\n }\n )\n );\n });\n}\n","import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\nimport { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { isFunction } from '../util/isFunction';\nimport { caughtSchedule } from '../util/caughtSchedule';\n\n/**\n * Used in {@link scheduled} to create an observable from an Iterable.\n * @param input The iterable to create an observable from\n * @param scheduler The scheduler to use\n */\nexport function scheduleIterable<T>(input: Iterable<T>, scheduler: SchedulerLike) {\n return new Observable<T>((subscriber) => {\n let iterator: Iterator<T, T>;\n\n // Schedule the initial creation of the iterator from\n // the iterable. This is so the code in the iterable is\n // not called until the scheduled job fires.\n subscriber.add(\n scheduler.schedule(() => {\n // Create the iterator.\n iterator = (input as any)[Symbol_iterator]();\n\n // Schedule the first iteration and emission.\n caughtSchedule(subscriber, scheduler, function () {\n // Pull the value out of the iterator\n const { value, done } = iterator.next();\n if (done) {\n // If it is \"done\" we just complete. This mimics the\n // behavior of JavaScript's `for..of` consumption of\n // iterables, which will not emit the value from an iterator\n // result of `{ done: true: value: 'here' }`.\n subscriber.complete();\n } else {\n // The iterable is not done, emit the value.\n subscriber.next(value);\n // Reschedule. This will cause this function to be\n // called again on the same scheduled delay.\n this.schedule();\n }\n });\n })\n );\n\n // During teardown, if we see this iterator has a `return` method,\n // then we know it is a Generator, and not just an Iterator. So we call\n // the `return()` function. This will ensure that any `finally { }` blocks\n // inside of the generator we can hit will be hit properly.\n return () => isFunction(iterator?.return) && iterator.return();\n });\n}\n","import { SchedulerLike, ReadableStreamLike } from '../types';\nimport { Observable } from '../Observable';\nimport { scheduleAsyncIterable } from './scheduleAsyncIterable';\nimport { readableStreamLikeToAsyncGenerator } from '../util/isReadableStreamLike';\n\nexport function scheduleReadableStreamLike<T>(input: ReadableStreamLike<T>, scheduler: SchedulerLike): Observable<T> {\n return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);\n}\n","import { isArrayLike } from '../util/isArrayLike';\nimport { isPromise } from '../util/isPromise';\nimport { observable as Symbol_observable } from '../symbol/observable';\nimport { Subscriber } from '../Subscriber';\n\nimport { Observable } from '../Observable';\nimport { ObservableInput, SchedulerLike, ObservedValueOf, ReadableStreamLike } from '../types';\nimport { scheduled } from '../scheduled/scheduled';\nimport { isFunction } from '../util/isFunction';\nimport { reportUnhandledError } from '../util/reportUnhandledError';\nimport { isInteropObservable } from '../util/isInteropObservable';\nimport { isAsyncIterable } from '../util/isAsyncIterable';\nimport { createInvalidObservableTypeError } from '../util/throwUnobservableError';\nimport { isIterable } from '../util/isIterable';\nimport { isReadableStreamLike, readableStreamLikeToAsyncGenerator } from '../util/isReadableStreamLike';\n\nexport function from<O extends ObservableInput<any>>(input: O): Observable<ObservedValueOf<O>>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function from<O extends ObservableInput<any>>(input: O, scheduler: SchedulerLike): Observable<ObservedValueOf<O>>;\n\n/**\n * Creates an Observable from an Array, an array-like object, a Promise, an iterable object, or an Observable-like object.\n *\n * <span class=\"informal\">Converts almost anything to an Observable.</span>\n *\n * ![](from.png)\n *\n * `from` converts various other objects and data types into Observables. It also converts a Promise, an array-like, or an\n * <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable\" target=\"_blank\">iterable</a>\n * object into an Observable that emits the items in that promise, array, or iterable. A String, in this context, is treated\n * as an array of characters. Observable-like objects (contains a function named with the ES2015 Symbol for Observable) can also be\n * converted through this operator.\n *\n * ## Examples\n *\n * ### Converts an array to an Observable\n *\n * ```ts\n * import { from } from 'rxjs';\n *\n * const array = [10, 20, 30];\n * const result = from(array);\n *\n * result.subscribe(x => console.log(x));\n *\n * // Logs:\n * // 10\n * // 20\n * // 30\n * ```\n *\n * ---\n *\n * ### Convert an infinite iterable (from a generator) to an Observable\n *\n * ```ts\n * import { from } from 'rxjs';\n * import { take } from 'rxjs/operators';\n *\n * function* generateDoubles(seed) {\n * let i = seed;\n * while (true) {\n * yield i;\n * i = 2 * i; // double it\n * }\n * }\n *\n * const iterator = generateDoubles(3);\n * const result = from(iterator).pipe(take(10));\n *\n * result.subscribe(x => console.log(x));\n *\n * // Logs:\n * // 3\n * // 6\n * // 12\n * // 24\n * // 48\n * // 96\n * // 192\n * // 384\n * // 768\n * // 1536\n * ```\n *\n * ---\n *\n * ### With async scheduler\n *\n * ```ts\n * import { from, asyncScheduler } from 'rxjs';\n *\n * console.log('start');\n *\n * const array = [10, 20, 30];\n * const result = from(array, asyncScheduler);\n *\n * result.subscribe(x => console.log(x));\n *\n * console.log('end');\n *\n * // Logs:\n * // start\n * // end\n * // 10\n * // 20\n * // 30\n * ```\n *\n * @see {@link fromEvent}\n * @see {@link fromEventPattern}\n *\n * @param {ObservableInput<T>} A subscription object, a Promise, an Observable-like,\n * an Array, an iterable, or an array-like object to be converted.\n * @param {SchedulerLike} An optional {@link SchedulerLike} on which to schedule the emission of values.\n * @return {Observable<T>}\n */\nexport function from<T>(input: ObservableInput<T>, scheduler?: SchedulerLike): Observable<T> {\n return scheduler ? scheduled(input, scheduler) : innerFrom(input);\n}\n\n// TODO: Use this throughout the library, rather than the `from` above, to avoid\n// the unnecessary scheduling check and reduce bundled sizes of operators that use `from`.\n// TODO: Eventually, this just becomes `from`, as we don't have the deprecated scheduled path anymore.\nexport function innerFrom<T>(input: ObservableInput<T>): Observable<T> {\n if (input instanceof Observable) {\n return input;\n }\n if (input != null) {\n if (isInteropObservable(input)) {\n return fromInteropObservable(input);\n }\n if (isArrayLike(input)) {\n return fromArrayLike(input);\n }\n if (isPromise(input)) {\n return fromPromise(input);\n }\n if (isAsyncIterable(input)) {\n return fromAsyncIterable(input);\n }\n if (isIterable(input)) {\n return fromIterable(input);\n }\n if (isReadableStreamLike(input)) {\n return fromReadableStreamLike(input);\n }\n }\n\n throw createInvalidObservableTypeError(input);\n}\n\n/**\n * Creates an RxJS Observable from an object that implements `Symbol.observable`.\n * @param obj An object that properly implements `Symbol.observable`.\n */\nfunction fromInteropObservable<T>(obj: any) {\n return new Observable((subscriber: Subscriber<T>) => {\n const obs = obj[Symbol_observable]();\n if (isFunction(obs.subscribe)) {\n return obs.subscribe(subscriber);\n }\n // Should be caught by observable subscribe function error handling.\n throw new TypeError('Provided object does not correctly implement Symbol.observable');\n });\n}\n\n/**\n * Synchronously emits the values of an array like and completes.\n * This is exported because there are creation functions and operators that need to\n * make direct use of the same logic, and there's no reason to make them run through\n * `from` conditionals because we *know* they're dealing with an array.\n * @param array The array to emit values from\n */\nexport function fromArrayLike<T>(array: ArrayLike<T>) {\n return new Observable((subscriber: Subscriber<T>) => {\n // Loop over the array and emit each value. Note two things here:\n // 1. We're making sure that the subscriber is not closed on each loop.\n // This is so we don't continue looping over a very large array after\n // something like a `take`, `takeWhile`, or other synchronous unsubscription\n // has already unsubscribed.\n // 2. In this form, reentrant code can alter that array we're looping over.\n // This is a known issue, but considered an edge case. The alternative would\n // be to copy the array before executing the loop, but this has\n // performance implications.\n for (let i = 0; i < array.length && !subscriber.closed; i++) {\n subscriber.next(array[i]);\n }\n subscriber.complete();\n });\n}\n\nfunction fromPromise<T>(promise: PromiseLike<T>) {\n return new Observable((subscriber: Subscriber<T>) => {\n promise\n .then(\n (value) => {\n if (!subscriber.closed) {\n subscriber.next(value);\n subscriber.complete();\n }\n },\n (err: any) => subscriber.error(err)\n )\n .then(null, reportUnhandledError);\n });\n}\n\nfunction fromIterable<T>(iterable: Iterable<T>) {\n return new Observable((subscriber: Subscriber<T>) => {\n for (const value of iterable) {\n subscriber.next(value);\n if (subscriber.closed) {\n return;\n }\n }\n subscriber.complete();\n });\n}\n\nfunction fromAsyncIterable<T>(asyncIterable: AsyncIterable<T>) {\n return new Observable((subscriber: Subscriber<T>) => {\n process(asyncIterable, subscriber).catch((err) => subscriber.error(err));\n });\n}\n\nfunction fromReadableStreamLike<T>(readableStream: ReadableStreamLike<T>) {\n return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));\n}\n\nasync function process<T>(asyncIterable: AsyncIterable<T>, subscriber: Subscriber<T>) {\n for await (const value of asyncIterable) {\n subscriber.next(value);\n // A side-effect may have closed our subscriber,\n // check before the next iteration.\n if (subscriber.closed) {\n return;\n }\n }\n subscriber.complete();\n}\n","import { SchedulerLike } from '../types';\nimport { scheduleArray } from '../scheduled/scheduleArray';\nimport { fromArrayLike } from './from';\n\nexport function internalFromArray<T>(input: ArrayLike<T>, scheduler?: SchedulerLike) {\n return scheduler ? scheduleArray(input, scheduler) : fromArrayLike(input);\n}\n","import { SchedulerLike } from '../types';\nimport { isFunction } from './isFunction';\n\nexport function isScheduler(value: any): value is SchedulerLike {\n return value && isFunction(value.schedule);\n}\n","import { SchedulerLike } from '../types';\nimport { isFunction } from './isFunction';\nimport { isScheduler } from './isScheduler';\n\nfunction last<T>(arr: T[]): T | undefined {\n return arr[arr.length - 1];\n}\n\nexport function popResultSelector(args: any[]): ((...args: unknown[]) => unknown) | undefined {\n return isFunction(last(args)) ? args.pop() : undefined;\n}\n\nexport function popScheduler(args: any[]): SchedulerLike | undefined {\n return isScheduler(last(args)) ? args.pop() : undefined;\n}\n\nexport function popNumber(args: any[], defaultValue: number): number {\n return typeof last(args) === 'number' ? args.pop()! : defaultValue;\n}\n","import { SchedulerLike, ValueFromArray } from '../types';\nimport { internalFromArray } from './fromArray';\nimport { Observable } from '../Observable';\nimport { scheduleArray } from '../scheduled/scheduleArray';\nimport { popScheduler } from '../util/args';\n\n// Devs are more likely to pass null or undefined than they are a scheduler\n// without accompanying values. To make things easier for (naughty) devs who\n// use the `strictNullChecks: false` TypeScript compiler option, these\n// overloads with explicit null and undefined values are included.\n\nexport function of(value: null): Observable<null>;\nexport function of(value: undefined): Observable<undefined>;\n\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function of(scheduler: SchedulerLike): Observable<never>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function of<A extends readonly unknown[]>(...valuesAndScheduler: [...A, SchedulerLike]): Observable<ValueFromArray<A>>;\n\nexport function of(): Observable<never>;\n/** @deprecated Do not specify explicit type parameters. Signatures with type parameters that cannot be inferred will be removed in v8. */\nexport function of<T>(): Observable<T>;\nexport function of<T>(value: T): Observable<T>;\nexport function of<A extends readonly unknown[]>(...values: A): Observable<ValueFromArray<A>>;\n\n/**\n * Converts the arguments to an observable sequence.\n *\n * <span class=\"informal\">Each argument becomes a `next` notification.</span>\n *\n * ![](of.png)\n *\n * Unlike {@link from}, it does not do any flattening and emits each argument in whole\n * as a separate `next` notification.\n *\n * ## Examples\n *\n * Emit the values `10, 20, 30`\n *\n * ```ts\n * import { of } from 'rxjs';\n *\n * of(10, 20, 30)\n * .subscribe(\n * next => console.log('next:', next),\n * err => console.log('error:', err),\n * () => console.log('the end'),\n * );\n *\n * // Outputs\n * // next: 10\n * // next: 20\n * // next: 30\n * // the end\n * ```\n *\n * Emit the array `[1, 2, 3]`\n *\n * ```ts\n * import { of } from 'rxjs';\n *\n * of([1, 2, 3])\n * .subscribe(\n * next => console.log('next:', next),\n * err => console.log('error:', err),\n * () => console.log('the end'),\n * );\n *\n * // Outputs\n * // next: [1, 2, 3]\n * // the end\n * ```\n *\n * @see {@link from}\n * @see {@link range}\n *\n * @param {...T} values A comma separated list of arguments you want to be emitted\n * @return {Observable} An Observable that emits the arguments\n * described above and then completes.\n */\nexport function of<T>(...args: Array<T | SchedulerLike>): Observable<T> {\n const scheduler = popScheduler(args);\n return scheduler ? scheduleArray(args as T[], scheduler) : internalFromArray(args as T[]);\n}\n","import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { SchedulerLike } from '../types';\nimport { isFunction } from '../util/isFunction';\n\n/**\n * Creates an observable that will create an error instance and push it to the consumer as an error\n * immediately upon subscription.\n *\n * <span class=\"informal\">Just errors and does nothing else</span>\n *\n * ![](throw.png)\n *\n * This creation function is useful for creating an observable that will create an error and error every\n * time it is subscribed to. Generally, inside of most operators when you might want to return an errored\n * observable, this is unnecessary. In most cases, such as in the inner return of {@link concatMap},\n * {@link mergeMap}, {@link defer}, and many others, you can simply throw the error, and RxJS will pick\n * that up and notify the consumer of the error.\n *\n * ## Example\n *\n * Create a simple observable that will create a new error with a timestamp and log it\n * and the message every time you subscribe to it.\n *\n * ```ts\n * import { throwError } from 'rxjs';\n *\n * let errorCount = 0;\n *\n * const errorWithTimestamp$ = throwError(() => {\n * const error: any = new Error(`This is error number ${++errorCount}`);\n * error.timestamp = Date.now();\n * return error;\n * });\n *\n * errorWithTimestamp$.subscribe({\n * error: err => console.log(err.timestamp, err.message)\n * });\n *\n * errorWithTimestamp$.subscribe({\n * error: err => console.log(err.timestamp, err.message)\n * });\n *\n * // Logs the timestamp and a new error message each subscription;\n * ```\n *\n * ## Unnecessary usage\n *\n * Using `throwError` inside of an operator or creation function\n * with a callback, is usually not necessary:\n *\n * ```ts\n * import { throwError, timer, of } from 'rxjs';\n * import { concatMap } from 'rxjs/operators';\n *\n * const delays$ = of(1000, 2000, Infinity, 3000);\n *\n * delays$.pipe(\n * concatMap(ms => {\n * if (ms < 10000) {\n * return timer(ms);\n * } else {\n * // This is probably overkill.\n * return throwError(() => new Error(`Invalid time ${ms}`));\n * }\n * })\n * )\n * .subscribe({\n * next: console.log,\n * error: console.error\n * });\n * ```\n *\n * You can just throw the error instead:\n *\n * ```ts\n * import { throwError, timer, of } from 'rxjs';\n * import { concatMap } from 'rxjs/operators';\n *\n * const delays$ = of(1000, 2000, Infinity, 3000);\n *\n * delays$.pipe(\n * concatMap(ms => {\n * if (ms < 10000) {\n * return timer(ms);\n * } else {\n * // Cleaner and easier to read for most folks.\n * throw new Error(`Invalid time ${ms}`);\n * }\n * })\n * )\n * .subscribe({\n * next: console.log,\n * error: console.error\n * });\n * ```\n *\n * @param errorFactory A factory function that will create the error instance that is pushed.\n */\nexport function throwError(errorFactory: () => any): Observable<never>;\n\n/**\n * Returns an observable that will error with the specified error immediately upon subscription.\n *\n * @param error The error instance to emit\n * @deprecated Support for passing an error value will be removed in v8. Instead, pass a factory function to `throwError(() => new Error('test'))`. This is\n * because it will create the error at the moment it should be created and capture a more appropriate stack trace. If\n * for some reason you need to create the error ahead of time, you can still do that: `const err = new Error('test'); throwError(() => err);`.\n */\nexport function throwError(error: any): Observable<never>;\n\n/**\n * Notifies the consumer of an error using a given scheduler by scheduling it at delay `0` upon subscription.\n *\n * @param errorOrErrorFactory An error instance or error factory\n * @param scheduler A scheduler to use to schedule the error notification\n * @deprecated The `scheduler` parameter will be removed in v8.\n * Use `throwError` in combination with {@link observeOn}: `throwError(() => new Error('test')).pipe(observeOn(scheduler));`.\n * Details: https://rxjs.dev/deprecations/scheduler-argument\n */\nexport function throwError(errorOrErrorFactory: any, scheduler: SchedulerLike): Observable<never>;\n\nexport function throwError(errorOrErrorFactory: any, scheduler?: SchedulerLike): Observable<never> {\n const errorFactory = isFunction(errorOrErrorFactory) ? errorOrErrorFactory : () => errorOrErrorFactory;\n const init = (subscriber: Subscriber<never>) => subscriber.error(errorFactory());\n return new Observable(scheduler ? (subscriber) => scheduler.schedule(init as any, 0, subscriber) : init);\n}\n","import { createErrorClass } from './createErrorClass';\n\nexport interface EmptyError extends Error {}\n\nexport interface EmptyErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (): EmptyError;\n}\n\n/**\n * An error thrown when an Observable or a sequence was queried but has no\n * elements.\n *\n * @see {@link first}\n * @see {@link last}\n * @see {@link single}\n * @see {@link firstValueFrom}\n * @see {@link lastValueFrom}\n *\n * @class EmptyError\n */\nexport const EmptyError: EmptyErrorCtor = createErrorClass((_super) => function EmptyErrorImpl(this: any) {\n _super(this);\n this.name = 'EmptyError';\n this.message = 'no elements in sequence';\n});\n","/**\n * Checks to see if a value is not only a `Date` object,\n * but a *valid* `Date` object that can be converted to a\n * number. For example, `new Date('blah')` is indeed an\n * `instanceof Date`, however it cannot be converted to a\n * number.\n */\nexport function isValidDate(value: any): value is Date {\n return value instanceof Date && !isNaN(value as any);\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { MonoTypeOperatorFunction, SchedulerLike, OperatorFunction, ObservableInput, ObservedValueOf } from '../types';\nimport { isValidDate } from '../util/isDate';\nimport { Subscription } from '../Subscription';\nimport { operate } from '../util/lift';\nimport { Observable } from '../Observable';\nimport { innerFrom } from '../observable/from';\nimport { createErrorClass } from '../util/createErrorClass';\nimport { caughtSchedule } from '../util/caughtSchedule';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\nexport interface TimeoutConfig<T, O extends ObservableInput<unknown> = ObservableInput<T>, M = unknown> {\n /**\n * The time allowed between values from the source before timeout is triggered.\n */\n each?: number;\n\n /**\n * The relative time as a `number` in milliseconds, or a specific time as a `Date` object,\n * by which the first value must arrive from the source before timeout is triggered.\n */\n first?: number | Date;\n\n /**\n * The scheduler to use with time-related operations within this operator. Defaults to {@link asyncScheduler}\n */\n scheduler?: SchedulerLike;\n\n /**\n * A factory used to create observable to switch to when timeout occurs. Provides\n * some information about the source observable's emissions and what delay or\n * exact time triggered the timeout.\n */\n with?: (info: TimeoutInfo<T, M>) => O;\n\n /**\n * Optional additional metadata you can provide to code that handles\n * the timeout, will be provided through the {@link TimeoutError}.\n * This can be used to help identify the source of a timeout or pass along\n * other information related to the timeout.\n */\n meta?: M;\n}\n\nexport interface TimeoutInfo<T, M = unknown> {\n /** Optional metadata that was provided to the timeout configuration. */\n readonly meta: M;\n /** The number of messages seen before the timeout */\n readonly seen: number;\n /** The last message seen */\n readonly lastValue: T | null;\n}\n\n/**\n * An error emitted when a timeout occurs.\n */\nexport interface TimeoutError<T = unknown, M = unknown> extends Error {\n /**\n * The information provided to the error by the timeout\n * operation that created the error. Will be `null` if\n * used directly in non-RxJS code with an empty constructor.\n * (Note that using this constructor directly is not recommended,\n * you should create your own errors)\n */\n info: TimeoutInfo<T, M> | null;\n}\n\nexport interface TimeoutErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new <T = unknown, M = unknown>(info?: TimeoutInfo<T, M>): TimeoutError<T, M>;\n}\n\n/**\n * An error thrown by the {@link operators/timeout} operator.\n *\n * Provided so users can use as a type and do quality comparisons.\n * We recommend you do not subclass this or create instances of this class directly.\n * If you have need of a error representing a timeout, you should\n * create your own error class and use that.\n *\n * @see {@link operators/timeout}\n *\n * @class TimeoutError\n */\nexport const TimeoutError: TimeoutErrorCtor = createErrorClass(\n (_super) =>\n function TimeoutErrorImpl(this: any, info: TimeoutInfo<any> | null = null) {\n _super(this);\n this.message = 'Timeout has occurred';\n this.name = 'TimeoutError';\n this.info = info;\n }\n);\n\n/**\n * If `with` is provided, this will return an observable that will switch to a different observable if the source\n * does not push values within the specified time parameters.\n *\n * <span class=\"informal\">The most flexible option for creating a timeout behavior.</span>\n *\n * The first thing to know about the configuration is if you do not provide a `with` property to the configuration,\n * when timeout conditions are met, this operator will emit a {@link TimeoutError}. Otherwise, it will use the factory\n * function provided by `with`, and switch your subscription to the result of that. Timeout conditions are provided by\n * the settings in `first` and `each`.\n *\n * The `first` property can be either a `Date` for a specific time, a `number` for a time period relative to the\n * point of subscription, or it can be skipped. This property is to check timeout conditions for the arrival of\n * the first value from the source _only_. The timings of all subsequent values from the source will be checked\n * against the time period provided by `each`, if it was provided.\n *\n * The `each` property can be either a `number` or skipped. If a value for `each` is provided, it represents the amount of\n * time the resulting observable will wait between the arrival of values from the source before timing out. Note that if\n * `first` is _not_ provided, the value from `each` will be used to check timeout conditions for the arrival of the first\n * value and all subsequent values. If `first` _is_ provided, `each` will only be use to check all values after the first.\n *\n * ### Example\n *\n * Emit a custom error if there is too much time between values\n *\n * ```ts\n * import { interval, throwError } from 'rxjs';\n * import { timeout } from 'rxjs/operators';\n *\n * class CustomTimeoutError extends Error {\n * constructor() {\n * super('It was too slow');\n * this.name = 'CustomTimeoutError';\n * }\n * }\n *\n * const slow$ = interval(900);\n *\n * slow$.pipe(\n * timeout({\n * each: 1000,\n * with: () => throwError(new CustomTimeoutError())\n * })\n * )\n * .subscribe({\n * error: console.error\n * })\n * ```\n *\n * ### Example\n *\n * Switch to a faster observable if your source is slow.\n *\n * ```ts\n * import { interval, throwError } from 'rxjs';\n * import { timeout } from 'rxjs/operators';\n *\n * const slow$ = interval(900);\n * const fast$ = interval(500);\n *\n * slow$.pipe(\n * timeout({\n * each: 1000,\n * with: () => fast$,\n * })\n * )\n * .subscribe(console.log)\n * ```\n * @param config The configuration for the timeout.\n */\nexport function timeout<T, O extends ObservableInput<unknown>, M = unknown>(\n config: TimeoutConfig<T, O, M> & { with: (info: TimeoutInfo<T, M>) => O }\n): OperatorFunction<T, T | ObservedValueOf<O>>;\n\n/**\n * Returns an observable that will error or switch to a different observable if the source does not push values\n * within the specified time parameters.\n *\n * <span class=\"informal\">The most flexible option for creating a timeout behavior.</span>\n *\n * The first thing to know about the configuration is if you do not provide a `with` property to the configuration,\n * when timeout conditions are met, this operator will emit a {@link TimeoutError}. Otherwise, it will use the factory\n * function provided by `with`, and switch your subscription to the result of that. Timeout conditions are provided by\n * the settings in `first` and `each`.\n *\n * The `first` property can be either a `Date` for a specific time, a `number` for a time period relative to the\n * point of subscription, or it can be skipped. This property is to check timeout conditions for the arrival of\n * the first value from the source _only_. The timings of all subsequent values from the source will be checked\n * against the time period provided by `each`, if it was provided.\n *\n * The `each` property can be either a `number` or skipped. If a value for `each` is provided, it represents the amount of\n * time the resulting observable will wait between the arrival of values from the source before timing out. Note that if\n * `first` is _not_ provided, the value from `each` will be used to check timeout conditions for the arrival of the first\n * value and all subsequent values. If `first` _is_ provided, `each` will only be use to check all values after the first.\n *\n * ### Handling TimeoutErrors\n *\n * If no `with` property was provided, subscriptions to the resulting observable may emit an error of {@link TimeoutError}.\n * The timeout error provides useful information you can examine when you're handling the error. The most common way to handle\n * the error would be with {@link catchError}, although you could use {@link tap} or just the error handler in your `subscribe` call\n * directly, if your error handling is only a side effect (such as notifying the user, or logging).\n *\n * In this case, you would check the error for `instanceof TimeoutError` to validate that the error was indeed from `timeout`, and\n * not from some other source. If it's not from `timeout`, you should probably rethrow it if you're in a `catchError`.\n *\n *\n * ### Example\n *\n * Emit a {@link TimeoutError} if the first value, and _only_ the first value, does not arrive within 5 seconds\n *\n * ```ts\n * import { interval } from 'rxjs';\n * import { timeout } from 'rxjs/operators';\n *\n * // A random interval that lasts between 0 and 10 seconds per tick\n * const source$ = interval(Math.round(Math.random() * 10000));\n *\n * source$.pipe(\n * timeout({ first: 5000 })\n * )\n * .subscribe(console.log);\n * ```\n *\n * ### Example\n *\n * Emit a {@link TimeoutError} if the source waits longer than 5 seconds between any two values or the first value\n * and subscription.\n *\n * ```ts\n * import { timer } from 'rxjs';\n * import { timeout, expand } from 'rxjs/operators';\n *\n * const getRandomTime = () => Math.round(Math.random() * 10000);\n *\n * // An observable that waits a random amount of time between each delivered value\n * const source$ = timer(getRandomTime()).pipe(\n * expand(() => timer(getRandomTime()))\n * )\n *\n * source$.pipe(\n * timeout({ each: 5000 })\n * )\n * .subscribe(console.log);\n * ```\n *\n * ### Example\n *\n * Emit a {@link TimeoutError} if the the source does not emit before 7 seconds, _or_ if the source waits longer than\n * 5 seconds between any two values after the first.\n *\n * ```ts\n * import { timer } from 'rxjs';\n * import { timeout, expand } from 'rxjs/operators';\n *\n * const getRandomTime = () => Math.round(Math.random() * 10000);\n *\n * // An observable that waits a random amount of time between each delivered value\n * const source$ = timer(getRandomTime()).pipe(\n * expand(() => timer(getRandomTime()))\n * )\n *\n * source$.pipe(\n * timeout({ first: 7000, each: 5000 })\n * )\n * .subscribe(console.log);\n * ```\n */\nexport function timeout<T, M = unknown>(config: Omit<TimeoutConfig<T, any, M>, 'with'>): OperatorFunction<T, T>;\n\n/**\n * Returns an observable that will error if the source does not push its first value before the specified time passed as a `Date`.\n * This is functionally the same as `timeout({ first: someDate })`.\n *\n * <span class=\"informal\">Errors if the first value doesn't show up before the given date and time</span>\n *\n * ![](timeout.png)\n *\n * @param first The date to at which the resulting observable will timeout if the source observable\n * does not emit at least one value.\n * @param scheduler The scheduler to use. Defaults to {@link asyncScheduler}.\n */\nexport function timeout<T>(first: Date, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;\n\n/**\n * Returns an observable that will error if the source does not push a value within the specified time in milliseconds.\n * This is functionally the same as `timeout({ each: milliseconds })`.\n *\n * <span class=\"informal\">Errors if it waits too long between any value</span>\n *\n * ![](timeout.png)\n *\n * @param each The time allowed between each pushed value from the source before the resulting observable\n * will timeout.\n * @param scheduler The scheduler to use. Defaults to {@link asyncScheduler}.\n */\nexport function timeout<T>(each: number, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;\n\n/**\n *\n * Errors if Observable does not emit a value in given time span.\n *\n * <span class=\"informal\">Timeouts on Observable that doesn't emit values fast enough.</span>\n *\n * ![](timeout.png)\n *\n * @return A function that returns an Observable that mirrors behaviour of the\n * source Observable, unless timeout happens when it throws an error.\n */\nexport function timeout<T, O extends ObservableInput<any>, M>(\n config: number | Date | TimeoutConfig<T, O, M>,\n schedulerArg?: SchedulerLike\n): OperatorFunction<T, T | ObservedValueOf<O>> {\n // Intentionally terse code.\n // If the first argument is a valid `Date`, then we use it as the `first` config.\n // Otherwise, if the first argument is a `number`, then we use it as the `each` config.\n // Otherwise, it can be assumed the first argument is the configuration object itself, and\n // we destructure that into what we're going to use, setting important defaults as we do.\n // NOTE: The default for `scheduler` will be the `scheduler` argument if it exists, or\n // it will default to the `asyncScheduler`.\n const { first, each, with: _with = timeoutErrorFactory, scheduler = schedulerArg ?? asyncScheduler, meta = null! } = (isValidDate(config)\n ? { first: config }\n : typeof config === 'number'\n ? { each: config }\n : config) as TimeoutConfig<T, O, M>;\n\n if (first == null && each == null) {\n // Ensure timeout was provided at runtime.\n throw new TypeError('No timeout provided.');\n }\n\n return operate((source, subscriber) => {\n // This subscription encapsulates our subscription to the\n // source for this operator. We're capturing it separately,\n // because if there is a `with` observable to fail over to,\n // we want to unsubscribe from our original subscription, and\n // hand of the subscription to that one.\n let originalSourceSubscription: Subscription;\n // The subscription for our timeout timer. This changes\n // every time get get a new value.\n let timerSubscription: Subscription;\n // A bit of state we pass to our with and error factories to\n // tell what the last value we saw was.\n let lastValue: T | null = null;\n // A bit of state we pass to the with and error factories to\n // tell how many values we have seen so far.\n let seen = 0;\n const startTimer = (delay: number) => {\n timerSubscription = caughtSchedule(\n subscriber,\n scheduler,\n () => {\n originalSourceSubscription.unsubscribe();\n innerFrom(\n _with!({\n meta,\n lastValue,\n seen,\n })\n ).subscribe(subscriber);\n },\n delay\n );\n };\n\n originalSourceSubscription = source.subscribe(\n new OperatorSubscriber(\n subscriber,\n (value: T) => {\n // clear the timer so we can emit and start another one.\n timerSubscription?.unsubscribe();\n seen++;\n // Emit\n subscriber.next((lastValue = value));\n // null | undefined are both < 0. Thanks, JavaScript.\n each! > 0 && startTimer(each!);\n },\n undefined,\n undefined,\n () => {\n if (!timerSubscription?.closed) {\n timerSubscription?.unsubscribe();\n }\n // Be sure not to hold the last value in memory after unsubscription\n // it could be quite large.\n lastValue = null;\n }\n )\n );\n\n // Intentionally terse code.\n // If `first` was provided, and it's a number, then use it.\n // If `first` was provided and it's not a number, it's a Date, and we get the difference between it and \"now\".\n // If `first` was not provided at all, then our first timer will be the value from `each`.\n startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler!.now()) : each!);\n });\n}\n\n/**\n * The default function to use to emit an error when timeout occurs and a `with` function\n * is not specified.\n * @param info The information about the timeout to pass along to the error\n */\nfunction timeoutErrorFactory(info: TimeoutInfo<any>): Observable<never> {\n throw new TimeoutError(info);\n}\n","import { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\nexport function map<T, R>(project: (value: T, index: number) => R): OperatorFunction<T, R>;\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function map<T, R, A>(project: (this: A, value: T, index: number) => R, thisArg: A): OperatorFunction<T, R>;\n\n/**\n * Applies a given `project` function to each value emitted by the source\n * Observable, and emits the resulting values as an Observable.\n *\n * <span class=\"informal\">Like [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map),\n * it passes each source value through a transformation function to get\n * corresponding output values.</span>\n *\n * ![](map.png)\n *\n * Similar to the well known `Array.prototype.map` function, this operator\n * applies a projection to each value and emits that projection in the output\n * Observable.\n *\n * ## Example\n * Map every click to the clientX position of that click\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { map } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const positions = clicks.pipe(map(ev => ev.clientX));\n * positions.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link mapTo}\n * @see {@link pluck}\n *\n * @param {function(value: T, index: number): R} project The function to apply\n * to each `value` emitted by the source Observable. The `index` parameter is\n * the number `i` for the i-th emission that has happened since the\n * subscription, starting from the number `0`.\n * @param {any} [thisArg] An optional argument to define what `this` is in the\n * `project` function.\n * @return A function that returns an Observable that emits the values from the\n * source Observable transformed by the given `project` function.\n */\nexport function map<T, R>(project: (value: T, index: number) => R, thisArg?: any): OperatorFunction<T, R> {\n return operate((source, subscriber) => {\n // The index of the value from the source. Used with projection.\n let index = 0;\n // Subscribe to the source, all errors and completions are sent along\n // to the consumer.\n source.subscribe(\n new OperatorSubscriber(subscriber, (value: T) => {\n // Call the projection function with the appropriate this context,\n // and send the resulting value to the consumer.\n subscriber.next(project.call(thisArg, value, index++));\n })\n );\n });\n}\n","import { OperatorFunction } from \"../types\";\nimport { map } from \"../operators/map\";\n\nconst { isArray } = Array;\n\nfunction callOrApply<T, R>(fn: ((...values: T[]) => R), args: T|T[]): R {\n return isArray(args) ? fn(...args) : fn(args);\n}\n\n/**\n * Used in several -- mostly deprecated -- situations where we need to \n * apply a list of arguments or a single argument to a result selector.\n */\nexport function mapOneOrManyArgs<T, R>(fn: ((...values: T[]) => R)): OperatorFunction<T|T[], R> {\n return map(args => callOrApply(fn, args))\n}","const { isArray } = Array;\nconst { getPrototypeOf, prototype: objectProto, keys: getKeys } = Object;\n\n/**\n * Used in functions where either a list of arguments, a single array of arguments, or a\n * dictionary of arguments can be returned. Returns an object with an `args` property with\n * the arguments in an array, if it is a dictionary, it will also return the `keys` in another\n * property.\n */\nexport function argsArgArrayOrObject<T, O extends Record<string, T>>(args: T[] | [O] | [T[]]): { args: T[]; keys: string[] | null } {\n if (args.length === 1) {\n const first = args[0];\n if (isArray(first)) {\n return { args: first, keys: null };\n }\n if (isPOJO(first)) {\n const keys = getKeys(first);\n return {\n args: keys.map((key) => first[key]),\n keys,\n };\n }\n }\n\n return { args: args as T[], keys: null };\n}\n\nfunction isPOJO(obj: any): obj is object {\n return obj && typeof obj === 'object' && getPrototypeOf(obj) === objectProto;\n}\n","export function createObject(keys: string[], values: any[]) {\n return keys.reduce((result, key, i) => ((result[key] = values[i]), result), {} as any);\n}\n","import { Observable } from '../Observable';\nimport { ObservableInput, SchedulerLike, ObservedValueOf, ObservableInputTuple } from '../types';\nimport { argsArgArrayOrObject } from '../util/argsArgArrayOrObject';\nimport { Subscriber } from '../Subscriber';\nimport { from } from './from';\nimport { identity } from '../util/identity';\nimport { Subscription } from '../Subscription';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { popResultSelector, popScheduler } from '../util/args';\nimport { createObject } from '../util/createObject';\nimport { OperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { AnyCatcher } from '../AnyCatcher';\n\n// combineLatest(any)\n// We put this first because we need to catch cases where the user has supplied\n// _exactly `any`_ as the argument. Since `any` literally matches _anything_,\n// we don't want it to randomly hit one of the other type signatures below,\n// as we have no idea at build-time what type we should be returning when given an any.\n\n/**\n * You have passed `any` here, we can't figure out if it is\n * an array or an object, so you're getting `unknown`. Use better types.\n * @param arg Something typed as `any`\n */\nexport function combineLatest<T extends AnyCatcher>(arg: T): Observable<unknown>;\n\n// combineLatest([a, b, c])\nexport function combineLatest(sources: []): Observable<never>;\nexport function combineLatest<A extends readonly unknown[]>(sources: readonly [...ObservableInputTuple<A>]): Observable<A>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function combineLatest<A extends readonly unknown[], R>(\n sources: readonly [...ObservableInputTuple<A>],\n resultSelector: (...values: A) => R,\n scheduler: SchedulerLike\n): Observable<R>;\nexport function combineLatest<A extends readonly unknown[], R>(\n sources: readonly [...ObservableInputTuple<A>],\n resultSelector: (...values: A) => R\n): Observable<R>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function combineLatest<A extends readonly unknown[]>(\n sources: readonly [...ObservableInputTuple<A>],\n scheduler: SchedulerLike\n): Observable<A>;\n\n// combineLatest(a, b, c)\n/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */\nexport function combineLatest<A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): Observable<A>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function combineLatest<A extends readonly unknown[], R>(\n ...sourcesAndResultSelectorAndScheduler: [...ObservableInputTuple<A>, (...values: A) => R, SchedulerLike]\n): Observable<R>;\n/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */\nexport function combineLatest<A extends readonly unknown[], R>(\n ...sourcesAndResultSelector: [...ObservableInputTuple<A>, (...values: A) => R]\n): Observable<R>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function combineLatest<A extends readonly unknown[]>(\n ...sourcesAndScheduler: [...ObservableInputTuple<A>, SchedulerLike]\n): Observable<A>;\n\n// combineLatest({a, b, c})\nexport function combineLatest(sourcesObject: { [K in any]: never }): Observable<never>;\nexport function combineLatest<T extends Record<string, ObservableInput<any>>>(\n sourcesObject: T\n): Observable<{ [K in keyof T]: ObservedValueOf<T[K]> }>;\n\n/**\n * Combines multiple Observables to create an Observable whose values are\n * calculated from the latest values of each of its input Observables.\n *\n * <span class=\"informal\">Whenever any input Observable emits a value, it\n * computes a formula using the latest values from all the inputs, then emits\n * the output of that formula.</span>\n *\n * ![](combineLatest.png)\n *\n * `combineLatest` combines the values from all the Observables passed in the\n * observables array. This is done by subscribing to each Observable in order and,\n * whenever any Observable emits, collecting an array of the most recent\n * values from each Observable. So if you pass `n` Observables to this operator,\n * the returned Observable will always emit an array of `n` values, in an order\n * corresponding to the order of the passed Observables (the value from the first Observable\n * will be at index 0 of the array and so on).\n *\n * Static version of `combineLatest` accepts an array of Observables. Note that an array of\n * Observables is a good choice, if you don't know beforehand how many Observables\n * you will combine. Passing an empty array will result in an Observable that\n * completes immediately.\n *\n * To ensure the output array always has the same length, `combineLatest` will\n * actually wait for all input Observables to emit at least once,\n * before it starts emitting results. This means if some Observable emits\n * values before other Observables started emitting, all these values but the last\n * will be lost. On the other hand, if some Observable does not emit a value but\n * completes, resulting Observable will complete at the same moment without\n * emitting anything, since it will now be impossible to include a value from the\n * completed Observable in the resulting array. Also, if some input Observable does\n * not emit any value and never completes, `combineLatest` will also never emit\n * and never complete, since, again, it will wait for all streams to emit some\n * value.\n *\n * If at least one Observable was passed to `combineLatest` and all passed Observables\n * emitted something, the resulting Observable will complete when all combined\n * streams complete. So even if some Observable completes, the result of\n * `combineLatest` will still emit values when other Observables do. In case\n * of a completed Observable, its value from now on will always be the last\n * emitted value. On the other hand, if any Observable errors, `combineLatest`\n * will error immediately as well, and all other Observables will be unsubscribed.\n *\n * ## Examples\n * ### Combine two timer Observables\n * ```ts\n * import { combineLatest, timer } from 'rxjs';\n *\n * const firstTimer = timer(0, 1000); // emit 0, 1, 2... after every second, starting from now\n * const secondTimer = timer(500, 1000); // emit 0, 1, 2... after every second, starting 0,5s from now\n * const combinedTimers = combineLatest([firstTimer, secondTimer]);\n * combinedTimers.subscribe(value => console.log(value));\n * // Logs\n * // [0, 0] after 0.5s\n * // [1, 0] after 1s\n * // [1, 1] after 1.5s\n * // [2, 1] after 2s\n * ```\n * ### Combine a dictionary of Observables\n * ```ts\n * import { combineLatest, of } from 'rxjs';\n * import { delay, startWith } from 'rxjs/operators';\n *\n * const observables = {\n * a: of(1).pipe(delay(1000), startWith(0)),\n * b: of(5).pipe(delay(5000), startWith(0)),\n * c: of(10).pipe(delay(10000), startWith(0))\n * };\n * const combined = combineLatest(observables);\n * combined.subscribe(value => console.log(value));\n * // Logs\n * // {a: 0, b: 0, c: 0} immediately\n * // {a: 1, b: 0, c: 0} after 1s\n * // {a: 1, b: 5, c: 0} after 5s\n * // {a: 1, b: 5, c: 10} after 10s\n * ```\n * ### Combine an array of Observables\n * ```ts\n * import { combineLatest, of } from 'rxjs';\n * import { delay, startWith } from 'rxjs/operators';\n *\n * const observables = [1, 5, 10].map(\n * n => of(n).pipe(\n * delay(n * 1000), // emit 0 and then emit n after n seconds\n * startWith(0),\n * )\n * );\n * const combined = combineLatest(observables);\n * combined.subscribe(value => console.log(value));\n * // Logs\n * // [0, 0, 0] immediately\n * // [1, 0, 0] after 1s\n * // [1, 5, 0] after 5s\n * // [1, 5, 10] after 10s\n * ```\n *\n *\n * ### Use map operator to dynamically calculate the Body-Mass Index\n * ```ts\n * import { combineLatest, of } from 'rxjs';\n * import { map } from 'rxjs/operators';\n *\n * const weight = of(70, 72, 76, 79, 75);\n * const height = of(1.76, 1.77, 1.78);\n * const bmi = combineLatest([weight, height]).pipe(\n * map(([w, h]) => w / (h * h)),\n * );\n * bmi.subscribe(x => console.log('BMI is ' + x));\n *\n * // With output to console:\n * // BMI is 24.212293388429753\n * // BMI is 23.93948099205209\n * // BMI is 23.671253629592222\n * ```\n *\n * @see {@link combineLatestAll}\n * @see {@link merge}\n * @see {@link withLatestFrom}\n *\n * @param {ObservableInput} [observables] An array of input Observables to combine with each other.\n * An array of Observables must be given as the first argument.\n * @param {function} [project] An optional function to project the values from\n * the combined latest values into a new value on the output Observable.\n * @param {SchedulerLike} [scheduler=null] The {@link SchedulerLike} to use for subscribing to\n * each input Observable.\n * @return {Observable} An Observable of projected values from the most recent\n * values from each input Observable, or an array of the most recent values from\n * each input Observable.\n */\nexport function combineLatest<O extends ObservableInput<any>, R>(...args: any[]): Observable<R> | Observable<ObservedValueOf<O>[]> {\n const scheduler = popScheduler(args);\n const resultSelector = popResultSelector(args);\n\n const { args: observables, keys } = argsArgArrayOrObject(args);\n\n if (observables.length === 0) {\n // If no observables are passed, or someone has passed an ampty array\n // of observables, or even an empty object POJO, we need to just\n // complete (EMPTY), but we have to honor the scheduler provided if any.\n return from([], scheduler as any);\n }\n\n const result = new Observable<ObservedValueOf<O>[]>(\n combineLatestInit(\n observables as ObservableInput<ObservedValueOf<O>>[],\n scheduler,\n keys\n ? // A handler for scrubbing the array of args into a dictionary.\n (values) => createObject(keys, values)\n : // A passthrough to just return the array\n identity\n )\n );\n\n return resultSelector ? (result.pipe(mapOneOrManyArgs(resultSelector)) as Observable<R>) : result;\n}\n\nexport function combineLatestInit(\n observables: ObservableInput<any>[],\n scheduler?: SchedulerLike,\n valueTransform: (values: any[]) => any = identity\n) {\n return (subscriber: Subscriber<any>) => {\n // The outer subscription. We're capturing this in a function\n // because we may have to schedule it.\n maybeSchedule(\n scheduler,\n () => {\n const { length } = observables;\n // A store for the values each observable has emitted so far. We match observable to value on index.\n const values = new Array(length);\n // The number of currently active subscriptions, as they complete, we decrement this number to see if\n // we are all done combining values, so we can complete the result.\n let active = length;\n // The number of inner sources that still haven't emitted the first value\n // We need to track this because all sources need to emit one value in order\n // to start emitting values.\n let remainingFirstValues = length;\n // The loop to kick off subscription. We're keying everything on index `i` to relate the observables passed\n // in to the slot in the output array or the key in the array of keys in the output dictionary.\n for (let i = 0; i < length; i++) {\n maybeSchedule(\n scheduler,\n () => {\n const source = from(observables[i], scheduler as any);\n let hasFirstValue = false;\n source.subscribe(\n new OperatorSubscriber(\n subscriber,\n (value) => {\n // When we get a value, record it in our set of values.\n values[i] = value;\n if (!hasFirstValue) {\n // If this is our first value, record that.\n hasFirstValue = true;\n remainingFirstValues--;\n }\n if (!remainingFirstValues) {\n // We're not waiting for any more\n // first values, so we can emit!\n subscriber.next(valueTransform(values.slice()));\n }\n },\n () => {\n if (!--active) {\n // We only complete the result if we have no more active\n // inner observables.\n subscriber.complete();\n }\n }\n )\n );\n },\n subscriber\n );\n }\n },\n subscriber\n );\n };\n}\n\n/**\n * A small utility to handle the couple of locations where we want to schedule if a scheduler was provided,\n * but we don't if there was no scheduler.\n */\nfunction maybeSchedule(scheduler: SchedulerLike | undefined, execute: () => void, subscription: Subscription) {\n if (scheduler) {\n subscription.add(scheduler.schedule(execute));\n } else {\n execute();\n }\n}\n","import { Observable } from '../Observable';\nimport { innerFrom } from '../observable/from';\nimport { Subscriber } from '../Subscriber';\nimport { ObservableInput, SchedulerLike } from '../types';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * A process embodying the general \"merge\" strategy. This is used in\n * `mergeMap` and `mergeScan` because the logic is otherwise nearly identical.\n * @param source The original source observable\n * @param subscriber The consumer subscriber\n * @param project The projection function to get our inner sources\n * @param concurrent The number of concurrent inner subscriptions\n * @param onBeforeNext Additional logic to apply before nexting to our consumer\n * @param expand If `true` this will perform an \"expand\" strategy, which differs only\n * in that it recurses, and the inner subscription must be schedule-able.\n * @param innerSubScheduler A scheduler to use to schedule inner subscriptions,\n * this is to support the expand strategy, mostly, and should be deprecated\n */\nexport function mergeInternals<T, R>(\n source: Observable<T>,\n subscriber: Subscriber<R>,\n project: (value: T, index: number) => ObservableInput<R>,\n concurrent: number,\n onBeforeNext?: (innerValue: R) => void,\n expand?: boolean,\n innerSubScheduler?: SchedulerLike,\n additionalTeardown?: () => void\n) {\n // Buffered values, in the event of going over our concurrency limit\n const buffer: T[] = [];\n // The number of active inner subscriptions.\n let active = 0;\n // An index to pass to our accumulator function\n let index = 0;\n // Whether or not the outer source has completed.\n let isComplete = false;\n\n /**\n * Checks to see if we can complete our result or not.\n */\n const checkComplete = () => {\n // If the outer has completed, and nothing is left in the buffer,\n // and we don't have any active inner subscriptions, then we can\n // Emit the state and complete.\n if (isComplete && !buffer.length && !active) {\n subscriber.complete();\n }\n };\n\n // If we're under our concurrency limit, just start the inner subscription, otherwise buffer and wait.\n const outerNext = (value: T) => (active < concurrent ? doInnerSub(value) : buffer.push(value));\n\n const doInnerSub = (value: T) => {\n // If we're expanding, we need to emit the outer values and the inner values\n // as the inners will \"become outers\" in a way as they are recursively fed\n // back to the projection mechanism.\n expand && subscriber.next(value as any);\n\n // Increment the number of active subscriptions so we can track it\n // against our concurrency limit later.\n active++;\n\n // A flag used to show that the inner observable completed.\n // This is checked during finalization to see if we should\n // move to the next item in the buffer, if there is on.\n let innerComplete = false;\n\n // Start our inner subscription.\n innerFrom(project(value, index++)).subscribe(\n new OperatorSubscriber(\n subscriber,\n (innerValue) => {\n // `mergeScan` has additional handling here. For example\n // taking the inner value and updating state.\n onBeforeNext?.(innerValue);\n\n if (expand) {\n // If we're expanding, then just recurse back to our outer\n // handler. It will emit the value first thing.\n outerNext(innerValue as any);\n } else {\n // Otherwise, emit the inner value.\n subscriber.next(innerValue);\n }\n },\n () => {\n // Flag that we have completed, so we know to check the buffer\n // during finalization.\n innerComplete = true;\n },\n // Errors are passed to the destination.\n undefined,\n () => {\n // During finalization, if the inner completed (it wasn't errored or\n // cancelled), then we want to try the next item in the buffer if\n // there is one.\n if (innerComplete) {\n // We have to wrap this in a try/catch because it happens during\n // finalization, possibly asynchronously, and we want to pass\n // any errors that happen (like in a projection function) to\n // the outer Subscriber.\n try {\n // INNER SOURCE COMPLETE\n // Decrement the active count to ensure that the next time\n // we try to call `doInnerSub`, the number is accurate.\n active--;\n // If we have more values in the buffer, try to process those\n // Note that this call will increment `active` ahead of the\n // next conditional, if there were any more inner subscriptions\n // to start.\n while (buffer.length && active < concurrent) {\n const bufferedValue = buffer.shift()!;\n // Particularly for `expand`, we need to check to see if a scheduler was provided\n // for when we want to start our inner subscription. Otherwise, we just start\n // are next inner subscription.\n innerSubScheduler ? subscriber.add(innerSubScheduler.schedule(() => doInnerSub(bufferedValue))) : doInnerSub(bufferedValue);\n }\n // Check to see if we can complete, and complete if so.\n checkComplete();\n } catch (err) {\n subscriber.error(err);\n }\n }\n }\n )\n );\n };\n\n // Subscribe to our source observable.\n source.subscribe(\n new OperatorSubscriber(subscriber, outerNext, () => {\n // Outer completed, make a note of it, and check to see if we can complete everything.\n isComplete = true;\n checkComplete();\n })\n );\n\n // Additional teardown (for when the destination is torn down).\n // Other teardown is added implicitly via subscription above.\n return () => {\n additionalTeardown?.();\n };\n}\n","import { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';\nimport { map } from './map';\nimport { innerFrom } from '../observable/from';\nimport { operate } from '../util/lift';\nimport { mergeInternals } from './mergeInternals';\nimport { isFunction } from '../util/isFunction';\n\n/* tslint:disable:max-line-length */\nexport function mergeMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n concurrent?: number\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function mergeMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector: undefined,\n concurrent?: number\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function mergeMap<T, R, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R,\n concurrent?: number\n): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Projects each source value to an Observable which is merged in the output\n * Observable.\n *\n * <span class=\"informal\">Maps each value to an Observable, then flattens all of\n * these inner Observables using {@link mergeAll}.</span>\n *\n * ![](mergeMap.png)\n *\n * Returns an Observable that emits items based on applying a function that you\n * supply to each item emitted by the source Observable, where that function\n * returns an Observable, and then merging those resulting Observables and\n * emitting the results of this merger.\n *\n * ## Example\n * Map and flatten each letter to an Observable ticking every 1 second\n * ```ts\n * import { of, interval } from 'rxjs';\n * import { mergeMap, map } from 'rxjs/operators';\n *\n * const letters = of('a', 'b', 'c');\n * const result = letters.pipe(\n * mergeMap(x => interval(1000).pipe(map(i => x+i))),\n * );\n * result.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // a0\n * // b0\n * // c0\n * // a1\n * // b1\n * // c1\n * // continues to list a,b,c with respective ascending integers\n * ```\n *\n * @see {@link concatMap}\n * @see {@link exhaustMap}\n * @see {@link merge}\n * @see {@link mergeAll}\n * @see {@link mergeMapTo}\n * @see {@link mergeScan}\n * @see {@link switchMap}\n *\n * @param {function(value: T, ?index: number): ObservableInput} project A function\n * that, when applied to an item emitted by the source Observable, returns an\n * Observable.\n * @param {number} [concurrent=Infinity] Maximum number of input\n * Observables being subscribed to concurrently.\n * @return A function that returns an Observable that emits the result of\n * applying the projection function (and the optional deprecated\n * `resultSelector`) to each item emitted by the source Observable and merging\n * the results of the Observables obtained from this transformation.\n */\nexport function mergeMap<T, R, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector?: ((outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R) | number,\n concurrent: number = Infinity\n): OperatorFunction<T, ObservedValueOf<O> | R> {\n if (isFunction(resultSelector)) {\n // DEPRECATED PATH\n return mergeMap((a, i) => map((b: any, ii: number) => resultSelector(a, b, i, ii))(innerFrom(project(a, i))), concurrent);\n } else if (typeof resultSelector === 'number') {\n concurrent = resultSelector;\n }\n\n return operate((source, subscriber) => mergeInternals(source, subscriber, project, concurrent));\n}\n","import { mergeMap } from './mergeMap';\nimport { identity } from '../util/identity';\nimport { OperatorFunction, ObservableInput, ObservedValueOf } from '../types';\n\n/**\n * Converts a higher-order Observable into a first-order Observable which\n * concurrently delivers all values that are emitted on the inner Observables.\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables.</span>\n *\n * ![](mergeAll.png)\n *\n * `mergeAll` subscribes to an Observable that emits Observables, also known as\n * a higher-order Observable. Each time it observes one of these emitted inner\n * Observables, it subscribes to that and delivers all the values from the\n * inner Observable on the output Observable. The output Observable only\n * completes once all inner Observables have completed. Any error delivered by\n * a inner Observable will be immediately emitted on the output Observable.\n *\n * ## Examples\n * Spawn a new interval Observable for each click event, and blend their outputs as one Observable\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { map, mergeAll } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const higherOrder = clicks.pipe(map((ev) => interval(1000)));\n * const firstOrder = higherOrder.pipe(mergeAll());\n * firstOrder.subscribe(x => console.log(x));\n * ```\n *\n * Count from 0 to 9 every second for each click, but only allow 2 concurrent timers\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { take, map, mergeAll } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const higherOrder = clicks.pipe(\n * map((ev) => interval(1000).pipe(take(10))),\n * );\n * const firstOrder = higherOrder.pipe(mergeAll(2));\n * firstOrder.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link combineLatestAll}\n * @see {@link concatAll}\n * @see {@link exhaustAll}\n * @see {@link merge}\n * @see {@link mergeMap}\n * @see {@link mergeMapTo}\n * @see {@link mergeScan}\n * @see {@link switchAll}\n * @see {@link switchMap}\n * @see {@link zipAll}\n *\n * @param {number} [concurrent=Infinity] Maximum number of inner\n * Observables being subscribed to concurrently.\n * @return A function that returns an Observable that emits values coming from\n * all the inner Observables emitted by the source Observable.\n */\nexport function mergeAll<O extends ObservableInput<any>>(concurrent: number = Infinity): OperatorFunction<O, ObservedValueOf<O>> {\n return mergeMap(identity, concurrent);\n}\n","import { mergeAll } from './mergeAll';\nimport { OperatorFunction, ObservableInput, ObservedValueOf } from '../types';\n\n/**\n * Converts a higher-order Observable into a first-order Observable by\n * concatenating the inner Observables in order.\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables by putting one\n * inner Observable after the other.</span>\n *\n * ![](concatAll.svg)\n *\n * Joins every Observable emitted by the source (a higher-order Observable), in\n * a serial fashion. It subscribes to each inner Observable only after the\n * previous inner Observable has completed, and merges all of their values into\n * the returned observable.\n *\n * __Warning:__ If the source Observable emits Observables quickly and\n * endlessly, and the inner Observables it emits generally complete slower than\n * the source emits, you can run into memory issues as the incoming Observables\n * collect in an unbounded buffer.\n *\n * Note: `concatAll` is equivalent to `mergeAll` with concurrency parameter set\n * to `1`.\n *\n * ## Example\n *\n * For each click event, tick every second from 0 to 3, with no concurrency\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { map, take, concatAll } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const higherOrder = clicks.pipe(\n * map(ev => interval(1000).pipe(take(4))),\n * );\n * const firstOrder = higherOrder.pipe(concatAll());\n * firstOrder.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // (results are not concurrent)\n * // For every click on the \"document\" it will emit values 0 to 3 spaced\n * // on a 1000ms interval\n * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3\n * ```\n *\n * @see {@link combineLatestAll}\n * @see {@link concat}\n * @see {@link concatMap}\n * @see {@link concatMapTo}\n * @see {@link exhaustAll}\n * @see {@link mergeAll}\n * @see {@link switchAll}\n * @see {@link switchMap}\n * @see {@link zipAll}\n *\n * @return A function that returns an Observable emitting values from all the\n * inner Observables concatenated.\n */\nexport function concatAll<O extends ObservableInput<any>>(): OperatorFunction<O, ObservedValueOf<O>> {\n return mergeAll(1);\n}\n","import { Observable } from '../Observable';\nimport { ObservableInputTuple, SchedulerLike } from '../types';\nimport { concatAll } from '../operators/concatAll';\nimport { internalFromArray } from './fromArray';\nimport { popScheduler } from '../util/args';\n\nexport function concat<T extends readonly unknown[]>(...inputs: [...ObservableInputTuple<T>]): Observable<T[number]>;\nexport function concat<T extends readonly unknown[]>(...inputsAndScheduler: [...ObservableInputTuple<T>, SchedulerLike]): Observable<T[number]>;\n\n/**\n * Creates an output Observable which sequentially emits all values from the first given\n * Observable and then moves on to the next.\n *\n * <span class=\"informal\">Concatenates multiple Observables together by\n * sequentially emitting their values, one Observable after the other.</span>\n *\n * ![](concat.png)\n *\n * `concat` joins multiple Observables together, by subscribing to them one at a time and\n * merging their results into the output Observable. You can pass either an array of\n * Observables, or put them directly as arguments. Passing an empty array will result\n * in Observable that completes immediately.\n *\n * `concat` will subscribe to first input Observable and emit all its values, without\n * changing or affecting them in any way. When that Observable completes, it will\n * subscribe to then next Observable passed and, again, emit its values. This will be\n * repeated, until the operator runs out of Observables. When last input Observable completes,\n * `concat` will complete as well. At any given moment only one Observable passed to operator\n * emits values. If you would like to emit values from passed Observables concurrently, check out\n * {@link merge} instead, especially with optional `concurrent` parameter. As a matter of fact,\n * `concat` is an equivalent of `merge` operator with `concurrent` parameter set to `1`.\n *\n * Note that if some input Observable never completes, `concat` will also never complete\n * and Observables following the one that did not complete will never be subscribed. On the other\n * hand, if some Observable simply completes immediately after it is subscribed, it will be\n * invisible for `concat`, which will just move on to the next Observable.\n *\n * If any Observable in chain errors, instead of passing control to the next Observable,\n * `concat` will error immediately as well. Observables that would be subscribed after\n * the one that emitted error, never will.\n *\n * If you pass to `concat` the same Observable many times, its stream of values\n * will be \"replayed\" on every subscription, which means you can repeat given Observable\n * as many times as you like. If passing the same Observable to `concat` 1000 times becomes tedious,\n * you can always use {@link repeat}.\n *\n * ## Examples\n * ### Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10\n * ```ts\n * import { concat, interval, range } from 'rxjs';\n * import { take } from 'rxjs/operators';\n *\n * const timer = interval(1000).pipe(take(4));\n * const sequence = range(1, 10);\n * const result = concat(timer, sequence);\n * result.subscribe(x => console.log(x));\n *\n * // results in:\n * // 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 -immediate-> 1 ... 10\n * ```\n *\n * ### Concatenate 3 Observables\n * ```ts\n * import { concat, interval } from 'rxjs';\n * import { take } from 'rxjs/operators';\n *\n * const timer1 = interval(1000).pipe(take(10));\n * const timer2 = interval(2000).pipe(take(6));\n * const timer3 = interval(500).pipe(take(10));\n *\n * const result = concat(timer1, timer2, timer3);\n * result.subscribe(x => console.log(x));\n *\n * // results in the following:\n * // (Prints to console sequentially)\n * // -1000ms-> 0 -1000ms-> 1 -1000ms-> ... 9\n * // -2000ms-> 0 -2000ms-> 1 -2000ms-> ... 5\n * // -500ms-> 0 -500ms-> 1 -500ms-> ... 9\n * ```\n *\n * ### Concatenate the same Observable to repeat it\n * ```ts\n * import { concat, interval } from 'rxjs';\n * import { take } from 'rxjs/operators';\n *\n * const timer = interval(1000).pipe(take(2));\n *\n * concat(timer, timer) // concatenating the same Observable!\n * .subscribe(\n * value => console.log(value),\n * err => {},\n * () => console.log('...and it is done!')\n * );\n *\n * // Logs:\n * // 0 after 1s\n * // 1 after 2s\n * // 0 after 3s\n * // 1 after 4s\n * // \"...and it is done!\" also after 4s\n * ```\n *\n * @see {@link concatAll}\n * @see {@link concatMap}\n * @see {@link concatMapTo}\n * @see {@link startWith}\n * @see {@link endWith}\n *\n * @param input1 An input Observable to concatenate with others.\n * @param input2 An input Observable to concatenate with others.\n * More than one input Observables may be given as argument.\n * @param scheduler An optional {@link SchedulerLike} to schedule each\n * Observable subscription on.\n */\nexport function concat(...args: any[]): Observable<unknown> {\n return concatAll()(internalFromArray(args, popScheduler(args)));\n}\n","import { Observable } from '../Observable';\nimport { mergeMap } from '../operators/mergeMap';\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isFunction } from '../util/isFunction';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { internalFromArray } from './fromArray';\n\n// These constants are used to create handler registry functions using array mapping below.\nconst nodeEventEmitterMethods = ['addListener', 'removeListener'] as const;\nconst eventTargetMethods = ['addEventListener', 'removeEventListener'] as const;\nconst jqueryMethods = ['on', 'off'] as const;\n\nexport interface NodeStyleEventEmitter {\n addListener(eventName: string | symbol, handler: NodeEventHandler): this;\n removeListener(eventName: string | symbol, handler: NodeEventHandler): this;\n}\n\nexport type NodeEventHandler = (...args: any[]) => void;\n\n// For APIs that implement `addListener` and `removeListener` methods that may\n// not use the same arguments or return EventEmitter values\n// such as React Native\nexport interface NodeCompatibleEventEmitter {\n addListener(eventName: string, handler: NodeEventHandler): void | {};\n removeListener(eventName: string, handler: NodeEventHandler): void | {};\n}\n\n// Use handler types like those in @types/jquery. See:\n// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/847731ba1d7fa6db6b911c0e43aa0afe596e7723/types/jquery/misc.d.ts#L6395\nexport interface JQueryStyleEventEmitter<TContext, T> {\n on(eventName: string, handler: (this: TContext, t: T, ...args: any[]) => any): void;\n off(eventName: string, handler: (this: TContext, t: T, ...args: any[]) => any): void;\n}\n\nexport interface EventListenerObject<E> {\n handleEvent(evt: E): void;\n}\n\nexport interface HasEventTargetAddRemove<E> {\n addEventListener(\n type: string,\n listener: ((evt: E) => void) | EventListenerObject<E> | null,\n options?: boolean | AddEventListenerOptions\n ): void;\n removeEventListener(\n type: string,\n listener: ((evt: E) => void) | EventListenerObject<E> | null,\n options?: EventListenerOptions | boolean\n ): void;\n}\n\nexport interface EventListenerOptions {\n capture?: boolean;\n passive?: boolean;\n once?: boolean;\n}\n\nexport interface AddEventListenerOptions extends EventListenerOptions {\n once?: boolean;\n passive?: boolean;\n}\n\nexport function fromEvent<T>(target: HasEventTargetAddRemove<T> | ArrayLike<HasEventTargetAddRemove<T>>, eventName: string): Observable<T>;\nexport function fromEvent<T, R>(\n target: HasEventTargetAddRemove<T> | ArrayLike<HasEventTargetAddRemove<T>>,\n eventName: string,\n resultSelector: (event: T) => R\n): Observable<R>;\nexport function fromEvent<T>(\n target: HasEventTargetAddRemove<T> | ArrayLike<HasEventTargetAddRemove<T>>,\n eventName: string,\n options: EventListenerOptions\n): Observable<T>;\nexport function fromEvent<T, R>(\n target: HasEventTargetAddRemove<T> | ArrayLike<HasEventTargetAddRemove<T>>,\n eventName: string,\n options: EventListenerOptions,\n resultSelector: (event: T) => R\n): Observable<R>;\n\nexport function fromEvent(target: NodeStyleEventEmitter | ArrayLike<NodeStyleEventEmitter>, eventName: string): Observable<unknown>;\n/** @deprecated Do not specify explicit type parameters. Signatures with type parameters that cannot be inferred will be removed in v8. */\nexport function fromEvent<T>(target: NodeStyleEventEmitter | ArrayLike<NodeStyleEventEmitter>, eventName: string): Observable<T>;\nexport function fromEvent<R>(\n target: NodeStyleEventEmitter | ArrayLike<NodeStyleEventEmitter>,\n eventName: string,\n resultSelector: (...args: any[]) => R\n): Observable<R>;\n\nexport function fromEvent(\n target: NodeCompatibleEventEmitter | ArrayLike<NodeCompatibleEventEmitter>,\n eventName: string\n): Observable<unknown>;\n/** @deprecated Do not specify explicit type parameters. Signatures with type parameters that cannot be inferred will be removed in v8. */\nexport function fromEvent<T>(target: NodeCompatibleEventEmitter | ArrayLike<NodeCompatibleEventEmitter>, eventName: string): Observable<T>;\nexport function fromEvent<R>(\n target: NodeCompatibleEventEmitter | ArrayLike<NodeCompatibleEventEmitter>,\n eventName: string,\n resultSelector: (...args: any[]) => R\n): Observable<R>;\n\nexport function fromEvent<T>(\n target: JQueryStyleEventEmitter<any, T> | ArrayLike<JQueryStyleEventEmitter<any, T>>,\n eventName: string\n): Observable<T>;\nexport function fromEvent<T, R>(\n target: JQueryStyleEventEmitter<any, T> | ArrayLike<JQueryStyleEventEmitter<any, T>>,\n eventName: string,\n resultSelector: (value: T, ...args: any[]) => R\n): Observable<R>;\n\n/**\n * Creates an Observable that emits events of a specific type coming from the\n * given event target.\n *\n * <span class=\"informal\">Creates an Observable from DOM events, or Node.js\n * EventEmitter events or others.</span>\n *\n * ![](fromEvent.png)\n *\n * `fromEvent` accepts as a first argument event target, which is an object with methods\n * for registering event handler functions. As a second argument it takes string that indicates\n * type of event we want to listen for. `fromEvent` supports selected types of event targets,\n * which are described in detail below. If your event target does not match any of the ones listed,\n * you should use {@link fromEventPattern}, which can be used on arbitrary APIs.\n * When it comes to APIs supported by `fromEvent`, their methods for adding and removing event\n * handler functions have different names, but they all accept a string describing event type\n * and function itself, which will be called whenever said event happens.\n *\n * Every time resulting Observable is subscribed, event handler function will be registered\n * to event target on given event type. When that event fires, value\n * passed as a first argument to registered function will be emitted by output Observable.\n * When Observable is unsubscribed, function will be unregistered from event target.\n *\n * Note that if event target calls registered function with more than one argument, second\n * and following arguments will not appear in resulting stream. In order to get access to them,\n * you can pass to `fromEvent` optional project function, which will be called with all arguments\n * passed to event handler. Output Observable will then emit value returned by project function,\n * instead of the usual value.\n *\n * Remember that event targets listed below are checked via duck typing. It means that\n * no matter what kind of object you have and no matter what environment you work in,\n * you can safely use `fromEvent` on that object if it exposes described methods (provided\n * of course they behave as was described above). So for example if Node.js library exposes\n * event target which has the same method names as DOM EventTarget, `fromEvent` is still\n * a good choice.\n *\n * If the API you use is more callback then event handler oriented (subscribed\n * callback function fires only once and thus there is no need to manually\n * unregister it), you should use {@link bindCallback} or {@link bindNodeCallback}\n * instead.\n *\n * `fromEvent` supports following types of event targets:\n *\n * **DOM EventTarget**\n *\n * This is an object with `addEventListener` and `removeEventListener` methods.\n *\n * In the browser, `addEventListener` accepts - apart from event type string and event\n * handler function arguments - optional third parameter, which is either an object or boolean,\n * both used for additional configuration how and when passed function will be called. When\n * `fromEvent` is used with event target of that type, you can provide this values\n * as third parameter as well.\n *\n * **Node.js EventEmitter**\n *\n * An object with `addListener` and `removeListener` methods.\n *\n * **JQuery-style event target**\n *\n * An object with `on` and `off` methods\n *\n * **DOM NodeList**\n *\n * List of DOM Nodes, returned for example by `document.querySelectorAll` or `Node.childNodes`.\n *\n * Although this collection is not event target in itself, `fromEvent` will iterate over all Nodes\n * it contains and install event handler function in every of them. When returned Observable\n * is unsubscribed, function will be removed from all Nodes.\n *\n * **DOM HtmlCollection**\n *\n * Just as in case of NodeList it is a collection of DOM nodes. Here as well event handler function is\n * installed and removed in each of elements.\n *\n *\n * ## Examples\n * ### Emits clicks happening on the DOM document\n * ```ts\n * import { fromEvent } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * clicks.subscribe(x => console.log(x));\n *\n * // Results in:\n * // MouseEvent object logged to console every time a click\n * // occurs on the document.\n * ```\n *\n * ### Use addEventListener with capture option\n * ```ts\n * import { fromEvent } from 'rxjs';\n *\n * const clicksInDocument = fromEvent(document, 'click', true); // note optional configuration parameter\n * // which will be passed to addEventListener\n * const clicksInDiv = fromEvent(someDivInDocument, 'click');\n *\n * clicksInDocument.subscribe(() => console.log('document'));\n * clicksInDiv.subscribe(() => console.log('div'));\n *\n * // By default events bubble UP in DOM tree, so normally\n * // when we would click on div in document\n * // \"div\" would be logged first and then \"document\".\n * // Since we specified optional `capture` option, document\n * // will catch event when it goes DOWN DOM tree, so console\n * // will log \"document\" and then \"div\".\n * ```\n *\n * @see {@link bindCallback}\n * @see {@link bindNodeCallback}\n * @see {@link fromEventPattern}\n *\n * @param {FromEventTarget<T>} target The DOM EventTarget, Node.js\n * EventEmitter, JQuery-like event target, NodeList or HTMLCollection to attach the event handler to.\n * @param {string} eventName The event name of interest, being emitted by the\n * `target`.\n * @param {EventListenerOptions} [options] Options to pass through to addEventListener\n * @return {Observable<T>}\n */\nexport function fromEvent<T>(\n target: any,\n eventName: string,\n options?: EventListenerOptions | ((...args: any[]) => T),\n resultSelector?: (...args: any[]) => T\n): Observable<T> {\n if (isFunction(options)) {\n resultSelector = options;\n options = undefined;\n }\n if (resultSelector) {\n return fromEvent<T>(target, eventName, options as EventListenerOptions).pipe(mapOneOrManyArgs(resultSelector));\n }\n\n // Figure out our add and remove methods. In order to do this,\n // we are going to analyze the target in a preferred order, if\n // the target matches a given signature, we take the two \"add\" and \"remove\"\n // method names and apply them to a map to create opposite versions of the\n // same function. This is because they all operate in duplicate pairs,\n // `addListener(name, handler)`, `removeListener(name, handler)`, for example.\n // The call only differs by method name, as to whether or not you're adding or removing.\n const [add, remove] =\n // If it is an EventTarget, we need to use a slightly different method than the other two patterns.\n isEventTarget(target)\n ? eventTargetMethods.map((methodName) => (handler: any) => target[methodName](eventName, handler, options as EventListenerOptions))\n : // In all other cases, the call pattern is identical with the exception of the method names.\n isNodeStyleEventEmitter(target)\n ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName))\n : isJQueryStyleEventEmitter(target)\n ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName))\n : [];\n\n // If add is falsy, it's because we didn't match a pattern above.\n // Check to see if it is an ArrayLike, because if it is, we want to\n // try to apply fromEvent to all of it's items. We do this check last,\n // because there are may be some types that are both ArrayLike *and* implement\n // event registry points, and we'd rather delegate to that when possible.\n if (!add) {\n if (isArrayLike(target)) {\n return mergeMap((subTarget: any) => fromEvent(subTarget, eventName, options as EventListenerOptions))(\n internalFromArray(target)\n ) as Observable<T>;\n }\n }\n\n // If add is falsy and we made it here, it's because we didn't\n // match any valid target objects above.\n if (!add) {\n throw new TypeError('Invalid event target');\n }\n\n return new Observable<T>((subscriber) => {\n // The handler we are going to register. Forwards the event object, by itself, or\n // an array of arguments to the event handler, if there is more than one argument,\n // to the consumer.\n const handler = (...args: any[]) => subscriber.next(1 < args.length ? args : args[0]);\n // Do the work of adding the handler to the target.\n add(handler);\n // When we teardown, we want to remove the handler and free up memory.\n return () => remove!(handler);\n });\n}\n\n/**\n * Used to create `add` and `remove` functions to register and unregister event handlers\n * from a target in the most common handler pattern, where there are only two arguments.\n * (e.g. `on(name, fn)`, `off(name, fn)`, `addListener(name, fn)`, or `removeListener(name, fn)`)\n * @param target The target we're calling methods on\n * @param eventName The event name for the event we're creating register or unregister functions for\n */\nfunction toCommonHandlerRegistry(target: any, eventName: string) {\n return (methodName: string) => (handler: any) => target[methodName](eventName, handler);\n}\n\n/**\n * Checks to see if the target implements the required node-style EventEmitter methods\n * for adding and removing event handlers.\n * @param target the object to check\n */\nfunction isNodeStyleEventEmitter(target: any): target is NodeStyleEventEmitter {\n return isFunction(target.addListener) && isFunction(target.removeListener);\n}\n\n/**\n * Checks to see if the target implements the required jQuery-style EventEmitter methods\n * for adding and removing event handlers.\n * @param target the object to check\n */\nfunction isJQueryStyleEventEmitter(target: any): target is JQueryStyleEventEmitter<any, any> {\n return isFunction(target.on) && isFunction(target.off);\n}\n\n/**\n * Checks to see if the target implements the required EventTarget methods\n * for adding and removing event handlers.\n * @param target the object to check\n */\nfunction isEventTarget(target: any): target is HasEventTargetAddRemove<any> {\n return isFunction(target.addEventListener) && isFunction(target.removeEventListener);\n}\n","import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\nimport { async as asyncScheduler } from '../scheduler/async';\nimport { isScheduler } from '../util/isScheduler';\nimport { isValidDate } from '../util/isDate';\n\n/**\n * Creates an observable that will wait for a specified time period, or exact date, before\n * emitting the number 0.\n *\n * <span class=\"informal\">Used to emit a notification after a delay.</span>\n *\n * This observable is useful for creating delays in code, or racing against other values\n * for ad-hoc timeouts.\n *\n * The `delay` is specified by default in milliseconds, however providing a custom scheduler could\n * create a different behavior.\n *\n * ## Examples\n *\n * ### Wait 3 seconds and start another observable\n *\n * You might want to use `timer` to delay subscription to an\n * observable by a set amount of time. Here we use a timer with\n * {@link concatMapTo} or {@link concatMap} in order to wait\n * a few seconds and start a subscription to a source.\n *\n * ```ts\n * import { timer, of } from 'rxjs';\n * import { concatMapTo } from 'rxjs/operators';\n *\n * // This could be any observable\n * const source = of(1, 2, 3);\n *\n * const result = timer(3000).pipe(\n * concatMapTo(source)\n * )\n * .subscribe(console.log);\n * ```\n *\n * ### Take all of the values until the start of the next minute\n *\n * Using the a date as the trigger for the first emission, you can\n * do things like wait until midnight to fire an event, or in this case,\n * wait until a new minute starts (chosen so the example wouldn't take\n * too long to run) in order to stop watching a stream. Leveraging\n * {@link takeUntil}.\n *\n * ```ts\n * import { interval, timer } from 'rxjs';\n * import { takeUntil } from 'rxjs/operators';\n *\n * // Build a Date object that marks the\n * // next minute.\n * const currentDate = new Date();\n * const startOfNextMinute = new Date(\n * currentDate.getFullYear(),\n * currentDate.getMonth(),\n * currentDate.getDate(),\n * currentDate.getHours(),\n * currentDate.getMinutes() + 1,\n * )\n *\n * // This could be any observable stream\n * const source = interval(1000);\n *\n * const result = source.pipe(\n * takeUntil(timer(startOfNextMinute))\n * );\n *\n * result.subscribe(console.log);\n * ```\n *\n * ### Known Limitations\n *\n * - The {@link asyncScheduler} uses `setTimeout` which has limitations for how far in the future it can be scheduled.\n *\n * - If a `scheduler` is provided that returns a timestamp other than an epoch from `now()`, and\n * a `Date` object is passed to the `dueTime` argument, the calculation for when the first emission\n * should occur will be incorrect. In this case, it would be best to do your own calculations\n * ahead of time, and pass a `number` in as the `dueTime`.\n *\n * @param due If a `number`, the amount of time in milliseconds to wait before emitting.\n * If a `Date`, the exact time at which to emit.\n * @param scheduler The scheduler to use to schedule the delay. Defaults to {@link asyncScheduler}.\n */\nexport function timer(due: number | Date, scheduler?: SchedulerLike): Observable<0>;\n\n/**\n * Creates an observable that starts an interval after a specified delay, emitting incrementing numbers -- starting at `0` --\n * on each interval after words.\n *\n * The `delay` and `intervalDuration` are specified by default in milliseconds, however providing a custom scheduler could\n * create a different behavior.\n *\n * ## Example\n *\n * ### Start an interval that starts right away\n *\n * Since {@link index/interval} waits for the passed delay before starting,\n * sometimes that's not ideal. You may want to start an interval immediately.\n * `timer` works well for this. Here we have both side-by-side so you can\n * see them in comparison.\n *\n * Note that this observable will never complete.\n *\n * ```ts\n * import { timer, interval } from 'rxjs';\n *\n * timer(0, 1000).subscribe(n => console.log('timer', n));\n * interval(1000).subscribe(n => console.log('interval', n));\n * ```\n *\n * ### Known Limitations\n *\n * - The {@link asyncScheduler} uses `setTimeout` which has limitations for how far in the future it can be scheduled.\n *\n * - If a `scheduler` is provided that returns a timestamp other than an epoch from `now()`, and\n * a `Date` object is passed to the `dueTime` argument, the calculation for when the first emission\n * should occur will be incorrect. In this case, it would be best to do your own calculations\n * ahead of time, and pass a `number` in as the `startDue`.\n * @param startDue If a `number`, is the time to wait before starting the interval.\n * If a `Date`, is the exact time at which to start the interval.\n * @param intervalDuration The delay between each value emitted in the interval. Passing a\n * negative number here will result in immediate completion after the first value is emitted, as though\n * no `intervalDuration` was passed at all.\n * @param scheduler The scheduler to use to schedule the delay. Defaults to {@link asyncScheduler}.\n */\nexport function timer(startDue: number | Date, intervalDuration: number, scheduler?: SchedulerLike): Observable<number>;\n\n/**\n * @deprecated The signature allowing `undefined` to be passed for `intervalDuration` will be removed in v8. Use the `timer(dueTime, scheduler?)` signature instead.\n */\nexport function timer(dueTime: number | Date, unused: undefined, scheduler?: SchedulerLike): Observable<0>;\n\nexport function timer(\n dueTime: number | Date = 0,\n intervalOrScheduler?: number | SchedulerLike,\n scheduler: SchedulerLike = asyncScheduler\n): Observable<number> {\n // Since negative intervalDuration is treated as though no\n // interval was specified at all, we start with a negative number.\n let intervalDuration = -1;\n\n if (intervalOrScheduler != null) {\n // If we have a second argument, and it's a scheduler,\n // override the scheduler we had defaulted. Otherwise,\n // it must be an interval.\n if (isScheduler(intervalOrScheduler)) {\n scheduler = intervalOrScheduler;\n } else {\n // Note that this *could* be negative, in which case\n // it's like not passing an intervalDuration at all.\n intervalDuration = intervalOrScheduler;\n }\n }\n\n return new Observable((subscriber) => {\n // If a valid date is passed, calculate how long to wait before\n // executing the first value... otherwise, if it's a number just schedule\n // that many milliseconds (or scheduler-specified unit size) in the future.\n let due = isValidDate(dueTime) ? +dueTime - scheduler!.now() : dueTime;\n\n if (due < 0) {\n // Ensure we don't schedule in the future.\n due = 0;\n }\n\n // The incrementing value we emit.\n let n = 0;\n\n // Start the timer.\n return scheduler.schedule(function () {\n if (!subscriber.closed) {\n // Emit the next value and increment.\n subscriber.next(n++);\n\n if (0 <= intervalDuration) {\n // If we have a interval after the initial timer,\n // reschedule with the period.\n this.schedule(undefined, intervalDuration);\n } else {\n // We didn't have an interval. So just complete.\n subscriber.complete();\n }\n }\n }, due);\n });\n}\n","import { Observable } from '../Observable';\nimport { ObservableInput, ObservableInputTuple, SchedulerLike } from '../types';\nimport { mergeAll } from '../operators/mergeAll';\nimport { internalFromArray } from './fromArray';\nimport { innerFrom } from './from';\nimport { EMPTY } from './empty';\nimport { popNumber, popScheduler } from '../util/args';\n\nexport function merge<A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): Observable<A[number]>;\nexport function merge<A extends readonly unknown[]>(...sourcesAndConcurrency: [...ObservableInputTuple<A>, number?]): Observable<A[number]>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `mergeAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function merge<A extends readonly unknown[]>(\n ...sourcesAndScheduler: [...ObservableInputTuple<A>, SchedulerLike?]\n): Observable<A[number]>;\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `mergeAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function merge<A extends readonly unknown[]>(\n ...sourcesAndConcurrencyAndScheduler: [...ObservableInputTuple<A>, number?, SchedulerLike?]\n): Observable<A[number]>;\n\n/**\n * Creates an output Observable which concurrently emits all values from every\n * given input Observable.\n *\n * <span class=\"informal\">Flattens multiple Observables together by blending\n * their values into one Observable.</span>\n *\n * ![](merge.png)\n *\n * `merge` subscribes to each given input Observable (as arguments), and simply\n * forwards (without doing any transformation) all the values from all the input\n * Observables to the output Observable. The output Observable only completes\n * once all input Observables have completed. Any error delivered by an input\n * Observable will be immediately emitted on the output Observable.\n *\n * ## Examples\n * ### Merge together two Observables: 1s interval and clicks\n * ```ts\n * import { merge, fromEvent, interval } from 'rxjs';\n *\n * const clicks = fromEvent(document, 'click');\n * const timer = interval(1000);\n * const clicksOrTimer = merge(clicks, timer);\n * clicksOrTimer.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // timer will emit ascending values, one every second(1000ms) to console\n * // clicks logs MouseEvents to console everytime the \"document\" is clicked\n * // Since the two streams are merged you see these happening\n * // as they occur.\n * ```\n *\n * ### Merge together 3 Observables, but only 2 run concurrently\n * ```ts\n * import { merge, interval } from 'rxjs';\n * import { take } from 'rxjs/operators';\n *\n * const timer1 = interval(1000).pipe(take(10));\n * const timer2 = interval(2000).pipe(take(6));\n * const timer3 = interval(500).pipe(take(10));\n * const concurrent = 2; // the argument\n * const merged = merge(timer1, timer2, timer3, concurrent);\n * merged.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // - First timer1 and timer2 will run concurrently\n * // - timer1 will emit a value every 1000ms for 10 iterations\n * // - timer2 will emit a value every 2000ms for 6 iterations\n * // - after timer1 hits its max iteration, timer2 will\n * // continue, and timer3 will start to run concurrently with timer2\n * // - when timer2 hits its max iteration it terminates, and\n * // timer3 will continue to emit a value every 500ms until it is complete\n * ```\n *\n * @see {@link mergeAll}\n * @see {@link mergeMap}\n * @see {@link mergeMapTo}\n * @see {@link mergeScan}\n *\n * @param {...ObservableInput} observables Input Observables to merge together.\n * @param {number} [concurrent=Infinity] Maximum number of input\n * Observables being subscribed to concurrently.\n * @param {SchedulerLike} [scheduler=null] The {@link SchedulerLike} to use for managing\n * concurrency of input Observables.\n * @return {Observable} an Observable that emits items that are the result of\n * every input Observable.\n */\nexport function merge(...args: (ObservableInput<unknown> | number | SchedulerLike)[]): Observable<unknown> {\n const scheduler = popScheduler(args);\n const concurrent = popNumber(args, Infinity);\n const sources = args as ObservableInput<unknown>[];\n return !sources.length\n ? // No source provided\n EMPTY\n : sources.length === 1\n ? // One source? Just return it.\n innerFrom(sources[0])\n : // Merge all sources\n mergeAll(concurrent)(internalFromArray(sources, scheduler));\n}\n","const { isArray } = Array;\n\n/**\n * Used in operators and functions that accept either a list of arguments, or an array of arguments\n * as a single argument.\n */\nexport function argsOrArgArray<T>(args: (T | T[])[]): T[] {\n return args.length === 1 && isArray(args[0]) ? args[0] : (args as T[]);\n}\n","import { OperatorFunction, MonoTypeOperatorFunction, TruthyTypesOf } from '../types';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function filter<T, S extends T, A>(predicate: (this: A, value: T, index: number) => value is S, thisArg: A): OperatorFunction<T, S>;\nexport function filter<T, S extends T>(predicate: (value: T, index: number) => value is S): OperatorFunction<T, S>;\nexport function filter<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;\n/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */\nexport function filter<T, A>(predicate: (this: A, value: T, index: number) => boolean, thisArg: A): MonoTypeOperatorFunction<T>;\nexport function filter<T>(predicate: (value: T, index: number) => boolean): MonoTypeOperatorFunction<T>;\n\n/**\n * Filter items emitted by the source Observable by only emitting those that\n * satisfy a specified predicate.\n *\n * <span class=\"informal\">Like\n * [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),\n * it only emits a value from the source if it passes a criterion function.</span>\n *\n * ![](filter.png)\n *\n * Similar to the well-known `Array.prototype.filter` method, this operator\n * takes values from the source Observable, passes them through a `predicate`\n * function and only emits those values that yielded `true`.\n *\n * ## Example\n * Emit only click events whose target was a DIV element\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { filter } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const clicksOnDivs = clicks.pipe(filter(ev => ev.target.tagName === 'DIV'));\n * clicksOnDivs.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link distinct}\n * @see {@link distinctUntilChanged}\n * @see {@link distinctUntilKeyChanged}\n * @see {@link ignoreElements}\n * @see {@link partition}\n * @see {@link skip}\n *\n * @param predicate A function that\n * evaluates each value emitted by the source Observable. If it returns `true`,\n * the value is emitted, if `false` the value is not passed to the output\n * Observable. The `index` parameter is the number `i` for the i-th source\n * emission that has happened since the subscription, starting from the number\n * `0`.\n * @param thisArg An optional argument to determine the value of `this`\n * in the `predicate` function.\n * @return A function that returns an Observable that emits items from the\n * source Observable that satisfy the specified `predicate`.\n */\nexport function filter<T>(predicate: (value: T, index: number) => boolean, thisArg?: any): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n // An index passed to our predicate function on each call.\n let index = 0;\n\n // Subscribe to the source, all errors and completions are\n // forwarded to the consumer.\n source.subscribe(\n // Call the predicate with the appropriate `this` context,\n // if the predicate returns `true`, then send the value\n // to the consumer.\n new OperatorSubscriber(subscriber, (value) => predicate.call(thisArg, value, index++) && subscriber.next(value))\n );\n });\n}\n","import { Observable } from '../Observable';\nimport { ObservableInputTuple } from '../types';\nimport { innerFrom } from './from';\nimport { argsOrArgArray } from '../util/argsOrArgArray';\nimport { EMPTY } from './empty';\nimport { OperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { popResultSelector } from '../util/args';\n\nexport function zip<A extends readonly unknown[]>(sources: [...ObservableInputTuple<A>]): Observable<A>;\nexport function zip<A extends readonly unknown[], R>(\n sources: [...ObservableInputTuple<A>],\n resultSelector: (...values: A) => R\n): Observable<R>;\nexport function zip<A extends readonly unknown[]>(...sources: [...ObservableInputTuple<A>]): Observable<A>;\nexport function zip<A extends readonly unknown[], R>(\n ...sourcesAndResultSelector: [...ObservableInputTuple<A>, (...values: A) => R]\n): Observable<R>;\n\n/**\n * Combines multiple Observables to create an Observable whose values are calculated from the values, in order, of each\n * of its input Observables.\n *\n * If the last parameter is a function, this function is used to compute the created value from the input values.\n * Otherwise, an array of the input values is returned.\n *\n * ## Example\n *\n * Combine age and name from different sources\n *\n * ```ts\n * import { zip, of } from 'rxjs';\n * import { map } from 'rxjs/operators';\n *\n * let age$ = of(27, 25, 29);\n * let name$ = of('Foo', 'Bar', 'Beer');\n * let isDev$ = of(true, true, false);\n *\n * zip(age$, name$, isDev$).pipe(\n * map(([age, name, isDev]) => ({ age, name, isDev }))\n * )\n * .subscribe(x => console.log(x));\n *\n * // Outputs\n * // { age: 27, name: 'Foo', isDev: true }\n * // { age: 25, name: 'Bar', isDev: true }\n * // { age: 29, name: 'Beer', isDev: false }\n * ```\n * @param sources\n * @return {Observable<R>}\n */\nexport function zip(...args: unknown[]): Observable<unknown> {\n const resultSelector = popResultSelector(args);\n\n const sources = argsOrArgArray(args) as Observable<unknown>[];\n\n return sources.length\n ? new Observable<unknown[]>((subscriber) => {\n // A collection of buffers of values from each source.\n // Keyed by the same index with which the sources were passed in.\n let buffers: unknown[][] = sources.map(() => []);\n\n // An array of flags of whether or not the sources have completed.\n // This is used to check to see if we should complete the result.\n // Keyed by the same index with which the sources were passed in.\n let completed = sources.map(() => false);\n\n // When everything is done, release the arrays above.\n subscriber.add(() => {\n buffers = completed = null!;\n });\n\n // Loop over our sources and subscribe to each one. The index `i` is\n // especially important here, because we use it in closures below to\n // access the related buffers and completion properties\n for (let sourceIndex = 0; !subscriber.closed && sourceIndex < sources.length; sourceIndex++) {\n innerFrom(sources[sourceIndex]).subscribe(\n new OperatorSubscriber(\n subscriber,\n (value) => {\n buffers[sourceIndex].push(value);\n // if every buffer has at least one value in it, then we\n // can shift out the oldest value from each buffer and emit\n // them as an array.\n if (buffers.every((buffer) => buffer.length)) {\n const result: any = buffers.map((buffer) => buffer.shift()!);\n // Emit the array. If theres' a result selector, use that.\n subscriber.next(resultSelector ? resultSelector(...result) : result);\n // If any one of the sources is both complete and has an empty buffer\n // then we complete the result. This is because we cannot possibly have\n // any more values to zip together.\n if (buffers.some((buffer, i) => !buffer.length && completed[i])) {\n subscriber.complete();\n }\n }\n },\n () => {\n // This source completed. Mark it as complete so we can check it later\n // if we have to.\n completed[sourceIndex] = true;\n // But, if this complete source has nothing in its buffer, then we\n // can complete the result, because we can't possibly have any more\n // values from this to zip together with the other values.\n !buffers[sourceIndex].length && subscriber.complete();\n }\n )\n );\n }\n\n // When everything is done, release the arrays above.\n return () => {\n buffers = completed = null!;\n };\n })\n : EMPTY;\n}\n","import { async } from '../scheduler/async';\nimport { audit } from './audit';\nimport { timer } from '../observable/timer';\nimport { MonoTypeOperatorFunction, SchedulerLike } from '../types';\n\n/**\n * Ignores source values for `duration` milliseconds, then emits the most recent\n * value from the source Observable, then repeats this process.\n *\n * <span class=\"informal\">When it sees a source value, it ignores that plus\n * the next ones for `duration` milliseconds, and then it emits the most recent\n * value from the source.</span>\n *\n * ![](auditTime.png)\n *\n * `auditTime` is similar to `throttleTime`, but emits the last value from the\n * silenced time window, instead of the first value. `auditTime` emits the most\n * recent value from the source Observable on the output Observable as soon as\n * its internal timer becomes disabled, and ignores source values while the\n * timer is enabled. Initially, the timer is disabled. As soon as the first\n * source value arrives, the timer is enabled. After `duration` milliseconds (or\n * the time unit determined internally by the optional `scheduler`) has passed,\n * the timer is disabled, then the most recent source value is emitted on the\n * output Observable, and this process repeats for the next source value.\n * Optionally takes a {@link SchedulerLike} for managing timers.\n *\n * ## Example\n *\n * Emit clicks at a rate of at most one click per second\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { auditTime } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(auditTime(1000));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link audit}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttleTime}\n *\n * @param {number} duration Time to wait before emitting the most recent source\n * value, measured in milliseconds or the time unit determined internally\n * by the optional `scheduler`.\n * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for\n * managing the timers that handle the rate-limiting behavior.\n * @return A function that returns an Observable that performs rate-limiting of\n * emissions from the source Observable.\n */\nexport function auditTime<T>(duration: number, scheduler: SchedulerLike = async): MonoTypeOperatorFunction<T> {\n return audit(() => timer(duration, scheduler));\n}\n","import { Subscriber } from '../Subscriber';\nimport { MonoTypeOperatorFunction, ObservableInput } from '../types';\n\nimport { operate } from '../util/lift';\nimport { innerFrom } from '../observable/from';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Ignores source values for a duration determined by another Observable, then\n * emits the most recent value from the source Observable, then repeats this\n * process.\n *\n * <span class=\"informal\">It's like {@link auditTime}, but the silencing\n * duration is determined by a second Observable.</span>\n *\n * ![](audit.png)\n *\n * `audit` is similar to `throttle`, but emits the last value from the silenced\n * time window, instead of the first value. `audit` emits the most recent value\n * from the source Observable on the output Observable as soon as its internal\n * timer becomes disabled, and ignores source values while the timer is enabled.\n * Initially, the timer is disabled. As soon as the first source value arrives,\n * the timer is enabled by calling the `durationSelector` function with the\n * source value, which returns the \"duration\" Observable. When the duration\n * Observable emits a value, the timer is disabled, then the most\n * recent source value is emitted on the output Observable, and this process\n * repeats for the next source value.\n *\n * ## Example\n *\n * Emit clicks at a rate of at most one click per second\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { audit } from 'rxjs/operators'\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(audit(ev => interval(1000)));\n * result.subscribe(x => console.log(x));\n * ```\n * @see {@link auditTime}\n * @see {@link debounce}\n * @see {@link delayWhen}\n * @see {@link sample}\n * @see {@link throttle}\n *\n * @param durationSelector A function\n * that receives a value from the source Observable, for computing the silencing\n * duration, returned as an Observable or a Promise.\n * @return A function that returns an Observable that performs rate-limiting of\n * emissions from the source Observable.\n */\nexport function audit<T>(durationSelector: (value: T) => ObservableInput<any>): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let hasValue = false;\n let lastValue: T | null = null;\n let durationSubscriber: Subscriber<any> | null = null;\n let isComplete = false;\n\n const endDuration = () => {\n durationSubscriber?.unsubscribe();\n durationSubscriber = null;\n if (hasValue) {\n hasValue = false;\n const value = lastValue!;\n lastValue = null;\n subscriber.next(value);\n }\n isComplete && subscriber.complete();\n };\n\n const cleanupDuration = () => {\n durationSubscriber = null;\n isComplete && subscriber.complete();\n };\n\n source.subscribe(\n new OperatorSubscriber(\n subscriber,\n (value) => {\n hasValue = true;\n lastValue = value;\n if (!durationSubscriber) {\n innerFrom(durationSelector(value)).subscribe(\n (durationSubscriber = new OperatorSubscriber(subscriber, endDuration, cleanupDuration))\n );\n }\n },\n () => {\n isComplete = true;\n (!hasValue || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();\n }\n )\n );\n });\n}\n","import { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\nimport { arrRemove } from '../util/arrRemove';\n\n/**\n * Buffers the source Observable values until the size hits the maximum\n * `bufferSize` given.\n *\n * <span class=\"informal\">Collects values from the past as an array, and emits\n * that array only when its size reaches `bufferSize`.</span>\n *\n * ![](bufferCount.png)\n *\n * Buffers a number of values from the source Observable by `bufferSize` then\n * emits the buffer and clears it, and starts a new buffer each\n * `startBufferEvery` values. If `startBufferEvery` is not provided or is\n * `null`, then new buffers are started immediately at the start of the source\n * and when each buffer closes and is emitted.\n *\n * ## Examples\n *\n * Emit the last two click events as an array\n *\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { bufferCount } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const buffered = clicks.pipe(bufferCount(2));\n * buffered.subscribe(x => console.log(x));\n * ```\n *\n * On every click, emit the last two click events as an array\n *\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { bufferCount } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const buffered = clicks.pipe(bufferCount(2, 1));\n * buffered.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link buffer}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link bufferWhen}\n * @see {@link pairwise}\n * @see {@link windowCount}\n *\n * @param {number} bufferSize The maximum size of the buffer emitted.\n * @param {number} [startBufferEvery] Interval at which to start a new buffer.\n * For example if `startBufferEvery` is `2`, then a new buffer will be started\n * on every other value from the source. A new buffer is started at the\n * beginning of the source by default.\n * @return A function that returns an Observable of arrays of buffered values.\n */\nexport function bufferCount<T>(bufferSize: number, startBufferEvery: number | null = null): OperatorFunction<T, T[]> {\n // If no `startBufferEvery` value was supplied, then we're\n // opening and closing on the bufferSize itself.\n startBufferEvery = startBufferEvery ?? bufferSize;\n\n return operate((source, subscriber) => {\n let buffers: T[][] = [];\n let count = 0;\n\n source.subscribe(\n new OperatorSubscriber(\n subscriber,\n (value) => {\n let toEmit: T[][] | null = null;\n\n // Check to see if we need to start a buffer.\n // This will start one at the first value, and then\n // a new one every N after that.\n if (count++ % startBufferEvery! === 0) {\n buffers.push([]);\n }\n\n // Push our value into our active buffers.\n for (const buffer of buffers) {\n buffer.push(value);\n // Check to see if we're over the bufferSize\n // if we are, record it so we can emit it later.\n // If we emitted it now and removed it, it would\n // mutate the `buffers` array while we're looping\n // over it.\n if (bufferSize <= buffer.length) {\n toEmit = toEmit ?? [];\n toEmit.push(buffer);\n }\n }\n\n if (toEmit) {\n // We have found some buffers that are over the\n // `bufferSize`. Emit them, and remove them from our\n // buffers list.\n for (const buffer of toEmit) {\n arrRemove(buffers, buffer);\n subscriber.next(buffer);\n }\n }\n },\n () => {\n // When the source completes, emit all of our\n // active buffers.\n for (const buffer of buffers) {\n subscriber.next(buffer);\n }\n subscriber.complete();\n },\n // Pass all errors through to consumer.\n undefined,\n () => {\n // Clean up our memory when we teardown\n buffers = null!;\n }\n )\n );\n });\n}\n","import { Observable } from '../Observable';\n\nimport { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';\nimport { Subscription } from '../Subscription';\nimport { innerFrom } from '../observable/from';\nimport { OperatorSubscriber } from './OperatorSubscriber';\nimport { operate } from '../util/lift';\n\n/* tslint:disable:max-line-length */\nexport function catchError<T, O extends ObservableInput<any>>(\n selector: (err: any, caught: Observable<T>) => O\n): OperatorFunction<T, T | ObservedValueOf<O>>;\n/* tslint:enable:max-line-length */\n\n/**\n * Catches errors on the observable to be handled by returning a new observable or throwing an error.\n *\n * <span class=\"informal\">\n * It only listens to the error channel and ignores notifications.\n * Handles errors from the source observable, and maps them to a new observable.\n * The error may also be rethrown, or a new error can be thrown to emit an error from the result.\n * </span>\n *\n * ![](catch.png)\n *\n * This operator handles errors, but forwards along all other events to the resulting observable.\n * If the source observable terminates with an error, it will map that error to a new observable,\n * subscribe to it, and forward all of its events to the resulting observable.\n *\n * ## Examples\n * Continues with a different Observable when there's an error\n *\n * ```ts\n * import { of } from 'rxjs';\n * import { map, catchError } from 'rxjs/operators';\n *\n * of(1, 2, 3, 4, 5).pipe(\n * map(n => {\n * \t if (n === 4) {\n * \t throw 'four!';\n * }\n *\t return n;\n * }),\n * catchError(err => of('I', 'II', 'III', 'IV', 'V')),\n * )\n * .subscribe(x => console.log(x));\n * // 1, 2, 3, I, II, III, IV, V\n * ```\n *\n * Retries the caught source Observable again in case of error, similar to retry() operator\n *\n * ```ts\n * import { of } from 'rxjs';\n * import { map, catchError, take } from 'rxjs/operators';\n *\n * of(1, 2, 3, 4, 5).pipe(\n * map(n => {\n * \t if (n === 4) {\n * \t throw 'four!';\n * }\n * \t return n;\n * }),\n * catchError((err, caught) => caught),\n * take(30),\n * )\n * .subscribe(x => console.log(x));\n * // 1, 2, 3, 1, 2, 3, ...\n * ```\n *\n * Throws a new error when the source Observable throws an error\n *\n * ```ts\n * import { of } from 'rxjs';\n * import { map, catchError } from 'rxjs/operators';\n *\n * of(1, 2, 3, 4, 5).pipe(\n * map(n => {\n * if (n === 4) {\n * throw 'four!';\n * }\n * return n;\n * }),\n * catchError(err => {\n * throw 'error in source. Details: ' + err;\n * }),\n * )\n * .subscribe(\n * x => console.log(x),\n * err => console.log(err)\n * );\n * // 1, 2, 3, error in source. Details: four!\n * ```\n *\n * @see {@link onErrorResumeNext}\n * @see {@link repeat}\n * @see {@link repeatWhen}\n * @see {@link retry }\n * @see {@link retryWhen}\n *\n * @param {function} selector a function that takes as arguments `err`, which is the error, and `caught`, which\n * is the source observable, in case you'd like to \"retry\" that observable by returning it again. Whatever observable\n * is returned by the `selector` will be used to continue the observable chain.\n * @return A function that returns an Observable that originates from either\n * the source or the Observable returned by the `selector` function.\n */\nexport function catchError<T, O extends ObservableInput<any>>(\n selector: (err: any, caught: Observable<T>) => O\n): OperatorFunction<T, T | ObservedValueOf<O>> {\n return operate((source, subscriber) => {\n let innerSub: Subscription | null = null;\n let syncUnsub = false;\n let handledResult: Observable<ObservedValueOf<O>>;\n\n innerSub = source.subscribe(\n new OperatorSubscriber(subscriber, undefined, undefined, (err) => {\n handledResult = innerFrom(selector(err, catchError(selector)(source)));\n if (innerSub) {\n innerSub.unsubscribe();\n innerSub = null;\n handledResult.subscribe(subscriber);\n } else {\n // We don't have an innerSub yet, that means the error was synchronous\n // because the subscribe call hasn't returned yet.\n syncUnsub = true;\n }\n })\n );\n\n if (syncUnsub) {\n // We have a synchronous error, we need to make sure to\n // teardown right away. This ensures that `finalize` is called\n // at the right time, and that teardown occurs at the expected\n // time between the source error and the subscription to the\n // next observable.\n innerSub.unsubscribe();\n innerSub = null;\n handledResult!.subscribe(subscriber);\n }\n });\n}\n","import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * A basic scan operation. This is used for `scan` and `reduce`.\n * @param accumulator The accumulator to use\n * @param seed The seed value for the state to accumulate\n * @param hasSeed Whether or not a seed was provided\n * @param emitOnNext Whether or not to emit the state on next\n * @param emitBeforeComplete Whether or not to emit the before completion\n */\n\nexport function scanInternals<V, A, S>(\n accumulator: (acc: V | A | S, value: V, index: number) => A,\n seed: S,\n hasSeed: boolean,\n emitOnNext: boolean,\n emitBeforeComplete?: undefined | true\n) {\n return (source: Observable<V>, subscriber: Subscriber<any>) => {\n // Whether or not we have state yet. This will only be\n // false before the first value arrives if we didn't get\n // a seed value.\n let hasState = hasSeed;\n // The state that we're tracking, starting with the seed,\n // if there is one, and then updated by the return value\n // from the accumulator on each emission.\n let state: any = seed;\n // An index to pass to the accumulator function.\n let index = 0;\n\n // Subscribe to our source. All errors and completions are passed through.\n source.subscribe(\n new OperatorSubscriber(\n subscriber,\n (value) => {\n // Always increment the index.\n const i = index++;\n // Set the state\n state = hasState\n ? // We already have state, so we can get the new state from the accumulator\n accumulator(state, value, i)\n : // We didn't have state yet, a seed value was not provided, so\n\n // we set the state to the first value, and mark that we have state now\n ((hasState = true), value);\n\n // Maybe send it to the consumer.\n emitOnNext && subscriber.next(state);\n },\n // If an onComplete was given, call it, otherwise\n // just pass through the complete notification to the consumer.\n emitBeforeComplete &&\n (() => {\n hasState && subscriber.next(state);\n subscriber.complete();\n })\n )\n );\n };\n}\n","import { scanInternals } from './scanInternals';\nimport { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\n\nexport function reduce<V, A = V>(accumulator: (acc: A | V, value: V, index: number) => A): OperatorFunction<V, V | A>;\nexport function reduce<V, A>(accumulator: (acc: A, value: V, index: number) => A, seed: A): OperatorFunction<V, A>;\nexport function reduce<V, A, S = A>(accumulator: (acc: A | S, value: V, index: number) => A, seed: S): OperatorFunction<V, A>;\n\n/**\n * Applies an accumulator function over the source Observable, and returns the\n * accumulated result when the source completes, given an optional seed value.\n *\n * <span class=\"informal\">Combines together all values emitted on the source,\n * using an accumulator function that knows how to join a new source value into\n * the accumulation from the past.</span>\n *\n * ![](reduce.png)\n *\n * Like\n * [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce),\n * `reduce` applies an `accumulator` function against an accumulation and each\n * value of the source Observable (from the past) to reduce it to a single\n * value, emitted on the output Observable. Note that `reduce` will only emit\n * one value, only when the source Observable completes. It is equivalent to\n * applying operator {@link scan} followed by operator {@link last}.\n *\n * Returns an Observable that applies a specified `accumulator` function to each\n * item emitted by the source Observable. If a `seed` value is specified, then\n * that value will be used as the initial value for the accumulator. If no seed\n * value is specified, the first item of the source is used as the seed.\n *\n * ## Example\n * Count the number of click events that happened in 5 seconds\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { reduce, takeUntil, mapTo } from 'rxjs/operators';\n *\n * const clicksInFiveSeconds = fromEvent(document, 'click').pipe(\n * takeUntil(interval(5000)),\n * );\n * const ones = clicksInFiveSeconds.pipe(mapTo(1));\n * const seed = 0;\n * const count = ones.pipe(reduce((acc, one) => acc + one, seed));\n * count.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link count}\n * @see {@link expand}\n * @see {@link mergeScan}\n * @see {@link scan}\n *\n * @param {function(acc: A, value: V, index: number): A} accumulator The accumulator function\n * called on each source value.\n * @param {A} [seed] The initial accumulation value.\n * @return A function that returns an Observable that emits a single value that\n * is the result of accumulating the values emitted by the source Observable.\n */\nexport function reduce<V, A>(accumulator: (acc: V | A, value: V, index: number) => A, seed?: any): OperatorFunction<V, V | A> {\n return operate(scanInternals(accumulator, seed, arguments.length >= 2, false, true));\n}\n","import { mergeMap } from './mergeMap';\nimport { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';\nimport { isFunction } from '../util/isFunction';\n\n/* tslint:disable:max-line-length */\nexport function concatMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function concatMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector: undefined\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function concatMap<T, R, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Projects each source value to an Observable which is merged in the output\n * Observable, in a serialized fashion waiting for each one to complete before\n * merging the next.\n *\n * <span class=\"informal\">Maps each value to an Observable, then flattens all of\n * these inner Observables using {@link concatAll}.</span>\n *\n * ![](concatMap.png)\n *\n * Returns an Observable that emits items based on applying a function that you\n * supply to each item emitted by the source Observable, where that function\n * returns an (so-called \"inner\") Observable. Each new inner Observable is\n * concatenated with the previous inner Observable.\n *\n * __Warning:__ if source values arrive endlessly and faster than their\n * corresponding inner Observables can complete, it will result in memory issues\n * as inner Observables amass in an unbounded buffer waiting for their turn to\n * be subscribed to.\n *\n * Note: `concatMap` is equivalent to `mergeMap` with concurrency parameter set\n * to `1`.\n *\n * ## Example\n * For each click event, tick every second from 0 to 3, with no concurrency\n *\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { concatMap, take } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(\n * concatMap(ev => interval(1000).pipe(take(4)))\n * );\n * result.subscribe(x => console.log(x));\n *\n * // Results in the following:\n * // (results are not concurrent)\n * // For every click on the \"document\" it will emit values 0 to 3 spaced\n * // on a 1000ms interval\n * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3\n * ```\n *\n * @see {@link concat}\n * @see {@link concatAll}\n * @see {@link concatMapTo}\n * @see {@link exhaustMap}\n * @see {@link mergeMap}\n * @see {@link switchMap}\n *\n * @param {function(value: T, ?index: number): ObservableInput} project A function\n * that, when applied to an item emitted by the source Observable, returns an\n * Observable.\n * @return A function that returns an Observable that emits the result of\n * applying the projection function (and the optional deprecated\n * `resultSelector`) to each item emitted by the source Observable and taking\n * values from each projected inner Observable sequentially.\n */\nexport function concatMap<T, R, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector?: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, ObservedValueOf<O> | R> {\n return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);\n}\n","import { OperatorFunction, ObservableInput, ObservedValueOf, SubjectLike } from '../types';\nimport { Observable } from '../Observable';\nimport { Subject } from '../Subject';\nimport { from } from '../observable/from';\nimport { operate } from '../util/lift';\nimport { fromSubscribable } from '../observable/fromSubscribable';\n\nexport interface ConnectConfig<T> {\n /**\n * A factory function used to create the Subject through which the source\n * is multicast. By default this creates a {@link Subject}.\n */\n connector: () => SubjectLike<T>;\n}\n\n/**\n * The default configuration for `connect`.\n */\nconst DEFAULT_CONFIG: ConnectConfig<unknown> = {\n connector: () => new Subject<unknown>(),\n};\n\n/**\n * Creates an observable by multicasting the source within a function that\n * allows the developer to define the usage of the multicast prior to connection.\n *\n * This is particularly useful if the observable source you wish to multicast could\n * be synchronous or asynchronous. This sets it apart from {@link share}, which, in the\n * case of totally synchronous sources will fail to share a single subscription with\n * multiple consumers, as by the time the subscription to the result of {@link share}\n * has returned, if the source is synchronous its internal reference count will jump from\n * 0 to 1 back to 0 and reset.\n *\n * To use `connect`, you provide a `selector` function that will give you\n * a multicast observable that is not yet connected. You then use that multicast observable\n * to create a resulting observable that, when subscribed, will set up your multicast. This is\n * generally, but not always, accomplished with {@link merge}.\n *\n * Note that using a {@link takeUntil} inside of `connect`'s `selector` _might_ mean you were looking\n * to use the {@link takeWhile} operator instead.\n *\n * When you subscribe to the result of `connect`, the `selector` function will be called. After\n * the `selector` function returns, the observable it returns will be subscribed to, _then_ the\n * multicast will be connected to the source.\n *\n * ### Example\n *\n * Sharing a totally synchronous observable\n *\n * ```ts\n * import { defer, of } from 'rxjs';\n * import { tap, connect } from 'rxjs/operators';\n *\n * const source$ = defer(() => {\n * console.log('subscription started');\n * return of(1, 2, 3, 4, 5).pipe(\n * tap(n => console.log(`source emitted ${n}`))\n * );\n * });\n *\n * source$.pipe(\n * // Notice in here we're merging 3 subscriptions to `shared$`.\n * connect((shared$) => merge(\n * shared$.pipe(map(n => `all ${n}`)),\n * shared$.pipe(filter(n => n % 2 === 0), map(n => `even ${n}`)),\n * shared$.pipe(filter(n => n % 2 === 1), map(n => `odd ${n}`)),\n * ))\n * )\n * .subscribe(console.log);\n *\n * // Expected output: (notice only one subscription)\n * \"subscription started\"\n * \"source emitted 1\"\n * \"all 1\"\n * \"odd 1\"\n * \"source emitted 2\"\n * \"all 2\"\n * \"even 2\"\n * \"source emitted 3\"\n * \"all 3\"\n * \"odd 3\"\n * \"source emitted 4\"\n * \"all 4\"\n * \"even 4\"\n * \"source emitted 5\"\n * \"all 5\"\n * \"odd 5\"\n * ```\n *\n * @param selector A function used to set up the multicast. Gives you a multicast observable\n * that is not yet connected. With that, you're expected to create and return\n * and Observable, that when subscribed to, will utilize the multicast observable.\n * After this function is executed -- and its return value subscribed to -- the\n * the operator will subscribe to the source, and the connection will be made.\n * @param config The configuration object for `connect`.\n */\nexport function connect<T, O extends ObservableInput<unknown>>(\n selector: (shared: Observable<T>) => O,\n config: ConnectConfig<T> = DEFAULT_CONFIG\n): OperatorFunction<T, ObservedValueOf<O>> {\n const { connector } = config;\n return operate((source, subscriber) => {\n const subject = connector();\n from(selector(fromSubscribable(subject))).subscribe(subscriber);\n subscriber.add(source.subscribe(subject));\n });\n}\n","import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { Subscribable } from '../types';\n\n/**\n * Used to convert a subscribable to an observable.\n *\n * Currently, this is only used within internals.\n *\n * TODO: Discuss ObservableInput supporting \"Subscribable\".\n * https://github.com/ReactiveX/rxjs/issues/5909\n *\n * @param subscribable A subscribable\n */\nexport function fromSubscribable<T>(subscribable: Subscribable<T>) {\n return new Observable((subscriber: Subscriber<T>) => subscribable.subscribe(subscriber));\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { Subscription } from '../Subscription';\nimport { MonoTypeOperatorFunction, SchedulerAction, SchedulerLike } from '../types';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Emits a notification from the source Observable only after a particular time span\n * has passed without another source emission.\n *\n * <span class=\"informal\">It's like {@link delay}, but passes only the most\n * recent notification from each burst of emissions.</span>\n *\n * ![](debounceTime.png)\n *\n * `debounceTime` delays notifications emitted by the source Observable, but drops\n * previous pending delayed emissions if a new notification arrives on the source\n * Observable. This operator keeps track of the most recent notification from the\n * source Observable, and emits that only when `dueTime` has passed\n * without any other notification appearing on the source Observable. If a new value\n * appears before `dueTime` silence occurs, the previous notification will be dropped\n * and will not be emitted and a new `dueTime` is scheduled.\n * If the completing event happens during `dueTime` the last cached notification\n * is emitted before the completion event is forwarded to the output observable.\n * If the error event happens during `dueTime` or after it only the error event is\n * forwarded to the output observable. The cache notification is not emitted in this case.\n *\n * This is a rate-limiting operator, because it is impossible for more than one\n * notification to be emitted in any time window of duration `dueTime`, but it is also\n * a delay-like operator since output emissions do not occur at the same time as\n * they did on the source Observable. Optionally takes a {@link SchedulerLike} for\n * managing timers.\n *\n * ## Example\n * Emit the most recent click after a burst of clicks\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { debounceTime } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(debounceTime(1000));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link audit}\n * @see {@link auditTime}\n * @see {@link debounce}\n * @see {@link debounceTime}\n * @see {@link sample}\n * @see {@link sampleTime}\n * @see {@link throttle}\n * @see {@link throttleTime}\n *\n * @param {number} dueTime The timeout duration in milliseconds (or the time\n * unit determined internally by the optional `scheduler`) for the window of\n * time required to wait for emission silence before emitting the most recent\n * source value.\n * @param {SchedulerLike} [scheduler=async] The {@link SchedulerLike} to use for\n * managing the timers that handle the timeout for each value.\n * @return A function that returns an Observable that delays the emissions of\n * the source Observable by the specified `dueTime`, and may drop some values\n * if they occur too frequently.\n */\nexport function debounceTime<T>(dueTime: number, scheduler: SchedulerLike = asyncScheduler): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let activeTask: Subscription | null = null;\n let lastValue: T | null = null;\n let lastTime: number | null = null;\n\n const emit = () => {\n if (activeTask) {\n // We have a value! Free up memory first, then emit the value.\n activeTask.unsubscribe();\n activeTask = null;\n const value = lastValue!;\n lastValue = null;\n subscriber.next(value);\n }\n };\n function emitWhenIdle(this: SchedulerAction<unknown>) {\n // This is called `dueTime` after the first value\n // but we might have received new values during this window!\n\n const targetTime = lastTime! + dueTime;\n const now = scheduler.now();\n if (now < targetTime) {\n // On that case, re-schedule to the new target\n activeTask = this.schedule(undefined, targetTime - now);\n subscriber.add(activeTask);\n return;\n }\n\n emit();\n }\n\n source.subscribe(\n new OperatorSubscriber(\n subscriber,\n (value: T) => {\n lastValue = value;\n lastTime = scheduler.now();\n\n // Only set up a task if it's not already up\n if (!activeTask) {\n activeTask = scheduler.schedule(emitWhenIdle, dueTime);\n subscriber.add(activeTask);\n }\n },\n () => {\n // Source completed.\n // Emit any pending debounced values then complete\n emit();\n subscriber.complete();\n },\n // Pass all errors through to consumer.\n undefined,\n () => {\n // Teardown.\n lastValue = activeTask = null;\n }\n )\n );\n });\n}\n","import { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Emits a given value if the source Observable completes without emitting any\n * `next` value, otherwise mirrors the source Observable.\n *\n * <span class=\"informal\">If the source Observable turns out to be empty, then\n * this operator will emit a default value.</span>\n *\n * ![](defaultIfEmpty.png)\n *\n * `defaultIfEmpty` emits the values emitted by the source Observable or a\n * specified default value if the source Observable is empty (completes without\n * having emitted any `next` value).\n *\n * ## Example\n * If no clicks happen in 5 seconds, then emit \"no clicks\"\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { defaultIfEmpty, takeUntil } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const clicksBeforeFive = clicks.pipe(takeUntil(interval(5000)));\n * const result = clicksBeforeFive.pipe(defaultIfEmpty('no clicks'));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link empty}\n * @see {@link last}\n *\n * @param defaultValue The default value used if the source\n * Observable is empty.\n * @return A function that returns an Observable that emits either the\n * specified `defaultValue` if the source Observable emits no items, or the\n * values emitted by the source Observable.\n */\nexport function defaultIfEmpty<T, R>(defaultValue: R): OperatorFunction<T, T | R> {\n return operate((source, subscriber) => {\n let hasValue = false;\n source.subscribe(\n new OperatorSubscriber(\n subscriber,\n (value) => {\n hasValue = true;\n subscriber.next(value);\n },\n () => {\n if (!hasValue) {\n subscriber.next(defaultValue!);\n }\n subscriber.complete();\n }\n )\n );\n });\n}\n","import { MonoTypeOperatorFunction } from '../types';\nimport { EMPTY } from '../observable/empty';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Emits only the first `count` values emitted by the source Observable.\n *\n * <span class=\"informal\">Takes the first `count` values from the source, then\n * completes.</span>\n *\n * ![](take.png)\n *\n * `take` returns an Observable that emits only the first `count` values emitted\n * by the source Observable. If the source emits fewer than `count` values then\n * all of its values are emitted. After that, it completes, regardless if the\n * source completes.\n *\n * ## Example\n * Take the first 5 seconds of an infinite 1-second interval Observable\n * ```ts\n * import { interval } from 'rxjs';\n * import { take } from 'rxjs/operators';\n *\n * const intervalCount = interval(1000);\n * const takeFive = intervalCount.pipe(take(5));\n * takeFive.subscribe(x => console.log(x));\n *\n * // Logs:\n * // 0\n * // 1\n * // 2\n * // 3\n * // 4\n * ```\n *\n * @see {@link takeLast}\n * @see {@link takeUntil}\n * @see {@link takeWhile}\n * @see {@link skip}\n *\n * @param count The maximum number of `next` values to emit.\n * @return A function that returns an Observable that emits only the first\n * `count` values emitted by the source Observable, or all of the values from\n * the source if the source emits fewer than `count` values.\n */\nexport function take<T>(count: number): MonoTypeOperatorFunction<T> {\n return count <= 0\n ? // If we are taking no values, that's empty.\n () => EMPTY\n : operate((source, subscriber) => {\n let seen = 0;\n source.subscribe(\n new OperatorSubscriber(subscriber, (value) => {\n // Increment the number of values we have seen,\n // then check it against the allowed count to see\n // if we are still letting values through.\n if (++seen <= count) {\n subscriber.next(value);\n // If we have met or passed our allowed count,\n // we need to complete. We have to do <= here,\n // because re-entrant code will increment `seen` twice.\n if (count <= seen) {\n subscriber.complete();\n }\n }\n })\n );\n });\n}\n","import { MonoTypeOperatorFunction } from '../types';\nimport { identity } from '../util/identity';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Returns a result {@link Observable} that emits all values pushed by the source observable if they\n * are distinct in comparison to the last value the result observable emitted.\n *\n * 1. It will always emit the first value from the source.\n * 2. For all subsequent values pushed by the source, they will be compared to the previously emitted values\n * using the provided `comparator` or an `===` equality check.\n * 3. If the value pushed by the source is determined to be unequal by this check, that value is emitted and\n * becomes the new \"previously emitted value\" internally.\n *\n * ## Example\n *\n * A very basic example with no `comparator`. Note that `1` is emitted more than once,\n * because it's distinct in comparison to the _previously emitted_ value,\n * not in comparison to _all other emitted values_.\n *\n * ```ts\n * import { of } from 'rxjs';\n * import { distinctUntilChanged } from 'rxjs/operators';\n *\n * of(1, 1, 1, 2, 2, 2, 1, 1, 3, 3).pipe(\n * distinctUntilChanged()\n * )\n * .subscribe(console.log);\n * // Logs: 1, 2, 1, 3\n * ```\n *\n * ## Example\n *\n * With a `comparator`, you can do custom comparisons. Let's say\n * you only want to emit a value when all of its components have\n * changed:\n *\n * ```ts\n * import { of } from 'rxjs';\n * import { distinctUntilChanged } from 'rxjs/operators';\n *\n * const totallyDifferentBuilds$ = of(\n * { engineVersion: '1.1.0', transmissionVersion: '1.2.0' },\n * { engineVersion: '1.1.0', transmissionVersion: '1.4.0' },\n * { engineVersion: '1.3.0', transmissionVersion: '1.4.0' },\n * { engineVersion: '1.3.0', transmissionVersion: '1.5.0' },\n * { engineVersion: '2.0.0', transmissionVersion: '1.5.0' }\n * ).pipe(\n * distinctUntilChanged((prev, curr) => {\n * return (\n * prev.engineVersion === curr.engineVersion ||\n * prev.transmissionVersion === curr.transmissionVersion\n * );\n * })\n * );\n *\n * totallyDifferentBuilds$.subscribe(console.log);\n *\n * // Logs:\n * // {engineVersion: \"1.1.0\", transmissionVersion: \"1.2.0\"}\n * // {engineVersion: \"1.3.0\", transmissionVersion: \"1.4.0\"}\n * // {engineVersion: \"2.0.0\", transmissionVersion: \"1.5.0\"}\n * ```\n *\n * ## Example\n *\n * You can also provide a custom `comparator` to check that emitted\n * changes are only in one direction. Let's say you only want to get\n * the next record temperature:\n *\n * ```ts\n * import { of } from \"rxjs\";\n * import { distinctUntilChanged } from \"rxjs/operators\";\n *\n * const temps$ = of(30, 31, 20, 34, 33, 29, 35, 20);\n *\n * const recordHighs$ = temps$.pipe(\n * distinctUntilChanged((prevHigh, temp) => {\n * // If the current temp is less than\n * // or the same as the previous record,\n * // the record hasn't changed.\n * return temp <= prevHigh;\n * })\n * );\n *\n * recordHighs$.subscribe(console.log);\n * // Logs: 30, 31, 34, 35\n * ```\n *\n * @param comparator A function used to compare the previous and current values for\n * equality. Defaults to a `===` check.\n * @return A function that returns an Observable that emits items from the\n * source Observable with distinct values.\n */\nexport function distinctUntilChanged<T>(comparator?: (previous: T, current: T) => boolean): MonoTypeOperatorFunction<T>;\n\n/**\n * Returns a result {@link Observable} that emits all values pushed by the source observable if they\n * are distinct in comparison to the last value the result observable emitted.\n *\n * 1. It will always emit the first value from the source.\n * 2. The `keySelector` will be run against all values, including the first value.\n * 3. For all values after the first, the selected key will be compared against the key selected from\n * the previously emitted value using the `comparator`.\n * 4. If the keys are determined to be unequal by this check, the value (not the key), is emitted\n * and the selected key from that value is saved for future comparisons against other keys.\n *\n * ## Example\n *\n * Selecting update events only when the `updatedBy` field shows\n * the account changed hands...\n *\n * ```ts\n * // A stream of updates to a given account\n * const accountUpdates$ = of(\n * { updatedBy: \"blesh\", data: [] },\n * { updatedBy: \"blesh\", data: [] },\n * { updatedBy: \"ncjamieson\", data: [] },\n * { updatedBy: \"ncjamieson\", data: [] },\n * { updatedBy: \"blesh\", data: [] }\n * );\n *\n * // We only want the events where it changed hands\n * const changedHands$ = accountUpdates$.pipe(\n * distinctUntilChanged(undefined, update => update.updatedBy)\n * );\n *\n * changedHands$.subscribe(console.log);\n * // Logs:\n * // {updatedBy: \"blesh\", data: Array[0]}\n * // {updatedBy: \"ncjamieson\", data: Array[0]}\n * // {updatedBy: \"blesh\", data: Array[0]}\n * ```\n *\n * @param comparator A function used to compare the previous and current keys for\n * equality. Defaults to a `===` check.\n * @param keySelector Used to select a key value to be passed to the `comparator`.\n * @return A function that returns an Observable that emits items from the\n * source Observable with distinct values.\n */\nexport function distinctUntilChanged<T, K>(\n comparator: (previous: K, current: K) => boolean,\n keySelector: (value: T) => K\n): MonoTypeOperatorFunction<T>;\n\nexport function distinctUntilChanged<T, K>(\n comparator?: (previous: K, current: K) => boolean,\n keySelector: (value: T) => K = identity as (value: T) => K\n): MonoTypeOperatorFunction<T> {\n // We've been allowing `null` do be passed as the `compare`, so we can't do\n // a default value for the parameter, because that will only work\n // for `undefined`.\n comparator = comparator ?? defaultCompare;\n\n return operate((source, subscriber) => {\n // The previous key, used to compare against keys selected\n // from new arrivals to determine \"distinctiveness\".\n let previousKey: K;\n // Whether or not this is the first value we've gotten.\n let first = true;\n\n source.subscribe(\n new OperatorSubscriber(subscriber, (value) => {\n // We always call the key selector.\n const currentKey = keySelector(value);\n\n // If it's the first value, we always emit it.\n // Otherwise, we compare this key to the previous key, and\n // if the comparer returns false, we emit.\n if (first || !comparator!(previousKey, currentKey)) {\n // Update our state *before* we emit the value\n // as emission can be the source of re-entrant code\n // in functional libraries like this. We only really\n // need to do this if it's the first value, or if the\n // key we're tracking in previous needs to change.\n first = false;\n previousKey = currentKey;\n\n // Emit the value!\n subscriber.next(value);\n }\n })\n );\n });\n}\n\nfunction defaultCompare(a: any, b: any) {\n return a === b;\n}\n","import { EmptyError } from '../util/EmptyError';\nimport { MonoTypeOperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * If the source observable completes without emitting a value, it will emit\n * an error. The error will be created at that time by the optional\n * `errorFactory` argument, otherwise, the error will be {@link EmptyError}.\n *\n * ![](throwIfEmpty.png)\n *\n * ## Example\n * ```ts\n * import { fromEvent, timer } from 'rxjs';\n * import { throwIfEmpty, takeUntil } from 'rxjs/operators';\n *\n * const click$ = fromEvent(document, 'click');\n *\n * click$.pipe(\n * takeUntil(timer(1000)),\n * throwIfEmpty(\n * () => new Error('the document was not clicked within 1 second')\n * ),\n * )\n * .subscribe({\n * next() { console.log('The button was clicked'); },\n * error(err) { console.error(err); }\n * });\n * ```\n *\n * @param errorFactory A factory function called to produce the\n * error to be thrown when the source observable completes without emitting a\n * value.\n * @return A function that returns an Observable that throws an error if the\n * source Observable completed without emitting.\n */\nexport function throwIfEmpty<T>(errorFactory: () => any = defaultErrorFactory): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let hasValue = false;\n source.subscribe(\n new OperatorSubscriber(\n subscriber,\n (value) => {\n hasValue = true;\n subscriber.next(value);\n },\n () => (hasValue ? subscriber.complete() : subscriber.error(errorFactory()))\n )\n );\n });\n}\n\nfunction defaultErrorFactory() {\n return new EmptyError();\n}\n","import { OperatorFunction, ObservableInput, ObservedValueOf, SchedulerLike } from '../types';\nimport { operate } from '../util/lift';\nimport { mergeInternals } from './mergeInternals';\n\n/* tslint:disable:max-line-length */\nexport function expand<T, O extends ObservableInput<unknown>>(\n project: (value: T, index: number) => O,\n concurrent?: number,\n scheduler?: SchedulerLike\n): OperatorFunction<T, ObservedValueOf<O>>;\n/**\n * @deprecated The `scheduler` parameter will be removed in v8. If you need to schedule the inner subscription,\n * use `subscribeOn` within the projection function: `expand((value) => fn(value).pipe(subscribeOn(scheduler)))`.\n * Details: Details: https://rxjs.dev/deprecations/scheduler-argument\n */\nexport function expand<T, O extends ObservableInput<unknown>>(\n project: (value: T, index: number) => O,\n concurrent: number | undefined,\n scheduler: SchedulerLike\n): OperatorFunction<T, ObservedValueOf<O>>;\n/* tslint:enable:max-line-length */\n\n/**\n * Recursively projects each source value to an Observable which is merged in\n * the output Observable.\n *\n * <span class=\"informal\">It's similar to {@link mergeMap}, but applies the\n * projection function to every source value as well as every output value.\n * It's recursive.</span>\n *\n * ![](expand.png)\n *\n * Returns an Observable that emits items based on applying a function that you\n * supply to each item emitted by the source Observable, where that function\n * returns an Observable, and then merging those resulting Observables and\n * emitting the results of this merger. *Expand* will re-emit on the output\n * Observable every source value. Then, each output value is given to the\n * `project` function which returns an inner Observable to be merged on the\n * output Observable. Those output values resulting from the projection are also\n * given to the `project` function to produce new output values. This is how\n * *expand* behaves recursively.\n *\n * ## Example\n * Start emitting the powers of two on every click, at most 10 of them\n * ```ts\n * import { fromEvent, of } from 'rxjs';\n * import { expand, mapTo, delay, take } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const powersOfTwo = clicks.pipe(\n * mapTo(1),\n * expand(x => of(2 * x).pipe(delay(1000))),\n * take(10),\n * );\n * powersOfTwo.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link mergeMap}\n * @see {@link mergeScan}\n *\n * @param {function(value: T, index: number) => Observable} project A function\n * that, when applied to an item emitted by the source or the output Observable,\n * returns an Observable.\n * @param {number} [concurrent=Infinity] Maximum number of input\n * Observables being subscribed to concurrently.\n * @param {SchedulerLike} [scheduler=null] The {@link SchedulerLike} to use for subscribing to\n * each projected inner Observable.\n * @return A function that returns an Observable that emits the source values\n * and also result of applying the projection function to each value emitted on\n * the output Observable and merging the results of the Observables obtained\n * from this transformation.\n */\nexport function expand<T, O extends ObservableInput<unknown>>(\n project: (value: T, index: number) => O,\n concurrent = Infinity,\n scheduler?: SchedulerLike\n): OperatorFunction<T, ObservedValueOf<O>> {\n concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;\n return operate((source, subscriber) =>\n mergeInternals(\n // General merge params\n source,\n subscriber,\n project,\n concurrent,\n\n // onBeforeNext\n undefined,\n\n // Expand-specific\n true, // Use expand path\n scheduler // Inner subscription scheduler\n )\n );\n}\n","import { MonoTypeOperatorFunction } from '../types';\nimport { operate } from '../util/lift';\n\n/**\n * Returns an Observable that mirrors the source Observable, but will call a specified function when\n * the source terminates on complete or error.\n * The specified function will also be called when the subscriber explicitly unsubscribes.\n *\n * ## Examples\n * Execute callback function when the observable completes\n *\n * ```ts\n * import { interval } from 'rxjs';\n * import { take, finalize } from 'rxjs/operators';\n *\n * // emit value in sequence every 1 second\n * const source = interval(1000);\n * const example = source.pipe(\n * take(5), //take only the first 5 values\n * finalize(() => console.log('Sequence complete')) // Execute when the observable completes\n * )\n * const subscribe = example.subscribe(val => console.log(val));\n *\n * // results:\n * // 0\n * // 1\n * // 2\n * // 3\n * // 4\n * // 'Sequence complete'\n * ```\n *\n * Execute callback function when the subscriber explicitly unsubscribes\n *\n * ```ts\n * import { interval, timer, noop } from 'rxjs';\n * import { finalize, tap } from 'rxjs/operators';\n *\n * const source = interval(100).pipe(\n * finalize(() => console.log('[finalize] Called')),\n * tap(() => console.log('[next] Called'),\n * () => console.log('[error] Not called'),\n * () => console.log('[tap] Not called')),\n * );\n *\n * const sub = source.subscribe(x => console.log(x), noop, () => console.log('[complete] Not called'));\n *\n * timer(150).subscribe(() => sub.unsubscribe());\n *\n * // results:\n * // '[next] Called'\n * // 0\n * // '[finalize] Called'\n * ```\n *\n * @param {function} callback Function to be called when source terminates.\n * @return A function that returns an Observable that mirrors the source, but\n * will call the specified function on termination.\n */\nexport function finalize<T>(callback: () => void): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n // TODO: This try/finally was only added for `useDeprecatedSynchronousErrorHandling`.\n // REMOVE THIS WHEN THAT HOT GARBAGE IS REMOVED IN V8.\n try {\n source.subscribe(subscriber);\n } finally {\n subscriber.add(callback);\n }\n });\n}\n","import { Observable } from '../Observable';\nimport { EmptyError } from '../util/EmptyError';\nimport { OperatorFunction, TruthyTypesOf } from '../types';\nimport { filter } from './filter';\nimport { take } from './take';\nimport { defaultIfEmpty } from './defaultIfEmpty';\nimport { throwIfEmpty } from './throwIfEmpty';\nimport { identity } from '../util/identity';\n\nexport function first<T, D = T>(predicate?: null, defaultValue?: D): OperatorFunction<T, T | D>;\nexport function first<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;\nexport function first<T, D>(predicate: BooleanConstructor, defaultValue: D): OperatorFunction<T, TruthyTypesOf<T> | D>;\nexport function first<T, S extends T>(\n predicate: (value: T, index: number, source: Observable<T>) => value is S,\n defaultValue?: S\n): OperatorFunction<T, S>;\nexport function first<T, S extends T, D>(\n predicate: (value: T, index: number, source: Observable<T>) => value is S,\n defaultValue: D\n): OperatorFunction<T, S | D>;\nexport function first<T, D = T>(\n predicate: (value: T, index: number, source: Observable<T>) => boolean,\n defaultValue?: D\n): OperatorFunction<T, T | D>;\n\n/**\n * Emits only the first value (or the first value that meets some condition)\n * emitted by the source Observable.\n *\n * <span class=\"informal\">Emits only the first value. Or emits only the first\n * value that passes some test.</span>\n *\n * ![](first.png)\n *\n * If called with no arguments, `first` emits the first value of the source\n * Observable, then completes. If called with a `predicate` function, `first`\n * emits the first value of the source that matches the specified condition. Throws an error if\n * `defaultValue` was not provided and a matching element is not found.\n *\n * ## Examples\n * Emit only the first click that happens on the DOM\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { first } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(first());\n * result.subscribe(x => console.log(x));\n * ```\n *\n * Emits the first click that happens on a DIV\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { first } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(first(ev => ev.target.tagName === 'DIV'));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link filter}\n * @see {@link find}\n * @see {@link take}\n *\n * @throws {EmptyError} Delivers an EmptyError to the Observer's `error`\n * callback if the Observable completes before any `next` notification was sent.\n * This is how `first()` is different from {@link take}(1) which completes instead.\n *\n * @param {function(value: T, index: number, source: Observable<T>): boolean} [predicate]\n * An optional function called with each item to test for condition matching.\n * @param {R} [defaultValue] The default value emitted in case no valid value\n * was found on the source.\n * @return A function that returns an Observable that emits the first item that\n * matches the condition.\n */\nexport function first<T, D>(\n predicate?: ((value: T, index: number, source: Observable<T>) => boolean) | null,\n defaultValue?: D\n): OperatorFunction<T, T | D> {\n const hasDefaultValue = arguments.length >= 2;\n return (source: Observable<T>) =>\n source.pipe(\n predicate ? filter((v, i) => predicate(v, i, source)) : identity,\n take(1),\n hasDefaultValue ? defaultIfEmpty(defaultValue!) : throwIfEmpty(() => new EmptyError())\n );\n}\n","import { EMPTY } from '../observable/empty';\nimport { MonoTypeOperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Waits for the source to complete, then emits the last N values from the source,\n * as specified by the `count` argument.\n *\n * ![](takeLast.png)\n *\n * `takeLast` results in an observable that will hold values up to `count` values in memory,\n * until the source completes. It then pushes all values in memory to the consumer, in the\n * order they were received from the source, then notifies the consumer that it is\n * complete.\n *\n * If for some reason the source completes before the `count` supplied to `takeLast` is reached,\n * all values received until that point are emitted, and then completion is notified.\n *\n * **Warning**: Using `takeLast` with an observable that never completes will result\n * in an observable that never emits a value.\n *\n * ## Example\n *\n * Take the last 3 values of an Observable with many values\n *\n * ```ts\n * import { range } from 'rxjs';\n * import { takeLast } from 'rxjs/operators';\n *\n * const many = range(1, 100);\n * const lastThree = many.pipe(takeLast(3));\n * lastThree.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link take}\n * @see {@link takeUntil}\n * @see {@link takeWhile}\n * @see {@link skip}\n *\n * @param count The maximum number of values to emit from the end of\n * the sequence of values emitted by the source Observable.\n * @return A function that returns an Observable that emits at most the last\n * `count` values emitted by the source Observable.\n */\nexport function takeLast<T>(count: number): MonoTypeOperatorFunction<T> {\n return count <= 0\n ? () => EMPTY\n : operate((source, subscriber) => {\n // This buffer will hold the values we are going to emit\n // when the source completes. Since we only want to take the\n // last N values, we can't emit until we're sure we're not getting\n // any more values.\n let buffer: T[] = [];\n source.subscribe(\n new OperatorSubscriber(\n subscriber,\n (value) => {\n // Add the most recent value onto the end of our buffer.\n buffer.push(value);\n // If our buffer is now larger than the number of values we\n // want to take, we remove the oldest value from the buffer.\n count < buffer.length && buffer.shift();\n },\n () => {\n // The source completed, we now know what are last values\n // are, emit them in the order they were received.\n for (const value of buffer) {\n subscriber.next(value);\n }\n subscriber.complete();\n },\n // Errors are passed through to the consumer\n undefined,\n () => {\n // During teardown release the values in our buffer.\n buffer = null!;\n }\n )\n );\n });\n}\n","import { Observable } from '../Observable';\nimport { EmptyError } from '../util/EmptyError';\nimport { OperatorFunction, TruthyTypesOf } from '../types';\nimport { filter } from './filter';\nimport { takeLast } from './takeLast';\nimport { throwIfEmpty } from './throwIfEmpty';\nimport { defaultIfEmpty } from './defaultIfEmpty';\nimport { identity } from '../util/identity';\n\nexport function last<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;\nexport function last<T, D>(predicate: BooleanConstructor, defaultValue: D): OperatorFunction<T, TruthyTypesOf<T> | D>;\nexport function last<T, D = T>(predicate?: null, defaultValue?: D): OperatorFunction<T, T | D>;\nexport function last<T, S extends T>(\n predicate: (value: T, index: number, source: Observable<T>) => value is S,\n defaultValue?: S\n): OperatorFunction<T, S>;\nexport function last<T, D = T>(\n predicate: (value: T, index: number, source: Observable<T>) => boolean,\n defaultValue?: D\n): OperatorFunction<T, T | D>;\n\n/**\n * Returns an Observable that emits only the last item emitted by the source Observable.\n * It optionally takes a predicate function as a parameter, in which case, rather than emitting\n * the last item from the source Observable, the resulting Observable will emit the last item\n * from the source Observable that satisfies the predicate.\n *\n * ![](last.png)\n *\n * It will throw an error if the source completes without notification or one that matches the predicate. It\n * returns the last value or if a predicate is provided last value that matches the predicate. It returns the\n * given default value if no notification is emitted or matches the predicate.\n *\n * ## Example\n * Last alphabet from the sequence.\n * ```ts\n * import { from } from 'rxjs';\n * import { last } from 'rxjs/operators';\n *\n * const source = from(['x', 'y', 'z']);\n * const example = source.pipe(last());\n * //output: \"Last alphabet: z\"\n * example.subscribe(val => console.log(`Last alphabet: ${val}`));\n * ```\n *\n * Default value when the value in the predicate is not matched.\n * ```ts\n * import { from } from 'rxjs';\n * import { last } from 'rxjs/operators';\n *\n * const source = from(['x', 'y', 'z']);\n * const example = source.pipe(last(char => char === 'a','not exist'));\n * //output: \"'a' is not exist.\"\n * example.subscribe(val => console.log(`'a' is ${val}.`));\n * ```\n *\n * @see {@link skip}\n * @see {@link skipUntil}\n * @see {@link skipLast}\n * @see {@link skipWhile}\n *\n * @throws {EmptyError} Delivers an EmptyError to the Observer's `error`\n * callback if the Observable completes before any `next` notification was sent.\n * @param {function} [predicate] - The condition any source emitted item has to satisfy.\n * @param {any} [defaultValue] - An optional default value to provide if last\n * predicate isn't met or no values were emitted.\n * @return A function that returns an Observable that emits only the last item\n * satisfying the given condition from the source, or a NoSuchElementException\n * if no such items are emitted.\n * @throws - Throws if no items that match the predicate are emitted by the source Observable.\n */\nexport function last<T, D>(\n predicate?: ((value: T, index: number, source: Observable<T>) => boolean) | null,\n defaultValue?: D\n): OperatorFunction<T, T | D> {\n const hasDefaultValue = arguments.length >= 2;\n return (source: Observable<T>) =>\n source.pipe(\n predicate ? filter((v, i) => predicate(v, i, source)) : identity,\n takeLast(1),\n hasDefaultValue ? defaultIfEmpty(defaultValue!) : throwIfEmpty(() => new EmptyError())\n );\n}\n","import { Subject } from '../Subject';\nimport { Observable } from '../Observable';\nimport { ConnectableObservable } from '../observable/ConnectableObservable';\nimport { OperatorFunction, UnaryFunction, ObservedValueOf, ObservableInput } from '../types';\nimport { isFunction } from '../util/isFunction';\nimport { connect } from './connect';\n\n/**\n * An operator that creates a {@link ConnectableObservable}, that when connected,\n * with the `connect` method, will use the provided subject to multicast the values\n * from the source to all consumers.\n *\n * @param subject The subject to multicast through.\n * @return A function that returns a {@link ConnectableObservable}\n * @deprecated Will be removed in v8. To create a connectable observable, use {@link connectable}.\n * If you're using {@link refCount} after `multicast`, use the {@link share} operator instead.\n * `multicast(subject), refCount()` is equivalent to\n * `share({ connector: () => subject, resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false })`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function multicast<T>(subject: Subject<T>): UnaryFunction<Observable<T>, ConnectableObservable<T>>;\n\n/**\n * Because this is deprecated in favor of the {@link connect} operator, and was otherwise poorly documented,\n * rather than duplicate the effort of documenting the same behavior, please see documentation for the\n * {@link connect} operator.\n *\n * @param subject The subject used to multicast.\n * @param selector A setup function to setup the multicast\n * @return A function that returns an observable that mirrors the observable returned by the selector.\n * @deprecated Will be removed in v8. Use the {@link connect} operator instead.\n * `multicast(subject, selector)` is equivalent to\n * `connect(selector, { connector: () => subject })`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function multicast<T, O extends ObservableInput<any>>(\n subject: Subject<T>,\n selector: (shared: Observable<T>) => O\n): OperatorFunction<T, ObservedValueOf<O>>;\n\n/**\n * An operator that creates a {@link ConnectableObservable}, that when connected,\n * with the `connect` method, will use the provided subject to multicast the values\n * from the source to all consumers.\n *\n * @param subjectFactory A factory that will be called to create the subject. Passing a function here\n * will cause the underlying subject to be \"reset\" on error, completion, or refCounted unsubscription of\n * the source.\n * @return A function that returns a {@link ConnectableObservable}\n * @deprecated Will be removed in v8. To create a connectable observable, use {@link connectable}.\n * If you're using {@link refCount} after `multicast`, use the {@link share} operator instead.\n * `multicast(() => new BehaviorSubject('test')), refCount()` is equivalent to\n * `share({ connector: () => new BehaviorSubject('test') })`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function multicast<T>(subjectFactory: () => Subject<T>): UnaryFunction<Observable<T>, ConnectableObservable<T>>;\n\n/**\n * Because this is deprecated in favor of the {@link connect} operator, and was otherwise poorly documented,\n * rather than duplicate the effort of documenting the same behavior, please see documentation for the\n * {@link connect} operator.\n *\n * @param subjectFactory A factory that creates the subject used to multicast.\n * @param selector A function to setup the multicast and select the output.\n * @return A function that returns an observable that mirrors the observable returned by the selector.\n * @deprecated Will be removed in v8. Use the {@link connect} operator instead.\n * `multicast(subjectFactory, selector)` is equivalent to\n * `connect(selector, { connector: subjectFactory })`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function multicast<T, O extends ObservableInput<any>>(\n subjectFactory: () => Subject<T>,\n selector: (shared: Observable<T>) => O\n): OperatorFunction<T, ObservedValueOf<O>>;\n\n/**\n * @deprecated Will be removed in v8. Use the {@link connectable} observable, the {@link connect} operator or the\n * {@link share} operator instead. See the overloads below for equivalent replacement examples of this operator's\n * behaviors.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function multicast<T, R>(\n subjectOrSubjectFactory: Subject<T> | (() => Subject<T>),\n selector?: (source: Observable<T>) => Observable<R>\n): OperatorFunction<T, R> {\n const subjectFactory = isFunction(subjectOrSubjectFactory) ? subjectOrSubjectFactory : () => subjectOrSubjectFactory;\n\n if (isFunction(selector)) {\n // If a selector function is provided, then we're a \"normal\" operator that isn't\n // going to return a ConnectableObservable. We can use `connect` to do what we\n // need to do.\n return connect(selector, {\n connector: subjectFactory,\n });\n }\n\n return (source: Observable<T>) => new ConnectableObservable<any>(source, subjectFactory);\n}\n","import { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Groups pairs of consecutive emissions together and emits them as an array of\n * two values.\n *\n * <span class=\"informal\">Puts the current value and previous value together as\n * an array, and emits that.</span>\n *\n * ![](pairwise.png)\n *\n * The Nth emission from the source Observable will cause the output Observable\n * to emit an array [(N-1)th, Nth] of the previous and the current value, as a\n * pair. For this reason, `pairwise` emits on the second and subsequent\n * emissions from the source Observable, but not on the first emission, because\n * there is no previous value in that case.\n *\n * ## Example\n * On every click (starting from the second), emit the relative distance to the previous click\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { pairwise, map } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const pairs = clicks.pipe(pairwise());\n * const distance = pairs.pipe(\n * map(pair => {\n * const x0 = pair[0].clientX;\n * const y0 = pair[0].clientY;\n * const x1 = pair[1].clientX;\n * const y1 = pair[1].clientY;\n * return Math.sqrt(Math.pow(x0 - x1, 2) + Math.pow(y0 - y1, 2));\n * }),\n * );\n * distance.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n *\n * @return A function that returns an Observable of pairs (as arrays) of\n * consecutive values from the source Observable.\n */\nexport function pairwise<T>(): OperatorFunction<T, [T, T]> {\n return operate((source, subscriber) => {\n let prev: T;\n let hasPrev = false;\n source.subscribe(\n new OperatorSubscriber(subscriber, (value) => {\n const p = prev;\n prev = value;\n hasPrev && subscriber.next([p, value]);\n hasPrev = true;\n })\n );\n });\n}\n","import { Observable } from '../Observable';\nimport { Subject } from '../Subject';\nimport { multicast } from './multicast';\nimport { ConnectableObservable } from '../observable/ConnectableObservable';\nimport { MonoTypeOperatorFunction, OperatorFunction, UnaryFunction, ObservableInput, ObservedValueOf } from '../types';\nimport { connect } from './connect';\n\n/**\n * Returns a connectable observable that, when connected, will multicast\n * all values through a single underlying {@link Subject} instance.\n *\n * @deprecated Will be removed in v8. To create a connectable observable, use {@link connectable}.\n * `source.pipe(publish())` is equivalent to\n * `connectable(source, { connector: () => new Subject(), resetOnDisconnect: false })`.\n * If you're using {@link refCount} after `publish`, use {@link share} operator instead.\n * `source.pipe(publish(), refCount())` is equivalent to\n * `source.pipe(share({ resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }))`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publish<T>(): UnaryFunction<Observable<T>, ConnectableObservable<T>>;\n\n/**\n * Returns an observable, that when subscribed to, creates an underlying {@link Subject},\n * provides an observable view of it to a `selector` function, takes the observable result of\n * that selector function and subscribes to it, sending its values to the consumer, _then_ connects\n * the subject to the original source.\n *\n * @param selector A function used to setup multicasting prior to automatic connection.\n *\n * @deprecated Will be removed in v8. Use the {@link connect} operator instead.\n * `publish(selector)` is equivalent to `connect(selector)`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publish<T, O extends ObservableInput<any>>(selector: (shared: Observable<T>) => O): OperatorFunction<T, ObservedValueOf<O>>;\n\n/**\n * Returns a ConnectableObservable, which is a variety of Observable that waits until its connect method is called\n * before it begins emitting items to those Observers that have subscribed to it.\n *\n * <span class=\"informal\">Makes a cold Observable hot</span>\n *\n * ![](publish.png)\n *\n * ## Examples\n * Make source$ hot by applying publish operator, then merge each inner observable into a single one\n * and subscribe.\n * ```ts\n * import { of, zip, interval, merge } from \"rxjs\";\n * import { map, publish, tap } from \"rxjs/operators\";\n *\n * const source$ = zip(interval(2000), of(1, 2, 3, 4, 5, 6, 7, 8, 9)).pipe(\n * map(values => values[1])\n * );\n *\n * source$\n * .pipe(\n * publish(multicasted$ =>\n * merge(\n * multicasted$.pipe(tap(x => console.log('Stream 1:', x))),\n * multicasted$.pipe(tap(x => console.log('Stream 2:', x))),\n * multicasted$.pipe(tap(x => console.log('Stream 3:', x))),\n * )\n * )\n * )\n * .subscribe();\n *\n * // Results every two seconds\n * // Stream 1: 1\n * // Stream 2: 1\n * // Stream 3: 1\n * // ...\n * // Stream 1: 9\n * // Stream 2: 9\n * // Stream 3: 9\n * ```\n *\n * @param {Function} [selector] - Optional selector function which can use the multicasted source sequence as many times\n * as needed, without causing multiple subscriptions to the source sequence.\n * Subscribers to the given source will receive all notifications of the source from the time of the subscription on.\n * @return A function that returns a ConnectableObservable that upon connection\n * causes the source Observable to emit items to its Observers.\n * @deprecated Will be removed in v8. Use the {@link connectable} observable, the {@link connect} operator or the\n * {@link share} operator instead. See the overloads below for equivalent replacement examples of this operator's\n * behaviors.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publish<T, R>(selector?: OperatorFunction<T, R>): MonoTypeOperatorFunction<T> | OperatorFunction<T, R> {\n return selector ? (source) => connect(selector)(source) : (source) => multicast(new Subject<T>())(source);\n}\n","import { Observable } from '../Observable';\nimport { ReplaySubject } from '../ReplaySubject';\nimport { multicast } from './multicast';\nimport { MonoTypeOperatorFunction, OperatorFunction, TimestampProvider, ObservableInput, ObservedValueOf } from '../types';\nimport { isFunction } from '../util/isFunction';\n\n/**\n * Creates a {@link ConnectableObservable} that uses a {@link ReplaySubject}\n * internally.\n *\n * @param bufferSize The buffer size for the underlying {@link ReplaySubject}.\n * @param windowTime The window time for the underlying {@link ReplaySubject}.\n * @param timestampProvider The timestamp provider for the underlying {@link ReplaySubject}.\n * @deprecated Will be removed in v8. To create a connectable observable that uses a\n * {@link ReplaySubject} under the hood, use {@link connectable}.\n * `source.pipe(publishReplay(size, time, scheduler))` is equivalent to\n * `connectable(source, { connector: () => new ReplaySubject(size, time, scheduler), resetOnDisconnect: false })`.\n * If you're using {@link refCount} after `publishReplay`, use the {@link share} operator instead.\n * `publishReplay(size, time, scheduler), refCount()` is equivalent to\n * `share({ connector: () => new ReplaySubject(size, time, scheduler), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false })`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publishReplay<T>(\n bufferSize?: number,\n windowTime?: number,\n timestampProvider?: TimestampProvider\n): MonoTypeOperatorFunction<T>;\n\n/**\n * Creates an observable, that when subscribed to, will create a {@link ReplaySubject},\n * and pass an observable from it (using [asObservable](api/index/class/Subject#asObservable)) to\n * the `selector` function, which then returns an observable that is subscribed to before\n * \"connecting\" the source to the internal `ReplaySubject`.\n *\n * Since this is deprecated, for additional details see the documentation for {@link connect}.\n *\n * @param bufferSize The buffer size for the underlying {@link ReplaySubject}.\n * @param windowTime The window time for the underlying {@link ReplaySubject}.\n * @param selector A function used to setup the multicast.\n * @param timestampProvider The timestamp provider for the underlying {@link ReplaySubject}.\n * @deprecated Will be removed in v8. Use the {@link connect} operator instead.\n * `source.pipe(publishReplay(size, window, selector, scheduler))` is equivalent to\n * `source.pipe(connect(selector, { connector: () => new ReplaySubject(size, window, scheduler) }))`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publishReplay<T, O extends ObservableInput<any>>(\n bufferSize: number | undefined,\n windowTime: number | undefined,\n selector: (shared: Observable<T>) => O,\n timestampProvider?: TimestampProvider\n): OperatorFunction<T, ObservedValueOf<O>>;\n\n/**\n * Creates a {@link ConnectableObservable} that uses a {@link ReplaySubject}\n * internally.\n *\n * @param bufferSize The buffer size for the underlying {@link ReplaySubject}.\n * @param windowTime The window time for the underlying {@link ReplaySubject}.\n * @param selector Passing `undefined` here determines that this operator will return a {@link ConnectableObservable}.\n * @param timestampProvider The timestamp provider for the underlying {@link ReplaySubject}.\n * @deprecated Will be removed in v8. To create a connectable observable that uses a\n * {@link ReplaySubject} under the hood, use {@link connectable}.\n * `source.pipe(publishReplay(size, time, scheduler))` is equivalent to\n * `connectable(source, { connector: () => new ReplaySubject(size, time, scheduler), resetOnDisconnect: false })`.\n * If you're using {@link refCount} after `publishReplay`, use the {@link share} operator instead.\n * `publishReplay(size, time, scheduler), refCount()` is equivalent to\n * `share({ connector: () => new ReplaySubject(size, time, scheduler), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false })`.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publishReplay<T, O extends ObservableInput<any>>(\n bufferSize: number | undefined,\n windowTime: number | undefined,\n selector: undefined,\n timestampProvider: TimestampProvider\n): OperatorFunction<T, ObservedValueOf<O>>;\n\n/**\n * @deprecated Will be removed in v8. Use the {@link connectable} observable, the {@link connect} operator or the\n * {@link share} operator instead. See the overloads below for equivalent replacement examples of this operator's\n * behaviors.\n * Details: https://rxjs.dev/deprecations/multicasting\n */\nexport function publishReplay<T, R>(\n bufferSize?: number,\n windowTime?: number,\n selectorOrScheduler?: TimestampProvider | OperatorFunction<T, R>,\n timestampProvider?: TimestampProvider\n) {\n if (selectorOrScheduler && !isFunction(selectorOrScheduler)) {\n timestampProvider = selectorOrScheduler;\n }\n const selector = isFunction(selectorOrScheduler) ? selectorOrScheduler : undefined;\n // Note, we're passing `selector!` here, because at runtime, `undefined` is an acceptable argument\n // but it makes our TypeScript signature for `multicast` unhappy (as it should, because it's gross).\n return (source: Observable<T>) => multicast(new ReplaySubject<T>(bufferSize, windowTime, timestampProvider), selector!)(source);\n}\n","import { MonoTypeOperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { Subscription } from '../Subscription';\nimport { OperatorSubscriber } from './OperatorSubscriber';\nimport { identity } from '../util/identity';\nimport { timer } from '../observable/timer';\nimport { innerFrom } from '../observable/from';\n\nexport interface RetryConfig {\n /**\n * The maximum number of times to retry.\n */\n count?: number;\n /**\n * The number of milliseconds to delay before retrying, OR a function to\n * return a notifier for delaying. If a function is returned, that function should\n * return a notifier that, when it emits will retry the source. If the notifier\n * completes _without_ emitting, the resulting observable will complete without error,\n * if the notifier errors, the error will be pushed to the result.\n */\n delay?: number | ((error: any, retryCount: number) => ObservableInput<any>);\n /**\n * Whether or not to reset the retry counter when the retried subscription\n * emits its first value.\n */\n resetOnSuccess?: boolean;\n}\n\n/**\n * Returns an Observable that mirrors the source Observable with the exception of an `error`. If the source Observable\n * calls `error`, this method will resubscribe to the source Observable for a maximum of `count` resubscriptions (given\n * as a number parameter) rather than propagating the `error` call.\n *\n * ![](retry.png)\n *\n * Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those emitted\n * during failed subscriptions. For example, if an Observable fails at first but emits [1, 2] then succeeds the second\n * time and emits: [1, 2, 3, 4, 5] then the complete stream of emissions and notifications\n * would be: [1, 2, 1, 2, 3, 4, 5, `complete`].\n *\n * ## Example\n * ```ts\n * import { interval, of, throwError } from 'rxjs';\n * import { mergeMap, retry } from 'rxjs/operators';\n *\n * const source = interval(1000);\n * const example = source.pipe(\n * mergeMap(val => {\n * if(val > 5){\n * return throwError('Error!');\n * }\n * return of(val);\n * }),\n * //retry 2 times on error\n * retry(2)\n * );\n *\n * const subscribe = example.subscribe({\n * next: val => console.log(val),\n * error: val => console.log(`${val}: Retried 2 times then quit!`)\n * });\n *\n * // Output:\n * // 0..1..2..3..4..5..\n * // 0..1..2..3..4..5..\n * // 0..1..2..3..4..5..\n * // \"Error!: Retried 2 times then quit!\"\n * ```\n *\n * @param count - Number of retry attempts before failing.\n * @param resetOnSuccess - When set to `true` every successful emission will reset the error count\n * @return A function that returns an Observable that will resubscribe to the\n * source stream when the source stream errors, at most `count` times.\n */\nexport function retry<T>(count?: number): MonoTypeOperatorFunction<T>;\n\n/**\n * Returns an observable that mirrors the source observable unless it errors. If it errors, the source observable\n * will be resubscribed to (or \"retried\") based on the configuration passed here. See documentation\n * for {@link RetryConfig} for more details.\n *\n * @param config - The retry configuration\n */\nexport function retry<T>(config: RetryConfig): MonoTypeOperatorFunction<T>;\n\nexport function retry<T>(configOrCount: number | RetryConfig = Infinity): MonoTypeOperatorFunction<T> {\n let config: RetryConfig;\n if (configOrCount && typeof configOrCount === 'object') {\n config = configOrCount;\n } else {\n config = {\n count: configOrCount,\n };\n }\n const { count = Infinity, delay, resetOnSuccess: resetOnSuccess = false } = config;\n\n return count <= 0\n ? identity\n : operate((source, subscriber) => {\n let soFar = 0;\n let innerSub: Subscription | null;\n const subscribeForRetry = () => {\n let syncUnsub = false;\n innerSub = source.subscribe(\n new OperatorSubscriber(\n subscriber,\n (value) => {\n // If we're resetting on success\n if (resetOnSuccess) {\n soFar = 0;\n }\n subscriber.next(value);\n },\n // Completions are passed through to consumer.\n undefined,\n (err) => {\n if (soFar++ < count) {\n // We are still under our retry count\n const resub = () => {\n if (innerSub) {\n innerSub.unsubscribe();\n innerSub = null;\n subscribeForRetry();\n } else {\n syncUnsub = true;\n }\n };\n\n if (delay != null) {\n // The user specified a retry delay.\n // They gave us a number, use a timer, otherwise, it's a function,\n // and we're going to call it to get a notifier.\n const notifier = typeof delay === 'number' ? timer(delay) : innerFrom(delay(err, soFar));\n const notifierSubscriber = new OperatorSubscriber(\n subscriber,\n () => {\n // After we get the first notification, we\n // unsubscribe from the notifer, because we don't want anymore\n // and we resubscribe to the source.\n notifierSubscriber.unsubscribe();\n resub();\n },\n () => {\n // The notifier completed without emitting.\n // The author is telling us they want to complete.\n subscriber.complete();\n }\n );\n notifier.subscribe(notifierSubscriber);\n } else {\n // There was no notifier given. Just resub immediately.\n resub();\n }\n } else {\n // We're past our maximum number of retries.\n // Just send along the error.\n subscriber.error(err);\n }\n }\n )\n );\n if (syncUnsub) {\n innerSub.unsubscribe();\n innerSub = null;\n subscribeForRetry();\n }\n };\n subscribeForRetry();\n });\n}\n","import { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { scanInternals } from './scanInternals';\n\nexport function scan<V, A = V>(accumulator: (acc: A | V, value: V, index: number) => A): OperatorFunction<V, V | A>;\nexport function scan<V, A>(accumulator: (acc: A, value: V, index: number) => A, seed: A): OperatorFunction<V, A>;\nexport function scan<V, A, S>(accumulator: (acc: A | S, value: V, index: number) => A, seed: S): OperatorFunction<V, A>;\n\n// TODO: link to a \"redux pattern\" section in the guide (location TBD)\n\n/**\n * Useful for encapsulating and managing state. Applies an accumulator (or \"reducer function\")\n * to each value from the source after an initial state is established -- either via\n * a `seed` value (second argument), or from the first value from the source.\n *\n * <span class=\"informal\">It's like {@link reduce}, but emits the current\n * accumulation state after each update</span>\n *\n * ![](scan.png)\n *\n * This operator maintains an internal state and emits it after processing each value as follows:\n *\n * 1. First value arrives\n * - If a `seed` value was supplied (as the second argument to `scan`), let `state = seed` and `value = firstValue`.\n * - If NO `seed` value was supplied (no second argument), let `state = firstValue` and go to 3.\n * 2. Let `state = accumulator(state, value)`.\n * - If an error is thrown by `accumulator`, notify the consumer of an error. The process ends.\n * 3. Emit `state`.\n * 4. Next value arrives, let `value = nextValue`, go to 2.\n *\n * ## Example\n *\n * An average of previous numbers. This example shows how\n * not providing a `seed` can prime the stream with the\n * first value from the source.\n *\n * ```ts\n * import { interval, of } from 'rxjs';\n * import { scan, map } from 'rxjs/operators';\n *\n * const numbers$ = of(1, 2, 3);\n *\n * numbers$\n * .pipe(\n * // Get the sum of the numbers coming in.\n * scan((total, n) => total + n),\n * // Get the average by dividing the sum by the total number\n * // received so var (which is 1 more than the zero-based index).\n * map((sum, index) => sum / (index + 1))\n * )\n * .subscribe(console.log);\n * ```\n *\n * ## Example\n *\n * The Fibonacci sequence. This example shows how you can use\n * a seed to prime accumulation process. Also... you know... Fibinacci.\n * So important to like, computers and stuff that its whiteboarded\n * in job interviews. Now you can show them the Rx version! (Please don't, haha)\n *\n * ```ts\n * import { interval } from 'rxjs';\n * import { scan, map, startWith } from 'rxjs/operators';\n *\n * const firstTwoFibs = [0, 1];\n * // An endless stream of Fibonnaci numbers.\n * const fibonnaci$ = interval(1000).pipe(\n * // Scan to get the fibonnaci numbers (after 0, 1)\n * scan(([a, b]) => [b, a + b], firstTwoFibs),\n * // Get the second number in the tuple, it's the one you calculated\n * map(([, n]) => n),\n * // Start with our first two digits :)\n * startWith(...firstTwoFibs)\n * );\n *\n * fibonnaci$.subscribe(console.log);\n * ```\n *\n *\n * @see {@link expand}\n * @see {@link mergeScan}\n * @see {@link reduce}\n * @see {@link switchScan}\n *\n * @param accumulator A \"reducer function\". This will be called for each value after an initial state is\n * acquired.\n * @param seed The initial state. If this is not provided, the first value from the source will\n * be used as the initial state, and emitted without going through the accumulator. All subsequent values\n * will be processed by the accumulator function. If this is provided, all values will go through\n * the accumulator function.\n * @return A function that returns an Observable of the accumulated values.\n */\nexport function scan<V, A, S>(accumulator: (acc: V | A | S, value: V, index: number) => A, seed?: S): OperatorFunction<V, V | A> {\n // providing a seed of `undefined` *should* be valid and trigger\n // hasSeed! so don't use `seed !== undefined` checks!\n // For this reason, we have to check it here at the original call site\n // otherwise inside Operator/Subscriber we won't know if `undefined`\n // means they didn't provide anything or if they literally provided `undefined`\n return operate(scanInternals(accumulator, seed as S, arguments.length >= 2, true));\n}\n","import { Observable } from '../Observable';\nimport { from } from '../observable/from';\nimport { take } from '../operators/take';\nimport { Subject } from '../Subject';\nimport { SafeSubscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { MonoTypeOperatorFunction, SubjectLike } from '../types';\nimport { operate } from '../util/lift';\n\nexport interface ShareConfig<T> {\n /**\n * The factory used to create the subject that will connect the source observable to\n * multicast consumers.\n */\n connector?: () => SubjectLike<T>;\n /**\n * If true, the resulting observable will reset internal state on error from source and return to a \"cold\" state. This\n * allows the resulting observable to be \"retried\" in the event of an error.\n * If false, when an error comes from the source it will push the error into the connecting subject, and the subject\n * will remain the connecting subject, meaning the resulting observable will not go \"cold\" again, and subsequent retries\n * or resubscriptions will resubscribe to that same subject. In all cases, RxJS subjects will emit the same error again, however\n * {@link ReplaySubject} will also push its buffered values before pushing the error.\n * It is also possible to pass a notifier factory returning an observable instead which grants more fine-grained\n * control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.\n */\n resetOnError?: boolean | ((error: any) => Observable<any>);\n /**\n * If true, the resulting observable will reset internal state on completion from source and return to a \"cold\" state. This\n * allows the resulting observable to be \"repeated\" after it is done.\n * If false, when the source completes, it will push the completion through the connecting subject, and the subject\n * will remain the connecting subject, meaning the resulting observable will not go \"cold\" again, and subsequent repeats\n * or resubscriptions will resubscribe to that same subject.\n * It is also possible to pass a notifier factory returning an observable instead which grants more fine-grained\n * control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.\n */\n resetOnComplete?: boolean | (() => Observable<any>);\n /**\n * If true, when the number of subscribers to the resulting observable reaches zero due to those subscribers unsubscribing, the\n * internal state will be reset and the resulting observable will return to a \"cold\" state. This means that the next\n * time the resulting observable is subscribed to, a new subject will be created and the source will be subscribed to\n * again.\n * If false, when the number of subscribers to the resulting observable reaches zero due to unsubscription, the subject\n * will remain connected to the source, and new subscriptions to the result will be connected through that same subject.\n * It is also possible to pass a notifier factory returning an observable instead which grants more fine-grained\n * control over how and when the reset should happen. This allows behaviors like conditional or delayed resets.\n */\n resetOnRefCountZero?: boolean | (() => Observable<any>);\n}\n\nexport function share<T>(): MonoTypeOperatorFunction<T>;\n\nexport function share<T>(options: ShareConfig<T>): MonoTypeOperatorFunction<T>;\n\n/**\n * Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one\n * Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will\n * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`.\n * This is an alias for `multicast(() => new Subject()), refCount()`.\n *\n * The subscription to the underlying source Observable can be reset (unsubscribe and resubscribe for new subscribers),\n * if the subscriber count to the shared observable drops to 0, or if the source Observable errors or completes. It is\n * possible to use notifier factories for the resets to allow for behaviors like conditional or delayed resets. Please\n * note that resetting on error or complete of the source Observable does not behave like a transparent retry or restart\n * of the source because the error or complete will be forwarded to all subscribers and their subscription will be\n * closed. Only new subscribers after a reset on error or complete happened will cause a fresh subscription to the\n * source. To achieve transparent retries or restarts pipe the source through appropriate operators before sharing.\n *\n * ![](share.png)\n *\n * ## Example\n * Generate new multicast Observable from the source Observable value\n * ```ts\n * import { interval } from 'rxjs';\n * import { share, map } from 'rxjs/operators';\n *\n * const source = interval(1000)\n * .pipe(\n * map((x: number) => {\n * console.log('Processing: ', x);\n * return x*x;\n * }),\n * share()\n * );\n *\n * source.subscribe(x => console.log('subscription 1: ', x));\n * source.subscribe(x => console.log('subscription 2: ', x));\n *\n * // Logs:\n * // Processing: 0\n * // subscription 1: 0\n * // subscription 2: 0\n * // Processing: 1\n * // subscription 1: 1\n * // subscription 2: 1\n * // Processing: 2\n * // subscription 1: 4\n * // subscription 2: 4\n * // Processing: 3\n * // subscription 1: 9\n * // subscription 2: 9\n * // ... and so on\n * ```\n *\n * ## Example with notifier factory: Delayed reset\n * ```ts\n * import { interval } from 'rxjs';\n * import { share, take, timer } from 'rxjs/operators';\n *\n * const source = interval(1000).pipe(take(3), share({ resetOnRefCountZero: () => timer(1000) }));\n *\n * const subscriptionOne = source.subscribe(x => console.log('subscription 1: ', x));\n * setTimeout(() => subscriptionOne.unsubscribe(), 1300);\n *\n * setTimeout(() => source.subscribe(x => console.log('subscription 2: ', x)), 1700);\n *\n * setTimeout(() => source.subscribe(x => console.log('subscription 3: ', x)), 5000);\n *\n * // Logs:\n * // subscription 1: 0\n * // (subscription 1 unsubscribes here)\n * // (subscription 2 subscribes here ~400ms later, source was not reset)\n * // subscription 2: 1\n * // subscription 2: 2\n * // (subscription 2 unsubscribes here)\n * // (subscription 3 subscribes here ~2000ms later, source did reset before)\n * // subscription 3: 0\n * // subscription 3: 1\n * // subscription 3: 2\n * ```\n *\n * @see {@link api/index/function/interval}\n * @see {@link map}\n *\n * @return A function that returns an Observable that mirrors the source.\n */\nexport function share<T>(options: ShareConfig<T> = {}): MonoTypeOperatorFunction<T> {\n const { connector = () => new Subject<T>(), resetOnError = true, resetOnComplete = true, resetOnRefCountZero = true } = options;\n // It's necessary to use a wrapper here, as the _operator_ must be\n // referentially transparent. Otherwise, it cannot be used in calls to the\n // static `pipe` function - to create a partial pipeline.\n //\n // The _operator function_ - the function returned by the _operator_ - will\n // not be referentially transparent - as it shares its source - but the\n // _operator function_ is called when the complete pipeline is composed via a\n // call to a source observable's `pipe` method - not when the static `pipe`\n // function is called.\n return (wrapperSource) => {\n let connection: SafeSubscriber<T> | null = null;\n let resetConnection: Subscription | null = null;\n let subject: SubjectLike<T> | null = null;\n let refCount = 0;\n let hasCompleted = false;\n let hasErrored = false;\n\n const cancelReset = () => {\n resetConnection?.unsubscribe();\n resetConnection = null;\n };\n // Used to reset the internal state to a \"cold\"\n // state, as though it had never been subscribed to.\n const reset = () => {\n cancelReset();\n connection = subject = null;\n hasCompleted = hasErrored = false;\n };\n const resetAndUnsubscribe = () => {\n // We need to capture the connection before\n // we reset (if we need to reset).\n const conn = connection;\n reset();\n conn?.unsubscribe();\n };\n\n return operate<T, T>((source, subscriber) => {\n refCount++;\n if (!hasErrored && !hasCompleted) {\n cancelReset();\n }\n\n // Create the subject if we don't have one yet. Grab a local reference to\n // it as well, which avoids non-null assertations when using it and, if we\n // connect to it now, then error/complete need a reference after it was\n // reset.\n const dest = (subject = subject ?? connector());\n\n // Add the teardown directly to the subscriber - instead of returning it -\n // so that the handling of the subscriber's unsubscription will be wired\n // up _before_ the subscription to the source occurs. This is done so that\n // the assignment to the source connection's `closed` property will be seen\n // by synchronous firehose sources.\n subscriber.add(() => {\n refCount--;\n\n // If we're resetting on refCount === 0, and it's 0, we only want to do\n // that on \"unsubscribe\", really. Resetting on error or completion is a different\n // configuration.\n if (refCount === 0 && !hasErrored && !hasCompleted) {\n resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);\n }\n });\n\n // The following line adds the subscription to the subscriber passed.\n // Basically, `subscriber === dest.subscribe(subscriber)` is `true`.\n dest.subscribe(subscriber);\n\n if (!connection) {\n // We need to create a subscriber here - rather than pass an observer and\n // assign the returned subscription to connection - because it's possible\n // for reentrant subscriptions to the shared observable to occur and in\n // those situations we want connection to be already-assigned so that we\n // don't create another connection to the source.\n connection = new SafeSubscriber({\n next: (value) => dest.next(value),\n error: (err) => {\n hasErrored = true;\n cancelReset();\n resetConnection = handleReset(reset, resetOnError, err);\n dest.error(err);\n },\n complete: () => {\n hasCompleted = true;\n cancelReset();\n resetConnection = handleReset(reset, resetOnComplete);\n dest.complete();\n },\n });\n from(source).subscribe(connection);\n }\n })(wrapperSource);\n };\n}\n\nfunction handleReset<T extends unknown[] = never[]>(\n reset: () => void,\n on: boolean | ((...args: T) => Observable<any>),\n ...args: T\n): Subscription | null {\n if (on === true) {\n reset();\n\n return null;\n }\n\n if (on === false) {\n return null;\n }\n\n return on(...args)\n .pipe(take(1))\n .subscribe(() => reset());\n}\n","import { MonoTypeOperatorFunction } from '../types';\nimport { filter } from './filter';\n\n/**\n * Returns an Observable that skips the first `count` items emitted by the source Observable.\n *\n * ![](skip.png)\n *\n * Skips the values until the sent notifications are equal or less than provided skip count. It raises\n * an error if skip count is equal or more than the actual number of emits and source raises an error.\n *\n * ## Example\n * Skip the values before the emission\n * ```ts\n * import { interval } from 'rxjs';\n * import { skip } from 'rxjs/operators';\n *\n * //emit every half second\n * const source = interval(500);\n * //skip the first 10 emitted values\n * const example = source.pipe(skip(10));\n * //output: 10...11...12...13........\n * const subscribe = example.subscribe(val => console.log(val));\n * ```\n *\n * @see {@link last}\n * @see {@link skipWhile}\n * @see {@link skipUntil}\n * @see {@link skipLast}\n *\n * @param {Number} count - The number of times, items emitted by source Observable should be skipped.\n * @return A function that returns an Observable that skips the first `count`\n * values emitted by the source Observable.\n */\nexport function skip<T>(count: number): MonoTypeOperatorFunction<T> {\n return filter((_, index) => count <= index);\n}\n","import { Falsy, MonoTypeOperatorFunction, OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\nexport function skipWhile<T>(predicate: BooleanConstructor): OperatorFunction<T, Extract<T, Falsy> extends never ? never : T>;\nexport function skipWhile<T>(predicate: (value: T, index: number) => true): OperatorFunction<T, never>;\nexport function skipWhile<T>(predicate: (value: T, index: number) => boolean): MonoTypeOperatorFunction<T>;\n\n/**\n * Returns an Observable that skips all items emitted by the source Observable as long as a specified condition holds\n * true, but emits all further source items as soon as the condition becomes false.\n *\n * ![](skipWhile.png)\n *\n * Skips all the notifications with a truthy predicate. It will not skip the notifications when the predicate is falsy.\n * It can also be skipped using index. Once the predicate is true, it will not be called again.\n *\n * ## Example\n * Using Value: Skip some super heroes\n * ```ts\n * import { from } from 'rxjs';\n * import { skipWhile } from 'rxjs/operators';\n *\n * const source = from(['Green Arrow', 'SuperMan', 'Flash', 'SuperGirl', 'Black Canary'])\n * // Skip the heroes until SuperGirl\n * const example = source.pipe(skipWhile((hero) => hero !== 'SuperGirl'));\n * // output: SuperGirl, Black Canary\n * example.subscribe((femaleHero) => console.log(femaleHero));\n * ```\n * Using Index: Skip value from the array until index 5\n * ```ts\n * import { from } from 'rxjs';\n * import { skipWhile } from 'rxjs/operators';\n *\n * const source = from([1, 2, 3, 4, 5, 6, 7, 9, 10]);\n * const example = source.pipe(skipWhile((_, i) => i !== 5));\n * // output: 6, 7, 9, 10\n * example.subscribe((val) => console.log(val));\n * ```\n *\n * @see {@link last}\n * @see {@link skip}\n * @see {@link skipUntil}\n * @see {@link skipLast}\n *\n * @param {Function} predicate - A function to test each item emitted from the source Observable.\n * @return A function that returns an Observable that begins emitting items\n * emitted by the source Observable when the specified predicate becomes false.\n */\nexport function skipWhile<T>(predicate: (value: T, index: number) => boolean): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let taking = false;\n let index = 0;\n source.subscribe(\n new OperatorSubscriber(subscriber, (value) => (taking || (taking = !predicate(value, index++))) && subscriber.next(value))\n );\n });\n}\n","import { concat } from '../observable/concat';\nimport { OperatorFunction, SchedulerLike, ValueFromArray } from '../types';\nimport { popScheduler } from '../util/args';\nimport { operate } from '../util/lift';\n\n// Devs are more likely to pass null or undefined than they are a scheduler\n// without accompanying values. To make things easier for (naughty) devs who\n// use the `strictNullChecks: false` TypeScript compiler option, these\n// overloads with explicit null and undefined values are included.\n\nexport function startWith<T>(value: null): OperatorFunction<T, T | null>;\nexport function startWith<T>(value: undefined): OperatorFunction<T, T | undefined>;\n\n/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `concatAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */\nexport function startWith<T, A extends readonly unknown[] = T[]>(\n ...valuesAndScheduler: [...A, SchedulerLike]\n): OperatorFunction<T, T | ValueFromArray<A>>;\nexport function startWith<T, A extends readonly unknown[] = T[]>(...values: A): OperatorFunction<T, T | ValueFromArray<A>>;\n\n/**\n * Returns an observable that, at the moment of subscription, will synchronously emit all\n * values provided to this operator, then subscribe to the source and mirror all of its emissions\n * to subscribers.\n *\n * This is a useful way to know when subscription has occurred on an existing observable.\n *\n * <span class=\"informal\">First emits its arguments in order, and then any\n * emissions from the source.</span>\n *\n * ![](startWith.png)\n *\n * ## Examples\n *\n * Emit a value when a timer starts.\n *\n * ```ts\n * import { timer } from 'rxjs';\n * import { startWith, map } from 'rxjs/operators';\n *\n * timer(1000)\n * .pipe(\n * map(() => 'timer emit'),\n * startWith('timer start')\n * )\n * .subscribe(x => console.log(x));\n *\n * // results:\n * // \"timer start\"\n * // \"timer emit\"\n * ```\n *\n * @param values Items you want the modified Observable to emit first.\n * @return A function that returns an Observable that synchronously emits\n * provided values before subscribing to the source Observable.\n *\n * @see {@link endWith}\n * @see {@link finalize}\n * @see {@link concat}\n */\nexport function startWith<T, D>(...values: D[]): OperatorFunction<T, T | D> {\n const scheduler = popScheduler(values);\n return operate((source, subscriber) => {\n // Here we can't pass `undefined` as a scheduler, because if we did, the\n // code inside of `concat` would be confused by the `undefined`, and treat it\n // like an invalid observable. So we have to split it two different ways.\n (scheduler ? concat(values, source, scheduler) : concat(values, source)).subscribe(subscriber);\n });\n}\n","import { Subscriber } from '../Subscriber';\nimport { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';\nimport { innerFrom } from '../observable/from';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/* tslint:disable:max-line-length */\nexport function switchMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function switchMap<T, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector: undefined\n): OperatorFunction<T, ObservedValueOf<O>>;\n/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */\nexport function switchMap<T, R, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Projects each source value to an Observable which is merged in the output\n * Observable, emitting values only from the most recently projected Observable.\n *\n * <span class=\"informal\">Maps each value to an Observable, then flattens all of\n * these inner Observables.</span>\n *\n * ![](switchMap.png)\n *\n * Returns an Observable that emits items based on applying a function that you\n * supply to each item emitted by the source Observable, where that function\n * returns an (so-called \"inner\") Observable. Each time it observes one of these\n * inner Observables, the output Observable begins emitting the items emitted by\n * that inner Observable. When a new inner Observable is emitted, `switchMap`\n * stops emitting items from the earlier-emitted inner Observable and begins\n * emitting items from the new one. It continues to behave like this for\n * subsequent inner Observables.\n *\n * ## Example\n * Generate new Observable according to source Observable values\n * ```typescript\n * import { of } from 'rxjs';\n * import { switchMap } from 'rxjs/operators';\n *\n * const switched = of(1, 2, 3).pipe(switchMap((x: number) => of(x, x ** 2, x ** 3)));\n * switched.subscribe(x => console.log(x));\n * // outputs\n * // 1\n * // 1\n * // 1\n * // 2\n * // 4\n * // 8\n * // ... and so on\n * ```\n *\n * Restart an interval Observable on every click event\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { switchMap } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(switchMap((ev) => interval(1000)));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link concatMap}\n * @see {@link exhaustMap}\n * @see {@link mergeMap}\n * @see {@link switchAll}\n * @see {@link switchMapTo}\n *\n * @param {function(value: T, ?index: number): ObservableInput} project A function\n * that, when applied to an item emitted by the source Observable, returns an\n * Observable.\n * @return A function that returns an Observable that emits the result of\n * applying the projection function (and the optional deprecated\n * `resultSelector`) to each item emitted by the source Observable and taking\n * only the values from the most recently projected inner Observable.\n */\nexport function switchMap<T, R, O extends ObservableInput<any>>(\n project: (value: T, index: number) => O,\n resultSelector?: (outerValue: T, innerValue: ObservedValueOf<O>, outerIndex: number, innerIndex: number) => R\n): OperatorFunction<T, ObservedValueOf<O> | R> {\n return operate((source, subscriber) => {\n let innerSubscriber: Subscriber<ObservedValueOf<O>> | null = null;\n let index = 0;\n // Whether or not the source subscription has completed\n let isComplete = false;\n\n // We only complete the result if the source is complete AND we don't have an active inner subscription.\n // This is called both when the source completes and when the inners complete.\n const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete();\n\n source.subscribe(\n new OperatorSubscriber(\n subscriber,\n (value) => {\n // Cancel the previous inner subscription if there was one\n innerSubscriber?.unsubscribe();\n let innerIndex = 0;\n const outerIndex = index++;\n // Start the next inner subscription\n innerFrom(project(value, outerIndex)).subscribe(\n (innerSubscriber = new OperatorSubscriber(\n subscriber,\n // When we get a new inner value, next it through. Note that this is\n // handling the deprecate result selector here. This is because with this architecture\n // it ends up being smaller than using the map operator.\n (innerValue) => subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue),\n () => {\n // The inner has completed. Null out the inner subcriber to\n // free up memory and to signal that we have no inner subscription\n // currently.\n innerSubscriber = null!;\n checkComplete();\n }\n ))\n );\n },\n () => {\n isComplete = true;\n checkComplete();\n }\n )\n );\n });\n}\n","import { MonoTypeOperatorFunction, ObservableInput } from '../types';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/from';\nimport { noop } from '../util/noop';\n\n/**\n * Emits the values emitted by the source Observable until a `notifier`\n * Observable emits a value.\n *\n * <span class=\"informal\">Lets values pass until a second Observable,\n * `notifier`, emits a value. Then, it completes.</span>\n *\n * ![](takeUntil.png)\n *\n * `takeUntil` subscribes and begins mirroring the source Observable. It also\n * monitors a second Observable, `notifier` that you provide. If the `notifier`\n * emits a value, the output Observable stops mirroring the source Observable\n * and completes. If the `notifier` doesn't emit any value and completes\n * then `takeUntil` will pass all values.\n *\n * ## Example\n * Tick every second until the first click happens\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { takeUntil } from 'rxjs/operators';\n *\n * const source = interval(1000);\n * const clicks = fromEvent(document, 'click');\n * const result = source.pipe(takeUntil(clicks));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link take}\n * @see {@link takeLast}\n * @see {@link takeWhile}\n * @see {@link skip}\n *\n * @param {Observable} notifier The Observable whose first emitted value will\n * cause the output Observable of `takeUntil` to stop emitting values from the\n * source Observable.\n * @return A function that returns an Observable that emits the values from the\n * source Observable until `notifier` emits its first value.\n */\nexport function takeUntil<T>(notifier: ObservableInput<any>): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n innerFrom(notifier).subscribe(new OperatorSubscriber(subscriber, () => subscriber.complete(), noop));\n !subscriber.closed && source.subscribe(subscriber);\n });\n}\n","import { OperatorFunction, MonoTypeOperatorFunction, Falsy } from '../types';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\nexport function takeWhile<T>(predicate: BooleanConstructor): OperatorFunction<T, Exclude<T, Falsy> extends never ? never : T>;\nexport function takeWhile<T>(\n predicate: BooleanConstructor,\n inclusive: false\n): OperatorFunction<T, Exclude<T, Falsy> extends never ? never : T>;\nexport function takeWhile<T>(predicate: BooleanConstructor, inclusive: true): MonoTypeOperatorFunction<T>;\nexport function takeWhile<T, S extends T>(predicate: (value: T, index: number) => value is S): OperatorFunction<T, S>;\nexport function takeWhile<T, S extends T>(predicate: (value: T, index: number) => value is S, inclusive: false): OperatorFunction<T, S>;\nexport function takeWhile<T>(predicate: (value: T, index: number) => boolean, inclusive?: boolean): MonoTypeOperatorFunction<T>;\n\n/**\n * Emits values emitted by the source Observable so long as each value satisfies\n * the given `predicate`, and then completes as soon as this `predicate` is not\n * satisfied.\n *\n * <span class=\"informal\">Takes values from the source only while they pass the\n * condition given. When the first value does not satisfy, it completes.</span>\n *\n * ![](takeWhile.png)\n *\n * `takeWhile` subscribes and begins mirroring the source Observable. Each value\n * emitted on the source is given to the `predicate` function which returns a\n * boolean, representing a condition to be satisfied by the source values. The\n * output Observable emits the source values until such time as the `predicate`\n * returns false, at which point `takeWhile` stops mirroring the source\n * Observable and completes the output Observable.\n *\n * ## Example\n * Emit click events only while the clientX property is greater than 200\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { takeWhile } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const result = clicks.pipe(takeWhile(ev => ev.clientX > 200));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link take}\n * @see {@link takeLast}\n * @see {@link takeUntil}\n * @see {@link skip}\n *\n * @param {function(value: T, index: number): boolean} predicate A function that\n * evaluates a value emitted by the source Observable and returns a boolean.\n * Also takes the (zero-based) index as the second argument.\n * @param {boolean} inclusive When set to `true` the value that caused\n * `predicate` to return `false` will also be emitted.\n * @return A function that returns an Observable that emits values from the\n * source Observable so long as each value satisfies the condition defined by\n * the `predicate`, then completes.\n */\nexport function takeWhile<T>(predicate: (value: T, index: number) => boolean, inclusive = false): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let index = 0;\n source.subscribe(\n new OperatorSubscriber(subscriber, (value) => {\n const result = predicate(value, index++);\n (result || inclusive) && subscriber.next(value);\n !result && subscriber.complete();\n })\n );\n });\n}\n","import { MonoTypeOperatorFunction, Observer } from '../types';\nimport { isFunction } from '../util/isFunction';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\nimport { identity } from '../util/identity';\n\nexport interface TapObserver<T> extends Observer<T> {\n subscribe: () => void;\n unsubscribe: () => void;\n finalize: () => void;\n}\n\nexport function tap<T>(observer?: Partial<TapObserver<T>>): MonoTypeOperatorFunction<T>;\nexport function tap<T>(next: (value: T) => void): MonoTypeOperatorFunction<T>;\n/** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */\nexport function tap<T>(\n next?: ((value: T) => void) | null,\n error?: ((error: any) => void) | null,\n complete?: (() => void) | null\n): MonoTypeOperatorFunction<T>;\n\n/**\n * Used to perform side-effects for notifications from the source observable\n *\n * <span class=\"informal\">Used when you want to affect outside state with a notification without altering the notification</span>\n *\n * ![](tap.png)\n *\n * Tap is designed to allow the developer a designated place to perform side effects. While you _could_ perform side-effects\n * inside of a `map` or a `mergeMap`, that would make their mapping functions impure, which isn't always a big deal, but will\n * make it so you can't do things like memoize those functions. The `tap` operator is designed solely for such side-effects to\n * help you remove side-effects from other operations.\n *\n * For any notification, next, error, or complete, `tap` will call the appropriate callback you have provided to it, via a function\n * reference, or a partial observer, then pass that notification down the stream.\n *\n * The observable returned by `tap` is an exact mirror of the source, with one exception: Any error that occurs -- synchronously -- in a handler\n * provided to `tap` will be emitted as an error from the returned observable.\n *\n * > Be careful! You can mutate objects as they pass through the `tap` operator's handlers.\n *\n * The most common use of `tap` is actually for debugging. You can place a `tap(console.log)` anywhere\n * in your observable `pipe`, log out the notifications as they are emitted by the source returned by the previous\n * operation.\n *\n * ## Example\n * Check a random number before it is handled. Below is an observable that will use a random number between 0 and 1,\n * and emit \"big\" or \"small\" depending on the size of that number. But we wanted to log what the original number\n * was, so we have added a `tap(console.log)`.\n *\n * ```ts\n * import { of } from 'rxjs';\n * import { tap, map } from 'rxjs/operators';\n *\n * of(Math.random()).pipe(\n * tap(console.log),\n * map(n => n > 0.5 ? 'big' : 'small')\n * ).subscribe(console.log);\n * ```\n *\n * ## Example\n * Using `tap` to analyze a value and force an error. Below is an observable where in our system we only\n * want to emit numbers 3 or less we get from another source. We can force our observable to error\n * using `tap`.\n *\n * ```ts\n * import { of } from 'rxjs';\n * import { tap } from 'rxjs/operators';\n *\n * const source = of(1, 2, 3, 4, 5)\n *\n * source.pipe(\n * tap(n => {\n * if (n > 3) {\n * throw new TypeError(`Value ${n} is greater than 3`)\n * }\n * })\n * )\n * .subscribe(console.log);\n * ```\n *\n * ## Example\n * We want to know when an observable completes before moving on to the next observable. The system\n * below will emit a random series of `\"X\"` characters from 3 different observables in sequence. The\n * only way we know when one observable completes and moves to the next one, in this case, is because\n * we have added a `tap` with the side-effect of logging to console.\n *\n * ```ts\n * import { of, interval } from 'rxjs';\n * import { tap, map, concatMap, take } from 'rxjs/operators';\n *\n *\n * of(1, 2, 3).pipe(\n * concatMap(n => interval(1000).pipe(\n * take(Math.round(Math.random() * 10)),\n * map(() => 'X'),\n * tap({\n * complete: () => console.log(`Done with ${n}`)\n * })\n * ))\n * )\n * .subscribe(console.log);\n * ```\n *\n * @see {@link finalize}\n * @see {@link Observable#subscribe}\n *\n * @param observerOrNext A next handler or partial observer\n * @param error An error handler\n * @param complete A completion handler\n * @return A function that returns an Observable identical to the source, but\n * runs the specified Observer or callback(s) for each item.\n */\nexport function tap<T>(\n observerOrNext?: Partial<TapObserver<T>> | ((value: T) => void) | null,\n error?: ((e: any) => void) | null,\n complete?: (() => void) | null\n): MonoTypeOperatorFunction<T> {\n // We have to check to see not only if next is a function,\n // but if error or complete were passed. This is because someone\n // could technically call tap like `tap(null, fn)` or `tap(null, null, fn)`.\n const tapObserver =\n isFunction(observerOrNext) || error || complete\n ? // tslint:disable-next-line: no-object-literal-type-assertion\n ({ next: observerOrNext as Exclude<typeof observerOrNext, Partial<TapObserver<T>>>, error, complete } as Partial<TapObserver<T>>)\n : observerOrNext;\n\n return tapObserver\n ? operate((source, subscriber) => {\n tapObserver.subscribe?.();\n let isUnsub = true;\n source.subscribe(\n new OperatorSubscriber(\n subscriber,\n (value) => {\n tapObserver.next?.(value);\n subscriber.next(value);\n },\n () => {\n isUnsub = false;\n tapObserver.complete?.();\n subscriber.complete();\n },\n (err) => {\n isUnsub = false;\n tapObserver.error?.(err);\n subscriber.error(err);\n },\n () => {\n if (isUnsub) {\n tapObserver.unsubscribe?.();\n }\n tapObserver.finalize?.();\n }\n )\n );\n })\n : // Tap was called with no valid tap observer or handler\n // (e.g. `tap(null, null, null)` or `tap(null)` or `tap()`)\n // so we're going to just mirror the source.\n identity;\n}\n","import { OperatorFunction, ObservableInputTuple } from '../types';\nimport { operate } from '../util/lift';\nimport { OperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/from';\nimport { identity } from '../util/identity';\nimport { noop } from '../util/noop';\nimport { popResultSelector } from '../util/args';\n\nexport function withLatestFrom<T, O extends unknown[]>(...inputs: [...ObservableInputTuple<O>]): OperatorFunction<T, [T, ...O]>;\n\nexport function withLatestFrom<T, O extends unknown[], R>(\n ...inputs: [...ObservableInputTuple<O>, (...value: [T, ...O]) => R]\n): OperatorFunction<T, R>;\n\n/**\n * Combines the source Observable with other Observables to create an Observable\n * whose values are calculated from the latest values of each, only when the\n * source emits.\n *\n * <span class=\"informal\">Whenever the source Observable emits a value, it\n * computes a formula using that value plus the latest values from other input\n * Observables, then emits the output of that formula.</span>\n *\n * ![](withLatestFrom.png)\n *\n * `withLatestFrom` combines each value from the source Observable (the\n * instance) with the latest values from the other input Observables only when\n * the source emits a value, optionally using a `project` function to determine\n * the value to be emitted on the output Observable. All input Observables must\n * emit at least one value before the output Observable will emit a value.\n *\n * ## Example\n * On every click event, emit an array with the latest timer event plus the click event\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { withLatestFrom } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const timer = interval(1000);\n * const result = clicks.pipe(withLatestFrom(timer));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link combineLatest}\n *\n * @param {ObservableInput} other An input Observable to combine with the source\n * Observable. More than one input Observables may be given as argument.\n * @param {Function} [project] Projection function for combining values\n * together. Receives all values in order of the Observables passed, where the\n * first parameter is a value from the source Observable. (e.g.\n * `a.pipe(withLatestFrom(b, c), map(([a1, b1, c1]) => a1 + b1 + c1))`). If this is not\n * passed, arrays will be emitted on the output Observable.\n * @return A function that returns an Observable of projected values from the\n * most recent values from each input Observable, or an array of the most\n * recent values from each input Observable.\n */\nexport function withLatestFrom<T, R>(...inputs: any[]): OperatorFunction<T, R | any[]> {\n const project = popResultSelector(inputs) as ((...args: any[]) => R) | undefined;\n\n return operate((source, subscriber) => {\n const len = inputs.length;\n const otherValues = new Array(len);\n // An array of whether or not the other sources have emitted. Matched with them by index.\n // TODO: At somepoint, we should investigate the performance implications here, and look\n // into using a `Set()` and checking the `size` to see if we're ready.\n let hasValue = inputs.map(() => false);\n // Flipped true when we have at least one value from all other sources and\n // we are ready to start emitting values.\n let ready = false;\n\n // Other sources. Note that here we are not checking `subscriber.closed`,\n // this causes all inputs to be subscribed to, even if nothing can be emitted\n // from them. This is an important distinction because subscription constitutes\n // a side-effect.\n for (let i = 0; i < len; i++) {\n innerFrom(inputs[i]).subscribe(\n new OperatorSubscriber(\n subscriber,\n (value) => {\n otherValues[i] = value;\n if (!ready && !hasValue[i]) {\n // If we're not ready yet, flag to show this observable has emitted.\n hasValue[i] = true;\n // Intentionally terse code.\n // If all of our other observables have emitted, set `ready` to `true`,\n // so we know we can start emitting values, then clean up the `hasValue` array,\n // because we don't need it anymore.\n (ready = hasValue.every(identity)) && (hasValue = null!);\n }\n },\n // Completing one of the other sources has\n // no bearing on the completion of our result.\n noop\n )\n );\n }\n\n // Source subscription\n source.subscribe(\n new OperatorSubscriber(subscriber, (value) => {\n if (ready) {\n // We have at least one value from the other sources. Go ahead and emit.\n const values = [value, ...otherValues];\n subscriber.next(project ? project(...values) : values);\n }\n })\n );\n });\n}\n","import { Image } from \"./Image\";\nimport {\n FilterExpression,\n FilterOperator,\n FilterValue,\n} from \"./FilterExpression\";\n\nimport { Func } from \"../util/Func\";\n\nexport type FilterFunction = Func<Image, boolean>;\n\n/**\n * @class Filter\n *\n * @classdesc Represents a class for creating image filters. Implementation and\n * definitions based on https://github.com/mapbox/feature-filter.\n */\nexport class FilterCreator {\n /**\n * Create a filter from a filter expression.\n *\n * @description The following filters are supported:\n *\n * Comparison\n * `==`\n * `!=`\n * `<`\n * `<=`\n * `>`\n * `>=`\n *\n * Set membership\n * `in`\n * `!in`\n *\n * Combining\n * `all`\n *\n * @param {FilterExpression} filter - Comparison, set membership or combinding filter\n * expression.\n * @returns {FilterFunction} Function taking a image and returning a boolean that\n * indicates whether the image passed the test or not.\n */\n public createFilter(filter: FilterExpression): FilterFunction {\n return <FilterFunction>new Function(\"node\", \"return \" + this._compile(filter) + \";\");\n }\n\n private _compile(filter: FilterExpression): string {\n if (filter == null || filter.length <= 1) {\n return \"true\";\n }\n\n const operator: FilterOperator = <FilterOperator>filter[0];\n const operation: string =\n operator === \"==\" ? this._compileComparisonOp(\"===\", <string>filter[1], filter[2], false) :\n operator === \"!=\" ? this._compileComparisonOp(\"!==\", <string>filter[1], filter[2], false) :\n operator === \">\" ||\n operator === \">=\" ||\n operator === \"<\" ||\n operator === \"<=\" ? this._compileComparisonOp(operator, <string>filter[1], filter[2], true) :\n operator === \"in\" ?\n this._compileInOp<FilterValue>(<string>filter[1], <FilterValue[]>filter.slice(2)) :\n operator === \"!in\" ?\n this._compileNegation(\n this._compileInOp<FilterValue>(<string>filter[1], <FilterValue[]>filter.slice(2))) :\n operator === \"all\" ? this._compileLogicalOp(<FilterExpression[]>filter.slice(1), \"&&\") :\n \"true\";\n\n return \"(\" + operation + \")\";\n }\n\n private _compare<T>(a: T, b: T): number {\n return a < b ? -1 : a > b ? 1 : 0;\n }\n\n private _compileComparisonOp<T>(operator: string, property: string, value: T, checkType: boolean): string {\n const left: string = this._compilePropertyReference(property);\n const right: string = JSON.stringify(value);\n\n return (checkType ? \"typeof \" + left + \"===typeof \" + right + \"&&\" : \"\") + left + operator + right;\n }\n\n private _compileInOp<T>(property: string, values: T[]): string {\n const compare: (a: T, b: T) => number = this._compare;\n const left: string = JSON.stringify(values.sort(compare));\n const right: string = this._compilePropertyReference(property);\n\n return left + \".indexOf(\" + right + \")!==-1\";\n }\n\n private _compileLogicalOp(filters: FilterExpression[], operator: string): string {\n const compile: (filter: FilterExpression) => string = this._compile.bind(this);\n\n return filters.map<string>(compile).join(operator);\n }\n\n private _compileNegation(expression: string): string {\n return \"!(\" + expression + \")\";\n }\n\n private _compilePropertyReference(property: string): string {\n return \"node[\" + JSON.stringify(property) + \"]\";\n }\n}\n","/**\n * @license\n * Copyright 2010-2021 Three.js Authors\n * SPDX-License-Identifier: MIT\n */\nconst REVISION = '134';\nconst MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };\nconst TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };\nconst CullFaceNone = 0;\nconst CullFaceBack = 1;\nconst CullFaceFront = 2;\nconst CullFaceFrontBack = 3;\nconst BasicShadowMap = 0;\nconst PCFShadowMap = 1;\nconst PCFSoftShadowMap = 2;\nconst VSMShadowMap = 3;\nconst FrontSide = 0;\nconst BackSide = 1;\nconst DoubleSide = 2;\nconst FlatShading = 1;\nconst SmoothShading = 2;\nconst NoBlending = 0;\nconst NormalBlending = 1;\nconst AdditiveBlending = 2;\nconst SubtractiveBlending = 3;\nconst MultiplyBlending = 4;\nconst CustomBlending = 5;\nconst AddEquation = 100;\nconst SubtractEquation = 101;\nconst ReverseSubtractEquation = 102;\nconst MinEquation = 103;\nconst MaxEquation = 104;\nconst ZeroFactor = 200;\nconst OneFactor = 201;\nconst SrcColorFactor = 202;\nconst OneMinusSrcColorFactor = 203;\nconst SrcAlphaFactor = 204;\nconst OneMinusSrcAlphaFactor = 205;\nconst DstAlphaFactor = 206;\nconst OneMinusDstAlphaFactor = 207;\nconst DstColorFactor = 208;\nconst OneMinusDstColorFactor = 209;\nconst SrcAlphaSaturateFactor = 210;\nconst NeverDepth = 0;\nconst AlwaysDepth = 1;\nconst LessDepth = 2;\nconst LessEqualDepth = 3;\nconst EqualDepth = 4;\nconst GreaterEqualDepth = 5;\nconst GreaterDepth = 6;\nconst NotEqualDepth = 7;\nconst MultiplyOperation = 0;\nconst MixOperation = 1;\nconst AddOperation = 2;\nconst NoToneMapping = 0;\nconst LinearToneMapping = 1;\nconst ReinhardToneMapping = 2;\nconst CineonToneMapping = 3;\nconst ACESFilmicToneMapping = 4;\nconst CustomToneMapping = 5;\n\nconst UVMapping = 300;\nconst CubeReflectionMapping = 301;\nconst CubeRefractionMapping = 302;\nconst EquirectangularReflectionMapping = 303;\nconst EquirectangularRefractionMapping = 304;\nconst CubeUVReflectionMapping = 306;\nconst CubeUVRefractionMapping = 307;\nconst RepeatWrapping = 1000;\nconst ClampToEdgeWrapping = 1001;\nconst MirroredRepeatWrapping = 1002;\nconst NearestFilter = 1003;\nconst NearestMipmapNearestFilter = 1004;\nconst NearestMipMapNearestFilter = 1004;\nconst NearestMipmapLinearFilter = 1005;\nconst NearestMipMapLinearFilter = 1005;\nconst LinearFilter = 1006;\nconst LinearMipmapNearestFilter = 1007;\nconst LinearMipMapNearestFilter = 1007;\nconst LinearMipmapLinearFilter = 1008;\nconst LinearMipMapLinearFilter = 1008;\nconst UnsignedByteType = 1009;\nconst ByteType = 1010;\nconst ShortType = 1011;\nconst UnsignedShortType = 1012;\nconst IntType = 1013;\nconst UnsignedIntType = 1014;\nconst FloatType = 1015;\nconst HalfFloatType = 1016;\nconst UnsignedShort4444Type = 1017;\nconst UnsignedShort5551Type = 1018;\nconst UnsignedShort565Type = 1019;\nconst UnsignedInt248Type = 1020;\nconst AlphaFormat = 1021;\nconst RGBFormat = 1022;\nconst RGBAFormat = 1023;\nconst LuminanceFormat = 1024;\nconst LuminanceAlphaFormat = 1025;\nconst RGBEFormat = RGBAFormat;\nconst DepthFormat = 1026;\nconst DepthStencilFormat = 1027;\nconst RedFormat = 1028;\nconst RedIntegerFormat = 1029;\nconst RGFormat = 1030;\nconst RGIntegerFormat = 1031;\nconst RGBIntegerFormat = 1032;\nconst RGBAIntegerFormat = 1033;\n\nconst RGB_S3TC_DXT1_Format = 33776;\nconst RGBA_S3TC_DXT1_Format = 33777;\nconst RGBA_S3TC_DXT3_Format = 33778;\nconst RGBA_S3TC_DXT5_Format = 33779;\nconst RGB_PVRTC_4BPPV1_Format = 35840;\nconst RGB_PVRTC_2BPPV1_Format = 35841;\nconst RGBA_PVRTC_4BPPV1_Format = 35842;\nconst RGBA_PVRTC_2BPPV1_Format = 35843;\nconst RGB_ETC1_Format = 36196;\nconst RGB_ETC2_Format = 37492;\nconst RGBA_ETC2_EAC_Format = 37496;\nconst RGBA_ASTC_4x4_Format = 37808;\nconst RGBA_ASTC_5x4_Format = 37809;\nconst RGBA_ASTC_5x5_Format = 37810;\nconst RGBA_ASTC_6x5_Format = 37811;\nconst RGBA_ASTC_6x6_Format = 37812;\nconst RGBA_ASTC_8x5_Format = 37813;\nconst RGBA_ASTC_8x6_Format = 37814;\nconst RGBA_ASTC_8x8_Format = 37815;\nconst RGBA_ASTC_10x5_Format = 37816;\nconst RGBA_ASTC_10x6_Format = 37817;\nconst RGBA_ASTC_10x8_Format = 37818;\nconst RGBA_ASTC_10x10_Format = 37819;\nconst RGBA_ASTC_12x10_Format = 37820;\nconst RGBA_ASTC_12x12_Format = 37821;\nconst RGBA_BPTC_Format = 36492;\nconst SRGB8_ALPHA8_ASTC_4x4_Format = 37840;\nconst SRGB8_ALPHA8_ASTC_5x4_Format = 37841;\nconst SRGB8_ALPHA8_ASTC_5x5_Format = 37842;\nconst SRGB8_ALPHA8_ASTC_6x5_Format = 37843;\nconst SRGB8_ALPHA8_ASTC_6x6_Format = 37844;\nconst SRGB8_ALPHA8_ASTC_8x5_Format = 37845;\nconst SRGB8_ALPHA8_ASTC_8x6_Format = 37846;\nconst SRGB8_ALPHA8_ASTC_8x8_Format = 37847;\nconst SRGB8_ALPHA8_ASTC_10x5_Format = 37848;\nconst SRGB8_ALPHA8_ASTC_10x6_Format = 37849;\nconst SRGB8_ALPHA8_ASTC_10x8_Format = 37850;\nconst SRGB8_ALPHA8_ASTC_10x10_Format = 37851;\nconst SRGB8_ALPHA8_ASTC_12x10_Format = 37852;\nconst SRGB8_ALPHA8_ASTC_12x12_Format = 37853;\nconst LoopOnce = 2200;\nconst LoopRepeat = 2201;\nconst LoopPingPong = 2202;\nconst InterpolateDiscrete = 2300;\nconst InterpolateLinear = 2301;\nconst InterpolateSmooth = 2302;\nconst ZeroCurvatureEnding = 2400;\nconst ZeroSlopeEnding = 2401;\nconst WrapAroundEnding = 2402;\nconst NormalAnimationBlendMode = 2500;\nconst AdditiveAnimationBlendMode = 2501;\nconst TrianglesDrawMode = 0;\nconst TriangleStripDrawMode = 1;\nconst TriangleFanDrawMode = 2;\nconst LinearEncoding = 3000;\nconst sRGBEncoding = 3001;\nconst GammaEncoding = 3007;\nconst RGBEEncoding = 3002;\nconst LogLuvEncoding = 3003;\nconst RGBM7Encoding = 3004;\nconst RGBM16Encoding = 3005;\nconst RGBDEncoding = 3006;\nconst BasicDepthPacking = 3200;\nconst RGBADepthPacking = 3201;\nconst TangentSpaceNormalMap = 0;\nconst ObjectSpaceNormalMap = 1;\n\nconst ZeroStencilOp = 0;\nconst KeepStencilOp = 7680;\nconst ReplaceStencilOp = 7681;\nconst IncrementStencilOp = 7682;\nconst DecrementStencilOp = 7683;\nconst IncrementWrapStencilOp = 34055;\nconst DecrementWrapStencilOp = 34056;\nconst InvertStencilOp = 5386;\n\nconst NeverStencilFunc = 512;\nconst LessStencilFunc = 513;\nconst EqualStencilFunc = 514;\nconst LessEqualStencilFunc = 515;\nconst GreaterStencilFunc = 516;\nconst NotEqualStencilFunc = 517;\nconst GreaterEqualStencilFunc = 518;\nconst AlwaysStencilFunc = 519;\n\nconst StaticDrawUsage = 35044;\nconst DynamicDrawUsage = 35048;\nconst StreamDrawUsage = 35040;\nconst StaticReadUsage = 35045;\nconst DynamicReadUsage = 35049;\nconst StreamReadUsage = 35041;\nconst StaticCopyUsage = 35046;\nconst DynamicCopyUsage = 35050;\nconst StreamCopyUsage = 35042;\n\nconst GLSL1 = '100';\nconst GLSL3 = '300 es';\n\n/**\n * https://github.com/mrdoob/eventdispatcher.js/\n */\n\nclass EventDispatcher {\n\n\taddEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) this._listeners = {};\n\n\t\tconst listeners = this._listeners;\n\n\t\tif ( listeners[ type ] === undefined ) {\n\n\t\t\tlisteners[ type ] = [];\n\n\t\t}\n\n\t\tif ( listeners[ type ].indexOf( listener ) === - 1 ) {\n\n\t\t\tlisteners[ type ].push( listener );\n\n\t\t}\n\n\t}\n\n\thasEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return false;\n\n\t\tconst listeners = this._listeners;\n\n\t\treturn listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;\n\n\t}\n\n\tremoveEventListener( type, listener ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tconst index = listenerArray.indexOf( listener );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\tlistenerArray.splice( index, 1 );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._listeners === undefined ) return;\n\n\t\tconst listeners = this._listeners;\n\t\tconst listenerArray = listeners[ event.type ];\n\n\t\tif ( listenerArray !== undefined ) {\n\n\t\t\tevent.target = this;\n\n\t\t\t// Make a copy, in case listeners are removed while iterating.\n\t\t\tconst array = listenerArray.slice( 0 );\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tarray[ i ].call( this, event );\n\n\t\t\t}\n\n\t\t\tevent.target = null;\n\n\t\t}\n\n\t}\n\n}\n\nlet _seed = 1234567;\n\nconst DEG2RAD = Math.PI / 180;\nconst RAD2DEG = 180 / Math.PI;\n\n//\n\nconst _lut = [];\n\nfor ( let i = 0; i < 256; i ++ ) {\n\n\t_lut[ i ] = ( i < 16 ? '0' : '' ) + ( i ).toString( 16 );\n\n}\n\nconst hasRandomUUID = typeof crypto !== 'undefined' && 'randomUUID' in crypto;\n\nfunction generateUUID() {\n\n\tif ( hasRandomUUID ) {\n\n\t\treturn crypto.randomUUID().toUpperCase();\n\n\t}\n\n\t// TODO Remove this code when crypto.randomUUID() is available everywhere\n\t// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\n\n\tconst d0 = Math.random() * 0xffffffff | 0;\n\tconst d1 = Math.random() * 0xffffffff | 0;\n\tconst d2 = Math.random() * 0xffffffff | 0;\n\tconst d3 = Math.random() * 0xffffffff | 0;\n\tconst uuid = _lut[ d0 & 0xff ] + _lut[ d0 >> 8 & 0xff ] + _lut[ d0 >> 16 & 0xff ] + _lut[ d0 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d1 & 0xff ] + _lut[ d1 >> 8 & 0xff ] + '-' + _lut[ d1 >> 16 & 0x0f | 0x40 ] + _lut[ d1 >> 24 & 0xff ] + '-' +\n\t\t\t_lut[ d2 & 0x3f | 0x80 ] + _lut[ d2 >> 8 & 0xff ] + '-' + _lut[ d2 >> 16 & 0xff ] + _lut[ d2 >> 24 & 0xff ] +\n\t\t\t_lut[ d3 & 0xff ] + _lut[ d3 >> 8 & 0xff ] + _lut[ d3 >> 16 & 0xff ] + _lut[ d3 >> 24 & 0xff ];\n\n\t// .toUpperCase() here flattens concatenated strings to save heap memory space.\n\treturn uuid.toUpperCase();\n\n}\n\nfunction clamp( value, min, max ) {\n\n\treturn Math.max( min, Math.min( max, value ) );\n\n}\n\n// compute euclidian modulo of m % n\n// https://en.wikipedia.org/wiki/Modulo_operation\nfunction euclideanModulo( n, m ) {\n\n\treturn ( ( n % m ) + m ) % m;\n\n}\n\n// Linear mapping from range <a1, a2> to range <b1, b2>\nfunction mapLinear( x, a1, a2, b1, b2 ) {\n\n\treturn b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\n\n}\n\n// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/\nfunction inverseLerp( x, y, value ) {\n\n\tif ( x !== y ) {\n\n\t\treturn ( value - x ) / ( y - x );\n\n\t} else {\n\n\t\treturn 0;\n\n\t}\n\n}\n\n// https://en.wikipedia.org/wiki/Linear_interpolation\nfunction lerp( x, y, t ) {\n\n\treturn ( 1 - t ) * x + t * y;\n\n}\n\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nfunction damp( x, y, lambda, dt ) {\n\n\treturn lerp( x, y, 1 - Math.exp( - lambda * dt ) );\n\n}\n\n// https://www.desmos.com/calculator/vcsjnyz7x4\nfunction pingpong( x, length = 1 ) {\n\n\treturn length - Math.abs( euclideanModulo( x, length * 2 ) - length );\n\n}\n\n// http://en.wikipedia.org/wiki/Smoothstep\nfunction smoothstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * ( 3 - 2 * x );\n\n}\n\nfunction smootherstep( x, min, max ) {\n\n\tif ( x <= min ) return 0;\n\tif ( x >= max ) return 1;\n\n\tx = ( x - min ) / ( max - min );\n\n\treturn x * x * x * ( x * ( x * 6 - 15 ) + 10 );\n\n}\n\n// Random integer from <low, high> interval\nfunction randInt( low, high ) {\n\n\treturn low + Math.floor( Math.random() * ( high - low + 1 ) );\n\n}\n\n// Random float from <low, high> interval\nfunction randFloat( low, high ) {\n\n\treturn low + Math.random() * ( high - low );\n\n}\n\n// Random float from <-range/2, range/2> interval\nfunction randFloatSpread( range ) {\n\n\treturn range * ( 0.5 - Math.random() );\n\n}\n\n// Deterministic pseudo-random float in the interval [ 0, 1 ]\nfunction seededRandom( s ) {\n\n\tif ( s !== undefined ) _seed = s % 2147483647;\n\n\t// Park-Miller algorithm\n\n\t_seed = _seed * 16807 % 2147483647;\n\n\treturn ( _seed - 1 ) / 2147483646;\n\n}\n\nfunction degToRad( degrees ) {\n\n\treturn degrees * DEG2RAD;\n\n}\n\nfunction radToDeg( radians ) {\n\n\treturn radians * RAD2DEG;\n\n}\n\nfunction isPowerOfTwo( value ) {\n\n\treturn ( value & ( value - 1 ) ) === 0 && value !== 0;\n\n}\n\nfunction ceilPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.ceil( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction floorPowerOfTwo( value ) {\n\n\treturn Math.pow( 2, Math.floor( Math.log( value ) / Math.LN2 ) );\n\n}\n\nfunction setQuaternionFromProperEuler( q, a, b, c, order ) {\n\n\t// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles\n\n\t// rotations are applied to the axes in the order specified by 'order'\n\t// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'\n\t// angles are in radians\n\n\tconst cos = Math.cos;\n\tconst sin = Math.sin;\n\n\tconst c2 = cos( b / 2 );\n\tconst s2 = sin( b / 2 );\n\n\tconst c13 = cos( ( a + c ) / 2 );\n\tconst s13 = sin( ( a + c ) / 2 );\n\n\tconst c1_3 = cos( ( a - c ) / 2 );\n\tconst s1_3 = sin( ( a - c ) / 2 );\n\n\tconst c3_1 = cos( ( c - a ) / 2 );\n\tconst s3_1 = sin( ( c - a ) / 2 );\n\n\tswitch ( order ) {\n\n\t\tcase 'XYX':\n\t\t\tq.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YZY':\n\t\t\tq.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZXZ':\n\t\t\tq.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'XZX':\n\t\t\tq.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'YXY':\n\t\t\tq.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );\n\t\t\tbreak;\n\n\t\tcase 'ZYZ':\n\t\t\tq.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order );\n\n\t}\n\n}\n\nvar MathUtils = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tDEG2RAD: DEG2RAD,\n\tRAD2DEG: RAD2DEG,\n\tgenerateUUID: generateUUID,\n\tclamp: clamp,\n\teuclideanModulo: euclideanModulo,\n\tmapLinear: mapLinear,\n\tinverseLerp: inverseLerp,\n\tlerp: lerp,\n\tdamp: damp,\n\tpingpong: pingpong,\n\tsmoothstep: smoothstep,\n\tsmootherstep: smootherstep,\n\trandInt: randInt,\n\trandFloat: randFloat,\n\trandFloatSpread: randFloatSpread,\n\tseededRandom: seededRandom,\n\tdegToRad: degToRad,\n\tradToDeg: radToDeg,\n\tisPowerOfTwo: isPowerOfTwo,\n\tceilPowerOfTwo: ceilPowerOfTwo,\n\tfloorPowerOfTwo: floorPowerOfTwo,\n\tsetQuaternionFromProperEuler: setQuaternionFromProperEuler\n});\n\nclass Vector2 {\n\n\tconstructor( x = 0, y = 0 ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.x;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.x = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.y;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.y = value;\n\n\t}\n\n\tset( x, y ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );\n\t\t\treturn this.addVectors( v, w );\n\n\t\t}\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );\n\t\t\treturn this.subVectors( v, w );\n\n\t\t}\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ];\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ];\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y;\n\n\t}\n\n\tcross( v ) {\n\n\t\treturn this.x * v.y - this.y * v.x;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tangle() {\n\n\t\t// computes the angle in radians with respect to the positive x-axis\n\n\t\tconst angle = Math.atan2( - this.y, - this.x ) + Math.PI;\n\n\t\treturn angle;\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y;\n\t\treturn dx * dx + dy * dy;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index, offset ) {\n\n\t\tif ( offset !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector2: offset has been removed from .fromBufferAttribute().' );\n\n\t\t}\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\n\t\treturn this;\n\n\t}\n\n\trotateAround( center, angle ) {\n\n\t\tconst c = Math.cos( angle ), s = Math.sin( angle );\n\n\t\tconst x = this.x - center.x;\n\t\tconst y = this.y - center.y;\n\n\t\tthis.x = x * c - y * s + center.x;\n\t\tthis.y = x * s + y * c + center.y;\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\n\t}\n\n}\n\nVector2.prototype.isVector2 = true;\n\nclass Matrix3 {\n\n\tconstructor() {\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t];\n\n\t\tif ( arguments.length > 0 ) {\n\n\t\t\tconsole.error( 'THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.' );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 1 ] = n21; te[ 2 ] = n31;\n\t\tte[ 3 ] = n12; te[ 4 ] = n22; te[ 5 ] = n32;\n\t\tte[ 6 ] = n13; te[ 7 ] = n23; te[ 8 ] = n33;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0,\n\t\t\t0, 1, 0,\n\t\t\t0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ];\n\t\tte[ 3 ] = me[ 3 ]; te[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ];\n\t\tte[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ]; te[ 8 ] = me[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrix3Column( this, 0 );\n\t\tyAxis.setFromMatrix3Column( this, 1 );\n\t\tzAxis.setFromMatrix3Column( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix4( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 4 ], me[ 8 ],\n\t\t\tme[ 1 ], me[ 5 ], me[ 9 ],\n\t\t\tme[ 2 ], me[ 6 ], me[ 10 ]\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m ) {\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 3 ], a13 = ae[ 6 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 4 ], a23 = ae[ 7 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 5 ], a33 = ae[ 8 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 3 ], b13 = be[ 6 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 4 ], b23 = be[ 7 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 5 ], b33 = be[ 8 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31;\n\t\tte[ 3 ] = a11 * b12 + a12 * b22 + a13 * b32;\n\t\tte[ 6 ] = a11 * b13 + a12 * b23 + a13 * b33;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31;\n\t\tte[ 4 ] = a21 * b12 + a22 * b22 + a23 * b32;\n\t\tte[ 7 ] = a21 * b13 + a22 * b23 + a23 * b33;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31;\n\t\tte[ 5 ] = a31 * b12 + a32 * b22 + a33 * b32;\n\t\tte[ 8 ] = a31 * b13 + a32 * b23 + a33 * b33;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;\n\t\tte[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;\n\t\tte[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],\n\t\t\td = te[ 3 ], e = te[ 4 ], f = te[ 5 ],\n\t\t\tg = te[ 6 ], h = te[ 7 ], i = te[ 8 ];\n\n\t\treturn a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\n\n\t}\n\n\tinvert() {\n\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ],\n\t\t\tn12 = te[ 3 ], n22 = te[ 4 ], n32 = te[ 5 ],\n\t\t\tn13 = te[ 6 ], n23 = te[ 7 ], n33 = te[ 8 ],\n\n\t\t\tt11 = n33 * n22 - n32 * n23,\n\t\t\tt12 = n32 * n13 - n33 * n12,\n\t\t\tt13 = n23 * n12 - n22 * n13,\n\n\t\t\tdet = n11 * t11 + n21 * t12 + n31 * t13;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n31 * n23 - n33 * n21 ) * detInv;\n\t\tte[ 2 ] = ( n32 * n21 - n31 * n22 ) * detInv;\n\n\t\tte[ 3 ] = t12 * detInv;\n\t\tte[ 4 ] = ( n33 * n11 - n31 * n13 ) * detInv;\n\t\tte[ 5 ] = ( n31 * n12 - n32 * n11 ) * detInv;\n\n\t\tte[ 6 ] = t13 * detInv;\n\t\tte[ 7 ] = ( n21 * n13 - n23 * n11 ) * detInv;\n\t\tte[ 8 ] = ( n22 * n11 - n21 * n12 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\ttranspose() {\n\n\t\tlet tmp;\n\t\tconst m = this.elements;\n\n\t\ttmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;\n\t\ttmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;\n\t\ttmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tgetNormalMatrix( matrix4 ) {\n\n\t\treturn this.setFromMatrix4( matrix4 ).invert().transpose();\n\n\t}\n\n\ttransposeIntoArray( r ) {\n\n\t\tconst m = this.elements;\n\n\t\tr[ 0 ] = m[ 0 ];\n\t\tr[ 1 ] = m[ 3 ];\n\t\tr[ 2 ] = m[ 6 ];\n\t\tr[ 3 ] = m[ 1 ];\n\t\tr[ 4 ] = m[ 4 ];\n\t\tr[ 5 ] = m[ 7 ];\n\t\tr[ 6 ] = m[ 2 ];\n\t\tr[ 7 ] = m[ 5 ];\n\t\tr[ 8 ] = m[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetUvTransform( tx, ty, sx, sy, rotation, cx, cy ) {\n\n\t\tconst c = Math.cos( rotation );\n\t\tconst s = Math.sin( rotation );\n\n\t\tthis.set(\n\t\t\tsx * c, sx * s, - sx * ( c * cx + s * cy ) + cx + tx,\n\t\t\t- sy * s, sy * c, - sy * ( - s * cx + c * cy ) + cy + ty,\n\t\t\t0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tscale( sx, sy ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= sx; te[ 3 ] *= sx; te[ 6 ] *= sx;\n\t\tte[ 1 ] *= sy; te[ 4 ] *= sy; te[ 7 ] *= sy;\n\n\t\treturn this;\n\n\t}\n\n\trotate( theta ) {\n\n\t\tconst c = Math.cos( theta );\n\t\tconst s = Math.sin( theta );\n\n\t\tconst te = this.elements;\n\n\t\tconst a11 = te[ 0 ], a12 = te[ 3 ], a13 = te[ 6 ];\n\t\tconst a21 = te[ 1 ], a22 = te[ 4 ], a23 = te[ 7 ];\n\n\t\tte[ 0 ] = c * a11 + s * a21;\n\t\tte[ 3 ] = c * a12 + s * a22;\n\t\tte[ 6 ] = c * a13 + s * a23;\n\n\t\tte[ 1 ] = - s * a11 + c * a21;\n\t\tte[ 4 ] = - s * a12 + c * a22;\n\t\tte[ 7 ] = - s * a13 + c * a23;\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( tx, ty ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] += tx * te[ 2 ]; te[ 3 ] += tx * te[ 5 ]; te[ 6 ] += tx * te[ 8 ];\n\t\tte[ 1 ] += ty * te[ 2 ]; te[ 4 ] += ty * te[ 5 ]; te[ 7 ] += ty * te[ 8 ];\n\n\t\treturn this;\n\n\t}\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\n\t\treturn array;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().fromArray( this.elements );\n\n\t}\n\n}\n\nMatrix3.prototype.isMatrix3 = true;\n\nfunction arrayMax( array ) {\n\n\tif ( array.length === 0 ) return - Infinity;\n\n\tlet max = array[ 0 ];\n\n\tfor ( let i = 1, l = array.length; i < l; ++ i ) {\n\n\t\tif ( array[ i ] > max ) max = array[ i ];\n\n\t}\n\n\treturn max;\n\n}\n\nconst TYPED_ARRAYS = {\n\tInt8Array: Int8Array,\n\tUint8Array: Uint8Array,\n\tUint8ClampedArray: Uint8ClampedArray,\n\tInt16Array: Int16Array,\n\tUint16Array: Uint16Array,\n\tInt32Array: Int32Array,\n\tUint32Array: Uint32Array,\n\tFloat32Array: Float32Array,\n\tFloat64Array: Float64Array\n};\n\nfunction getTypedArray( type, buffer ) {\n\n\treturn new TYPED_ARRAYS[ type ]( buffer );\n\n}\n\nfunction createElementNS( name ) {\n\n\treturn document.createElementNS( 'http://www.w3.org/1999/xhtml', name );\n\n}\n\n/**\n * cyrb53 hash for string from: https://stackoverflow.com/a/52171480\n *\n * Public Domain, @bryc - https://stackoverflow.com/users/815680/bryc\n *\n * It is roughly similar to the well-known MurmurHash/xxHash algorithms. It uses a combination\n * of multiplication and Xorshift to generate the hash, but not as thorough. As a result it's\n * faster than either would be in JavaScript and significantly simpler to implement. Keep in\n * mind this is not a secure algorithm, if privacy/security is a concern, this is not for you.\n *\n * @param {string} str\n * @param {number} seed, default 0\n * @returns number\n */\nfunction hashString( str, seed = 0 ) {\n\n\tlet h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;\n\n\tfor ( let i = 0, ch; i < str.length; i ++ ) {\n\n\t\tch = str.charCodeAt( i );\n\n\t\th1 = Math.imul( h1 ^ ch, 2654435761 );\n\n\t\th2 = Math.imul( h2 ^ ch, 1597334677 );\n\n\t}\n\n\th1 = Math.imul( h1 ^ ( h1 >>> 16 ), 2246822507 ) ^ Math.imul( h2 ^ ( h2 >>> 13 ), 3266489909 );\n\n\th2 = Math.imul( h2 ^ ( h2 >>> 16 ), 2246822507 ) ^ Math.imul( h1 ^ ( h1 >>> 13 ), 3266489909 );\n\n\treturn 4294967296 * ( 2097151 & h2 ) + ( h1 >>> 0 );\n\n}\n\nlet _canvas;\n\nclass ImageUtils {\n\n\tstatic getDataURL( image ) {\n\n\t\tif ( /^data:/i.test( image.src ) ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tif ( typeof HTMLCanvasElement == 'undefined' ) {\n\n\t\t\treturn image.src;\n\n\t\t}\n\n\t\tlet canvas;\n\n\t\tif ( image instanceof HTMLCanvasElement ) {\n\n\t\t\tcanvas = image;\n\n\t\t} else {\n\n\t\t\tif ( _canvas === undefined ) _canvas = createElementNS( 'canvas' );\n\n\t\t\t_canvas.width = image.width;\n\t\t\t_canvas.height = image.height;\n\n\t\t\tconst context = _canvas.getContext( '2d' );\n\n\t\t\tif ( image instanceof ImageData ) {\n\n\t\t\t\tcontext.putImageData( image, 0, 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height );\n\n\t\t\t}\n\n\t\t\tcanvas = _canvas;\n\n\t\t}\n\n\t\tif ( canvas.width > 2048 || canvas.height > 2048 ) {\n\n\t\t\tconsole.warn( 'THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image );\n\n\t\t\treturn canvas.toDataURL( 'image/jpeg', 0.6 );\n\n\t\t} else {\n\n\t\t\treturn canvas.toDataURL( 'image/png' );\n\n\t\t}\n\n\t}\n\n}\n\nlet textureId = 0;\n\nclass Texture extends EventDispatcher {\n\n\tconstructor( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = 1, encoding = LinearEncoding ) {\n\n\t\tsuper();\n\n\t\tObject.defineProperty( this, 'id', { value: textureId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\n\t\tthis.image = image;\n\t\tthis.mipmaps = [];\n\n\t\tthis.mapping = mapping;\n\n\t\tthis.wrapS = wrapS;\n\t\tthis.wrapT = wrapT;\n\n\t\tthis.magFilter = magFilter;\n\t\tthis.minFilter = minFilter;\n\n\t\tthis.anisotropy = anisotropy;\n\n\t\tthis.format = format;\n\t\tthis.internalFormat = null;\n\t\tthis.type = type;\n\n\t\tthis.offset = new Vector2( 0, 0 );\n\t\tthis.repeat = new Vector2( 1, 1 );\n\t\tthis.center = new Vector2( 0, 0 );\n\t\tthis.rotation = 0;\n\n\t\tthis.matrixAutoUpdate = true;\n\t\tthis.matrix = new Matrix3();\n\n\t\tthis.generateMipmaps = true;\n\t\tthis.premultiplyAlpha = false;\n\t\tthis.flipY = true;\n\t\tthis.unpackAlignment = 4;\t// valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\n\n\t\t// Values of encoding !== THREE.LinearEncoding only supported on map, envMap and emissiveMap.\n\t\t//\n\t\t// Also changing the encoding after already used by a Material will not automatically make the Material\n\t\t// update. You need to explicitly call Material.needsUpdate to trigger it to recompile.\n\t\tthis.encoding = encoding;\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\t\tthis.onUpdate = null;\n\n\t\tthis.isRenderTargetTexture = false;\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.setUvTransform( this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.image = source.image;\n\t\tthis.mipmaps = source.mipmaps.slice( 0 );\n\n\t\tthis.mapping = source.mapping;\n\n\t\tthis.wrapS = source.wrapS;\n\t\tthis.wrapT = source.wrapT;\n\n\t\tthis.magFilter = source.magFilter;\n\t\tthis.minFilter = source.minFilter;\n\n\t\tthis.anisotropy = source.anisotropy;\n\n\t\tthis.format = source.format;\n\t\tthis.internalFormat = source.internalFormat;\n\t\tthis.type = source.type;\n\n\t\tthis.offset.copy( source.offset );\n\t\tthis.repeat.copy( source.repeat );\n\t\tthis.center.copy( source.center );\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrix.copy( source.matrix );\n\n\t\tthis.generateMipmaps = source.generateMipmaps;\n\t\tthis.premultiplyAlpha = source.premultiplyAlpha;\n\t\tthis.flipY = source.flipY;\n\t\tthis.unpackAlignment = source.unpackAlignment;\n\t\tthis.encoding = source.encoding;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( ! isRootObject && meta.textures[ this.uuid ] !== undefined ) {\n\n\t\t\treturn meta.textures[ this.uuid ];\n\n\t\t}\n\n\t\tconst output = {\n\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.5,\n\t\t\t\ttype: 'Texture',\n\t\t\t\tgenerator: 'Texture.toJSON'\n\t\t\t},\n\n\t\t\tuuid: this.uuid,\n\t\t\tname: this.name,\n\n\t\t\tmapping: this.mapping,\n\n\t\t\trepeat: [ this.repeat.x, this.repeat.y ],\n\t\t\toffset: [ this.offset.x, this.offset.y ],\n\t\t\tcenter: [ this.center.x, this.center.y ],\n\t\t\trotation: this.rotation,\n\n\t\t\twrap: [ this.wrapS, this.wrapT ],\n\n\t\t\tformat: this.format,\n\t\t\ttype: this.type,\n\t\t\tencoding: this.encoding,\n\n\t\t\tminFilter: this.minFilter,\n\t\t\tmagFilter: this.magFilter,\n\t\t\tanisotropy: this.anisotropy,\n\n\t\t\tflipY: this.flipY,\n\n\t\t\tpremultiplyAlpha: this.premultiplyAlpha,\n\t\t\tunpackAlignment: this.unpackAlignment\n\n\t\t};\n\n\t\tif ( this.image !== undefined ) {\n\n\t\t\t// TODO: Move to THREE.Image\n\n\t\t\tconst image = this.image;\n\n\t\t\tif ( image.uuid === undefined ) {\n\n\t\t\t\timage.uuid = generateUUID(); // UGH\n\n\t\t\t}\n\n\t\t\tif ( ! isRootObject && meta.images[ image.uuid ] === undefined ) {\n\n\t\t\t\tlet url;\n\n\t\t\t\tif ( Array.isArray( image ) ) {\n\n\t\t\t\t\t// process array of images e.g. CubeTexture\n\n\t\t\t\t\turl = [];\n\n\t\t\t\t\tfor ( let i = 0, l = image.length; i < l; i ++ ) {\n\n\t\t\t\t\t\t// check cube texture with data textures\n\n\t\t\t\t\t\tif ( image[ i ].isDataTexture ) {\n\n\t\t\t\t\t\t\turl.push( serializeImage( image[ i ].image ) );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\turl.push( serializeImage( image[ i ] ) );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// process single image\n\n\t\t\t\t\turl = serializeImage( image );\n\n\t\t\t\t}\n\n\t\t\t\tmeta.images[ image.uuid ] = {\n\t\t\t\t\tuuid: image.uuid,\n\t\t\t\t\turl: url\n\t\t\t\t};\n\n\t\t\t}\n\n\t\t\toutput.image = image.uuid;\n\n\t\t}\n\n\t\tif ( JSON.stringify( this.userData ) !== '{}' ) output.userData = this.userData;\n\n\t\tif ( ! isRootObject ) {\n\n\t\t\tmeta.textures[ this.uuid ] = output;\n\n\t\t}\n\n\t\treturn output;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\ttransformUv( uv ) {\n\n\t\tif ( this.mapping !== UVMapping ) return uv;\n\n\t\tuv.applyMatrix3( this.matrix );\n\n\t\tif ( uv.x < 0 || uv.x > 1 ) {\n\n\t\t\tswitch ( this.wrapS ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.x = uv.x < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.x = Math.ceil( uv.x ) - uv.x;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( uv.y < 0 || uv.y > 1 ) {\n\n\t\t\tswitch ( this.wrapT ) {\n\n\t\t\t\tcase RepeatWrapping:\n\n\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ClampToEdgeWrapping:\n\n\t\t\t\t\tuv.y = uv.y < 0 ? 0 : 1;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase MirroredRepeatWrapping:\n\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) {\n\n\t\t\t\t\t\tuv.y = Math.ceil( uv.y ) - uv.y;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.flipY ) {\n\n\t\t\tuv.y = 1 - uv.y;\n\n\t\t}\n\n\t\treturn uv;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n}\n\nTexture.DEFAULT_IMAGE = undefined;\nTexture.DEFAULT_MAPPING = UVMapping;\n\nTexture.prototype.isTexture = true;\n\nfunction serializeImage( image ) {\n\n\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t// default images\n\n\t\treturn ImageUtils.getDataURL( image );\n\n\t} else {\n\n\t\tif ( image.data ) {\n\n\t\t\t// images of DataTexture\n\n\t\t\treturn {\n\t\t\t\tdata: Array.prototype.slice.call( image.data ),\n\t\t\t\twidth: image.width,\n\t\t\t\theight: image.height,\n\t\t\t\ttype: image.data.constructor.name\n\t\t\t};\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.Texture: Unable to serialize Texture.' );\n\t\t\treturn {};\n\n\t\t}\n\n\t}\n\n}\n\nclass Vector4 {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t}\n\n\tget width() {\n\n\t\treturn this.z;\n\n\t}\n\n\tset width( value ) {\n\n\t\tthis.z = value;\n\n\t}\n\n\tget height() {\n\n\t\treturn this.w;\n\n\t}\n\n\tset height( value ) {\n\n\t\tthis.w = value;\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\t\tthis.w = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( w ) {\n\n\t\tthis.w = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tcase 3: this.w = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tcase 3: return this.w;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z, this.w );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );\n\t\t\treturn this.addVectors( v, w );\n\n\t\t}\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\t\tthis.w += v.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\t\tthis.w += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\t\tthis.w = a.w + b.w;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\t\tthis.w += v.w * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );\n\t\t\treturn this.subVectors( v, w );\n\n\t\t}\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\t\tthis.w -= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\t\tthis.w -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\t\tthis.w = a.w - b.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v ) {\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\t\tthis.w *= v.w;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\t\tthis.w *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z, w = this.w;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tsetAxisAngleFromQuaternion( q ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n\n\t\t// q is assumed to be normalized\n\n\t\tthis.w = 2 * Math.acos( q.w );\n\n\t\tconst s = Math.sqrt( 1 - q.w * q.w );\n\n\t\tif ( s < 0.0001 ) {\n\n\t\t\tthis.x = 1;\n\t\t\tthis.y = 0;\n\t\t\tthis.z = 0;\n\n\t\t} else {\n\n\t\t\tthis.x = q.x / s;\n\t\t\tthis.y = q.y / s;\n\t\t\tthis.z = q.z / s;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetAxisAngleFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tlet angle, x, y, z; // variables for result\n\t\tconst epsilon = 0.01,\t\t// margin to allow for rounding errors\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\n\n\t\t\tte = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon ) &&\n\t\t ( Math.abs( m13 - m31 ) < epsilon ) &&\n\t\t ( Math.abs( m23 - m32 ) < epsilon ) ) {\n\n\t\t\t// singularity found\n\t\t\t// first check for identity matrix which must have +1 for all terms\n\t\t\t// in leading diagonal and zero in other terms\n\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m13 + m31 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m23 + m32 ) < epsilon2 ) &&\n\t\t\t ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\n\n\t\t\t\t// this singularity is identity matrix so angle = 0\n\n\t\t\t\tthis.set( 1, 0, 0, 0 );\n\n\t\t\t\treturn this; // zero angle, arbitrary axis\n\n\t\t\t}\n\n\t\t\t// otherwise this singularity is angle = 180\n\n\t\t\tangle = Math.PI;\n\n\t\t\tconst xx = ( m11 + 1 ) / 2;\n\t\t\tconst yy = ( m22 + 1 ) / 2;\n\t\t\tconst zz = ( m33 + 1 ) / 2;\n\t\t\tconst xy = ( m12 + m21 ) / 4;\n\t\t\tconst xz = ( m13 + m31 ) / 4;\n\t\t\tconst yz = ( m23 + m32 ) / 4;\n\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) {\n\n\t\t\t\t// m11 is the largest diagonal term\n\n\t\t\t\tif ( xx < epsilon ) {\n\n\t\t\t\t\tx = 0;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tx = Math.sqrt( xx );\n\t\t\t\t\ty = xy / x;\n\t\t\t\t\tz = xz / x;\n\n\t\t\t\t}\n\n\t\t\t} else if ( yy > zz ) {\n\n\t\t\t\t// m22 is the largest diagonal term\n\n\t\t\t\tif ( yy < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0;\n\t\t\t\t\tz = 0.707106781;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ty = Math.sqrt( yy );\n\t\t\t\t\tx = xy / y;\n\t\t\t\t\tz = yz / y;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// m33 is the largest diagonal term so base result on this\n\n\t\t\t\tif ( zz < epsilon ) {\n\n\t\t\t\t\tx = 0.707106781;\n\t\t\t\t\ty = 0.707106781;\n\t\t\t\t\tz = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tz = Math.sqrt( zz );\n\t\t\t\t\tx = xz / z;\n\t\t\t\t\ty = yz / z;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.set( x, y, z, angle );\n\n\t\t\treturn this; // return 180 deg rotation\n\n\t\t}\n\n\t\t// as we have reached here there are no singularities so we can handle normally\n\n\t\tlet s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 ) +\n\t\t\t( m13 - m31 ) * ( m13 - m31 ) +\n\t\t\t( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\n\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\n\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\n\t\t// caught by singularity test above, but I've left it in just in case\n\n\t\tthis.x = ( m32 - m23 ) / s;\n\t\tthis.y = ( m13 - m31 ) / s;\n\t\tthis.z = ( m21 - m12 ) / s;\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\t\tthis.w = Math.min( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\t\tthis.w = Math.max( this.w, v.w );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\t\tthis.w = Math.max( min.w, Math.min( max.w, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\t\tthis.w = Math.max( minVal, Math.min( maxVal, this.w ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\t\tthis.w = Math.floor( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\t\tthis.w = Math.ceil( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\t\tthis.w = Math.round( this.w );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\n\t\tthis.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );\n\t\tthis.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\t\tthis.w = - this.w;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\t\tthis.w += ( v.w - this.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\t\tthis.w = v1.w + ( v2.w - v1.w ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\t\tthis.w = array[ offset + 3 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\t\tarray[ offset + 3 ] = this.w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index, offset ) {\n\n\t\tif ( offset !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector4: offset has been removed from .fromBufferAttribute().' );\n\n\t\t}\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\t\tthis.w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\t\tthis.w = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\t\tyield this.w;\n\n\t}\n\n}\n\nVector4.prototype.isVector4 = true;\n\n/*\n In options, we can specify:\n * Texture parameters for an auto-generated target texture\n * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers\n*/\nclass WebGLRenderTarget extends EventDispatcher {\n\n\tconstructor( width, height, options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\t\tthis.depth = 1;\n\n\t\tthis.scissor = new Vector4( 0, 0, width, height );\n\t\tthis.scissorTest = false;\n\n\t\tthis.viewport = new Vector4( 0, 0, width, height );\n\n\t\tthis.texture = new Texture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\tthis.texture.image = { width: width, height: height, depth: 1 };\n\n\t\tthis.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n\t\tthis.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;\n\t\tthis.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\n\n\t\tthis.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;\n\t\tthis.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;\n\t\tthis.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;\n\n\t}\n\n\tsetTexture( texture ) {\n\n\t\ttexture.image = {\n\t\t\twidth: this.width,\n\t\t\theight: this.height,\n\t\t\tdepth: this.depth\n\t\t};\n\n\t\tthis.texture = texture;\n\n\t}\n\n\tsetSize( width, height, depth = 1 ) {\n\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.depth = depth;\n\n\t\t\tthis.texture.image.width = width;\n\t\t\tthis.texture.image.height = height;\n\t\t\tthis.texture.image.depth = depth;\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\t\tthis.depth = source.depth;\n\n\t\tthis.viewport.copy( source.viewport );\n\n\t\tthis.texture = source.texture.clone();\n\t\tthis.texture.image = { ...this.texture.image }; // See #20328.\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\t\tthis.depthTexture = source.depthTexture;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nWebGLRenderTarget.prototype.isWebGLRenderTarget = true;\n\nclass WebGLMultipleRenderTargets extends WebGLRenderTarget {\n\n\tconstructor( width, height, count ) {\n\n\t\tsuper( width, height );\n\n\t\tconst texture = this.texture;\n\n\t\tthis.texture = [];\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tthis.texture[ i ] = texture.clone();\n\n\t\t}\n\n\t}\n\n\tsetSize( width, height, depth = 1 ) {\n\n\t\tif ( this.width !== width || this.height !== height || this.depth !== depth ) {\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.depth = depth;\n\n\t\t\tfor ( let i = 0, il = this.texture.length; i < il; i ++ ) {\n\n\t\t\t\tthis.texture[ i ].image.width = width;\n\t\t\t\tthis.texture[ i ].image.height = height;\n\t\t\t\tthis.texture[ i ].image.depth = depth;\n\n\t\t\t}\n\n\t\t\tthis.dispose();\n\n\t\t}\n\n\t\tthis.viewport.set( 0, 0, width, height );\n\t\tthis.scissor.set( 0, 0, width, height );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.dispose();\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\t\tthis.depth = source.depth;\n\n\t\tthis.viewport.set( 0, 0, this.width, this.height );\n\t\tthis.scissor.set( 0, 0, this.width, this.height );\n\n\t\tthis.depthBuffer = source.depthBuffer;\n\t\tthis.stencilBuffer = source.stencilBuffer;\n\t\tthis.depthTexture = source.depthTexture;\n\n\t\tthis.texture.length = 0;\n\n\t\tfor ( let i = 0, il = source.texture.length; i < il; i ++ ) {\n\n\t\t\tthis.texture[ i ] = source.texture[ i ].clone();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nWebGLMultipleRenderTargets.prototype.isWebGLMultipleRenderTargets = true;\n\nclass WebGLMultisampleRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( width, height, options ) {\n\n\t\tsuper( width, height, options );\n\n\t\tthis.samples = 4;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy.call( this, source );\n\n\t\tthis.samples = source.samples;\n\n\t\treturn this;\n\n\t}\n\n}\n\nWebGLMultisampleRenderTarget.prototype.isWebGLMultisampleRenderTarget = true;\n\nclass Quaternion {\n\n\tconstructor( x = 0, y = 0, z = 0, w = 1 ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t}\n\n\tstatic slerp( qa, qb, qm, t ) {\n\n\t\tconsole.warn( 'THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead.' );\n\t\treturn qm.slerpQuaternions( qa, qb, t );\n\n\t}\n\n\tstatic slerpFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t ) {\n\n\t\t// fuzz-free, array-based Quaternion SLERP operation\n\n\t\tlet x0 = src0[ srcOffset0 + 0 ],\n\t\t\ty0 = src0[ srcOffset0 + 1 ],\n\t\t\tz0 = src0[ srcOffset0 + 2 ],\n\t\t\tw0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 + 0 ],\n\t\t\ty1 = src1[ srcOffset1 + 1 ],\n\t\t\tz1 = src1[ srcOffset1 + 2 ],\n\t\t\tw1 = src1[ srcOffset1 + 3 ];\n\n\t\tif ( t === 0 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x0;\n\t\t\tdst[ dstOffset + 1 ] = y0;\n\t\t\tdst[ dstOffset + 2 ] = z0;\n\t\t\tdst[ dstOffset + 3 ] = w0;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( t === 1 ) {\n\n\t\t\tdst[ dstOffset + 0 ] = x1;\n\t\t\tdst[ dstOffset + 1 ] = y1;\n\t\t\tdst[ dstOffset + 2 ] = z1;\n\t\t\tdst[ dstOffset + 3 ] = w1;\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1 ) {\n\n\t\t\tlet s = 1 - t;\n\t\t\tconst cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,\n\t\t\t\tdir = ( cos >= 0 ? 1 : - 1 ),\n\t\t\t\tsqrSin = 1 - cos * cos;\n\n\t\t\t// Skip the Slerp for tiny steps to avoid numeric problems:\n\t\t\tif ( sqrSin > Number.EPSILON ) {\n\n\t\t\t\tconst sin = Math.sqrt( sqrSin ),\n\t\t\t\t\tlen = Math.atan2( sin, cos * dir );\n\n\t\t\t\ts = Math.sin( s * len ) / sin;\n\t\t\t\tt = Math.sin( t * len ) / sin;\n\n\t\t\t}\n\n\t\t\tconst tDir = t * dir;\n\n\t\t\tx0 = x0 * s + x1 * tDir;\n\t\t\ty0 = y0 * s + y1 * tDir;\n\t\t\tz0 = z0 * s + z1 * tDir;\n\t\t\tw0 = w0 * s + w1 * tDir;\n\n\t\t\t// Normalize in case we just did a lerp:\n\t\t\tif ( s === 1 - t ) {\n\n\t\t\t\tconst f = 1 / Math.sqrt( x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0 );\n\n\t\t\t\tx0 *= f;\n\t\t\t\ty0 *= f;\n\t\t\t\tz0 *= f;\n\t\t\t\tw0 *= f;\n\n\t\t\t}\n\n\t\t}\n\n\t\tdst[ dstOffset ] = x0;\n\t\tdst[ dstOffset + 1 ] = y0;\n\t\tdst[ dstOffset + 2 ] = z0;\n\t\tdst[ dstOffset + 3 ] = w0;\n\n\t}\n\n\tstatic multiplyQuaternionsFlat( dst, dstOffset, src0, srcOffset0, src1, srcOffset1 ) {\n\n\t\tconst x0 = src0[ srcOffset0 ];\n\t\tconst y0 = src0[ srcOffset0 + 1 ];\n\t\tconst z0 = src0[ srcOffset0 + 2 ];\n\t\tconst w0 = src0[ srcOffset0 + 3 ];\n\n\t\tconst x1 = src1[ srcOffset1 ];\n\t\tconst y1 = src1[ srcOffset1 + 1 ];\n\t\tconst z1 = src1[ srcOffset1 + 2 ];\n\t\tconst w1 = src1[ srcOffset1 + 3 ];\n\n\t\tdst[ dstOffset ] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;\n\t\tdst[ dstOffset + 1 ] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;\n\t\tdst[ dstOffset + 2 ] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;\n\t\tdst[ dstOffset + 3 ] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;\n\n\t\treturn dst;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget w() {\n\n\t\treturn this._w;\n\n\t}\n\n\tset w( value ) {\n\n\t\tthis._w = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, w ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._w = w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._w );\n\n\t}\n\n\tcopy( quaternion ) {\n\n\t\tthis._x = quaternion.x;\n\t\tthis._y = quaternion.y;\n\t\tthis._z = quaternion.z;\n\t\tthis._w = quaternion.w;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromEuler( euler, update ) {\n\n\t\tif ( ! ( euler && euler.isEuler ) ) {\n\n\t\t\tthrow new Error( 'THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.' );\n\n\t\t}\n\n\t\tconst x = euler._x, y = euler._y, z = euler._z, order = euler._order;\n\n\t\t// http://www.mathworks.com/matlabcentral/fileexchange/\n\t\t// \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n\t\t//\tcontent/SpinCalc.m\n\n\t\tconst cos = Math.cos;\n\t\tconst sin = Math.sin;\n\n\t\tconst c1 = cos( x / 2 );\n\t\tconst c2 = cos( y / 2 );\n\t\tconst c3 = cos( z / 2 );\n\n\t\tconst s1 = sin( x / 2 );\n\t\tconst s2 = sin( y / 2 );\n\t\tconst s3 = sin( z / 2 );\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\t\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\t\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\n\t\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\n\t\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\n\t\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.warn( 'THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tif ( update !== false ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAxisAngle( axis, angle ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n\n\t\t// assumes axis is normalized\n\n\t\tconst halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n\t\tthis._x = axis.x * s;\n\t\tthis._y = axis.y * s;\n\t\tthis._z = axis.z * s;\n\t\tthis._w = Math.cos( halfAngle );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m ) {\n\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements,\n\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],\n\n\t\t\ttrace = m11 + m22 + m33;\n\n\t\tif ( trace > 0 ) {\n\n\t\t\tconst s = 0.5 / Math.sqrt( trace + 1.0 );\n\n\t\t\tthis._w = 0.25 / s;\n\t\t\tthis._x = ( m32 - m23 ) * s;\n\t\t\tthis._y = ( m13 - m31 ) * s;\n\t\t\tthis._z = ( m21 - m12 ) * s;\n\n\t\t} else if ( m11 > m22 && m11 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );\n\n\t\t\tthis._w = ( m32 - m23 ) / s;\n\t\t\tthis._x = 0.25 * s;\n\t\t\tthis._y = ( m12 + m21 ) / s;\n\t\t\tthis._z = ( m13 + m31 ) / s;\n\n\t\t} else if ( m22 > m33 ) {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );\n\n\t\t\tthis._w = ( m13 - m31 ) / s;\n\t\t\tthis._x = ( m12 + m21 ) / s;\n\t\t\tthis._y = 0.25 * s;\n\t\t\tthis._z = ( m23 + m32 ) / s;\n\n\t\t} else {\n\n\t\t\tconst s = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );\n\n\t\t\tthis._w = ( m21 - m12 ) / s;\n\t\t\tthis._x = ( m13 + m31 ) / s;\n\t\t\tthis._y = ( m23 + m32 ) / s;\n\t\t\tthis._z = 0.25 * s;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromUnitVectors( vFrom, vTo ) {\n\n\t\t// assumes direction vectors vFrom and vTo are normalized\n\n\t\tlet r = vFrom.dot( vTo ) + 1;\n\n\t\tif ( r < Number.EPSILON ) {\n\n\t\t\t// vFrom and vTo point in opposite directions\n\n\t\t\tr = 0;\n\n\t\t\tif ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n\n\t\t\t\tthis._x = - vFrom.y;\n\t\t\t\tthis._y = vFrom.x;\n\t\t\t\tthis._z = 0;\n\t\t\t\tthis._w = r;\n\n\t\t\t} else {\n\n\t\t\t\tthis._x = 0;\n\t\t\t\tthis._y = - vFrom.z;\n\t\t\t\tthis._z = vFrom.y;\n\t\t\t\tthis._w = r;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n\n\t\t\tthis._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\n\t\t\tthis._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\n\t\t\tthis._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\n\t\t\tthis._w = r;\n\n\t\t}\n\n\t\treturn this.normalize();\n\n\t}\n\n\tangleTo( q ) {\n\n\t\treturn 2 * Math.acos( Math.abs( clamp( this.dot( q ), - 1, 1 ) ) );\n\n\t}\n\n\trotateTowards( q, step ) {\n\n\t\tconst angle = this.angleTo( q );\n\n\t\tif ( angle === 0 ) return this;\n\n\t\tconst t = Math.min( 1, step / angle );\n\n\t\tthis.slerp( q, t );\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\treturn this.set( 0, 0, 0, 1 );\n\n\t}\n\n\tinvert() {\n\n\t\t// quaternion is assumed to have unit length\n\n\t\treturn this.conjugate();\n\n\t}\n\n\tconjugate() {\n\n\t\tthis._x *= - 1;\n\t\tthis._y *= - 1;\n\t\tthis._z *= - 1;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\n\n\t}\n\n\tlengthSq() {\n\n\t\treturn this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );\n\n\t}\n\n\tnormalize() {\n\n\t\tlet l = this.length();\n\n\t\tif ( l === 0 ) {\n\n\t\t\tthis._x = 0;\n\t\t\tthis._y = 0;\n\t\t\tthis._z = 0;\n\t\t\tthis._w = 1;\n\n\t\t} else {\n\n\t\t\tl = 1 / l;\n\n\t\t\tthis._x = this._x * l;\n\t\t\tthis._y = this._y * l;\n\t\t\tthis._z = this._z * l;\n\t\t\tthis._w = this._w * l;\n\n\t\t}\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( q, p ) {\n\n\t\tif ( p !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.' );\n\t\t\treturn this.multiplyQuaternions( q, p );\n\n\t\t}\n\n\t\treturn this.multiplyQuaternions( this, q );\n\n\t}\n\n\tpremultiply( q ) {\n\n\t\treturn this.multiplyQuaternions( q, this );\n\n\t}\n\n\tmultiplyQuaternions( a, b ) {\n\n\t\t// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n\t\tconst qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\n\t\tconst qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\n\n\t\tthis._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n\t\tthis._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n\t\tthis._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n\t\tthis._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerp( qb, t ) {\n\n\t\tif ( t === 0 ) return this;\n\t\tif ( t === 1 ) return this.copy( qb );\n\n\t\tconst x = this._x, y = this._y, z = this._z, w = this._w;\n\n\t\t// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n\t\tlet cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\n\n\t\tif ( cosHalfTheta < 0 ) {\n\n\t\t\tthis._w = - qb._w;\n\t\t\tthis._x = - qb._x;\n\t\t\tthis._y = - qb._y;\n\t\t\tthis._z = - qb._z;\n\n\t\t\tcosHalfTheta = - cosHalfTheta;\n\n\t\t} else {\n\n\t\t\tthis.copy( qb );\n\n\t\t}\n\n\t\tif ( cosHalfTheta >= 1.0 ) {\n\n\t\t\tthis._w = w;\n\t\t\tthis._x = x;\n\t\t\tthis._y = y;\n\t\t\tthis._z = z;\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;\n\n\t\tif ( sqrSinHalfTheta <= Number.EPSILON ) {\n\n\t\t\tconst s = 1 - t;\n\t\t\tthis._w = s * w + t * this._w;\n\t\t\tthis._x = s * x + t * this._x;\n\t\t\tthis._y = s * y + t * this._y;\n\t\t\tthis._z = s * z + t * this._z;\n\n\t\t\tthis.normalize();\n\t\t\tthis._onChangeCallback();\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst sinHalfTheta = Math.sqrt( sqrSinHalfTheta );\n\t\tconst halfTheta = Math.atan2( sinHalfTheta, cosHalfTheta );\n\t\tconst ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n\t\t\tratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n\t\tthis._w = ( w * ratioA + this._w * ratioB );\n\t\tthis._x = ( x * ratioA + this._x * ratioB );\n\t\tthis._y = ( y * ratioA + this._y * ratioB );\n\t\tthis._z = ( z * ratioA + this._z * ratioB );\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tslerpQuaternions( qa, qb, t ) {\n\n\t\tthis.copy( qa ).slerp( qb, t );\n\n\t}\n\n\trandom() {\n\n\t\t// Derived from http://planning.cs.uiuc.edu/node198.html\n\t\t// Note, this source uses w, x, y, z ordering,\n\t\t// so we swap the order below.\n\n\t\tconst u1 = Math.random();\n\t\tconst sqrt1u1 = Math.sqrt( 1 - u1 );\n\t\tconst sqrtu1 = Math.sqrt( u1 );\n\n\t\tconst u2 = 2 * Math.PI * Math.random();\n\n\t\tconst u3 = 2 * Math.PI * Math.random();\n\n\t\treturn this.set(\n\t\t\tsqrt1u1 * Math.cos( u2 ),\n\t\t\tsqrtu1 * Math.sin( u3 ),\n\t\t\tsqrtu1 * Math.cos( u3 ),\n\t\t\tsqrt1u1 * Math.sin( u2 ),\n\t\t);\n\n\t}\n\n\tequals( quaternion ) {\n\n\t\treturn ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis._x = array[ offset ];\n\t\tthis._y = array[ offset + 1 ];\n\t\tthis._z = array[ offset + 2 ];\n\t\tthis._w = array[ offset + 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._w;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis._x = attribute.getX( index );\n\t\tthis._y = attribute.getY( index );\n\t\tthis._z = attribute.getZ( index );\n\t\tthis._w = attribute.getW( index );\n\n\t\treturn this;\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n}\n\nQuaternion.prototype.isQuaternion = true;\n\nclass Vector3 {\n\n\tconstructor( x = 0, y = 0, z = 0 ) {\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t}\n\n\tset( x, y, z ) {\n\n\t\tif ( z === undefined ) z = this.z; // sprite.scale.set(x,y)\n\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.x = scalar;\n\t\tthis.y = scalar;\n\t\tthis.z = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetX( x ) {\n\n\t\tthis.x = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( y ) {\n\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( z ) {\n\n\t\tthis.z = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponent( index, value ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: this.x = value; break;\n\t\t\tcase 1: this.y = value; break;\n\t\t\tcase 2: this.z = value; break;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetComponent( index ) {\n\n\t\tswitch ( index ) {\n\n\t\t\tcase 0: return this.x;\n\t\t\tcase 1: return this.y;\n\t\t\tcase 2: return this.z;\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.x, this.y, this.z );\n\n\t}\n\n\tcopy( v ) {\n\n\t\tthis.x = v.x;\n\t\tthis.y = v.y;\n\t\tthis.z = v.z;\n\n\t\treturn this;\n\n\t}\n\n\tadd( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );\n\t\t\treturn this.addVectors( v, w );\n\n\t\t}\n\n\t\tthis.x += v.x;\n\t\tthis.y += v.y;\n\t\tthis.z += v.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.x += s;\n\t\tthis.y += s;\n\t\tthis.z += s;\n\n\t\treturn this;\n\n\t}\n\n\taddVectors( a, b ) {\n\n\t\tthis.x = a.x + b.x;\n\t\tthis.y = a.y + b.y;\n\t\tthis.z = a.z + b.z;\n\n\t\treturn this;\n\n\t}\n\n\taddScaledVector( v, s ) {\n\n\t\tthis.x += v.x * s;\n\t\tthis.y += v.y * s;\n\t\tthis.z += v.z * s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );\n\t\t\treturn this.subVectors( v, w );\n\n\t\t}\n\n\t\tthis.x -= v.x;\n\t\tthis.y -= v.y;\n\t\tthis.z -= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tsubScalar( s ) {\n\n\t\tthis.x -= s;\n\t\tthis.y -= s;\n\t\tthis.z -= s;\n\n\t\treturn this;\n\n\t}\n\n\tsubVectors( a, b ) {\n\n\t\tthis.x = a.x - b.x;\n\t\tthis.y = a.y - b.y;\n\t\tthis.z = a.z - b.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' );\n\t\t\treturn this.multiplyVectors( v, w );\n\n\t\t}\n\n\t\tthis.x *= v.x;\n\t\tthis.y *= v.y;\n\t\tthis.z *= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( scalar ) {\n\n\t\tthis.x *= scalar;\n\t\tthis.y *= scalar;\n\t\tthis.z *= scalar;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyVectors( a, b ) {\n\n\t\tthis.x = a.x * b.x;\n\t\tthis.y = a.y * b.y;\n\t\tthis.z = a.z * b.z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyEuler( euler ) {\n\n\t\tif ( ! ( euler && euler.isEuler ) ) {\n\n\t\t\tconsole.error( 'THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.' );\n\n\t\t}\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromEuler( euler ) );\n\n\t}\n\n\tapplyAxisAngle( axis, angle ) {\n\n\t\treturn this.applyQuaternion( _quaternion$4.setFromAxisAngle( axis, angle ) );\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\treturn this.applyMatrix3( m ).normalize();\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tconst w = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] );\n\n\t\tthis.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * w;\n\t\tthis.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * w;\n\t\tthis.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * w;\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst qx = q.x, qy = q.y, qz = q.z, qw = q.w;\n\n\t\t// calculate quat * vector\n\n\t\tconst ix = qw * x + qy * z - qz * y;\n\t\tconst iy = qw * y + qz * x - qx * z;\n\t\tconst iz = qw * z + qx * y - qy * x;\n\t\tconst iw = - qx * x - qy * y - qz * z;\n\n\t\t// calculate result * inverse quat\n\n\t\tthis.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\n\t\tthis.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\n\t\tthis.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\n\n\t\treturn this;\n\n\t}\n\n\tproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );\n\n\t}\n\n\tunproject( camera ) {\n\n\t\treturn this.applyMatrix4( camera.projectionMatrixInverse ).applyMatrix4( camera.matrixWorld );\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\t// input: THREE.Matrix4 affine matrix\n\t\t// vector interpreted as a direction\n\n\t\tconst x = this.x, y = this.y, z = this.z;\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;\n\n\t\treturn this.normalize();\n\n\t}\n\n\tdivide( v ) {\n\n\t\tthis.x /= v.x;\n\t\tthis.y /= v.y;\n\t\tthis.z /= v.z;\n\n\t\treturn this;\n\n\t}\n\n\tdivideScalar( scalar ) {\n\n\t\treturn this.multiplyScalar( 1 / scalar );\n\n\t}\n\n\tmin( v ) {\n\n\t\tthis.x = Math.min( this.x, v.x );\n\t\tthis.y = Math.min( this.y, v.y );\n\t\tthis.z = Math.min( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tmax( v ) {\n\n\t\tthis.x = Math.max( this.x, v.x );\n\t\tthis.y = Math.max( this.y, v.y );\n\t\tthis.z = Math.max( this.z, v.z );\n\n\t\treturn this;\n\n\t}\n\n\tclamp( min, max ) {\n\n\t\t// assumes min < max, componentwise\n\n\t\tthis.x = Math.max( min.x, Math.min( max.x, this.x ) );\n\t\tthis.y = Math.max( min.y, Math.min( max.y, this.y ) );\n\t\tthis.z = Math.max( min.z, Math.min( max.z, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampScalar( minVal, maxVal ) {\n\n\t\tthis.x = Math.max( minVal, Math.min( maxVal, this.x ) );\n\t\tthis.y = Math.max( minVal, Math.min( maxVal, this.y ) );\n\t\tthis.z = Math.max( minVal, Math.min( maxVal, this.z ) );\n\n\t\treturn this;\n\n\t}\n\n\tclampLength( min, max ) {\n\n\t\tconst length = this.length();\n\n\t\treturn this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );\n\n\t}\n\n\tfloor() {\n\n\t\tthis.x = Math.floor( this.x );\n\t\tthis.y = Math.floor( this.y );\n\t\tthis.z = Math.floor( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tceil() {\n\n\t\tthis.x = Math.ceil( this.x );\n\t\tthis.y = Math.ceil( this.y );\n\t\tthis.z = Math.ceil( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tround() {\n\n\t\tthis.x = Math.round( this.x );\n\t\tthis.y = Math.round( this.y );\n\t\tthis.z = Math.round( this.z );\n\n\t\treturn this;\n\n\t}\n\n\troundToZero() {\n\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\n\t\tthis.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.x = - this.x;\n\t\tthis.y = - this.y;\n\t\tthis.z = - this.z;\n\n\t\treturn this;\n\n\t}\n\n\tdot( v ) {\n\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z;\n\n\t}\n\n\t// TODO lengthSquared?\n\n\tlengthSq() {\n\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\n\n\t}\n\n\tlength() {\n\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n\n\t}\n\n\tmanhattanLength() {\n\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );\n\n\t}\n\n\tnormalize() {\n\n\t\treturn this.divideScalar( this.length() || 1 );\n\n\t}\n\n\tsetLength( length ) {\n\n\t\treturn this.normalize().multiplyScalar( length );\n\n\t}\n\n\tlerp( v, alpha ) {\n\n\t\tthis.x += ( v.x - this.x ) * alpha;\n\t\tthis.y += ( v.y - this.y ) * alpha;\n\t\tthis.z += ( v.z - this.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpVectors( v1, v2, alpha ) {\n\n\t\tthis.x = v1.x + ( v2.x - v1.x ) * alpha;\n\t\tthis.y = v1.y + ( v2.y - v1.y ) * alpha;\n\t\tthis.z = v1.z + ( v2.z - v1.z ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tcross( v, w ) {\n\n\t\tif ( w !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.' );\n\t\t\treturn this.crossVectors( v, w );\n\n\t\t}\n\n\t\treturn this.crossVectors( this, v );\n\n\t}\n\n\tcrossVectors( a, b ) {\n\n\t\tconst ax = a.x, ay = a.y, az = a.z;\n\t\tconst bx = b.x, by = b.y, bz = b.z;\n\n\t\tthis.x = ay * bz - az * by;\n\t\tthis.y = az * bx - ax * bz;\n\t\tthis.z = ax * by - ay * bx;\n\n\t\treturn this;\n\n\t}\n\n\tprojectOnVector( v ) {\n\n\t\tconst denominator = v.lengthSq();\n\n\t\tif ( denominator === 0 ) return this.set( 0, 0, 0 );\n\n\t\tconst scalar = v.dot( this ) / denominator;\n\n\t\treturn this.copy( v ).multiplyScalar( scalar );\n\n\t}\n\n\tprojectOnPlane( planeNormal ) {\n\n\t\t_vector$c.copy( this ).projectOnVector( planeNormal );\n\n\t\treturn this.sub( _vector$c );\n\n\t}\n\n\treflect( normal ) {\n\n\t\t// reflect incident vector off plane orthogonal to normal\n\t\t// normal is assumed to have unit length\n\n\t\treturn this.sub( _vector$c.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );\n\n\t}\n\n\tangleTo( v ) {\n\n\t\tconst denominator = Math.sqrt( this.lengthSq() * v.lengthSq() );\n\n\t\tif ( denominator === 0 ) return Math.PI / 2;\n\n\t\tconst theta = this.dot( v ) / denominator;\n\n\t\t// clamp, to handle numerical problems\n\n\t\treturn Math.acos( clamp( theta, - 1, 1 ) );\n\n\t}\n\n\tdistanceTo( v ) {\n\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\n\n\t}\n\n\tdistanceToSquared( v ) {\n\n\t\tconst dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;\n\n\t\treturn dx * dx + dy * dy + dz * dz;\n\n\t}\n\n\tmanhattanDistanceTo( v ) {\n\n\t\treturn Math.abs( this.x - v.x ) + Math.abs( this.y - v.y ) + Math.abs( this.z - v.z );\n\n\t}\n\n\tsetFromSpherical( s ) {\n\n\t\treturn this.setFromSphericalCoords( s.radius, s.phi, s.theta );\n\n\t}\n\n\tsetFromSphericalCoords( radius, phi, theta ) {\n\n\t\tconst sinPhiRadius = Math.sin( phi ) * radius;\n\n\t\tthis.x = sinPhiRadius * Math.sin( theta );\n\t\tthis.y = Math.cos( phi ) * radius;\n\t\tthis.z = sinPhiRadius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCylindrical( c ) {\n\n\t\treturn this.setFromCylindricalCoords( c.radius, c.theta, c.y );\n\n\t}\n\n\tsetFromCylindricalCoords( radius, theta, y ) {\n\n\t\tthis.x = radius * Math.sin( theta );\n\t\tthis.y = y;\n\t\tthis.z = radius * Math.cos( theta );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixPosition( m ) {\n\n\t\tconst e = m.elements;\n\n\t\tthis.x = e[ 12 ];\n\t\tthis.y = e[ 13 ];\n\t\tthis.z = e[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixScale( m ) {\n\n\t\tconst sx = this.setFromMatrixColumn( m, 0 ).length();\n\t\tconst sy = this.setFromMatrixColumn( m, 1 ).length();\n\t\tconst sz = this.setFromMatrixColumn( m, 2 ).length();\n\n\t\tthis.x = sx;\n\t\tthis.y = sy;\n\t\tthis.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrixColumn( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 4 );\n\n\t}\n\n\tsetFromMatrix3Column( m, index ) {\n\n\t\treturn this.fromArray( m.elements, index * 3 );\n\n\t}\n\n\tequals( v ) {\n\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.x = array[ offset ];\n\t\tthis.y = array[ offset + 1 ];\n\t\tthis.z = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.x;\n\t\tarray[ offset + 1 ] = this.y;\n\t\tarray[ offset + 2 ] = this.z;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index, offset ) {\n\n\t\tif ( offset !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Vector3: offset has been removed from .fromBufferAttribute().' );\n\n\t\t}\n\n\t\tthis.x = attribute.getX( index );\n\t\tthis.y = attribute.getY( index );\n\t\tthis.z = attribute.getZ( index );\n\n\t\treturn this;\n\n\t}\n\n\trandom() {\n\n\t\tthis.x = Math.random();\n\t\tthis.y = Math.random();\n\t\tthis.z = Math.random();\n\n\t\treturn this;\n\n\t}\n\n\trandomDirection() {\n\n\t\t// Derived from https://mathworld.wolfram.com/SpherePointPicking.html\n\n\t\tconst u = ( Math.random() - 0.5 ) * 2;\n\t\tconst t = Math.random() * Math.PI * 2;\n\t\tconst f = Math.sqrt( 1 - u ** 2 );\n\n\t\tthis.x = f * Math.cos( t );\n\t\tthis.y = f * Math.sin( t );\n\t\tthis.z = u;\n\n\t\treturn this;\n\n\t}\n\n\t*[ Symbol.iterator ]() {\n\n\t\tyield this.x;\n\t\tyield this.y;\n\t\tyield this.z;\n\n\t}\n\n}\n\nVector3.prototype.isVector3 = true;\n\nconst _vector$c = /*@__PURE__*/ new Vector3();\nconst _quaternion$4 = /*@__PURE__*/ new Quaternion();\n\nclass Box3 {\n\n\tconstructor( min = new Vector3( + Infinity, + Infinity, + Infinity ), max = new Vector3( - Infinity, - Infinity, - Infinity ) ) {\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromArray( array ) {\n\n\t\tlet minX = + Infinity;\n\t\tlet minY = + Infinity;\n\t\tlet minZ = + Infinity;\n\n\t\tlet maxX = - Infinity;\n\t\tlet maxY = - Infinity;\n\t\tlet maxZ = - Infinity;\n\n\t\tfor ( let i = 0, l = array.length; i < l; i += 3 ) {\n\n\t\t\tconst x = array[ i ];\n\t\t\tconst y = array[ i + 1 ];\n\t\t\tconst z = array[ i + 2 ];\n\n\t\t\tif ( x < minX ) minX = x;\n\t\t\tif ( y < minY ) minY = y;\n\t\t\tif ( z < minZ ) minZ = z;\n\n\t\t\tif ( x > maxX ) maxX = x;\n\t\t\tif ( y > maxY ) maxY = y;\n\t\t\tif ( z > maxZ ) maxZ = z;\n\n\t\t}\n\n\t\tthis.min.set( minX, minY, minZ );\n\t\tthis.max.set( maxX, maxY, maxZ );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromBufferAttribute( attribute ) {\n\n\t\tlet minX = + Infinity;\n\t\tlet minY = + Infinity;\n\t\tlet minZ = + Infinity;\n\n\t\tlet maxX = - Infinity;\n\t\tlet maxY = - Infinity;\n\t\tlet maxZ = - Infinity;\n\n\t\tfor ( let i = 0, l = attribute.count; i < l; i ++ ) {\n\n\t\t\tconst x = attribute.getX( i );\n\t\t\tconst y = attribute.getY( i );\n\t\t\tconst z = attribute.getZ( i );\n\n\t\t\tif ( x < minX ) minX = x;\n\t\t\tif ( y < minY ) minY = y;\n\t\t\tif ( z < minZ ) minZ = z;\n\n\t\t\tif ( x > maxX ) maxX = x;\n\t\t\tif ( y > maxY ) maxY = y;\n\t\t\tif ( z > maxZ ) maxZ = z;\n\n\t\t}\n\n\t\tthis.min.set( minX, minY, minZ );\n\t\tthis.max.set( maxX, maxY, maxZ );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$b.copy( size ).multiplyScalar( 0.5 );\n\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromObject( object ) {\n\n\t\tthis.makeEmpty();\n\n\t\treturn this.expandByObject( object );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = this.min.z = + Infinity;\n\t\tthis.max.x = this.max.y = this.max.z = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\texpandByObject( object ) {\n\n\t\t// Computes the world-axis-aligned bounding box of an object (including its children),\n\t\t// accounting for both the object's, and children's, world transforms\n\n\t\tobject.updateWorldMatrix( false, false );\n\n\t\tconst geometry = object.geometry;\n\n\t\tif ( geometry !== undefined ) {\n\n\t\t\tif ( geometry.boundingBox === null ) {\n\n\t\t\t\tgeometry.computeBoundingBox();\n\n\t\t\t}\n\n\t\t\t_box$3.copy( geometry.boundingBox );\n\t\t\t_box$3.applyMatrix4( object.matrixWorld );\n\n\t\t\tthis.union( _box$3 );\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tthis.expandByObject( children[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ||\n\t\t\tpoint.z < this.min.z || point.z > this.max.z ? false : true;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y &&\n\t\t\tthis.min.z <= box.min.z && box.max.z <= this.max.z;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y ),\n\t\t\t( point.z - this.min.z ) / ( this.max.z - this.min.z )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 6 splitting planes to rule out intersections.\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ||\n\t\t\tbox.max.z < this.min.z || box.min.z > this.max.z ? false : true;\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\t// Find the point on the AABB closest to the sphere center.\n\t\tthis.clampPoint( sphere.center, _vector$b );\n\n\t\t// If that point is inside the sphere, the AABB and sphere intersect.\n\t\treturn _vector$b.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// We compute the minimum and maximum dot product values. If those values\n\t\t// are on the same side (back or front) of the plane, then there is no intersection.\n\n\t\tlet min, max;\n\n\t\tif ( plane.normal.x > 0 ) {\n\n\t\t\tmin = plane.normal.x * this.min.x;\n\t\t\tmax = plane.normal.x * this.max.x;\n\n\t\t} else {\n\n\t\t\tmin = plane.normal.x * this.max.x;\n\t\t\tmax = plane.normal.x * this.min.x;\n\n\t\t}\n\n\t\tif ( plane.normal.y > 0 ) {\n\n\t\t\tmin += plane.normal.y * this.min.y;\n\t\t\tmax += plane.normal.y * this.max.y;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.y * this.max.y;\n\t\t\tmax += plane.normal.y * this.min.y;\n\n\t\t}\n\n\t\tif ( plane.normal.z > 0 ) {\n\n\t\t\tmin += plane.normal.z * this.min.z;\n\t\t\tmax += plane.normal.z * this.max.z;\n\n\t\t} else {\n\n\t\t\tmin += plane.normal.z * this.max.z;\n\t\t\tmax += plane.normal.z * this.min.z;\n\n\t\t}\n\n\t\treturn ( min <= - plane.constant && max >= - plane.constant );\n\n\t}\n\n\tintersectsTriangle( triangle ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// compute box center and extents\n\t\tthis.getCenter( _center );\n\t\t_extents.subVectors( this.max, _center );\n\n\t\t// translate triangle to aabb origin\n\t\t_v0$2.subVectors( triangle.a, _center );\n\t\t_v1$7.subVectors( triangle.b, _center );\n\t\t_v2$3.subVectors( triangle.c, _center );\n\n\t\t// compute edge vectors for triangle\n\t\t_f0.subVectors( _v1$7, _v0$2 );\n\t\t_f1.subVectors( _v2$3, _v1$7 );\n\t\t_f2.subVectors( _v0$2, _v2$3 );\n\n\t\t// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\n\t\t// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\n\t\t// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\n\t\tlet axes = [\n\t\t\t0, - _f0.z, _f0.y, 0, - _f1.z, _f1.y, 0, - _f2.z, _f2.y,\n\t\t\t_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,\n\t\t\t- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0\n\t\t];\n\t\tif ( ! satForAxes( axes, _v0$2, _v1$7, _v2$3, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// test 3 face normals from the aabb\n\t\taxes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];\n\t\tif ( ! satForAxes( axes, _v0$2, _v1$7, _v2$3, _extents ) ) {\n\n\t\t\treturn false;\n\n\t\t}\n\n\t\t// finally testing the face normal of the triangle\n\t\t// use already existing triangle edge vectors here\n\t\t_triangleNormal.crossVectors( _f0, _f1 );\n\t\taxes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];\n\n\t\treturn satForAxes( axes, _v0$2, _v1$7, _v2$3, _extents );\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\tconst clampedPoint = _vector$b.copy( point ).clamp( this.min, this.max );\n\n\t\treturn clampedPoint.sub( point ).length();\n\n\t}\n\n\tgetBoundingSphere( target ) {\n\n\t\tthis.getCenter( target.center );\n\n\t\ttarget.radius = this.getSize( _vector$b ).length() * 0.5;\n\n\t\treturn target;\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\t// ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\n\t\tif ( this.isEmpty() ) this.makeEmpty();\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\t// transform of empty box is an empty box.\n\t\tif ( this.isEmpty() ) return this;\n\n\t\t// NOTE: I am using a binary pattern to specify all 2^3 combinations below\n\t\t_points[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000\n\t\t_points[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001\n\t\t_points[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010\n\t\t_points[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011\n\t\t_points[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100\n\t\t_points[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101\n\t\t_points[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110\n\t\t_points[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111\n\n\t\tthis.setFromPoints( _points );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nBox3.prototype.isBox3 = true;\n\nconst _points = [\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3(),\n\t/*@__PURE__*/ new Vector3()\n];\n\nconst _vector$b = /*@__PURE__*/ new Vector3();\n\nconst _box$3 = /*@__PURE__*/ new Box3();\n\n// triangle centered vertices\n\nconst _v0$2 = /*@__PURE__*/ new Vector3();\nconst _v1$7 = /*@__PURE__*/ new Vector3();\nconst _v2$3 = /*@__PURE__*/ new Vector3();\n\n// triangle edge vectors\n\nconst _f0 = /*@__PURE__*/ new Vector3();\nconst _f1 = /*@__PURE__*/ new Vector3();\nconst _f2 = /*@__PURE__*/ new Vector3();\n\nconst _center = /*@__PURE__*/ new Vector3();\nconst _extents = /*@__PURE__*/ new Vector3();\nconst _triangleNormal = /*@__PURE__*/ new Vector3();\nconst _testAxis = /*@__PURE__*/ new Vector3();\n\nfunction satForAxes( axes, v0, v1, v2, extents ) {\n\n\tfor ( let i = 0, j = axes.length - 3; i <= j; i += 3 ) {\n\n\t\t_testAxis.fromArray( axes, i );\n\t\t// project the aabb onto the seperating axis\n\t\tconst r = extents.x * Math.abs( _testAxis.x ) + extents.y * Math.abs( _testAxis.y ) + extents.z * Math.abs( _testAxis.z );\n\t\t// project all 3 vertices of the triangle onto the seperating axis\n\t\tconst p0 = v0.dot( _testAxis );\n\t\tconst p1 = v1.dot( _testAxis );\n\t\tconst p2 = v2.dot( _testAxis );\n\t\t// actual test, basically see if either of the most extreme of the triangle points intersects r\n\t\tif ( Math.max( - Math.max( p0, p1, p2 ), Math.min( p0, p1, p2 ) ) > r ) {\n\n\t\t\t// points of the projected triangle are outside the projected half-length of the aabb\n\t\t\t// the axis is seperating and we can exit\n\t\t\treturn false;\n\n\t\t}\n\n\t}\n\n\treturn true;\n\n}\n\nconst _box$2 = /*@__PURE__*/ new Box3();\nconst _v1$6 = /*@__PURE__*/ new Vector3();\nconst _toFarthestPoint = /*@__PURE__*/ new Vector3();\nconst _toPoint = /*@__PURE__*/ new Vector3();\n\nclass Sphere {\n\n\tconstructor( center = new Vector3(), radius = - 1 ) {\n\n\t\tthis.center = center;\n\t\tthis.radius = radius;\n\n\t}\n\n\tset( center, radius ) {\n\n\t\tthis.center.copy( center );\n\t\tthis.radius = radius;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points, optionalCenter ) {\n\n\t\tconst center = this.center;\n\n\t\tif ( optionalCenter !== undefined ) {\n\n\t\t\tcenter.copy( optionalCenter );\n\n\t\t} else {\n\n\t\t\t_box$2.setFromPoints( points ).getCenter( center );\n\n\t\t}\n\n\t\tlet maxRadiusSq = 0;\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );\n\n\t\t}\n\n\t\tthis.radius = Math.sqrt( maxRadiusSq );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( sphere ) {\n\n\t\tthis.center.copy( sphere.center );\n\t\tthis.radius = sphere.radius;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\treturn ( this.radius < 0 );\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.center.set( 0, 0, 0 );\n\t\tthis.radius = - 1;\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn ( point.distanceTo( this.center ) - this.radius );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst radiusSum = this.radius + sphere.radius;\n\n\t\treturn sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsSphere( this );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\treturn Math.abs( plane.distanceToPoint( this.center ) ) <= this.radius;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\tconst deltaLengthSq = this.center.distanceToSquared( point );\n\n\t\ttarget.copy( point );\n\n\t\tif ( deltaLengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\ttarget.sub( this.center ).normalize();\n\t\t\ttarget.multiplyScalar( this.radius ).add( this.center );\n\n\t\t}\n\n\t\treturn target;\n\n\t}\n\n\tgetBoundingBox( target ) {\n\n\t\tif ( this.isEmpty() ) {\n\n\t\t\t// Empty sphere produces empty bounding box\n\t\t\ttarget.makeEmpty();\n\t\t\treturn target;\n\n\t\t}\n\n\t\ttarget.set( this.center, this.center );\n\t\ttarget.expandByScalar( this.radius );\n\n\t\treturn target;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.center.applyMatrix4( matrix );\n\t\tthis.radius = this.radius * matrix.getMaxScaleOnAxis();\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.center.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\t// from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L649-L671\n\n\t\t_toPoint.subVectors( point, this.center );\n\n\t\tconst lengthSq = _toPoint.lengthSq();\n\n\t\tif ( lengthSq > ( this.radius * this.radius ) ) {\n\n\t\t\tconst length = Math.sqrt( lengthSq );\n\t\t\tconst missingRadiusHalf = ( length - this.radius ) * 0.5;\n\n\t\t\t// Nudge this sphere towards the target point. Add half the missing distance to radius,\n\t\t\t// and the other half to position. This gives a tighter enclosure, instead of if\n\t\t\t// the whole missing distance were just added to radius.\n\n\t\t\tthis.center.add( _toPoint.multiplyScalar( missingRadiusHalf / length ) );\n\t\t\tthis.radius += missingRadiusHalf;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tunion( sphere ) {\n\n\t\t// from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L759-L769\n\n\t\t// To enclose another sphere into this sphere, we only need to enclose two points:\n\t\t// 1) Enclose the farthest point on the other sphere into this sphere.\n\t\t// 2) Enclose the opposite point of the farthest point into this sphere.\n\n\t\t_toFarthestPoint.subVectors( sphere.center, this.center ).normalize().multiplyScalar( sphere.radius );\n\n\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).add( _toFarthestPoint ) );\n\t\tthis.expandByPoint( _v1$6.copy( sphere.center ).sub( _toFarthestPoint ) );\n\n\t\treturn this;\n\n\t}\n\n\tequals( sphere ) {\n\n\t\treturn sphere.center.equals( this.center ) && ( sphere.radius === this.radius );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$a = /*@__PURE__*/ new Vector3();\nconst _segCenter = /*@__PURE__*/ new Vector3();\nconst _segDir = /*@__PURE__*/ new Vector3();\nconst _diff = /*@__PURE__*/ new Vector3();\n\nconst _edge1 = /*@__PURE__*/ new Vector3();\nconst _edge2 = /*@__PURE__*/ new Vector3();\nconst _normal$1 = /*@__PURE__*/ new Vector3();\n\nclass Ray {\n\n\tconstructor( origin = new Vector3(), direction = new Vector3( 0, 0, - 1 ) ) {\n\n\t\tthis.origin = origin;\n\t\tthis.direction = direction;\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\tthis.origin.copy( origin );\n\t\tthis.direction.copy( direction );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( ray ) {\n\n\t\tthis.origin.copy( ray.origin );\n\t\tthis.direction.copy( ray.direction );\n\n\t\treturn this;\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn target.copy( this.direction ).multiplyScalar( t ).add( this.origin );\n\n\t}\n\n\tlookAt( v ) {\n\n\t\tthis.direction.copy( v ).sub( this.origin ).normalize();\n\n\t\treturn this;\n\n\t}\n\n\trecast( t ) {\n\n\t\tthis.origin.copy( this.at( t, _vector$a ) );\n\n\t\treturn this;\n\n\t}\n\n\tclosestPointToPoint( point, target ) {\n\n\t\ttarget.subVectors( point, this.origin );\n\n\t\tconst directionDistance = target.dot( this.direction );\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn target.copy( this.origin );\n\n\t\t}\n\n\t\treturn target.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn Math.sqrt( this.distanceSqToPoint( point ) );\n\n\t}\n\n\tdistanceSqToPoint( point ) {\n\n\t\tconst directionDistance = _vector$a.subVectors( point, this.origin ).dot( this.direction );\n\n\t\t// point behind the ray\n\n\t\tif ( directionDistance < 0 ) {\n\n\t\t\treturn this.origin.distanceToSquared( point );\n\n\t\t}\n\n\t\t_vector$a.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin );\n\n\t\treturn _vector$a.distanceToSquared( point );\n\n\t}\n\n\tdistanceSqToSegment( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {\n\n\t\t// from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteDistRaySegment.h\n\t\t// It returns the min distance between the ray and the segment\n\t\t// defined by v0 and v1\n\t\t// It can also set two optional targets :\n\t\t// - The closest point on the ray\n\t\t// - The closest point on the segment\n\n\t\t_segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );\n\t\t_segDir.copy( v1 ).sub( v0 ).normalize();\n\t\t_diff.copy( this.origin ).sub( _segCenter );\n\n\t\tconst segExtent = v0.distanceTo( v1 ) * 0.5;\n\t\tconst a01 = - this.direction.dot( _segDir );\n\t\tconst b0 = _diff.dot( this.direction );\n\t\tconst b1 = - _diff.dot( _segDir );\n\t\tconst c = _diff.lengthSq();\n\t\tconst det = Math.abs( 1 - a01 * a01 );\n\t\tlet s0, s1, sqrDist, extDet;\n\n\t\tif ( det > 0 ) {\n\n\t\t\t// The ray and segment are not parallel.\n\n\t\t\ts0 = a01 * b1 - b0;\n\t\t\ts1 = a01 * b0 - b1;\n\t\t\textDet = segExtent * det;\n\n\t\t\tif ( s0 >= 0 ) {\n\n\t\t\t\tif ( s1 >= - extDet ) {\n\n\t\t\t\t\tif ( s1 <= extDet ) {\n\n\t\t\t\t\t\t// region 0\n\t\t\t\t\t\t// Minimum at interior points of ray and segment.\n\n\t\t\t\t\t\tconst invDet = 1 / det;\n\t\t\t\t\t\ts0 *= invDet;\n\t\t\t\t\t\ts1 *= invDet;\n\t\t\t\t\t\tsqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// region 1\n\n\t\t\t\t\t\ts1 = segExtent;\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 5\n\n\t\t\t\t\ts1 = - segExtent;\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( s1 <= - extDet ) {\n\n\t\t\t\t\t// region 4\n\n\t\t\t\t\ts0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else if ( s1 <= extDet ) {\n\n\t\t\t\t\t// region 3\n\n\t\t\t\t\ts0 = 0;\n\t\t\t\t\ts1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// region 2\n\n\t\t\t\t\ts0 = Math.max( 0, - ( a01 * segExtent + b0 ) );\n\t\t\t\t\ts1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\n\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// Ray and segment are parallel.\n\n\t\t\ts1 = ( a01 > 0 ) ? - segExtent : segExtent;\n\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\n\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\n\n\t\t}\n\n\t\tif ( optionalPointOnRay ) {\n\n\t\t\toptionalPointOnRay.copy( this.direction ).multiplyScalar( s0 ).add( this.origin );\n\n\t\t}\n\n\t\tif ( optionalPointOnSegment ) {\n\n\t\t\toptionalPointOnSegment.copy( _segDir ).multiplyScalar( s1 ).add( _segCenter );\n\n\t\t}\n\n\t\treturn sqrDist;\n\n\t}\n\n\tintersectSphere( sphere, target ) {\n\n\t\t_vector$a.subVectors( sphere.center, this.origin );\n\t\tconst tca = _vector$a.dot( this.direction );\n\t\tconst d2 = _vector$a.dot( _vector$a ) - tca * tca;\n\t\tconst radius2 = sphere.radius * sphere.radius;\n\n\t\tif ( d2 > radius2 ) return null;\n\n\t\tconst thc = Math.sqrt( radius2 - d2 );\n\n\t\t// t0 = first intersect point - entrance on front of sphere\n\t\tconst t0 = tca - thc;\n\n\t\t// t1 = second intersect point - exit point on back of sphere\n\t\tconst t1 = tca + thc;\n\n\t\t// test to see if both t0 and t1 are behind the ray - if so, return null\n\t\tif ( t0 < 0 && t1 < 0 ) return null;\n\n\t\t// test to see if t0 is behind the ray:\n\t\t// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\n\t\t// in order to always return an intersect point that is in front of the ray.\n\t\tif ( t0 < 0 ) return this.at( t1, target );\n\n\t\t// else t0 is in front of the ray, so return the first collision point scaled by t0\n\t\treturn this.at( t0, target );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn this.distanceSqToPoint( sphere.center ) <= ( sphere.radius * sphere.radius );\n\n\t}\n\n\tdistanceToPlane( plane ) {\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( plane.distanceToPoint( this.origin ) === 0 ) {\n\n\t\t\t\treturn 0;\n\n\t\t\t}\n\n\t\t\t// Null is preferable to undefined since undefined means.... it is undefined\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;\n\n\t\t// Return if the ray never intersects the plane\n\n\t\treturn t >= 0 ? t : null;\n\n\t}\n\n\tintersectPlane( plane, target ) {\n\n\t\tconst t = this.distanceToPlane( plane );\n\n\t\tif ( t === null ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn this.at( t, target );\n\n\t}\n\n\tintersectsPlane( plane ) {\n\n\t\t// check if the ray lies on the plane first\n\n\t\tconst distToPoint = plane.distanceToPoint( this.origin );\n\n\t\tif ( distToPoint === 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\tconst denominator = plane.normal.dot( this.direction );\n\n\t\tif ( denominator * distToPoint < 0 ) {\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\t// ray origin is behind the plane (and is pointing behind it)\n\n\t\treturn false;\n\n\t}\n\n\tintersectBox( box, target ) {\n\n\t\tlet tmin, tmax, tymin, tymax, tzmin, tzmax;\n\n\t\tconst invdirx = 1 / this.direction.x,\n\t\t\tinvdiry = 1 / this.direction.y,\n\t\t\tinvdirz = 1 / this.direction.z;\n\n\t\tconst origin = this.origin;\n\n\t\tif ( invdirx >= 0 ) {\n\n\t\t\ttmin = ( box.min.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.max.x - origin.x ) * invdirx;\n\n\t\t} else {\n\n\t\t\ttmin = ( box.max.x - origin.x ) * invdirx;\n\t\t\ttmax = ( box.min.x - origin.x ) * invdirx;\n\n\t\t}\n\n\t\tif ( invdiry >= 0 ) {\n\n\t\t\ttymin = ( box.min.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.max.y - origin.y ) * invdiry;\n\n\t\t} else {\n\n\t\t\ttymin = ( box.max.y - origin.y ) * invdiry;\n\t\t\ttymax = ( box.min.y - origin.y ) * invdiry;\n\n\t\t}\n\n\t\tif ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;\n\n\t\t// These lines also handle the case where tmin or tmax is NaN\n\t\t// (result of 0 * Infinity). x !== x returns true if x is NaN\n\n\t\tif ( tymin > tmin || tmin !== tmin ) tmin = tymin;\n\n\t\tif ( tymax < tmax || tmax !== tmax ) tmax = tymax;\n\n\t\tif ( invdirz >= 0 ) {\n\n\t\t\ttzmin = ( box.min.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.max.z - origin.z ) * invdirz;\n\n\t\t} else {\n\n\t\t\ttzmin = ( box.max.z - origin.z ) * invdirz;\n\t\t\ttzmax = ( box.min.z - origin.z ) * invdirz;\n\n\t\t}\n\n\t\tif ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;\n\n\t\tif ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;\n\n\t\tif ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;\n\n\t\t//return point closest to the ray (positive side)\n\n\t\tif ( tmax < 0 ) return null;\n\n\t\treturn this.at( tmin >= 0 ? tmin : tmax, target );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn this.intersectBox( box, _vector$a ) !== null;\n\n\t}\n\n\tintersectTriangle( a, b, c, backfaceCulling, target ) {\n\n\t\t// Compute the offset origin, edges, and normal.\n\n\t\t// from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\n\n\t\t_edge1.subVectors( b, a );\n\t\t_edge2.subVectors( c, a );\n\t\t_normal$1.crossVectors( _edge1, _edge2 );\n\n\t\t// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\n\t\t// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\n\t\t// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\n\t\t// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\n\t\t// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\n\t\tlet DdN = this.direction.dot( _normal$1 );\n\t\tlet sign;\n\n\t\tif ( DdN > 0 ) {\n\n\t\t\tif ( backfaceCulling ) return null;\n\t\t\tsign = 1;\n\n\t\t} else if ( DdN < 0 ) {\n\n\t\t\tsign = - 1;\n\t\t\tDdN = - DdN;\n\n\t\t} else {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t_diff.subVectors( this.origin, a );\n\t\tconst DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );\n\n\t\t// b1 < 0, no intersection\n\t\tif ( DdQxE2 < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );\n\n\t\t// b2 < 0, no intersection\n\t\tif ( DdE1xQ < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// b1+b2 > 1, no intersection\n\t\tif ( DdQxE2 + DdE1xQ > DdN ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Line intersects triangle, check if ray does.\n\t\tconst QdN = - sign * _diff.dot( _normal$1 );\n\n\t\t// t < 0, no intersection\n\t\tif ( QdN < 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\t// Ray intersects triangle.\n\t\treturn this.at( QdN / DdN, target );\n\n\t}\n\n\tapplyMatrix4( matrix4 ) {\n\n\t\tthis.origin.applyMatrix4( matrix4 );\n\t\tthis.direction.transformDirection( matrix4 );\n\n\t\treturn this;\n\n\t}\n\n\tequals( ray ) {\n\n\t\treturn ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nclass Matrix4 {\n\n\tconstructor() {\n\n\t\tthis.elements = [\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t];\n\n\t\tif ( arguments.length > 0 ) {\n\n\t\t\tconsole.error( 'THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.' );\n\n\t\t}\n\n\t}\n\n\tset( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;\n\t\tte[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;\n\t\tte[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;\n\t\tte[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;\n\n\t\treturn this;\n\n\t}\n\n\tidentity() {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, 1, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Matrix4().fromArray( this.elements );\n\n\t}\n\n\tcopy( m ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tte[ 0 ] = me[ 0 ]; te[ 1 ] = me[ 1 ]; te[ 2 ] = me[ 2 ]; te[ 3 ] = me[ 3 ];\n\t\tte[ 4 ] = me[ 4 ]; te[ 5 ] = me[ 5 ]; te[ 6 ] = me[ 6 ]; te[ 7 ] = me[ 7 ];\n\t\tte[ 8 ] = me[ 8 ]; te[ 9 ] = me[ 9 ]; te[ 10 ] = me[ 10 ]; te[ 11 ] = me[ 11 ];\n\t\tte[ 12 ] = me[ 12 ]; te[ 13 ] = me[ 13 ]; te[ 14 ] = me[ 14 ]; te[ 15 ] = me[ 15 ];\n\n\t\treturn this;\n\n\t}\n\n\tcopyPosition( m ) {\n\n\t\tconst te = this.elements, me = m.elements;\n\n\t\tte[ 12 ] = me[ 12 ];\n\t\tte[ 13 ] = me[ 13 ];\n\t\tte[ 14 ] = me[ 14 ];\n\n\t\treturn this;\n\n\t}\n\n\tsetFromMatrix3( m ) {\n\n\t\tconst me = m.elements;\n\n\t\tthis.set(\n\n\t\t\tme[ 0 ], me[ 3 ], me[ 6 ], 0,\n\t\t\tme[ 1 ], me[ 4 ], me[ 7 ], 0,\n\t\t\tme[ 2 ], me[ 5 ], me[ 8 ], 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractBasis( xAxis, yAxis, zAxis ) {\n\n\t\txAxis.setFromMatrixColumn( this, 0 );\n\t\tyAxis.setFromMatrixColumn( this, 1 );\n\t\tzAxis.setFromMatrixColumn( this, 2 );\n\n\t\treturn this;\n\n\t}\n\n\tmakeBasis( xAxis, yAxis, zAxis ) {\n\n\t\tthis.set(\n\t\t\txAxis.x, yAxis.x, zAxis.x, 0,\n\t\t\txAxis.y, yAxis.y, zAxis.y, 0,\n\t\t\txAxis.z, yAxis.z, zAxis.z, 0,\n\t\t\t0, 0, 0, 1\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\textractRotation( m ) {\n\n\t\t// this method does not support reflection matrices\n\n\t\tconst te = this.elements;\n\t\tconst me = m.elements;\n\n\t\tconst scaleX = 1 / _v1$5.setFromMatrixColumn( m, 0 ).length();\n\t\tconst scaleY = 1 / _v1$5.setFromMatrixColumn( m, 1 ).length();\n\t\tconst scaleZ = 1 / _v1$5.setFromMatrixColumn( m, 2 ).length();\n\n\t\tte[ 0 ] = me[ 0 ] * scaleX;\n\t\tte[ 1 ] = me[ 1 ] * scaleX;\n\t\tte[ 2 ] = me[ 2 ] * scaleX;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = me[ 4 ] * scaleY;\n\t\tte[ 5 ] = me[ 5 ] * scaleY;\n\t\tte[ 6 ] = me[ 6 ] * scaleY;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = me[ 8 ] * scaleZ;\n\t\tte[ 9 ] = me[ 9 ] * scaleZ;\n\t\tte[ 10 ] = me[ 10 ] * scaleZ;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromEuler( euler ) {\n\n\t\tif ( ! ( euler && euler.isEuler ) ) {\n\n\t\t\tconsole.error( 'THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.' );\n\n\t\t}\n\n\t\tconst te = this.elements;\n\n\t\tconst x = euler.x, y = euler.y, z = euler.z;\n\t\tconst a = Math.cos( x ), b = Math.sin( x );\n\t\tconst c = Math.cos( y ), d = Math.sin( y );\n\t\tconst e = Math.cos( z ), f = Math.sin( z );\n\n\t\tif ( euler.order === 'XYZ' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - c * f;\n\t\t\tte[ 8 ] = d;\n\n\t\t\tte[ 1 ] = af + be * d;\n\t\t\tte[ 5 ] = ae - bf * d;\n\t\t\tte[ 9 ] = - b * c;\n\n\t\t\tte[ 2 ] = bf - ae * d;\n\t\t\tte[ 6 ] = be + af * d;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YXZ' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce + df * b;\n\t\t\tte[ 4 ] = de * b - cf;\n\t\t\tte[ 8 ] = a * d;\n\n\t\t\tte[ 1 ] = a * f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b;\n\n\t\t\tte[ 2 ] = cf * b - de;\n\t\t\tte[ 6 ] = df + ce * b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZXY' ) {\n\n\t\t\tconst ce = c * e, cf = c * f, de = d * e, df = d * f;\n\n\t\t\tte[ 0 ] = ce - df * b;\n\t\t\tte[ 4 ] = - a * f;\n\t\t\tte[ 8 ] = de + cf * b;\n\n\t\t\tte[ 1 ] = cf + de * b;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = df - ce * b;\n\n\t\t\tte[ 2 ] = - a * d;\n\t\t\tte[ 6 ] = b;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'ZYX' ) {\n\n\t\t\tconst ae = a * e, af = a * f, be = b * e, bf = b * f;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = be * d - af;\n\t\t\tte[ 8 ] = ae * d + bf;\n\n\t\t\tte[ 1 ] = c * f;\n\t\t\tte[ 5 ] = bf * d + ae;\n\t\t\tte[ 9 ] = af * d - be;\n\n\t\t\tte[ 2 ] = - d;\n\t\t\tte[ 6 ] = b * c;\n\t\t\tte[ 10 ] = a * c;\n\n\t\t} else if ( euler.order === 'YZX' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = bd - ac * f;\n\t\t\tte[ 8 ] = bc * f + ad;\n\n\t\t\tte[ 1 ] = f;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = - b * e;\n\n\t\t\tte[ 2 ] = - d * e;\n\t\t\tte[ 6 ] = ad * f + bc;\n\t\t\tte[ 10 ] = ac - bd * f;\n\n\t\t} else if ( euler.order === 'XZY' ) {\n\n\t\t\tconst ac = a * c, ad = a * d, bc = b * c, bd = b * d;\n\n\t\t\tte[ 0 ] = c * e;\n\t\t\tte[ 4 ] = - f;\n\t\t\tte[ 8 ] = d * e;\n\n\t\t\tte[ 1 ] = ac * f + bd;\n\t\t\tte[ 5 ] = a * e;\n\t\t\tte[ 9 ] = ad * f - bc;\n\n\t\t\tte[ 2 ] = bc * f - ad;\n\t\t\tte[ 6 ] = b * e;\n\t\t\tte[ 10 ] = bd * f + ac;\n\n\t\t}\n\n\t\t// bottom row\n\t\tte[ 3 ] = 0;\n\t\tte[ 7 ] = 0;\n\t\tte[ 11 ] = 0;\n\n\t\t// last column\n\t\tte[ 12 ] = 0;\n\t\tte[ 13 ] = 0;\n\t\tte[ 14 ] = 0;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationFromQuaternion( q ) {\n\n\t\treturn this.compose( _zero, q, _one );\n\n\t}\n\n\tlookAt( eye, target, up ) {\n\n\t\tconst te = this.elements;\n\n\t\t_z.subVectors( eye, target );\n\n\t\tif ( _z.lengthSq() === 0 ) {\n\n\t\t\t// eye and target are in the same position\n\n\t\t\t_z.z = 1;\n\n\t\t}\n\n\t\t_z.normalize();\n\t\t_x.crossVectors( up, _z );\n\n\t\tif ( _x.lengthSq() === 0 ) {\n\n\t\t\t// up and z are parallel\n\n\t\t\tif ( Math.abs( up.z ) === 1 ) {\n\n\t\t\t\t_z.x += 0.0001;\n\n\t\t\t} else {\n\n\t\t\t\t_z.z += 0.0001;\n\n\t\t\t}\n\n\t\t\t_z.normalize();\n\t\t\t_x.crossVectors( up, _z );\n\n\t\t}\n\n\t\t_x.normalize();\n\t\t_y.crossVectors( _z, _x );\n\n\t\tte[ 0 ] = _x.x; te[ 4 ] = _y.x; te[ 8 ] = _z.x;\n\t\tte[ 1 ] = _x.y; te[ 5 ] = _y.y; te[ 9 ] = _z.y;\n\t\tte[ 2 ] = _x.z; te[ 6 ] = _y.z; te[ 10 ] = _z.z;\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( m, n ) {\n\n\t\tif ( n !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.' );\n\t\t\treturn this.multiplyMatrices( m, n );\n\n\t\t}\n\n\t\treturn this.multiplyMatrices( this, m );\n\n\t}\n\n\tpremultiply( m ) {\n\n\t\treturn this.multiplyMatrices( m, this );\n\n\t}\n\n\tmultiplyMatrices( a, b ) {\n\n\t\tconst ae = a.elements;\n\t\tconst be = b.elements;\n\t\tconst te = this.elements;\n\n\t\tconst a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];\n\t\tconst a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];\n\t\tconst a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];\n\t\tconst a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];\n\n\t\tconst b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];\n\t\tconst b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];\n\t\tconst b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];\n\t\tconst b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];\n\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\n\t\tte[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\n\t\tte[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\n\t\tte[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\n\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\n\t\tte[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\n\t\tte[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\n\t\tte[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\n\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\n\t\tte[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\n\t\tte[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\n\t\tte[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\n\n\t\tte[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\n\t\tte[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\n\t\tte[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\n\t\tte[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tconst te = this.elements;\n\n\t\tte[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;\n\t\tte[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;\n\t\tte[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;\n\t\tte[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;\n\n\t\treturn this;\n\n\t}\n\n\tdeterminant() {\n\n\t\tconst te = this.elements;\n\n\t\tconst n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];\n\t\tconst n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];\n\t\tconst n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];\n\t\tconst n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];\n\n\t\t//TODO: make this more efficient\n\t\t//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\n\n\t\treturn (\n\t\t\tn41 * (\n\t\t\t\t+ n14 * n23 * n32\n\t\t\t\t - n13 * n24 * n32\n\t\t\t\t - n14 * n22 * n33\n\t\t\t\t + n12 * n24 * n33\n\t\t\t\t + n13 * n22 * n34\n\t\t\t\t - n12 * n23 * n34\n\t\t\t) +\n\t\t\tn42 * (\n\t\t\t\t+ n11 * n23 * n34\n\t\t\t\t - n11 * n24 * n33\n\t\t\t\t + n14 * n21 * n33\n\t\t\t\t - n13 * n21 * n34\n\t\t\t\t + n13 * n24 * n31\n\t\t\t\t - n14 * n23 * n31\n\t\t\t) +\n\t\t\tn43 * (\n\t\t\t\t+ n11 * n24 * n32\n\t\t\t\t - n11 * n22 * n34\n\t\t\t\t - n14 * n21 * n32\n\t\t\t\t + n12 * n21 * n34\n\t\t\t\t + n14 * n22 * n31\n\t\t\t\t - n12 * n24 * n31\n\t\t\t) +\n\t\t\tn44 * (\n\t\t\t\t- n13 * n22 * n31\n\t\t\t\t - n11 * n23 * n32\n\t\t\t\t + n11 * n22 * n33\n\t\t\t\t + n13 * n21 * n32\n\t\t\t\t - n12 * n21 * n33\n\t\t\t\t + n12 * n23 * n31\n\t\t\t)\n\n\t\t);\n\n\t}\n\n\ttranspose() {\n\n\t\tconst te = this.elements;\n\t\tlet tmp;\n\n\t\ttmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;\n\t\ttmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;\n\t\ttmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;\n\n\t\ttmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;\n\t\ttmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;\n\t\ttmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;\n\n\t\treturn this;\n\n\t}\n\n\tsetPosition( x, y, z ) {\n\n\t\tconst te = this.elements;\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\tte[ 12 ] = x.x;\n\t\t\tte[ 13 ] = x.y;\n\t\t\tte[ 14 ] = x.z;\n\n\t\t} else {\n\n\t\t\tte[ 12 ] = x;\n\t\t\tte[ 13 ] = y;\n\t\t\tte[ 14 ] = z;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tinvert() {\n\n\t\t// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\n\t\tconst te = this.elements,\n\n\t\t\tn11 = te[ 0 ], n21 = te[ 1 ], n31 = te[ 2 ], n41 = te[ 3 ],\n\t\t\tn12 = te[ 4 ], n22 = te[ 5 ], n32 = te[ 6 ], n42 = te[ 7 ],\n\t\t\tn13 = te[ 8 ], n23 = te[ 9 ], n33 = te[ 10 ], n43 = te[ 11 ],\n\t\t\tn14 = te[ 12 ], n24 = te[ 13 ], n34 = te[ 14 ], n44 = te[ 15 ],\n\n\t\t\tt11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,\n\t\t\tt12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,\n\t\t\tt13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,\n\t\t\tt14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\n\n\t\tconst det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;\n\n\t\tif ( det === 0 ) return this.set( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );\n\n\t\tconst detInv = 1 / det;\n\n\t\tte[ 0 ] = t11 * detInv;\n\t\tte[ 1 ] = ( n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44 ) * detInv;\n\t\tte[ 2 ] = ( n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44 ) * detInv;\n\t\tte[ 3 ] = ( n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43 ) * detInv;\n\n\t\tte[ 4 ] = t12 * detInv;\n\t\tte[ 5 ] = ( n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44 ) * detInv;\n\t\tte[ 6 ] = ( n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44 ) * detInv;\n\t\tte[ 7 ] = ( n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43 ) * detInv;\n\n\t\tte[ 8 ] = t13 * detInv;\n\t\tte[ 9 ] = ( n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44 ) * detInv;\n\t\tte[ 10 ] = ( n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44 ) * detInv;\n\t\tte[ 11 ] = ( n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43 ) * detInv;\n\n\t\tte[ 12 ] = t14 * detInv;\n\t\tte[ 13 ] = ( n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34 ) * detInv;\n\t\tte[ 14 ] = ( n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34 ) * detInv;\n\t\tte[ 15 ] = ( n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33 ) * detInv;\n\n\t\treturn this;\n\n\t}\n\n\tscale( v ) {\n\n\t\tconst te = this.elements;\n\t\tconst x = v.x, y = v.y, z = v.z;\n\n\t\tte[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;\n\t\tte[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;\n\t\tte[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;\n\t\tte[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxScaleOnAxis() {\n\n\t\tconst te = this.elements;\n\n\t\tconst scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];\n\t\tconst scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];\n\t\tconst scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];\n\n\t\treturn Math.sqrt( Math.max( scaleXSq, scaleYSq, scaleZSq ) );\n\n\t}\n\n\tmakeTranslation( x, y, z ) {\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, x,\n\t\t\t0, 1, 0, y,\n\t\t\t0, 0, 1, z,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationX( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t1, 0, 0, 0,\n\t\t\t0, c, - s, 0,\n\t\t\t0, s, c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationY( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\t c, 0, s, 0,\n\t\t\t 0, 1, 0, 0,\n\t\t\t- s, 0, c, 0,\n\t\t\t 0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationZ( theta ) {\n\n\t\tconst c = Math.cos( theta ), s = Math.sin( theta );\n\n\t\tthis.set(\n\n\t\t\tc, - s, 0, 0,\n\t\t\ts, c, 0, 0,\n\t\t\t0, 0, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeRotationAxis( axis, angle ) {\n\n\t\t// Based on http://www.gamedev.net/reference/articles/article1199.asp\n\n\t\tconst c = Math.cos( angle );\n\t\tconst s = Math.sin( angle );\n\t\tconst t = 1 - c;\n\t\tconst x = axis.x, y = axis.y, z = axis.z;\n\t\tconst tx = t * x, ty = t * y;\n\n\t\tthis.set(\n\n\t\t\ttx * x + c, tx * y - s * z, tx * z + s * y, 0,\n\t\t\ttx * y + s * z, ty * y + c, ty * z - s * x, 0,\n\t\t\ttx * z - s * y, ty * z + s * x, t * z * z + c, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeScale( x, y, z ) {\n\n\t\tthis.set(\n\n\t\t\tx, 0, 0, 0,\n\t\t\t0, y, 0, 0,\n\t\t\t0, 0, z, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tmakeShear( xy, xz, yx, yz, zx, zy ) {\n\n\t\tthis.set(\n\n\t\t\t1, yx, zx, 0,\n\t\t\txy, 1, zy, 0,\n\t\t\txz, yz, 1, 0,\n\t\t\t0, 0, 0, 1\n\n\t\t);\n\n\t\treturn this;\n\n\t}\n\n\tcompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tconst x = quaternion._x, y = quaternion._y, z = quaternion._z, w = quaternion._w;\n\t\tconst x2 = x + x,\ty2 = y + y, z2 = z + z;\n\t\tconst xx = x * x2, xy = x * y2, xz = x * z2;\n\t\tconst yy = y * y2, yz = y * z2, zz = z * z2;\n\t\tconst wx = w * x2, wy = w * y2, wz = w * z2;\n\n\t\tconst sx = scale.x, sy = scale.y, sz = scale.z;\n\n\t\tte[ 0 ] = ( 1 - ( yy + zz ) ) * sx;\n\t\tte[ 1 ] = ( xy + wz ) * sx;\n\t\tte[ 2 ] = ( xz - wy ) * sx;\n\t\tte[ 3 ] = 0;\n\n\t\tte[ 4 ] = ( xy - wz ) * sy;\n\t\tte[ 5 ] = ( 1 - ( xx + zz ) ) * sy;\n\t\tte[ 6 ] = ( yz + wx ) * sy;\n\t\tte[ 7 ] = 0;\n\n\t\tte[ 8 ] = ( xz + wy ) * sz;\n\t\tte[ 9 ] = ( yz - wx ) * sz;\n\t\tte[ 10 ] = ( 1 - ( xx + yy ) ) * sz;\n\t\tte[ 11 ] = 0;\n\n\t\tte[ 12 ] = position.x;\n\t\tte[ 13 ] = position.y;\n\t\tte[ 14 ] = position.z;\n\t\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tdecompose( position, quaternion, scale ) {\n\n\t\tconst te = this.elements;\n\n\t\tlet sx = _v1$5.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();\n\t\tconst sy = _v1$5.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();\n\t\tconst sz = _v1$5.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();\n\n\t\t// if determine is negative, we need to invert one scale\n\t\tconst det = this.determinant();\n\t\tif ( det < 0 ) sx = - sx;\n\n\t\tposition.x = te[ 12 ];\n\t\tposition.y = te[ 13 ];\n\t\tposition.z = te[ 14 ];\n\n\t\t// scale the rotation part\n\t\t_m1$2.copy( this );\n\n\t\tconst invSX = 1 / sx;\n\t\tconst invSY = 1 / sy;\n\t\tconst invSZ = 1 / sz;\n\n\t\t_m1$2.elements[ 0 ] *= invSX;\n\t\t_m1$2.elements[ 1 ] *= invSX;\n\t\t_m1$2.elements[ 2 ] *= invSX;\n\n\t\t_m1$2.elements[ 4 ] *= invSY;\n\t\t_m1$2.elements[ 5 ] *= invSY;\n\t\t_m1$2.elements[ 6 ] *= invSY;\n\n\t\t_m1$2.elements[ 8 ] *= invSZ;\n\t\t_m1$2.elements[ 9 ] *= invSZ;\n\t\t_m1$2.elements[ 10 ] *= invSZ;\n\n\t\tquaternion.setFromRotationMatrix( _m1$2 );\n\n\t\tscale.x = sx;\n\t\tscale.y = sy;\n\t\tscale.z = sz;\n\n\t\treturn this;\n\n\t}\n\n\tmakePerspective( left, right, top, bottom, near, far ) {\n\n\t\tif ( far === undefined ) {\n\n\t\t\tconsole.warn( 'THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.' );\n\n\t\t}\n\n\t\tconst te = this.elements;\n\t\tconst x = 2 * near / ( right - left );\n\t\tconst y = 2 * near / ( top - bottom );\n\n\t\tconst a = ( right + left ) / ( right - left );\n\t\tconst b = ( top + bottom ) / ( top - bottom );\n\t\tconst c = - ( far + near ) / ( far - near );\n\t\tconst d = - 2 * far * near / ( far - near );\n\n\t\tte[ 0 ] = x;\tte[ 4 ] = 0;\tte[ 8 ] = a;\tte[ 12 ] = 0;\n\t\tte[ 1 ] = 0;\tte[ 5 ] = y;\tte[ 9 ] = b;\tte[ 13 ] = 0;\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = c;\tte[ 14 ] = d;\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = - 1;\tte[ 15 ] = 0;\n\n\t\treturn this;\n\n\t}\n\n\tmakeOrthographic( left, right, top, bottom, near, far ) {\n\n\t\tconst te = this.elements;\n\t\tconst w = 1.0 / ( right - left );\n\t\tconst h = 1.0 / ( top - bottom );\n\t\tconst p = 1.0 / ( far - near );\n\n\t\tconst x = ( right + left ) * w;\n\t\tconst y = ( top + bottom ) * h;\n\t\tconst z = ( far + near ) * p;\n\n\t\tte[ 0 ] = 2 * w;\tte[ 4 ] = 0;\tte[ 8 ] = 0;\tte[ 12 ] = - x;\n\t\tte[ 1 ] = 0;\tte[ 5 ] = 2 * h;\tte[ 9 ] = 0;\tte[ 13 ] = - y;\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = - 2 * p;\tte[ 14 ] = - z;\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = 0;\tte[ 15 ] = 1;\n\n\t\treturn this;\n\n\t}\n\n\tequals( matrix ) {\n\n\t\tconst te = this.elements;\n\t\tconst me = matrix.elements;\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tfor ( let i = 0; i < 16; i ++ ) {\n\n\t\t\tthis.elements[ i ] = array[ i + offset ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst te = this.elements;\n\n\t\tarray[ offset ] = te[ 0 ];\n\t\tarray[ offset + 1 ] = te[ 1 ];\n\t\tarray[ offset + 2 ] = te[ 2 ];\n\t\tarray[ offset + 3 ] = te[ 3 ];\n\n\t\tarray[ offset + 4 ] = te[ 4 ];\n\t\tarray[ offset + 5 ] = te[ 5 ];\n\t\tarray[ offset + 6 ] = te[ 6 ];\n\t\tarray[ offset + 7 ] = te[ 7 ];\n\n\t\tarray[ offset + 8 ] = te[ 8 ];\n\t\tarray[ offset + 9 ] = te[ 9 ];\n\t\tarray[ offset + 10 ] = te[ 10 ];\n\t\tarray[ offset + 11 ] = te[ 11 ];\n\n\t\tarray[ offset + 12 ] = te[ 12 ];\n\t\tarray[ offset + 13 ] = te[ 13 ];\n\t\tarray[ offset + 14 ] = te[ 14 ];\n\t\tarray[ offset + 15 ] = te[ 15 ];\n\n\t\treturn array;\n\n\t}\n\n}\n\nMatrix4.prototype.isMatrix4 = true;\n\nconst _v1$5 = /*@__PURE__*/ new Vector3();\nconst _m1$2 = /*@__PURE__*/ new Matrix4();\nconst _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );\nconst _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );\nconst _x = /*@__PURE__*/ new Vector3();\nconst _y = /*@__PURE__*/ new Vector3();\nconst _z = /*@__PURE__*/ new Vector3();\n\nconst _matrix$1 = /*@__PURE__*/ new Matrix4();\nconst _quaternion$3 = /*@__PURE__*/ new Quaternion();\n\nclass Euler {\n\n\tconstructor( x = 0, y = 0, z = 0, order = Euler.DefaultOrder ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t}\n\n\tget x() {\n\n\t\treturn this._x;\n\n\t}\n\n\tset x( value ) {\n\n\t\tthis._x = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget y() {\n\n\t\treturn this._y;\n\n\t}\n\n\tset y( value ) {\n\n\t\tthis._y = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget z() {\n\n\t\treturn this._z;\n\n\t}\n\n\tset z( value ) {\n\n\t\tthis._z = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tget order() {\n\n\t\treturn this._order;\n\n\t}\n\n\tset order( value ) {\n\n\t\tthis._order = value;\n\t\tthis._onChangeCallback();\n\n\t}\n\n\tset( x, y, z, order = this._order ) {\n\n\t\tthis._x = x;\n\t\tthis._y = y;\n\t\tthis._z = z;\n\t\tthis._order = order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this._x, this._y, this._z, this._order );\n\n\t}\n\n\tcopy( euler ) {\n\n\t\tthis._x = euler._x;\n\t\tthis._y = euler._y;\n\t\tthis._z = euler._z;\n\t\tthis._order = euler._order;\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromRotationMatrix( m, order = this._order, update = true ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tconst te = m.elements;\n\t\tconst m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];\n\t\tconst m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];\n\t\tconst m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\n\n\t\tswitch ( order ) {\n\n\t\t\tcase 'XYZ':\n\n\t\t\t\tthis._y = Math.asin( clamp( m13, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m13 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YXZ':\n\n\t\t\t\tthis._x = Math.asin( - clamp( m23, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m23 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\t\t\t\t\tthis._z = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZXY':\n\n\t\t\t\tthis._x = Math.asin( clamp( m32, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m32 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._y = Math.atan2( - m31, m33 );\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._y = 0;\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'ZYX':\n\n\t\t\t\tthis._y = Math.asin( - clamp( m31, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m31 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m33 );\n\t\t\t\t\tthis._z = Math.atan2( m21, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._z = Math.atan2( - m12, m22 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'YZX':\n\n\t\t\t\tthis._z = Math.asin( clamp( m21, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m21 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m22 );\n\t\t\t\t\tthis._y = Math.atan2( - m31, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = 0;\n\t\t\t\t\tthis._y = Math.atan2( m13, m33 );\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'XZY':\n\n\t\t\t\tthis._z = Math.asin( - clamp( m12, - 1, 1 ) );\n\n\t\t\t\tif ( Math.abs( m12 ) < 0.9999999 ) {\n\n\t\t\t\t\tthis._x = Math.atan2( m32, m22 );\n\t\t\t\t\tthis._y = Math.atan2( m13, m11 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis._x = Math.atan2( - m23, m33 );\n\t\t\t\t\tthis._y = 0;\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tconsole.warn( 'THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order );\n\n\t\t}\n\n\t\tthis._order = order;\n\n\t\tif ( update === true ) this._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\tsetFromQuaternion( q, order, update ) {\n\n\t\t_matrix$1.makeRotationFromQuaternion( q );\n\n\t\treturn this.setFromRotationMatrix( _matrix$1, order, update );\n\n\t}\n\n\tsetFromVector3( v, order = this._order ) {\n\n\t\treturn this.set( v.x, v.y, v.z, order );\n\n\t}\n\n\treorder( newOrder ) {\n\n\t\t// WARNING: this discards revolution information -bhouston\n\n\t\t_quaternion$3.setFromEuler( this );\n\n\t\treturn this.setFromQuaternion( _quaternion$3, newOrder );\n\n\t}\n\n\tequals( euler ) {\n\n\t\treturn ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );\n\n\t}\n\n\tfromArray( array ) {\n\n\t\tthis._x = array[ 0 ];\n\t\tthis._y = array[ 1 ];\n\t\tthis._z = array[ 2 ];\n\t\tif ( array[ 3 ] !== undefined ) this._order = array[ 3 ];\n\n\t\tthis._onChangeCallback();\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this._x;\n\t\tarray[ offset + 1 ] = this._y;\n\t\tarray[ offset + 2 ] = this._z;\n\t\tarray[ offset + 3 ] = this._order;\n\n\t\treturn array;\n\n\t}\n\n\ttoVector3( optionalResult ) {\n\n\t\tif ( optionalResult ) {\n\n\t\t\treturn optionalResult.set( this._x, this._y, this._z );\n\n\t\t} else {\n\n\t\t\treturn new Vector3( this._x, this._y, this._z );\n\n\t\t}\n\n\t}\n\n\t_onChange( callback ) {\n\n\t\tthis._onChangeCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\t_onChangeCallback() {}\n\n}\n\nEuler.prototype.isEuler = true;\n\nEuler.DefaultOrder = 'XYZ';\nEuler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ];\n\nclass Layers {\n\n\tconstructor() {\n\n\t\tthis.mask = 1 | 0;\n\n\t}\n\n\tset( channel ) {\n\n\t\tthis.mask = 1 << channel | 0;\n\n\t}\n\n\tenable( channel ) {\n\n\t\tthis.mask |= 1 << channel | 0;\n\n\t}\n\n\tenableAll() {\n\n\t\tthis.mask = 0xffffffff | 0;\n\n\t}\n\n\ttoggle( channel ) {\n\n\t\tthis.mask ^= 1 << channel | 0;\n\n\t}\n\n\tdisable( channel ) {\n\n\t\tthis.mask &= ~ ( 1 << channel | 0 );\n\n\t}\n\n\tdisableAll() {\n\n\t\tthis.mask = 0;\n\n\t}\n\n\ttest( layers ) {\n\n\t\treturn ( this.mask & layers.mask ) !== 0;\n\n\t}\n\n}\n\nlet _object3DId = 0;\n\nconst _v1$4 = /*@__PURE__*/ new Vector3();\nconst _q1 = /*@__PURE__*/ new Quaternion();\nconst _m1$1 = /*@__PURE__*/ new Matrix4();\nconst _target = /*@__PURE__*/ new Vector3();\n\nconst _position$3 = /*@__PURE__*/ new Vector3();\nconst _scale$2 = /*@__PURE__*/ new Vector3();\nconst _quaternion$2 = /*@__PURE__*/ new Quaternion();\n\nconst _xAxis = /*@__PURE__*/ new Vector3( 1, 0, 0 );\nconst _yAxis = /*@__PURE__*/ new Vector3( 0, 1, 0 );\nconst _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );\n\nconst _addedEvent = { type: 'added' };\nconst _removedEvent = { type: 'removed' };\n\nclass Object3D extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tObject.defineProperty( this, 'id', { value: _object3DId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Object3D';\n\n\t\tthis.parent = null;\n\t\tthis.children = [];\n\n\t\tthis.up = Object3D.DefaultUp.clone();\n\n\t\tconst position = new Vector3();\n\t\tconst rotation = new Euler();\n\t\tconst quaternion = new Quaternion();\n\t\tconst scale = new Vector3( 1, 1, 1 );\n\n\t\tfunction onRotationChange() {\n\n\t\t\tquaternion.setFromEuler( rotation, false );\n\n\t\t}\n\n\t\tfunction onQuaternionChange() {\n\n\t\t\trotation.setFromQuaternion( quaternion, undefined, false );\n\n\t\t}\n\n\t\trotation._onChange( onRotationChange );\n\t\tquaternion._onChange( onQuaternionChange );\n\n\t\tObject.defineProperties( this, {\n\t\t\tposition: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: position\n\t\t\t},\n\t\t\trotation: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: rotation\n\t\t\t},\n\t\t\tquaternion: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: quaternion\n\t\t\t},\n\t\t\tscale: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: scale\n\t\t\t},\n\t\t\tmodelViewMatrix: {\n\t\t\t\tvalue: new Matrix4()\n\t\t\t},\n\t\t\tnormalMatrix: {\n\t\t\t\tvalue: new Matrix3()\n\t\t\t}\n\t\t} );\n\n\t\tthis.matrix = new Matrix4();\n\t\tthis.matrixWorld = new Matrix4();\n\n\t\tthis.matrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate;\n\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\tthis.layers = new Layers();\n\t\tthis.visible = true;\n\n\t\tthis.castShadow = false;\n\t\tthis.receiveShadow = false;\n\n\t\tthis.frustumCulled = true;\n\t\tthis.renderOrder = 0;\n\n\t\tthis.animations = [];\n\n\t\tthis.userData = {};\n\n\t}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tonAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tthis.matrix.premultiply( matrix );\n\n\t\tthis.matrix.decompose( this.position, this.quaternion, this.scale );\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\tthis.quaternion.premultiply( q );\n\n\t\treturn this;\n\n\t}\n\n\tsetRotationFromAxisAngle( axis, angle ) {\n\n\t\t// assumes axis is normalized\n\n\t\tthis.quaternion.setFromAxisAngle( axis, angle );\n\n\t}\n\n\tsetRotationFromEuler( euler ) {\n\n\t\tthis.quaternion.setFromEuler( euler, true );\n\n\t}\n\n\tsetRotationFromMatrix( m ) {\n\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n\t\tthis.quaternion.setFromRotationMatrix( m );\n\n\t}\n\n\tsetRotationFromQuaternion( q ) {\n\n\t\t// assumes q is normalized\n\n\t\tthis.quaternion.copy( q );\n\n\t}\n\n\trotateOnAxis( axis, angle ) {\n\n\t\t// rotate object on axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.multiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateOnWorldAxis( axis, angle ) {\n\n\t\t// rotate object on axis in world space\n\t\t// axis is assumed to be normalized\n\t\t// method assumes no rotated parent\n\n\t\t_q1.setFromAxisAngle( axis, angle );\n\n\t\tthis.quaternion.premultiply( _q1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\treturn this.rotateOnAxis( _xAxis, angle );\n\n\t}\n\n\trotateY( angle ) {\n\n\t\treturn this.rotateOnAxis( _yAxis, angle );\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\treturn this.rotateOnAxis( _zAxis, angle );\n\n\t}\n\n\ttranslateOnAxis( axis, distance ) {\n\n\t\t// translate object by distance along axis in object space\n\t\t// axis is assumed to be normalized\n\n\t\t_v1$4.copy( axis ).applyQuaternion( this.quaternion );\n\n\t\tthis.position.add( _v1$4.multiplyScalar( distance ) );\n\n\t\treturn this;\n\n\t}\n\n\ttranslateX( distance ) {\n\n\t\treturn this.translateOnAxis( _xAxis, distance );\n\n\t}\n\n\ttranslateY( distance ) {\n\n\t\treturn this.translateOnAxis( _yAxis, distance );\n\n\t}\n\n\ttranslateZ( distance ) {\n\n\t\treturn this.translateOnAxis( _zAxis, distance );\n\n\t}\n\n\tlocalToWorld( vector ) {\n\n\t\treturn vector.applyMatrix4( this.matrixWorld );\n\n\t}\n\n\tworldToLocal( vector ) {\n\n\t\treturn vector.applyMatrix4( _m1$1.copy( this.matrixWorld ).invert() );\n\n\t}\n\n\tlookAt( x, y, z ) {\n\n\t\t// This method does not support objects having non-uniformly-scaled parent(s)\n\n\t\tif ( x.isVector3 ) {\n\n\t\t\t_target.copy( x );\n\n\t\t} else {\n\n\t\t\t_target.set( x, y, z );\n\n\t\t}\n\n\t\tconst parent = this.parent;\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_position$3.setFromMatrixPosition( this.matrixWorld );\n\n\t\tif ( this.isCamera || this.isLight ) {\n\n\t\t\t_m1$1.lookAt( _position$3, _target, this.up );\n\n\t\t} else {\n\n\t\t\t_m1$1.lookAt( _target, _position$3, this.up );\n\n\t\t}\n\n\t\tthis.quaternion.setFromRotationMatrix( _m1$1 );\n\n\t\tif ( parent ) {\n\n\t\t\t_m1$1.extractRotation( parent.matrixWorld );\n\t\t\t_q1.setFromRotationMatrix( _m1$1 );\n\t\t\tthis.quaternion.premultiply( _q1.invert() );\n\n\t\t}\n\n\t}\n\n\tadd( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.add( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object === this ) {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object can\\'t be added as a child of itself.', object );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tif ( object && object.isObject3D ) {\n\n\t\t\tif ( object.parent !== null ) {\n\n\t\t\t\tobject.parent.remove( object );\n\n\t\t\t}\n\n\t\t\tobject.parent = this;\n\t\t\tthis.children.push( object );\n\n\t\t\tobject.dispatchEvent( _addedEvent );\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremove( object ) {\n\n\t\tif ( arguments.length > 1 ) {\n\n\t\t\tfor ( let i = 0; i < arguments.length; i ++ ) {\n\n\t\t\t\tthis.remove( arguments[ i ] );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst index = this.children.indexOf( object );\n\n\t\tif ( index !== - 1 ) {\n\n\t\t\tobject.parent = null;\n\t\t\tthis.children.splice( index, 1 );\n\n\t\t\tobject.dispatchEvent( _removedEvent );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tremoveFromParent() {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tparent.remove( this );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclear() {\n\n\t\tfor ( let i = 0; i < this.children.length; i ++ ) {\n\n\t\t\tconst object = this.children[ i ];\n\n\t\t\tobject.parent = null;\n\n\t\t\tobject.dispatchEvent( _removedEvent );\n\n\t\t}\n\n\t\tthis.children.length = 0;\n\n\t\treturn this;\n\n\n\t}\n\n\tattach( object ) {\n\n\t\t// adds object as a child of this, while maintaining the object's world transform\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\t_m1$1.copy( this.matrixWorld ).invert();\n\n\t\tif ( object.parent !== null ) {\n\n\t\t\tobject.parent.updateWorldMatrix( true, false );\n\n\t\t\t_m1$1.multiply( object.parent.matrixWorld );\n\n\t\t}\n\n\t\tobject.applyMatrix4( _m1$1 );\n\n\t\tthis.add( object );\n\n\t\tobject.updateWorldMatrix( false, true );\n\n\t\treturn this;\n\n\t}\n\n\tgetObjectById( id ) {\n\n\t\treturn this.getObjectByProperty( 'id', id );\n\n\t}\n\n\tgetObjectByName( name ) {\n\n\t\treturn this.getObjectByProperty( 'name', name );\n\n\t}\n\n\tgetObjectByProperty( name, value ) {\n\n\t\tif ( this[ name ] === value ) return this;\n\n\t\tfor ( let i = 0, l = this.children.length; i < l; i ++ ) {\n\n\t\t\tconst child = this.children[ i ];\n\t\t\tconst object = child.getObjectByProperty( name, value );\n\n\t\t\tif ( object !== undefined ) {\n\n\t\t\t\treturn object;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tgetWorldPosition( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\treturn target.setFromMatrixPosition( this.matrixWorld );\n\n\t}\n\n\tgetWorldQuaternion( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, target, _scale$2 );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldScale( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tthis.matrixWorld.decompose( _position$3, _quaternion$2, target );\n\n\t\treturn target;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tconst e = this.matrixWorld.elements;\n\n\t\treturn target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize();\n\n\t}\n\n\traycast() {}\n\n\ttraverse( callback ) {\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverse( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseVisible( callback ) {\n\n\t\tif ( this.visible === false ) return;\n\n\t\tcallback( this );\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].traverseVisible( callback );\n\n\t\t}\n\n\t}\n\n\ttraverseAncestors( callback ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( parent !== null ) {\n\n\t\t\tcallback( parent );\n\n\t\t\tparent.traverseAncestors( callback );\n\n\t\t}\n\n\t}\n\n\tupdateMatrix() {\n\n\t\tthis.matrix.compose( this.position, this.quaternion, this.scale );\n\n\t\tthis.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.matrixWorldNeedsUpdate || force ) {\n\n\t\t\tif ( this.parent === null ) {\n\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t\t}\n\n\t\t\tthis.matrixWorldNeedsUpdate = false;\n\n\t\t\tforce = true;\n\n\t\t}\n\n\t\t// update children\n\n\t\tconst children = this.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tchildren[ i ].updateMatrixWorld( force );\n\n\t\t}\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tconst parent = this.parent;\n\n\t\tif ( updateParents === true && parent !== null ) {\n\n\t\t\tparent.updateWorldMatrix( true, false );\n\n\t\t}\n\n\t\tif ( this.matrixAutoUpdate ) this.updateMatrix();\n\n\t\tif ( this.parent === null ) {\n\n\t\t\tthis.matrixWorld.copy( this.matrix );\n\n\t\t} else {\n\n\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\n\n\t\t}\n\n\t\t// update children\n\n\t\tif ( updateChildren === true ) {\n\n\t\t\tconst children = this.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tchildren[ i ].updateWorldMatrix( false, true );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\t// meta is a string when called from JSON.stringify\n\t\tconst isRootObject = ( meta === undefined || typeof meta === 'string' );\n\n\t\tconst output = {};\n\n\t\t// meta is a hash used to collect geometries, materials.\n\t\t// not providing it implies that this is the root object\n\t\t// being serialized.\n\t\tif ( isRootObject ) {\n\n\t\t\t// initialize meta obj\n\t\t\tmeta = {\n\t\t\t\tgeometries: {},\n\t\t\t\tmaterials: {},\n\t\t\t\ttextures: {},\n\t\t\t\timages: {},\n\t\t\t\tshapes: {},\n\t\t\t\tskeletons: {},\n\t\t\t\tanimations: {}\n\t\t\t};\n\n\t\t\toutput.metadata = {\n\t\t\t\tversion: 4.5,\n\t\t\t\ttype: 'Object',\n\t\t\t\tgenerator: 'Object3D.toJSON'\n\t\t\t};\n\n\t\t}\n\n\t\t// standard Object3D serialization\n\n\t\tconst object = {};\n\n\t\tobject.uuid = this.uuid;\n\t\tobject.type = this.type;\n\n\t\tif ( this.name !== '' ) object.name = this.name;\n\t\tif ( this.castShadow === true ) object.castShadow = true;\n\t\tif ( this.receiveShadow === true ) object.receiveShadow = true;\n\t\tif ( this.visible === false ) object.visible = false;\n\t\tif ( this.frustumCulled === false ) object.frustumCulled = false;\n\t\tif ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;\n\t\tif ( JSON.stringify( this.userData ) !== '{}' ) object.userData = this.userData;\n\n\t\tobject.layers = this.layers.mask;\n\t\tobject.matrix = this.matrix.toArray();\n\n\t\tif ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;\n\n\t\t// object specific properties\n\n\t\tif ( this.isInstancedMesh ) {\n\n\t\t\tobject.type = 'InstancedMesh';\n\t\t\tobject.count = this.count;\n\t\t\tobject.instanceMatrix = this.instanceMatrix.toJSON();\n\t\t\tif ( this.instanceColor !== null ) object.instanceColor = this.instanceColor.toJSON();\n\n\t\t}\n\n\t\t//\n\n\t\tfunction serialize( library, element ) {\n\n\t\t\tif ( library[ element.uuid ] === undefined ) {\n\n\t\t\t\tlibrary[ element.uuid ] = element.toJSON( meta );\n\n\t\t\t}\n\n\t\t\treturn element.uuid;\n\n\t\t}\n\n\t\tif ( this.isScene ) {\n\n\t\t\tif ( this.background ) {\n\n\t\t\t\tif ( this.background.isColor ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON();\n\n\t\t\t\t} else if ( this.background.isTexture ) {\n\n\t\t\t\t\tobject.background = this.background.toJSON( meta ).uuid;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( this.environment && this.environment.isTexture ) {\n\n\t\t\t\tobject.environment = this.environment.toJSON( meta ).uuid;\n\n\t\t\t}\n\n\t\t} else if ( this.isMesh || this.isLine || this.isPoints ) {\n\n\t\t\tobject.geometry = serialize( meta.geometries, this.geometry );\n\n\t\t\tconst parameters = this.geometry.parameters;\n\n\t\t\tif ( parameters !== undefined && parameters.shapes !== undefined ) {\n\n\t\t\t\tconst shapes = parameters.shapes;\n\n\t\t\t\tif ( Array.isArray( shapes ) ) {\n\n\t\t\t\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\t\t\t\tconst shape = shapes[ i ];\n\n\t\t\t\t\t\tserialize( meta.shapes, shape );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tserialize( meta.shapes, shapes );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.isSkinnedMesh ) {\n\n\t\t\tobject.bindMode = this.bindMode;\n\t\t\tobject.bindMatrix = this.bindMatrix.toArray();\n\n\t\t\tif ( this.skeleton !== undefined ) {\n\n\t\t\t\tserialize( meta.skeletons, this.skeleton );\n\n\t\t\t\tobject.skeleton = this.skeleton.uuid;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.material !== undefined ) {\n\n\t\t\tif ( Array.isArray( this.material ) ) {\n\n\t\t\t\tconst uuids = [];\n\n\t\t\t\tfor ( let i = 0, l = this.material.length; i < l; i ++ ) {\n\n\t\t\t\t\tuuids.push( serialize( meta.materials, this.material[ i ] ) );\n\n\t\t\t\t}\n\n\t\t\t\tobject.material = uuids;\n\n\t\t\t} else {\n\n\t\t\t\tobject.material = serialize( meta.materials, this.material );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.children.length > 0 ) {\n\n\t\t\tobject.children = [];\n\n\t\t\tfor ( let i = 0; i < this.children.length; i ++ ) {\n\n\t\t\t\tobject.children.push( this.children[ i ].toJSON( meta ).object );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.animations.length > 0 ) {\n\n\t\t\tobject.animations = [];\n\n\t\t\tfor ( let i = 0; i < this.animations.length; i ++ ) {\n\n\t\t\t\tconst animation = this.animations[ i ];\n\n\t\t\t\tobject.animations.push( serialize( meta.animations, animation ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( isRootObject ) {\n\n\t\t\tconst geometries = extractFromCache( meta.geometries );\n\t\t\tconst materials = extractFromCache( meta.materials );\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\t\t\tconst shapes = extractFromCache( meta.shapes );\n\t\t\tconst skeletons = extractFromCache( meta.skeletons );\n\t\t\tconst animations = extractFromCache( meta.animations );\n\n\t\t\tif ( geometries.length > 0 ) output.geometries = geometries;\n\t\t\tif ( materials.length > 0 ) output.materials = materials;\n\t\t\tif ( textures.length > 0 ) output.textures = textures;\n\t\t\tif ( images.length > 0 ) output.images = images;\n\t\t\tif ( shapes.length > 0 ) output.shapes = shapes;\n\t\t\tif ( skeletons.length > 0 ) output.skeletons = skeletons;\n\t\t\tif ( animations.length > 0 ) output.animations = animations;\n\n\t\t}\n\n\t\toutput.object = object;\n\n\t\treturn output;\n\n\t\t// extract data from the cache hash\n\t\t// remove metadata on each item\n\t\t// and return as array\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t}\n\n\tclone( recursive ) {\n\n\t\treturn new this.constructor().copy( this, recursive );\n\n\t}\n\n\tcopy( source, recursive = true ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.up.copy( source.up );\n\n\t\tthis.position.copy( source.position );\n\t\tthis.rotation.order = source.rotation.order;\n\t\tthis.quaternion.copy( source.quaternion );\n\t\tthis.scale.copy( source.scale );\n\n\t\tthis.matrix.copy( source.matrix );\n\t\tthis.matrixWorld.copy( source.matrixWorld );\n\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\n\n\t\tthis.layers.mask = source.layers.mask;\n\t\tthis.visible = source.visible;\n\n\t\tthis.castShadow = source.castShadow;\n\t\tthis.receiveShadow = source.receiveShadow;\n\n\t\tthis.frustumCulled = source.frustumCulled;\n\t\tthis.renderOrder = source.renderOrder;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\tif ( recursive === true ) {\n\n\t\t\tfor ( let i = 0; i < source.children.length; i ++ ) {\n\n\t\t\t\tconst child = source.children[ i ];\n\t\t\t\tthis.add( child.clone() );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nObject3D.DefaultUp = new Vector3( 0, 1, 0 );\nObject3D.DefaultMatrixAutoUpdate = true;\n\nObject3D.prototype.isObject3D = true;\n\nconst _v0$1 = /*@__PURE__*/ new Vector3();\nconst _v1$3 = /*@__PURE__*/ new Vector3();\nconst _v2$2 = /*@__PURE__*/ new Vector3();\nconst _v3$1 = /*@__PURE__*/ new Vector3();\n\nconst _vab = /*@__PURE__*/ new Vector3();\nconst _vac = /*@__PURE__*/ new Vector3();\nconst _vbc = /*@__PURE__*/ new Vector3();\nconst _vap = /*@__PURE__*/ new Vector3();\nconst _vbp = /*@__PURE__*/ new Vector3();\nconst _vcp = /*@__PURE__*/ new Vector3();\n\nclass Triangle {\n\n\tconstructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {\n\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\n\t}\n\n\tstatic getNormal( a, b, c, target ) {\n\n\t\ttarget.subVectors( c, b );\n\t\t_v0$1.subVectors( a, b );\n\t\ttarget.cross( _v0$1 );\n\n\t\tconst targetLengthSq = target.lengthSq();\n\t\tif ( targetLengthSq > 0 ) {\n\n\t\t\treturn target.multiplyScalar( 1 / Math.sqrt( targetLengthSq ) );\n\n\t\t}\n\n\t\treturn target.set( 0, 0, 0 );\n\n\t}\n\n\t// static/instance method to calculate barycentric coordinates\n\t// based on: http://www.blackpawn.com/texts/pointinpoly/default.html\n\tstatic getBarycoord( point, a, b, c, target ) {\n\n\t\t_v0$1.subVectors( c, a );\n\t\t_v1$3.subVectors( b, a );\n\t\t_v2$2.subVectors( point, a );\n\n\t\tconst dot00 = _v0$1.dot( _v0$1 );\n\t\tconst dot01 = _v0$1.dot( _v1$3 );\n\t\tconst dot02 = _v0$1.dot( _v2$2 );\n\t\tconst dot11 = _v1$3.dot( _v1$3 );\n\t\tconst dot12 = _v1$3.dot( _v2$2 );\n\n\t\tconst denom = ( dot00 * dot11 - dot01 * dot01 );\n\n\t\t// collinear or singular triangle\n\t\tif ( denom === 0 ) {\n\n\t\t\t// arbitrary location outside of triangle?\n\t\t\t// not sure if this is the best idea, maybe should be returning undefined\n\t\t\treturn target.set( - 2, - 1, - 1 );\n\n\t\t}\n\n\t\tconst invDenom = 1 / denom;\n\t\tconst u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;\n\t\tconst v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;\n\n\t\t// barycentric coordinates must always sum to 1\n\t\treturn target.set( 1 - u - v, v, u );\n\n\t}\n\n\tstatic containsPoint( point, a, b, c ) {\n\n\t\tthis.getBarycoord( point, a, b, c, _v3$1 );\n\n\t\treturn ( _v3$1.x >= 0 ) && ( _v3$1.y >= 0 ) && ( ( _v3$1.x + _v3$1.y ) <= 1 );\n\n\t}\n\n\tstatic getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) {\n\n\t\tthis.getBarycoord( point, p1, p2, p3, _v3$1 );\n\n\t\ttarget.set( 0, 0 );\n\t\ttarget.addScaledVector( uv1, _v3$1.x );\n\t\ttarget.addScaledVector( uv2, _v3$1.y );\n\t\ttarget.addScaledVector( uv3, _v3$1.z );\n\n\t\treturn target;\n\n\t}\n\n\tstatic isFrontFacing( a, b, c, direction ) {\n\n\t\t_v0$1.subVectors( c, b );\n\t\t_v1$3.subVectors( a, b );\n\n\t\t// strictly front facing\n\t\treturn ( _v0$1.cross( _v1$3 ).dot( direction ) < 0 ) ? true : false;\n\n\t}\n\n\tset( a, b, c ) {\n\n\t\tthis.a.copy( a );\n\t\tthis.b.copy( b );\n\t\tthis.c.copy( c );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPointsAndIndices( points, i0, i1, i2 ) {\n\n\t\tthis.a.copy( points[ i0 ] );\n\t\tthis.b.copy( points[ i1 ] );\n\t\tthis.c.copy( points[ i2 ] );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromAttributeAndIndices( attribute, i0, i1, i2 ) {\n\n\t\tthis.a.fromBufferAttribute( attribute, i0 );\n\t\tthis.b.fromBufferAttribute( attribute, i1 );\n\t\tthis.c.fromBufferAttribute( attribute, i2 );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( triangle ) {\n\n\t\tthis.a.copy( triangle.a );\n\t\tthis.b.copy( triangle.b );\n\t\tthis.c.copy( triangle.c );\n\n\t\treturn this;\n\n\t}\n\n\tgetArea() {\n\n\t\t_v0$1.subVectors( this.c, this.b );\n\t\t_v1$3.subVectors( this.a, this.b );\n\n\t\treturn _v0$1.cross( _v1$3 ).length() * 0.5;\n\n\t}\n\n\tgetMidpoint( target ) {\n\n\t\treturn target.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );\n\n\t}\n\n\tgetNormal( target ) {\n\n\t\treturn Triangle.getNormal( this.a, this.b, this.c, target );\n\n\t}\n\n\tgetPlane( target ) {\n\n\t\treturn target.setFromCoplanarPoints( this.a, this.b, this.c );\n\n\t}\n\n\tgetBarycoord( point, target ) {\n\n\t\treturn Triangle.getBarycoord( point, this.a, this.b, this.c, target );\n\n\t}\n\n\tgetUV( point, uv1, uv2, uv3, target ) {\n\n\t\treturn Triangle.getUV( point, this.a, this.b, this.c, uv1, uv2, uv3, target );\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn Triangle.containsPoint( point, this.a, this.b, this.c );\n\n\t}\n\n\tisFrontFacing( direction ) {\n\n\t\treturn Triangle.isFrontFacing( this.a, this.b, this.c, direction );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsTriangle( this );\n\n\t}\n\n\tclosestPointToPoint( p, target ) {\n\n\t\tconst a = this.a, b = this.b, c = this.c;\n\t\tlet v, w;\n\n\t\t// algorithm thanks to Real-Time Collision Detection by Christer Ericson,\n\t\t// published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\n\t\t// under the accompanying license; see chapter 5.1.5 for detailed explanation.\n\t\t// basically, we're distinguishing which of the voronoi regions of the triangle\n\t\t// the point lies in with the minimum amount of redundant computation.\n\n\t\t_vab.subVectors( b, a );\n\t\t_vac.subVectors( c, a );\n\t\t_vap.subVectors( p, a );\n\t\tconst d1 = _vab.dot( _vap );\n\t\tconst d2 = _vac.dot( _vap );\n\t\tif ( d1 <= 0 && d2 <= 0 ) {\n\n\t\t\t// vertex region of A; barycentric coords (1, 0, 0)\n\t\t\treturn target.copy( a );\n\n\t\t}\n\n\t\t_vbp.subVectors( p, b );\n\t\tconst d3 = _vab.dot( _vbp );\n\t\tconst d4 = _vac.dot( _vbp );\n\t\tif ( d3 >= 0 && d4 <= d3 ) {\n\n\t\t\t// vertex region of B; barycentric coords (0, 1, 0)\n\t\t\treturn target.copy( b );\n\n\t\t}\n\n\t\tconst vc = d1 * d4 - d3 * d2;\n\t\tif ( vc <= 0 && d1 >= 0 && d3 <= 0 ) {\n\n\t\t\tv = d1 / ( d1 - d3 );\n\t\t\t// edge region of AB; barycentric coords (1-v, v, 0)\n\t\t\treturn target.copy( a ).addScaledVector( _vab, v );\n\n\t\t}\n\n\t\t_vcp.subVectors( p, c );\n\t\tconst d5 = _vab.dot( _vcp );\n\t\tconst d6 = _vac.dot( _vcp );\n\t\tif ( d6 >= 0 && d5 <= d6 ) {\n\n\t\t\t// vertex region of C; barycentric coords (0, 0, 1)\n\t\t\treturn target.copy( c );\n\n\t\t}\n\n\t\tconst vb = d5 * d2 - d1 * d6;\n\t\tif ( vb <= 0 && d2 >= 0 && d6 <= 0 ) {\n\n\t\t\tw = d2 / ( d2 - d6 );\n\t\t\t// edge region of AC; barycentric coords (1-w, 0, w)\n\t\t\treturn target.copy( a ).addScaledVector( _vac, w );\n\n\t\t}\n\n\t\tconst va = d3 * d6 - d5 * d4;\n\t\tif ( va <= 0 && ( d4 - d3 ) >= 0 && ( d5 - d6 ) >= 0 ) {\n\n\t\t\t_vbc.subVectors( c, b );\n\t\t\tw = ( d4 - d3 ) / ( ( d4 - d3 ) + ( d5 - d6 ) );\n\t\t\t// edge region of BC; barycentric coords (0, 1-w, w)\n\t\t\treturn target.copy( b ).addScaledVector( _vbc, w ); // edge region of BC\n\n\t\t}\n\n\t\t// face region\n\t\tconst denom = 1 / ( va + vb + vc );\n\t\t// u = va * denom\n\t\tv = vb * denom;\n\t\tw = vc * denom;\n\n\t\treturn target.copy( a ).addScaledVector( _vab, v ).addScaledVector( _vac, w );\n\n\t}\n\n\tequals( triangle ) {\n\n\t\treturn triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );\n\n\t}\n\n}\n\nlet materialId = 0;\n\nclass Material extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tObject.defineProperty( this, 'id', { value: materialId ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'Material';\n\n\t\tthis.fog = true;\n\n\t\tthis.blending = NormalBlending;\n\t\tthis.side = FrontSide;\n\t\tthis.vertexColors = false;\n\n\t\tthis.opacity = 1;\n\t\tthis.format = RGBAFormat;\n\t\tthis.transparent = false;\n\n\t\tthis.blendSrc = SrcAlphaFactor;\n\t\tthis.blendDst = OneMinusSrcAlphaFactor;\n\t\tthis.blendEquation = AddEquation;\n\t\tthis.blendSrcAlpha = null;\n\t\tthis.blendDstAlpha = null;\n\t\tthis.blendEquationAlpha = null;\n\n\t\tthis.depthFunc = LessEqualDepth;\n\t\tthis.depthTest = true;\n\t\tthis.depthWrite = true;\n\n\t\tthis.stencilWriteMask = 0xff;\n\t\tthis.stencilFunc = AlwaysStencilFunc;\n\t\tthis.stencilRef = 0;\n\t\tthis.stencilFuncMask = 0xff;\n\t\tthis.stencilFail = KeepStencilOp;\n\t\tthis.stencilZFail = KeepStencilOp;\n\t\tthis.stencilZPass = KeepStencilOp;\n\t\tthis.stencilWrite = false;\n\n\t\tthis.clippingPlanes = null;\n\t\tthis.clipIntersection = false;\n\t\tthis.clipShadows = false;\n\n\t\tthis.shadowSide = null;\n\n\t\tthis.colorWrite = true;\n\n\t\tthis.precision = null; // override the renderer's default precision for this material\n\n\t\tthis.polygonOffset = false;\n\t\tthis.polygonOffsetFactor = 0;\n\t\tthis.polygonOffsetUnits = 0;\n\n\t\tthis.dithering = false;\n\n\t\tthis.alphaToCoverage = false;\n\t\tthis.premultipliedAlpha = false;\n\n\t\tthis.visible = true;\n\n\t\tthis.toneMapped = true;\n\n\t\tthis.userData = {};\n\n\t\tthis.version = 0;\n\n\t\tthis._alphaTest = 0;\n\n\t}\n\n\tget alphaTest() {\n\n\t\treturn this._alphaTest;\n\n\t}\n\n\tset alphaTest( value ) {\n\n\t\tif ( this._alphaTest > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._alphaTest = value;\n\n\t}\n\n\tonBuild( /* shaderobject, renderer */ ) {}\n\n\tonBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}\n\n\tonBeforeCompile( /* shaderobject, renderer */ ) {}\n\n\tcustomProgramCacheKey() {\n\n\t\treturn this.onBeforeCompile.toString();\n\n\t}\n\n\tsetValues( values ) {\n\n\t\tif ( values === undefined ) return;\n\n\t\tfor ( const key in values ) {\n\n\t\t\tconst newValue = values[ key ];\n\n\t\t\tif ( newValue === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.Material: \\'' + key + '\\' parameter is undefined.' );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\t// for backward compatability if shading is set in the constructor\n\t\t\tif ( key === 'shading' ) {\n\n\t\t\t\tconsole.warn( 'THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.' );\n\t\t\t\tthis.flatShading = ( newValue === FlatShading ) ? true : false;\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tconst currentValue = this[ key ];\n\n\t\t\tif ( currentValue === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.' + this.type + ': \\'' + key + '\\' is not a property of this material.' );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( currentValue && currentValue.isColor ) {\n\n\t\t\t\tcurrentValue.set( newValue );\n\n\t\t\t} else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {\n\n\t\t\t\tcurrentValue.copy( newValue );\n\n\t\t\t} else {\n\n\t\t\t\tthis[ key ] = newValue;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst isRoot = ( meta === undefined || typeof meta === 'string' );\n\n\t\tif ( isRoot ) {\n\n\t\t\tmeta = {\n\t\t\t\ttextures: {},\n\t\t\t\timages: {}\n\t\t\t};\n\n\t\t}\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.5,\n\t\t\t\ttype: 'Material',\n\t\t\t\tgenerator: 'Material.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard Material serialization\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\n\t\tif ( this.color && this.color.isColor ) data.color = this.color.getHex();\n\n\t\tif ( this.roughness !== undefined ) data.roughness = this.roughness;\n\t\tif ( this.metalness !== undefined ) data.metalness = this.metalness;\n\n\t\tif ( this.sheen !== undefined ) data.sheen = this.sheen;\n\t\tif ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();\n\t\tif ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;\n\t\tif ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();\n\t\tif ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;\n\n\t\tif ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();\n\t\tif ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;\n\t\tif ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();\n\t\tif ( this.shininess !== undefined ) data.shininess = this.shininess;\n\t\tif ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;\n\t\tif ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;\n\n\t\tif ( this.clearcoatMap && this.clearcoatMap.isTexture ) {\n\n\t\t\tdata.clearcoatMap = this.clearcoatMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture ) {\n\n\t\t\tdata.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture ) {\n\n\t\t\tdata.clearcoatNormalMap = this.clearcoatNormalMap.toJSON( meta ).uuid;\n\t\t\tdata.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;\n\t\tif ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;\n\t\tif ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;\n\n\t\tif ( this.lightMap && this.lightMap.isTexture ) {\n\n\t\t\tdata.lightMap = this.lightMap.toJSON( meta ).uuid;\n\t\t\tdata.lightMapIntensity = this.lightMapIntensity;\n\n\t\t}\n\n\t\tif ( this.aoMap && this.aoMap.isTexture ) {\n\n\t\t\tdata.aoMap = this.aoMap.toJSON( meta ).uuid;\n\t\t\tdata.aoMapIntensity = this.aoMapIntensity;\n\n\t\t}\n\n\t\tif ( this.bumpMap && this.bumpMap.isTexture ) {\n\n\t\t\tdata.bumpMap = this.bumpMap.toJSON( meta ).uuid;\n\t\t\tdata.bumpScale = this.bumpScale;\n\n\t\t}\n\n\t\tif ( this.normalMap && this.normalMap.isTexture ) {\n\n\t\t\tdata.normalMap = this.normalMap.toJSON( meta ).uuid;\n\t\t\tdata.normalMapType = this.normalMapType;\n\t\t\tdata.normalScale = this.normalScale.toArray();\n\n\t\t}\n\n\t\tif ( this.displacementMap && this.displacementMap.isTexture ) {\n\n\t\t\tdata.displacementMap = this.displacementMap.toJSON( meta ).uuid;\n\t\t\tdata.displacementScale = this.displacementScale;\n\t\t\tdata.displacementBias = this.displacementBias;\n\n\t\t}\n\n\t\tif ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;\n\t\tif ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;\n\n\t\tif ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;\n\t\tif ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;\n\t\tif ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;\n\t\tif ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;\n\n\t\tif ( this.envMap && this.envMap.isTexture ) {\n\n\t\t\tdata.envMap = this.envMap.toJSON( meta ).uuid;\n\n\t\t\tif ( this.combine !== undefined ) data.combine = this.combine;\n\n\t\t}\n\n\t\tif ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;\n\t\tif ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;\n\t\tif ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;\n\n\t\tif ( this.gradientMap && this.gradientMap.isTexture ) {\n\n\t\t\tdata.gradientMap = this.gradientMap.toJSON( meta ).uuid;\n\n\t\t}\n\n\t\tif ( this.transmission !== undefined ) data.transmission = this.transmission;\n\t\tif ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;\n\t\tif ( this.thickness !== undefined ) data.thickness = this.thickness;\n\t\tif ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;\n\t\tif ( this.attenuationDistance !== undefined ) data.attenuationDistance = this.attenuationDistance;\n\t\tif ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();\n\n\t\tif ( this.size !== undefined ) data.size = this.size;\n\t\tif ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;\n\t\tif ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;\n\n\t\tif ( this.blending !== NormalBlending ) data.blending = this.blending;\n\t\tif ( this.side !== FrontSide ) data.side = this.side;\n\t\tif ( this.vertexColors ) data.vertexColors = true;\n\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\n\t\tif ( this.format !== RGBAFormat ) data.format = this.format;\n\t\tif ( this.transparent === true ) data.transparent = this.transparent;\n\n\t\tdata.depthFunc = this.depthFunc;\n\t\tdata.depthTest = this.depthTest;\n\t\tdata.depthWrite = this.depthWrite;\n\t\tdata.colorWrite = this.colorWrite;\n\n\t\tdata.stencilWrite = this.stencilWrite;\n\t\tdata.stencilWriteMask = this.stencilWriteMask;\n\t\tdata.stencilFunc = this.stencilFunc;\n\t\tdata.stencilRef = this.stencilRef;\n\t\tdata.stencilFuncMask = this.stencilFuncMask;\n\t\tdata.stencilFail = this.stencilFail;\n\t\tdata.stencilZFail = this.stencilZFail;\n\t\tdata.stencilZPass = this.stencilZPass;\n\n\t\t// rotation (SpriteMaterial)\n\t\tif ( this.rotation && this.rotation !== 0 ) data.rotation = this.rotation;\n\n\t\tif ( this.polygonOffset === true ) data.polygonOffset = true;\n\t\tif ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;\n\t\tif ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;\n\n\t\tif ( this.linewidth && this.linewidth !== 1 ) data.linewidth = this.linewidth;\n\t\tif ( this.dashSize !== undefined ) data.dashSize = this.dashSize;\n\t\tif ( this.gapSize !== undefined ) data.gapSize = this.gapSize;\n\t\tif ( this.scale !== undefined ) data.scale = this.scale;\n\n\t\tif ( this.dithering === true ) data.dithering = true;\n\n\t\tif ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;\n\t\tif ( this.alphaToCoverage === true ) data.alphaToCoverage = this.alphaToCoverage;\n\t\tif ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha;\n\n\t\tif ( this.wireframe === true ) data.wireframe = this.wireframe;\n\t\tif ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;\n\t\tif ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;\n\t\tif ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;\n\n\t\tif ( this.flatShading === true ) data.flatShading = this.flatShading;\n\n\t\tif ( this.visible === false ) data.visible = false;\n\n\t\tif ( this.toneMapped === false ) data.toneMapped = false;\n\n\t\tif ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;\n\n\t\t// TODO: Copied from Object3D.toJSON\n\n\t\tfunction extractFromCache( cache ) {\n\n\t\t\tconst values = [];\n\n\t\t\tfor ( const key in cache ) {\n\n\t\t\t\tconst data = cache[ key ];\n\t\t\t\tdelete data.metadata;\n\t\t\t\tvalues.push( data );\n\n\t\t\t}\n\n\t\t\treturn values;\n\n\t\t}\n\n\t\tif ( isRoot ) {\n\n\t\t\tconst textures = extractFromCache( meta.textures );\n\t\t\tconst images = extractFromCache( meta.images );\n\n\t\t\tif ( textures.length > 0 ) data.textures = textures;\n\t\t\tif ( images.length > 0 ) data.images = images;\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\n\t\tthis.fog = source.fog;\n\n\t\tthis.blending = source.blending;\n\t\tthis.side = source.side;\n\t\tthis.vertexColors = source.vertexColors;\n\n\t\tthis.opacity = source.opacity;\n\t\tthis.format = source.format;\n\t\tthis.transparent = source.transparent;\n\n\t\tthis.blendSrc = source.blendSrc;\n\t\tthis.blendDst = source.blendDst;\n\t\tthis.blendEquation = source.blendEquation;\n\t\tthis.blendSrcAlpha = source.blendSrcAlpha;\n\t\tthis.blendDstAlpha = source.blendDstAlpha;\n\t\tthis.blendEquationAlpha = source.blendEquationAlpha;\n\n\t\tthis.depthFunc = source.depthFunc;\n\t\tthis.depthTest = source.depthTest;\n\t\tthis.depthWrite = source.depthWrite;\n\n\t\tthis.stencilWriteMask = source.stencilWriteMask;\n\t\tthis.stencilFunc = source.stencilFunc;\n\t\tthis.stencilRef = source.stencilRef;\n\t\tthis.stencilFuncMask = source.stencilFuncMask;\n\t\tthis.stencilFail = source.stencilFail;\n\t\tthis.stencilZFail = source.stencilZFail;\n\t\tthis.stencilZPass = source.stencilZPass;\n\t\tthis.stencilWrite = source.stencilWrite;\n\n\t\tconst srcPlanes = source.clippingPlanes;\n\t\tlet dstPlanes = null;\n\n\t\tif ( srcPlanes !== null ) {\n\n\t\t\tconst n = srcPlanes.length;\n\t\t\tdstPlanes = new Array( n );\n\n\t\t\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\t\t\tdstPlanes[ i ] = srcPlanes[ i ].clone();\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.clippingPlanes = dstPlanes;\n\t\tthis.clipIntersection = source.clipIntersection;\n\t\tthis.clipShadows = source.clipShadows;\n\n\t\tthis.shadowSide = source.shadowSide;\n\n\t\tthis.colorWrite = source.colorWrite;\n\n\t\tthis.precision = source.precision;\n\n\t\tthis.polygonOffset = source.polygonOffset;\n\t\tthis.polygonOffsetFactor = source.polygonOffsetFactor;\n\t\tthis.polygonOffsetUnits = source.polygonOffsetUnits;\n\n\t\tthis.dithering = source.dithering;\n\n\t\tthis.alphaTest = source.alphaTest;\n\t\tthis.alphaToCoverage = source.alphaToCoverage;\n\t\tthis.premultipliedAlpha = source.premultipliedAlpha;\n\n\t\tthis.visible = source.visible;\n\n\t\tthis.toneMapped = source.toneMapped;\n\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n}\n\nMaterial.prototype.isMaterial = true;\n\nconst _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,\n\t'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,\n\t'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,\n\t'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,\n\t'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,\n\t'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,\n\t'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,\n\t'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,\n\t'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,\n\t'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,\n\t'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,\n\t'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,\n\t'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,\n\t'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,\n\t'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,\n\t'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,\n\t'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,\n\t'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,\n\t'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,\n\t'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'rebeccapurple': 0x663399, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,\n\t'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,\n\t'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,\n\t'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,\n\t'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };\n\nconst _hslA = { h: 0, s: 0, l: 0 };\nconst _hslB = { h: 0, s: 0, l: 0 };\n\nfunction hue2rgb( p, q, t ) {\n\n\tif ( t < 0 ) t += 1;\n\tif ( t > 1 ) t -= 1;\n\tif ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\n\tif ( t < 1 / 2 ) return q;\n\tif ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );\n\treturn p;\n\n}\n\nfunction SRGBToLinear( c ) {\n\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n\n}\n\nfunction LinearToSRGB( c ) {\n\n\treturn ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;\n\n}\n\nclass Color {\n\n\tconstructor( r, g, b ) {\n\n\t\tif ( g === undefined && b === undefined ) {\n\n\t\t\t// r is THREE.Color, hex or string\n\t\t\treturn this.set( r );\n\n\t\t}\n\n\t\treturn this.setRGB( r, g, b );\n\n\t}\n\n\tset( value ) {\n\n\t\tif ( value && value.isColor ) {\n\n\t\t\tthis.copy( value );\n\n\t\t} else if ( typeof value === 'number' ) {\n\n\t\t\tthis.setHex( value );\n\n\t\t} else if ( typeof value === 'string' ) {\n\n\t\t\tthis.setStyle( value );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetScalar( scalar ) {\n\n\t\tthis.r = scalar;\n\t\tthis.g = scalar;\n\t\tthis.b = scalar;\n\n\t\treturn this;\n\n\t}\n\n\tsetHex( hex ) {\n\n\t\thex = Math.floor( hex );\n\n\t\tthis.r = ( hex >> 16 & 255 ) / 255;\n\t\tthis.g = ( hex >> 8 & 255 ) / 255;\n\t\tthis.b = ( hex & 255 ) / 255;\n\n\t\treturn this;\n\n\t}\n\n\tsetRGB( r, g, b ) {\n\n\t\tthis.r = r;\n\t\tthis.g = g;\n\t\tthis.b = b;\n\n\t\treturn this;\n\n\t}\n\n\tsetHSL( h, s, l ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\t\th = euclideanModulo( h, 1 );\n\t\ts = clamp( s, 0, 1 );\n\t\tl = clamp( l, 0, 1 );\n\n\t\tif ( s === 0 ) {\n\n\t\t\tthis.r = this.g = this.b = l;\n\n\t\t} else {\n\n\t\t\tconst p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );\n\t\t\tconst q = ( 2 * l ) - p;\n\n\t\t\tthis.r = hue2rgb( q, p, h + 1 / 3 );\n\t\t\tthis.g = hue2rgb( q, p, h );\n\t\t\tthis.b = hue2rgb( q, p, h - 1 / 3 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetStyle( style ) {\n\n\t\tfunction handleAlpha( string ) {\n\n\t\t\tif ( string === undefined ) return;\n\n\t\t\tif ( parseFloat( string ) < 1 ) {\n\n\t\t\t\tconsole.warn( 'THREE.Color: Alpha component of ' + style + ' will be ignored.' );\n\n\t\t\t}\n\n\t\t}\n\n\n\t\tlet m;\n\n\t\tif ( m = /^((?:rgb|hsl)a?)\\(([^\\)]*)\\)/.exec( style ) ) {\n\n\t\t\t// rgb / hsl\n\n\t\t\tlet color;\n\t\t\tconst name = m[ 1 ];\n\t\t\tconst components = m[ 2 ];\n\n\t\t\tswitch ( name ) {\n\n\t\t\t\tcase 'rgb':\n\t\t\t\tcase 'rgba':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(255,0,0) rgba(255,0,0,0.5)\n\t\t\t\t\t\tthis.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255;\n\t\t\t\t\t\tthis.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255;\n\t\t\t\t\t\tthis.b = Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255;\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( color = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\n\t\t\t\t\t\tthis.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100;\n\t\t\t\t\t\tthis.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100;\n\t\t\t\t\t\tthis.b = Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100;\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'hsl':\n\t\t\t\tcase 'hsla':\n\n\t\t\t\t\tif ( color = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec( components ) ) {\n\n\t\t\t\t\t\t// hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n\t\t\t\t\t\tconst h = parseFloat( color[ 1 ] ) / 360;\n\t\t\t\t\t\tconst s = parseInt( color[ 2 ], 10 ) / 100;\n\t\t\t\t\t\tconst l = parseInt( color[ 3 ], 10 ) / 100;\n\n\t\t\t\t\t\thandleAlpha( color[ 4 ] );\n\n\t\t\t\t\t\treturn this.setHSL( h, s, l );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t} else if ( m = /^\\#([A-Fa-f\\d]+)$/.exec( style ) ) {\n\n\t\t\t// hex color\n\n\t\t\tconst hex = m[ 1 ];\n\t\t\tconst size = hex.length;\n\n\t\t\tif ( size === 3 ) {\n\n\t\t\t\t// #ff0\n\t\t\t\tthis.r = parseInt( hex.charAt( 0 ) + hex.charAt( 0 ), 16 ) / 255;\n\t\t\t\tthis.g = parseInt( hex.charAt( 1 ) + hex.charAt( 1 ), 16 ) / 255;\n\t\t\t\tthis.b = parseInt( hex.charAt( 2 ) + hex.charAt( 2 ), 16 ) / 255;\n\n\t\t\t\treturn this;\n\n\t\t\t} else if ( size === 6 ) {\n\n\t\t\t\t// #ff0000\n\t\t\t\tthis.r = parseInt( hex.charAt( 0 ) + hex.charAt( 1 ), 16 ) / 255;\n\t\t\t\tthis.g = parseInt( hex.charAt( 2 ) + hex.charAt( 3 ), 16 ) / 255;\n\t\t\t\tthis.b = parseInt( hex.charAt( 4 ) + hex.charAt( 5 ), 16 ) / 255;\n\n\t\t\t\treturn this;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( style && style.length > 0 ) {\n\n\t\t\treturn this.setColorName( style );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetColorName( style ) {\n\n\t\t// color keywords\n\t\tconst hex = _colorKeywords[ style.toLowerCase() ];\n\n\t\tif ( hex !== undefined ) {\n\n\t\t\t// red\n\t\t\tthis.setHex( hex );\n\n\t\t} else {\n\n\t\t\t// unknown color\n\t\t\tconsole.warn( 'THREE.Color: Unknown color ' + style );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.r, this.g, this.b );\n\n\t}\n\n\tcopy( color ) {\n\n\t\tthis.r = color.r;\n\t\tthis.g = color.g;\n\t\tthis.b = color.b;\n\n\t\treturn this;\n\n\t}\n\n\tcopyGammaToLinear( color, gammaFactor = 2.0 ) {\n\n\t\tthis.r = Math.pow( color.r, gammaFactor );\n\t\tthis.g = Math.pow( color.g, gammaFactor );\n\t\tthis.b = Math.pow( color.b, gammaFactor );\n\n\t\treturn this;\n\n\t}\n\n\tcopyLinearToGamma( color, gammaFactor = 2.0 ) {\n\n\t\tconst safeInverse = ( gammaFactor > 0 ) ? ( 1.0 / gammaFactor ) : 1.0;\n\n\t\tthis.r = Math.pow( color.r, safeInverse );\n\t\tthis.g = Math.pow( color.g, safeInverse );\n\t\tthis.b = Math.pow( color.b, safeInverse );\n\n\t\treturn this;\n\n\t}\n\n\tconvertGammaToLinear( gammaFactor ) {\n\n\t\tthis.copyGammaToLinear( this, gammaFactor );\n\n\t\treturn this;\n\n\t}\n\n\tconvertLinearToGamma( gammaFactor ) {\n\n\t\tthis.copyLinearToGamma( this, gammaFactor );\n\n\t\treturn this;\n\n\t}\n\n\tcopySRGBToLinear( color ) {\n\n\t\tthis.r = SRGBToLinear( color.r );\n\t\tthis.g = SRGBToLinear( color.g );\n\t\tthis.b = SRGBToLinear( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tcopyLinearToSRGB( color ) {\n\n\t\tthis.r = LinearToSRGB( color.r );\n\t\tthis.g = LinearToSRGB( color.g );\n\t\tthis.b = LinearToSRGB( color.b );\n\n\t\treturn this;\n\n\t}\n\n\tconvertSRGBToLinear() {\n\n\t\tthis.copySRGBToLinear( this );\n\n\t\treturn this;\n\n\t}\n\n\tconvertLinearToSRGB() {\n\n\t\tthis.copyLinearToSRGB( this );\n\n\t\treturn this;\n\n\t}\n\n\tgetHex() {\n\n\t\treturn ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0;\n\n\t}\n\n\tgetHexString() {\n\n\t\treturn ( '000000' + this.getHex().toString( 16 ) ).slice( - 6 );\n\n\t}\n\n\tgetHSL( target ) {\n\n\t\t// h,s,l ranges are in 0.0 - 1.0\n\n\t\tconst r = this.r, g = this.g, b = this.b;\n\n\t\tconst max = Math.max( r, g, b );\n\t\tconst min = Math.min( r, g, b );\n\n\t\tlet hue, saturation;\n\t\tconst lightness = ( min + max ) / 2.0;\n\n\t\tif ( min === max ) {\n\n\t\t\thue = 0;\n\t\t\tsaturation = 0;\n\n\t\t} else {\n\n\t\t\tconst delta = max - min;\n\n\t\t\tsaturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );\n\n\t\t\tswitch ( max ) {\n\n\t\t\t\tcase r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;\n\t\t\t\tcase g: hue = ( b - r ) / delta + 2; break;\n\t\t\t\tcase b: hue = ( r - g ) / delta + 4; break;\n\n\t\t\t}\n\n\t\t\thue /= 6;\n\n\t\t}\n\n\t\ttarget.h = hue;\n\t\ttarget.s = saturation;\n\t\ttarget.l = lightness;\n\n\t\treturn target;\n\n\t}\n\n\tgetStyle() {\n\n\t\treturn 'rgb(' + ( ( this.r * 255 ) | 0 ) + ',' + ( ( this.g * 255 ) | 0 ) + ',' + ( ( this.b * 255 ) | 0 ) + ')';\n\n\t}\n\n\toffsetHSL( h, s, l ) {\n\n\t\tthis.getHSL( _hslA );\n\n\t\t_hslA.h += h; _hslA.s += s; _hslA.l += l;\n\n\t\tthis.setHSL( _hslA.h, _hslA.s, _hslA.l );\n\n\t\treturn this;\n\n\t}\n\n\tadd( color ) {\n\n\t\tthis.r += color.r;\n\t\tthis.g += color.g;\n\t\tthis.b += color.b;\n\n\t\treturn this;\n\n\t}\n\n\taddColors( color1, color2 ) {\n\n\t\tthis.r = color1.r + color2.r;\n\t\tthis.g = color1.g + color2.g;\n\t\tthis.b = color1.b + color2.b;\n\n\t\treturn this;\n\n\t}\n\n\taddScalar( s ) {\n\n\t\tthis.r += s;\n\t\tthis.g += s;\n\t\tthis.b += s;\n\n\t\treturn this;\n\n\t}\n\n\tsub( color ) {\n\n\t\tthis.r = Math.max( 0, this.r - color.r );\n\t\tthis.g = Math.max( 0, this.g - color.g );\n\t\tthis.b = Math.max( 0, this.b - color.b );\n\n\t\treturn this;\n\n\t}\n\n\tmultiply( color ) {\n\n\t\tthis.r *= color.r;\n\t\tthis.g *= color.g;\n\t\tthis.b *= color.b;\n\n\t\treturn this;\n\n\t}\n\n\tmultiplyScalar( s ) {\n\n\t\tthis.r *= s;\n\t\tthis.g *= s;\n\t\tthis.b *= s;\n\n\t\treturn this;\n\n\t}\n\n\tlerp( color, alpha ) {\n\n\t\tthis.r += ( color.r - this.r ) * alpha;\n\t\tthis.g += ( color.g - this.g ) * alpha;\n\t\tthis.b += ( color.b - this.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpColors( color1, color2, alpha ) {\n\n\t\tthis.r = color1.r + ( color2.r - color1.r ) * alpha;\n\t\tthis.g = color1.g + ( color2.g - color1.g ) * alpha;\n\t\tthis.b = color1.b + ( color2.b - color1.b ) * alpha;\n\n\t\treturn this;\n\n\t}\n\n\tlerpHSL( color, alpha ) {\n\n\t\tthis.getHSL( _hslA );\n\t\tcolor.getHSL( _hslB );\n\n\t\tconst h = lerp( _hslA.h, _hslB.h, alpha );\n\t\tconst s = lerp( _hslA.s, _hslB.s, alpha );\n\t\tconst l = lerp( _hslA.l, _hslB.l, alpha );\n\n\t\tthis.setHSL( h, s, l );\n\n\t\treturn this;\n\n\t}\n\n\tequals( c ) {\n\n\t\treturn ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tthis.r = array[ offset ];\n\t\tthis.g = array[ offset + 1 ];\n\t\tthis.b = array[ offset + 2 ];\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tarray[ offset ] = this.r;\n\t\tarray[ offset + 1 ] = this.g;\n\t\tarray[ offset + 2 ] = this.b;\n\n\t\treturn array;\n\n\t}\n\n\tfromBufferAttribute( attribute, index ) {\n\n\t\tthis.r = attribute.getX( index );\n\t\tthis.g = attribute.getY( index );\n\t\tthis.b = attribute.getZ( index );\n\n\t\tif ( attribute.normalized === true ) {\n\n\t\t\t// assuming Uint8Array\n\n\t\t\tthis.r /= 255;\n\t\t\tthis.g /= 255;\n\t\t\tthis.b /= 255;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.getHex();\n\n\t}\n\n}\n\nColor.NAMES = _colorKeywords;\n\nColor.prototype.isColor = true;\nColor.prototype.r = 1;\nColor.prototype.g = 1;\nColor.prototype.b = 1;\n\n/**\n * parameters = {\n * color: <hex>,\n * opacity: <float>,\n * map: new THREE.Texture( <Image> ),\n *\n * lightMap: new THREE.Texture( <Image> ),\n * lightMapIntensity: <float>\n *\n * aoMap: new THREE.Texture( <Image> ),\n * aoMapIntensity: <float>\n *\n * specularMap: new THREE.Texture( <Image> ),\n *\n * alphaMap: new THREE.Texture( <Image> ),\n *\n * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),\n * combine: THREE.Multiply,\n * reflectivity: <float>,\n * refractionRatio: <float>,\n *\n * depthTest: <bool>,\n * depthWrite: <bool>,\n *\n * wireframe: <boolean>,\n * wireframeLinewidth: <float>,\n * }\n */\n\nclass MeshBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'MeshBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // emissive\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\treturn this;\n\n\t}\n\n}\n\nMeshBasicMaterial.prototype.isMeshBasicMaterial = true;\n\nconst _vector$9 = /*@__PURE__*/ new Vector3();\nconst _vector2$1 = /*@__PURE__*/ new Vector2();\n\nclass BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tif ( Array.isArray( array ) ) {\n\n\t\t\tthrow new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );\n\n\t\t}\n\n\t\tthis.name = '';\n\n\t\tthis.array = array;\n\t\tthis.itemSize = itemSize;\n\t\tthis.count = array !== undefined ? array.length / itemSize : 0;\n\t\tthis.normalized = normalized === true;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.updateRange = { offset: 0, count: - 1 };\n\n\t\tthis.version = 0;\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.name = source.name;\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.itemSize = source.itemSize;\n\t\tthis.count = source.count;\n\t\tthis.normalized = source.normalized;\n\n\t\tthis.usage = source.usage;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.itemSize;\n\t\tindex2 *= attribute.itemSize;\n\n\t\tfor ( let i = 0, l = this.itemSize; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcopyArray( array ) {\n\n\t\tthis.array.set( array );\n\n\t\treturn this;\n\n\t}\n\n\tcopyColorsArray( colors ) {\n\n\t\tconst array = this.array;\n\t\tlet offset = 0;\n\n\t\tfor ( let i = 0, l = colors.length; i < l; i ++ ) {\n\n\t\t\tlet color = colors[ i ];\n\n\t\t\tif ( color === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.BufferAttribute.copyColorsArray(): color is undefined', i );\n\t\t\t\tcolor = new Color();\n\n\t\t\t}\n\n\t\t\tarray[ offset ++ ] = color.r;\n\t\t\tarray[ offset ++ ] = color.g;\n\t\t\tarray[ offset ++ ] = color.b;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcopyVector2sArray( vectors ) {\n\n\t\tconst array = this.array;\n\t\tlet offset = 0;\n\n\t\tfor ( let i = 0, l = vectors.length; i < l; i ++ ) {\n\n\t\t\tlet vector = vectors[ i ];\n\n\t\t\tif ( vector === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i );\n\t\t\t\tvector = new Vector2();\n\n\t\t\t}\n\n\t\t\tarray[ offset ++ ] = vector.x;\n\t\t\tarray[ offset ++ ] = vector.y;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcopyVector3sArray( vectors ) {\n\n\t\tconst array = this.array;\n\t\tlet offset = 0;\n\n\t\tfor ( let i = 0, l = vectors.length; i < l; i ++ ) {\n\n\t\t\tlet vector = vectors[ i ];\n\n\t\t\tif ( vector === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i );\n\t\t\t\tvector = new Vector3();\n\n\t\t\t}\n\n\t\t\tarray[ offset ++ ] = vector.x;\n\t\t\tarray[ offset ++ ] = vector.y;\n\t\t\tarray[ offset ++ ] = vector.z;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcopyVector4sArray( vectors ) {\n\n\t\tconst array = this.array;\n\t\tlet offset = 0;\n\n\t\tfor ( let i = 0, l = vectors.length; i < l; i ++ ) {\n\n\t\t\tlet vector = vectors[ i ];\n\n\t\t\tif ( vector === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i );\n\t\t\t\tvector = new Vector4();\n\n\t\t\t}\n\n\t\t\tarray[ offset ++ ] = vector.x;\n\t\t\tarray[ offset ++ ] = vector.y;\n\t\t\tarray[ offset ++ ] = vector.z;\n\t\t\tarray[ offset ++ ] = vector.w;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix3( m ) {\n\n\t\tif ( this.itemSize === 2 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector2$1.fromBufferAttribute( this, i );\n\t\t\t\t_vector2$1.applyMatrix3( m );\n\n\t\t\t\tthis.setXY( i, _vector2$1.x, _vector2$1.y );\n\n\t\t\t}\n\n\t\t} else if ( this.itemSize === 3 ) {\n\n\t\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t\t_vector$9.fromBufferAttribute( this, i );\n\t\t\t\t_vector$9.applyMatrix3( m );\n\n\t\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$9.x = this.getX( i );\n\t\t\t_vector$9.y = this.getY( i );\n\t\t\t_vector$9.z = this.getZ( i );\n\n\t\t\t_vector$9.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$9.x = this.getX( i );\n\t\t\t_vector$9.y = this.getY( i );\n\t\t\t_vector$9.z = this.getZ( i );\n\n\t\t\t_vector$9.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$9.x = this.getX( i );\n\t\t\t_vector$9.y = this.getY( i );\n\t\t\t_vector$9.z = this.getZ( i );\n\n\t\t\t_vector$9.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\treturn this.array[ index * this.itemSize ];\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tthis.array[ index * this.itemSize ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tgetY( index ) {\n\n\t\treturn this.array[ index * this.itemSize + 1 ];\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tthis.array[ index * this.itemSize + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tgetZ( index ) {\n\n\t\treturn this.array[ index * this.itemSize + 2 ];\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tthis.array[ index * this.itemSize + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tgetW( index ) {\n\n\t\treturn this.array[ index * this.itemSize + 3 ];\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tthis.array[ index * this.itemSize + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex *= this.itemSize;\n\n\t\tthis.array[ index + 0 ] = x;\n\t\tthis.array[ index + 1 ] = y;\n\t\tthis.array[ index + 2 ] = z;\n\t\tthis.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.array, this.itemSize ).copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\titemSize: this.itemSize,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tarray: Array.prototype.slice.call( this.array ),\n\t\t\tnormalized: this.normalized\n\t\t};\n\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( this.usage !== StaticDrawUsage ) data.usage = this.usage;\n\t\tif ( this.updateRange.offset !== 0 || this.updateRange.count !== - 1 ) data.updateRange = this.updateRange;\n\n\t\treturn data;\n\n\t}\n\n}\n\nBufferAttribute.prototype.isBufferAttribute = true;\n\n//\n\nclass Int8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint8ClampedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint8ClampedArray( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Int32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Int32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Uint32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float16BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Uint16Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nFloat16BufferAttribute.prototype.isFloat16BufferAttribute = true;\n\nclass Float32BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float32Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nclass Float64BufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized ) {\n\n\t\tsuper( new Float64Array( array ), itemSize, normalized );\n\n\t}\n\n}\n\nlet _id = 0;\n\nconst _m1 = /*@__PURE__*/ new Matrix4();\nconst _obj = /*@__PURE__*/ new Object3D();\nconst _offset = /*@__PURE__*/ new Vector3();\nconst _box$1 = /*@__PURE__*/ new Box3();\nconst _boxMorphTargets = /*@__PURE__*/ new Box3();\nconst _vector$8 = /*@__PURE__*/ new Vector3();\n\nclass BufferGeometry extends EventDispatcher {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tObject.defineProperty( this, 'id', { value: _id ++ } );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.name = '';\n\t\tthis.type = 'BufferGeometry';\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\n\t\tthis.morphAttributes = {};\n\t\tthis.morphTargetsRelative = false;\n\n\t\tthis.groups = [];\n\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\tthis.drawRange = { start: 0, count: Infinity };\n\n\t\tthis.userData = {};\n\n\t}\n\n\tgetIndex() {\n\n\t\treturn this.index;\n\n\t}\n\n\tsetIndex( index ) {\n\n\t\tif ( Array.isArray( index ) ) {\n\n\t\t\tthis.index = new ( arrayMax( index ) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );\n\n\t\t} else {\n\n\t\t\tthis.index = index;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetAttribute( name ) {\n\n\t\treturn this.attributes[ name ];\n\n\t}\n\n\tsetAttribute( name, attribute ) {\n\n\t\tthis.attributes[ name ] = attribute;\n\n\t\treturn this;\n\n\t}\n\n\tdeleteAttribute( name ) {\n\n\t\tdelete this.attributes[ name ];\n\n\t\treturn this;\n\n\t}\n\n\thasAttribute( name ) {\n\n\t\treturn this.attributes[ name ] !== undefined;\n\n\t}\n\n\taddGroup( start, count, materialIndex = 0 ) {\n\n\t\tthis.groups.push( {\n\n\t\t\tstart: start,\n\t\t\tcount: count,\n\t\t\tmaterialIndex: materialIndex\n\n\t\t} );\n\n\t}\n\n\tclearGroups() {\n\n\t\tthis.groups = [];\n\n\t}\n\n\tsetDrawRange( start, count ) {\n\n\t\tthis.drawRange.start = start;\n\t\tthis.drawRange.count = count;\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tconst position = this.attributes.position;\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tposition.applyMatrix4( matrix );\n\n\t\t\tposition.needsUpdate = true;\n\n\t\t}\n\n\t\tconst normal = this.attributes.normal;\n\n\t\tif ( normal !== undefined ) {\n\n\t\t\tconst normalMatrix = new Matrix3().getNormalMatrix( matrix );\n\n\t\t\tnormal.applyNormalMatrix( normalMatrix );\n\n\t\t\tnormal.needsUpdate = true;\n\n\t\t}\n\n\t\tconst tangent = this.attributes.tangent;\n\n\t\tif ( tangent !== undefined ) {\n\n\t\t\ttangent.transformDirection( matrix );\n\n\t\t\ttangent.needsUpdate = true;\n\n\t\t}\n\n\t\tif ( this.boundingBox !== null ) {\n\n\t\t\tthis.computeBoundingBox();\n\n\t\t}\n\n\t\tif ( this.boundingSphere !== null ) {\n\n\t\t\tthis.computeBoundingSphere();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyQuaternion( q ) {\n\n\t\t_m1.makeRotationFromQuaternion( q );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateX( angle ) {\n\n\t\t// rotate geometry around world x-axis\n\n\t\t_m1.makeRotationX( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateY( angle ) {\n\n\t\t// rotate geometry around world y-axis\n\n\t\t_m1.makeRotationY( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\trotateZ( angle ) {\n\n\t\t// rotate geometry around world z-axis\n\n\t\t_m1.makeRotationZ( angle );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( x, y, z ) {\n\n\t\t// translate geometry\n\n\t\t_m1.makeTranslation( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\tscale( x, y, z ) {\n\n\t\t// scale geometry\n\n\t\t_m1.makeScale( x, y, z );\n\n\t\tthis.applyMatrix4( _m1 );\n\n\t\treturn this;\n\n\t}\n\n\tlookAt( vector ) {\n\n\t\t_obj.lookAt( vector );\n\n\t\t_obj.updateMatrix();\n\n\t\tthis.applyMatrix4( _obj.matrix );\n\n\t\treturn this;\n\n\t}\n\n\tcenter() {\n\n\t\tthis.computeBoundingBox();\n\n\t\tthis.boundingBox.getCenter( _offset ).negate();\n\n\t\tthis.translate( _offset.x, _offset.y, _offset.z );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tconst position = [];\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tconst point = points[ i ];\n\t\t\tposition.push( point.x, point.y, point.z || 0 );\n\n\t\t}\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );\n\n\t\treturn this;\n\n\t}\n\n\tcomputeBoundingBox() {\n\n\t\tif ( this.boundingBox === null ) {\n\n\t\t\tthis.boundingBox = new Box3();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set \"mesh.frustumCulled\" to \"false\".', this );\n\n\t\t\tthis.boundingBox.set(\n\t\t\t\tnew Vector3( - Infinity, - Infinity, - Infinity ),\n\t\t\t\tnew Vector3( + Infinity, + Infinity, + Infinity )\n\t\t\t);\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position !== undefined ) {\n\n\t\t\tthis.boundingBox.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_box$1.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.min, _box$1.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\n\n\t\t\t\t\t\t_vector$8.addVectors( this.boundingBox.max, _box$1.max );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _vector$8 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$1.min );\n\t\t\t\t\t\tthis.boundingBox.expandByPoint( _box$1.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tthis.boundingBox.makeEmpty();\n\n\t\t}\n\n\t\tif ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t}\n\n\t}\n\n\tcomputeBoundingSphere() {\n\n\t\tif ( this.boundingSphere === null ) {\n\n\t\t\tthis.boundingSphere = new Sphere();\n\n\t\t}\n\n\t\tconst position = this.attributes.position;\n\t\tconst morphAttributesPosition = this.morphAttributes.position;\n\n\t\tif ( position && position.isGLBufferAttribute ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set \"mesh.frustumCulled\" to \"false\".', this );\n\n\t\t\tthis.boundingSphere.set( new Vector3(), Infinity );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( position ) {\n\n\t\t\t// first, find the center of the bounding sphere\n\n\t\t\tconst center = this.boundingSphere.center;\n\n\t\t\t_box$1.setFromBufferAttribute( position );\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\t_boxMorphTargets.setFromBufferAttribute( morphAttribute );\n\n\t\t\t\t\tif ( this.morphTargetsRelative ) {\n\n\t\t\t\t\t\t_vector$8.addVectors( _box$1.min, _boxMorphTargets.min );\n\t\t\t\t\t\t_box$1.expandByPoint( _vector$8 );\n\n\t\t\t\t\t\t_vector$8.addVectors( _box$1.max, _boxMorphTargets.max );\n\t\t\t\t\t\t_box$1.expandByPoint( _vector$8 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t_box$1.expandByPoint( _boxMorphTargets.min );\n\t\t\t\t\t\t_box$1.expandByPoint( _boxMorphTargets.max );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t_box$1.getCenter( center );\n\n\t\t\t// second, try to find a boundingSphere with a radius smaller than the\n\t\t\t// boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n\n\t\t\tlet maxRadiusSq = 0;\n\n\t\t\tfor ( let i = 0, il = position.count; i < il; i ++ ) {\n\n\t\t\t\t_vector$8.fromBufferAttribute( position, i );\n\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\n\n\t\t\t}\n\n\t\t\t// process morph attributes if present\n\n\t\t\tif ( morphAttributesPosition ) {\n\n\t\t\t\tfor ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst morphAttribute = morphAttributesPosition[ i ];\n\t\t\t\t\tconst morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t\t\t\tfor ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {\n\n\t\t\t\t\t\t_vector$8.fromBufferAttribute( morphAttribute, j );\n\n\t\t\t\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t\t\t\t_offset.fromBufferAttribute( position, j );\n\t\t\t\t\t\t\t_vector$8.add( _offset );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\n\n\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\n\n\t\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeTangents() {\n\n\t\tconst index = this.index;\n\t\tconst attributes = this.attributes;\n\n\t\t// based on http://www.terathon.com/code/tangent.html\n\t\t// (per vertex tangents)\n\n\t\tif ( index === null ||\n\t\t\t attributes.position === undefined ||\n\t\t\t attributes.normal === undefined ||\n\t\t\t attributes.uv === undefined ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst indices = index.array;\n\t\tconst positions = attributes.position.array;\n\t\tconst normals = attributes.normal.array;\n\t\tconst uvs = attributes.uv.array;\n\n\t\tconst nVertices = positions.length / 3;\n\n\t\tif ( attributes.tangent === undefined ) {\n\n\t\t\tthis.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );\n\n\t\t}\n\n\t\tconst tangents = attributes.tangent.array;\n\n\t\tconst tan1 = [], tan2 = [];\n\n\t\tfor ( let i = 0; i < nVertices; i ++ ) {\n\n\t\t\ttan1[ i ] = new Vector3();\n\t\t\ttan2[ i ] = new Vector3();\n\n\t\t}\n\n\t\tconst vA = new Vector3(),\n\t\t\tvB = new Vector3(),\n\t\t\tvC = new Vector3(),\n\n\t\t\tuvA = new Vector2(),\n\t\t\tuvB = new Vector2(),\n\t\t\tuvC = new Vector2(),\n\n\t\t\tsdir = new Vector3(),\n\t\t\ttdir = new Vector3();\n\n\t\tfunction handleTriangle( a, b, c ) {\n\n\t\t\tvA.fromArray( positions, a * 3 );\n\t\t\tvB.fromArray( positions, b * 3 );\n\t\t\tvC.fromArray( positions, c * 3 );\n\n\t\t\tuvA.fromArray( uvs, a * 2 );\n\t\t\tuvB.fromArray( uvs, b * 2 );\n\t\t\tuvC.fromArray( uvs, c * 2 );\n\n\t\t\tvB.sub( vA );\n\t\t\tvC.sub( vA );\n\n\t\t\tuvB.sub( uvA );\n\t\t\tuvC.sub( uvA );\n\n\t\t\tconst r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y );\n\n\t\t\t// silently ignore degenerate uv triangles having coincident or colinear vertices\n\n\t\t\tif ( ! isFinite( r ) ) return;\n\n\t\t\tsdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r );\n\t\t\ttdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r );\n\n\t\t\ttan1[ a ].add( sdir );\n\t\t\ttan1[ b ].add( sdir );\n\t\t\ttan1[ c ].add( sdir );\n\n\t\t\ttan2[ a ].add( tdir );\n\t\t\ttan2[ b ].add( tdir );\n\t\t\ttan2[ c ].add( tdir );\n\n\t\t}\n\n\t\tlet groups = this.groups;\n\n\t\tif ( groups.length === 0 ) {\n\n\t\t\tgroups = [ {\n\t\t\t\tstart: 0,\n\t\t\t\tcount: indices.length\n\t\t\t} ];\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleTriangle(\n\t\t\t\t\tindices[ j + 0 ],\n\t\t\t\t\tindices[ j + 1 ],\n\t\t\t\t\tindices[ j + 2 ]\n\t\t\t\t);\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst tmp = new Vector3(), tmp2 = new Vector3();\n\t\tconst n = new Vector3(), n2 = new Vector3();\n\n\t\tfunction handleVertex( v ) {\n\n\t\t\tn.fromArray( normals, v * 3 );\n\t\t\tn2.copy( n );\n\n\t\t\tconst t = tan1[ v ];\n\n\t\t\t// Gram-Schmidt orthogonalize\n\n\t\t\ttmp.copy( t );\n\t\t\ttmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();\n\n\t\t\t// Calculate handedness\n\n\t\t\ttmp2.crossVectors( n2, t );\n\t\t\tconst test = tmp2.dot( tan2[ v ] );\n\t\t\tconst w = ( test < 0.0 ) ? - 1.0 : 1.0;\n\n\t\t\ttangents[ v * 4 ] = tmp.x;\n\t\t\ttangents[ v * 4 + 1 ] = tmp.y;\n\t\t\ttangents[ v * 4 + 2 ] = tmp.z;\n\t\t\ttangents[ v * 4 + 3 ] = w;\n\n\t\t}\n\n\t\tfor ( let i = 0, il = groups.length; i < il; ++ i ) {\n\n\t\t\tconst group = groups[ i ];\n\n\t\t\tconst start = group.start;\n\t\t\tconst count = group.count;\n\n\t\t\tfor ( let j = start, jl = start + count; j < jl; j += 3 ) {\n\n\t\t\t\thandleVertex( indices[ j + 0 ] );\n\t\t\t\thandleVertex( indices[ j + 1 ] );\n\t\t\t\thandleVertex( indices[ j + 2 ] );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcomputeVertexNormals() {\n\n\t\tconst index = this.index;\n\t\tconst positionAttribute = this.getAttribute( 'position' );\n\n\t\tif ( positionAttribute !== undefined ) {\n\n\t\t\tlet normalAttribute = this.getAttribute( 'normal' );\n\n\t\t\tif ( normalAttribute === undefined ) {\n\n\t\t\t\tnormalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );\n\t\t\t\tthis.setAttribute( 'normal', normalAttribute );\n\n\t\t\t} else {\n\n\t\t\t\t// reset existing normals to zero\n\n\t\t\t\tfor ( let i = 0, il = normalAttribute.count; i < il; i ++ ) {\n\n\t\t\t\t\tnormalAttribute.setXYZ( i, 0, 0, 0 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst pA = new Vector3(), pB = new Vector3(), pC = new Vector3();\n\t\t\tconst nA = new Vector3(), nB = new Vector3(), nC = new Vector3();\n\t\t\tconst cb = new Vector3(), ab = new Vector3();\n\n\t\t\t// indexed elements\n\n\t\t\tif ( index ) {\n\n\t\t\t\tfor ( let i = 0, il = index.count; i < il; i += 3 ) {\n\n\t\t\t\t\tconst vA = index.getX( i + 0 );\n\t\t\t\t\tconst vB = index.getX( i + 1 );\n\t\t\t\t\tconst vC = index.getX( i + 2 );\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, vA );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, vB );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, vC );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnA.fromBufferAttribute( normalAttribute, vA );\n\t\t\t\t\tnB.fromBufferAttribute( normalAttribute, vB );\n\t\t\t\t\tnC.fromBufferAttribute( normalAttribute, vC );\n\n\t\t\t\t\tnA.add( cb );\n\t\t\t\t\tnB.add( cb );\n\t\t\t\t\tnC.add( cb );\n\n\t\t\t\t\tnormalAttribute.setXYZ( vA, nA.x, nA.y, nA.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vB, nB.x, nB.y, nB.z );\n\t\t\t\t\tnormalAttribute.setXYZ( vC, nC.x, nC.y, nC.z );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed elements (unconnected triangle soup)\n\n\t\t\t\tfor ( let i = 0, il = positionAttribute.count; i < il; i += 3 ) {\n\n\t\t\t\t\tpA.fromBufferAttribute( positionAttribute, i + 0 );\n\t\t\t\t\tpB.fromBufferAttribute( positionAttribute, i + 1 );\n\t\t\t\t\tpC.fromBufferAttribute( positionAttribute, i + 2 );\n\n\t\t\t\t\tcb.subVectors( pC, pB );\n\t\t\t\t\tab.subVectors( pA, pB );\n\t\t\t\t\tcb.cross( ab );\n\n\t\t\t\t\tnormalAttribute.setXYZ( i + 0, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 1, cb.x, cb.y, cb.z );\n\t\t\t\t\tnormalAttribute.setXYZ( i + 2, cb.x, cb.y, cb.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.normalizeNormals();\n\n\t\t\tnormalAttribute.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tmerge( geometry, offset ) {\n\n\t\tif ( ! ( geometry && geometry.isBufferGeometry ) ) {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( offset === undefined ) {\n\n\t\t\toffset = 0;\n\n\t\t\tconsole.warn(\n\t\t\t\t'THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. '\n\t\t\t\t+ 'Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.'\n\t\t\t);\n\n\t\t}\n\n\t\tconst attributes = this.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tif ( geometry.attributes[ key ] === undefined ) continue;\n\n\t\t\tconst attribute1 = attributes[ key ];\n\t\t\tconst attributeArray1 = attribute1.array;\n\n\t\t\tconst attribute2 = geometry.attributes[ key ];\n\t\t\tconst attributeArray2 = attribute2.array;\n\n\t\t\tconst attributeOffset = attribute2.itemSize * offset;\n\t\t\tconst length = Math.min( attributeArray2.length, attributeArray1.length - attributeOffset );\n\n\t\t\tfor ( let i = 0, j = attributeOffset; i < length; i ++, j ++ ) {\n\n\t\t\t\tattributeArray1[ j ] = attributeArray2[ i ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tnormalizeNormals() {\n\n\t\tconst normals = this.attributes.normal;\n\n\t\tfor ( let i = 0, il = normals.count; i < il; i ++ ) {\n\n\t\t\t_vector$8.fromBufferAttribute( normals, i );\n\n\t\t\t_vector$8.normalize();\n\n\t\t\tnormals.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );\n\n\t\t}\n\n\t}\n\n\ttoNonIndexed() {\n\n\t\tfunction convertBufferAttribute( attribute, indices ) {\n\n\t\t\tconst array = attribute.array;\n\t\t\tconst itemSize = attribute.itemSize;\n\t\t\tconst normalized = attribute.normalized;\n\n\t\t\tconst array2 = new array.constructor( indices.length * itemSize );\n\n\t\t\tlet index = 0, index2 = 0;\n\n\t\t\tfor ( let i = 0, l = indices.length; i < l; i ++ ) {\n\n\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\tindex = indices[ i ] * attribute.data.stride + attribute.offset;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindex = indices[ i ] * itemSize;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let j = 0; j < itemSize; j ++ ) {\n\n\t\t\t\t\tarray2[ index2 ++ ] = array[ index ++ ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( array2, itemSize, normalized );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( this.index === null ) {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.' );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tconst geometry2 = new BufferGeometry();\n\n\t\tconst indices = this.index.array;\n\t\tconst attributes = this.attributes;\n\n\t\t// attributes\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\n\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\tgeometry2.setAttribute( name, newAttribute );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = this.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst morphArray = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, il = morphAttribute.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = morphAttribute[ i ];\n\n\t\t\t\tconst newAttribute = convertBufferAttribute( attribute, indices );\n\n\t\t\t\tmorphArray.push( newAttribute );\n\n\t\t\t}\n\n\t\t\tgeometry2.morphAttributes[ name ] = morphArray;\n\n\t\t}\n\n\t\tgeometry2.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = this.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tgeometry2.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\treturn geometry2;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.5,\n\t\t\t\ttype: 'BufferGeometry',\n\t\t\t\tgenerator: 'BufferGeometry.toJSON'\n\t\t\t}\n\t\t};\n\n\t\t// standard BufferGeometry serialization\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.type = this.type;\n\t\tif ( this.name !== '' ) data.name = this.name;\n\t\tif ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;\n\n\t\tif ( this.parameters !== undefined ) {\n\n\t\t\tconst parameters = this.parameters;\n\n\t\t\tfor ( const key in parameters ) {\n\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\n\n\t\t\t}\n\n\t\t\treturn data;\n\n\t\t}\n\n\t\t// for simplicity the code assumes attributes are not shared across geometries, see #15811\n\n\t\tdata.data = { attributes: {} };\n\n\t\tconst index = this.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tdata.data.index = {\n\t\t\t\ttype: index.array.constructor.name,\n\t\t\t\tarray: Array.prototype.slice.call( index.array )\n\t\t\t};\n\n\t\t}\n\n\t\tconst attributes = this.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\n\t\t\tdata.data.attributes[ key ] = attribute.toJSON( data.data );\n\n\t\t}\n\n\t\tconst morphAttributes = {};\n\t\tlet hasMorphAttributes = false;\n\n\t\tfor ( const key in this.morphAttributes ) {\n\n\t\t\tconst attributeArray = this.morphAttributes[ key ];\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\tconst attribute = attributeArray[ i ];\n\n\t\t\t\tarray.push( attribute.toJSON( data.data ) );\n\n\t\t\t}\n\n\t\t\tif ( array.length > 0 ) {\n\n\t\t\t\tmorphAttributes[ key ] = array;\n\n\t\t\t\thasMorphAttributes = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( hasMorphAttributes ) {\n\n\t\t\tdata.data.morphAttributes = morphAttributes;\n\t\t\tdata.data.morphTargetsRelative = this.morphTargetsRelative;\n\n\t\t}\n\n\t\tconst groups = this.groups;\n\n\t\tif ( groups.length > 0 ) {\n\n\t\t\tdata.data.groups = JSON.parse( JSON.stringify( groups ) );\n\n\t\t}\n\n\t\tconst boundingSphere = this.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tdata.data.boundingSphere = {\n\t\t\t\tcenter: boundingSphere.center.toArray(),\n\t\t\t\tradius: boundingSphere.radius\n\t\t\t};\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tclone() {\n\n\t\t return new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\t// reset\n\n\t\tthis.index = null;\n\t\tthis.attributes = {};\n\t\tthis.morphAttributes = {};\n\t\tthis.groups = [];\n\t\tthis.boundingBox = null;\n\t\tthis.boundingSphere = null;\n\n\t\t// used for storing cloned, shared data\n\n\t\tconst data = {};\n\n\t\t// name\n\n\t\tthis.name = source.name;\n\n\t\t// index\n\n\t\tconst index = source.index;\n\n\t\tif ( index !== null ) {\n\n\t\t\tthis.setIndex( index.clone( data ) );\n\n\t\t}\n\n\t\t// attributes\n\n\t\tconst attributes = source.attributes;\n\n\t\tfor ( const name in attributes ) {\n\n\t\t\tconst attribute = attributes[ name ];\n\t\t\tthis.setAttribute( name, attribute.clone( data ) );\n\n\t\t}\n\n\t\t// morph attributes\n\n\t\tconst morphAttributes = source.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = [];\n\t\t\tconst morphAttribute = morphAttributes[ name ]; // morphAttribute: array of Float32BufferAttributes\n\n\t\t\tfor ( let i = 0, l = morphAttribute.length; i < l; i ++ ) {\n\n\t\t\t\tarray.push( morphAttribute[ i ].clone( data ) );\n\n\t\t\t}\n\n\t\t\tthis.morphAttributes[ name ] = array;\n\n\t\t}\n\n\t\tthis.morphTargetsRelative = source.morphTargetsRelative;\n\n\t\t// groups\n\n\t\tconst groups = source.groups;\n\n\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\tconst group = groups[ i ];\n\t\t\tthis.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t}\n\n\t\t// bounding box\n\n\t\tconst boundingBox = source.boundingBox;\n\n\t\tif ( boundingBox !== null ) {\n\n\t\t\tthis.boundingBox = boundingBox.clone();\n\n\t\t}\n\n\t\t// bounding sphere\n\n\t\tconst boundingSphere = source.boundingSphere;\n\n\t\tif ( boundingSphere !== null ) {\n\n\t\t\tthis.boundingSphere = boundingSphere.clone();\n\n\t\t}\n\n\t\t// draw range\n\n\t\tthis.drawRange.start = source.drawRange.start;\n\t\tthis.drawRange.count = source.drawRange.count;\n\n\t\t// user data\n\n\t\tthis.userData = source.userData;\n\n\t\t// geometry generator parameters\n\n\t\tif ( source.parameters !== undefined ) this.parameters = Object.assign( {}, source.parameters );\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nBufferGeometry.prototype.isBufferGeometry = true;\n\nconst _inverseMatrix$2 = /*@__PURE__*/ new Matrix4();\nconst _ray$2 = /*@__PURE__*/ new Ray();\nconst _sphere$3 = /*@__PURE__*/ new Sphere();\n\nconst _vA$1 = /*@__PURE__*/ new Vector3();\nconst _vB$1 = /*@__PURE__*/ new Vector3();\nconst _vC$1 = /*@__PURE__*/ new Vector3();\n\nconst _tempA = /*@__PURE__*/ new Vector3();\nconst _tempB = /*@__PURE__*/ new Vector3();\nconst _tempC = /*@__PURE__*/ new Vector3();\n\nconst _morphA = /*@__PURE__*/ new Vector3();\nconst _morphB = /*@__PURE__*/ new Vector3();\nconst _morphC = /*@__PURE__*/ new Vector3();\n\nconst _uvA$1 = /*@__PURE__*/ new Vector2();\nconst _uvB$1 = /*@__PURE__*/ new Vector2();\nconst _uvC$1 = /*@__PURE__*/ new Vector2();\n\nconst _intersectionPoint = /*@__PURE__*/ new Vector3();\nconst _intersectionPointWorld = /*@__PURE__*/ new Vector3();\n\nclass Mesh extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new MeshBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Mesh';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tif ( source.morphTargetInfluences !== undefined ) {\n\n\t\t\tthis.morphTargetInfluences = source.morphTargetInfluences.slice();\n\n\t\t}\n\n\t\tif ( source.morphTargetDictionary !== undefined ) {\n\n\t\t\tthis.morphTargetDictionary = Object.assign( {}, source.morphTargetDictionary );\n\n\t\t}\n\n\t\tthis.material = source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\tconst morphAttributes = geometry.morphAttributes;\n\t\t\tconst keys = Object.keys( morphAttributes );\n\n\t\t\tif ( keys.length > 0 ) {\n\n\t\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst morphTargets = geometry.morphTargets;\n\n\t\t\tif ( morphTargets !== undefined && morphTargets.length > 0 ) {\n\n\t\t\t\tconsole.error( 'THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst material = this.material;\n\t\tconst matrixWorld = this.matrixWorld;\n\n\t\tif ( material === undefined ) return;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$3.copy( geometry.boundingSphere );\n\t\t_sphere$3.applyMatrix4( matrixWorld );\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix$2.copy( matrixWorld ).invert();\n\t\t_ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 );\n\n\t\t// Check boundingBox before continuing\n\n\t\tif ( geometry.boundingBox !== null ) {\n\n\t\t\tif ( _ray$2.intersectsBox( geometry.boundingBox ) === false ) return;\n\n\t\t}\n\n\t\tlet intersection;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst position = geometry.attributes.position;\n\t\t\tconst morphPosition = geometry.morphAttributes.position;\n\t\t\tconst morphTargetsRelative = geometry.morphTargetsRelative;\n\t\t\tconst uv = geometry.attributes.uv;\n\t\t\tconst uv2 = geometry.attributes.uv2;\n\t\t\tconst groups = geometry.groups;\n\t\t\tconst drawRange = geometry.drawRange;\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\t// indexed buffer geometry\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\t\tconst end = Math.min( index.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\t\tconst a = index.getX( j );\n\t\t\t\t\t\t\tconst b = index.getX( j + 1 );\n\t\t\t\t\t\t\tconst c = index.getX( j + 2 );\n\n\t\t\t\t\t\t\tintersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );\n\n\t\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\t\tconst a = index.getX( i );\n\t\t\t\t\t\tconst b = index.getX( i + 1 );\n\t\t\t\t\t\tconst c = index.getX( i + 2 );\n\n\t\t\t\t\t\tintersection = checkBufferGeometryIntersection( this, material, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in indexed buffer semantics\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( position !== undefined ) {\n\n\t\t\t\t// non-indexed buffer geometry\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tfor ( let i = 0, il = groups.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\tconst start = Math.max( group.start, drawRange.start );\n\t\t\t\t\t\tconst end = Math.min( position.count, Math.min( ( group.start + group.count ), ( drawRange.start + drawRange.count ) ) );\n\n\t\t\t\t\t\tfor ( let j = start, jl = end; j < jl; j += 3 ) {\n\n\t\t\t\t\t\t\tconst a = j;\n\t\t\t\t\t\t\tconst b = j + 1;\n\t\t\t\t\t\t\tconst c = j + 2;\n\n\t\t\t\t\t\t\tintersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );\n\n\t\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( j / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\t\t\tintersection.face.materialIndex = group.materialIndex;\n\t\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\t\tconst end = Math.min( position.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\t\tfor ( let i = start, il = end; i < il; i += 3 ) {\n\n\t\t\t\t\t\tconst a = i;\n\t\t\t\t\t\tconst b = i + 1;\n\t\t\t\t\t\tconst c = i + 2;\n\n\t\t\t\t\t\tintersection = checkBufferGeometryIntersection( this, material, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c );\n\n\t\t\t\t\t\tif ( intersection ) {\n\n\t\t\t\t\t\t\tintersection.faceIndex = Math.floor( i / 3 ); // triangle number in non-indexed buffer semantics\n\t\t\t\t\t\t\tintersects.push( intersection );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( geometry.isGeometry ) {\n\n\t\t\tconsole.error( 'THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' );\n\n\t\t}\n\n\t}\n\n}\n\nMesh.prototype.isMesh = true;\n\nfunction checkIntersection( object, material, raycaster, ray, pA, pB, pC, point ) {\n\n\tlet intersect;\n\n\tif ( material.side === BackSide ) {\n\n\t\tintersect = ray.intersectTriangle( pC, pB, pA, true, point );\n\n\t} else {\n\n\t\tintersect = ray.intersectTriangle( pA, pB, pC, material.side !== DoubleSide, point );\n\n\t}\n\n\tif ( intersect === null ) return null;\n\n\t_intersectionPointWorld.copy( point );\n\t_intersectionPointWorld.applyMatrix4( object.matrixWorld );\n\n\tconst distance = raycaster.ray.origin.distanceTo( _intersectionPointWorld );\n\n\tif ( distance < raycaster.near || distance > raycaster.far ) return null;\n\n\treturn {\n\t\tdistance: distance,\n\t\tpoint: _intersectionPointWorld.clone(),\n\t\tobject: object\n\t};\n\n}\n\nfunction checkBufferGeometryIntersection( object, material, raycaster, ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ) {\n\n\t_vA$1.fromBufferAttribute( position, a );\n\t_vB$1.fromBufferAttribute( position, b );\n\t_vC$1.fromBufferAttribute( position, c );\n\n\tconst morphInfluences = object.morphTargetInfluences;\n\n\tif ( morphPosition && morphInfluences ) {\n\n\t\t_morphA.set( 0, 0, 0 );\n\t\t_morphB.set( 0, 0, 0 );\n\t\t_morphC.set( 0, 0, 0 );\n\n\t\tfor ( let i = 0, il = morphPosition.length; i < il; i ++ ) {\n\n\t\t\tconst influence = morphInfluences[ i ];\n\t\t\tconst morphAttribute = morphPosition[ i ];\n\n\t\t\tif ( influence === 0 ) continue;\n\n\t\t\t_tempA.fromBufferAttribute( morphAttribute, a );\n\t\t\t_tempB.fromBufferAttribute( morphAttribute, b );\n\t\t\t_tempC.fromBufferAttribute( morphAttribute, c );\n\n\t\t\tif ( morphTargetsRelative ) {\n\n\t\t\t\t_morphA.addScaledVector( _tempA, influence );\n\t\t\t\t_morphB.addScaledVector( _tempB, influence );\n\t\t\t\t_morphC.addScaledVector( _tempC, influence );\n\n\t\t\t} else {\n\n\t\t\t\t_morphA.addScaledVector( _tempA.sub( _vA$1 ), influence );\n\t\t\t\t_morphB.addScaledVector( _tempB.sub( _vB$1 ), influence );\n\t\t\t\t_morphC.addScaledVector( _tempC.sub( _vC$1 ), influence );\n\n\t\t\t}\n\n\t\t}\n\n\t\t_vA$1.add( _morphA );\n\t\t_vB$1.add( _morphB );\n\t\t_vC$1.add( _morphC );\n\n\t}\n\n\tif ( object.isSkinnedMesh ) {\n\n\t\tobject.boneTransform( a, _vA$1 );\n\t\tobject.boneTransform( b, _vB$1 );\n\t\tobject.boneTransform( c, _vC$1 );\n\n\t}\n\n\tconst intersection = checkIntersection( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint );\n\n\tif ( intersection ) {\n\n\t\tif ( uv ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv, c );\n\n\t\t\tintersection.uv = Triangle.getUV( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\n\t\t}\n\n\t\tif ( uv2 ) {\n\n\t\t\t_uvA$1.fromBufferAttribute( uv2, a );\n\t\t\t_uvB$1.fromBufferAttribute( uv2, b );\n\t\t\t_uvC$1.fromBufferAttribute( uv2, c );\n\n\t\t\tintersection.uv2 = Triangle.getUV( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );\n\n\t\t}\n\n\t\tconst face = {\n\t\t\ta: a,\n\t\t\tb: b,\n\t\t\tc: c,\n\t\t\tnormal: new Vector3(),\n\t\t\tmaterialIndex: 0\n\t\t};\n\n\t\tTriangle.getNormal( _vA$1, _vB$1, _vC$1, face.normal );\n\n\t\tintersection.face = face;\n\n\t}\n\n\treturn intersection;\n\n}\n\nclass BoxGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'BoxGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\tdepth: depth,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tdepthSegments: depthSegments\n\t\t};\n\n\t\tconst scope = this;\n\n\t\t// segments\n\n\t\twidthSegments = Math.floor( widthSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\t\tdepthSegments = Math.floor( depthSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet numberOfVertices = 0;\n\t\tlet groupStart = 0;\n\n\t\t// build each side of the box geometry\n\n\t\tbuildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px\n\t\tbuildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx\n\t\tbuildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py\n\t\tbuildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny\n\t\tbuildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz\n\t\tbuildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {\n\n\t\t\tconst segmentWidth = width / gridX;\n\t\t\tconst segmentHeight = height / gridY;\n\n\t\t\tconst widthHalf = width / 2;\n\t\t\tconst heightHalf = height / 2;\n\t\t\tconst depthHalf = depth / 2;\n\n\t\t\tconst gridX1 = gridX + 1;\n\t\t\tconst gridY1 = gridY + 1;\n\n\t\t\tlet vertexCounter = 0;\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst vector = new Vector3();\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\t\tconst y = iy * segmentHeight - heightHalf;\n\n\t\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\t\tconst x = ix * segmentWidth - widthHalf;\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = x * udir;\n\t\t\t\t\tvector[ v ] = y * vdir;\n\t\t\t\t\tvector[ w ] = depthHalf;\n\n\t\t\t\t\t// now apply vector to vertex buffer\n\n\t\t\t\t\tvertices.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// set values to correct vector component\n\n\t\t\t\t\tvector[ u ] = 0;\n\t\t\t\t\tvector[ v ] = 0;\n\t\t\t\t\tvector[ w ] = depth > 0 ? 1 : - 1;\n\n\t\t\t\t\t// now apply vector to normal buffer\n\n\t\t\t\t\tnormals.push( vector.x, vector.y, vector.z );\n\n\t\t\t\t\t// uvs\n\n\t\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t\t\t// counters\n\n\t\t\t\t\tvertexCounter += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// indices\n\n\t\t\t// 1. you need three indices to draw a single face\n\t\t\t// 2. a single segment consists of two faces\n\t\t\t// 3. so we need to generate six (2*3) indices per segment\n\n\t\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\t\tconst a = numberOfVertices + ix + gridX1 * iy;\n\t\t\t\t\tconst b = numberOfVertices + ix + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\t\tconst d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// increase counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, materialIndex );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t\t// update total number of vertices\n\n\t\t\tnumberOfVertices += vertexCounter;\n\n\t\t}\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new BoxGeometry( data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments );\n\n\t}\n\n}\n\n/**\n * Uniform Utilities\n */\n\nfunction cloneUniforms( src ) {\n\n\tconst dst = {};\n\n\tfor ( const u in src ) {\n\n\t\tdst[ u ] = {};\n\n\t\tfor ( const p in src[ u ] ) {\n\n\t\t\tconst property = src[ u ][ p ];\n\n\t\t\tif ( property && ( property.isColor ||\n\t\t\t\tproperty.isMatrix3 || property.isMatrix4 ||\n\t\t\t\tproperty.isVector2 || property.isVector3 || property.isVector4 ||\n\t\t\t\tproperty.isTexture || property.isQuaternion ) ) {\n\n\t\t\t\tdst[ u ][ p ] = property.clone();\n\n\t\t\t} else if ( Array.isArray( property ) ) {\n\n\t\t\t\tdst[ u ][ p ] = property.slice();\n\n\t\t\t} else {\n\n\t\t\t\tdst[ u ][ p ] = property;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn dst;\n\n}\n\nfunction mergeUniforms( uniforms ) {\n\n\tconst merged = {};\n\n\tfor ( let u = 0; u < uniforms.length; u ++ ) {\n\n\t\tconst tmp = cloneUniforms( uniforms[ u ] );\n\n\t\tfor ( const p in tmp ) {\n\n\t\t\tmerged[ p ] = tmp[ p ];\n\n\t\t}\n\n\t}\n\n\treturn merged;\n\n}\n\n// Legacy\n\nconst UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms };\n\nvar default_vertex = \"void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}\";\n\nvar default_fragment = \"void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}\";\n\n/**\n * parameters = {\n * defines: { \"label\" : \"value\" },\n * uniforms: { \"parameter1\": { value: 1.0 }, \"parameter2\": { value2: 2 } },\n *\n * fragmentShader: <string>,\n * vertexShader: <string>,\n *\n * wireframe: <boolean>,\n * wireframeLinewidth: <float>,\n *\n * lights: <bool>\n * }\n */\n\nclass ShaderMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ShaderMaterial';\n\n\t\tthis.defines = {};\n\t\tthis.uniforms = {};\n\n\t\tthis.vertexShader = default_vertex;\n\t\tthis.fragmentShader = default_fragment;\n\n\t\tthis.linewidth = 1;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.fog = false; // set to use scene fog\n\t\tthis.lights = false; // set to use scene lights\n\t\tthis.clipping = false; // set to use user-defined clipping planes\n\n\t\tthis.extensions = {\n\t\t\tderivatives: false, // set to use derivatives\n\t\t\tfragDepth: false, // set to use fragment depth values\n\t\t\tdrawBuffers: false, // set to use draw buffers\n\t\t\tshaderTextureLOD: false // set to use shader texture LOD\n\t\t};\n\n\t\t// When rendered geometry doesn't include these attributes but the material does,\n\t\t// use these default values in WebGL. This avoids errors when buffer data is missing.\n\t\tthis.defaultAttributeValues = {\n\t\t\t'color': [ 1, 1, 1 ],\n\t\t\t'uv': [ 0, 0 ],\n\t\t\t'uv2': [ 0, 0 ]\n\t\t};\n\n\t\tthis.index0AttributeName = undefined;\n\t\tthis.uniformsNeedUpdate = false;\n\n\t\tthis.glslVersion = null;\n\n\t\tif ( parameters !== undefined ) {\n\n\t\t\tif ( parameters.attributes !== undefined ) {\n\n\t\t\t\tconsole.error( 'THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.' );\n\n\t\t\t}\n\n\t\t\tthis.setValues( parameters );\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.fragmentShader = source.fragmentShader;\n\t\tthis.vertexShader = source.vertexShader;\n\n\t\tthis.uniforms = cloneUniforms( source.uniforms );\n\n\t\tthis.defines = Object.assign( {}, source.defines );\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.lights = source.lights;\n\t\tthis.clipping = source.clipping;\n\n\t\tthis.extensions = Object.assign( {}, source.extensions );\n\n\t\tthis.glslVersion = source.glslVersion;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.glslVersion = this.glslVersion;\n\t\tdata.uniforms = {};\n\n\t\tfor ( const name in this.uniforms ) {\n\n\t\t\tconst uniform = this.uniforms[ name ];\n\t\t\tconst value = uniform.value;\n\n\t\t\tif ( value && value.isTexture ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 't',\n\t\t\t\t\tvalue: value.toJSON( meta ).uuid\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isColor ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'c',\n\t\t\t\t\tvalue: value.getHex()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector2 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v2',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isVector4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'v4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix3 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm3',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else if ( value && value.isMatrix4 ) {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\ttype: 'm4',\n\t\t\t\t\tvalue: value.toArray()\n\t\t\t\t};\n\n\t\t\t} else {\n\n\t\t\t\tdata.uniforms[ name ] = {\n\t\t\t\t\tvalue: value\n\t\t\t\t};\n\n\t\t\t\t// note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( Object.keys( this.defines ).length > 0 ) data.defines = this.defines;\n\n\t\tdata.vertexShader = this.vertexShader;\n\t\tdata.fragmentShader = this.fragmentShader;\n\n\t\tconst extensions = {};\n\n\t\tfor ( const key in this.extensions ) {\n\n\t\t\tif ( this.extensions[ key ] === true ) extensions[ key ] = true;\n\n\t\t}\n\n\t\tif ( Object.keys( extensions ).length > 0 ) data.extensions = extensions;\n\n\t\treturn data;\n\n\t}\n\n}\n\nShaderMaterial.prototype.isShaderMaterial = true;\n\nclass Camera extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'Camera';\n\n\t\tthis.matrixWorldInverse = new Matrix4();\n\n\t\tthis.projectionMatrix = new Matrix4();\n\t\tthis.projectionMatrixInverse = new Matrix4();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.matrixWorldInverse.copy( source.matrixWorldInverse );\n\n\t\tthis.projectionMatrix.copy( source.projectionMatrix );\n\t\tthis.projectionMatrixInverse.copy( source.projectionMatrixInverse );\n\n\t\treturn this;\n\n\t}\n\n\tgetWorldDirection( target ) {\n\n\t\tthis.updateWorldMatrix( true, false );\n\n\t\tconst e = this.matrixWorld.elements;\n\n\t\treturn target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tupdateWorldMatrix( updateParents, updateChildren ) {\n\n\t\tsuper.updateWorldMatrix( updateParents, updateChildren );\n\n\t\tthis.matrixWorldInverse.copy( this.matrixWorld ).invert();\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nCamera.prototype.isCamera = true;\n\nclass PerspectiveCamera extends Camera {\n\n\tconstructor( fov = 50, aspect = 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PerspectiveCamera';\n\n\t\tthis.fov = fov;\n\t\tthis.zoom = 1;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.focus = 10;\n\n\t\tthis.aspect = aspect;\n\t\tthis.view = null;\n\n\t\tthis.filmGauge = 35;\t// width of the film (default in millimeters)\n\t\tthis.filmOffset = 0;\t// horizontal film offset (same unit as gauge)\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.fov = source.fov;\n\t\tthis.zoom = source.zoom;\n\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\t\tthis.focus = source.focus;\n\n\t\tthis.aspect = source.aspect;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\tthis.filmGauge = source.filmGauge;\n\t\tthis.filmOffset = source.filmOffset;\n\n\t\treturn this;\n\n\t}\n\n\t/**\n\t * Sets the FOV by focal length in respect to the current .filmGauge.\n\t *\n\t * The default film gauge is 35, so that the focal length can be specified for\n\t * a 35mm (full frame) camera.\n\t *\n\t * Values for focal length and film gauge must have the same unit.\n\t */\n\tsetFocalLength( focalLength ) {\n\n\t\t/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */\n\t\tconst vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\n\n\t\tthis.fov = RAD2DEG * 2 * Math.atan( vExtentSlope );\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\t/**\n\t * Calculates the focal length from the current .fov and .filmGauge.\n\t */\n\tgetFocalLength() {\n\n\t\tconst vExtentSlope = Math.tan( DEG2RAD * 0.5 * this.fov );\n\n\t\treturn 0.5 * this.getFilmHeight() / vExtentSlope;\n\n\t}\n\n\tgetEffectiveFOV() {\n\n\t\treturn RAD2DEG * 2 * Math.atan(\n\t\t\tMath.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom );\n\n\t}\n\n\tgetFilmWidth() {\n\n\t\t// film not completely covered in portrait format (aspect < 1)\n\t\treturn this.filmGauge * Math.min( this.aspect, 1 );\n\n\t}\n\n\tgetFilmHeight() {\n\n\t\t// film not completely covered in landscape format (aspect > 1)\n\t\treturn this.filmGauge / Math.max( this.aspect, 1 );\n\n\t}\n\n\t/**\n\t * Sets an offset in a larger frustum. This is useful for multi-window or\n\t * multi-monitor/multi-machine setups.\n\t *\n\t * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n\t * the monitors are in grid like this\n\t *\n\t * +---+---+---+\n\t * | A | B | C |\n\t * +---+---+---+\n\t * | D | E | F |\n\t * +---+---+---+\n\t *\n\t * then for each monitor you would call it like this\n\t *\n\t * const w = 1920;\n\t * const h = 1080;\n\t * const fullWidth = w * 3;\n\t * const fullHeight = h * 2;\n\t *\n\t * --A--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n\t * --B--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n\t * --C--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n\t * --D--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n\t * --E--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n\t * --F--\n\t * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n\t *\n\t * Note there is no reason monitors have to be the same size or in a grid.\n\t */\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tthis.aspect = fullWidth / fullHeight;\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst near = this.near;\n\t\tlet top = near * Math.tan( DEG2RAD * 0.5 * this.fov ) / this.zoom;\n\t\tlet height = 2 * top;\n\t\tlet width = this.aspect * height;\n\t\tlet left = - 0.5 * width;\n\t\tconst view = this.view;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst fullWidth = view.fullWidth,\n\t\t\t\tfullHeight = view.fullHeight;\n\n\t\t\tleft += view.offsetX * width / fullWidth;\n\t\t\ttop -= view.offsetY * height / fullHeight;\n\t\t\twidth *= view.width / fullWidth;\n\t\t\theight *= view.height / fullHeight;\n\n\t\t}\n\n\t\tconst skew = this.filmOffset;\n\t\tif ( skew !== 0 ) left += near * skew / this.getFilmWidth();\n\n\t\tthis.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.fov = this.fov;\n\t\tdata.object.zoom = this.zoom;\n\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\t\tdata.object.focus = this.focus;\n\n\t\tdata.object.aspect = this.aspect;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\tdata.object.filmGauge = this.filmGauge;\n\t\tdata.object.filmOffset = this.filmOffset;\n\n\t\treturn data;\n\n\t}\n\n}\n\nPerspectiveCamera.prototype.isPerspectiveCamera = true;\n\nconst fov = 90, aspect = 1;\n\nclass CubeCamera extends Object3D {\n\n\tconstructor( near, far, renderTarget ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubeCamera';\n\n\t\tif ( renderTarget.isWebGLCubeRenderTarget !== true ) {\n\n\t\t\tconsole.error( 'THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.renderTarget = renderTarget;\n\n\t\tconst cameraPX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPX.layers = this.layers;\n\t\tcameraPX.up.set( 0, - 1, 0 );\n\t\tcameraPX.lookAt( new Vector3( 1, 0, 0 ) );\n\t\tthis.add( cameraPX );\n\n\t\tconst cameraNX = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNX.layers = this.layers;\n\t\tcameraNX.up.set( 0, - 1, 0 );\n\t\tcameraNX.lookAt( new Vector3( - 1, 0, 0 ) );\n\t\tthis.add( cameraNX );\n\n\t\tconst cameraPY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPY.layers = this.layers;\n\t\tcameraPY.up.set( 0, 0, 1 );\n\t\tcameraPY.lookAt( new Vector3( 0, 1, 0 ) );\n\t\tthis.add( cameraPY );\n\n\t\tconst cameraNY = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNY.layers = this.layers;\n\t\tcameraNY.up.set( 0, 0, - 1 );\n\t\tcameraNY.lookAt( new Vector3( 0, - 1, 0 ) );\n\t\tthis.add( cameraNY );\n\n\t\tconst cameraPZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraPZ.layers = this.layers;\n\t\tcameraPZ.up.set( 0, - 1, 0 );\n\t\tcameraPZ.lookAt( new Vector3( 0, 0, 1 ) );\n\t\tthis.add( cameraPZ );\n\n\t\tconst cameraNZ = new PerspectiveCamera( fov, aspect, near, far );\n\t\tcameraNZ.layers = this.layers;\n\t\tcameraNZ.up.set( 0, - 1, 0 );\n\t\tcameraNZ.lookAt( new Vector3( 0, 0, - 1 ) );\n\t\tthis.add( cameraNZ );\n\n\t}\n\n\tupdate( renderer, scene ) {\n\n\t\tif ( this.parent === null ) this.updateMatrixWorld();\n\n\t\tconst renderTarget = this.renderTarget;\n\n\t\tconst [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;\n\n\t\tconst currentXrEnabled = renderer.xr.enabled;\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\trenderer.xr.enabled = false;\n\n\t\tconst generateMipmaps = renderTarget.texture.generateMipmaps;\n\n\t\trenderTarget.texture.generateMipmaps = false;\n\n\t\trenderer.setRenderTarget( renderTarget, 0 );\n\t\trenderer.render( scene, cameraPX );\n\n\t\trenderer.setRenderTarget( renderTarget, 1 );\n\t\trenderer.render( scene, cameraNX );\n\n\t\trenderer.setRenderTarget( renderTarget, 2 );\n\t\trenderer.render( scene, cameraPY );\n\n\t\trenderer.setRenderTarget( renderTarget, 3 );\n\t\trenderer.render( scene, cameraNY );\n\n\t\trenderer.setRenderTarget( renderTarget, 4 );\n\t\trenderer.render( scene, cameraPZ );\n\n\t\trenderTarget.texture.generateMipmaps = generateMipmaps;\n\n\t\trenderer.setRenderTarget( renderTarget, 5 );\n\t\trenderer.render( scene, cameraNZ );\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t\trenderer.xr.enabled = currentXrEnabled;\n\n\t}\n\n}\n\nclass CubeTexture extends Texture {\n\n\tconstructor( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding ) {\n\n\t\timages = images !== undefined ? images : [];\n\t\tmapping = mapping !== undefined ? mapping : CubeReflectionMapping;\n\n\t\tsuper( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );\n\n\t\tthis.flipY = false;\n\n\t}\n\n\tget images() {\n\n\t\treturn this.image;\n\n\t}\n\n\tset images( value ) {\n\n\t\tthis.image = value;\n\n\t}\n\n}\n\nCubeTexture.prototype.isCubeTexture = true;\n\nclass WebGLCubeRenderTarget extends WebGLRenderTarget {\n\n\tconstructor( size, options, dummy ) {\n\n\t\tif ( Number.isInteger( options ) ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )' );\n\n\t\t\toptions = dummy;\n\n\t\t}\n\n\t\tsuper( size, size, options );\n\n\t\toptions = options || {};\n\n\t\t// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)\n\t\t// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,\n\t\t// in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.\n\n\t\t// three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped\n\t\t// and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture\n\t\t// as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).\n\n\t\tthis.texture = new CubeTexture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );\n\t\tthis.texture.isRenderTargetTexture = true;\n\n\t\tthis.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n\t\tthis.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\n\n\t\tthis.texture._needsFlipEnvMap = false;\n\n\t}\n\n\tfromEquirectangularTexture( renderer, texture ) {\n\n\t\tthis.texture.type = texture.type;\n\t\tthis.texture.format = RGBAFormat; // see #18859\n\t\tthis.texture.encoding = texture.encoding;\n\n\t\tthis.texture.generateMipmaps = texture.generateMipmaps;\n\t\tthis.texture.minFilter = texture.minFilter;\n\t\tthis.texture.magFilter = texture.magFilter;\n\n\t\tconst shader = {\n\n\t\t\tuniforms: {\n\t\t\t\ttEquirect: { value: null },\n\t\t\t},\n\n\t\t\tvertexShader: /* glsl */`\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t`,\n\n\t\t\tfragmentShader: /* glsl */`\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t`\n\t\t};\n\n\t\tconst geometry = new BoxGeometry( 5, 5, 5 );\n\n\t\tconst material = new ShaderMaterial( {\n\n\t\t\tname: 'CubemapFromEquirect',\n\n\t\t\tuniforms: cloneUniforms( shader.uniforms ),\n\t\t\tvertexShader: shader.vertexShader,\n\t\t\tfragmentShader: shader.fragmentShader,\n\t\t\tside: BackSide,\n\t\t\tblending: NoBlending\n\n\t\t} );\n\n\t\tmaterial.uniforms.tEquirect.value = texture;\n\n\t\tconst mesh = new Mesh( geometry, material );\n\n\t\tconst currentMinFilter = texture.minFilter;\n\n\t\t// Avoid blurred poles\n\t\tif ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;\n\n\t\tconst camera = new CubeCamera( 1, 10, this );\n\t\tcamera.update( renderer, mesh );\n\n\t\ttexture.minFilter = currentMinFilter;\n\n\t\tmesh.geometry.dispose();\n\t\tmesh.material.dispose();\n\n\t\treturn this;\n\n\t}\n\n\tclear( renderer, color, depth, stencil ) {\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\trenderer.setRenderTarget( this, i );\n\n\t\t\trenderer.clear( color, depth, stencil );\n\n\t\t}\n\n\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t}\n\n}\n\nWebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true;\n\nconst _vector1 = /*@__PURE__*/ new Vector3();\nconst _vector2 = /*@__PURE__*/ new Vector3();\nconst _normalMatrix = /*@__PURE__*/ new Matrix3();\n\nclass Plane {\n\n\tconstructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {\n\n\t\t// normal is assumed to be normalized\n\n\t\tthis.normal = normal;\n\t\tthis.constant = constant;\n\n\t}\n\n\tset( normal, constant ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = constant;\n\n\t\treturn this;\n\n\t}\n\n\tsetComponents( x, y, z, w ) {\n\n\t\tthis.normal.set( x, y, z );\n\t\tthis.constant = w;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromNormalAndCoplanarPoint( normal, point ) {\n\n\t\tthis.normal.copy( normal );\n\t\tthis.constant = - point.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCoplanarPoints( a, b, c ) {\n\n\t\tconst normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();\n\n\t\t// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\n\n\t\tthis.setFromNormalAndCoplanarPoint( normal, a );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( plane ) {\n\n\t\tthis.normal.copy( plane.normal );\n\t\tthis.constant = plane.constant;\n\n\t\treturn this;\n\n\t}\n\n\tnormalize() {\n\n\t\t// Note: will lead to a divide by zero if the plane is invalid.\n\n\t\tconst inverseNormalLength = 1.0 / this.normal.length();\n\t\tthis.normal.multiplyScalar( inverseNormalLength );\n\t\tthis.constant *= inverseNormalLength;\n\n\t\treturn this;\n\n\t}\n\n\tnegate() {\n\n\t\tthis.constant *= - 1;\n\t\tthis.normal.negate();\n\n\t\treturn this;\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\treturn this.normal.dot( point ) + this.constant;\n\n\t}\n\n\tdistanceToSphere( sphere ) {\n\n\t\treturn this.distanceToPoint( sphere.center ) - sphere.radius;\n\n\t}\n\n\tprojectPoint( point, target ) {\n\n\t\treturn target.copy( this.normal ).multiplyScalar( - this.distanceToPoint( point ) ).add( point );\n\n\t}\n\n\tintersectLine( line, target ) {\n\n\t\tconst direction = line.delta( _vector1 );\n\n\t\tconst denominator = this.normal.dot( direction );\n\n\t\tif ( denominator === 0 ) {\n\n\t\t\t// line is coplanar, return origin\n\t\t\tif ( this.distanceToPoint( line.start ) === 0 ) {\n\n\t\t\t\treturn target.copy( line.start );\n\n\t\t\t}\n\n\t\t\t// Unsure if this is the correct method to handle this case.\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;\n\n\t\tif ( t < 0 || t > 1 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\treturn target.copy( direction ).multiplyScalar( t ).add( line.start );\n\n\t}\n\n\tintersectsLine( line ) {\n\n\t\t// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\n\n\t\tconst startSign = this.distanceToPoint( line.start );\n\t\tconst endSign = this.distanceToPoint( line.end );\n\n\t\treturn ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\treturn box.intersectsPlane( this );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\treturn sphere.intersectsPlane( this );\n\n\t}\n\n\tcoplanarPoint( target ) {\n\n\t\treturn target.copy( this.normal ).multiplyScalar( - this.constant );\n\n\t}\n\n\tapplyMatrix4( matrix, optionalNormalMatrix ) {\n\n\t\tconst normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );\n\n\t\tconst referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );\n\n\t\tconst normal = this.normal.applyMatrix3( normalMatrix ).normalize();\n\n\t\tthis.constant = - referencePoint.dot( normal );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.constant -= offset.dot( this.normal );\n\n\t\treturn this;\n\n\t}\n\n\tequals( plane ) {\n\n\t\treturn plane.normal.equals( this.normal ) && ( plane.constant === this.constant );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nPlane.prototype.isPlane = true;\n\nconst _sphere$2 = /*@__PURE__*/ new Sphere();\nconst _vector$7 = /*@__PURE__*/ new Vector3();\n\nclass Frustum {\n\n\tconstructor( p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane() ) {\n\n\t\tthis.planes = [ p0, p1, p2, p3, p4, p5 ];\n\n\t}\n\n\tset( p0, p1, p2, p3, p4, p5 ) {\n\n\t\tconst planes = this.planes;\n\n\t\tplanes[ 0 ].copy( p0 );\n\t\tplanes[ 1 ].copy( p1 );\n\t\tplanes[ 2 ].copy( p2 );\n\t\tplanes[ 3 ].copy( p3 );\n\t\tplanes[ 4 ].copy( p4 );\n\t\tplanes[ 5 ].copy( p5 );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( frustum ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tplanes[ i ].copy( frustum.planes[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromProjectionMatrix( m ) {\n\n\t\tconst planes = this.planes;\n\t\tconst me = m.elements;\n\t\tconst me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];\n\t\tconst me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];\n\t\tconst me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];\n\t\tconst me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];\n\n\t\tplanes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();\n\t\tplanes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();\n\t\tplanes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();\n\t\tplanes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();\n\t\tplanes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();\n\t\tplanes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();\n\n\t\treturn this;\n\n\t}\n\n\tintersectsObject( object ) {\n\n\t\tconst geometry = object.geometry;\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$2.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );\n\n\t\treturn this.intersectsSphere( _sphere$2 );\n\n\t}\n\n\tintersectsSprite( sprite ) {\n\n\t\t_sphere$2.center.set( 0, 0, 0 );\n\t\t_sphere$2.radius = 0.7071067811865476;\n\t\t_sphere$2.applyMatrix4( sprite.matrixWorld );\n\n\t\treturn this.intersectsSphere( _sphere$2 );\n\n\t}\n\n\tintersectsSphere( sphere ) {\n\n\t\tconst planes = this.planes;\n\t\tconst center = sphere.center;\n\t\tconst negRadius = - sphere.radius;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst distance = planes[ i ].distanceToPoint( center );\n\n\t\t\tif ( distance < negRadius ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst plane = planes[ i ];\n\n\t\t\t// corner at max distance\n\n\t\t\t_vector$7.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n\t\t\t_vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n\t\t\t_vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n\n\t\t\tif ( plane.distanceToPoint( _vector$7 ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\tconst planes = this.planes;\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tif ( planes[ i ].distanceToPoint( point ) < 0 ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nfunction WebGLAnimation() {\n\n\tlet context = null;\n\tlet isAnimating = false;\n\tlet animationLoop = null;\n\tlet requestId = null;\n\n\tfunction onAnimationFrame( time, frame ) {\n\n\t\tanimationLoop( time, frame );\n\n\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t}\n\n\treturn {\n\n\t\tstart: function () {\n\n\t\t\tif ( isAnimating === true ) return;\n\t\t\tif ( animationLoop === null ) return;\n\n\t\t\trequestId = context.requestAnimationFrame( onAnimationFrame );\n\n\t\t\tisAnimating = true;\n\n\t\t},\n\n\t\tstop: function () {\n\n\t\t\tcontext.cancelAnimationFrame( requestId );\n\n\t\t\tisAnimating = false;\n\n\t\t},\n\n\t\tsetAnimationLoop: function ( callback ) {\n\n\t\t\tanimationLoop = callback;\n\n\t\t},\n\n\t\tsetContext: function ( value ) {\n\n\t\t\tcontext = value;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLAttributes( gl, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tconst buffers = new WeakMap();\n\n\tfunction createBuffer( attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst usage = attribute.usage;\n\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\t\tgl.bufferData( bufferType, array, usage );\n\n\t\tattribute.onUploadCallback();\n\n\t\tlet type = 5126;\n\n\t\tif ( array instanceof Float32Array ) {\n\n\t\t\ttype = 5126;\n\n\t\t} else if ( array instanceof Float64Array ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.' );\n\n\t\t} else if ( array instanceof Uint16Array ) {\n\n\t\t\tif ( attribute.isFloat16BufferAttribute ) {\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\ttype = 5131;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\ttype = 5123;\n\n\t\t\t}\n\n\t\t} else if ( array instanceof Int16Array ) {\n\n\t\t\ttype = 5122;\n\n\t\t} else if ( array instanceof Uint32Array ) {\n\n\t\t\ttype = 5125;\n\n\t\t} else if ( array instanceof Int32Array ) {\n\n\t\t\ttype = 5124;\n\n\t\t} else if ( array instanceof Int8Array ) {\n\n\t\t\ttype = 5120;\n\n\t\t} else if ( array instanceof Uint8Array ) {\n\n\t\t\ttype = 5121;\n\n\t\t} else if ( array instanceof Uint8ClampedArray ) {\n\n\t\t\ttype = 5121;\n\n\t\t}\n\n\t\treturn {\n\t\t\tbuffer: buffer,\n\t\t\ttype: type,\n\t\t\tbytesPerElement: array.BYTES_PER_ELEMENT,\n\t\t\tversion: attribute.version\n\t\t};\n\n\t}\n\n\tfunction updateBuffer( buffer, attribute, bufferType ) {\n\n\t\tconst array = attribute.array;\n\t\tconst updateRange = attribute.updateRange;\n\n\t\tgl.bindBuffer( bufferType, buffer );\n\n\t\tif ( updateRange.count === - 1 ) {\n\n\t\t\t// Not using update ranges\n\n\t\t\tgl.bufferSubData( bufferType, 0, array );\n\n\t\t} else {\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray, updateRange.offset, updateRange.count );\n\n\t\t\t} else {\n\n\t\t\t\tgl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,\n\t\t\t\t\tarray.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );\n\n\t\t\t}\n\n\t\t\tupdateRange.count = - 1; // reset range\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction get( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\treturn buffers.get( attribute );\n\n\t}\n\n\tfunction remove( attribute ) {\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data ) {\n\n\t\t\tgl.deleteBuffer( data.buffer );\n\n\t\t\tbuffers.delete( attribute );\n\n\t\t}\n\n\t}\n\n\tfunction update( attribute, bufferType ) {\n\n\t\tif ( attribute.isGLBufferAttribute ) {\n\n\t\t\tconst cached = buffers.get( attribute );\n\n\t\t\tif ( ! cached || cached.version < attribute.version ) {\n\n\t\t\t\tbuffers.set( attribute, {\n\t\t\t\t\tbuffer: attribute.buffer,\n\t\t\t\t\ttype: attribute.type,\n\t\t\t\t\tbytesPerElement: attribute.elementSize,\n\t\t\t\t\tversion: attribute.version\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;\n\n\t\tconst data = buffers.get( attribute );\n\n\t\tif ( data === undefined ) {\n\n\t\t\tbuffers.set( attribute, createBuffer( attribute, bufferType ) );\n\n\t\t} else if ( data.version < attribute.version ) {\n\n\t\t\tupdateBuffer( data.buffer, attribute, bufferType );\n\n\t\t\tdata.version = attribute.version;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update\n\n\t};\n\n}\n\nclass PlaneGeometry extends BufferGeometry {\n\n\tconstructor( width = 1, height = 1, widthSegments = 1, heightSegments = 1 ) {\n\n\t\tsuper();\n\t\tthis.type = 'PlaneGeometry';\n\n\t\tthis.parameters = {\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments\n\t\t};\n\n\t\tconst width_half = width / 2;\n\t\tconst height_half = height / 2;\n\n\t\tconst gridX = Math.floor( widthSegments );\n\t\tconst gridY = Math.floor( heightSegments );\n\n\t\tconst gridX1 = gridX + 1;\n\t\tconst gridY1 = gridY + 1;\n\n\t\tconst segment_width = width / gridX;\n\t\tconst segment_height = height / gridY;\n\n\t\t//\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\tfor ( let iy = 0; iy < gridY1; iy ++ ) {\n\n\t\t\tconst y = iy * segment_height - height_half;\n\n\t\t\tfor ( let ix = 0; ix < gridX1; ix ++ ) {\n\n\t\t\t\tconst x = ix * segment_width - width_half;\n\n\t\t\t\tvertices.push( x, - y, 0 );\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\tuvs.push( ix / gridX );\n\t\t\t\tuvs.push( 1 - ( iy / gridY ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let iy = 0; iy < gridY; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < gridX; ix ++ ) {\n\n\t\t\t\tconst a = ix + gridX1 * iy;\n\t\t\t\tconst b = ix + gridX1 * ( iy + 1 );\n\t\t\t\tconst c = ( ix + 1 ) + gridX1 * ( iy + 1 );\n\t\t\t\tconst d = ( ix + 1 ) + gridX1 * iy;\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PlaneGeometry( data.width, data.height, data.widthSegments, data.heightSegments );\n\n\t}\n\n}\n\nvar alphamap_fragment = \"#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\\n#endif\";\n\nvar alphamap_pars_fragment = \"#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar alphatest_fragment = \"#ifdef USE_ALPHATEST\\n\\tif ( diffuseColor.a < alphaTest ) discard;\\n#endif\";\n\nvar alphatest_pars_fragment = \"#ifdef USE_ALPHATEST\\n\\tuniform float alphaTest;\\n#endif\";\n\nvar aomap_fragment = \"#ifdef USE_AOMAP\\n\\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\\n\\treflectedLight.indirectDiffuse *= ambientOcclusion;\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\\t\\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\\n\\t\\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\\n\\t#endif\\n#endif\";\n\nvar aomap_pars_fragment = \"#ifdef USE_AOMAP\\n\\tuniform sampler2D aoMap;\\n\\tuniform float aoMapIntensity;\\n#endif\";\n\nvar begin_vertex = \"vec3 transformed = vec3( position );\";\n\nvar beginnormal_vertex = \"vec3 objectNormal = vec3( normal );\\n#ifdef USE_TANGENT\\n\\tvec3 objectTangent = vec3( tangent.xyz );\\n#endif\";\n\nvar bsdfs = \"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\\n\\treturn RECIPROCAL_PI * diffuseColor;\\n}\\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n}\\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\\n\\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\\n\\treturn 0.5 / max( gv + gl, EPSILON );\\n}\\nfloat D_GGX( const in float alpha, const in float dotNH ) {\\n\\tfloat a2 = pow2( alpha );\\n\\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\\n\\treturn RECIPROCAL_PI * a2 / pow2( denom );\\n}\\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\\n\\tfloat alpha = pow2( roughness );\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\tfloat D = D_GGX( alpha, dotNH );\\n\\treturn F * ( V * D );\\n}\\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\\n\\tconst float LUT_SIZE = 64.0;\\n\\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\\n\\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\\n\\tfloat dotNV = saturate( dot( N, V ) );\\n\\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\\n\\tuv = uv * LUT_SCALE + LUT_BIAS;\\n\\treturn uv;\\n}\\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\\n\\tfloat l = length( f );\\n\\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\\n}\\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\\n\\tfloat x = dot( v1, v2 );\\n\\tfloat y = abs( x );\\n\\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\\n\\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\\n\\tfloat v = a / b;\\n\\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\\n\\treturn cross( v1, v2 ) * theta_sintheta;\\n}\\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\\n\\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\\n\\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\\n\\tvec3 lightNormal = cross( v1, v2 );\\n\\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\\n\\tvec3 T1, T2;\\n\\tT1 = normalize( V - N * dot( V, N ) );\\n\\tT2 = - cross( N, T1 );\\n\\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\\n\\tvec3 coords[ 4 ];\\n\\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\\n\\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\\n\\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\\n\\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\\n\\tcoords[ 0 ] = normalize( coords[ 0 ] );\\n\\tcoords[ 1 ] = normalize( coords[ 1 ] );\\n\\tcoords[ 2 ] = normalize( coords[ 2 ] );\\n\\tcoords[ 3 ] = normalize( coords[ 3 ] );\\n\\tvec3 vectorFormFactor = vec3( 0.0 );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\\n\\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\\n\\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\\n\\treturn vec3( result );\\n}\\nfloat G_BlinnPhong_Implicit( ) {\\n\\treturn 0.25;\\n}\\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\\n\\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\\n}\\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\\n\\tfloat G = G_BlinnPhong_Implicit( );\\n\\tfloat D = D_BlinnPhong( shininess, dotNH );\\n\\treturn F * ( G * D );\\n}\\n#if defined( USE_SHEEN )\\nfloat D_Charlie( float roughness, float dotNH ) {\\n\\tfloat alpha = pow2( roughness );\\n\\tfloat invAlpha = 1.0 / alpha;\\n\\tfloat cos2h = dotNH * dotNH;\\n\\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\\n\\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\\n}\\nfloat V_Neubelt( float dotNV, float dotNL ) {\\n\\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\\n}\\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat D = D_Charlie( sheenRoughness, dotNH );\\n\\tfloat V = V_Neubelt( dotNV, dotNL );\\n\\treturn sheenColor * ( D * V );\\n}\\n#endif\";\n\nvar bumpmap_pars_fragment = \"#ifdef USE_BUMPMAP\\n\\tuniform sampler2D bumpMap;\\n\\tuniform float bumpScale;\\n\\tvec2 dHdxy_fwd() {\\n\\t\\tvec2 dSTdx = dFdx( vUv );\\n\\t\\tvec2 dSTdy = dFdy( vUv );\\n\\t\\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\\n\\t\\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\\n\\t\\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\\n\\t\\treturn vec2( dBx, dBy );\\n\\t}\\n\\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\\n\\t\\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\\n\\t\\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\\n\\t\\tvec3 vN = surf_norm;\\n\\t\\tvec3 R1 = cross( vSigmaY, vN );\\n\\t\\tvec3 R2 = cross( vN, vSigmaX );\\n\\t\\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\\n\\t\\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\\t\\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\\t}\\n#endif\";\n\nvar clipping_planes_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvec4 plane;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\tplane = clippingPlanes[ i ];\\n\\t\\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\tbool clipped = true;\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\tif ( clipped ) discard;\\n\\t#endif\\n#endif\";\n\nvar clipping_planes_pars_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n\\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\n#endif\";\n\nvar clipping_planes_pars_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n#endif\";\n\nvar clipping_planes_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvClipPosition = - mvPosition.xyz;\\n#endif\";\n\nvar color_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tdiffuseColor *= vColor;\\n#elif defined( USE_COLOR )\\n\\tdiffuseColor.rgb *= vColor;\\n#endif\";\n\nvar color_pars_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_pars_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\n\nvar color_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvColor = vec4( 1.0 );\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\\tvColor = vec3( 1.0 );\\n#endif\\n#ifdef USE_COLOR\\n\\tvColor *= color;\\n#endif\\n#ifdef USE_INSTANCING_COLOR\\n\\tvColor.xyz *= instanceColor.xyz;\\n#endif\";\n\nvar common = \"#define PI 3.141592653589793\\n#define PI2 6.283185307179586\\n#define PI_HALF 1.5707963267948966\\n#define RECIPROCAL_PI 0.3183098861837907\\n#define RECIPROCAL_PI2 0.15915494309189535\\n#define EPSILON 1e-6\\n#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\\nfloat pow2( const in float x ) { return x*x; }\\nfloat pow3( const in float x ) { return x*x*x; }\\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\\nhighp float rand( const in vec2 uv ) {\\n\\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\\n\\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\\n\\treturn fract( sin( sn ) * c );\\n}\\n#ifdef HIGH_PRECISION\\n\\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\\n#else\\n\\tfloat precisionSafeLength( vec3 v ) {\\n\\t\\tfloat maxComponent = max3( abs( v ) );\\n\\t\\treturn length( v / maxComponent ) * maxComponent;\\n\\t}\\n#endif\\nstruct IncidentLight {\\n\\tvec3 color;\\n\\tvec3 direction;\\n\\tbool visible;\\n};\\nstruct ReflectedLight {\\n\\tvec3 directDiffuse;\\n\\tvec3 directSpecular;\\n\\tvec3 indirectDiffuse;\\n\\tvec3 indirectSpecular;\\n};\\nstruct GeometricContext {\\n\\tvec3 position;\\n\\tvec3 normal;\\n\\tvec3 viewDir;\\n#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal;\\n#endif\\n};\\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\n}\\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\\n\\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\\n}\\nmat3 transposeMat3( const in mat3 m ) {\\n\\tmat3 tmp;\\n\\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\\n\\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\\n\\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\\n\\treturn tmp;\\n}\\nfloat linearToRelativeLuminance( const in vec3 color ) {\\n\\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\\n\\treturn dot( weights, color.rgb );\\n}\\nbool isPerspectiveMatrix( mat4 m ) {\\n\\treturn m[ 2 ][ 3 ] == - 1.0;\\n}\\nvec2 equirectUv( in vec3 dir ) {\\n\\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\\n\\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\\treturn vec2( u, v );\\n}\";\n\nvar cube_uv_reflection_fragment = \"#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t#define cubeUV_maxMipLevel 8.0\\n\\t#define cubeUV_minMipLevel 4.0\\n\\t#define cubeUV_maxTileSize 256.0\\n\\t#define cubeUV_minTileSize 16.0\\n\\tfloat getFace( vec3 direction ) {\\n\\t\\tvec3 absDirection = abs( direction );\\n\\t\\tfloat face = - 1.0;\\n\\t\\tif ( absDirection.x > absDirection.z ) {\\n\\t\\t\\tif ( absDirection.x > absDirection.y )\\n\\t\\t\\t\\tface = direction.x > 0.0 ? 0.0 : 3.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t} else {\\n\\t\\t\\tif ( absDirection.z > absDirection.y )\\n\\t\\t\\t\\tface = direction.z > 0.0 ? 2.0 : 5.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t}\\n\\t\\treturn face;\\n\\t}\\n\\tvec2 getUV( vec3 direction, float face ) {\\n\\t\\tvec2 uv;\\n\\t\\tif ( face == 0.0 ) {\\n\\t\\t\\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 1.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\\n\\t\\t} else if ( face == 2.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\\n\\t\\t} else if ( face == 3.0 ) {\\n\\t\\t\\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 4.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\\n\\t\\t} else {\\n\\t\\t\\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\\n\\t\\t}\\n\\t\\treturn 0.5 * ( uv + 1.0 );\\n\\t}\\n\\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\\n\\t\\tfloat face = getFace( direction );\\n\\t\\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\\n\\t\\tmipInt = max( mipInt, cubeUV_minMipLevel );\\n\\t\\tfloat faceSize = exp2( mipInt );\\n\\t\\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\\n\\t\\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\\n\\t\\tvec2 f = fract( uv );\\n\\t\\tuv += 0.5 - f;\\n\\t\\tif ( face > 2.0 ) {\\n\\t\\t\\tuv.y += faceSize;\\n\\t\\t\\tface -= 3.0;\\n\\t\\t}\\n\\t\\tuv.x += face * faceSize;\\n\\t\\tif ( mipInt < cubeUV_maxMipLevel ) {\\n\\t\\t\\tuv.y += 2.0 * cubeUV_maxTileSize;\\n\\t\\t}\\n\\t\\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\\n\\t\\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\\n\\t\\tuv *= texelSize;\\n\\t\\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\\n\\t\\tuv.x += texelSize;\\n\\t\\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\\n\\t\\tuv.y += texelSize;\\n\\t\\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\\n\\t\\tuv.x -= texelSize;\\n\\t\\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\\n\\t\\tvec3 tm = mix( tl, tr, f.x );\\n\\t\\tvec3 bm = mix( bl, br, f.x );\\n\\t\\treturn mix( tm, bm, f.y );\\n\\t}\\n\\t#define r0 1.0\\n\\t#define v0 0.339\\n\\t#define m0 - 2.0\\n\\t#define r1 0.8\\n\\t#define v1 0.276\\n\\t#define m1 - 1.0\\n\\t#define r4 0.4\\n\\t#define v4 0.046\\n\\t#define m4 2.0\\n\\t#define r5 0.305\\n\\t#define v5 0.016\\n\\t#define m5 3.0\\n\\t#define r6 0.21\\n\\t#define v6 0.0038\\n\\t#define m6 4.0\\n\\tfloat roughnessToMip( float roughness ) {\\n\\t\\tfloat mip = 0.0;\\n\\t\\tif ( roughness >= r1 ) {\\n\\t\\t\\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\\n\\t\\t} else if ( roughness >= r4 ) {\\n\\t\\t\\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\\n\\t\\t} else if ( roughness >= r5 ) {\\n\\t\\t\\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\\n\\t\\t} else if ( roughness >= r6 ) {\\n\\t\\t\\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\\n\\t\\t} else {\\n\\t\\t\\tmip = - 2.0 * log2( 1.16 * roughness );\\t\\t}\\n\\t\\treturn mip;\\n\\t}\\n\\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\\n\\t\\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\\n\\t\\tfloat mipF = fract( mip );\\n\\t\\tfloat mipInt = floor( mip );\\n\\t\\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\\n\\t\\tif ( mipF == 0.0 ) {\\n\\t\\t\\treturn vec4( color0, 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\\n\\t\\t\\treturn vec4( mix( color0, color1, mipF ), 1.0 );\\n\\t\\t}\\n\\t}\\n#endif\";\n\nvar defaultnormal_vertex = \"vec3 transformedNormal = objectNormal;\\n#ifdef USE_INSTANCING\\n\\tmat3 m = mat3( instanceMatrix );\\n\\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\\n\\ttransformedNormal = m * transformedNormal;\\n#endif\\ntransformedNormal = normalMatrix * transformedNormal;\\n#ifdef FLIP_SIDED\\n\\ttransformedNormal = - transformedNormal;\\n#endif\\n#ifdef USE_TANGENT\\n\\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\\n\\t#ifdef FLIP_SIDED\\n\\t\\ttransformedTangent = - transformedTangent;\\n\\t#endif\\n#endif\";\n\nvar displacementmap_pars_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\tuniform sampler2D displacementMap;\\n\\tuniform float displacementScale;\\n\\tuniform float displacementBias;\\n#endif\";\n\nvar displacementmap_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\\n#endif\";\n\nvar emissivemap_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\\n\\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\\n\\ttotalEmissiveRadiance *= emissiveColor.rgb;\\n#endif\";\n\nvar emissivemap_pars_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tuniform sampler2D emissiveMap;\\n#endif\";\n\nvar encodings_fragment = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\";\n\nvar encodings_pars_fragment = \"\\nvec4 LinearToLinear( in vec4 value ) {\\n\\treturn value;\\n}\\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\\n\\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\\n}\\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\\n\\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\\n}\\nvec4 sRGBToLinear( in vec4 value ) {\\n\\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\\n}\\nvec4 LinearTosRGB( in vec4 value ) {\\n\\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\\n}\\nvec4 RGBEToLinear( in vec4 value ) {\\n\\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\\n}\\nvec4 LinearToRGBE( in vec4 value ) {\\n\\tfloat maxComponent = max( max( value.r, value.g ), value.b );\\n\\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\\n\\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\\n}\\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\\n\\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\\n}\\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\\n\\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\\n\\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\\n\\tM = ceil( M * 255.0 ) / 255.0;\\n\\treturn vec4( value.rgb / ( M * maxRange ), M );\\n}\\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\\n\\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\\n}\\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\\n\\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\\n\\tfloat D = max( maxRange / maxRGB, 1.0 );\\n\\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\\n\\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\\n}\\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\\nvec4 LinearToLogLuv( in vec4 value ) {\\n\\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\\n\\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\\n\\tvec4 vResult;\\n\\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\\n\\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\\n\\tvResult.w = fract( Le );\\n\\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\\n\\treturn vResult;\\n}\\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\\nvec4 LogLuvToLinear( in vec4 value ) {\\n\\tfloat Le = value.z * 255.0 + value.w;\\n\\tvec3 Xp_Y_XYZp;\\n\\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\\n\\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\\n\\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\\n\\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\\n\\treturn vec4( max( vRGB, 0.0 ), 1.0 );\\n}\";\n\nvar envmap_fragment = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvec3 cameraToFrag;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#else\\n\\t\\tvec3 reflectVec = vReflect;\\n\\t#endif\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\n\\t\\tenvColor = envMapTexelToLinear( envColor );\\n\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\\n\\t#else\\n\\t\\tvec4 envColor = vec4( 0.0 );\\n\\t#endif\\n\\t#ifdef ENVMAP_BLENDING_MULTIPLY\\n\\t\\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_MIX )\\n\\t\\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\\n\\t#elif defined( ENVMAP_BLENDING_ADD )\\n\\t\\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\\n\\t#endif\\n#endif\";\n\nvar envmap_common_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float envMapIntensity;\\n\\tuniform float flipEnvMap;\\n\\tuniform int maxMipLevel;\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tuniform samplerCube envMap;\\n\\t#else\\n\\t\\tuniform sampler2D envMap;\\n\\t#endif\\n\\t\\n#endif\";\n\nvar envmap_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float reflectivity;\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t\\tuniform float refractionRatio;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t#endif\\n#endif\";\n\nvar envmap_pars_vertex = \"#ifdef USE_ENVMAP\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\t\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t\\tuniform float refractionRatio;\\n\\t#endif\\n#endif\";\n\nvar envmap_vertex = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvWorldPosition = worldPosition.xyz;\\n\\t#else\\n\\t\\tvec3 cameraToVertex;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvReflect = reflect( cameraToVertex, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar fog_vertex = \"#ifdef USE_FOG\\n\\tvFogDepth = - mvPosition.z;\\n#endif\";\n\nvar fog_pars_vertex = \"#ifdef USE_FOG\\n\\tvarying float vFogDepth;\\n#endif\";\n\nvar fog_fragment = \"#ifdef USE_FOG\\n\\t#ifdef FOG_EXP2\\n\\t\\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\\n\\t#else\\n\\t\\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\\n\\t#endif\\n\\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\n#endif\";\n\nvar fog_pars_fragment = \"#ifdef USE_FOG\\n\\tuniform vec3 fogColor;\\n\\tvarying float vFogDepth;\\n\\t#ifdef FOG_EXP2\\n\\t\\tuniform float fogDensity;\\n\\t#else\\n\\t\\tuniform float fogNear;\\n\\t\\tuniform float fogFar;\\n\\t#endif\\n#endif\";\n\nvar gradientmap_pars_fragment = \"#ifdef USE_GRADIENTMAP\\n\\tuniform sampler2D gradientMap;\\n#endif\\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\\n\\tfloat dotNL = dot( normal, lightDirection );\\n\\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\\n\\t#ifdef USE_GRADIENTMAP\\n\\t\\treturn texture2D( gradientMap, coord ).rgb;\\n\\t#else\\n\\t\\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\\n\\t#endif\\n}\";\n\nvar lightmap_fragment = \"#ifdef USE_LIGHTMAP\\n\\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\\n\\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\\n\\t#ifndef PHYSICALLY_CORRECT_LIGHTS\\n\\t\\tlightMapIrradiance *= PI;\\n\\t#endif\\n\\treflectedLight.indirectDiffuse += lightMapIrradiance;\\n#endif\";\n\nvar lightmap_pars_fragment = \"#ifdef USE_LIGHTMAP\\n\\tuniform sampler2D lightMap;\\n\\tuniform float lightMapIntensity;\\n#endif\";\n\nvar lights_lambert_vertex = \"vec3 diffuse = vec3( 1.0 );\\nGeometricContext geometry;\\ngeometry.position = mvPosition.xyz;\\ngeometry.normal = normalize( transformedNormal );\\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\\nGeometricContext backGeometry;\\nbackGeometry.position = geometry.position;\\nbackGeometry.normal = -geometry.normal;\\nbackGeometry.viewDir = geometry.viewDir;\\nvLightFront = vec3( 0.0 );\\nvIndirectFront = vec3( 0.0 );\\n#ifdef DOUBLE_SIDED\\n\\tvLightBack = vec3( 0.0 );\\n\\tvIndirectBack = vec3( 0.0 );\\n#endif\\nIncidentLight directLight;\\nfloat dotNL;\\nvec3 directLightColor_Diffuse;\\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\\n#ifdef DOUBLE_SIDED\\n\\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\\n\\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\\n#endif\\n#if NUM_POINT_LIGHTS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\\t\\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\\n\\t\\tdotNL = dot( geometry.normal, directLight.direction );\\n\\t\\tdirectLightColor_Diffuse = directLight.color;\\n\\t\\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\t\\t\\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\\n\\t\\t#endif\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if NUM_SPOT_LIGHTS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\\t\\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\\n\\t\\tdotNL = dot( geometry.normal, directLight.direction );\\n\\t\\tdirectLightColor_Diffuse = directLight.color;\\n\\t\\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\t\\t\\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\\n\\t\\t#endif\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if NUM_DIR_LIGHTS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\\t\\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\\n\\t\\tdotNL = dot( geometry.normal, directLight.direction );\\n\\t\\tdirectLightColor_Diffuse = directLight.color;\\n\\t\\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\t\\t\\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\\n\\t\\t#endif\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if NUM_HEMI_LIGHTS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\\t\\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\t\\t\\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\\n\\t\\t#endif\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\";\n\nvar lights_pars_begin = \"uniform bool receiveShadow;\\nuniform vec3 ambientLightColor;\\nuniform vec3 lightProbe[ 9 ];\\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\\n\\tfloat x = normal.x, y = normal.y, z = normal.z;\\n\\tvec3 result = shCoefficients[ 0 ] * 0.886227;\\n\\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\\n\\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\\n\\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\\n\\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\\n\\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\\n\\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\\n\\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\\n\\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\\n\\treturn result;\\n}\\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\\n\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\\n\\treturn irradiance;\\n}\\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\\n\\tvec3 irradiance = ambientLightColor;\\n\\treturn irradiance;\\n}\\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\\n\\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\\n\\t\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\\t\\tif ( cutoffDistance > 0.0 ) {\\n\\t\\t\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\\t\\t}\\n\\t\\treturn distanceFalloff;\\n\\t#else\\n\\t\\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\\n\\t\\t\\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\\n\\t\\t}\\n\\t\\treturn 1.0;\\n\\t#endif\\n}\\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\\n\\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\\n}\\n#if NUM_DIR_LIGHTS > 0\\n\\tstruct DirectionalLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t};\\n\\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\\n\\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\\t\\tlight.color = directionalLight.color;\\n\\t\\tlight.direction = directionalLight.direction;\\n\\t\\tlight.visible = true;\\n\\t}\\n#endif\\n#if NUM_POINT_LIGHTS > 0\\n\\tstruct PointLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t};\\n\\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\\n\\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\\t\\tvec3 lVector = pointLight.position - geometry.position;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat lightDistance = length( lVector );\\n\\t\\tlight.color = pointLight.color;\\n\\t\\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\\n\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t}\\n#endif\\n#if NUM_SPOT_LIGHTS > 0\\n\\tstruct SpotLight {\\n\\t\\tvec3 position;\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t\\tfloat distance;\\n\\t\\tfloat decay;\\n\\t\\tfloat coneCos;\\n\\t\\tfloat penumbraCos;\\n\\t};\\n\\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\\n\\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\\t\\tvec3 lVector = spotLight.position - geometry.position;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat angleCos = dot( light.direction, spotLight.direction );\\n\\t\\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\\n\\t\\tif ( spotAttenuation > 0.0 ) {\\n\\t\\t\\tfloat lightDistance = length( lVector );\\n\\t\\t\\tlight.color = spotLight.color * spotAttenuation;\\n\\t\\t\\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\\n\\t\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t\\t} else {\\n\\t\\t\\tlight.color = vec3( 0.0 );\\n\\t\\t\\tlight.visible = false;\\n\\t\\t}\\n\\t}\\n#endif\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tstruct RectAreaLight {\\n\\t\\tvec3 color;\\n\\t\\tvec3 position;\\n\\t\\tvec3 halfWidth;\\n\\t\\tvec3 halfHeight;\\n\\t};\\n\\tuniform sampler2D ltc_1;\\tuniform sampler2D ltc_2;\\n\\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\\n#endif\\n#if NUM_HEMI_LIGHTS > 0\\n\\tstruct HemisphereLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 skyColor;\\n\\t\\tvec3 groundColor;\\n\\t};\\n\\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\\n\\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\\n\\t\\tfloat dotNL = dot( normal, hemiLight.direction );\\n\\t\\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\\n\\t\\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\\n\\t\\treturn irradiance;\\n\\t}\\n#endif\";\n\nvar envmap_physical_pars_fragment = \"#if defined( USE_ENVMAP )\\n\\t#ifdef ENVMAP_MODE_REFRACTION\\n\\t\\tuniform float refractionRatio;\\n\\t#endif\\n\\tvec3 getIBLIrradiance( const in vec3 normal ) {\\n\\t\\t#if defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\\n\\t\\t\\treturn PI * envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\\n\\t\\t#if defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\t\\tvec3 reflectVec;\\n\\t\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\t\\treflectVec = reflect( - viewDir, normal );\\n\\t\\t\\t\\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\\n\\t\\t\\t#else\\n\\t\\t\\t\\treflectVec = refract( - viewDir, normal, refractionRatio );\\n\\t\\t\\t#endif\\n\\t\\t\\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\\n\\t\\t\\treturn envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n#endif\";\n\nvar lights_toon_fragment = \"ToonMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\";\n\nvar lights_toon_pars_fragment = \"varying vec3 vViewPosition;\\nstruct ToonMaterial {\\n\\tvec3 diffuseColor;\\n};\\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Toon\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Toon\\n#define Material_LightProbeLOD( material )\\t(0)\";\n\nvar lights_phong_fragment = \"BlinnPhongMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\n\nvar lights_phong_pars_fragment = \"varying vec3 vViewPosition;\\nstruct BlinnPhongMaterial {\\n\\tvec3 diffuseColor;\\n\\tvec3 specularColor;\\n\\tfloat specularShininess;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n\\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\\n}\\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_BlinnPhong\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_BlinnPhong\\n#define Material_LightProbeLOD( material )\\t(0)\";\n\nvar lights_physical_fragment = \"PhysicalMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\\nmaterial.roughness = min( material.roughness, 1.0 );\\n#ifdef IOR\\n\\t#ifdef SPECULAR\\n\\t\\tfloat specularIntensityFactor = specularIntensity;\\n\\t\\tvec3 specularColorFactor = specularColor;\\n\\t\\t#ifdef USE_SPECULARINTENSITYMAP\\n\\t\\t\\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\\n\\t\\t#endif\\n\\t\\t#ifdef USE_SPECULARCOLORMAP\\n\\t\\t\\tspecularColorFactor *= specularColorMapTexelToLinear( texture2D( specularColorMap, vUv ) ).rgb;\\n\\t\\t#endif\\n\\t\\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\\n\\t#else\\n\\t\\tfloat specularIntensityFactor = 1.0;\\n\\t\\tvec3 specularColorFactor = vec3( 1.0 );\\n\\t\\tmaterial.specularF90 = 1.0;\\n\\t#endif\\n\\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\\n#else\\n\\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\\n\\tmaterial.specularF90 = 1.0;\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tmaterial.clearcoat = clearcoat;\\n\\tmaterial.clearcoatRoughness = clearcoatRoughness;\\n\\tmaterial.clearcoatF0 = vec3( 0.04 );\\n\\tmaterial.clearcoatF90 = 1.0;\\n\\t#ifdef USE_CLEARCOATMAP\\n\\t\\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\t\\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\\n\\t#endif\\n\\tmaterial.clearcoat = saturate( material.clearcoat );\\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\\n\\tmaterial.clearcoatRoughness += geometryRoughness;\\n\\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\\n#endif\\n#ifdef USE_SHEEN\\n\\tmaterial.sheenColor = sheenColor;\\n\\t#ifdef USE_SHEENCOLORMAP\\n\\t\\tmaterial.sheenColor *= sheenColorMapTexelToLinear( texture2D( sheenColorMap, vUv ) ).rgb;\\n\\t#endif\\n\\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\\n\\t#ifdef USE_SHEENROUGHNESSMAP\\n\\t\\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\\n\\t#endif\\n#endif\";\n\nvar lights_physical_pars_fragment = \"struct PhysicalMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat roughness;\\n\\tvec3 specularColor;\\n\\tfloat specularF90;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat clearcoat;\\n\\t\\tfloat clearcoatRoughness;\\n\\t\\tvec3 clearcoatF0;\\n\\t\\tfloat clearcoatF90;\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tvec3 sheenColor;\\n\\t\\tfloat sheenRoughness;\\n\\t#endif\\n};\\nvec3 clearcoatSpecular = vec3( 0.0 );\\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\\n\\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\\n\\tvec4 r = roughness * c0 + c1;\\n\\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\\n\\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\\n\\treturn fab;\\n}\\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\treturn specularColor * fab.x + specularF90 * fab.y;\\n}\\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\\n\\tfloat Ess = fab.x + fab.y;\\n\\tfloat Ems = 1.0 - Ess;\\n\\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\\n\\tsingleScatter += FssEss;\\n\\tmultiScatter += Fms * Ems;\\n}\\n#if NUM_RECT_AREA_LIGHTS > 0\\n\\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\t\\tvec3 normal = geometry.normal;\\n\\t\\tvec3 viewDir = geometry.viewDir;\\n\\t\\tvec3 position = geometry.position;\\n\\t\\tvec3 lightPos = rectAreaLight.position;\\n\\t\\tvec3 halfWidth = rectAreaLight.halfWidth;\\n\\t\\tvec3 halfHeight = rectAreaLight.halfHeight;\\n\\t\\tvec3 lightColor = rectAreaLight.color;\\n\\t\\tfloat roughness = material.roughness;\\n\\t\\tvec3 rectCoords[ 4 ];\\n\\t\\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\\t\\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\\n\\t\\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\\n\\t\\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\\n\\t\\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\\n\\t\\tvec4 t1 = texture2D( ltc_1, uv );\\n\\t\\tvec4 t2 = texture2D( ltc_2, uv );\\n\\t\\tmat3 mInv = mat3(\\n\\t\\t\\tvec3( t1.x, 0, t1.y ),\\n\\t\\t\\tvec3( 0, 1, 0 ),\\n\\t\\t\\tvec3( t1.z, 0, t1.w )\\n\\t\\t);\\n\\t\\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\\n\\t\\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\\n\\t\\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\\n\\t}\\n#endif\\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\\n\\t\\tvec3 ccIrradiance = dotNLcc * directLight.color;\\n\\t\\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\treflectedLight.directSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\\n\\t#endif\\n\\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\\t#endif\\n\\tvec3 singleScattering = vec3( 0.0 );\\n\\tvec3 multiScattering = vec3( 0.0 );\\n\\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\n\\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\\n\\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\\n\\treflectedLight.indirectSpecular += radiance * singleScattering;\\n\\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\\n\\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Physical\\n#define RE_Direct_RectArea\\t\\tRE_Direct_RectArea_Physical\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Physical\\n#define RE_IndirectSpecular\\t\\tRE_IndirectSpecular_Physical\\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\\n\\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\\n}\";\n\nvar lights_fragment_begin = \"\\nGeometricContext geometry;\\ngeometry.position = - vViewPosition;\\ngeometry.normal = normal;\\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\n#ifdef USE_CLEARCOAT\\n\\tgeometry.clearcoatNormal = clearcoatNormal;\\n#endif\\nIncidentLight directLight;\\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tPointLight pointLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\\t\\tpointLight = pointLights[ i ];\\n\\t\\tgetPointLightInfo( pointLight, geometry, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\\n\\t\\tpointLightShadow = pointLightShadows[ i ];\\n\\t\\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tSpotLight spotLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\\t\\tspotLight = spotLights[ i ];\\n\\t\\tgetSpotLightInfo( spotLight, geometry, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\tspotLightShadow = spotLightShadows[ i ];\\n\\t\\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tDirectionalLight directionalLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLights[ i ];\\n\\t\\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\\n\\t\\tdirectionalLightShadow = directionalLightShadows[ i ];\\n\\t\\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\\n\\tRectAreaLight rectAreaLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\\n\\t\\trectAreaLight = rectAreaLights[ i ];\\n\\t\\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if defined( RE_IndirectDiffuse )\\n\\tvec3 iblIrradiance = vec3( 0.0 );\\n\\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\\n\\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\\n\\t#if ( NUM_HEMI_LIGHTS > 0 )\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\\t\\t\\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tvec3 radiance = vec3( 0.0 );\\n\\tvec3 clearcoatRadiance = vec3( 0.0 );\\n#endif\";\n\nvar lights_fragment_maps = \"#if defined( RE_IndirectDiffuse )\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\\n\\t\\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\\n\\t\\t#ifndef PHYSICALLY_CORRECT_LIGHTS\\n\\t\\t\\tlightMapIrradiance *= PI;\\n\\t\\t#endif\\n\\t\\tirradiance += lightMapIrradiance;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tiblIrradiance += getIBLIrradiance( geometry.normal );\\n\\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\\n\\t#endif\\n#endif\";\n\nvar lights_fragment_end = \"#if defined( RE_IndirectDiffuse )\\n\\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\\n#endif\";\n\nvar logdepthbuf_fragment = \"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\\n\\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\\n#endif\";\n\nvar logdepthbuf_pars_fragment = \"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\\n\\tuniform float logDepthBufFC;\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\n\nvar logdepthbuf_pars_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\t\\tvarying float vFragDepth;\\n\\t\\tvarying float vIsPerspective;\\n\\t#else\\n\\t\\tuniform float logDepthBufFC;\\n\\t#endif\\n#endif\";\n\nvar logdepthbuf_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\t\\tvFragDepth = 1.0 + gl_Position.w;\\n\\t\\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\\n\\t#else\\n\\t\\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\\n\\t\\t\\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\\n\\t\\t\\tgl_Position.z *= gl_Position.w;\\n\\t\\t}\\n\\t#endif\\n#endif\";\n\nvar map_fragment = \"#ifdef USE_MAP\\n\\tvec4 texelColor = texture2D( map, vUv );\\n\\ttexelColor = mapTexelToLinear( texelColor );\\n\\tdiffuseColor *= texelColor;\\n#endif\";\n\nvar map_pars_fragment = \"#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\";\n\nvar map_particle_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\\n#endif\\n#ifdef USE_MAP\\n\\tvec4 mapTexel = texture2D( map, uv );\\n\\tdiffuseColor *= mapTexelToLinear( mapTexel );\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\\n#endif\";\n\nvar map_particle_pars_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\tuniform mat3 uvTransform;\\n#endif\\n#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\n\nvar metalnessmap_fragment = \"float metalnessFactor = metalness;\\n#ifdef USE_METALNESSMAP\\n\\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\\n\\tmetalnessFactor *= texelMetalness.b;\\n#endif\";\n\nvar metalnessmap_pars_fragment = \"#ifdef USE_METALNESSMAP\\n\\tuniform sampler2D metalnessMap;\\n#endif\";\n\nvar morphnormal_vertex = \"#ifdef USE_MORPHNORMALS\\n\\tobjectNormal *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\tif ( morphTargetInfluences[ i ] > 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\\n\\t\\t}\\n\\t#else\\n\\t\\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\\n\\t\\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\\n\\t\\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\\n\\t\\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\\n\\t#endif\\n#endif\";\n\nvar morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\\tuniform float morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\t\\tuniform sampler2DArray morphTargetsTexture;\\n\\t\\tuniform vec2 morphTargetsTextureSize;\\n\\t\\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\\n\\t\\t\\tfloat texelIndex = float( vertexIndex * stride + offset );\\n\\t\\t\\tfloat y = floor( texelIndex / morphTargetsTextureSize.x );\\n\\t\\t\\tfloat x = texelIndex - y * morphTargetsTextureSize.x;\\n\\t\\t\\tvec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );\\n\\t\\t\\treturn texture( morphTargetsTexture, morphUV ).xyz;\\n\\t\\t}\\n\\t#else\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\tuniform float morphTargetInfluences[ 8 ];\\n\\t\\t#else\\n\\t\\t\\tuniform float morphTargetInfluences[ 4 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\\ttransformed *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\t\\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\\n\\t\\t\\t#else\\n\\t\\t\\t\\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\\n\\t\\t\\t#endif\\n\\t\\t}\\n\\t#else\\n\\t\\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\\n\\t\\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\\n\\t\\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\\n\\t\\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\\n\\t\\t\\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\\n\\t\\t\\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\\n\\t\\t\\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\n\nvar normal_fragment_begin = \"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\\n#ifdef FLAT_SHADED\\n\\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\\n\\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\\n\\tvec3 normal = normalize( cross( fdx, fdy ) );\\n#else\\n\\tvec3 normal = normalize( vNormal );\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal = normal * faceDirection;\\n\\t#endif\\n\\t#ifdef USE_TANGENT\\n\\t\\tvec3 tangent = normalize( vTangent );\\n\\t\\tvec3 bitangent = normalize( vBitangent );\\n\\t\\t#ifdef DOUBLE_SIDED\\n\\t\\t\\ttangent = tangent * faceDirection;\\n\\t\\t\\tbitangent = bitangent * faceDirection;\\n\\t\\t#endif\\n\\t\\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\\n\\t\\t\\tmat3 vTBN = mat3( tangent, bitangent, normal );\\n\\t\\t#endif\\n\\t#endif\\n#endif\\nvec3 geometryNormal = normal;\";\n\nvar normal_fragment_maps = \"#ifdef OBJECTSPACE_NORMALMAP\\n\\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\\n\\t#ifdef FLIP_SIDED\\n\\t\\tnormal = - normal;\\n\\t#endif\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal = normal * faceDirection;\\n\\t#endif\\n\\tnormal = normalize( normalMatrix * normal );\\n#elif defined( TANGENTSPACE_NORMALMAP )\\n\\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\\n\\tmapN.xy *= normalScale;\\n\\t#ifdef USE_TANGENT\\n\\t\\tnormal = normalize( vTBN * mapN );\\n\\t#else\\n\\t\\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\\n\\t#endif\\n#elif defined( USE_BUMPMAP )\\n\\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\\n#endif\";\n\nvar normal_pars_fragment = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_pars_vertex = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\n\nvar normal_vertex = \"#ifndef FLAT_SHADED\\n\\tvNormal = normalize( transformedNormal );\\n\\t#ifdef USE_TANGENT\\n\\t\\tvTangent = normalize( transformedTangent );\\n\\t\\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\n\\t#endif\\n#endif\";\n\nvar normalmap_pars_fragment = \"#ifdef USE_NORMALMAP\\n\\tuniform sampler2D normalMap;\\n\\tuniform vec2 normalScale;\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\n\\tuniform mat3 normalMatrix;\\n#endif\\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\\n\\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\\n\\t\\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\\n\\t\\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\\n\\t\\tvec2 st0 = dFdx( vUv.st );\\n\\t\\tvec2 st1 = dFdy( vUv.st );\\n\\t\\tvec3 N = surf_norm;\\n\\t\\tvec3 q1perp = cross( q1, N );\\n\\t\\tvec3 q0perp = cross( N, q0 );\\n\\t\\tvec3 T = q1perp * st0.x + q0perp * st1.x;\\n\\t\\tvec3 B = q1perp * st0.y + q0perp * st1.y;\\n\\t\\tfloat det = max( dot( T, T ), dot( B, B ) );\\n\\t\\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\\n\\t\\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\\n\\t}\\n#endif\";\n\nvar clearcoat_normal_fragment_begin = \"#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal = geometryNormal;\\n#endif\";\n\nvar clearcoat_normal_fragment_maps = \"#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\\n\\tclearcoatMapN.xy *= clearcoatNormalScale;\\n\\t#ifdef USE_TANGENT\\n\\t\\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\\n\\t#else\\n\\t\\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\\n\\t#endif\\n#endif\";\n\nvar clearcoat_pars_fragment = \"#ifdef USE_CLEARCOATMAP\\n\\tuniform sampler2D clearcoatMap;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform sampler2D clearcoatRoughnessMap;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform sampler2D clearcoatNormalMap;\\n\\tuniform vec2 clearcoatNormalScale;\\n#endif\";\n\nvar output_fragment = \"#ifdef OPAQUE\\ndiffuseColor.a = 1.0;\\n#endif\\n#ifdef USE_TRANSMISSION\\ndiffuseColor.a *= transmissionAlpha + 0.1;\\n#endif\\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\";\n\nvar packing = \"vec3 packNormalToRGB( const in vec3 normal ) {\\n\\treturn normalize( normal ) * 0.5 + 0.5;\\n}\\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\\n\\treturn 2.0 * rgb.xyz - 1.0;\\n}\\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\\nconst float ShiftRight8 = 1. / 256.;\\nvec4 packDepthToRGBA( const in float v ) {\\n\\tvec4 r = vec4( fract( v * PackFactors ), v );\\n\\tr.yzw -= r.xyz * ShiftRight8;\\treturn r * PackUpscale;\\n}\\nfloat unpackRGBAToDepth( const in vec4 v ) {\\n\\treturn dot( v, UnpackFactors );\\n}\\nvec4 pack2HalfToRGBA( vec2 v ) {\\n\\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\\n\\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\\n}\\nvec2 unpackRGBATo2Half( vec4 v ) {\\n\\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\\n}\\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn ( viewZ + near ) / ( near - far );\\n}\\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\\n\\treturn linearClipZ * ( near - far ) - near;\\n}\\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\\n\\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\\n}\\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\\n\\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\\n}\";\n\nvar premultiplied_alpha_fragment = \"#ifdef PREMULTIPLIED_ALPHA\\n\\tgl_FragColor.rgb *= gl_FragColor.a;\\n#endif\";\n\nvar project_vertex = \"vec4 mvPosition = vec4( transformed, 1.0 );\\n#ifdef USE_INSTANCING\\n\\tmvPosition = instanceMatrix * mvPosition;\\n#endif\\nmvPosition = modelViewMatrix * mvPosition;\\ngl_Position = projectionMatrix * mvPosition;\";\n\nvar dithering_fragment = \"#ifdef DITHERING\\n\\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\n#endif\";\n\nvar dithering_pars_fragment = \"#ifdef DITHERING\\n\\tvec3 dithering( vec3 color ) {\\n\\t\\tfloat grid_position = rand( gl_FragCoord.xy );\\n\\t\\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\\n\\t\\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\\n\\t\\treturn color + dither_shift_RGB;\\n\\t}\\n#endif\";\n\nvar roughnessmap_fragment = \"float roughnessFactor = roughness;\\n#ifdef USE_ROUGHNESSMAP\\n\\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\\n\\troughnessFactor *= texelRoughness.g;\\n#endif\";\n\nvar roughnessmap_pars_fragment = \"#ifdef USE_ROUGHNESSMAP\\n\\tuniform sampler2D roughnessMap;\\n#endif\";\n\nvar shadowmap_pars_fragment = \"#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\\n\\t\\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\\n\\t}\\n\\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\\n\\t\\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\\n\\t}\\n\\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\\n\\t\\tfloat occlusion = 1.0;\\n\\t\\tvec2 distribution = texture2DDistribution( shadow, uv );\\n\\t\\tfloat hard_shadow = step( compare , distribution.x );\\n\\t\\tif (hard_shadow != 1.0 ) {\\n\\t\\t\\tfloat distance = compare - distribution.x ;\\n\\t\\t\\tfloat variance = max( 0.00000, distribution.y * distribution.y );\\n\\t\\t\\tfloat softness_probability = variance / (variance + distance * distance );\\t\\t\\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\\t\\t\\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\\n\\t\\t}\\n\\t\\treturn occlusion;\\n\\t}\\n\\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\\n\\t\\tfloat shadow = 1.0;\\n\\t\\tshadowCoord.xyz /= shadowCoord.w;\\n\\t\\tshadowCoord.z += shadowBias;\\n\\t\\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\\n\\t\\tbool inFrustum = all( inFrustumVec );\\n\\t\\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\\n\\t\\tbool frustumTest = all( frustumTestVec );\\n\\t\\tif ( frustumTest ) {\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx0 = - texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy0 = - texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx1 = + texelSize.x * shadowRadius;\\n\\t\\t\\tfloat dy1 = + texelSize.y * shadowRadius;\\n\\t\\t\\tfloat dx2 = dx0 / 2.0;\\n\\t\\t\\tfloat dy2 = dy0 / 2.0;\\n\\t\\t\\tfloat dx3 = dx1 / 2.0;\\n\\t\\t\\tfloat dy3 = dy1 / 2.0;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\\n\\t\\t\\t) * ( 1.0 / 17.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx = texelSize.x;\\n\\t\\t\\tfloat dy = texelSize.y;\\n\\t\\t\\tvec2 uv = shadowCoord.xy;\\n\\t\\t\\tvec2 f = fract( uv * shadowMapSize + 0.5 );\\n\\t\\t\\tuv -= f * texelSize;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t f.y )\\n\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#else\\n\\t\\t\\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\\n\\t\\t#endif\\n\\t\\t}\\n\\t\\treturn shadow;\\n\\t}\\n\\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\\n\\t\\tvec3 absV = abs( v );\\n\\t\\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\\n\\t\\tabsV *= scaleToCube;\\n\\t\\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\\n\\t\\tvec2 planar = v.xy;\\n\\t\\tfloat almostATexel = 1.5 * texelSizeY;\\n\\t\\tfloat almostOne = 1.0 - almostATexel;\\n\\t\\tif ( absV.z >= almostOne ) {\\n\\t\\t\\tif ( v.z > 0.0 )\\n\\t\\t\\t\\tplanar.x = 4.0 - v.x;\\n\\t\\t} else if ( absV.x >= almostOne ) {\\n\\t\\t\\tfloat signX = sign( v.x );\\n\\t\\t\\tplanar.x = v.z * signX + 2.0 * signX;\\n\\t\\t} else if ( absV.y >= almostOne ) {\\n\\t\\t\\tfloat signY = sign( v.y );\\n\\t\\t\\tplanar.x = v.x + 2.0 * signY + 2.0;\\n\\t\\t\\tplanar.y = v.z * signY - 2.0;\\n\\t\\t}\\n\\t\\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\\n\\t}\\n\\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\\n\\t\\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\\n\\t\\tvec3 lightToPosition = shadowCoord.xyz;\\n\\t\\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\\t\\tdp += shadowBias;\\n\\t\\tvec3 bd3D = normalize( lightToPosition );\\n\\t\\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\\n\\t\\t\\treturn (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\\n\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t#else\\n\\t\\t\\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\\n\\t\\t#endif\\n\\t}\\n#endif\";\n\nvar shadowmap_pars_vertex = \"#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n#endif\";\n\nvar shadowmap_vertex = \"#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\t\\tvec4 shadowWorldPosition;\\n\\t#endif\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\";\n\nvar shadowmask_pars_fragment = \"float getShadowMask() {\\n\\tfloat shadow = 1.0;\\n\\t#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tspotLight = spotLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tpointLight = pointLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#endif\\n\\treturn shadow;\\n}\";\n\nvar skinbase_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\\n\\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\\n\\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\\n\\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\\n#endif\";\n\nvar skinning_pars_vertex = \"#ifdef USE_SKINNING\\n\\tuniform mat4 bindMatrix;\\n\\tuniform mat4 bindMatrixInverse;\\n\\t#ifdef BONE_TEXTURE\\n\\t\\tuniform highp sampler2D boneTexture;\\n\\t\\tuniform int boneTextureSize;\\n\\t\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\t\\tfloat j = i * 4.0;\\n\\t\\t\\tfloat x = mod( j, float( boneTextureSize ) );\\n\\t\\t\\tfloat y = floor( j / float( boneTextureSize ) );\\n\\t\\t\\tfloat dx = 1.0 / float( boneTextureSize );\\n\\t\\t\\tfloat dy = 1.0 / float( boneTextureSize );\\n\\t\\t\\ty = dy * ( y + 0.5 );\\n\\t\\t\\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\\n\\t\\t\\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\\n\\t\\t\\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\\n\\t\\t\\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\\n\\t\\t\\tmat4 bone = mat4( v1, v2, v3, v4 );\\n\\t\\t\\treturn bone;\\n\\t\\t}\\n\\t#else\\n\\t\\tuniform mat4 boneMatrices[ MAX_BONES ];\\n\\t\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\t\\tmat4 bone = boneMatrices[ int(i) ];\\n\\t\\t\\treturn bone;\\n\\t\\t}\\n\\t#endif\\n#endif\";\n\nvar skinning_vertex = \"#ifdef USE_SKINNING\\n\\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\\n\\tvec4 skinned = vec4( 0.0 );\\n\\tskinned += boneMatX * skinVertex * skinWeight.x;\\n\\tskinned += boneMatY * skinVertex * skinWeight.y;\\n\\tskinned += boneMatZ * skinVertex * skinWeight.z;\\n\\tskinned += boneMatW * skinVertex * skinWeight.w;\\n\\ttransformed = ( bindMatrixInverse * skinned ).xyz;\\n#endif\";\n\nvar skinnormal_vertex = \"#ifdef USE_SKINNING\\n\\tmat4 skinMatrix = mat4( 0.0 );\\n\\tskinMatrix += skinWeight.x * boneMatX;\\n\\tskinMatrix += skinWeight.y * boneMatY;\\n\\tskinMatrix += skinWeight.z * boneMatZ;\\n\\tskinMatrix += skinWeight.w * boneMatW;\\n\\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\\n\\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\\n\\t#ifdef USE_TANGENT\\n\\t\\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\\n\\t#endif\\n#endif\";\n\nvar specularmap_fragment = \"float specularStrength;\\n#ifdef USE_SPECULARMAP\\n\\tvec4 texelSpecular = texture2D( specularMap, vUv );\\n\\tspecularStrength = texelSpecular.r;\\n#else\\n\\tspecularStrength = 1.0;\\n#endif\";\n\nvar specularmap_pars_fragment = \"#ifdef USE_SPECULARMAP\\n\\tuniform sampler2D specularMap;\\n#endif\";\n\nvar tonemapping_fragment = \"#if defined( TONE_MAPPING )\\n\\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\n#endif\";\n\nvar tonemapping_pars_fragment = \"#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\nuniform float toneMappingExposure;\\nvec3 LinearToneMapping( vec3 color ) {\\n\\treturn toneMappingExposure * color;\\n}\\nvec3 ReinhardToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\treturn saturate( color / ( vec3( 1.0 ) + color ) );\\n}\\nvec3 OptimizedCineonToneMapping( vec3 color ) {\\n\\tcolor *= toneMappingExposure;\\n\\tcolor = max( vec3( 0.0 ), color - 0.004 );\\n\\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\\n}\\nvec3 RRTAndODTFit( vec3 v ) {\\n\\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\\n\\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\\n\\treturn a / b;\\n}\\nvec3 ACESFilmicToneMapping( vec3 color ) {\\n\\tconst mat3 ACESInputMat = mat3(\\n\\t\\tvec3( 0.59719, 0.07600, 0.02840 ),\\t\\tvec3( 0.35458, 0.90834, 0.13383 ),\\n\\t\\tvec3( 0.04823, 0.01566, 0.83777 )\\n\\t);\\n\\tconst mat3 ACESOutputMat = mat3(\\n\\t\\tvec3( 1.60475, -0.10208, -0.00327 ),\\t\\tvec3( -0.53108, 1.10813, -0.07276 ),\\n\\t\\tvec3( -0.07367, -0.00605, 1.07602 )\\n\\t);\\n\\tcolor *= toneMappingExposure / 0.6;\\n\\tcolor = ACESInputMat * color;\\n\\tcolor = RRTAndODTFit( color );\\n\\tcolor = ACESOutputMat * color;\\n\\treturn saturate( color );\\n}\\nvec3 CustomToneMapping( vec3 color ) { return color; }\";\n\nvar transmission_fragment = \"#ifdef USE_TRANSMISSION\\n\\tfloat transmissionAlpha = 1.0;\\n\\tfloat transmissionFactor = transmission;\\n\\tfloat thicknessFactor = thickness;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\\n\\t#endif\\n\\tvec3 pos = vWorldPosition;\\n\\tvec3 v = normalize( cameraPosition - pos );\\n\\tvec3 n = inverseTransformDirection( normal, viewMatrix );\\n\\tvec4 transmission = getIBLVolumeRefraction(\\n\\t\\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\\n\\t\\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\\n\\t\\tattenuationColor, attenuationDistance );\\n\\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\\n\\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\\n#endif\";\n\nvar transmission_pars_fragment = \"#ifdef USE_TRANSMISSION\\n\\tuniform float transmission;\\n\\tuniform float thickness;\\n\\tuniform float attenuationDistance;\\n\\tuniform vec3 attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tuniform sampler2D transmissionMap;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tuniform sampler2D thicknessMap;\\n\\t#endif\\n\\tuniform vec2 transmissionSamplerSize;\\n\\tuniform sampler2D transmissionSamplerMap;\\n\\tuniform mat4 modelMatrix;\\n\\tuniform mat4 projectionMatrix;\\n\\tvarying vec3 vWorldPosition;\\n\\tvec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {\\n\\t\\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\\n\\t\\tvec3 modelScale;\\n\\t\\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\\n\\t\\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\\n\\t\\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\\n\\t\\treturn normalize( refractionVector ) * thickness * modelScale;\\n\\t}\\n\\tfloat applyIorToRoughness( float roughness, float ior ) {\\n\\t\\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\\n\\t}\\n\\tvec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior ) {\\n\\t\\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\\n\\t\\t#ifdef TEXTURE_LOD_EXT\\n\\t\\t\\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\\n\\t\\t#else\\n\\t\\t\\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\\n\\t\\t#endif\\n\\t}\\n\\tvec3 applyVolumeAttenuation( vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance ) {\\n\\t\\tif ( attenuationDistance == 0.0 ) {\\n\\t\\t\\treturn radiance;\\n\\t\\t} else {\\n\\t\\t\\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\\n\\t\\t\\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\\t\\t\\treturn transmittance * radiance;\\n\\t\\t}\\n\\t}\\n\\tvec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 diffuseColor, vec3 specularColor, float specularF90,\\n\\t\\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\\n\\t\\tvec3 attenuationColor, float attenuationDistance ) {\\n\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\trefractionCoords += 1.0;\\n\\t\\trefractionCoords /= 2.0;\\n\\t\\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\\t\\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\\n\\t\\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\\n\\t\\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\\n\\t}\\n#endif\";\n\nvar uv_pars_fragment = \"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\\n\\tvarying vec2 vUv;\\n#endif\";\n\nvar uv_pars_vertex = \"#ifdef USE_UV\\n\\t#ifdef UVS_VERTEX_ONLY\\n\\t\\tvec2 vUv;\\n\\t#else\\n\\t\\tvarying vec2 vUv;\\n\\t#endif\\n\\tuniform mat3 uvTransform;\\n#endif\";\n\nvar uv_vertex = \"#ifdef USE_UV\\n\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n#endif\";\n\nvar uv2_pars_fragment = \"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\\n\\tvarying vec2 vUv2;\\n#endif\";\n\nvar uv2_pars_vertex = \"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\\n\\tattribute vec2 uv2;\\n\\tvarying vec2 vUv2;\\n\\tuniform mat3 uv2Transform;\\n#endif\";\n\nvar uv2_vertex = \"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\\n\\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\\n#endif\";\n\nvar worldpos_vertex = \"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\\n\\tvec4 worldPosition = vec4( transformed, 1.0 );\\n\\t#ifdef USE_INSTANCING\\n\\t\\tworldPosition = instanceMatrix * worldPosition;\\n\\t#endif\\n\\tworldPosition = modelMatrix * worldPosition;\\n#endif\";\n\nconst vertex$g = \"varying vec2 vUv;\\nuniform mat3 uvTransform;\\nvoid main() {\\n\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\tgl_Position = vec4( position.xy, 1.0, 1.0 );\\n}\";\n\nconst fragment$g = \"uniform sampler2D t2D;\\nvarying vec2 vUv;\\nvoid main() {\\n\\tvec4 texColor = texture2D( t2D, vUv );\\n\\tgl_FragColor = mapTexelToLinear( texColor );\\n\\t#include <tonemapping_fragment>\\n\\t#include <encodings_fragment>\\n}\";\n\nconst vertex$f = \"varying vec3 vWorldDirection;\\n#include <common>\\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include <begin_vertex>\\n\\t#include <project_vertex>\\n\\tgl_Position.z = gl_Position.w;\\n}\";\n\nconst fragment$f = \"#include <envmap_common_pars_fragment>\\nuniform float opacity;\\nvarying vec3 vWorldDirection;\\n#include <cube_uv_reflection_fragment>\\nvoid main() {\\n\\tvec3 vReflect = vWorldDirection;\\n\\t#include <envmap_fragment>\\n\\tgl_FragColor = envColor;\\n\\tgl_FragColor.a *= opacity;\\n\\t#include <tonemapping_fragment>\\n\\t#include <encodings_fragment>\\n}\";\n\nconst vertex$e = \"#include <common>\\n#include <uv_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include <beginnormal_vertex>\\n\\t\\t#include <morphnormal_vertex>\\n\\t\\t#include <skinnormal_vertex>\\n\\t#endif\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\tvHighPrecisionZW = gl_Position.zw;\\n}\";\n\nconst fragment$e = \"#if DEPTH_PACKING == 3200\\n\\tuniform float opacity;\\n#endif\\n#include <common>\\n#include <packing>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvarying vec2 vHighPrecisionZW;\\nvoid main() {\\n\\t#include <clipping_planes_fragment>\\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tdiffuseColor.a = opacity;\\n\\t#endif\\n\\t#include <map_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <logdepthbuf_fragment>\\n\\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\\n\\t#elif DEPTH_PACKING == 3201\\n\\t\\tgl_FragColor = packDepthToRGBA( fragCoordZ );\\n\\t#endif\\n}\";\n\nconst vertex$d = \"#define DISTANCE\\nvarying vec3 vWorldPosition;\\n#include <common>\\n#include <uv_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#ifdef USE_DISPLACEMENTMAP\\n\\t\\t#include <beginnormal_vertex>\\n\\t\\t#include <morphnormal_vertex>\\n\\t\\t#include <skinnormal_vertex>\\n\\t#endif\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <worldpos_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\tvWorldPosition = worldPosition.xyz;\\n}\";\n\nconst fragment$d = \"#define DISTANCE\\nuniform vec3 referencePosition;\\nuniform float nearDistance;\\nuniform float farDistance;\\nvarying vec3 vWorldPosition;\\n#include <common>\\n#include <packing>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main () {\\n\\t#include <clipping_planes_fragment>\\n\\tvec4 diffuseColor = vec4( 1.0 );\\n\\t#include <map_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\tfloat dist = length( vWorldPosition - referencePosition );\\n\\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\\n\\tdist = saturate( dist );\\n\\tgl_FragColor = packDepthToRGBA( dist );\\n}\";\n\nconst vertex$c = \"varying vec3 vWorldDirection;\\n#include <common>\\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include <begin_vertex>\\n\\t#include <project_vertex>\\n}\";\n\nconst fragment$c = \"uniform sampler2D tEquirect;\\nvarying vec3 vWorldDirection;\\n#include <common>\\nvoid main() {\\n\\tvec3 direction = normalize( vWorldDirection );\\n\\tvec2 sampleUV = equirectUv( direction );\\n\\tvec4 texColor = texture2D( tEquirect, sampleUV );\\n\\tgl_FragColor = mapTexelToLinear( texColor );\\n\\t#include <tonemapping_fragment>\\n\\t#include <encodings_fragment>\\n}\";\n\nconst vertex$b = \"uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;\\n#include <common>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\tvLineDistance = scale * lineDistance;\\n\\t#include <color_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$b = \"uniform vec3 diffuse;\\nuniform float opacity;\\nuniform float dashSize;\\nuniform float totalSize;\\nvarying float vLineDistance;\\n#include <common>\\n#include <color_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\t#include <clipping_planes_fragment>\\n\\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\\n\\t\\tdiscard;\\n\\t}\\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <color_fragment>\\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include <output_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <encodings_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n}\";\n\nconst vertex$a = \"#include <common>\\n#include <uv_pars_vertex>\\n#include <uv2_pars_vertex>\\n#include <envmap_pars_vertex>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <uv2_vertex>\\n\\t#include <color_vertex>\\n\\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\\n\\t\\t#include <beginnormal_vertex>\\n\\t\\t#include <morphnormal_vertex>\\n\\t\\t#include <skinbase_vertex>\\n\\t\\t#include <skinnormal_vertex>\\n\\t\\t#include <defaultnormal_vertex>\\n\\t#endif\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\t#include <worldpos_vertex>\\n\\t#include <envmap_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$a = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n#endif\\n#include <common>\\n#include <dithering_pars_fragment>\\n#include <color_pars_fragment>\\n#include <uv_pars_fragment>\\n#include <uv2_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <aomap_pars_fragment>\\n#include <lightmap_pars_fragment>\\n#include <envmap_common_pars_fragment>\\n#include <envmap_pars_fragment>\\n#include <cube_uv_reflection_fragment>\\n#include <fog_pars_fragment>\\n#include <specularmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\t#include <clipping_planes_fragment>\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <specularmap_fragment>\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\\n\\t\\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\\n\\t#else\\n\\t\\treflectedLight.indirectDiffuse += vec3( 1.0 );\\n\\t#endif\\n\\t#include <aomap_fragment>\\n\\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\\n\\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\\n\\t#include <envmap_fragment>\\n\\t#include <output_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <encodings_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n\\t#include <dithering_fragment>\\n}\";\n\nconst vertex$9 = \"#define LAMBERT\\nvarying vec3 vLightFront;\\nvarying vec3 vIndirectFront;\\n#ifdef DOUBLE_SIDED\\n\\tvarying vec3 vLightBack;\\n\\tvarying vec3 vIndirectBack;\\n#endif\\n#include <common>\\n#include <uv_pars_vertex>\\n#include <uv2_pars_vertex>\\n#include <envmap_pars_vertex>\\n#include <bsdfs>\\n#include <lights_pars_begin>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <shadowmap_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <uv2_vertex>\\n\\t#include <color_vertex>\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\t#include <worldpos_vertex>\\n\\t#include <envmap_vertex>\\n\\t#include <lights_lambert_vertex>\\n\\t#include <shadowmap_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$9 = \"uniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\nvarying vec3 vLightFront;\\nvarying vec3 vIndirectFront;\\n#ifdef DOUBLE_SIDED\\n\\tvarying vec3 vLightBack;\\n\\tvarying vec3 vIndirectBack;\\n#endif\\n#include <common>\\n#include <packing>\\n#include <dithering_pars_fragment>\\n#include <color_pars_fragment>\\n#include <uv_pars_fragment>\\n#include <uv2_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <aomap_pars_fragment>\\n#include <lightmap_pars_fragment>\\n#include <emissivemap_pars_fragment>\\n#include <envmap_common_pars_fragment>\\n#include <envmap_pars_fragment>\\n#include <cube_uv_reflection_fragment>\\n#include <bsdfs>\\n#include <lights_pars_begin>\\n#include <fog_pars_fragment>\\n#include <shadowmap_pars_fragment>\\n#include <shadowmask_pars_fragment>\\n#include <specularmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\t#include <clipping_planes_fragment>\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <specularmap_fragment>\\n\\t#include <emissivemap_fragment>\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\\n\\t#else\\n\\t\\treflectedLight.indirectDiffuse += vIndirectFront;\\n\\t#endif\\n\\t#include <lightmap_fragment>\\n\\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\\n\\t#else\\n\\t\\treflectedLight.directDiffuse = vLightFront;\\n\\t#endif\\n\\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\\n\\t#include <aomap_fragment>\\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include <envmap_fragment>\\n\\t#include <output_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <encodings_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n\\t#include <dithering_fragment>\\n}\";\n\nconst vertex$8 = \"#define MATCAP\\nvarying vec3 vViewPosition;\\n#include <common>\\n#include <uv_pars_vertex>\\n#include <color_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <normal_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <color_vertex>\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <normal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\t#include <fog_vertex>\\n\\tvViewPosition = - mvPosition.xyz;\\n}\";\n\nconst fragment$8 = \"#define MATCAP\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform sampler2D matcap;\\nvarying vec3 vViewPosition;\\n#include <common>\\n#include <dithering_pars_fragment>\\n#include <color_pars_fragment>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <normal_pars_fragment>\\n#include <bumpmap_pars_fragment>\\n#include <normalmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\t#include <clipping_planes_fragment>\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <normal_fragment_begin>\\n\\t#include <normal_fragment_maps>\\n\\tvec3 viewDir = normalize( vViewPosition );\\n\\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\\n\\tvec3 y = cross( viewDir, x );\\n\\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\\n\\t#ifdef USE_MATCAP\\n\\t\\tvec4 matcapColor = texture2D( matcap, uv );\\n\\t\\tmatcapColor = matcapTexelToLinear( matcapColor );\\n\\t#else\\n\\t\\tvec4 matcapColor = vec4( 1.0 );\\n\\t#endif\\n\\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\\n\\t#include <output_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <encodings_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n\\t#include <dithering_fragment>\\n}\";\n\nconst vertex$7 = \"#define NORMAL\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include <common>\\n#include <uv_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <normal_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <normal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\\n\\tvViewPosition = - mvPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$7 = \"#define NORMAL\\nuniform float opacity;\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\\n\\tvarying vec3 vViewPosition;\\n#endif\\n#include <packing>\\n#include <uv_pars_fragment>\\n#include <normal_pars_fragment>\\n#include <bumpmap_pars_fragment>\\n#include <normalmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\t#include <clipping_planes_fragment>\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <normal_fragment_begin>\\n\\t#include <normal_fragment_maps>\\n\\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\\n}\";\n\nconst vertex$6 = \"#define PHONG\\nvarying vec3 vViewPosition;\\n#include <common>\\n#include <uv_pars_vertex>\\n#include <uv2_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <envmap_pars_vertex>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <normal_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <shadowmap_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <uv2_vertex>\\n\\t#include <color_vertex>\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <normal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include <worldpos_vertex>\\n\\t#include <envmap_vertex>\\n\\t#include <shadowmap_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$6 = \"#define PHONG\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform vec3 specular;\\nuniform float shininess;\\nuniform float opacity;\\n#include <common>\\n#include <packing>\\n#include <dithering_pars_fragment>\\n#include <color_pars_fragment>\\n#include <uv_pars_fragment>\\n#include <uv2_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <aomap_pars_fragment>\\n#include <lightmap_pars_fragment>\\n#include <emissivemap_pars_fragment>\\n#include <envmap_common_pars_fragment>\\n#include <envmap_pars_fragment>\\n#include <cube_uv_reflection_fragment>\\n#include <fog_pars_fragment>\\n#include <bsdfs>\\n#include <lights_pars_begin>\\n#include <normal_pars_fragment>\\n#include <lights_phong_pars_fragment>\\n#include <shadowmap_pars_fragment>\\n#include <bumpmap_pars_fragment>\\n#include <normalmap_pars_fragment>\\n#include <specularmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\t#include <clipping_planes_fragment>\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <specularmap_fragment>\\n\\t#include <normal_fragment_begin>\\n\\t#include <normal_fragment_maps>\\n\\t#include <emissivemap_fragment>\\n\\t#include <lights_phong_fragment>\\n\\t#include <lights_fragment_begin>\\n\\t#include <lights_fragment_maps>\\n\\t#include <lights_fragment_end>\\n\\t#include <aomap_fragment>\\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\\n\\t#include <envmap_fragment>\\n\\t#include <output_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <encodings_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n\\t#include <dithering_fragment>\\n}\";\n\nconst vertex$5 = \"#define STANDARD\\nvarying vec3 vViewPosition;\\n#ifdef USE_TRANSMISSION\\n\\tvarying vec3 vWorldPosition;\\n#endif\\n#include <common>\\n#include <uv_pars_vertex>\\n#include <uv2_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <normal_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <shadowmap_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <uv2_vertex>\\n\\t#include <color_vertex>\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <normal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include <worldpos_vertex>\\n\\t#include <shadowmap_vertex>\\n\\t#include <fog_vertex>\\n#ifdef USE_TRANSMISSION\\n\\tvWorldPosition = worldPosition.xyz;\\n#endif\\n}\";\n\nconst fragment$5 = \"#define STANDARD\\n#ifdef PHYSICAL\\n\\t#define IOR\\n\\t#define SPECULAR\\n#endif\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float roughness;\\nuniform float metalness;\\nuniform float opacity;\\n#ifdef IOR\\n\\tuniform float ior;\\n#endif\\n#ifdef SPECULAR\\n\\tuniform float specularIntensity;\\n\\tuniform vec3 specularColor;\\n\\t#ifdef USE_SPECULARINTENSITYMAP\\n\\t\\tuniform sampler2D specularIntensityMap;\\n\\t#endif\\n\\t#ifdef USE_SPECULARCOLORMAP\\n\\t\\tuniform sampler2D specularColorMap;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tuniform float clearcoat;\\n\\tuniform float clearcoatRoughness;\\n#endif\\n#ifdef USE_SHEEN\\n\\tuniform vec3 sheenColor;\\n\\tuniform float sheenRoughness;\\n\\t#ifdef USE_SHEENCOLORMAP\\n\\t\\tuniform sampler2D sheenColorMap;\\n\\t#endif\\n\\t#ifdef USE_SHEENROUGHNESSMAP\\n\\t\\tuniform sampler2D sheenRoughnessMap;\\n\\t#endif\\n#endif\\nvarying vec3 vViewPosition;\\n#include <common>\\n#include <packing>\\n#include <dithering_pars_fragment>\\n#include <color_pars_fragment>\\n#include <uv_pars_fragment>\\n#include <uv2_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <aomap_pars_fragment>\\n#include <lightmap_pars_fragment>\\n#include <emissivemap_pars_fragment>\\n#include <bsdfs>\\n#include <cube_uv_reflection_fragment>\\n#include <envmap_common_pars_fragment>\\n#include <envmap_physical_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <lights_pars_begin>\\n#include <normal_pars_fragment>\\n#include <lights_physical_pars_fragment>\\n#include <transmission_pars_fragment>\\n#include <shadowmap_pars_fragment>\\n#include <bumpmap_pars_fragment>\\n#include <normalmap_pars_fragment>\\n#include <clearcoat_pars_fragment>\\n#include <roughnessmap_pars_fragment>\\n#include <metalnessmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\t#include <clipping_planes_fragment>\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <roughnessmap_fragment>\\n\\t#include <metalnessmap_fragment>\\n\\t#include <normal_fragment_begin>\\n\\t#include <normal_fragment_maps>\\n\\t#include <clearcoat_normal_fragment_begin>\\n\\t#include <clearcoat_normal_fragment_maps>\\n\\t#include <emissivemap_fragment>\\n\\t#include <lights_physical_fragment>\\n\\t#include <lights_fragment_begin>\\n\\t#include <lights_fragment_maps>\\n\\t#include <lights_fragment_end>\\n\\t#include <aomap_fragment>\\n\\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\\n\\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\\n\\t#include <transmission_fragment>\\n\\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\\n\\t\\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\n\\t\\toutgoingLight = outgoingLight * ( 1.0 - clearcoat * Fcc ) + clearcoatSpecular * clearcoat;\\n\\t#endif\\n\\t#include <output_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <encodings_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n\\t#include <dithering_fragment>\\n}\";\n\nconst vertex$4 = \"#define TOON\\nvarying vec3 vViewPosition;\\n#include <common>\\n#include <uv_pars_vertex>\\n#include <uv2_pars_vertex>\\n#include <displacementmap_pars_vertex>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <normal_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <shadowmap_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\t#include <uv2_vertex>\\n\\t#include <color_vertex>\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <normal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <displacementmap_vertex>\\n\\t#include <project_vertex>\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\tvViewPosition = - mvPosition.xyz;\\n\\t#include <worldpos_vertex>\\n\\t#include <shadowmap_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$4 = \"#define TOON\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float opacity;\\n#include <common>\\n#include <packing>\\n#include <dithering_pars_fragment>\\n#include <color_pars_fragment>\\n#include <uv_pars_fragment>\\n#include <uv2_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <aomap_pars_fragment>\\n#include <lightmap_pars_fragment>\\n#include <emissivemap_pars_fragment>\\n#include <gradientmap_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <bsdfs>\\n#include <lights_pars_begin>\\n#include <normal_pars_fragment>\\n#include <lights_toon_pars_fragment>\\n#include <shadowmap_pars_fragment>\\n#include <bumpmap_pars_fragment>\\n#include <normalmap_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\t#include <clipping_planes_fragment>\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\\n\\tvec3 totalEmissiveRadiance = emissive;\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\t#include <normal_fragment_begin>\\n\\t#include <normal_fragment_maps>\\n\\t#include <emissivemap_fragment>\\n\\t#include <lights_toon_fragment>\\n\\t#include <lights_fragment_begin>\\n\\t#include <lights_fragment_maps>\\n\\t#include <lights_fragment_end>\\n\\t#include <aomap_fragment>\\n\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include <output_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <encodings_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n\\t#include <dithering_fragment>\\n}\";\n\nconst vertex$3 = \"uniform float size;\\nuniform float scale;\\n#include <common>\\n#include <color_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <color_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <project_vertex>\\n\\tgl_PointSize = size;\\n\\t#ifdef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\\n\\t#endif\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\t#include <worldpos_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$3 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include <common>\\n#include <color_pars_fragment>\\n#include <map_particle_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\t#include <clipping_planes_fragment>\\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_particle_fragment>\\n\\t#include <color_fragment>\\n\\t#include <alphatest_fragment>\\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include <output_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <encodings_fragment>\\n\\t#include <fog_fragment>\\n\\t#include <premultiplied_alpha_fragment>\\n}\";\n\nconst vertex$2 = \"#include <common>\\n#include <fog_pars_vertex>\\n#include <morphtarget_pars_vertex>\\n#include <skinning_pars_vertex>\\n#include <shadowmap_pars_vertex>\\nvoid main() {\\n\\t#include <beginnormal_vertex>\\n\\t#include <morphnormal_vertex>\\n\\t#include <skinbase_vertex>\\n\\t#include <skinnormal_vertex>\\n\\t#include <defaultnormal_vertex>\\n\\t#include <begin_vertex>\\n\\t#include <morphtarget_vertex>\\n\\t#include <skinning_vertex>\\n\\t#include <project_vertex>\\n\\t#include <worldpos_vertex>\\n\\t#include <shadowmap_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$2 = \"uniform vec3 color;\\nuniform float opacity;\\n#include <common>\\n#include <packing>\\n#include <fog_pars_fragment>\\n#include <bsdfs>\\n#include <lights_pars_begin>\\n#include <shadowmap_pars_fragment>\\n#include <shadowmask_pars_fragment>\\nvoid main() {\\n\\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\n\\t#include <tonemapping_fragment>\\n\\t#include <encodings_fragment>\\n\\t#include <fog_fragment>\\n}\";\n\nconst vertex$1 = \"uniform float rotation;\\nuniform vec2 center;\\n#include <common>\\n#include <uv_pars_vertex>\\n#include <fog_pars_vertex>\\n#include <logdepthbuf_pars_vertex>\\n#include <clipping_planes_pars_vertex>\\nvoid main() {\\n\\t#include <uv_vertex>\\n\\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\tvec2 scale;\\n\\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\\n\\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\\n\\t#ifndef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) scale *= - mvPosition.z;\\n\\t#endif\\n\\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\\n\\tvec2 rotatedPosition;\\n\\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\\n\\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\\n\\tmvPosition.xy += rotatedPosition;\\n\\tgl_Position = projectionMatrix * mvPosition;\\n\\t#include <logdepthbuf_vertex>\\n\\t#include <clipping_planes_vertex>\\n\\t#include <fog_vertex>\\n}\";\n\nconst fragment$1 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include <common>\\n#include <uv_pars_fragment>\\n#include <map_pars_fragment>\\n#include <alphamap_pars_fragment>\\n#include <alphatest_pars_fragment>\\n#include <fog_pars_fragment>\\n#include <logdepthbuf_pars_fragment>\\n#include <clipping_planes_pars_fragment>\\nvoid main() {\\n\\t#include <clipping_planes_fragment>\\n\\tvec3 outgoingLight = vec3( 0.0 );\\n\\tvec4 diffuseColor = vec4( diffuse, opacity );\\n\\t#include <logdepthbuf_fragment>\\n\\t#include <map_fragment>\\n\\t#include <alphamap_fragment>\\n\\t#include <alphatest_fragment>\\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include <output_fragment>\\n\\t#include <tonemapping_fragment>\\n\\t#include <encodings_fragment>\\n\\t#include <fog_fragment>\\n}\";\n\nconst ShaderChunk = {\n\talphamap_fragment: alphamap_fragment,\n\talphamap_pars_fragment: alphamap_pars_fragment,\n\talphatest_fragment: alphatest_fragment,\n\talphatest_pars_fragment: alphatest_pars_fragment,\n\taomap_fragment: aomap_fragment,\n\taomap_pars_fragment: aomap_pars_fragment,\n\tbegin_vertex: begin_vertex,\n\tbeginnormal_vertex: beginnormal_vertex,\n\tbsdfs: bsdfs,\n\tbumpmap_pars_fragment: bumpmap_pars_fragment,\n\tclipping_planes_fragment: clipping_planes_fragment,\n\tclipping_planes_pars_fragment: clipping_planes_pars_fragment,\n\tclipping_planes_pars_vertex: clipping_planes_pars_vertex,\n\tclipping_planes_vertex: clipping_planes_vertex,\n\tcolor_fragment: color_fragment,\n\tcolor_pars_fragment: color_pars_fragment,\n\tcolor_pars_vertex: color_pars_vertex,\n\tcolor_vertex: color_vertex,\n\tcommon: common,\n\tcube_uv_reflection_fragment: cube_uv_reflection_fragment,\n\tdefaultnormal_vertex: defaultnormal_vertex,\n\tdisplacementmap_pars_vertex: displacementmap_pars_vertex,\n\tdisplacementmap_vertex: displacementmap_vertex,\n\temissivemap_fragment: emissivemap_fragment,\n\temissivemap_pars_fragment: emissivemap_pars_fragment,\n\tencodings_fragment: encodings_fragment,\n\tencodings_pars_fragment: encodings_pars_fragment,\n\tenvmap_fragment: envmap_fragment,\n\tenvmap_common_pars_fragment: envmap_common_pars_fragment,\n\tenvmap_pars_fragment: envmap_pars_fragment,\n\tenvmap_pars_vertex: envmap_pars_vertex,\n\tenvmap_physical_pars_fragment: envmap_physical_pars_fragment,\n\tenvmap_vertex: envmap_vertex,\n\tfog_vertex: fog_vertex,\n\tfog_pars_vertex: fog_pars_vertex,\n\tfog_fragment: fog_fragment,\n\tfog_pars_fragment: fog_pars_fragment,\n\tgradientmap_pars_fragment: gradientmap_pars_fragment,\n\tlightmap_fragment: lightmap_fragment,\n\tlightmap_pars_fragment: lightmap_pars_fragment,\n\tlights_lambert_vertex: lights_lambert_vertex,\n\tlights_pars_begin: lights_pars_begin,\n\tlights_toon_fragment: lights_toon_fragment,\n\tlights_toon_pars_fragment: lights_toon_pars_fragment,\n\tlights_phong_fragment: lights_phong_fragment,\n\tlights_phong_pars_fragment: lights_phong_pars_fragment,\n\tlights_physical_fragment: lights_physical_fragment,\n\tlights_physical_pars_fragment: lights_physical_pars_fragment,\n\tlights_fragment_begin: lights_fragment_begin,\n\tlights_fragment_maps: lights_fragment_maps,\n\tlights_fragment_end: lights_fragment_end,\n\tlogdepthbuf_fragment: logdepthbuf_fragment,\n\tlogdepthbuf_pars_fragment: logdepthbuf_pars_fragment,\n\tlogdepthbuf_pars_vertex: logdepthbuf_pars_vertex,\n\tlogdepthbuf_vertex: logdepthbuf_vertex,\n\tmap_fragment: map_fragment,\n\tmap_pars_fragment: map_pars_fragment,\n\tmap_particle_fragment: map_particle_fragment,\n\tmap_particle_pars_fragment: map_particle_pars_fragment,\n\tmetalnessmap_fragment: metalnessmap_fragment,\n\tmetalnessmap_pars_fragment: metalnessmap_pars_fragment,\n\tmorphnormal_vertex: morphnormal_vertex,\n\tmorphtarget_pars_vertex: morphtarget_pars_vertex,\n\tmorphtarget_vertex: morphtarget_vertex,\n\tnormal_fragment_begin: normal_fragment_begin,\n\tnormal_fragment_maps: normal_fragment_maps,\n\tnormal_pars_fragment: normal_pars_fragment,\n\tnormal_pars_vertex: normal_pars_vertex,\n\tnormal_vertex: normal_vertex,\n\tnormalmap_pars_fragment: normalmap_pars_fragment,\n\tclearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,\n\tclearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,\n\tclearcoat_pars_fragment: clearcoat_pars_fragment,\n\toutput_fragment: output_fragment,\n\tpacking: packing,\n\tpremultiplied_alpha_fragment: premultiplied_alpha_fragment,\n\tproject_vertex: project_vertex,\n\tdithering_fragment: dithering_fragment,\n\tdithering_pars_fragment: dithering_pars_fragment,\n\troughnessmap_fragment: roughnessmap_fragment,\n\troughnessmap_pars_fragment: roughnessmap_pars_fragment,\n\tshadowmap_pars_fragment: shadowmap_pars_fragment,\n\tshadowmap_pars_vertex: shadowmap_pars_vertex,\n\tshadowmap_vertex: shadowmap_vertex,\n\tshadowmask_pars_fragment: shadowmask_pars_fragment,\n\tskinbase_vertex: skinbase_vertex,\n\tskinning_pars_vertex: skinning_pars_vertex,\n\tskinning_vertex: skinning_vertex,\n\tskinnormal_vertex: skinnormal_vertex,\n\tspecularmap_fragment: specularmap_fragment,\n\tspecularmap_pars_fragment: specularmap_pars_fragment,\n\ttonemapping_fragment: tonemapping_fragment,\n\ttonemapping_pars_fragment: tonemapping_pars_fragment,\n\ttransmission_fragment: transmission_fragment,\n\ttransmission_pars_fragment: transmission_pars_fragment,\n\tuv_pars_fragment: uv_pars_fragment,\n\tuv_pars_vertex: uv_pars_vertex,\n\tuv_vertex: uv_vertex,\n\tuv2_pars_fragment: uv2_pars_fragment,\n\tuv2_pars_vertex: uv2_pars_vertex,\n\tuv2_vertex: uv2_vertex,\n\tworldpos_vertex: worldpos_vertex,\n\n\tbackground_vert: vertex$g,\n\tbackground_frag: fragment$g,\n\tcube_vert: vertex$f,\n\tcube_frag: fragment$f,\n\tdepth_vert: vertex$e,\n\tdepth_frag: fragment$e,\n\tdistanceRGBA_vert: vertex$d,\n\tdistanceRGBA_frag: fragment$d,\n\tequirect_vert: vertex$c,\n\tequirect_frag: fragment$c,\n\tlinedashed_vert: vertex$b,\n\tlinedashed_frag: fragment$b,\n\tmeshbasic_vert: vertex$a,\n\tmeshbasic_frag: fragment$a,\n\tmeshlambert_vert: vertex$9,\n\tmeshlambert_frag: fragment$9,\n\tmeshmatcap_vert: vertex$8,\n\tmeshmatcap_frag: fragment$8,\n\tmeshnormal_vert: vertex$7,\n\tmeshnormal_frag: fragment$7,\n\tmeshphong_vert: vertex$6,\n\tmeshphong_frag: fragment$6,\n\tmeshphysical_vert: vertex$5,\n\tmeshphysical_frag: fragment$5,\n\tmeshtoon_vert: vertex$4,\n\tmeshtoon_frag: fragment$4,\n\tpoints_vert: vertex$3,\n\tpoints_frag: fragment$3,\n\tshadow_vert: vertex$2,\n\tshadow_frag: fragment$2,\n\tsprite_vert: vertex$1,\n\tsprite_frag: fragment$1\n};\n\n/**\n * Uniforms library for shared webgl shaders\n */\n\nconst UniformsLib = {\n\n\tcommon: {\n\n\t\tdiffuse: { value: new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\n\t\tmap: { value: null },\n\t\tuvTransform: { value: new Matrix3() },\n\t\tuv2Transform: { value: new Matrix3() },\n\n\t\talphaMap: { value: null },\n\t\talphaTest: { value: 0 }\n\n\t},\n\n\tspecularmap: {\n\n\t\tspecularMap: { value: null },\n\n\t},\n\n\tenvmap: {\n\n\t\tenvMap: { value: null },\n\t\tflipEnvMap: { value: - 1 },\n\t\treflectivity: { value: 1.0 }, // basic, lambert, phong\n\t\tior: { value: 1.5 }, // standard, physical\n\t\trefractionRatio: { value: 0.98 },\n\t\tmaxMipLevel: { value: 0 }\n\n\t},\n\n\taomap: {\n\n\t\taoMap: { value: null },\n\t\taoMapIntensity: { value: 1 }\n\n\t},\n\n\tlightmap: {\n\n\t\tlightMap: { value: null },\n\t\tlightMapIntensity: { value: 1 }\n\n\t},\n\n\temissivemap: {\n\n\t\temissiveMap: { value: null }\n\n\t},\n\n\tbumpmap: {\n\n\t\tbumpMap: { value: null },\n\t\tbumpScale: { value: 1 }\n\n\t},\n\n\tnormalmap: {\n\n\t\tnormalMap: { value: null },\n\t\tnormalScale: { value: new Vector2( 1, 1 ) }\n\n\t},\n\n\tdisplacementmap: {\n\n\t\tdisplacementMap: { value: null },\n\t\tdisplacementScale: { value: 1 },\n\t\tdisplacementBias: { value: 0 }\n\n\t},\n\n\troughnessmap: {\n\n\t\troughnessMap: { value: null }\n\n\t},\n\n\tmetalnessmap: {\n\n\t\tmetalnessMap: { value: null }\n\n\t},\n\n\tgradientmap: {\n\n\t\tgradientMap: { value: null }\n\n\t},\n\n\tfog: {\n\n\t\tfogDensity: { value: 0.00025 },\n\t\tfogNear: { value: 1 },\n\t\tfogFar: { value: 2000 },\n\t\tfogColor: { value: new Color( 0xffffff ) }\n\n\t},\n\n\tlights: {\n\n\t\tambientLightColor: { value: [] },\n\n\t\tlightProbe: { value: [] },\n\n\t\tdirectionalLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tcolor: {}\n\t\t} },\n\n\t\tdirectionalLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tdirectionalShadowMap: { value: [] },\n\t\tdirectionalShadowMatrix: { value: [] },\n\n\t\tspotLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdirection: {},\n\t\t\tdistance: {},\n\t\t\tconeCos: {},\n\t\t\tpenumbraCos: {},\n\t\t\tdecay: {}\n\t\t} },\n\n\t\tspotLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {}\n\t\t} },\n\n\t\tspotShadowMap: { value: [] },\n\t\tspotShadowMatrix: { value: [] },\n\n\t\tpointLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\tdecay: {},\n\t\t\tdistance: {}\n\t\t} },\n\n\t\tpointLightShadows: { value: [], properties: {\n\t\t\tshadowBias: {},\n\t\t\tshadowNormalBias: {},\n\t\t\tshadowRadius: {},\n\t\t\tshadowMapSize: {},\n\t\t\tshadowCameraNear: {},\n\t\t\tshadowCameraFar: {}\n\t\t} },\n\n\t\tpointShadowMap: { value: [] },\n\t\tpointShadowMatrix: { value: [] },\n\n\t\themisphereLights: { value: [], properties: {\n\t\t\tdirection: {},\n\t\t\tskyColor: {},\n\t\t\tgroundColor: {}\n\t\t} },\n\n\t\t// TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src\n\t\trectAreaLights: { value: [], properties: {\n\t\t\tcolor: {},\n\t\t\tposition: {},\n\t\t\twidth: {},\n\t\t\theight: {}\n\t\t} },\n\n\t\tltc_1: { value: null },\n\t\tltc_2: { value: null }\n\n\t},\n\n\tpoints: {\n\n\t\tdiffuse: { value: new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tsize: { value: 1.0 },\n\t\tscale: { value: 1.0 },\n\t\tmap: { value: null },\n\t\talphaMap: { value: null },\n\t\talphaTest: { value: 0 },\n\t\tuvTransform: { value: new Matrix3() }\n\n\t},\n\n\tsprite: {\n\n\t\tdiffuse: { value: new Color( 0xffffff ) },\n\t\topacity: { value: 1.0 },\n\t\tcenter: { value: new Vector2( 0.5, 0.5 ) },\n\t\trotation: { value: 0.0 },\n\t\tmap: { value: null },\n\t\talphaMap: { value: null },\n\t\talphaTest: { value: 0 },\n\t\tuvTransform: { value: new Matrix3() }\n\n\t}\n\n};\n\nconst ShaderLib = {\n\n\tbasic: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshbasic_vert,\n\t\tfragmentShader: ShaderChunk.meshbasic_frag\n\n\t},\n\n\tlambert: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshlambert_vert,\n\t\tfragmentShader: ShaderChunk.meshlambert_frag\n\n\t},\n\n\tphong: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.specularmap,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: new Color( 0x000000 ) },\n\t\t\t\tspecular: { value: new Color( 0x111111 ) },\n\t\t\t\tshininess: { value: 30 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphong_vert,\n\t\tfragmentShader: ShaderChunk.meshphong_frag\n\n\t},\n\n\tstandard: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.envmap,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.roughnessmap,\n\t\t\tUniformsLib.metalnessmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: new Color( 0x000000 ) },\n\t\t\t\troughness: { value: 1.0 },\n\t\t\t\tmetalness: { value: 0.0 },\n\t\t\t\tenvMapIntensity: { value: 1 } // temporary\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshphysical_vert,\n\t\tfragmentShader: ShaderChunk.meshphysical_frag\n\n\t},\n\n\ttoon: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.aomap,\n\t\t\tUniformsLib.lightmap,\n\t\t\tUniformsLib.emissivemap,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.gradientmap,\n\t\t\tUniformsLib.fog,\n\t\t\tUniformsLib.lights,\n\t\t\t{\n\t\t\t\temissive: { value: new Color( 0x000000 ) }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshtoon_vert,\n\t\tfragmentShader: ShaderChunk.meshtoon_frag\n\n\t},\n\n\tmatcap: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tmatcap: { value: null }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshmatcap_vert,\n\t\tfragmentShader: ShaderChunk.meshmatcap_frag\n\n\t},\n\n\tpoints: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.points,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.points_vert,\n\t\tfragmentShader: ShaderChunk.points_frag\n\n\t},\n\n\tdashed: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tscale: { value: 1 },\n\t\t\t\tdashSize: { value: 1 },\n\t\t\t\ttotalSize: { value: 2 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.linedashed_vert,\n\t\tfragmentShader: ShaderChunk.linedashed_frag\n\n\t},\n\n\tdepth: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.depth_vert,\n\t\tfragmentShader: ShaderChunk.depth_frag\n\n\t},\n\n\tnormal: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.bumpmap,\n\t\t\tUniformsLib.normalmap,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.meshnormal_vert,\n\t\tfragmentShader: ShaderChunk.meshnormal_frag\n\n\t},\n\n\tsprite: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.sprite,\n\t\t\tUniformsLib.fog\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.sprite_vert,\n\t\tfragmentShader: ShaderChunk.sprite_frag\n\n\t},\n\n\tbackground: {\n\n\t\tuniforms: {\n\t\t\tuvTransform: { value: new Matrix3() },\n\t\t\tt2D: { value: null },\n\t\t},\n\n\t\tvertexShader: ShaderChunk.background_vert,\n\t\tfragmentShader: ShaderChunk.background_frag\n\n\t},\n\t/* -------------------------------------------------------------------------\n\t//\tCube map shader\n\t ------------------------------------------------------------------------- */\n\n\tcube: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.envmap,\n\t\t\t{\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.cube_vert,\n\t\tfragmentShader: ShaderChunk.cube_frag\n\n\t},\n\n\tequirect: {\n\n\t\tuniforms: {\n\t\t\ttEquirect: { value: null },\n\t\t},\n\n\t\tvertexShader: ShaderChunk.equirect_vert,\n\t\tfragmentShader: ShaderChunk.equirect_frag\n\n\t},\n\n\tdistanceRGBA: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.common,\n\t\t\tUniformsLib.displacementmap,\n\t\t\t{\n\t\t\t\treferencePosition: { value: new Vector3() },\n\t\t\t\tnearDistance: { value: 1 },\n\t\t\t\tfarDistance: { value: 1000 }\n\t\t\t}\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.distanceRGBA_vert,\n\t\tfragmentShader: ShaderChunk.distanceRGBA_frag\n\n\t},\n\n\tshadow: {\n\n\t\tuniforms: mergeUniforms( [\n\t\t\tUniformsLib.lights,\n\t\t\tUniformsLib.fog,\n\t\t\t{\n\t\t\t\tcolor: { value: new Color( 0x00000 ) },\n\t\t\t\topacity: { value: 1.0 }\n\t\t\t},\n\t\t] ),\n\n\t\tvertexShader: ShaderChunk.shadow_vert,\n\t\tfragmentShader: ShaderChunk.shadow_frag\n\n\t}\n\n};\n\nShaderLib.physical = {\n\n\tuniforms: mergeUniforms( [\n\t\tShaderLib.standard.uniforms,\n\t\t{\n\t\t\tclearcoat: { value: 0 },\n\t\t\tclearcoatMap: { value: null },\n\t\t\tclearcoatRoughness: { value: 0 },\n\t\t\tclearcoatRoughnessMap: { value: null },\n\t\t\tclearcoatNormalScale: { value: new Vector2( 1, 1 ) },\n\t\t\tclearcoatNormalMap: { value: null },\n\t\t\tsheen: { value: 0 },\n\t\t\tsheenColor: { value: new Color( 0x000000 ) },\n\t\t\tsheenColorMap: { value: null },\n\t\t\tsheenRoughness: { value: 0 },\n\t\t\tsheenRoughnessMap: { value: null },\n\t\t\ttransmission: { value: 0 },\n\t\t\ttransmissionMap: { value: null },\n\t\t\ttransmissionSamplerSize: { value: new Vector2() },\n\t\t\ttransmissionSamplerMap: { value: null },\n\t\t\tthickness: { value: 0 },\n\t\t\tthicknessMap: { value: null },\n\t\t\tattenuationDistance: { value: 0 },\n\t\t\tattenuationColor: { value: new Color( 0x000000 ) },\n\t\t\tspecularIntensity: { value: 0 },\n\t\t\tspecularIntensityMap: { value: null },\n\t\t\tspecularColor: { value: new Color( 1, 1, 1 ) },\n\t\t\tspecularColorMap: { value: null },\n\t\t}\n\t] ),\n\n\tvertexShader: ShaderChunk.meshphysical_vert,\n\tfragmentShader: ShaderChunk.meshphysical_frag\n\n};\n\nfunction WebGLBackground( renderer, cubemaps, state, objects, premultipliedAlpha ) {\n\n\tconst clearColor = new Color( 0x000000 );\n\tlet clearAlpha = 0;\n\n\tlet planeMesh;\n\tlet boxMesh;\n\n\tlet currentBackground = null;\n\tlet currentBackgroundVersion = 0;\n\tlet currentTonemapping = null;\n\n\tfunction render( renderList, scene ) {\n\n\t\tlet forceClear = false;\n\t\tlet background = scene.isScene === true ? scene.background : null;\n\n\t\tif ( background && background.isTexture ) {\n\n\t\t\tbackground = cubemaps.get( background );\n\n\t\t}\n\n\t\t// Ignore background in AR\n\t\t// TODO: Reconsider this.\n\n\t\tconst xr = renderer.xr;\n\t\tconst session = xr.getSession && xr.getSession();\n\n\t\tif ( session && session.environmentBlendMode === 'additive' ) {\n\n\t\t\tbackground = null;\n\n\t\t}\n\n\t\tif ( background === null ) {\n\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t} else if ( background && background.isColor ) {\n\n\t\t\tsetClear( background, 1 );\n\t\t\tforceClear = true;\n\n\t\t}\n\n\t\tif ( renderer.autoClear || forceClear ) {\n\n\t\t\trenderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n\n\t\t}\n\n\t\tif ( background && ( background.isCubeTexture || background.mapping === CubeUVReflectionMapping ) ) {\n\n\t\t\tif ( boxMesh === undefined ) {\n\n\t\t\t\tboxMesh = new Mesh(\n\t\t\t\t\tnew BoxGeometry( 1, 1, 1 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundCubeMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.cube.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.cube.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.cube.fragmentShader,\n\t\t\t\t\t\tside: BackSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'normal' );\n\t\t\t\tboxMesh.geometry.deleteAttribute( 'uv' );\n\n\t\t\t\tboxMesh.onBeforeRender = function ( renderer, scene, camera ) {\n\n\t\t\t\t\tthis.matrixWorld.copyPosition( camera.matrixWorld );\n\n\t\t\t\t};\n\n\t\t\t\t// enable code injection for non-built-in material\n\t\t\t\tObject.defineProperty( boxMesh.material, 'envMap', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.envMap.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( boxMesh );\n\n\t\t\t}\n\n\t\t\tboxMesh.material.uniforms.envMap.value = background;\n\t\t\tboxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tboxMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null );\n\n\t\t} else if ( background && background.isTexture ) {\n\n\t\t\tif ( planeMesh === undefined ) {\n\n\t\t\t\tplaneMesh = new Mesh(\n\t\t\t\t\tnew PlaneGeometry( 2, 2 ),\n\t\t\t\t\tnew ShaderMaterial( {\n\t\t\t\t\t\tname: 'BackgroundMaterial',\n\t\t\t\t\t\tuniforms: cloneUniforms( ShaderLib.background.uniforms ),\n\t\t\t\t\t\tvertexShader: ShaderLib.background.vertexShader,\n\t\t\t\t\t\tfragmentShader: ShaderLib.background.fragmentShader,\n\t\t\t\t\t\tside: FrontSide,\n\t\t\t\t\t\tdepthTest: false,\n\t\t\t\t\t\tdepthWrite: false,\n\t\t\t\t\t\tfog: false\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tplaneMesh.geometry.deleteAttribute( 'normal' );\n\n\t\t\t\t// enable code injection for non-built-in material\n\t\t\t\tObject.defineProperty( planeMesh.material, 'map', {\n\n\t\t\t\t\tget: function () {\n\n\t\t\t\t\t\treturn this.uniforms.t2D.value;\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\tobjects.update( planeMesh );\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.t2D.value = background;\n\n\t\t\tif ( background.matrixAutoUpdate === true ) {\n\n\t\t\t\tbackground.updateMatrix();\n\n\t\t\t}\n\n\t\t\tplaneMesh.material.uniforms.uvTransform.value.copy( background.matrix );\n\n\t\t\tif ( currentBackground !== background ||\n\t\t\t\tcurrentBackgroundVersion !== background.version ||\n\t\t\t\tcurrentTonemapping !== renderer.toneMapping ) {\n\n\t\t\t\tplaneMesh.material.needsUpdate = true;\n\n\t\t\t\tcurrentBackground = background;\n\t\t\t\tcurrentBackgroundVersion = background.version;\n\t\t\t\tcurrentTonemapping = renderer.toneMapping;\n\n\t\t\t}\n\n\n\t\t\t// push to the pre-sorted opaque render list\n\t\t\trenderList.unshift( planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null );\n\n\t\t}\n\n\t}\n\n\tfunction setClear( color, alpha ) {\n\n\t\tstate.buffers.color.setClear( color.r, color.g, color.b, alpha, premultipliedAlpha );\n\n\t}\n\n\treturn {\n\n\t\tgetClearColor: function () {\n\n\t\t\treturn clearColor;\n\n\t\t},\n\t\tsetClearColor: function ( color, alpha = 1 ) {\n\n\t\t\tclearColor.set( color );\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\tgetClearAlpha: function () {\n\n\t\t\treturn clearAlpha;\n\n\t\t},\n\t\tsetClearAlpha: function ( alpha ) {\n\n\t\t\tclearAlpha = alpha;\n\t\t\tsetClear( clearColor, clearAlpha );\n\n\t\t},\n\t\trender: render\n\n\t};\n\n}\n\nfunction WebGLBindingStates( gl, extensions, attributes, capabilities ) {\n\n\tconst maxVertexAttributes = gl.getParameter( 34921 );\n\n\tconst extension = capabilities.isWebGL2 ? null : extensions.get( 'OES_vertex_array_object' );\n\tconst vaoAvailable = capabilities.isWebGL2 || extension !== null;\n\n\tconst bindingStates = {};\n\n\tconst defaultState = createBindingState( null );\n\tlet currentState = defaultState;\n\n\tfunction setup( object, material, program, geometry, index ) {\n\n\t\tlet updateBuffers = false;\n\n\t\tif ( vaoAvailable ) {\n\n\t\t\tconst state = getBindingState( geometry, program, material );\n\n\t\t\tif ( currentState !== state ) {\n\n\t\t\t\tcurrentState = state;\n\t\t\t\tbindVertexArrayObject( currentState.object );\n\n\t\t\t}\n\n\t\t\tupdateBuffers = needsUpdate( geometry, index );\n\n\t\t\tif ( updateBuffers ) saveCache( geometry, index );\n\n\t\t} else {\n\n\t\t\tconst wireframe = ( material.wireframe === true );\n\n\t\t\tif ( currentState.geometry !== geometry.id ||\n\t\t\t\tcurrentState.program !== program.id ||\n\t\t\t\tcurrentState.wireframe !== wireframe ) {\n\n\t\t\t\tcurrentState.geometry = geometry.id;\n\t\t\t\tcurrentState.program = program.id;\n\t\t\t\tcurrentState.wireframe = wireframe;\n\n\t\t\t\tupdateBuffers = true;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( object.isInstancedMesh === true ) {\n\n\t\t\tupdateBuffers = true;\n\n\t\t}\n\n\t\tif ( index !== null ) {\n\n\t\t\tattributes.update( index, 34963 );\n\n\t\t}\n\n\t\tif ( updateBuffers ) {\n\n\t\t\tsetupVertexAttributes( object, material, program, geometry );\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tgl.bindBuffer( 34963, attributes.get( index ).buffer );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction createVertexArrayObject() {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.createVertexArray();\n\n\t\treturn extension.createVertexArrayOES();\n\n\t}\n\n\tfunction bindVertexArrayObject( vao ) {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.bindVertexArray( vao );\n\n\t\treturn extension.bindVertexArrayOES( vao );\n\n\t}\n\n\tfunction deleteVertexArrayObject( vao ) {\n\n\t\tif ( capabilities.isWebGL2 ) return gl.deleteVertexArray( vao );\n\n\t\treturn extension.deleteVertexArrayOES( vao );\n\n\t}\n\n\tfunction getBindingState( geometry, program, material ) {\n\n\t\tconst wireframe = ( material.wireframe === true );\n\n\t\tlet programMap = bindingStates[ geometry.id ];\n\n\t\tif ( programMap === undefined ) {\n\n\t\t\tprogramMap = {};\n\t\t\tbindingStates[ geometry.id ] = programMap;\n\n\t\t}\n\n\t\tlet stateMap = programMap[ program.id ];\n\n\t\tif ( stateMap === undefined ) {\n\n\t\t\tstateMap = {};\n\t\t\tprogramMap[ program.id ] = stateMap;\n\n\t\t}\n\n\t\tlet state = stateMap[ wireframe ];\n\n\t\tif ( state === undefined ) {\n\n\t\t\tstate = createBindingState( createVertexArrayObject() );\n\t\t\tstateMap[ wireframe ] = state;\n\n\t\t}\n\n\t\treturn state;\n\n\t}\n\n\tfunction createBindingState( vao ) {\n\n\t\tconst newAttributes = [];\n\t\tconst enabledAttributes = [];\n\t\tconst attributeDivisors = [];\n\n\t\tfor ( let i = 0; i < maxVertexAttributes; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\t\t\tenabledAttributes[ i ] = 0;\n\t\t\tattributeDivisors[ i ] = 0;\n\n\t\t}\n\n\t\treturn {\n\n\t\t\t// for backward compatibility on non-VAO support browser\n\t\t\tgeometry: null,\n\t\t\tprogram: null,\n\t\t\twireframe: false,\n\n\t\t\tnewAttributes: newAttributes,\n\t\t\tenabledAttributes: enabledAttributes,\n\t\t\tattributeDivisors: attributeDivisors,\n\t\t\tobject: vao,\n\t\t\tattributes: {},\n\t\t\tindex: null\n\n\t\t};\n\n\t}\n\n\tfunction needsUpdate( geometry, index ) {\n\n\t\tconst cachedAttributes = currentState.attributes;\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tlet attributesNum = 0;\n\n\t\tfor ( const key in geometryAttributes ) {\n\n\t\t\tconst cachedAttribute = cachedAttributes[ key ];\n\t\t\tconst geometryAttribute = geometryAttributes[ key ];\n\n\t\t\tif ( cachedAttribute === undefined ) return true;\n\n\t\t\tif ( cachedAttribute.attribute !== geometryAttribute ) return true;\n\n\t\t\tif ( cachedAttribute.data !== geometryAttribute.data ) return true;\n\n\t\t\tattributesNum ++;\n\n\t\t}\n\n\t\tif ( currentState.attributesNum !== attributesNum ) return true;\n\n\t\tif ( currentState.index !== index ) return true;\n\n\t\treturn false;\n\n\t}\n\n\tfunction saveCache( geometry, index ) {\n\n\t\tconst cache = {};\n\t\tconst attributes = geometry.attributes;\n\t\tlet attributesNum = 0;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\n\t\t\tconst data = {};\n\t\t\tdata.attribute = attribute;\n\n\t\t\tif ( attribute.data ) {\n\n\t\t\t\tdata.data = attribute.data;\n\n\t\t\t}\n\n\t\t\tcache[ key ] = data;\n\n\t\t\tattributesNum ++;\n\n\t\t}\n\n\t\tcurrentState.attributes = cache;\n\t\tcurrentState.attributesNum = attributesNum;\n\n\t\tcurrentState.index = index;\n\n\t}\n\n\tfunction initAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\n\t\tfor ( let i = 0, il = newAttributes.length; i < il; i ++ ) {\n\n\t\t\tnewAttributes[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\tfunction enableAttribute( attribute ) {\n\n\t\tenableAttributeAndDivisor( attribute, 0 );\n\n\t}\n\n\tfunction enableAttributeAndDivisor( attribute, meshPerAttribute ) {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\t\tconst attributeDivisors = currentState.attributeDivisors;\n\n\t\tnewAttributes[ attribute ] = 1;\n\n\t\tif ( enabledAttributes[ attribute ] === 0 ) {\n\n\t\t\tgl.enableVertexAttribArray( attribute );\n\t\t\tenabledAttributes[ attribute ] = 1;\n\n\t\t}\n\n\t\tif ( attributeDivisors[ attribute ] !== meshPerAttribute ) {\n\n\t\t\tconst extension = capabilities.isWebGL2 ? gl : extensions.get( 'ANGLE_instanced_arrays' );\n\n\t\t\textension[ capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE' ]( attribute, meshPerAttribute );\n\t\t\tattributeDivisors[ attribute ] = meshPerAttribute;\n\n\t\t}\n\n\t}\n\n\tfunction disableUnusedAttributes() {\n\n\t\tconst newAttributes = currentState.newAttributes;\n\t\tconst enabledAttributes = currentState.enabledAttributes;\n\n\t\tfor ( let i = 0, il = enabledAttributes.length; i < il; i ++ ) {\n\n\t\t\tif ( enabledAttributes[ i ] !== newAttributes[ i ] ) {\n\n\t\t\t\tgl.disableVertexAttribArray( i );\n\t\t\t\tenabledAttributes[ i ] = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction vertexAttribPointer( index, size, type, normalized, stride, offset ) {\n\n\t\tif ( capabilities.isWebGL2 === true && ( type === 5124 || type === 5125 ) ) {\n\n\t\t\tgl.vertexAttribIPointer( index, size, type, stride, offset );\n\n\t\t} else {\n\n\t\t\tgl.vertexAttribPointer( index, size, type, normalized, stride, offset );\n\n\t\t}\n\n\t}\n\n\tfunction setupVertexAttributes( object, material, program, geometry ) {\n\n\t\tif ( capabilities.isWebGL2 === false && ( object.isInstancedMesh || geometry.isInstancedBufferGeometry ) ) {\n\n\t\t\tif ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) return;\n\n\t\t}\n\n\t\tinitAttributes();\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\tconst programAttributes = program.getAttributes();\n\n\t\tconst materialDefaultAttributeValues = material.defaultAttributeValues;\n\n\t\tfor ( const name in programAttributes ) {\n\n\t\t\tconst programAttribute = programAttributes[ name ];\n\n\t\t\tif ( programAttribute.location >= 0 ) {\n\n\t\t\t\tlet geometryAttribute = geometryAttributes[ name ];\n\n\t\t\t\tif ( geometryAttribute === undefined ) {\n\n\t\t\t\t\tif ( name === 'instanceMatrix' && object.instanceMatrix ) geometryAttribute = object.instanceMatrix;\n\t\t\t\t\tif ( name === 'instanceColor' && object.instanceColor ) geometryAttribute = object.instanceColor;\n\n\t\t\t\t}\n\n\t\t\t\tif ( geometryAttribute !== undefined ) {\n\n\t\t\t\t\tconst normalized = geometryAttribute.normalized;\n\t\t\t\t\tconst size = geometryAttribute.itemSize;\n\n\t\t\t\t\tconst attribute = attributes.get( geometryAttribute );\n\n\t\t\t\t\t// TODO Attribute may not be available on context restore\n\n\t\t\t\t\tif ( attribute === undefined ) continue;\n\n\t\t\t\t\tconst buffer = attribute.buffer;\n\t\t\t\t\tconst type = attribute.type;\n\t\t\t\t\tconst bytesPerElement = attribute.bytesPerElement;\n\n\t\t\t\t\tif ( geometryAttribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst data = geometryAttribute.data;\n\t\t\t\t\t\tconst stride = data.stride;\n\t\t\t\t\t\tconst offset = geometryAttribute.offset;\n\n\t\t\t\t\t\tif ( data && data.isInstancedInterleavedBuffer ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, data.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = data.meshPerAttribute * data.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( 34962, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tstride * bytesPerElement,\n\t\t\t\t\t\t\t\t( offset + ( size / programAttribute.locationSize ) * i ) * bytesPerElement\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( geometryAttribute.isInstancedBufferAttribute ) {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttributeAndDivisor( programAttribute.location + i, geometryAttribute.meshPerAttribute );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined ) {\n\n\t\t\t\t\t\t\t\tgeometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\t\tenableAttribute( programAttribute.location + i );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.bindBuffer( 34962, buffer );\n\n\t\t\t\t\t\tfor ( let i = 0; i < programAttribute.locationSize; i ++ ) {\n\n\t\t\t\t\t\t\tvertexAttribPointer(\n\t\t\t\t\t\t\t\tprogramAttribute.location + i,\n\t\t\t\t\t\t\t\tsize / programAttribute.locationSize,\n\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\tnormalized,\n\t\t\t\t\t\t\t\tsize * bytesPerElement,\n\t\t\t\t\t\t\t\t( size / programAttribute.locationSize ) * i * bytesPerElement\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( materialDefaultAttributeValues !== undefined ) {\n\n\t\t\t\t\tconst value = materialDefaultAttributeValues[ name ];\n\n\t\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\t\tswitch ( value.length ) {\n\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\tgl.vertexAttrib2fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\tgl.vertexAttrib3fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\tgl.vertexAttrib4fv( programAttribute.location, value );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tgl.vertexAttrib1fv( programAttribute.location, value );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tdisableUnusedAttributes();\n\n\t}\n\n\tfunction dispose() {\n\n\t\treset();\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tfor ( const programId in programMap ) {\n\n\t\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t\t}\n\n\t\t\t\tdelete programMap[ programId ];\n\n\t\t\t}\n\n\t\t\tdelete bindingStates[ geometryId ];\n\n\t\t}\n\n\t}\n\n\tfunction releaseStatesOfGeometry( geometry ) {\n\n\t\tif ( bindingStates[ geometry.id ] === undefined ) return;\n\n\t\tconst programMap = bindingStates[ geometry.id ];\n\n\t\tfor ( const programId in programMap ) {\n\n\t\t\tconst stateMap = programMap[ programId ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ programId ];\n\n\t\t}\n\n\t\tdelete bindingStates[ geometry.id ];\n\n\t}\n\n\tfunction releaseStatesOfProgram( program ) {\n\n\t\tfor ( const geometryId in bindingStates ) {\n\n\t\t\tconst programMap = bindingStates[ geometryId ];\n\n\t\t\tif ( programMap[ program.id ] === undefined ) continue;\n\n\t\t\tconst stateMap = programMap[ program.id ];\n\n\t\t\tfor ( const wireframe in stateMap ) {\n\n\t\t\t\tdeleteVertexArrayObject( stateMap[ wireframe ].object );\n\n\t\t\t\tdelete stateMap[ wireframe ];\n\n\t\t\t}\n\n\t\t\tdelete programMap[ program.id ];\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\tresetDefaultState();\n\n\t\tif ( currentState === defaultState ) return;\n\n\t\tcurrentState = defaultState;\n\t\tbindVertexArrayObject( currentState.object );\n\n\t}\n\n\t// for backward-compatilibity\n\n\tfunction resetDefaultState() {\n\n\t\tdefaultState.geometry = null;\n\t\tdefaultState.program = null;\n\t\tdefaultState.wireframe = false;\n\n\t}\n\n\treturn {\n\n\t\tsetup: setup,\n\t\treset: reset,\n\t\tresetDefaultState: resetDefaultState,\n\t\tdispose: dispose,\n\t\treleaseStatesOfGeometry: releaseStatesOfGeometry,\n\t\treleaseStatesOfProgram: releaseStatesOfProgram,\n\n\t\tinitAttributes: initAttributes,\n\t\tenableAttribute: enableAttribute,\n\t\tdisableUnusedAttributes: disableUnusedAttributes\n\n\t};\n\n}\n\nfunction WebGLBufferRenderer( gl, extensions, info, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawArrays( mode, start, count );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tlet extension, methodName;\n\n\t\tif ( isWebGL2 ) {\n\n\t\t\textension = gl;\n\t\t\tmethodName = 'drawArraysInstanced';\n\n\t\t} else {\n\n\t\t\textension = extensions.get( 'ANGLE_instanced_arrays' );\n\t\t\tmethodName = 'drawArraysInstancedANGLE';\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\textension[ methodName ]( mode, start, count, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\n}\n\nfunction WebGLCapabilities( gl, extensions, parameters ) {\n\n\tlet maxAnisotropy;\n\n\tfunction getMaxAnisotropy() {\n\n\t\tif ( maxAnisotropy !== undefined ) return maxAnisotropy;\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\t\tmaxAnisotropy = gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT );\n\n\t\t} else {\n\n\t\t\tmaxAnisotropy = 0;\n\n\t\t}\n\n\t\treturn maxAnisotropy;\n\n\t}\n\n\tfunction getMaxPrecision( precision ) {\n\n\t\tif ( precision === 'highp' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( 35633, 36338 ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( 35632, 36338 ).precision > 0 ) {\n\n\t\t\t\treturn 'highp';\n\n\t\t\t}\n\n\t\t\tprecision = 'mediump';\n\n\t\t}\n\n\t\tif ( precision === 'mediump' ) {\n\n\t\t\tif ( gl.getShaderPrecisionFormat( 35633, 36337 ).precision > 0 &&\n\t\t\t\tgl.getShaderPrecisionFormat( 35632, 36337 ).precision > 0 ) {\n\n\t\t\t\treturn 'mediump';\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn 'lowp';\n\n\t}\n\n\t/* eslint-disable no-undef */\n\tconst isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext ) ||\n\t\t( typeof WebGL2ComputeRenderingContext !== 'undefined' && gl instanceof WebGL2ComputeRenderingContext );\n\t/* eslint-enable no-undef */\n\n\tlet precision = parameters.precision !== undefined ? parameters.precision : 'highp';\n\tconst maxPrecision = getMaxPrecision( precision );\n\n\tif ( maxPrecision !== precision ) {\n\n\t\tconsole.warn( 'THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' );\n\t\tprecision = maxPrecision;\n\n\t}\n\n\tconst drawBuffers = isWebGL2 || extensions.has( 'WEBGL_draw_buffers' );\n\n\tconst logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;\n\n\tconst maxTextures = gl.getParameter( 34930 );\n\tconst maxVertexTextures = gl.getParameter( 35660 );\n\tconst maxTextureSize = gl.getParameter( 3379 );\n\tconst maxCubemapSize = gl.getParameter( 34076 );\n\n\tconst maxAttributes = gl.getParameter( 34921 );\n\tconst maxVertexUniforms = gl.getParameter( 36347 );\n\tconst maxVaryings = gl.getParameter( 36348 );\n\tconst maxFragmentUniforms = gl.getParameter( 36349 );\n\n\tconst vertexTextures = maxVertexTextures > 0;\n\tconst floatFragmentTextures = isWebGL2 || extensions.has( 'OES_texture_float' );\n\tconst floatVertexTextures = vertexTextures && floatFragmentTextures;\n\n\tconst maxSamples = isWebGL2 ? gl.getParameter( 36183 ) : 0;\n\n\treturn {\n\n\t\tisWebGL2: isWebGL2,\n\n\t\tdrawBuffers: drawBuffers,\n\n\t\tgetMaxAnisotropy: getMaxAnisotropy,\n\t\tgetMaxPrecision: getMaxPrecision,\n\n\t\tprecision: precision,\n\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\tmaxTextures: maxTextures,\n\t\tmaxVertexTextures: maxVertexTextures,\n\t\tmaxTextureSize: maxTextureSize,\n\t\tmaxCubemapSize: maxCubemapSize,\n\n\t\tmaxAttributes: maxAttributes,\n\t\tmaxVertexUniforms: maxVertexUniforms,\n\t\tmaxVaryings: maxVaryings,\n\t\tmaxFragmentUniforms: maxFragmentUniforms,\n\n\t\tvertexTextures: vertexTextures,\n\t\tfloatFragmentTextures: floatFragmentTextures,\n\t\tfloatVertexTextures: floatVertexTextures,\n\n\t\tmaxSamples: maxSamples\n\n\t};\n\n}\n\nfunction WebGLClipping( properties ) {\n\n\tconst scope = this;\n\n\tlet globalState = null,\n\t\tnumGlobalPlanes = 0,\n\t\tlocalClippingEnabled = false,\n\t\trenderingShadows = false;\n\n\tconst plane = new Plane(),\n\t\tviewNormalMatrix = new Matrix3(),\n\n\t\tuniform = { value: null, needsUpdate: false };\n\n\tthis.uniform = uniform;\n\tthis.numPlanes = 0;\n\tthis.numIntersection = 0;\n\n\tthis.init = function ( planes, enableLocalClipping, camera ) {\n\n\t\tconst enabled =\n\t\t\tplanes.length !== 0 ||\n\t\t\tenableLocalClipping ||\n\t\t\t// enable state of previous frame - the clipping code has to\n\t\t\t// run another frame in order to reset the state:\n\t\t\tnumGlobalPlanes !== 0 ||\n\t\t\tlocalClippingEnabled;\n\n\t\tlocalClippingEnabled = enableLocalClipping;\n\n\t\tglobalState = projectPlanes( planes, camera, 0 );\n\t\tnumGlobalPlanes = planes.length;\n\n\t\treturn enabled;\n\n\t};\n\n\tthis.beginShadows = function () {\n\n\t\trenderingShadows = true;\n\t\tprojectPlanes( null );\n\n\t};\n\n\tthis.endShadows = function () {\n\n\t\trenderingShadows = false;\n\t\tresetGlobalState();\n\n\t};\n\n\tthis.setState = function ( material, camera, useCache ) {\n\n\t\tconst planes = material.clippingPlanes,\n\t\t\tclipIntersection = material.clipIntersection,\n\t\t\tclipShadows = material.clipShadows;\n\n\t\tconst materialProperties = properties.get( material );\n\n\t\tif ( ! localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && ! clipShadows ) {\n\n\t\t\t// there's no local clipping\n\n\t\t\tif ( renderingShadows ) {\n\n\t\t\t\t// there's no global clipping\n\n\t\t\t\tprojectPlanes( null );\n\n\t\t\t} else {\n\n\t\t\t\tresetGlobalState();\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst nGlobal = renderingShadows ? 0 : numGlobalPlanes,\n\t\t\t\tlGlobal = nGlobal * 4;\n\n\t\t\tlet dstArray = materialProperties.clippingState || null;\n\n\t\t\tuniform.value = dstArray; // ensure unique state\n\n\t\t\tdstArray = projectPlanes( planes, camera, lGlobal, useCache );\n\n\t\t\tfor ( let i = 0; i !== lGlobal; ++ i ) {\n\n\t\t\t\tdstArray[ i ] = globalState[ i ];\n\n\t\t\t}\n\n\t\t\tmaterialProperties.clippingState = dstArray;\n\t\t\tthis.numIntersection = clipIntersection ? this.numPlanes : 0;\n\t\t\tthis.numPlanes += nGlobal;\n\n\t\t}\n\n\n\t};\n\n\tfunction resetGlobalState() {\n\n\t\tif ( uniform.value !== globalState ) {\n\n\t\t\tuniform.value = globalState;\n\t\t\tuniform.needsUpdate = numGlobalPlanes > 0;\n\n\t\t}\n\n\t\tscope.numPlanes = numGlobalPlanes;\n\t\tscope.numIntersection = 0;\n\n\t}\n\n\tfunction projectPlanes( planes, camera, dstOffset, skipTransform ) {\n\n\t\tconst nPlanes = planes !== null ? planes.length : 0;\n\t\tlet dstArray = null;\n\n\t\tif ( nPlanes !== 0 ) {\n\n\t\t\tdstArray = uniform.value;\n\n\t\t\tif ( skipTransform !== true || dstArray === null ) {\n\n\t\t\t\tconst flatSize = dstOffset + nPlanes * 4,\n\t\t\t\t\tviewMatrix = camera.matrixWorldInverse;\n\n\t\t\t\tviewNormalMatrix.getNormalMatrix( viewMatrix );\n\n\t\t\t\tif ( dstArray === null || dstArray.length < flatSize ) {\n\n\t\t\t\t\tdstArray = new Float32Array( flatSize );\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0, i4 = dstOffset; i !== nPlanes; ++ i, i4 += 4 ) {\n\n\t\t\t\t\tplane.copy( planes[ i ] ).applyMatrix4( viewMatrix, viewNormalMatrix );\n\n\t\t\t\t\tplane.normal.toArray( dstArray, i4 );\n\t\t\t\t\tdstArray[ i4 + 3 ] = plane.constant;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tuniform.value = dstArray;\n\t\t\tuniform.needsUpdate = true;\n\n\t\t}\n\n\t\tscope.numPlanes = nPlanes;\n\t\tscope.numIntersection = 0;\n\n\t\treturn dstArray;\n\n\t}\n\n}\n\nfunction WebGLCubeMaps( renderer ) {\n\n\tlet cubemaps = new WeakMap();\n\n\tfunction mapTextureMapping( texture, mapping ) {\n\n\t\tif ( mapping === EquirectangularReflectionMapping ) {\n\n\t\t\ttexture.mapping = CubeReflectionMapping;\n\n\t\t} else if ( mapping === EquirectangularRefractionMapping ) {\n\n\t\t\ttexture.mapping = CubeRefractionMapping;\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture && texture.isRenderTargetTexture === false ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tif ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) {\n\n\t\t\t\tif ( cubemaps.has( texture ) ) {\n\n\t\t\t\t\tconst cubemap = cubemaps.get( texture ).texture;\n\t\t\t\t\treturn mapTextureMapping( cubemap, texture.mapping );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\tif ( image && image.height > 0 ) {\n\n\t\t\t\t\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\t\t\t\t\tconst renderTarget = new WebGLCubeRenderTarget( image.height / 2 );\n\t\t\t\t\t\trenderTarget.fromEquirectangularTexture( renderer, texture );\n\t\t\t\t\t\tcubemaps.set( texture, renderTarget );\n\n\t\t\t\t\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\treturn mapTextureMapping( renderTarget.texture, texture.mapping );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemap = cubemaps.get( texture );\n\n\t\tif ( cubemap !== undefined ) {\n\n\t\t\tcubemaps.delete( texture );\n\t\t\tcubemap.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubemaps = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nclass OrthographicCamera extends Camera {\n\n\tconstructor( left = - 1, right = 1, top = 1, bottom = - 1, near = 0.1, far = 2000 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'OrthographicCamera';\n\n\t\tthis.zoom = 1;\n\t\tthis.view = null;\n\n\t\tthis.left = left;\n\t\tthis.right = right;\n\t\tthis.top = top;\n\t\tthis.bottom = bottom;\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tthis.left = source.left;\n\t\tthis.right = source.right;\n\t\tthis.top = source.top;\n\t\tthis.bottom = source.bottom;\n\t\tthis.near = source.near;\n\t\tthis.far = source.far;\n\n\t\tthis.zoom = source.zoom;\n\t\tthis.view = source.view === null ? null : Object.assign( {}, source.view );\n\n\t\treturn this;\n\n\t}\n\n\tsetViewOffset( fullWidth, fullHeight, x, y, width, height ) {\n\n\t\tif ( this.view === null ) {\n\n\t\t\tthis.view = {\n\t\t\t\tenabled: true,\n\t\t\t\tfullWidth: 1,\n\t\t\t\tfullHeight: 1,\n\t\t\t\toffsetX: 0,\n\t\t\t\toffsetY: 0,\n\t\t\t\twidth: 1,\n\t\t\t\theight: 1\n\t\t\t};\n\n\t\t}\n\n\t\tthis.view.enabled = true;\n\t\tthis.view.fullWidth = fullWidth;\n\t\tthis.view.fullHeight = fullHeight;\n\t\tthis.view.offsetX = x;\n\t\tthis.view.offsetY = y;\n\t\tthis.view.width = width;\n\t\tthis.view.height = height;\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tclearViewOffset() {\n\n\t\tif ( this.view !== null ) {\n\n\t\t\tthis.view.enabled = false;\n\n\t\t}\n\n\t\tthis.updateProjectionMatrix();\n\n\t}\n\n\tupdateProjectionMatrix() {\n\n\t\tconst dx = ( this.right - this.left ) / ( 2 * this.zoom );\n\t\tconst dy = ( this.top - this.bottom ) / ( 2 * this.zoom );\n\t\tconst cx = ( this.right + this.left ) / 2;\n\t\tconst cy = ( this.top + this.bottom ) / 2;\n\n\t\tlet left = cx - dx;\n\t\tlet right = cx + dx;\n\t\tlet top = cy + dy;\n\t\tlet bottom = cy - dy;\n\n\t\tif ( this.view !== null && this.view.enabled ) {\n\n\t\t\tconst scaleW = ( this.right - this.left ) / this.view.fullWidth / this.zoom;\n\t\t\tconst scaleH = ( this.top - this.bottom ) / this.view.fullHeight / this.zoom;\n\n\t\t\tleft += scaleW * this.view.offsetX;\n\t\t\tright = left + scaleW * this.view.width;\n\t\t\ttop -= scaleH * this.view.offsetY;\n\t\t\tbottom = top - scaleH * this.view.height;\n\n\t\t}\n\n\t\tthis.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far );\n\n\t\tthis.projectionMatrixInverse.copy( this.projectionMatrix ).invert();\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.zoom = this.zoom;\n\t\tdata.object.left = this.left;\n\t\tdata.object.right = this.right;\n\t\tdata.object.top = this.top;\n\t\tdata.object.bottom = this.bottom;\n\t\tdata.object.near = this.near;\n\t\tdata.object.far = this.far;\n\n\t\tif ( this.view !== null ) data.object.view = Object.assign( {}, this.view );\n\n\t\treturn data;\n\n\t}\n\n}\n\nOrthographicCamera.prototype.isOrthographicCamera = true;\n\nclass RawShaderMaterial extends ShaderMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper( parameters );\n\n\t\tthis.type = 'RawShaderMaterial';\n\n\t}\n\n}\n\nRawShaderMaterial.prototype.isRawShaderMaterial = true;\n\nconst LOD_MIN = 4;\nconst LOD_MAX = 8;\nconst SIZE_MAX = Math.pow( 2, LOD_MAX );\n\n// The standard deviations (radians) associated with the extra mips. These are\n// chosen to approximate a Trowbridge-Reitz distribution function times the\n// geometric shadowing function. These sigma values squared must match the\n// variance #defines in cube_uv_reflection_fragment.glsl.js.\nconst EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];\n\nconst TOTAL_LODS = LOD_MAX - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;\n\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\n// samples and exit early, but not recompile the shader.\nconst MAX_SAMPLES = 20;\n\nconst ENCODINGS = {\n\t[ LinearEncoding ]: 0,\n\t[ sRGBEncoding ]: 1,\n\t[ RGBEEncoding ]: 2,\n\t[ RGBM7Encoding ]: 3,\n\t[ RGBM16Encoding ]: 4,\n\t[ RGBDEncoding ]: 5,\n\t[ GammaEncoding ]: 6\n};\n\nconst _flatCamera = /*@__PURE__*/ new OrthographicCamera();\nconst { _lodPlanes, _sizeLods, _sigmas } = /*@__PURE__*/ _createPlanes();\nconst _clearColor = /*@__PURE__*/ new Color();\nlet _oldTarget = null;\n\n// Golden Ratio\nconst PHI = ( 1 + Math.sqrt( 5 ) ) / 2;\nconst INV_PHI = 1 / PHI;\n\n// Vertices of a dodecahedron (except the opposites, which represent the\n// same axis), used as axis directions evenly spread on a sphere.\nconst _axisDirections = [\n\t/*@__PURE__*/ new Vector3( 1, 1, 1 ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, 1 ),\n\t/*@__PURE__*/ new Vector3( 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( - 1, 1, - 1 ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),\n\t/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),\n\t/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),\n\t/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),\n\t/*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ) ];\n\n/**\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\n * (PMREM) from a cubeMap environment texture. This allows different levels of\n * blur to be quickly accessed based on material roughness. It is packed into a\n * special CubeUV format that allows us to perform custom interpolation so that\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\n * higher roughness levels. In this way we maintain resolution to smoothly\n * interpolate diffuse lighting while limiting sampling computation.\n *\n * Paper: Fast, Accurate Image-Based Lighting\n * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view\n*/\n\nclass PMREMGenerator {\n\n\tconstructor( renderer ) {\n\n\t\tthis._renderer = renderer;\n\t\tthis._pingPongRenderTarget = null;\n\n\t\tthis._blurMaterial = _getBlurShader( MAX_SAMPLES );\n\t\tthis._equirectShader = null;\n\t\tthis._cubemapShader = null;\n\n\t\tthis._compileMaterial( this._blurMaterial );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from a supplied Scene, which can be faster than using an\n\t * image if networking bandwidth is low. Optional sigma specifies a blur radius\n\t * in radians to be applied to the scene before PMREM generation. Optional near\n\t * and far planes ensure the scene is rendered in its entirety (the cubeCamera\n\t * is placed at the origin).\n\t */\n\tfromScene( scene, sigma = 0, near = 0.1, far = 100 ) {\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\tconst cubeUVRenderTarget = this._allocateTargets();\n\n\t\tthis._sceneToCubeUV( scene, near, far, cubeUVRenderTarget );\n\t\tif ( sigma > 0 ) {\n\n\t\t\tthis._blur( cubeUVRenderTarget, 0, 0, sigma );\n\n\t\t}\n\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an equirectangular texture, which can be either LDR\n\t * (RGBFormat) or HDR (RGBEFormat). The ideal input image size is 1k (1024 x 512),\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromEquirectangular( equirectangular ) {\n\n\t\treturn this._fromTexture( equirectangular );\n\n\t}\n\n\t/**\n\t * Generates a PMREM from an cubemap texture, which can be either LDR\n\t * (RGBFormat) or HDR (RGBEFormat). The ideal input cube size is 256 x 256,\n\t * as this matches best with the 256 x 256 cubemap output.\n\t */\n\tfromCubemap( cubemap ) {\n\n\t\treturn this._fromTexture( cubemap );\n\n\t}\n\n\t/**\n\t * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileCubemapShader() {\n\n\t\tif ( this._cubemapShader === null ) {\n\n\t\t\tthis._cubemapShader = _getCubemapShader();\n\t\t\tthis._compileMaterial( this._cubemapShader );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\n\t * your texture's network fetch for increased concurrency.\n\t */\n\tcompileEquirectangularShader() {\n\n\t\tif ( this._equirectShader === null ) {\n\n\t\t\tthis._equirectShader = _getEquirectShader();\n\t\t\tthis._compileMaterial( this._equirectShader );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\n\t * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\n\t * one of them will cause any others to also become unusable.\n\t */\n\tdispose() {\n\n\t\tthis._blurMaterial.dispose();\n\n\t\tif ( this._cubemapShader !== null ) this._cubemapShader.dispose();\n\t\tif ( this._equirectShader !== null ) this._equirectShader.dispose();\n\n\t\tfor ( let i = 0; i < _lodPlanes.length; i ++ ) {\n\n\t\t\t_lodPlanes[ i ].dispose();\n\n\t\t}\n\n\t}\n\n\t// private interface\n\n\t_cleanup( outputTarget ) {\n\n\t\tthis._pingPongRenderTarget.dispose();\n\t\tthis._renderer.setRenderTarget( _oldTarget );\n\t\toutputTarget.scissorTest = false;\n\t\t_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );\n\n\t}\n\n\t_fromTexture( texture ) {\n\n\t\t_oldTarget = this._renderer.getRenderTarget();\n\t\tconst cubeUVRenderTarget = this._allocateTargets( texture );\n\t\tthis._textureToCubeUV( texture, cubeUVRenderTarget );\n\t\tthis._applyPMREM( cubeUVRenderTarget );\n\t\tthis._cleanup( cubeUVRenderTarget );\n\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_allocateTargets( texture ) { // warning: null texture is valid\n\n\t\tconst params = {\n\t\t\tmagFilter: NearestFilter,\n\t\t\tminFilter: NearestFilter,\n\t\t\tgenerateMipmaps: false,\n\t\t\ttype: UnsignedByteType,\n\t\t\tformat: RGBEFormat,\n\t\t\tencoding: _isLDR( texture ) ? texture.encoding : RGBEEncoding,\n\t\t\tdepthBuffer: false\n\t\t};\n\n\t\tconst cubeUVRenderTarget = _createRenderTarget( params );\n\t\tcubeUVRenderTarget.depthBuffer = texture ? false : true;\n\t\tthis._pingPongRenderTarget = _createRenderTarget( params );\n\t\treturn cubeUVRenderTarget;\n\n\t}\n\n\t_compileMaterial( material ) {\n\n\t\tconst tmpMesh = new Mesh( _lodPlanes[ 0 ], material );\n\t\tthis._renderer.compile( tmpMesh, _flatCamera );\n\n\t}\n\n\t_sceneToCubeUV( scene, near, far, cubeUVRenderTarget ) {\n\n\t\tconst fov = 90;\n\t\tconst aspect = 1;\n\t\tconst cubeCamera = new PerspectiveCamera( fov, aspect, near, far );\n\t\tconst upSign = [ 1, - 1, 1, 1, 1, 1 ];\n\t\tconst forwardSign = [ 1, 1, 1, - 1, - 1, - 1 ];\n\t\tconst renderer = this._renderer;\n\n\t\tconst originalAutoClear = renderer.autoClear;\n\t\tconst outputEncoding = renderer.outputEncoding;\n\t\tconst toneMapping = renderer.toneMapping;\n\t\trenderer.getClearColor( _clearColor );\n\n\t\trenderer.toneMapping = NoToneMapping;\n\t\trenderer.outputEncoding = LinearEncoding;\n\t\trenderer.autoClear = false;\n\n\t\tconst backgroundMaterial = new MeshBasicMaterial( {\n\t\t\tname: 'PMREM.Background',\n\t\t\tside: BackSide,\n\t\t\tdepthWrite: false,\n\t\t\tdepthTest: false,\n\t\t} );\n\n\t\tconst backgroundBox = new Mesh( new BoxGeometry(), backgroundMaterial );\n\n\t\tlet useSolidColor = false;\n\t\tconst background = scene.background;\n\n\t\tif ( background ) {\n\n\t\t\tif ( background.isColor ) {\n\n\t\t\t\tbackgroundMaterial.color.copy( background );\n\t\t\t\tscene.background = null;\n\t\t\t\tuseSolidColor = true;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tbackgroundMaterial.color.copy( _clearColor );\n\t\t\tuseSolidColor = true;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tconst col = i % 3;\n\t\t\tif ( col == 0 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( forwardSign[ i ], 0, 0 );\n\n\t\t\t} else if ( col == 1 ) {\n\n\t\t\t\tcubeCamera.up.set( 0, 0, upSign[ i ] );\n\t\t\t\tcubeCamera.lookAt( 0, forwardSign[ i ], 0 );\n\n\t\t\t} else {\n\n\t\t\t\tcubeCamera.up.set( 0, upSign[ i ], 0 );\n\t\t\t\tcubeCamera.lookAt( 0, 0, forwardSign[ i ] );\n\n\t\t\t}\n\n\t\t\t_setViewport( cubeUVRenderTarget,\n\t\t\t\tcol * SIZE_MAX, i > 2 ? SIZE_MAX : 0, SIZE_MAX, SIZE_MAX );\n\t\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\n\t\t\tif ( useSolidColor ) {\n\n\t\t\t\trenderer.render( backgroundBox, cubeCamera );\n\n\t\t\t}\n\n\t\t\trenderer.render( scene, cubeCamera );\n\n\t\t}\n\n\t\tbackgroundBox.geometry.dispose();\n\t\tbackgroundBox.material.dispose();\n\n\t\trenderer.toneMapping = toneMapping;\n\t\trenderer.outputEncoding = outputEncoding;\n\t\trenderer.autoClear = originalAutoClear;\n\t\tscene.background = background;\n\n\t}\n\n\t_setEncoding( uniform, texture ) {\n\n\t\tif ( this._renderer.capabilities.isWebGL2 === true && texture.format === RGBAFormat && texture.type === UnsignedByteType && texture.encoding === sRGBEncoding ) {\n\n\t\t\tuniform.value = ENCODINGS[ LinearEncoding ];\n\n\t\t} else {\n\n\t\t\tuniform.value = ENCODINGS[ texture.encoding ];\n\n\t\t}\n\n\t}\n\n\t_textureToCubeUV( texture, cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst isCubeTexture = ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping );\n\n\t\tif ( isCubeTexture ) {\n\n\t\t\tif ( this._cubemapShader == null ) {\n\n\t\t\t\tthis._cubemapShader = _getCubemapShader();\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif ( this._equirectShader == null ) {\n\n\t\t\t\tthis._equirectShader = _getEquirectShader();\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst material = isCubeTexture ? this._cubemapShader : this._equirectShader;\n\t\tconst mesh = new Mesh( _lodPlanes[ 0 ], material );\n\n\t\tconst uniforms = material.uniforms;\n\n\t\tuniforms[ 'envMap' ].value = texture;\n\n\t\tif ( ! isCubeTexture ) {\n\n\t\t\tuniforms[ 'texelSize' ].value.set( 1.0 / texture.image.width, 1.0 / texture.image.height );\n\n\t\t}\n\n\t\tthis._setEncoding( uniforms[ 'inputEncoding' ], texture );\n\t\tthis._setEncoding( uniforms[ 'outputEncoding' ], cubeUVRenderTarget.texture );\n\n\t\t_setViewport( cubeUVRenderTarget, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX );\n\n\t\trenderer.setRenderTarget( cubeUVRenderTarget );\n\t\trenderer.render( mesh, _flatCamera );\n\n\t}\n\n\t_applyPMREM( cubeUVRenderTarget ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst autoClear = renderer.autoClear;\n\t\trenderer.autoClear = false;\n\n\t\tfor ( let i = 1; i < TOTAL_LODS; i ++ ) {\n\n\t\t\tconst sigma = Math.sqrt( _sigmas[ i ] * _sigmas[ i ] - _sigmas[ i - 1 ] * _sigmas[ i - 1 ] );\n\n\t\t\tconst poleAxis = _axisDirections[ ( i - 1 ) % _axisDirections.length ];\n\n\t\t\tthis._blur( cubeUVRenderTarget, i - 1, i, sigma, poleAxis );\n\n\t\t}\n\n\t\trenderer.autoClear = autoClear;\n\n\t}\n\n\t/**\n\t * This is a two-pass Gaussian blur for a cubemap. Normally this is done\n\t * vertically and horizontally, but this breaks down on a cube. Here we apply\n\t * the blur latitudinally (around the poles), and then longitudinally (towards\n\t * the poles) to approximate the orthogonally-separable blur. It is least\n\t * accurate at the poles, but still does a decent job.\n\t */\n\t_blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) {\n\n\t\tconst pingPongRenderTarget = this._pingPongRenderTarget;\n\n\t\tthis._halfBlur(\n\t\t\tcubeUVRenderTarget,\n\t\t\tpingPongRenderTarget,\n\t\t\tlodIn,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'latitudinal',\n\t\t\tpoleAxis );\n\n\t\tthis._halfBlur(\n\t\t\tpingPongRenderTarget,\n\t\t\tcubeUVRenderTarget,\n\t\t\tlodOut,\n\t\t\tlodOut,\n\t\t\tsigma,\n\t\t\t'longitudinal',\n\t\t\tpoleAxis );\n\n\t}\n\n\t_halfBlur( targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis ) {\n\n\t\tconst renderer = this._renderer;\n\t\tconst blurMaterial = this._blurMaterial;\n\n\t\tif ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {\n\n\t\t\tconsole.error(\n\t\t\t\t'blur direction must be either latitudinal or longitudinal!' );\n\n\t\t}\n\n\t\t// Number of standard deviations at which to cut off the discrete approximation.\n\t\tconst STANDARD_DEVIATIONS = 3;\n\n\t\tconst blurMesh = new Mesh( _lodPlanes[ lodOut ], blurMaterial );\n\t\tconst blurUniforms = blurMaterial.uniforms;\n\n\t\tconst pixels = _sizeLods[ lodIn ] - 1;\n\t\tconst radiansPerPixel = isFinite( sigmaRadians ) ? Math.PI / ( 2 * pixels ) : 2 * Math.PI / ( 2 * MAX_SAMPLES - 1 );\n\t\tconst sigmaPixels = sigmaRadians / radiansPerPixel;\n\t\tconst samples = isFinite( sigmaRadians ) ? 1 + Math.floor( STANDARD_DEVIATIONS * sigmaPixels ) : MAX_SAMPLES;\n\n\t\tif ( samples > MAX_SAMPLES ) {\n\n\t\t\tconsole.warn( `sigmaRadians, ${\n\t\t\t\tsigmaRadians}, is too large and will clip, as it requested ${\n\t\t\t\tsamples} samples when the maximum is set to ${MAX_SAMPLES}` );\n\n\t\t}\n\n\t\tconst weights = [];\n\t\tlet sum = 0;\n\n\t\tfor ( let i = 0; i < MAX_SAMPLES; ++ i ) {\n\n\t\t\tconst x = i / sigmaPixels;\n\t\t\tconst weight = Math.exp( - x * x / 2 );\n\t\t\tweights.push( weight );\n\n\t\t\tif ( i == 0 ) {\n\n\t\t\t\tsum += weight;\n\n\t\t\t} else if ( i < samples ) {\n\n\t\t\t\tsum += 2 * weight;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( let i = 0; i < weights.length; i ++ ) {\n\n\t\t\tweights[ i ] = weights[ i ] / sum;\n\n\t\t}\n\n\t\tblurUniforms[ 'envMap' ].value = targetIn.texture;\n\t\tblurUniforms[ 'samples' ].value = samples;\n\t\tblurUniforms[ 'weights' ].value = weights;\n\t\tblurUniforms[ 'latitudinal' ].value = direction === 'latitudinal';\n\n\t\tif ( poleAxis ) {\n\n\t\t\tblurUniforms[ 'poleAxis' ].value = poleAxis;\n\n\t\t}\n\n\t\tblurUniforms[ 'dTheta' ].value = radiansPerPixel;\n\t\tblurUniforms[ 'mipInt' ].value = LOD_MAX - lodIn;\n\n\t\tthis._setEncoding( blurUniforms[ 'inputEncoding' ], targetIn.texture );\n\t\tthis._setEncoding( blurUniforms[ 'outputEncoding' ], targetIn.texture );\n\n\t\tconst outputSize = _sizeLods[ lodOut ];\n\t\tconst x = 3 * Math.max( 0, SIZE_MAX - 2 * outputSize );\n\t\tconst y = ( lodOut === 0 ? 0 : 2 * SIZE_MAX ) + 2 * outputSize * ( lodOut > LOD_MAX - LOD_MIN ? lodOut - LOD_MAX + LOD_MIN : 0 );\n\n\t\t_setViewport( targetOut, x, y, 3 * outputSize, 2 * outputSize );\n\t\trenderer.setRenderTarget( targetOut );\n\t\trenderer.render( blurMesh, _flatCamera );\n\n\t}\n\n}\n\nfunction _isLDR( texture ) {\n\n\tif ( texture === undefined || texture.type !== UnsignedByteType ) return false;\n\n\treturn texture.encoding === LinearEncoding || texture.encoding === sRGBEncoding || texture.encoding === GammaEncoding;\n\n}\n\nfunction _createPlanes() {\n\n\tconst _lodPlanes = [];\n\tconst _sizeLods = [];\n\tconst _sigmas = [];\n\n\tlet lod = LOD_MAX;\n\n\tfor ( let i = 0; i < TOTAL_LODS; i ++ ) {\n\n\t\tconst sizeLod = Math.pow( 2, lod );\n\t\t_sizeLods.push( sizeLod );\n\t\tlet sigma = 1.0 / sizeLod;\n\n\t\tif ( i > LOD_MAX - LOD_MIN ) {\n\n\t\t\tsigma = EXTRA_LOD_SIGMA[ i - LOD_MAX + LOD_MIN - 1 ];\n\n\t\t} else if ( i == 0 ) {\n\n\t\t\tsigma = 0;\n\n\t\t}\n\n\t\t_sigmas.push( sigma );\n\n\t\tconst texelSize = 1.0 / ( sizeLod - 1 );\n\t\tconst min = - texelSize / 2;\n\t\tconst max = 1 + texelSize / 2;\n\t\tconst uv1 = [ min, min, max, min, max, max, min, min, max, max, min, max ];\n\n\t\tconst cubeFaces = 6;\n\t\tconst vertices = 6;\n\t\tconst positionSize = 3;\n\t\tconst uvSize = 2;\n\t\tconst faceIndexSize = 1;\n\n\t\tconst position = new Float32Array( positionSize * vertices * cubeFaces );\n\t\tconst uv = new Float32Array( uvSize * vertices * cubeFaces );\n\t\tconst faceIndex = new Float32Array( faceIndexSize * vertices * cubeFaces );\n\n\t\tfor ( let face = 0; face < cubeFaces; face ++ ) {\n\n\t\t\tconst x = ( face % 3 ) * 2 / 3 - 1;\n\t\t\tconst y = face > 2 ? 0 : - 1;\n\t\t\tconst coordinates = [\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y, 0,\n\t\t\t\tx + 2 / 3, y + 1, 0,\n\t\t\t\tx, y + 1, 0\n\t\t\t];\n\t\t\tposition.set( coordinates, positionSize * vertices * face );\n\t\t\tuv.set( uv1, uvSize * vertices * face );\n\t\t\tconst fill = [ face, face, face, face, face, face ];\n\t\t\tfaceIndex.set( fill, faceIndexSize * vertices * face );\n\n\t\t}\n\n\t\tconst planes = new BufferGeometry();\n\t\tplanes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );\n\t\tplanes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );\n\t\tplanes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );\n\t\t_lodPlanes.push( planes );\n\n\t\tif ( lod > LOD_MIN ) {\n\n\t\t\tlod --;\n\n\t\t}\n\n\t}\n\n\treturn { _lodPlanes, _sizeLods, _sigmas };\n\n}\n\nfunction _createRenderTarget( params ) {\n\n\tconst cubeUVRenderTarget = new WebGLRenderTarget( 3 * SIZE_MAX, 3 * SIZE_MAX, params );\n\tcubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;\n\tcubeUVRenderTarget.texture.name = 'PMREM.cubeUv';\n\tcubeUVRenderTarget.scissorTest = true;\n\treturn cubeUVRenderTarget;\n\n}\n\nfunction _setViewport( target, x, y, width, height ) {\n\n\ttarget.viewport.set( x, y, width, height );\n\ttarget.scissor.set( x, y, width, height );\n\n}\n\nfunction _getBlurShader( maxSamples ) {\n\n\tconst weights = new Float32Array( maxSamples );\n\tconst poleAxis = new Vector3( 0, 1, 0 );\n\tconst shaderMaterial = new RawShaderMaterial( {\n\n\t\tname: 'SphericalGaussianBlur',\n\n\t\tdefines: { 'n': maxSamples },\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'samples': { value: 1 },\n\t\t\t'weights': { value: weights },\n\t\t\t'latitudinal': { value: false },\n\t\t\t'dTheta': { value: 0 },\n\t\t\t'mipInt': { value: 0 },\n\t\t\t'poleAxis': { value: poleAxis },\n\t\t\t'inputEncoding': { value: ENCODINGS[ LinearEncoding ] },\n\t\t\t'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${ _getEncodings() }\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getEquirectShader() {\n\n\tconst texelSize = new Vector2( 1, 1 );\n\tconst shaderMaterial = new RawShaderMaterial( {\n\n\t\tname: 'EquirectangularToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'texelSize': { value: texelSize },\n\t\t\t'inputEncoding': { value: ENCODINGS[ LinearEncoding ] },\n\t\t\t'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${ _getEncodings() }\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getCubemapShader() {\n\n\tconst shaderMaterial = new RawShaderMaterial( {\n\n\t\tname: 'CubemapToCubeUV',\n\n\t\tuniforms: {\n\t\t\t'envMap': { value: null },\n\t\t\t'inputEncoding': { value: ENCODINGS[ LinearEncoding ] },\n\t\t\t'outputEncoding': { value: ENCODINGS[ LinearEncoding ] }\n\t\t},\n\n\t\tvertexShader: _getCommonVertexShader(),\n\n\t\tfragmentShader: /* glsl */`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${ _getEncodings() }\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,\n\n\t\tblending: NoBlending,\n\t\tdepthTest: false,\n\t\tdepthWrite: false\n\n\t} );\n\n\treturn shaderMaterial;\n\n}\n\nfunction _getCommonVertexShader() {\n\n\treturn /* glsl */`\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t`;\n\n}\n\nfunction _getEncodings() {\n\n\treturn /* glsl */`\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t`;\n\n}\n\nfunction WebGLCubeUVMaps( renderer ) {\n\n\tlet cubeUVmaps = new WeakMap();\n\n\tlet pmremGenerator = null;\n\n\tfunction get( texture ) {\n\n\t\tif ( texture && texture.isTexture && texture.isRenderTargetTexture === false ) {\n\n\t\t\tconst mapping = texture.mapping;\n\n\t\t\tconst isEquirectMap = ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping );\n\t\t\tconst isCubeMap = ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping );\n\n\t\t\tif ( isEquirectMap || isCubeMap ) {\n\n\t\t\t\t// equirect/cube map to cubeUV conversion\n\n\t\t\t\tif ( cubeUVmaps.has( texture ) ) {\n\n\t\t\t\t\treturn cubeUVmaps.get( texture ).texture;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst image = texture.image;\n\n\t\t\t\t\tif ( ( isEquirectMap && image && image.height > 0 ) || ( isCubeMap && image && isCubeTextureComplete( image ) ) ) {\n\n\t\t\t\t\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\t\t\t\t\tif ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );\n\n\t\t\t\t\t\tconst renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );\n\t\t\t\t\t\tcubeUVmaps.set( texture, renderTarget );\n\n\t\t\t\t\t\trenderer.setRenderTarget( currentRenderTarget );\n\n\t\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\t\t\t\treturn renderTarget.texture;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// image not yet ready. try the conversion next frame\n\n\t\t\t\t\t\treturn null;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tfunction isCubeTextureComplete( image ) {\n\n\t\tlet count = 0;\n\t\tconst length = 6;\n\n\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\tif ( image[ i ] !== undefined ) count ++;\n\n\t\t}\n\n\t\treturn count === length;\n\n\n\t}\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tconst cubemapUV = cubeUVmaps.get( texture );\n\n\t\tif ( cubemapUV !== undefined ) {\n\n\t\t\tcubeUVmaps.delete( texture );\n\t\t\tcubemapUV.dispose();\n\n\t\t}\n\n\t}\n\n\tfunction dispose() {\n\n\t\tcubeUVmaps = new WeakMap();\n\n\t\tif ( pmremGenerator !== null ) {\n\n\t\t\tpmremGenerator.dispose();\n\t\t\tpmremGenerator = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction WebGLExtensions( gl ) {\n\n\tconst extensions = {};\n\n\tfunction getExtension( name ) {\n\n\t\tif ( extensions[ name ] !== undefined ) {\n\n\t\t\treturn extensions[ name ];\n\n\t\t}\n\n\t\tlet extension;\n\n\t\tswitch ( name ) {\n\n\t\t\tcase 'WEBGL_depth_texture':\n\t\t\t\textension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'EXT_texture_filter_anisotropic':\n\t\t\t\textension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_s3tc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'WEBGL_compressed_texture_pvrtc':\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\textension = gl.getExtension( name );\n\n\t\t}\n\n\t\textensions[ name ] = extension;\n\n\t\treturn extension;\n\n\t}\n\n\treturn {\n\n\t\thas: function ( name ) {\n\n\t\t\treturn getExtension( name ) !== null;\n\n\t\t},\n\n\t\tinit: function ( capabilities ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\tgetExtension( 'EXT_color_buffer_float' );\n\n\t\t\t} else {\n\n\t\t\t\tgetExtension( 'WEBGL_depth_texture' );\n\t\t\t\tgetExtension( 'OES_texture_float' );\n\t\t\t\tgetExtension( 'OES_texture_half_float' );\n\t\t\t\tgetExtension( 'OES_texture_half_float_linear' );\n\t\t\t\tgetExtension( 'OES_standard_derivatives' );\n\t\t\t\tgetExtension( 'OES_element_index_uint' );\n\t\t\t\tgetExtension( 'OES_vertex_array_object' );\n\t\t\t\tgetExtension( 'ANGLE_instanced_arrays' );\n\n\t\t\t}\n\n\t\t\tgetExtension( 'OES_texture_float_linear' );\n\t\t\tgetExtension( 'EXT_color_buffer_half_float' );\n\n\t\t},\n\n\t\tget: function ( name ) {\n\n\t\t\tconst extension = getExtension( name );\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );\n\n\t\t\t}\n\n\t\t\treturn extension;\n\n\t\t}\n\n\t};\n\n}\n\nfunction WebGLGeometries( gl, attributes, info, bindingStates ) {\n\n\tconst geometries = {};\n\tconst wireframeAttributes = new WeakMap();\n\n\tfunction onGeometryDispose( event ) {\n\n\t\tconst geometry = event.target;\n\n\t\tif ( geometry.index !== null ) {\n\n\t\t\tattributes.remove( geometry.index );\n\n\t\t}\n\n\t\tfor ( const name in geometry.attributes ) {\n\n\t\t\tattributes.remove( geometry.attributes[ name ] );\n\n\t\t}\n\n\t\tgeometry.removeEventListener( 'dispose', onGeometryDispose );\n\n\t\tdelete geometries[ geometry.id ];\n\n\t\tconst attribute = wireframeAttributes.get( geometry );\n\n\t\tif ( attribute ) {\n\n\t\t\tattributes.remove( attribute );\n\t\t\twireframeAttributes.delete( geometry );\n\n\t\t}\n\n\t\tbindingStates.releaseStatesOfGeometry( geometry );\n\n\t\tif ( geometry.isInstancedBufferGeometry === true ) {\n\n\t\t\tdelete geometry._maxInstanceCount;\n\n\t\t}\n\n\t\t//\n\n\t\tinfo.memory.geometries --;\n\n\t}\n\n\tfunction get( object, geometry ) {\n\n\t\tif ( geometries[ geometry.id ] === true ) return geometry;\n\n\t\tgeometry.addEventListener( 'dispose', onGeometryDispose );\n\n\t\tgeometries[ geometry.id ] = true;\n\n\t\tinfo.memory.geometries ++;\n\n\t\treturn geometry;\n\n\t}\n\n\tfunction update( geometry ) {\n\n\t\tconst geometryAttributes = geometry.attributes;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates.\n\n\t\tfor ( const name in geometryAttributes ) {\n\n\t\t\tattributes.update( geometryAttributes[ name ], 34962 );\n\n\t\t}\n\n\t\t// morph targets\n\n\t\tconst morphAttributes = geometry.morphAttributes;\n\n\t\tfor ( const name in morphAttributes ) {\n\n\t\t\tconst array = morphAttributes[ name ];\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i ++ ) {\n\n\t\t\t\tattributes.update( array[ i ], 34962 );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateWireframeAttribute( geometry ) {\n\n\t\tconst indices = [];\n\n\t\tconst geometryIndex = geometry.index;\n\t\tconst geometryPosition = geometry.attributes.position;\n\t\tlet version = 0;\n\n\t\tif ( geometryIndex !== null ) {\n\n\t\t\tconst array = geometryIndex.array;\n\t\t\tversion = geometryIndex.version;\n\n\t\t\tfor ( let i = 0, l = array.length; i < l; i += 3 ) {\n\n\t\t\t\tconst a = array[ i + 0 ];\n\t\t\t\tconst b = array[ i + 1 ];\n\t\t\t\tconst c = array[ i + 2 ];\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst array = geometryPosition.array;\n\t\t\tversion = geometryPosition.version;\n\n\t\t\tfor ( let i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) {\n\n\t\t\t\tconst a = i + 0;\n\t\t\t\tconst b = i + 1;\n\t\t\t\tconst c = i + 2;\n\n\t\t\t\tindices.push( a, b, b, c, c, a );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst attribute = new ( arrayMax( indices ) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 );\n\t\tattribute.version = version;\n\n\t\t// Updating index buffer in VAO now. See WebGLBindingStates\n\n\t\t//\n\n\t\tconst previousAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( previousAttribute ) attributes.remove( previousAttribute );\n\n\t\t//\n\n\t\twireframeAttributes.set( geometry, attribute );\n\n\t}\n\n\tfunction getWireframeAttribute( geometry ) {\n\n\t\tconst currentAttribute = wireframeAttributes.get( geometry );\n\n\t\tif ( currentAttribute ) {\n\n\t\t\tconst geometryIndex = geometry.index;\n\n\t\t\tif ( geometryIndex !== null ) {\n\n\t\t\t\t// if the attribute is obsolete, create a new one\n\n\t\t\t\tif ( currentAttribute.version < geometryIndex.version ) {\n\n\t\t\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tupdateWireframeAttribute( geometry );\n\n\t\t}\n\n\t\treturn wireframeAttributes.get( geometry );\n\n\t}\n\n\treturn {\n\n\t\tget: get,\n\t\tupdate: update,\n\n\t\tgetWireframeAttribute: getWireframeAttribute\n\n\t};\n\n}\n\nfunction WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tlet mode;\n\n\tfunction setMode( value ) {\n\n\t\tmode = value;\n\n\t}\n\n\tlet type, bytesPerElement;\n\n\tfunction setIndex( value ) {\n\n\t\ttype = value.type;\n\t\tbytesPerElement = value.bytesPerElement;\n\n\t}\n\n\tfunction render( start, count ) {\n\n\t\tgl.drawElements( mode, count, type, start * bytesPerElement );\n\n\t\tinfo.update( count, mode, 1 );\n\n\t}\n\n\tfunction renderInstances( start, count, primcount ) {\n\n\t\tif ( primcount === 0 ) return;\n\n\t\tlet extension, methodName;\n\n\t\tif ( isWebGL2 ) {\n\n\t\t\textension = gl;\n\t\t\tmethodName = 'drawElementsInstanced';\n\n\t\t} else {\n\n\t\t\textension = extensions.get( 'ANGLE_instanced_arrays' );\n\t\t\tmethodName = 'drawElementsInstancedANGLE';\n\n\t\t\tif ( extension === null ) {\n\n\t\t\t\tconsole.error( 'THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\textension[ methodName ]( mode, count, type, start * bytesPerElement, primcount );\n\n\t\tinfo.update( count, mode, primcount );\n\n\t}\n\n\t//\n\n\tthis.setMode = setMode;\n\tthis.setIndex = setIndex;\n\tthis.render = render;\n\tthis.renderInstances = renderInstances;\n\n}\n\nfunction WebGLInfo( gl ) {\n\n\tconst memory = {\n\t\tgeometries: 0,\n\t\ttextures: 0\n\t};\n\n\tconst render = {\n\t\tframe: 0,\n\t\tcalls: 0,\n\t\ttriangles: 0,\n\t\tpoints: 0,\n\t\tlines: 0\n\t};\n\n\tfunction update( count, mode, instanceCount ) {\n\n\t\trender.calls ++;\n\n\t\tswitch ( mode ) {\n\n\t\t\tcase 4:\n\t\t\t\trender.triangles += instanceCount * ( count / 3 );\n\t\t\t\tbreak;\n\n\t\t\tcase 1:\n\t\t\t\trender.lines += instanceCount * ( count / 2 );\n\t\t\t\tbreak;\n\n\t\t\tcase 3:\n\t\t\t\trender.lines += instanceCount * ( count - 1 );\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\n\t\t\t\trender.lines += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tcase 0:\n\t\t\t\trender.points += instanceCount * count;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tconsole.error( 'THREE.WebGLInfo: Unknown draw mode:', mode );\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction reset() {\n\n\t\trender.frame ++;\n\t\trender.calls = 0;\n\t\trender.triangles = 0;\n\t\trender.points = 0;\n\t\trender.lines = 0;\n\n\t}\n\n\treturn {\n\t\tmemory: memory,\n\t\trender: render,\n\t\tprograms: null,\n\t\tautoReset: true,\n\t\treset: reset,\n\t\tupdate: update\n\t};\n\n}\n\nclass DataTexture2DArray extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\tsuper( null );\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\nDataTexture2DArray.prototype.isDataTexture2DArray = true;\n\nfunction numericalSort( a, b ) {\n\n\treturn a[ 0 ] - b[ 0 ];\n\n}\n\nfunction absNumericalSort( a, b ) {\n\n\treturn Math.abs( b[ 1 ] ) - Math.abs( a[ 1 ] );\n\n}\n\nfunction denormalize( morph, attribute ) {\n\n\tlet denominator = 1;\n\tconst array = attribute.isInterleavedBufferAttribute ? attribute.data.array : attribute.array;\n\n\tif ( array instanceof Int8Array ) denominator = 127;\n\telse if ( array instanceof Int16Array ) denominator = 32767;\n\telse if ( array instanceof Int32Array ) denominator = 2147483647;\n\telse console.error( 'THREE.WebGLMorphtargets: Unsupported morph attribute data type: ', array );\n\n\tmorph.divideScalar( denominator );\n\n}\n\nfunction WebGLMorphtargets( gl, capabilities, textures ) {\n\n\tconst influencesList = {};\n\tconst morphInfluences = new Float32Array( 8 );\n\tconst morphTextures = new WeakMap();\n\tconst morph = new Vector3();\n\n\tconst workInfluences = [];\n\n\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\tworkInfluences[ i ] = [ i, 0 ];\n\n\t}\n\n\tfunction update( object, geometry, material, program ) {\n\n\t\tconst objectInfluences = object.morphTargetInfluences;\n\n\t\tif ( capabilities.isWebGL2 === true ) {\n\n\t\t\t// instead of using attributes, the WebGL 2 code path encodes morph targets\n\t\t\t// into an array of data textures. Each layer represents a single morph target.\n\n\t\t\tconst numberOfMorphTargets = geometry.morphAttributes.position.length;\n\n\t\t\tlet entry = morphTextures.get( geometry );\n\n\t\t\tif ( entry === undefined || entry.count !== numberOfMorphTargets ) {\n\n\t\t\t\tif ( entry !== undefined ) entry.texture.dispose();\n\n\t\t\t\tconst hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n\n\t\t\t\tconst morphTargets = geometry.morphAttributes.position;\n\t\t\t\tconst morphNormals = geometry.morphAttributes.normal || [];\n\n\t\t\t\tconst numberOfVertices = geometry.attributes.position.count;\n\t\t\t\tconst numberOfVertexData = ( hasMorphNormals === true ) ? 2 : 1; // (v,n) vs. (v)\n\n\t\t\t\tlet width = numberOfVertices * numberOfVertexData;\n\t\t\t\tlet height = 1;\n\n\t\t\t\tif ( width > capabilities.maxTextureSize ) {\n\n\t\t\t\t\theight = Math.ceil( width / capabilities.maxTextureSize );\n\t\t\t\t\twidth = capabilities.maxTextureSize;\n\n\t\t\t\t}\n\n\t\t\t\tconst buffer = new Float32Array( width * height * 4 * numberOfMorphTargets );\n\n\t\t\t\tconst texture = new DataTexture2DArray( buffer, width, height, numberOfMorphTargets );\n\t\t\t\ttexture.format = RGBAFormat; // using RGBA since RGB might be emulated (and is thus slower)\n\t\t\t\ttexture.type = FloatType;\n\n\t\t\t\t// fill buffer\n\n\t\t\t\tconst vertexDataStride = numberOfVertexData * 4;\n\n\t\t\t\tfor ( let i = 0; i < numberOfMorphTargets; i ++ ) {\n\n\t\t\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\t\t\tconst morphNormal = morphNormals[ i ];\n\n\t\t\t\t\tconst offset = width * height * 4 * i;\n\n\t\t\t\t\tfor ( let j = 0; j < morphTarget.count; j ++ ) {\n\n\t\t\t\t\t\tmorph.fromBufferAttribute( morphTarget, j );\n\n\t\t\t\t\t\tif ( morphTarget.normalized === true ) denormalize( morph, morphTarget );\n\n\t\t\t\t\t\tconst stride = j * vertexDataStride;\n\n\t\t\t\t\t\tbuffer[ offset + stride + 0 ] = morph.x;\n\t\t\t\t\t\tbuffer[ offset + stride + 1 ] = morph.y;\n\t\t\t\t\t\tbuffer[ offset + stride + 2 ] = morph.z;\n\t\t\t\t\t\tbuffer[ offset + stride + 3 ] = 0;\n\n\t\t\t\t\t\tif ( hasMorphNormals === true ) {\n\n\t\t\t\t\t\t\tmorph.fromBufferAttribute( morphNormal, j );\n\n\t\t\t\t\t\t\tif ( morphNormal.normalized === true ) denormalize( morph, morphNormal );\n\n\t\t\t\t\t\t\tbuffer[ offset + stride + 4 ] = morph.x;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 5 ] = morph.y;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 6 ] = morph.z;\n\t\t\t\t\t\t\tbuffer[ offset + stride + 7 ] = 0;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tentry = {\n\t\t\t\t\tcount: numberOfMorphTargets,\n\t\t\t\t\ttexture: texture,\n\t\t\t\t\tsize: new Vector2( width, height )\n\t\t\t\t};\n\n\t\t\t\tmorphTextures.set( geometry, entry );\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet morphInfluencesSum = 0;\n\n\t\t\tfor ( let i = 0; i < objectInfluences.length; i ++ ) {\n\n\t\t\t\tmorphInfluencesSum += objectInfluences[ i ];\n\n\t\t\t}\n\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );\n\n\n\t\t} else {\n\n\t\t\t// When object doesn't have morph target influences defined, we treat it as a 0-length array\n\t\t\t// This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences\n\n\t\t\tconst length = objectInfluences === undefined ? 0 : objectInfluences.length;\n\n\t\t\tlet influences = influencesList[ geometry.id ];\n\n\t\t\tif ( influences === undefined || influences.length !== length ) {\n\n\t\t\t\t// initialise list\n\n\t\t\t\tinfluences = [];\n\n\t\t\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\t\t\tinfluences[ i ] = [ i, 0 ];\n\n\t\t\t\t}\n\n\t\t\t\tinfluencesList[ geometry.id ] = influences;\n\n\t\t\t}\n\n\t\t\t// Collect influences\n\n\t\t\tfor ( let i = 0; i < length; i ++ ) {\n\n\t\t\t\tconst influence = influences[ i ];\n\n\t\t\t\tinfluence[ 0 ] = i;\n\t\t\t\tinfluence[ 1 ] = objectInfluences[ i ];\n\n\t\t\t}\n\n\t\t\tinfluences.sort( absNumericalSort );\n\n\t\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\t\tif ( i < length && influences[ i ][ 1 ] ) {\n\n\t\t\t\t\tworkInfluences[ i ][ 0 ] = influences[ i ][ 0 ];\n\t\t\t\t\tworkInfluences[ i ][ 1 ] = influences[ i ][ 1 ];\n\n\t\t\t\t} else {\n\n\t\t\t\t\tworkInfluences[ i ][ 0 ] = Number.MAX_SAFE_INTEGER;\n\t\t\t\t\tworkInfluences[ i ][ 1 ] = 0;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tworkInfluences.sort( numericalSort );\n\n\t\t\tconst morphTargets = geometry.morphAttributes.position;\n\t\t\tconst morphNormals = geometry.morphAttributes.normal;\n\n\t\t\tlet morphInfluencesSum = 0;\n\n\t\t\tfor ( let i = 0; i < 8; i ++ ) {\n\n\t\t\t\tconst influence = workInfluences[ i ];\n\t\t\t\tconst index = influence[ 0 ];\n\t\t\t\tconst value = influence[ 1 ];\n\n\t\t\t\tif ( index !== Number.MAX_SAFE_INTEGER && value ) {\n\n\t\t\t\t\tif ( morphTargets && geometry.getAttribute( 'morphTarget' + i ) !== morphTargets[ index ] ) {\n\n\t\t\t\t\t\tgeometry.setAttribute( 'morphTarget' + i, morphTargets[ index ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( morphNormals && geometry.getAttribute( 'morphNormal' + i ) !== morphNormals[ index ] ) {\n\n\t\t\t\t\t\tgeometry.setAttribute( 'morphNormal' + i, morphNormals[ index ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmorphInfluences[ i ] = value;\n\t\t\t\t\tmorphInfluencesSum += value;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( morphTargets && geometry.hasAttribute( 'morphTarget' + i ) === true ) {\n\n\t\t\t\t\t\tgeometry.deleteAttribute( 'morphTarget' + i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( morphNormals && geometry.hasAttribute( 'morphNormal' + i ) === true ) {\n\n\t\t\t\t\t\tgeometry.deleteAttribute( 'morphNormal' + i );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmorphInfluences[ i ] = 0;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// GLSL shader uses formula baseinfluence * base + sum(target * influence)\n\t\t\t// This allows us to switch between absolute morphs and relative morphs without changing shader code\n\t\t\t// When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)\n\t\t\tconst morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );\n\t\t\tprogram.getUniforms().setValue( gl, 'morphTargetInfluences', morphInfluences );\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\tupdate: update\n\n\t};\n\n}\n\nfunction WebGLObjects( gl, geometries, attributes, info ) {\n\n\tlet updateMap = new WeakMap();\n\n\tfunction update( object ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\tconst geometry = object.geometry;\n\t\tconst buffergeometry = geometries.get( object, geometry );\n\n\t\t// Update once per frame\n\n\t\tif ( updateMap.get( buffergeometry ) !== frame ) {\n\n\t\t\tgeometries.update( buffergeometry );\n\n\t\t\tupdateMap.set( buffergeometry, frame );\n\n\t\t}\n\n\t\tif ( object.isInstancedMesh ) {\n\n\t\t\tif ( object.hasEventListener( 'dispose', onInstancedMeshDispose ) === false ) {\n\n\t\t\t\tobject.addEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\t\t}\n\n\t\t\tattributes.update( object.instanceMatrix, 34962 );\n\n\t\t\tif ( object.instanceColor !== null ) {\n\n\t\t\t\tattributes.update( object.instanceColor, 34962 );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn buffergeometry;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tupdateMap = new WeakMap();\n\n\t}\n\n\tfunction onInstancedMeshDispose( event ) {\n\n\t\tconst instancedMesh = event.target;\n\n\t\tinstancedMesh.removeEventListener( 'dispose', onInstancedMeshDispose );\n\n\t\tattributes.remove( instancedMesh.instanceMatrix );\n\n\t\tif ( instancedMesh.instanceColor !== null ) attributes.remove( instancedMesh.instanceColor );\n\n\t}\n\n\treturn {\n\n\t\tupdate: update,\n\t\tdispose: dispose\n\n\t};\n\n}\n\nclass DataTexture3D extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, depth = 1 ) {\n\n\t\t// We're going to add .setXXX() methods for setting properties later.\n\t\t// Users can still set in DataTexture3D directly.\n\t\t//\n\t\t//\tconst texture = new THREE.DataTexture3D( data, width, height, depth );\n\t\t// \ttexture.anisotropy = 16;\n\t\t//\n\t\t// See #14839\n\n\t\tsuper( null );\n\n\t\tthis.image = { data, width, height, depth };\n\n\t\tthis.magFilter = NearestFilter;\n\t\tthis.minFilter = NearestFilter;\n\n\t\tthis.wrapR = ClampToEdgeWrapping;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\nDataTexture3D.prototype.isDataTexture3D = true;\n\n/**\n * Uniforms of a program.\n * Those form a tree structure with a special top-level container for the root,\n * which you get by calling 'new WebGLUniforms( gl, program )'.\n *\n *\n * Properties of inner nodes including the top-level container:\n *\n * .seq - array of nested uniforms\n * .map - nested uniforms by name\n *\n *\n * Methods of all nodes except the top-level container:\n *\n * .setValue( gl, value, [textures] )\n *\n * \t\tuploads a uniform value(s)\n * \tthe 'textures' parameter is needed for sampler uniforms\n *\n *\n * Static methods of the top-level container (textures factorizations):\n *\n * .upload( gl, seq, values, textures )\n *\n * \t\tsets uniforms in 'seq' to 'values[id].value'\n *\n * .seqWithValue( seq, values ) : filteredSeq\n *\n * \t\tfilters 'seq' entries with corresponding entry in values\n *\n *\n * Methods of the top-level container (textures factorizations):\n *\n * .setValue( gl, name, value, textures )\n *\n * \t\tsets uniform with name 'name' to 'value'\n *\n * .setOptional( gl, obj, prop )\n *\n * \t\tlike .set for an optional property of the object\n *\n */\n\nconst emptyTexture = new Texture();\nconst emptyTexture2dArray = new DataTexture2DArray();\nconst emptyTexture3d = new DataTexture3D();\nconst emptyCubeTexture = new CubeTexture();\n\n// --- Utilities ---\n\n// Array Caches (provide typed arrays for temporary by size)\n\nconst arrayCacheF32 = [];\nconst arrayCacheI32 = [];\n\n// Float32Array caches used for uploading Matrix uniforms\n\nconst mat4array = new Float32Array( 16 );\nconst mat3array = new Float32Array( 9 );\nconst mat2array = new Float32Array( 4 );\n\n// Flattening for arrays of vectors and matrices\n\nfunction flatten( array, nBlocks, blockSize ) {\n\n\tconst firstElem = array[ 0 ];\n\n\tif ( firstElem <= 0 || firstElem > 0 ) return array;\n\t// unoptimized: ! isNaN( firstElem )\n\t// see http://jacksondunstan.com/articles/983\n\n\tconst n = nBlocks * blockSize;\n\tlet r = arrayCacheF32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Float32Array( n );\n\t\tarrayCacheF32[ n ] = r;\n\n\t}\n\n\tif ( nBlocks !== 0 ) {\n\n\t\tfirstElem.toArray( r, 0 );\n\n\t\tfor ( let i = 1, offset = 0; i !== nBlocks; ++ i ) {\n\n\t\t\toffset += blockSize;\n\t\t\tarray[ i ].toArray( r, offset );\n\n\t\t}\n\n\t}\n\n\treturn r;\n\n}\n\nfunction arraysEqual( a, b ) {\n\n\tif ( a.length !== b.length ) return false;\n\n\tfor ( let i = 0, l = a.length; i < l; i ++ ) {\n\n\t\tif ( a[ i ] !== b[ i ] ) return false;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction copyArray( a, b ) {\n\n\tfor ( let i = 0, l = b.length; i < l; i ++ ) {\n\n\t\ta[ i ] = b[ i ];\n\n\t}\n\n}\n\n// Texture unit allocation\n\nfunction allocTexUnits( textures, n ) {\n\n\tlet r = arrayCacheI32[ n ];\n\n\tif ( r === undefined ) {\n\n\t\tr = new Int32Array( n );\n\t\tarrayCacheI32[ n ] = r;\n\n\t}\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\tr[ i ] = textures.allocateTextureUnit();\n\n\t}\n\n\treturn r;\n\n}\n\n// --- Setters ---\n\n// Note: Defining these methods externally, because they come in a bunch\n// and this way their names minify.\n\n// Single scalar\n\nfunction setValueV1f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1f( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single float vector (from flat array or THREE.VectorN)\n\nfunction setValueV2f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y ) {\n\n\t\t\tgl.uniform2f( this.addr, v.x, v.y );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform2fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV3f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z ) {\n\n\t\t\tgl.uniform3f( this.addr, v.x, v.y, v.z );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\n\t\t}\n\n\t} else if ( v.r !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.r || cache[ 1 ] !== v.g || cache[ 2 ] !== v.b ) {\n\n\t\t\tgl.uniform3f( this.addr, v.r, v.g, v.b );\n\n\t\t\tcache[ 0 ] = v.r;\n\t\t\tcache[ 1 ] = v.g;\n\t\t\tcache[ 2 ] = v.b;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform3fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\nfunction setValueV4f( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( v.x !== undefined ) {\n\n\t\tif ( cache[ 0 ] !== v.x || cache[ 1 ] !== v.y || cache[ 2 ] !== v.z || cache[ 3 ] !== v.w ) {\n\n\t\t\tgl.uniform4f( this.addr, v.x, v.y, v.z, v.w );\n\n\t\t\tcache[ 0 ] = v.x;\n\t\t\tcache[ 1 ] = v.y;\n\t\t\tcache[ 2 ] = v.z;\n\t\t\tcache[ 3 ] = v.w;\n\n\t\t}\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniform4fv( this.addr, v );\n\n\t\tcopyArray( cache, v );\n\n\t}\n\n}\n\n// Single matrix (from flat array or THREE.MatrixN)\n\nfunction setValueM2( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix2fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat2array.set( elements );\n\n\t\tgl.uniformMatrix2fv( this.addr, false, mat2array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM3( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix3fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat3array.set( elements );\n\n\t\tgl.uniformMatrix3fv( this.addr, false, mat3array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\nfunction setValueM4( gl, v ) {\n\n\tconst cache = this.cache;\n\tconst elements = v.elements;\n\n\tif ( elements === undefined ) {\n\n\t\tif ( arraysEqual( cache, v ) ) return;\n\n\t\tgl.uniformMatrix4fv( this.addr, false, v );\n\n\t\tcopyArray( cache, v );\n\n\t} else {\n\n\t\tif ( arraysEqual( cache, elements ) ) return;\n\n\t\tmat4array.set( elements );\n\n\t\tgl.uniformMatrix4fv( this.addr, false, mat4array );\n\n\t\tcopyArray( cache, elements );\n\n\t}\n\n}\n\n// Single integer / boolean\n\nfunction setValueV1i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1i( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single integer / boolean vector (from flat array)\n\nfunction setValueV2i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( arraysEqual( cache, v ) ) return;\n\n\tgl.uniform2iv( this.addr, v );\n\n\tcopyArray( cache, v );\n\n}\n\nfunction setValueV3i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( arraysEqual( cache, v ) ) return;\n\n\tgl.uniform3iv( this.addr, v );\n\n\tcopyArray( cache, v );\n\n}\n\nfunction setValueV4i( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( arraysEqual( cache, v ) ) return;\n\n\tgl.uniform4iv( this.addr, v );\n\n\tcopyArray( cache, v );\n\n}\n\n// Single unsigned integer\n\nfunction setValueV1ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( cache[ 0 ] === v ) return;\n\n\tgl.uniform1ui( this.addr, v );\n\n\tcache[ 0 ] = v;\n\n}\n\n// Single unsigned integer vector (from flat array)\n\nfunction setValueV2ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( arraysEqual( cache, v ) ) return;\n\n\tgl.uniform2uiv( this.addr, v );\n\n\tcopyArray( cache, v );\n\n}\n\nfunction setValueV3ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( arraysEqual( cache, v ) ) return;\n\n\tgl.uniform3uiv( this.addr, v );\n\n\tcopyArray( cache, v );\n\n}\n\nfunction setValueV4ui( gl, v ) {\n\n\tconst cache = this.cache;\n\n\tif ( arraysEqual( cache, v ) ) return;\n\n\tgl.uniform4uiv( this.addr, v );\n\n\tcopyArray( cache, v );\n\n}\n\n\n// Single texture (2D / Cube)\n\nfunction setValueT1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.safeSetTexture2D( v || emptyTexture, unit );\n\n}\n\nfunction setValueT3D1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture3D( v || emptyTexture3d, unit );\n\n}\n\nfunction setValueT6( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.safeSetTextureCube( v || emptyCubeTexture, unit );\n\n}\n\nfunction setValueT2DArray1( gl, v, textures ) {\n\n\tconst cache = this.cache;\n\tconst unit = textures.allocateTextureUnit();\n\n\tif ( cache[ 0 ] !== unit ) {\n\n\t\tgl.uniform1i( this.addr, unit );\n\t\tcache[ 0 ] = unit;\n\n\t}\n\n\ttextures.setTexture2DArray( v || emptyTexture2dArray, unit );\n\n}\n\n// Helper to pick the right setter for the singular case\n\nfunction getSingularSetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1f; // FLOAT\n\t\tcase 0x8b50: return setValueV2f; // _VEC2\n\t\tcase 0x8b51: return setValueV3f; // _VEC3\n\t\tcase 0x8b52: return setValueV4f; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2; // _MAT2\n\t\tcase 0x8b5b: return setValueM3; // _MAT3\n\t\tcase 0x8b5c: return setValueM4; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1i; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2i; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3i; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4i; // _VEC4\n\n\t\tcase 0x1405: return setValueV1ui; // UINT\n\t\tcase 0x8dc6: return setValueV2ui; // _VEC2\n\t\tcase 0x8dc7: return setValueV3ui; // _VEC3\n\t\tcase 0x8dc8: return setValueV4ui; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1;\n\n\t\tcase 0x8b5f: // SAMPLER_3D\n\t\tcase 0x8dcb: // INT_SAMPLER_3D\n\t\tcase 0x8dd3: // UNSIGNED_INT_SAMPLER_3D\n\t\t\treturn setValueT3D1;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6;\n\n\t\tcase 0x8dc1: // SAMPLER_2D_ARRAY\n\t\tcase 0x8dcf: // INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n\t\tcase 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW\n\t\t\treturn setValueT2DArray1;\n\n\t}\n\n}\n\n\n// Array of scalars\n\nfunction setValueV1fArray( gl, v ) {\n\n\tgl.uniform1fv( this.addr, v );\n\n}\n\n// Array of vectors (from flat array or array of THREE.VectorN)\n\nfunction setValueV2fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 2 );\n\n\tgl.uniform2fv( this.addr, data );\n\n}\n\nfunction setValueV3fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 3 );\n\n\tgl.uniform3fv( this.addr, data );\n\n}\n\nfunction setValueV4fArray( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniform4fv( this.addr, data );\n\n}\n\n// Array of matrices (from flat array or array of THREE.MatrixN)\n\nfunction setValueM2Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 4 );\n\n\tgl.uniformMatrix2fv( this.addr, false, data );\n\n}\n\nfunction setValueM3Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 9 );\n\n\tgl.uniformMatrix3fv( this.addr, false, data );\n\n}\n\nfunction setValueM4Array( gl, v ) {\n\n\tconst data = flatten( v, this.size, 16 );\n\n\tgl.uniformMatrix4fv( this.addr, false, data );\n\n}\n\n// Array of integer / boolean\n\nfunction setValueV1iArray( gl, v ) {\n\n\tgl.uniform1iv( this.addr, v );\n\n}\n\n// Array of integer / boolean vectors (from flat array)\n\nfunction setValueV2iArray( gl, v ) {\n\n\tgl.uniform2iv( this.addr, v );\n\n}\n\nfunction setValueV3iArray( gl, v ) {\n\n\tgl.uniform3iv( this.addr, v );\n\n}\n\nfunction setValueV4iArray( gl, v ) {\n\n\tgl.uniform4iv( this.addr, v );\n\n}\n\n// Array of unsigned integer\n\nfunction setValueV1uiArray( gl, v ) {\n\n\tgl.uniform1uiv( this.addr, v );\n\n}\n\n// Array of unsigned integer vectors (from flat array)\n\nfunction setValueV2uiArray( gl, v ) {\n\n\tgl.uniform2uiv( this.addr, v );\n\n}\n\nfunction setValueV3uiArray( gl, v ) {\n\n\tgl.uniform3uiv( this.addr, v );\n\n}\n\nfunction setValueV4uiArray( gl, v ) {\n\n\tgl.uniform4uiv( this.addr, v );\n\n}\n\n\n// Array of textures (2D / Cube)\n\nfunction setValueT1Array( gl, v, textures ) {\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tgl.uniform1iv( this.addr, units );\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.safeSetTexture2D( v[ i ] || emptyTexture, units[ i ] );\n\n\t}\n\n}\n\nfunction setValueT6Array( gl, v, textures ) {\n\n\tconst n = v.length;\n\n\tconst units = allocTexUnits( textures, n );\n\n\tgl.uniform1iv( this.addr, units );\n\n\tfor ( let i = 0; i !== n; ++ i ) {\n\n\t\ttextures.safeSetTextureCube( v[ i ] || emptyCubeTexture, units[ i ] );\n\n\t}\n\n}\n\n// Helper to pick the right setter for a pure (bottom-level) array\n\nfunction getPureArraySetter( type ) {\n\n\tswitch ( type ) {\n\n\t\tcase 0x1406: return setValueV1fArray; // FLOAT\n\t\tcase 0x8b50: return setValueV2fArray; // _VEC2\n\t\tcase 0x8b51: return setValueV3fArray; // _VEC3\n\t\tcase 0x8b52: return setValueV4fArray; // _VEC4\n\n\t\tcase 0x8b5a: return setValueM2Array; // _MAT2\n\t\tcase 0x8b5b: return setValueM3Array; // _MAT3\n\t\tcase 0x8b5c: return setValueM4Array; // _MAT4\n\n\t\tcase 0x1404: case 0x8b56: return setValueV1iArray; // INT, BOOL\n\t\tcase 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2\n\t\tcase 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3\n\t\tcase 0x8b55: case 0x8b59: return setValueV4iArray; // _VEC4\n\n\t\tcase 0x1405: return setValueV1uiArray; // UINT\n\t\tcase 0x8dc6: return setValueV2uiArray; // _VEC2\n\t\tcase 0x8dc7: return setValueV3uiArray; // _VEC3\n\t\tcase 0x8dc8: return setValueV4uiArray; // _VEC4\n\n\t\tcase 0x8b5e: // SAMPLER_2D\n\t\tcase 0x8d66: // SAMPLER_EXTERNAL_OES\n\t\tcase 0x8dca: // INT_SAMPLER_2D\n\t\tcase 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n\t\tcase 0x8b62: // SAMPLER_2D_SHADOW\n\t\t\treturn setValueT1Array;\n\n\t\tcase 0x8b60: // SAMPLER_CUBE\n\t\tcase 0x8dcc: // INT_SAMPLER_CUBE\n\t\tcase 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n\t\tcase 0x8dc5: // SAMPLER_CUBE_SHADOW\n\t\t\treturn setValueT6Array;\n\n\t}\n\n}\n\n// --- Uniform Classes ---\n\nfunction SingleUniform( id, activeInfo, addr ) {\n\n\tthis.id = id;\n\tthis.addr = addr;\n\tthis.cache = [];\n\tthis.setValue = getSingularSetter( activeInfo.type );\n\n\t// this.path = activeInfo.name; // DEBUG\n\n}\n\nfunction PureArrayUniform( id, activeInfo, addr ) {\n\n\tthis.id = id;\n\tthis.addr = addr;\n\tthis.cache = [];\n\tthis.size = activeInfo.size;\n\tthis.setValue = getPureArraySetter( activeInfo.type );\n\n\t// this.path = activeInfo.name; // DEBUG\n\n}\n\nPureArrayUniform.prototype.updateCache = function ( data ) {\n\n\tconst cache = this.cache;\n\n\tif ( data instanceof Float32Array && cache.length !== data.length ) {\n\n\t\tthis.cache = new Float32Array( data.length );\n\n\t}\n\n\tcopyArray( cache, data );\n\n};\n\nfunction StructuredUniform( id ) {\n\n\tthis.id = id;\n\n\tthis.seq = [];\n\tthis.map = {};\n\n}\n\nStructuredUniform.prototype.setValue = function ( gl, value, textures ) {\n\n\tconst seq = this.seq;\n\n\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\tconst u = seq[ i ];\n\t\tu.setValue( gl, value[ u.id ], textures );\n\n\t}\n\n};\n\n// --- Top-level ---\n\n// Parser - builds up the property tree from the path strings\n\nconst RePathPart = /(\\w+)(\\])?(\\[|\\.)?/g;\n\n// extracts\n// \t- the identifier (member name or array index)\n// - followed by an optional right bracket (found when array index)\n// - followed by an optional left bracket or dot (type of subscript)\n//\n// Note: These portions can be read in a non-overlapping fashion and\n// allow straightforward parsing of the hierarchy that WebGL encodes\n// in the uniform names.\n\nfunction addUniform( container, uniformObject ) {\n\n\tcontainer.seq.push( uniformObject );\n\tcontainer.map[ uniformObject.id ] = uniformObject;\n\n}\n\nfunction parseUniform( activeInfo, addr, container ) {\n\n\tconst path = activeInfo.name,\n\t\tpathLength = path.length;\n\n\t// reset RegExp object, because of the early exit of a previous run\n\tRePathPart.lastIndex = 0;\n\n\twhile ( true ) {\n\n\t\tconst match = RePathPart.exec( path ),\n\t\t\tmatchEnd = RePathPart.lastIndex;\n\n\t\tlet id = match[ 1 ];\n\t\tconst idIsIndex = match[ 2 ] === ']',\n\t\t\tsubscript = match[ 3 ];\n\n\t\tif ( idIsIndex ) id = id | 0; // convert to integer\n\n\t\tif ( subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength ) {\n\n\t\t\t// bare name or \"pure\" bottom-level array \"[0]\" suffix\n\n\t\t\taddUniform( container, subscript === undefined ?\n\t\t\t\tnew SingleUniform( id, activeInfo, addr ) :\n\t\t\t\tnew PureArrayUniform( id, activeInfo, addr ) );\n\n\t\t\tbreak;\n\n\t\t} else {\n\n\t\t\t// step into inner node / create it in case it doesn't exist\n\n\t\t\tconst map = container.map;\n\t\t\tlet next = map[ id ];\n\n\t\t\tif ( next === undefined ) {\n\n\t\t\t\tnext = new StructuredUniform( id );\n\t\t\t\taddUniform( container, next );\n\n\t\t\t}\n\n\t\t\tcontainer = next;\n\n\t\t}\n\n\t}\n\n}\n\n// Root Container\n\nfunction WebGLUniforms( gl, program ) {\n\n\tthis.seq = [];\n\tthis.map = {};\n\n\tconst n = gl.getProgramParameter( program, 35718 );\n\n\tfor ( let i = 0; i < n; ++ i ) {\n\n\t\tconst info = gl.getActiveUniform( program, i ),\n\t\t\taddr = gl.getUniformLocation( program, info.name );\n\n\t\tparseUniform( info, addr, this );\n\n\t}\n\n}\n\nWebGLUniforms.prototype.setValue = function ( gl, name, value, textures ) {\n\n\tconst u = this.map[ name ];\n\n\tif ( u !== undefined ) u.setValue( gl, value, textures );\n\n};\n\nWebGLUniforms.prototype.setOptional = function ( gl, object, name ) {\n\n\tconst v = object[ name ];\n\n\tif ( v !== undefined ) this.setValue( gl, name, v );\n\n};\n\n\n// Static interface\n\nWebGLUniforms.upload = function ( gl, seq, values, textures ) {\n\n\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\tconst u = seq[ i ],\n\t\t\tv = values[ u.id ];\n\n\t\tif ( v.needsUpdate !== false ) {\n\n\t\t\t// note: always updating when .needsUpdate is undefined\n\t\t\tu.setValue( gl, v.value, textures );\n\n\t\t}\n\n\t}\n\n};\n\nWebGLUniforms.seqWithValue = function ( seq, values ) {\n\n\tconst r = [];\n\n\tfor ( let i = 0, n = seq.length; i !== n; ++ i ) {\n\n\t\tconst u = seq[ i ];\n\t\tif ( u.id in values ) r.push( u );\n\n\t}\n\n\treturn r;\n\n};\n\nfunction WebGLShader( gl, type, string ) {\n\n\tconst shader = gl.createShader( type );\n\n\tgl.shaderSource( shader, string );\n\tgl.compileShader( shader );\n\n\treturn shader;\n\n}\n\nlet programIdCount = 0;\n\nfunction addLineNumbers( string ) {\n\n\tconst lines = string.split( '\\n' );\n\n\tfor ( let i = 0; i < lines.length; i ++ ) {\n\n\t\tlines[ i ] = ( i + 1 ) + ': ' + lines[ i ];\n\n\t}\n\n\treturn lines.join( '\\n' );\n\n}\n\nfunction getEncodingComponents( encoding ) {\n\n\tswitch ( encoding ) {\n\n\t\tcase LinearEncoding:\n\t\t\treturn [ 'Linear', '( value )' ];\n\t\tcase sRGBEncoding:\n\t\t\treturn [ 'sRGB', '( value )' ];\n\t\tcase RGBEEncoding:\n\t\t\treturn [ 'RGBE', '( value )' ];\n\t\tcase RGBM7Encoding:\n\t\t\treturn [ 'RGBM', '( value, 7.0 )' ];\n\t\tcase RGBM16Encoding:\n\t\t\treturn [ 'RGBM', '( value, 16.0 )' ];\n\t\tcase RGBDEncoding:\n\t\t\treturn [ 'RGBD', '( value, 256.0 )' ];\n\t\tcase GammaEncoding:\n\t\t\treturn [ 'Gamma', '( value, float( GAMMA_FACTOR ) )' ];\n\t\tcase LogLuvEncoding:\n\t\t\treturn [ 'LogLuv', '( value )' ];\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported encoding:', encoding );\n\t\t\treturn [ 'Linear', '( value )' ];\n\n\t}\n\n}\n\nfunction getShaderErrors( gl, shader, type ) {\n\n\tconst status = gl.getShaderParameter( shader, 35713 );\n\tconst errors = gl.getShaderInfoLog( shader ).trim();\n\n\tif ( status && errors === '' ) return '';\n\n\t// --enable-privileged-webgl-extension\n\t// console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\n\n\treturn type.toUpperCase() + '\\n\\n' + errors + '\\n\\n' + addLineNumbers( gl.getShaderSource( shader ) );\n\n}\n\nfunction getTexelDecodingFunction( functionName, encoding ) {\n\n\tconst components = getEncodingComponents( encoding );\n\treturn 'vec4 ' + functionName + '( vec4 value ) { return ' + components[ 0 ] + 'ToLinear' + components[ 1 ] + '; }';\n\n}\n\nfunction getTexelEncodingFunction( functionName, encoding ) {\n\n\tconst components = getEncodingComponents( encoding );\n\treturn 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[ 0 ] + components[ 1 ] + '; }';\n\n}\n\nfunction getToneMappingFunction( functionName, toneMapping ) {\n\n\tlet toneMappingName;\n\n\tswitch ( toneMapping ) {\n\n\t\tcase LinearToneMapping:\n\t\t\ttoneMappingName = 'Linear';\n\t\t\tbreak;\n\n\t\tcase ReinhardToneMapping:\n\t\t\ttoneMappingName = 'Reinhard';\n\t\t\tbreak;\n\n\t\tcase CineonToneMapping:\n\t\t\ttoneMappingName = 'OptimizedCineon';\n\t\t\tbreak;\n\n\t\tcase ACESFilmicToneMapping:\n\t\t\ttoneMappingName = 'ACESFilmic';\n\t\t\tbreak;\n\n\t\tcase CustomToneMapping:\n\t\t\ttoneMappingName = 'Custom';\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Unsupported toneMapping:', toneMapping );\n\t\t\ttoneMappingName = 'Linear';\n\n\t}\n\n\treturn 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }';\n\n}\n\nfunction generateExtensions( parameters ) {\n\n\tconst chunks = [\n\t\t( parameters.extensionDerivatives || parameters.envMapCubeUV || parameters.bumpMap || parameters.tangentSpaceNormalMap || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',\n\t\t( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',\n\t\t( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',\n\t\t( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''\n\t];\n\n\treturn chunks.filter( filterEmptyLine ).join( '\\n' );\n\n}\n\nfunction generateDefines( defines ) {\n\n\tconst chunks = [];\n\n\tfor ( const name in defines ) {\n\n\t\tconst value = defines[ name ];\n\n\t\tif ( value === false ) continue;\n\n\t\tchunks.push( '#define ' + name + ' ' + value );\n\n\t}\n\n\treturn chunks.join( '\\n' );\n\n}\n\nfunction fetchAttributeLocations( gl, program ) {\n\n\tconst attributes = {};\n\n\tconst n = gl.getProgramParameter( program, 35721 );\n\n\tfor ( let i = 0; i < n; i ++ ) {\n\n\t\tconst info = gl.getActiveAttrib( program, i );\n\t\tconst name = info.name;\n\n\t\tlet locationSize = 1;\n\t\tif ( info.type === 35674 ) locationSize = 2;\n\t\tif ( info.type === 35675 ) locationSize = 3;\n\t\tif ( info.type === 35676 ) locationSize = 4;\n\n\t\t// console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );\n\n\t\tattributes[ name ] = {\n\t\t\ttype: info.type,\n\t\t\tlocation: gl.getAttribLocation( program, name ),\n\t\t\tlocationSize: locationSize\n\t\t};\n\n\t}\n\n\treturn attributes;\n\n}\n\nfunction filterEmptyLine( string ) {\n\n\treturn string !== '';\n\n}\n\nfunction replaceLightNums( string, parameters ) {\n\n\treturn string\n\t\t.replace( /NUM_DIR_LIGHTS/g, parameters.numDirLights )\n\t\t.replace( /NUM_SPOT_LIGHTS/g, parameters.numSpotLights )\n\t\t.replace( /NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights )\n\t\t.replace( /NUM_POINT_LIGHTS/g, parameters.numPointLights )\n\t\t.replace( /NUM_HEMI_LIGHTS/g, parameters.numHemiLights )\n\t\t.replace( /NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows )\n\t\t.replace( /NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows )\n\t\t.replace( /NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows );\n\n}\n\nfunction replaceClippingPlaneNums( string, parameters ) {\n\n\treturn string\n\t\t.replace( /NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes )\n\t\t.replace( /UNION_CLIPPING_PLANES/g, ( parameters.numClippingPlanes - parameters.numClipIntersection ) );\n\n}\n\n// Resolve Includes\n\nconst includePattern = /^[ \\t]*#include +<([\\w\\d./]+)>/gm;\n\nfunction resolveIncludes( string ) {\n\n\treturn string.replace( includePattern, includeReplacer );\n\n}\n\nfunction includeReplacer( match, include ) {\n\n\tconst string = ShaderChunk[ include ];\n\n\tif ( string === undefined ) {\n\n\t\tthrow new Error( 'Can not resolve #include <' + include + '>' );\n\n\t}\n\n\treturn resolveIncludes( string );\n\n}\n\n// Unroll Loops\n\nconst deprecatedUnrollLoopPattern = /#pragma unroll_loop[\\s]+?for \\( int i \\= (\\d+)\\; i < (\\d+)\\; i \\+\\+ \\) \\{([\\s\\S]+?)(?=\\})\\}/g;\nconst unrollLoopPattern = /#pragma unroll_loop_start\\s+for\\s*\\(\\s*int\\s+i\\s*=\\s*(\\d+)\\s*;\\s*i\\s*<\\s*(\\d+)\\s*;\\s*i\\s*\\+\\+\\s*\\)\\s*{([\\s\\S]+?)}\\s+#pragma unroll_loop_end/g;\n\nfunction unrollLoops( string ) {\n\n\treturn string\n\t\t.replace( unrollLoopPattern, loopReplacer )\n\t\t.replace( deprecatedUnrollLoopPattern, deprecatedLoopReplacer );\n\n}\n\nfunction deprecatedLoopReplacer( match, start, end, snippet ) {\n\n\tconsole.warn( 'WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.' );\n\treturn loopReplacer( match, start, end, snippet );\n\n}\n\nfunction loopReplacer( match, start, end, snippet ) {\n\n\tlet string = '';\n\n\tfor ( let i = parseInt( start ); i < parseInt( end ); i ++ ) {\n\n\t\tstring += snippet\n\t\t\t.replace( /\\[\\s*i\\s*\\]/g, '[ ' + i + ' ]' )\n\t\t\t.replace( /UNROLLED_LOOP_INDEX/g, i );\n\n\t}\n\n\treturn string;\n\n}\n\n//\n\nfunction generatePrecision( parameters ) {\n\n\tlet precisionstring = 'precision ' + parameters.precision + ' float;\\nprecision ' + parameters.precision + ' int;';\n\n\tif ( parameters.precision === 'highp' ) {\n\n\t\tprecisionstring += '\\n#define HIGH_PRECISION';\n\n\t} else if ( parameters.precision === 'mediump' ) {\n\n\t\tprecisionstring += '\\n#define MEDIUM_PRECISION';\n\n\t} else if ( parameters.precision === 'lowp' ) {\n\n\t\tprecisionstring += '\\n#define LOW_PRECISION';\n\n\t}\n\n\treturn precisionstring;\n\n}\n\nfunction generateShadowMapTypeDefine( parameters ) {\n\n\tlet shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';\n\n\tif ( parameters.shadowMapType === PCFShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';\n\n\t} else if ( parameters.shadowMapType === PCFSoftShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';\n\n\t} else if ( parameters.shadowMapType === VSMShadowMap ) {\n\n\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';\n\n\t}\n\n\treturn shadowMapTypeDefine;\n\n}\n\nfunction generateEnvMapTypeDefine( parameters ) {\n\n\tlet envMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeReflectionMapping:\n\t\t\tcase CubeRefractionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n\t\t\t\tbreak;\n\n\t\t\tcase CubeUVReflectionMapping:\n\t\t\tcase CubeUVRefractionMapping:\n\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapTypeDefine;\n\n}\n\nfunction generateEnvMapModeDefine( parameters ) {\n\n\tlet envMapModeDefine = 'ENVMAP_MODE_REFLECTION';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.envMapMode ) {\n\n\t\t\tcase CubeRefractionMapping:\n\t\t\tcase CubeUVRefractionMapping:\n\n\t\t\t\tenvMapModeDefine = 'ENVMAP_MODE_REFRACTION';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapModeDefine;\n\n}\n\nfunction generateEnvMapBlendingDefine( parameters ) {\n\n\tlet envMapBlendingDefine = 'ENVMAP_BLENDING_NONE';\n\n\tif ( parameters.envMap ) {\n\n\t\tswitch ( parameters.combine ) {\n\n\t\t\tcase MultiplyOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\n\t\t\t\tbreak;\n\n\t\t\tcase MixOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MIX';\n\t\t\t\tbreak;\n\n\t\t\tcase AddOperation:\n\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_ADD';\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\treturn envMapBlendingDefine;\n\n}\n\nfunction WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {\n\n\t// TODO Send this event to Three.js DevTools\n\t// console.log( 'WebGLProgram', cacheKey );\n\n\tconst gl = renderer.getContext();\n\n\tconst defines = parameters.defines;\n\n\tlet vertexShader = parameters.vertexShader;\n\tlet fragmentShader = parameters.fragmentShader;\n\n\tconst shadowMapTypeDefine = generateShadowMapTypeDefine( parameters );\n\tconst envMapTypeDefine = generateEnvMapTypeDefine( parameters );\n\tconst envMapModeDefine = generateEnvMapModeDefine( parameters );\n\tconst envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );\n\n\n\tconst gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0;\n\n\tconst customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );\n\n\tconst customDefines = generateDefines( defines );\n\n\tconst program = gl.createProgram();\n\n\tlet prefixVertex, prefixFragment;\n\tlet versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\\n' : '';\n\n\tif ( parameters.isRawShaderMaterial ) {\n\n\t\tprefixVertex = [\n\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixVertex.length > 0 ) {\n\n\t\t\tprefixVertex += '\\n';\n\n\t\t}\n\n\t\tprefixFragment = [\n\n\t\t\tcustomExtensions,\n\t\t\tcustomDefines\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tif ( prefixFragment.length > 0 ) {\n\n\t\t\tprefixFragment += '\\n';\n\n\t\t}\n\n\t} else {\n\n\t\tprefixVertex = [\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\tparameters.instancing ? '#define USE_INSTANCING' : '',\n\t\t\tparameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',\n\n\t\t\tparameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '',\n\n\t\t\t'#define GAMMA_FACTOR ' + gammaFactorDefine,\n\n\t\t\t'#define MAX_BONES ' + parameters.maxBones,\n\t\t\t( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '',\n\t\t\t( parameters.useFog && parameters.fogExp2 ) ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\t( parameters.normalMap && parameters.objectSpaceNormalMap ) ? '#define OBJECTSPACE_NORMALMAP' : '',\n\t\t\t( parameters.normalMap && parameters.tangentSpaceNormalMap ) ? '#define TANGENTSPACE_NORMALMAP' : '',\n\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.displacementMap && parameters.supportsVertexTextures ? '#define USE_DISPLACEMENTMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULARCOLORMAP' : '',\n\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEENCOLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEENROUGHNESSMAP' : '',\n\n\t\t\tparameters.vertexTangents ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUvs ? '#define USE_UV' : '',\n\t\t\tparameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.skinning ? '#define USE_SKINNING' : '',\n\t\t\tparameters.useVertexTexture ? '#define BONE_TEXTURE' : '',\n\n\t\t\tparameters.morphTargets ? '#define USE_MORPHTARGETS' : '',\n\t\t\tparameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',\n\t\t\t( parameters.morphTargets && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE' : '',\n\t\t\t( parameters.morphTargets && parameters.isWebGL2 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\t\t\t( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\n\n\t\t\t'uniform mat4 modelMatrix;',\n\t\t\t'uniform mat4 modelViewMatrix;',\n\t\t\t'uniform mat4 projectionMatrix;',\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform mat3 normalMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t'#ifdef USE_INSTANCING',\n\n\t\t\t'\tattribute mat4 instanceMatrix;',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_INSTANCING_COLOR',\n\n\t\t\t'\tattribute vec3 instanceColor;',\n\n\t\t\t'#endif',\n\n\t\t\t'attribute vec3 position;',\n\t\t\t'attribute vec3 normal;',\n\t\t\t'attribute vec2 uv;',\n\n\t\t\t'#ifdef USE_TANGENT',\n\n\t\t\t'\tattribute vec4 tangent;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if defined( USE_COLOR_ALPHA )',\n\n\t\t\t'\tattribute vec4 color;',\n\n\t\t\t'#elif defined( USE_COLOR )',\n\n\t\t\t'\tattribute vec3 color;',\n\n\t\t\t'#endif',\n\n\t\t\t'#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )',\n\n\t\t\t'\tattribute vec3 morphTarget0;',\n\t\t\t'\tattribute vec3 morphTarget1;',\n\t\t\t'\tattribute vec3 morphTarget2;',\n\t\t\t'\tattribute vec3 morphTarget3;',\n\n\t\t\t'\t#ifdef USE_MORPHNORMALS',\n\n\t\t\t'\t\tattribute vec3 morphNormal0;',\n\t\t\t'\t\tattribute vec3 morphNormal1;',\n\t\t\t'\t\tattribute vec3 morphNormal2;',\n\t\t\t'\t\tattribute vec3 morphNormal3;',\n\n\t\t\t'\t#else',\n\n\t\t\t'\t\tattribute vec3 morphTarget4;',\n\t\t\t'\t\tattribute vec3 morphTarget5;',\n\t\t\t'\t\tattribute vec3 morphTarget6;',\n\t\t\t'\t\tattribute vec3 morphTarget7;',\n\n\t\t\t'\t#endif',\n\n\t\t\t'#endif',\n\n\t\t\t'#ifdef USE_SKINNING',\n\n\t\t\t'\tattribute vec4 skinIndex;',\n\t\t\t'\tattribute vec4 skinWeight;',\n\n\t\t\t'#endif',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t\tprefixFragment = [\n\n\t\t\tcustomExtensions,\n\n\t\t\tgeneratePrecision( parameters ),\n\n\t\t\t'#define SHADER_NAME ' + parameters.shaderName,\n\n\t\t\tcustomDefines,\n\n\t\t\t'#define GAMMA_FACTOR ' + gammaFactorDefine,\n\n\t\t\t( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '',\n\t\t\t( parameters.useFog && parameters.fogExp2 ) ? '#define FOG_EXP2' : '',\n\n\t\t\tparameters.map ? '#define USE_MAP' : '',\n\t\t\tparameters.matcap ? '#define USE_MATCAP' : '',\n\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\n\t\t\tparameters.envMap ? '#define ' + envMapTypeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\n\t\t\tparameters.envMap ? '#define ' + envMapBlendingDefine : '',\n\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\n\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\n\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\n\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\n\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\n\t\t\t( parameters.normalMap && parameters.objectSpaceNormalMap ) ? '#define OBJECTSPACE_NORMALMAP' : '',\n\t\t\t( parameters.normalMap && parameters.tangentSpaceNormalMap ) ? '#define TANGENTSPACE_NORMALMAP' : '',\n\n\t\t\tparameters.clearcoat ? '#define USE_CLEARCOAT' : '',\n\t\t\tparameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',\n\t\t\tparameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',\n\t\t\tparameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',\n\n\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\n\t\t\tparameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '',\n\t\t\tparameters.specularColorMap ? '#define USE_SPECULARCOLORMAP' : '',\n\t\t\tparameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',\n\t\t\tparameters.metalnessMap ? '#define USE_METALNESSMAP' : '',\n\n\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\n\t\t\tparameters.alphaTest ? '#define USE_ALPHATEST' : '',\n\n\t\t\tparameters.sheen ? '#define USE_SHEEN' : '',\n\t\t\tparameters.sheenColorMap ? '#define USE_SHEENCOLORMAP' : '',\n\t\t\tparameters.sheenRoughnessMap ? '#define USE_SHEENROUGHNESSMAP' : '',\n\n\t\t\tparameters.transmission ? '#define USE_TRANSMISSION' : '',\n\t\t\tparameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',\n\t\t\tparameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',\n\n\t\t\tparameters.vertexTangents ? '#define USE_TANGENT' : '',\n\t\t\tparameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '',\n\t\t\tparameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',\n\t\t\tparameters.vertexUvs ? '#define USE_UV' : '',\n\t\t\tparameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '',\n\n\t\t\tparameters.gradientMap ? '#define USE_GRADIENTMAP' : '',\n\n\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\n\n\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\n\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\n\n\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\n\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\n\n\t\t\tparameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',\n\n\t\t\tparameters.physicallyCorrectLights ? '#define PHYSICALLY_CORRECT_LIGHTS' : '',\n\n\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\n\t\t\t( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\n\n\t\t\t( ( parameters.extensionShaderTextureLOD || parameters.envMap ) && parameters.rendererExtensionShaderTextureLod ) ? '#define TEXTURE_LOD_EXT' : '',\n\n\t\t\t'uniform mat4 viewMatrix;',\n\t\t\t'uniform vec3 cameraPosition;',\n\t\t\t'uniform bool isOrthographic;',\n\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? '#define TONE_MAPPING' : '',\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? ShaderChunk[ 'tonemapping_pars_fragment' ] : '', // this code is required here because it is used by the toneMapping() function defined below\n\t\t\t( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',\n\n\t\t\tparameters.dithering ? '#define DITHERING' : '',\n\t\t\tparameters.format === RGBFormat ? '#define OPAQUE' : '',\n\n\t\t\tShaderChunk[ 'encodings_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below\n\t\t\tparameters.map ? getTexelDecodingFunction( 'mapTexelToLinear', parameters.mapEncoding ) : '',\n\t\t\tparameters.matcap ? getTexelDecodingFunction( 'matcapTexelToLinear', parameters.matcapEncoding ) : '',\n\t\t\tparameters.envMap ? getTexelDecodingFunction( 'envMapTexelToLinear', parameters.envMapEncoding ) : '',\n\t\t\tparameters.emissiveMap ? getTexelDecodingFunction( 'emissiveMapTexelToLinear', parameters.emissiveMapEncoding ) : '',\n\t\t\tparameters.specularColorMap ? getTexelDecodingFunction( 'specularColorMapTexelToLinear', parameters.specularColorMapEncoding ) : '',\n\t\t\tparameters.sheenColorMap ? getTexelDecodingFunction( 'sheenColorMapTexelToLinear', parameters.sheenColorMapEncoding ) : '',\n\t\t\tparameters.lightMap ? getTexelDecodingFunction( 'lightMapTexelToLinear', parameters.lightMapEncoding ) : '',\n\t\t\tgetTexelEncodingFunction( 'linearToOutputTexel', parameters.outputEncoding ),\n\n\t\t\tparameters.depthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '',\n\n\t\t\t'\\n'\n\n\t\t].filter( filterEmptyLine ).join( '\\n' );\n\n\t}\n\n\tvertexShader = resolveIncludes( vertexShader );\n\tvertexShader = replaceLightNums( vertexShader, parameters );\n\tvertexShader = replaceClippingPlaneNums( vertexShader, parameters );\n\n\tfragmentShader = resolveIncludes( fragmentShader );\n\tfragmentShader = replaceLightNums( fragmentShader, parameters );\n\tfragmentShader = replaceClippingPlaneNums( fragmentShader, parameters );\n\n\tvertexShader = unrollLoops( vertexShader );\n\tfragmentShader = unrollLoops( fragmentShader );\n\n\tif ( parameters.isWebGL2 && parameters.isRawShaderMaterial !== true ) {\n\n\t\t// GLSL 3.0 conversion for built-in materials and ShaderMaterial\n\n\t\tversionString = '#version 300 es\\n';\n\n\t\tprefixVertex = [\n\t\t\t'precision mediump sampler2DArray;',\n\t\t\t'#define attribute in',\n\t\t\t'#define varying out',\n\t\t\t'#define texture2D texture'\n\t\t].join( '\\n' ) + '\\n' + prefixVertex;\n\n\t\tprefixFragment = [\n\t\t\t'#define varying in',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : 'out highp vec4 pc_fragColor;',\n\t\t\t( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',\n\t\t\t'#define gl_FragDepthEXT gl_FragDepth',\n\t\t\t'#define texture2D texture',\n\t\t\t'#define textureCube texture',\n\t\t\t'#define texture2DProj textureProj',\n\t\t\t'#define texture2DLodEXT textureLod',\n\t\t\t'#define texture2DProjLodEXT textureProjLod',\n\t\t\t'#define textureCubeLodEXT textureLod',\n\t\t\t'#define texture2DGradEXT textureGrad',\n\t\t\t'#define texture2DProjGradEXT textureProjGrad',\n\t\t\t'#define textureCubeGradEXT textureGrad'\n\t\t].join( '\\n' ) + '\\n' + prefixFragment;\n\n\t}\n\n\tconst vertexGlsl = versionString + prefixVertex + vertexShader;\n\tconst fragmentGlsl = versionString + prefixFragment + fragmentShader;\n\n\t// console.log( '*VERTEX*', vertexGlsl );\n\t// console.log( '*FRAGMENT*', fragmentGlsl );\n\n\tconst glVertexShader = WebGLShader( gl, 35633, vertexGlsl );\n\tconst glFragmentShader = WebGLShader( gl, 35632, fragmentGlsl );\n\n\tgl.attachShader( program, glVertexShader );\n\tgl.attachShader( program, glFragmentShader );\n\n\t// Force a particular attribute to index 0.\n\n\tif ( parameters.index0AttributeName !== undefined ) {\n\n\t\tgl.bindAttribLocation( program, 0, parameters.index0AttributeName );\n\n\t} else if ( parameters.morphTargets === true ) {\n\n\t\t// programs with morphTargets displace position out of attribute 0\n\t\tgl.bindAttribLocation( program, 0, 'position' );\n\n\t}\n\n\tgl.linkProgram( program );\n\n\t// check for link errors\n\tif ( renderer.debug.checkShaderErrors ) {\n\n\t\tconst programLog = gl.getProgramInfoLog( program ).trim();\n\t\tconst vertexLog = gl.getShaderInfoLog( glVertexShader ).trim();\n\t\tconst fragmentLog = gl.getShaderInfoLog( glFragmentShader ).trim();\n\n\t\tlet runnable = true;\n\t\tlet haveDiagnostics = true;\n\n\t\tif ( gl.getProgramParameter( program, 35714 ) === false ) {\n\n\t\t\trunnable = false;\n\n\t\t\tconst vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );\n\t\t\tconst fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );\n\n\t\t\tconsole.error(\n\t\t\t\t'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +\n\t\t\t\t'VALIDATE_STATUS ' + gl.getProgramParameter( program, 35715 ) + '\\n\\n' +\n\t\t\t\t'Program Info Log: ' + programLog + '\\n' +\n\t\t\t\tvertexErrors + '\\n' +\n\t\t\t\tfragmentErrors\n\t\t\t);\n\n\t\t} else if ( programLog !== '' ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLProgram: Program Info Log:', programLog );\n\n\t\t} else if ( vertexLog === '' || fragmentLog === '' ) {\n\n\t\t\thaveDiagnostics = false;\n\n\t\t}\n\n\t\tif ( haveDiagnostics ) {\n\n\t\t\tthis.diagnostics = {\n\n\t\t\t\trunnable: runnable,\n\n\t\t\t\tprogramLog: programLog,\n\n\t\t\t\tvertexShader: {\n\n\t\t\t\t\tlog: vertexLog,\n\t\t\t\t\tprefix: prefixVertex\n\n\t\t\t\t},\n\n\t\t\t\tfragmentShader: {\n\n\t\t\t\t\tlog: fragmentLog,\n\t\t\t\t\tprefix: prefixFragment\n\n\t\t\t\t}\n\n\t\t\t};\n\n\t\t}\n\n\t}\n\n\t// Clean up\n\n\t// Crashes in iOS9 and iOS10. #18402\n\t// gl.detachShader( program, glVertexShader );\n\t// gl.detachShader( program, glFragmentShader );\n\n\tgl.deleteShader( glVertexShader );\n\tgl.deleteShader( glFragmentShader );\n\n\t// set up caching for uniform locations\n\n\tlet cachedUniforms;\n\n\tthis.getUniforms = function () {\n\n\t\tif ( cachedUniforms === undefined ) {\n\n\t\t\tcachedUniforms = new WebGLUniforms( gl, program );\n\n\t\t}\n\n\t\treturn cachedUniforms;\n\n\t};\n\n\t// set up caching for attribute locations\n\n\tlet cachedAttributes;\n\n\tthis.getAttributes = function () {\n\n\t\tif ( cachedAttributes === undefined ) {\n\n\t\t\tcachedAttributes = fetchAttributeLocations( gl, program );\n\n\t\t}\n\n\t\treturn cachedAttributes;\n\n\t};\n\n\t// free resource\n\n\tthis.destroy = function () {\n\n\t\tbindingStates.releaseStatesOfProgram( this );\n\n\t\tgl.deleteProgram( program );\n\t\tthis.program = undefined;\n\n\t};\n\n\t//\n\n\tthis.name = parameters.shaderName;\n\tthis.id = programIdCount ++;\n\tthis.cacheKey = cacheKey;\n\tthis.usedTimes = 1;\n\tthis.program = program;\n\tthis.vertexShader = glVertexShader;\n\tthis.fragmentShader = glFragmentShader;\n\n\treturn this;\n\n}\n\nfunction WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping ) {\n\n\tconst programs = [];\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\tconst logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;\n\tconst floatVertexTextures = capabilities.floatVertexTextures;\n\tconst maxVertexUniforms = capabilities.maxVertexUniforms;\n\tconst vertexTextures = capabilities.vertexTextures;\n\n\tlet precision = capabilities.precision;\n\n\tconst shaderIDs = {\n\t\tMeshDepthMaterial: 'depth',\n\t\tMeshDistanceMaterial: 'distanceRGBA',\n\t\tMeshNormalMaterial: 'normal',\n\t\tMeshBasicMaterial: 'basic',\n\t\tMeshLambertMaterial: 'lambert',\n\t\tMeshPhongMaterial: 'phong',\n\t\tMeshToonMaterial: 'toon',\n\t\tMeshStandardMaterial: 'physical',\n\t\tMeshPhysicalMaterial: 'physical',\n\t\tMeshMatcapMaterial: 'matcap',\n\t\tLineBasicMaterial: 'basic',\n\t\tLineDashedMaterial: 'dashed',\n\t\tPointsMaterial: 'points',\n\t\tShadowMaterial: 'shadow',\n\t\tSpriteMaterial: 'sprite'\n\t};\n\n\tconst parameterNames = [\n\t\t'precision', 'isWebGL2', 'supportsVertexTextures', 'outputEncoding', 'instancing', 'instancingColor',\n\t\t'map', 'mapEncoding', 'matcap', 'matcapEncoding', 'envMap', 'envMapMode', 'envMapEncoding', 'envMapCubeUV',\n\t\t'lightMap', 'lightMapEncoding', 'aoMap', 'emissiveMap', 'emissiveMapEncoding', 'bumpMap', 'normalMap',\n\t\t'objectSpaceNormalMap', 'tangentSpaceNormalMap',\n\t\t'clearcoat', 'clearcoatMap', 'clearcoatRoughnessMap', 'clearcoatNormalMap',\n\t\t'displacementMap', 'specularMap', , 'roughnessMap', 'metalnessMap', 'gradientMap',\n\t\t'alphaMap', 'alphaTest', 'combine', 'vertexColors', 'vertexAlphas', 'vertexTangents', 'vertexUvs', 'uvsVertexOnly', 'fog', 'useFog', 'fogExp2',\n\t\t'flatShading', 'sizeAttenuation', 'logarithmicDepthBuffer', 'skinning',\n\t\t'maxBones', 'useVertexTexture', 'morphTargets', 'morphNormals', 'morphTargetsCount', 'premultipliedAlpha',\n\t\t'numDirLights', 'numPointLights', 'numSpotLights', 'numHemiLights', 'numRectAreaLights',\n\t\t'numDirLightShadows', 'numPointLightShadows', 'numSpotLightShadows',\n\t\t'shadowMapEnabled', 'shadowMapType', 'toneMapping', 'physicallyCorrectLights',\n\t\t'doubleSided', 'flipSided', 'numClippingPlanes', 'numClipIntersection', 'depthPacking', 'dithering', 'format',\n\t\t'specularIntensityMap', 'specularColorMap', 'specularColorMapEncoding',\n\t\t'transmission', 'transmissionMap', 'thicknessMap',\n\t\t'sheen', 'sheenColorMap', 'sheenColorMapEncoding', 'sheenRoughnessMap'\n\t];\n\n\tfunction getMaxBones( object ) {\n\n\t\tconst skeleton = object.skeleton;\n\t\tconst bones = skeleton.bones;\n\n\t\tif ( floatVertexTextures ) {\n\n\t\t\treturn 1024;\n\n\t\t} else {\n\n\t\t\t// default for when object is not specified\n\t\t\t// ( for example when prebuilding shader to be used with multiple objects )\n\t\t\t//\n\t\t\t// - leave some extra space for other uniforms\n\t\t\t// - limit here is ANGLE's 254 max uniform vectors\n\t\t\t// (up to 54 should be safe)\n\n\t\t\tconst nVertexUniforms = maxVertexUniforms;\n\t\t\tconst nVertexMatrices = Math.floor( ( nVertexUniforms - 20 ) / 4 );\n\n\t\t\tconst maxBones = Math.min( nVertexMatrices, bones.length );\n\n\t\t\tif ( maxBones < bones.length ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Skeleton has ' + bones.length + ' bones. This GPU supports ' + maxBones + '.' );\n\t\t\t\treturn 0;\n\n\t\t\t}\n\n\t\t\treturn maxBones;\n\n\t\t}\n\n\t}\n\n\tfunction getTextureEncodingFromMap( map ) {\n\n\t\tlet encoding;\n\n\t\tif ( map && map.isTexture ) {\n\n\t\t\tencoding = map.encoding;\n\n\t\t} else if ( map && map.isWebGLRenderTarget ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLPrograms.getTextureEncodingFromMap: don\\'t use render targets as textures. Use their .texture property instead.' );\n\t\t\tencoding = map.texture.encoding;\n\n\t\t} else {\n\n\t\t\tencoding = LinearEncoding;\n\n\t\t}\n\n\t\tif ( isWebGL2 && map && map.isTexture && map.format === RGBAFormat && map.type === UnsignedByteType && map.encoding === sRGBEncoding ) {\n\n\t\t\tencoding = LinearEncoding; // disable inline decode for sRGB textures in WebGL 2\n\n\t\t}\n\n\t\treturn encoding;\n\n\t}\n\n\tfunction getParameters( material, lights, shadows, scene, object ) {\n\n\t\tconst fog = scene.fog;\n\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\n\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\n\t\t// heuristics to create shader parameters according to lights in the scene\n\t\t// (not to blow over maxLights budget)\n\n\t\tconst maxBones = object.isSkinnedMesh ? getMaxBones( object ) : 0;\n\n\t\tif ( material.precision !== null ) {\n\n\t\t\tprecision = capabilities.getMaxPrecision( material.precision );\n\n\t\t\tif ( precision !== material.precision ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet vertexShader, fragmentShader;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\n\t\t\tvertexShader = shader.vertexShader;\n\t\t\tfragmentShader = shader.fragmentShader;\n\n\t\t} else {\n\n\t\t\tvertexShader = material.vertexShader;\n\t\t\tfragmentShader = material.fragmentShader;\n\n\t\t}\n\n\t\tconst currentRenderTarget = renderer.getRenderTarget();\n\n\t\tconst useAlphaTest = material.alphaTest > 0;\n\t\tconst useClearcoat = material.clearcoat > 0;\n\n\t\tconst parameters = {\n\n\t\t\tisWebGL2: isWebGL2,\n\n\t\t\tshaderID: shaderID,\n\t\t\tshaderName: material.type,\n\n\t\t\tvertexShader: vertexShader,\n\t\t\tfragmentShader: fragmentShader,\n\t\t\tdefines: material.defines,\n\n\t\t\tisRawShaderMaterial: material.isRawShaderMaterial === true,\n\t\t\tglslVersion: material.glslVersion,\n\n\t\t\tprecision: precision,\n\n\t\t\tinstancing: object.isInstancedMesh === true,\n\t\t\tinstancingColor: object.isInstancedMesh === true && object.instanceColor !== null,\n\n\t\t\tsupportsVertexTextures: vertexTextures,\n\t\t\toutputEncoding: ( currentRenderTarget !== null ) ? getTextureEncodingFromMap( currentRenderTarget.texture ) : renderer.outputEncoding,\n\t\t\tmap: !! material.map,\n\t\t\tmapEncoding: getTextureEncodingFromMap( material.map ),\n\t\t\tmatcap: !! material.matcap,\n\t\t\tmatcapEncoding: getTextureEncodingFromMap( material.matcap ),\n\t\t\tenvMap: !! envMap,\n\t\t\tenvMapMode: envMap && envMap.mapping,\n\t\t\tenvMapEncoding: getTextureEncodingFromMap( envMap ),\n\t\t\tenvMapCubeUV: ( !! envMap ) && ( ( envMap.mapping === CubeUVReflectionMapping ) || ( envMap.mapping === CubeUVRefractionMapping ) ),\n\t\t\tlightMap: !! material.lightMap,\n\t\t\tlightMapEncoding: getTextureEncodingFromMap( material.lightMap ),\n\t\t\taoMap: !! material.aoMap,\n\t\t\temissiveMap: !! material.emissiveMap,\n\t\t\temissiveMapEncoding: getTextureEncodingFromMap( material.emissiveMap ),\n\t\t\tbumpMap: !! material.bumpMap,\n\t\t\tnormalMap: !! material.normalMap,\n\t\t\tobjectSpaceNormalMap: material.normalMapType === ObjectSpaceNormalMap,\n\t\t\ttangentSpaceNormalMap: material.normalMapType === TangentSpaceNormalMap,\n\n\t\t\tclearcoat: useClearcoat,\n\t\t\tclearcoatMap: useClearcoat && !! material.clearcoatMap,\n\t\t\tclearcoatRoughnessMap: useClearcoat && !! material.clearcoatRoughnessMap,\n\t\t\tclearcoatNormalMap: useClearcoat && !! material.clearcoatNormalMap,\n\n\t\t\tdisplacementMap: !! material.displacementMap,\n\t\t\troughnessMap: !! material.roughnessMap,\n\t\t\tmetalnessMap: !! material.metalnessMap,\n\t\t\tspecularMap: !! material.specularMap,\n\t\t\tspecularIntensityMap: !! material.specularIntensityMap,\n\t\t\tspecularColorMap: !! material.specularColorMap,\n\t\t\tspecularColorMapEncoding: getTextureEncodingFromMap( material.specularColorMap ),\n\n\t\t\talphaMap: !! material.alphaMap,\n\t\t\talphaTest: useAlphaTest,\n\n\t\t\tgradientMap: !! material.gradientMap,\n\n\t\t\tsheen: material.sheen > 0,\n\t\t\tsheenColorMap: !! material.sheenColorMap,\n\t\t\tsheenColorMapEncoding: getTextureEncodingFromMap( material.sheenColorMap ),\n\t\t\tsheenRoughnessMap: !! material.sheenRoughnessMap,\n\n\t\t\ttransmission: material.transmission > 0,\n\t\t\ttransmissionMap: !! material.transmissionMap,\n\t\t\tthicknessMap: !! material.thicknessMap,\n\n\t\t\tcombine: material.combine,\n\n\t\t\tvertexTangents: ( !! material.normalMap && !! object.geometry && !! object.geometry.attributes.tangent ),\n\t\t\tvertexColors: material.vertexColors,\n\t\t\tvertexAlphas: material.vertexColors === true && !! object.geometry && !! object.geometry.attributes.color && object.geometry.attributes.color.itemSize === 4,\n\t\t\tvertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatMap || !! material.clearcoatRoughnessMap || !! material.clearcoatNormalMap || !! material.displacementMap || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || !! material.sheenColorMap || material.sheenRoughnessMap,\n\t\t\tuvsVertexOnly: ! ( !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap || material.transmission > 0 || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || !! material.sheen > 0 || !! material.sheenColorMap || !! material.sheenRoughnessMap ) && !! material.displacementMap,\n\n\t\t\tfog: !! fog,\n\t\t\tuseFog: material.fog,\n\t\t\tfogExp2: ( fog && fog.isFogExp2 ),\n\n\t\t\tflatShading: !! material.flatShading,\n\n\t\t\tsizeAttenuation: material.sizeAttenuation,\n\t\t\tlogarithmicDepthBuffer: logarithmicDepthBuffer,\n\n\t\t\tskinning: object.isSkinnedMesh === true && maxBones > 0,\n\t\t\tmaxBones: maxBones,\n\t\t\tuseVertexTexture: floatVertexTextures,\n\n\t\t\tmorphTargets: !! object.geometry && !! object.geometry.morphAttributes.position,\n\t\t\tmorphNormals: !! object.geometry && !! object.geometry.morphAttributes.normal,\n\t\t\tmorphTargetsCount: ( !! object.geometry && !! object.geometry.morphAttributes.position ) ? object.geometry.morphAttributes.position.length : 0,\n\n\t\t\tnumDirLights: lights.directional.length,\n\t\t\tnumPointLights: lights.point.length,\n\t\t\tnumSpotLights: lights.spot.length,\n\t\t\tnumRectAreaLights: lights.rectArea.length,\n\t\t\tnumHemiLights: lights.hemi.length,\n\n\t\t\tnumDirLightShadows: lights.directionalShadowMap.length,\n\t\t\tnumPointLightShadows: lights.pointShadowMap.length,\n\t\t\tnumSpotLightShadows: lights.spotShadowMap.length,\n\n\t\t\tnumClippingPlanes: clipping.numPlanes,\n\t\t\tnumClipIntersection: clipping.numIntersection,\n\n\t\t\tformat: material.format,\n\t\t\tdithering: material.dithering,\n\n\t\t\tshadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,\n\t\t\tshadowMapType: renderer.shadowMap.type,\n\n\t\t\ttoneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping,\n\t\t\tphysicallyCorrectLights: renderer.physicallyCorrectLights,\n\n\t\t\tpremultipliedAlpha: material.premultipliedAlpha,\n\n\t\t\tdoubleSided: material.side === DoubleSide,\n\t\t\tflipSided: material.side === BackSide,\n\n\t\t\tdepthPacking: ( material.depthPacking !== undefined ) ? material.depthPacking : false,\n\n\t\t\tindex0AttributeName: material.index0AttributeName,\n\n\t\t\textensionDerivatives: material.extensions && material.extensions.derivatives,\n\t\t\textensionFragDepth: material.extensions && material.extensions.fragDepth,\n\t\t\textensionDrawBuffers: material.extensions && material.extensions.drawBuffers,\n\t\t\textensionShaderTextureLOD: material.extensions && material.extensions.shaderTextureLOD,\n\n\t\t\trendererExtensionFragDepth: isWebGL2 || extensions.has( 'EXT_frag_depth' ),\n\t\t\trendererExtensionDrawBuffers: isWebGL2 || extensions.has( 'WEBGL_draw_buffers' ),\n\t\t\trendererExtensionShaderTextureLod: isWebGL2 || extensions.has( 'EXT_shader_texture_lod' ),\n\n\t\t\tcustomProgramCacheKey: material.customProgramCacheKey()\n\n\t\t};\n\n\t\treturn parameters;\n\n\t}\n\n\tfunction getProgramCacheKey( parameters ) {\n\n\t\tconst array = [];\n\n\t\tif ( parameters.shaderID ) {\n\n\t\t\tarray.push( parameters.shaderID );\n\n\t\t} else {\n\n\t\t\tarray.push( hashString( parameters.fragmentShader ) );\n\t\t\tarray.push( hashString( parameters.vertexShader ) );\n\n\t\t}\n\n\t\tif ( parameters.defines !== undefined ) {\n\n\t\t\tfor ( const name in parameters.defines ) {\n\n\t\t\t\tarray.push( name );\n\t\t\t\tarray.push( parameters.defines[ name ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( parameters.isRawShaderMaterial === false ) {\n\n\t\t\tfor ( let i = 0; i < parameterNames.length; i ++ ) {\n\n\t\t\t\tarray.push( parameters[ parameterNames[ i ] ] );\n\n\t\t\t}\n\n\t\t\tarray.push( renderer.outputEncoding );\n\t\t\tarray.push( renderer.gammaFactor );\n\n\t\t}\n\n\t\tarray.push( parameters.customProgramCacheKey );\n\n\t\treturn array.join();\n\n\t}\n\n\tfunction getUniforms( material ) {\n\n\t\tconst shaderID = shaderIDs[ material.type ];\n\t\tlet uniforms;\n\n\t\tif ( shaderID ) {\n\n\t\t\tconst shader = ShaderLib[ shaderID ];\n\t\t\tuniforms = UniformsUtils.clone( shader.uniforms );\n\n\t\t} else {\n\n\t\t\tuniforms = material.uniforms;\n\n\t\t}\n\n\t\treturn uniforms;\n\n\t}\n\n\tfunction acquireProgram( parameters, cacheKey ) {\n\n\t\tlet program;\n\n\t\t// Check if code has been already compiled\n\t\tfor ( let p = 0, pl = programs.length; p < pl; p ++ ) {\n\n\t\t\tconst preexistingProgram = programs[ p ];\n\n\t\t\tif ( preexistingProgram.cacheKey === cacheKey ) {\n\n\t\t\t\tprogram = preexistingProgram;\n\t\t\t\t++ program.usedTimes;\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( program === undefined ) {\n\n\t\t\tprogram = new WebGLProgram( renderer, cacheKey, parameters, bindingStates );\n\t\t\tprograms.push( program );\n\n\t\t}\n\n\t\treturn program;\n\n\t}\n\n\tfunction releaseProgram( program ) {\n\n\t\tif ( -- program.usedTimes === 0 ) {\n\n\t\t\t// Remove from unordered set\n\t\t\tconst i = programs.indexOf( program );\n\t\t\tprograms[ i ] = programs[ programs.length - 1 ];\n\t\t\tprograms.pop();\n\n\t\t\t// Free WebGL resources\n\t\t\tprogram.destroy();\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tgetParameters: getParameters,\n\t\tgetProgramCacheKey: getProgramCacheKey,\n\t\tgetUniforms: getUniforms,\n\t\tacquireProgram: acquireProgram,\n\t\treleaseProgram: releaseProgram,\n\t\t// Exposed for resource monitoring & error feedback via renderer.info:\n\t\tprograms: programs\n\t};\n\n}\n\nfunction WebGLProperties() {\n\n\tlet properties = new WeakMap();\n\n\tfunction get( object ) {\n\n\t\tlet map = properties.get( object );\n\n\t\tif ( map === undefined ) {\n\n\t\t\tmap = {};\n\t\t\tproperties.set( object, map );\n\n\t\t}\n\n\t\treturn map;\n\n\t}\n\n\tfunction remove( object ) {\n\n\t\tproperties.delete( object );\n\n\t}\n\n\tfunction update( object, key, value ) {\n\n\t\tproperties.get( object )[ key ] = value;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tproperties = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tremove: remove,\n\t\tupdate: update,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction painterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.program !== b.program ) {\n\n\t\treturn a.program.id - b.program.id;\n\n\t} else if ( a.material.id !== b.material.id ) {\n\n\t\treturn a.material.id - b.material.id;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn a.z - b.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\nfunction reversePainterSortStable( a, b ) {\n\n\tif ( a.groupOrder !== b.groupOrder ) {\n\n\t\treturn a.groupOrder - b.groupOrder;\n\n\t} else if ( a.renderOrder !== b.renderOrder ) {\n\n\t\treturn a.renderOrder - b.renderOrder;\n\n\t} else if ( a.z !== b.z ) {\n\n\t\treturn b.z - a.z;\n\n\t} else {\n\n\t\treturn a.id - b.id;\n\n\t}\n\n}\n\n\nfunction WebGLRenderList( properties ) {\n\n\tconst renderItems = [];\n\tlet renderItemsIndex = 0;\n\n\tconst opaque = [];\n\tconst transmissive = [];\n\tconst transparent = [];\n\n\tconst defaultProgram = { id: - 1 };\n\n\tfunction init() {\n\n\t\trenderItemsIndex = 0;\n\n\t\topaque.length = 0;\n\t\ttransmissive.length = 0;\n\t\ttransparent.length = 0;\n\n\t}\n\n\tfunction getNextRenderItem( object, geometry, material, groupOrder, z, group ) {\n\n\t\tlet renderItem = renderItems[ renderItemsIndex ];\n\t\tconst materialProperties = properties.get( material );\n\n\t\tif ( renderItem === undefined ) {\n\n\t\t\trenderItem = {\n\t\t\t\tid: object.id,\n\t\t\t\tobject: object,\n\t\t\t\tgeometry: geometry,\n\t\t\t\tmaterial: material,\n\t\t\t\tprogram: materialProperties.program || defaultProgram,\n\t\t\t\tgroupOrder: groupOrder,\n\t\t\t\trenderOrder: object.renderOrder,\n\t\t\t\tz: z,\n\t\t\t\tgroup: group\n\t\t\t};\n\n\t\t\trenderItems[ renderItemsIndex ] = renderItem;\n\n\t\t} else {\n\n\t\t\trenderItem.id = object.id;\n\t\t\trenderItem.object = object;\n\t\t\trenderItem.geometry = geometry;\n\t\t\trenderItem.material = material;\n\t\t\trenderItem.program = materialProperties.program || defaultProgram;\n\t\t\trenderItem.groupOrder = groupOrder;\n\t\t\trenderItem.renderOrder = object.renderOrder;\n\t\t\trenderItem.z = z;\n\t\t\trenderItem.group = group;\n\n\t\t}\n\n\t\trenderItemsIndex ++;\n\n\t\treturn renderItem;\n\n\t}\n\n\tfunction push( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.push( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.push( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.push( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction unshift( object, geometry, material, groupOrder, z, group ) {\n\n\t\tconst renderItem = getNextRenderItem( object, geometry, material, groupOrder, z, group );\n\n\t\tif ( material.transmission > 0.0 ) {\n\n\t\t\ttransmissive.unshift( renderItem );\n\n\t\t} else if ( material.transparent === true ) {\n\n\t\t\ttransparent.unshift( renderItem );\n\n\t\t} else {\n\n\t\t\topaque.unshift( renderItem );\n\n\t\t}\n\n\t}\n\n\tfunction sort( customOpaqueSort, customTransparentSort ) {\n\n\t\tif ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );\n\t\tif ( transmissive.length > 1 ) transmissive.sort( customTransparentSort || reversePainterSortStable );\n\t\tif ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );\n\n\t}\n\n\tfunction finish() {\n\n\t\t// Clear references from inactive renderItems in the list\n\n\t\tfor ( let i = renderItemsIndex, il = renderItems.length; i < il; i ++ ) {\n\n\t\t\tconst renderItem = renderItems[ i ];\n\n\t\t\tif ( renderItem.id === null ) break;\n\n\t\t\trenderItem.id = null;\n\t\t\trenderItem.object = null;\n\t\t\trenderItem.geometry = null;\n\t\t\trenderItem.material = null;\n\t\t\trenderItem.program = null;\n\t\t\trenderItem.group = null;\n\n\t\t}\n\n\t}\n\n\treturn {\n\n\t\topaque: opaque,\n\t\ttransmissive: transmissive,\n\t\ttransparent: transparent,\n\n\t\tinit: init,\n\t\tpush: push,\n\t\tunshift: unshift,\n\t\tfinish: finish,\n\n\t\tsort: sort\n\t};\n\n}\n\nfunction WebGLRenderLists( properties ) {\n\n\tlet lists = new WeakMap();\n\n\tfunction get( scene, renderCallDepth ) {\n\n\t\tlet list;\n\n\t\tif ( lists.has( scene ) === false ) {\n\n\t\t\tlist = new WebGLRenderList( properties );\n\t\t\tlists.set( scene, [ list ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= lists.get( scene ).length ) {\n\n\t\t\t\tlist = new WebGLRenderList( properties );\n\t\t\t\tlists.get( scene ).push( list );\n\n\t\t\t} else {\n\n\t\t\t\tlist = lists.get( scene )[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn list;\n\n\t}\n\n\tfunction dispose() {\n\n\t\tlists = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\nfunction UniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tconeCos: 0,\n\t\t\t\t\t\tpenumbraCos: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tdistance: 0,\n\t\t\t\t\t\tdecay: 0\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'HemisphereLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tdirection: new Vector3(),\n\t\t\t\t\t\tskyColor: new Color(),\n\t\t\t\t\t\tgroundColor: new Color()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'RectAreaLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tcolor: new Color(),\n\t\t\t\t\t\tposition: new Vector3(),\n\t\t\t\t\t\thalfWidth: new Vector3(),\n\t\t\t\t\t\thalfHeight: new Vector3()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\nfunction ShadowUniformsCache() {\n\n\tconst lights = {};\n\n\treturn {\n\n\t\tget: function ( light ) {\n\n\t\t\tif ( lights[ light.id ] !== undefined ) {\n\n\t\t\t\treturn lights[ light.id ];\n\n\t\t\t}\n\n\t\t\tlet uniforms;\n\n\t\t\tswitch ( light.type ) {\n\n\t\t\t\tcase 'DirectionalLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'SpotLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2()\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'PointLight':\n\t\t\t\t\tuniforms = {\n\t\t\t\t\t\tshadowBias: 0,\n\t\t\t\t\t\tshadowNormalBias: 0,\n\t\t\t\t\t\tshadowRadius: 1,\n\t\t\t\t\t\tshadowMapSize: new Vector2(),\n\t\t\t\t\t\tshadowCameraNear: 1,\n\t\t\t\t\t\tshadowCameraFar: 1000\n\t\t\t\t\t};\n\t\t\t\t\tbreak;\n\n\t\t\t\t// TODO (abelnation): set RectAreaLight shadow uniforms\n\n\t\t\t}\n\n\t\t\tlights[ light.id ] = uniforms;\n\n\t\t\treturn uniforms;\n\n\t\t}\n\n\t};\n\n}\n\n\n\nlet nextVersion = 0;\n\nfunction shadowCastingLightsFirst( lightA, lightB ) {\n\n\treturn ( lightB.castShadow ? 1 : 0 ) - ( lightA.castShadow ? 1 : 0 );\n\n}\n\nfunction WebGLLights( extensions, capabilities ) {\n\n\tconst cache = new UniformsCache();\n\n\tconst shadowCache = ShadowUniformsCache();\n\n\tconst state = {\n\n\t\tversion: 0,\n\n\t\thash: {\n\t\t\tdirectionalLength: - 1,\n\t\t\tpointLength: - 1,\n\t\t\tspotLength: - 1,\n\t\t\trectAreaLength: - 1,\n\t\t\themiLength: - 1,\n\n\t\t\tnumDirectionalShadows: - 1,\n\t\t\tnumPointShadows: - 1,\n\t\t\tnumSpotShadows: - 1\n\t\t},\n\n\t\tambient: [ 0, 0, 0 ],\n\t\tprobe: [],\n\t\tdirectional: [],\n\t\tdirectionalShadow: [],\n\t\tdirectionalShadowMap: [],\n\t\tdirectionalShadowMatrix: [],\n\t\tspot: [],\n\t\tspotShadow: [],\n\t\tspotShadowMap: [],\n\t\tspotShadowMatrix: [],\n\t\trectArea: [],\n\t\trectAreaLTC1: null,\n\t\trectAreaLTC2: null,\n\t\tpoint: [],\n\t\tpointShadow: [],\n\t\tpointShadowMap: [],\n\t\tpointShadowMatrix: [],\n\t\themi: []\n\n\t};\n\n\tfor ( let i = 0; i < 9; i ++ ) state.probe.push( new Vector3() );\n\n\tconst vector3 = new Vector3();\n\tconst matrix4 = new Matrix4();\n\tconst matrix42 = new Matrix4();\n\n\tfunction setup( lights, physicallyCorrectLights ) {\n\n\t\tlet r = 0, g = 0, b = 0;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) state.probe[ i ].set( 0, 0, 0 );\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tlet numDirectionalShadows = 0;\n\t\tlet numPointShadows = 0;\n\t\tlet numSpotShadows = 0;\n\n\t\tlights.sort( shadowCastingLightsFirst );\n\n\t\t// artist-friendly light intensity scaling factor\n\t\tconst scaleFactor = ( physicallyCorrectLights !== true ) ? Math.PI : 1;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tconst color = light.color;\n\t\t\tconst intensity = light.intensity;\n\t\t\tconst distance = light.distance;\n\n\t\t\tconst shadowMap = ( light.shadow && light.shadow.map ) ? light.shadow.map.texture : null;\n\n\t\t\tif ( light.isAmbientLight ) {\n\n\t\t\t\tr += color.r * intensity * scaleFactor;\n\t\t\t\tg += color.g * intensity * scaleFactor;\n\t\t\t\tb += color.b * intensity * scaleFactor;\n\n\t\t\t} else if ( light.isLightProbe ) {\n\n\t\t\t\tfor ( let j = 0; j < 9; j ++ ) {\n\n\t\t\t\t\tstate.probe[ j ].addScaledVector( light.sh.coefficients[ j ], intensity );\n\n\t\t\t\t}\n\n\t\t\t} else if ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity * scaleFactor );\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.directionalShadow[ directionalLength ] = shadowUniforms;\n\t\t\t\t\tstate.directionalShadowMap[ directionalLength ] = shadowMap;\n\t\t\t\t\tstate.directionalShadowMatrix[ directionalLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumDirectionalShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.directional[ directionalLength ] = uniforms;\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity * scaleFactor );\n\t\t\t\tuniforms.distance = distance;\n\n\t\t\t\tuniforms.coneCos = Math.cos( light.angle );\n\t\t\t\tuniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) );\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\n\t\t\t\t\tstate.spotShadow[ spotLength ] = shadowUniforms;\n\t\t\t\t\tstate.spotShadowMap[ spotLength ] = shadowMap;\n\t\t\t\t\tstate.spotShadowMatrix[ spotLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumSpotShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.spot[ spotLength ] = uniforms;\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\t// (a) intensity is the total visible light emitted\n\t\t\t\t//uniforms.color.copy( color ).multiplyScalar( intensity / ( light.width * light.height * Math.PI ) );\n\n\t\t\t\t// (b) intensity is the brightness of the light\n\t\t\t\tuniforms.color.copy( color ).multiplyScalar( intensity );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tstate.rectArea[ rectAreaLength ] = uniforms;\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.color.copy( light.color ).multiplyScalar( light.intensity * scaleFactor );\n\t\t\t\tuniforms.distance = light.distance;\n\t\t\t\tuniforms.decay = light.decay;\n\n\t\t\t\tif ( light.castShadow ) {\n\n\t\t\t\t\tconst shadow = light.shadow;\n\n\t\t\t\t\tconst shadowUniforms = shadowCache.get( light );\n\n\t\t\t\t\tshadowUniforms.shadowBias = shadow.bias;\n\t\t\t\t\tshadowUniforms.shadowNormalBias = shadow.normalBias;\n\t\t\t\t\tshadowUniforms.shadowRadius = shadow.radius;\n\t\t\t\t\tshadowUniforms.shadowMapSize = shadow.mapSize;\n\t\t\t\t\tshadowUniforms.shadowCameraNear = shadow.camera.near;\n\t\t\t\t\tshadowUniforms.shadowCameraFar = shadow.camera.far;\n\n\t\t\t\t\tstate.pointShadow[ pointLength ] = shadowUniforms;\n\t\t\t\t\tstate.pointShadowMap[ pointLength ] = shadowMap;\n\t\t\t\t\tstate.pointShadowMatrix[ pointLength ] = light.shadow.matrix;\n\n\t\t\t\t\tnumPointShadows ++;\n\n\t\t\t\t}\n\n\t\t\t\tstate.point[ pointLength ] = uniforms;\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = cache.get( light );\n\n\t\t\t\tuniforms.skyColor.copy( light.color ).multiplyScalar( intensity * scaleFactor );\n\t\t\t\tuniforms.groundColor.copy( light.groundColor ).multiplyScalar( intensity * scaleFactor );\n\n\t\t\t\tstate.hemi[ hemiLength ] = uniforms;\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( rectAreaLength > 0 ) {\n\n\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\t// WebGL 2\n\n\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n\n\t\t\t} else {\n\n\t\t\t\t// WebGL 1\n\n\t\t\t\tif ( extensions.has( 'OES_texture_float_linear' ) === true ) {\n\n\t\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n\t\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n\n\t\t\t\t} else if ( extensions.has( 'OES_texture_half_float_linear' ) === true ) {\n\n\t\t\t\t\tstate.rectAreaLTC1 = UniformsLib.LTC_HALF_1;\n\t\t\t\t\tstate.rectAreaLTC2 = UniformsLib.LTC_HALF_2;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.ambient[ 0 ] = r;\n\t\tstate.ambient[ 1 ] = g;\n\t\tstate.ambient[ 2 ] = b;\n\n\t\tconst hash = state.hash;\n\n\t\tif ( hash.directionalLength !== directionalLength ||\n\t\t\thash.pointLength !== pointLength ||\n\t\t\thash.spotLength !== spotLength ||\n\t\t\thash.rectAreaLength !== rectAreaLength ||\n\t\t\thash.hemiLength !== hemiLength ||\n\t\t\thash.numDirectionalShadows !== numDirectionalShadows ||\n\t\t\thash.numPointShadows !== numPointShadows ||\n\t\t\thash.numSpotShadows !== numSpotShadows ) {\n\n\t\t\tstate.directional.length = directionalLength;\n\t\t\tstate.spot.length = spotLength;\n\t\t\tstate.rectArea.length = rectAreaLength;\n\t\t\tstate.point.length = pointLength;\n\t\t\tstate.hemi.length = hemiLength;\n\n\t\t\tstate.directionalShadow.length = numDirectionalShadows;\n\t\t\tstate.directionalShadowMap.length = numDirectionalShadows;\n\t\t\tstate.pointShadow.length = numPointShadows;\n\t\t\tstate.pointShadowMap.length = numPointShadows;\n\t\t\tstate.spotShadow.length = numSpotShadows;\n\t\t\tstate.spotShadowMap.length = numSpotShadows;\n\t\t\tstate.directionalShadowMatrix.length = numDirectionalShadows;\n\t\t\tstate.pointShadowMatrix.length = numPointShadows;\n\t\t\tstate.spotShadowMatrix.length = numSpotShadows;\n\n\t\t\thash.directionalLength = directionalLength;\n\t\t\thash.pointLength = pointLength;\n\t\t\thash.spotLength = spotLength;\n\t\t\thash.rectAreaLength = rectAreaLength;\n\t\t\thash.hemiLength = hemiLength;\n\n\t\t\thash.numDirectionalShadows = numDirectionalShadows;\n\t\t\thash.numPointShadows = numPointShadows;\n\t\t\thash.numSpotShadows = numSpotShadows;\n\n\t\t\tstate.version = nextVersion ++;\n\n\t\t}\n\n\t}\n\n\tfunction setupView( lights, camera ) {\n\n\t\tlet directionalLength = 0;\n\t\tlet pointLength = 0;\n\t\tlet spotLength = 0;\n\t\tlet rectAreaLength = 0;\n\t\tlet hemiLength = 0;\n\n\t\tconst viewMatrix = camera.matrixWorldInverse;\n\n\t\tfor ( let i = 0, l = lights.length; i < l; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\n\t\t\tif ( light.isDirectionalLight ) {\n\n\t\t\t\tconst uniforms = state.directional[ directionalLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tdirectionalLength ++;\n\n\t\t\t} else if ( light.isSpotLight ) {\n\n\t\t\t\tconst uniforms = state.spot[ spotLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tvector3.setFromMatrixPosition( light.target.matrixWorld );\n\t\t\t\tuniforms.direction.sub( vector3 );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\n\t\t\t\tspotLength ++;\n\n\t\t\t} else if ( light.isRectAreaLight ) {\n\n\t\t\t\tconst uniforms = state.rectArea[ rectAreaLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\t// extract local rotation of light to derive width/height half vectors\n\t\t\t\tmatrix42.identity();\n\t\t\t\tmatrix4.copy( light.matrixWorld );\n\t\t\t\tmatrix4.premultiply( viewMatrix );\n\t\t\t\tmatrix42.extractRotation( matrix4 );\n\n\t\t\t\tuniforms.halfWidth.set( light.width * 0.5, 0.0, 0.0 );\n\t\t\t\tuniforms.halfHeight.set( 0.0, light.height * 0.5, 0.0 );\n\n\t\t\t\tuniforms.halfWidth.applyMatrix4( matrix42 );\n\t\t\t\tuniforms.halfHeight.applyMatrix4( matrix42 );\n\n\t\t\t\trectAreaLength ++;\n\n\t\t\t} else if ( light.isPointLight ) {\n\n\t\t\t\tconst uniforms = state.point[ pointLength ];\n\n\t\t\t\tuniforms.position.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.position.applyMatrix4( viewMatrix );\n\n\t\t\t\tpointLength ++;\n\n\t\t\t} else if ( light.isHemisphereLight ) {\n\n\t\t\t\tconst uniforms = state.hemi[ hemiLength ];\n\n\t\t\t\tuniforms.direction.setFromMatrixPosition( light.matrixWorld );\n\t\t\t\tuniforms.direction.transformDirection( viewMatrix );\n\t\t\t\tuniforms.direction.normalize();\n\n\t\t\t\themiLength ++;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\tsetup: setup,\n\t\tsetupView: setupView,\n\t\tstate: state\n\t};\n\n}\n\nfunction WebGLRenderState( extensions, capabilities ) {\n\n\tconst lights = new WebGLLights( extensions, capabilities );\n\n\tconst lightsArray = [];\n\tconst shadowsArray = [];\n\n\tfunction init() {\n\n\t\tlightsArray.length = 0;\n\t\tshadowsArray.length = 0;\n\n\t}\n\n\tfunction pushLight( light ) {\n\n\t\tlightsArray.push( light );\n\n\t}\n\n\tfunction pushShadow( shadowLight ) {\n\n\t\tshadowsArray.push( shadowLight );\n\n\t}\n\n\tfunction setupLights( physicallyCorrectLights ) {\n\n\t\tlights.setup( lightsArray, physicallyCorrectLights );\n\n\t}\n\n\tfunction setupLightsView( camera ) {\n\n\t\tlights.setupView( lightsArray, camera );\n\n\t}\n\n\tconst state = {\n\t\tlightsArray: lightsArray,\n\t\tshadowsArray: shadowsArray,\n\n\t\tlights: lights\n\t};\n\n\treturn {\n\t\tinit: init,\n\t\tstate: state,\n\t\tsetupLights: setupLights,\n\t\tsetupLightsView: setupLightsView,\n\n\t\tpushLight: pushLight,\n\t\tpushShadow: pushShadow\n\t};\n\n}\n\nfunction WebGLRenderStates( extensions, capabilities ) {\n\n\tlet renderStates = new WeakMap();\n\n\tfunction get( scene, renderCallDepth = 0 ) {\n\n\t\tlet renderState;\n\n\t\tif ( renderStates.has( scene ) === false ) {\n\n\t\t\trenderState = new WebGLRenderState( extensions, capabilities );\n\t\t\trenderStates.set( scene, [ renderState ] );\n\n\t\t} else {\n\n\t\t\tif ( renderCallDepth >= renderStates.get( scene ).length ) {\n\n\t\t\t\trenderState = new WebGLRenderState( extensions, capabilities );\n\t\t\t\trenderStates.get( scene ).push( renderState );\n\n\t\t\t} else {\n\n\t\t\t\trenderState = renderStates.get( scene )[ renderCallDepth ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn renderState;\n\n\t}\n\n\tfunction dispose() {\n\n\t\trenderStates = new WeakMap();\n\n\t}\n\n\treturn {\n\t\tget: get,\n\t\tdispose: dispose\n\t};\n\n}\n\n/**\n * parameters = {\n *\n * opacity: <float>,\n *\n * map: new THREE.Texture( <Image> ),\n *\n * alphaMap: new THREE.Texture( <Image> ),\n *\n * displacementMap: new THREE.Texture( <Image> ),\n * displacementScale: <float>,\n * displacementBias: <float>,\n *\n * wireframe: <boolean>,\n * wireframeLinewidth: <float>\n * }\n */\n\nclass MeshDepthMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'MeshDepthMaterial';\n\n\t\tthis.depthPacking = BasicDepthPacking;\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.fog = false;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.depthPacking = source.depthPacking;\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\treturn this;\n\n\t}\n\n}\n\nMeshDepthMaterial.prototype.isMeshDepthMaterial = true;\n\n/**\n * parameters = {\n *\n * referencePosition: <float>,\n * nearDistance: <float>,\n * farDistance: <float>,\n *\n * map: new THREE.Texture( <Image> ),\n *\n * alphaMap: new THREE.Texture( <Image> ),\n *\n * displacementMap: new THREE.Texture( <Image> ),\n * displacementScale: <float>,\n * displacementBias: <float>\n *\n * }\n */\n\nclass MeshDistanceMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'MeshDistanceMaterial';\n\n\t\tthis.referencePosition = new Vector3();\n\t\tthis.nearDistance = 1;\n\t\tthis.farDistance = 1000;\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.fog = false;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.referencePosition.copy( source.referencePosition );\n\t\tthis.nearDistance = source.nearDistance;\n\t\tthis.farDistance = source.farDistance;\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\treturn this;\n\n\t}\n\n}\n\nMeshDistanceMaterial.prototype.isMeshDistanceMaterial = true;\n\nconst vertex = \"void main() {\\n\\tgl_Position = vec4( position, 1.0 );\\n}\";\n\nconst fragment = \"uniform sampler2D shadow_pass;\\nuniform vec2 resolution;\\nuniform float radius;\\n#include <packing>\\nvoid main() {\\n\\tconst float samples = float( VSM_SAMPLES );\\n\\tfloat mean = 0.0;\\n\\tfloat squared_mean = 0.0;\\n\\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\\n\\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\\n\\tfor ( float i = 0.0; i < samples; i ++ ) {\\n\\t\\tfloat uvOffset = uvStart + i * uvStride;\\n\\t\\t#ifdef HORIZONTAL_PASS\\n\\t\\t\\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\\n\\t\\t\\tmean += distribution.x;\\n\\t\\t\\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\\n\\t\\t#else\\n\\t\\t\\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\\n\\t\\t\\tmean += depth;\\n\\t\\t\\tsquared_mean += depth * depth;\\n\\t\\t#endif\\n\\t}\\n\\tmean = mean / samples;\\n\\tsquared_mean = squared_mean / samples;\\n\\tfloat std_dev = sqrt( squared_mean - mean * mean );\\n\\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\\n}\";\n\nfunction WebGLShadowMap( _renderer, _objects, _capabilities ) {\n\n\tlet _frustum = new Frustum();\n\n\tconst _shadowMapSize = new Vector2(),\n\t\t_viewportSize = new Vector2(),\n\n\t\t_viewport = new Vector4(),\n\n\t\t_depthMaterial = new MeshDepthMaterial( { depthPacking: RGBADepthPacking } ),\n\t\t_distanceMaterial = new MeshDistanceMaterial(),\n\n\t\t_materialCache = {},\n\n\t\t_maxTextureSize = _capabilities.maxTextureSize;\n\n\tconst shadowSide = { 0: BackSide, 1: FrontSide, 2: DoubleSide };\n\n\tconst shadowMaterialVertical = new ShaderMaterial( {\n\t\tdefines: {\n\t\t\tVSM_SAMPLES: 8\n\t\t},\n\t\tuniforms: {\n\t\t\tshadow_pass: { value: null },\n\t\t\tresolution: { value: new Vector2() },\n\t\t\tradius: { value: 4.0 }\n\t\t},\n\n\t\tvertexShader: vertex,\n\t\tfragmentShader: fragment\n\n\t} );\n\n\tconst shadowMaterialHorizontal = shadowMaterialVertical.clone();\n\tshadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;\n\n\tconst fullScreenTri = new BufferGeometry();\n\tfullScreenTri.setAttribute(\n\t\t'position',\n\t\tnew BufferAttribute(\n\t\t\tnew Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),\n\t\t\t3\n\t\t)\n\t);\n\n\tconst fullScreenMesh = new Mesh( fullScreenTri, shadowMaterialVertical );\n\n\tconst scope = this;\n\n\tthis.enabled = false;\n\n\tthis.autoUpdate = true;\n\tthis.needsUpdate = false;\n\n\tthis.type = PCFShadowMap;\n\n\tthis.render = function ( lights, scene, camera ) {\n\n\t\tif ( scope.enabled === false ) return;\n\t\tif ( scope.autoUpdate === false && scope.needsUpdate === false ) return;\n\n\t\tif ( lights.length === 0 ) return;\n\n\t\tconst currentRenderTarget = _renderer.getRenderTarget();\n\t\tconst activeCubeFace = _renderer.getActiveCubeFace();\n\t\tconst activeMipmapLevel = _renderer.getActiveMipmapLevel();\n\n\t\tconst _state = _renderer.state;\n\n\t\t// Set GL state for depth map.\n\t\t_state.setBlending( NoBlending );\n\t\t_state.buffers.color.setClear( 1, 1, 1, 1 );\n\t\t_state.buffers.depth.setTest( true );\n\t\t_state.setScissorTest( false );\n\n\t\t// render depth map\n\n\t\tfor ( let i = 0, il = lights.length; i < il; i ++ ) {\n\n\t\t\tconst light = lights[ i ];\n\t\t\tconst shadow = light.shadow;\n\n\t\t\tif ( shadow === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLShadowMap:', light, 'has no shadow.' );\n\t\t\t\tcontinue;\n\n\t\t\t}\n\n\t\t\tif ( shadow.autoUpdate === false && shadow.needsUpdate === false ) continue;\n\n\t\t\t_shadowMapSize.copy( shadow.mapSize );\n\n\t\t\tconst shadowFrameExtents = shadow.getFrameExtents();\n\n\t\t\t_shadowMapSize.multiply( shadowFrameExtents );\n\n\t\t\t_viewportSize.copy( shadow.mapSize );\n\n\t\t\tif ( _shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\tif ( _shadowMapSize.x > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.x = Math.floor( _maxTextureSize / shadowFrameExtents.x );\n\t\t\t\t\t_shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;\n\t\t\t\t\tshadow.mapSize.x = _viewportSize.x;\n\n\t\t\t\t}\n\n\t\t\t\tif ( _shadowMapSize.y > _maxTextureSize ) {\n\n\t\t\t\t\t_viewportSize.y = Math.floor( _maxTextureSize / shadowFrameExtents.y );\n\t\t\t\t\t_shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;\n\t\t\t\t\tshadow.mapSize.y = _viewportSize.y;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( shadow.map === null && ! shadow.isPointLightShadow && this.type === VSMShadowMap ) {\n\n\t\t\t\tconst pars = { minFilter: LinearFilter, magFilter: LinearFilter, format: RGBAFormat };\n\n\t\t\t\tshadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );\n\t\t\t\tshadow.map.texture.name = light.name + '.shadowMap';\n\n\t\t\t\tshadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );\n\n\t\t\t\tshadow.camera.updateProjectionMatrix();\n\n\t\t\t}\n\n\t\t\tif ( shadow.map === null ) {\n\n\t\t\t\tconst pars = { minFilter: NearestFilter, magFilter: NearestFilter, format: RGBAFormat };\n\n\t\t\t\tshadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );\n\t\t\t\tshadow.map.texture.name = light.name + '.shadowMap';\n\n\t\t\t\tshadow.camera.updateProjectionMatrix();\n\n\t\t\t}\n\n\t\t\t_renderer.setRenderTarget( shadow.map );\n\t\t\t_renderer.clear();\n\n\t\t\tconst viewportCount = shadow.getViewportCount();\n\n\t\t\tfor ( let vp = 0; vp < viewportCount; vp ++ ) {\n\n\t\t\t\tconst viewport = shadow.getViewport( vp );\n\n\t\t\t\t_viewport.set(\n\t\t\t\t\t_viewportSize.x * viewport.x,\n\t\t\t\t\t_viewportSize.y * viewport.y,\n\t\t\t\t\t_viewportSize.x * viewport.z,\n\t\t\t\t\t_viewportSize.y * viewport.w\n\t\t\t\t);\n\n\t\t\t\t_state.viewport( _viewport );\n\n\t\t\t\tshadow.updateMatrices( light, vp );\n\n\t\t\t\t_frustum = shadow.getFrustum();\n\n\t\t\t\trenderObject( scene, camera, shadow.camera, light, this.type );\n\n\t\t\t}\n\n\t\t\t// do blur pass for VSM\n\n\t\t\tif ( ! shadow.isPointLightShadow && this.type === VSMShadowMap ) {\n\n\t\t\t\tVSMPass( shadow, camera );\n\n\t\t\t}\n\n\t\t\tshadow.needsUpdate = false;\n\n\t\t}\n\n\t\tscope.needsUpdate = false;\n\n\t\t_renderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );\n\n\t};\n\n\tfunction VSMPass( shadow, camera ) {\n\n\t\tconst geometry = _objects.update( fullScreenMesh );\n\n\t\tif ( shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples ) {\n\n\t\t\tshadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples;\n\t\t\tshadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;\n\n\t\t\tshadowMaterialVertical.needsUpdate = true;\n\t\t\tshadowMaterialHorizontal.needsUpdate = true;\n\n\t\t}\n\n\t\t// vertical pass\n\n\t\tshadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;\n\t\tshadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialVertical.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.mapPass );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );\n\n\t\t// horizontal pass\n\n\t\tshadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;\n\t\tshadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;\n\t\tshadowMaterialHorizontal.uniforms.radius.value = shadow.radius;\n\t\t_renderer.setRenderTarget( shadow.map );\n\t\t_renderer.clear();\n\t\t_renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );\n\n\t}\n\n\tfunction getDepthMaterial( object, geometry, material, light, shadowCameraNear, shadowCameraFar, type ) {\n\n\t\tlet result = null;\n\n\t\tconst customMaterial = ( light.isPointLight === true ) ? object.customDistanceMaterial : object.customDepthMaterial;\n\n\t\tif ( customMaterial !== undefined ) {\n\n\t\t\tresult = customMaterial;\n\n\t\t} else {\n\n\t\t\tresult = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial;\n\n\t\t}\n\n\t\tif ( ( _renderer.localClippingEnabled && material.clipShadows === true && material.clippingPlanes.length !== 0 ) ||\n\t\t\t( material.displacementMap && material.displacementScale !== 0 ) ||\n\t\t\t( material.alphaMap && material.alphaTest > 0 ) ) {\n\n\t\t\t// in this case we need a unique material instance reflecting the\n\t\t\t// appropriate state\n\n\t\t\tconst keyA = result.uuid, keyB = material.uuid;\n\n\t\t\tlet materialsForVariant = _materialCache[ keyA ];\n\n\t\t\tif ( materialsForVariant === undefined ) {\n\n\t\t\t\tmaterialsForVariant = {};\n\t\t\t\t_materialCache[ keyA ] = materialsForVariant;\n\n\t\t\t}\n\n\t\t\tlet cachedMaterial = materialsForVariant[ keyB ];\n\n\t\t\tif ( cachedMaterial === undefined ) {\n\n\t\t\t\tcachedMaterial = result.clone();\n\t\t\t\tmaterialsForVariant[ keyB ] = cachedMaterial;\n\n\t\t\t}\n\n\t\t\tresult = cachedMaterial;\n\n\t\t}\n\n\t\tresult.visible = material.visible;\n\t\tresult.wireframe = material.wireframe;\n\n\t\tif ( type === VSMShadowMap ) {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : material.side;\n\n\t\t} else {\n\n\t\t\tresult.side = ( material.shadowSide !== null ) ? material.shadowSide : shadowSide[ material.side ];\n\n\t\t}\n\n\t\tresult.alphaMap = material.alphaMap;\n\t\tresult.alphaTest = material.alphaTest;\n\n\t\tresult.clipShadows = material.clipShadows;\n\t\tresult.clippingPlanes = material.clippingPlanes;\n\t\tresult.clipIntersection = material.clipIntersection;\n\n\t\tresult.displacementMap = material.displacementMap;\n\t\tresult.displacementScale = material.displacementScale;\n\t\tresult.displacementBias = material.displacementBias;\n\n\t\tresult.wireframeLinewidth = material.wireframeLinewidth;\n\t\tresult.linewidth = material.linewidth;\n\n\t\tif ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {\n\n\t\t\tresult.referencePosition.setFromMatrixPosition( light.matrixWorld );\n\t\t\tresult.nearDistance = shadowCameraNear;\n\t\t\tresult.farDistance = shadowCameraFar;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\tfunction renderObject( object, camera, shadowCamera, light, type ) {\n\n\t\tif ( object.visible === false ) return;\n\n\t\tconst visible = object.layers.test( camera.layers );\n\n\t\tif ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) {\n\n\t\t\tif ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) ) {\n\n\t\t\t\tobject.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );\n\n\t\t\t\tconst geometry = _objects.update( object );\n\t\t\t\tconst material = object.material;\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\tfor ( let k = 0, kl = groups.length; k < kl; k ++ ) {\n\n\t\t\t\t\t\tconst group = groups[ k ];\n\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, geometry, groupMaterial, light, shadowCamera.near, shadowCamera.far, type );\n\n\t\t\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\tconst depthMaterial = getDepthMaterial( object, geometry, material, light, shadowCamera.near, shadowCamera.far, type );\n\n\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( children[ i ], camera, shadowCamera, light, type );\n\n\t\t}\n\n\t}\n\n}\n\nfunction WebGLState( gl, extensions, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tfunction ColorBuffer() {\n\n\t\tlet locked = false;\n\n\t\tconst color = new Vector4();\n\t\tlet currentColorMask = null;\n\t\tconst currentColorClear = new Vector4( 0, 0, 0, 0 );\n\n\t\treturn {\n\n\t\t\tsetMask: function ( colorMask ) {\n\n\t\t\t\tif ( currentColorMask !== colorMask && ! locked ) {\n\n\t\t\t\t\tgl.colorMask( colorMask, colorMask, colorMask, colorMask );\n\t\t\t\t\tcurrentColorMask = colorMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( r, g, b, a, premultipliedAlpha ) {\n\n\t\t\t\tif ( premultipliedAlpha === true ) {\n\n\t\t\t\t\tr *= a; g *= a; b *= a;\n\n\t\t\t\t}\n\n\t\t\t\tcolor.set( r, g, b, a );\n\n\t\t\t\tif ( currentColorClear.equals( color ) === false ) {\n\n\t\t\t\t\tgl.clearColor( r, g, b, a );\n\t\t\t\t\tcurrentColorClear.copy( color );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentColorMask = null;\n\t\t\t\tcurrentColorClear.set( - 1, 0, 0, 0 ); // set to invalid state\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction DepthBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentDepthMask = null;\n\t\tlet currentDepthFunc = null;\n\t\tlet currentDepthClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( depthTest ) {\n\n\t\t\t\tif ( depthTest ) {\n\n\t\t\t\t\tenable( 2929 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdisable( 2929 );\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( depthMask ) {\n\n\t\t\t\tif ( currentDepthMask !== depthMask && ! locked ) {\n\n\t\t\t\t\tgl.depthMask( depthMask );\n\t\t\t\t\tcurrentDepthMask = depthMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( depthFunc ) {\n\n\t\t\t\tif ( currentDepthFunc !== depthFunc ) {\n\n\t\t\t\t\tif ( depthFunc ) {\n\n\t\t\t\t\t\tswitch ( depthFunc ) {\n\n\t\t\t\t\t\t\tcase NeverDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 512 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase AlwaysDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 519 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase LessDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 513 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase LessEqualDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 515 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase EqualDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 514 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase GreaterEqualDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 518 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase GreaterDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 516 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase NotEqualDepth:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 517 );\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\n\t\t\t\t\t\t\t\tgl.depthFunc( 515 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tgl.depthFunc( 515 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrentDepthFunc = depthFunc;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( depth ) {\n\n\t\t\t\tif ( currentDepthClear !== depth ) {\n\n\t\t\t\t\tgl.clearDepth( depth );\n\t\t\t\t\tcurrentDepthClear = depth;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentDepthMask = null;\n\t\t\t\tcurrentDepthFunc = null;\n\t\t\t\tcurrentDepthClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tfunction StencilBuffer() {\n\n\t\tlet locked = false;\n\n\t\tlet currentStencilMask = null;\n\t\tlet currentStencilFunc = null;\n\t\tlet currentStencilRef = null;\n\t\tlet currentStencilFuncMask = null;\n\t\tlet currentStencilFail = null;\n\t\tlet currentStencilZFail = null;\n\t\tlet currentStencilZPass = null;\n\t\tlet currentStencilClear = null;\n\n\t\treturn {\n\n\t\t\tsetTest: function ( stencilTest ) {\n\n\t\t\t\tif ( ! locked ) {\n\n\t\t\t\t\tif ( stencilTest ) {\n\n\t\t\t\t\t\tenable( 2960 );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tdisable( 2960 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetMask: function ( stencilMask ) {\n\n\t\t\t\tif ( currentStencilMask !== stencilMask && ! locked ) {\n\n\t\t\t\t\tgl.stencilMask( stencilMask );\n\t\t\t\t\tcurrentStencilMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetFunc: function ( stencilFunc, stencilRef, stencilMask ) {\n\n\t\t\t\tif ( currentStencilFunc !== stencilFunc ||\n\t\t\t\t currentStencilRef !== stencilRef ||\n\t\t\t\t currentStencilFuncMask !== stencilMask ) {\n\n\t\t\t\t\tgl.stencilFunc( stencilFunc, stencilRef, stencilMask );\n\n\t\t\t\t\tcurrentStencilFunc = stencilFunc;\n\t\t\t\t\tcurrentStencilRef = stencilRef;\n\t\t\t\t\tcurrentStencilFuncMask = stencilMask;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetOp: function ( stencilFail, stencilZFail, stencilZPass ) {\n\n\t\t\t\tif ( currentStencilFail !== stencilFail ||\n\t\t\t\t currentStencilZFail !== stencilZFail ||\n\t\t\t\t currentStencilZPass !== stencilZPass ) {\n\n\t\t\t\t\tgl.stencilOp( stencilFail, stencilZFail, stencilZPass );\n\n\t\t\t\t\tcurrentStencilFail = stencilFail;\n\t\t\t\t\tcurrentStencilZFail = stencilZFail;\n\t\t\t\t\tcurrentStencilZPass = stencilZPass;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tsetLocked: function ( lock ) {\n\n\t\t\t\tlocked = lock;\n\n\t\t\t},\n\n\t\t\tsetClear: function ( stencil ) {\n\n\t\t\t\tif ( currentStencilClear !== stencil ) {\n\n\t\t\t\t\tgl.clearStencil( stencil );\n\t\t\t\t\tcurrentStencilClear = stencil;\n\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\treset: function () {\n\n\t\t\t\tlocked = false;\n\n\t\t\t\tcurrentStencilMask = null;\n\t\t\t\tcurrentStencilFunc = null;\n\t\t\t\tcurrentStencilRef = null;\n\t\t\t\tcurrentStencilFuncMask = null;\n\t\t\t\tcurrentStencilFail = null;\n\t\t\t\tcurrentStencilZFail = null;\n\t\t\t\tcurrentStencilZPass = null;\n\t\t\t\tcurrentStencilClear = null;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t//\n\n\tconst colorBuffer = new ColorBuffer();\n\tconst depthBuffer = new DepthBuffer();\n\tconst stencilBuffer = new StencilBuffer();\n\n\tlet enabledCapabilities = {};\n\n\tlet xrFramebuffer = null;\n\tlet currentBoundFramebuffers = {};\n\n\tlet currentProgram = null;\n\n\tlet currentBlendingEnabled = false;\n\tlet currentBlending = null;\n\tlet currentBlendEquation = null;\n\tlet currentBlendSrc = null;\n\tlet currentBlendDst = null;\n\tlet currentBlendEquationAlpha = null;\n\tlet currentBlendSrcAlpha = null;\n\tlet currentBlendDstAlpha = null;\n\tlet currentPremultipledAlpha = false;\n\n\tlet currentFlipSided = null;\n\tlet currentCullFace = null;\n\n\tlet currentLineWidth = null;\n\n\tlet currentPolygonOffsetFactor = null;\n\tlet currentPolygonOffsetUnits = null;\n\n\tconst maxTextures = gl.getParameter( 35661 );\n\n\tlet lineWidthAvailable = false;\n\tlet version = 0;\n\tconst glVersion = gl.getParameter( 7938 );\n\n\tif ( glVersion.indexOf( 'WebGL' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^WebGL (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 1.0 );\n\n\t} else if ( glVersion.indexOf( 'OpenGL ES' ) !== - 1 ) {\n\n\t\tversion = parseFloat( /^OpenGL ES (\\d)/.exec( glVersion )[ 1 ] );\n\t\tlineWidthAvailable = ( version >= 2.0 );\n\n\t}\n\n\tlet currentTextureSlot = null;\n\tlet currentBoundTextures = {};\n\n\tconst scissorParam = gl.getParameter( 3088 );\n\tconst viewportParam = gl.getParameter( 2978 );\n\n\tconst currentScissor = new Vector4().fromArray( scissorParam );\n\tconst currentViewport = new Vector4().fromArray( viewportParam );\n\n\tfunction createTexture( type, target, count ) {\n\n\t\tconst data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture( type, texture );\n\t\tgl.texParameteri( type, 10241, 9728 );\n\t\tgl.texParameteri( type, 10240, 9728 );\n\n\t\tfor ( let i = 0; i < count; i ++ ) {\n\n\t\t\tgl.texImage2D( target + i, 0, 6408, 1, 1, 0, 6408, 5121, data );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n\tconst emptyTextures = {};\n\temptyTextures[ 3553 ] = createTexture( 3553, 3553, 1 );\n\temptyTextures[ 34067 ] = createTexture( 34067, 34069, 6 );\n\n\t// init\n\n\tcolorBuffer.setClear( 0, 0, 0, 1 );\n\tdepthBuffer.setClear( 1 );\n\tstencilBuffer.setClear( 0 );\n\n\tenable( 2929 );\n\tdepthBuffer.setFunc( LessEqualDepth );\n\n\tsetFlipSided( false );\n\tsetCullFace( CullFaceBack );\n\tenable( 2884 );\n\n\tsetBlending( NoBlending );\n\n\t//\n\n\tfunction enable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== true ) {\n\n\t\t\tgl.enable( id );\n\t\t\tenabledCapabilities[ id ] = true;\n\n\t\t}\n\n\t}\n\n\tfunction disable( id ) {\n\n\t\tif ( enabledCapabilities[ id ] !== false ) {\n\n\t\t\tgl.disable( id );\n\t\t\tenabledCapabilities[ id ] = false;\n\n\t\t}\n\n\t}\n\n\tfunction bindXRFramebuffer( framebuffer ) {\n\n\t\tif ( framebuffer !== xrFramebuffer ) {\n\n\t\t\tgl.bindFramebuffer( 36160, framebuffer );\n\n\t\t\txrFramebuffer = framebuffer;\n\n\t\t}\n\n\t}\n\n\tfunction bindFramebuffer( target, framebuffer ) {\n\n\t\tif ( framebuffer === null && xrFramebuffer !== null ) framebuffer = xrFramebuffer; // use active XR framebuffer if available\n\n\t\tif ( currentBoundFramebuffers[ target ] !== framebuffer ) {\n\n\t\t\tgl.bindFramebuffer( target, framebuffer );\n\n\t\t\tcurrentBoundFramebuffers[ target ] = framebuffer;\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t// 36009 is equivalent to 36160\n\n\t\t\t\tif ( target === 36009 ) {\n\n\t\t\t\t\tcurrentBoundFramebuffers[ 36160 ] = framebuffer;\n\n\t\t\t\t}\n\n\t\t\t\tif ( target === 36160 ) {\n\n\t\t\t\t\tcurrentBoundFramebuffers[ 36009 ] = framebuffer;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tfunction useProgram( program ) {\n\n\t\tif ( currentProgram !== program ) {\n\n\t\t\tgl.useProgram( program );\n\n\t\t\tcurrentProgram = program;\n\n\t\t\treturn true;\n\n\t\t}\n\n\t\treturn false;\n\n\t}\n\n\tconst equationToGL = {\n\t\t[ AddEquation ]: 32774,\n\t\t[ SubtractEquation ]: 32778,\n\t\t[ ReverseSubtractEquation ]: 32779\n\t};\n\n\tif ( isWebGL2 ) {\n\n\t\tequationToGL[ MinEquation ] = 32775;\n\t\tequationToGL[ MaxEquation ] = 32776;\n\n\t} else {\n\n\t\tconst extension = extensions.get( 'EXT_blend_minmax' );\n\n\t\tif ( extension !== null ) {\n\n\t\t\tequationToGL[ MinEquation ] = extension.MIN_EXT;\n\t\t\tequationToGL[ MaxEquation ] = extension.MAX_EXT;\n\n\t\t}\n\n\t}\n\n\tconst factorToGL = {\n\t\t[ ZeroFactor ]: 0,\n\t\t[ OneFactor ]: 1,\n\t\t[ SrcColorFactor ]: 768,\n\t\t[ SrcAlphaFactor ]: 770,\n\t\t[ SrcAlphaSaturateFactor ]: 776,\n\t\t[ DstColorFactor ]: 774,\n\t\t[ DstAlphaFactor ]: 772,\n\t\t[ OneMinusSrcColorFactor ]: 769,\n\t\t[ OneMinusSrcAlphaFactor ]: 771,\n\t\t[ OneMinusDstColorFactor ]: 775,\n\t\t[ OneMinusDstAlphaFactor ]: 773\n\t};\n\n\tfunction setBlending( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha ) {\n\n\t\tif ( blending === NoBlending ) {\n\n\t\t\tif ( currentBlendingEnabled === true ) {\n\n\t\t\t\tdisable( 3042 );\n\t\t\t\tcurrentBlendingEnabled = false;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( currentBlendingEnabled === false ) {\n\n\t\t\tenable( 3042 );\n\t\t\tcurrentBlendingEnabled = true;\n\n\t\t}\n\n\t\tif ( blending !== CustomBlending ) {\n\n\t\t\tif ( blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha ) {\n\n\t\t\t\tif ( currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation ) {\n\n\t\t\t\t\tgl.blendEquation( 32774 );\n\n\t\t\t\t\tcurrentBlendEquation = AddEquation;\n\t\t\t\t\tcurrentBlendEquationAlpha = AddEquation;\n\n\t\t\t\t}\n\n\t\t\t\tif ( premultipliedAlpha ) {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( 1, 771, 1, 771 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( 1, 1 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( 0, 0, 769, 771 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( 0, 768, 0, 770 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tswitch ( blending ) {\n\n\t\t\t\t\t\tcase NormalBlending:\n\t\t\t\t\t\t\tgl.blendFuncSeparate( 770, 771, 1, 771 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase AdditiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( 770, 1 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase SubtractiveBlending:\n\t\t\t\t\t\t\tgl.blendFunc( 0, 769 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tcase MultiplyBlending:\n\t\t\t\t\t\t\tgl.blendFunc( 0, 768 );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLState: Invalid blending: ', blending );\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tcurrentBlendSrc = null;\n\t\t\t\tcurrentBlendDst = null;\n\t\t\t\tcurrentBlendSrcAlpha = null;\n\t\t\t\tcurrentBlendDstAlpha = null;\n\n\t\t\t\tcurrentBlending = blending;\n\t\t\t\tcurrentPremultipledAlpha = premultipliedAlpha;\n\n\t\t\t}\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// custom blending\n\n\t\tblendEquationAlpha = blendEquationAlpha || blendEquation;\n\t\tblendSrcAlpha = blendSrcAlpha || blendSrc;\n\t\tblendDstAlpha = blendDstAlpha || blendDst;\n\n\t\tif ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) {\n\n\t\t\tgl.blendEquationSeparate( equationToGL[ blendEquation ], equationToGL[ blendEquationAlpha ] );\n\n\t\t\tcurrentBlendEquation = blendEquation;\n\t\t\tcurrentBlendEquationAlpha = blendEquationAlpha;\n\n\t\t}\n\n\t\tif ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) {\n\n\t\t\tgl.blendFuncSeparate( factorToGL[ blendSrc ], factorToGL[ blendDst ], factorToGL[ blendSrcAlpha ], factorToGL[ blendDstAlpha ] );\n\n\t\t\tcurrentBlendSrc = blendSrc;\n\t\t\tcurrentBlendDst = blendDst;\n\t\t\tcurrentBlendSrcAlpha = blendSrcAlpha;\n\t\t\tcurrentBlendDstAlpha = blendDstAlpha;\n\n\t\t}\n\n\t\tcurrentBlending = blending;\n\t\tcurrentPremultipledAlpha = null;\n\n\t}\n\n\tfunction setMaterial( material, frontFaceCW ) {\n\n\t\tmaterial.side === DoubleSide\n\t\t\t? disable( 2884 )\n\t\t\t: enable( 2884 );\n\n\t\tlet flipSided = ( material.side === BackSide );\n\t\tif ( frontFaceCW ) flipSided = ! flipSided;\n\n\t\tsetFlipSided( flipSided );\n\n\t\t( material.blending === NormalBlending && material.transparent === false )\n\t\t\t? setBlending( NoBlending )\n\t\t\t: setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha );\n\n\t\tdepthBuffer.setFunc( material.depthFunc );\n\t\tdepthBuffer.setTest( material.depthTest );\n\t\tdepthBuffer.setMask( material.depthWrite );\n\t\tcolorBuffer.setMask( material.colorWrite );\n\n\t\tconst stencilWrite = material.stencilWrite;\n\t\tstencilBuffer.setTest( stencilWrite );\n\t\tif ( stencilWrite ) {\n\n\t\t\tstencilBuffer.setMask( material.stencilWriteMask );\n\t\t\tstencilBuffer.setFunc( material.stencilFunc, material.stencilRef, material.stencilFuncMask );\n\t\t\tstencilBuffer.setOp( material.stencilFail, material.stencilZFail, material.stencilZPass );\n\n\t\t}\n\n\t\tsetPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );\n\n\t\tmaterial.alphaToCoverage === true\n\t\t\t? enable( 32926 )\n\t\t\t: disable( 32926 );\n\n\t}\n\n\t//\n\n\tfunction setFlipSided( flipSided ) {\n\n\t\tif ( currentFlipSided !== flipSided ) {\n\n\t\t\tif ( flipSided ) {\n\n\t\t\t\tgl.frontFace( 2304 );\n\n\t\t\t} else {\n\n\t\t\t\tgl.frontFace( 2305 );\n\n\t\t\t}\n\n\t\t\tcurrentFlipSided = flipSided;\n\n\t\t}\n\n\t}\n\n\tfunction setCullFace( cullFace ) {\n\n\t\tif ( cullFace !== CullFaceNone ) {\n\n\t\t\tenable( 2884 );\n\n\t\t\tif ( cullFace !== currentCullFace ) {\n\n\t\t\t\tif ( cullFace === CullFaceBack ) {\n\n\t\t\t\t\tgl.cullFace( 1029 );\n\n\t\t\t\t} else if ( cullFace === CullFaceFront ) {\n\n\t\t\t\t\tgl.cullFace( 1028 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tgl.cullFace( 1032 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( 2884 );\n\n\t\t}\n\n\t\tcurrentCullFace = cullFace;\n\n\t}\n\n\tfunction setLineWidth( width ) {\n\n\t\tif ( width !== currentLineWidth ) {\n\n\t\t\tif ( lineWidthAvailable ) gl.lineWidth( width );\n\n\t\t\tcurrentLineWidth = width;\n\n\t\t}\n\n\t}\n\n\tfunction setPolygonOffset( polygonOffset, factor, units ) {\n\n\t\tif ( polygonOffset ) {\n\n\t\t\tenable( 32823 );\n\n\t\t\tif ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) {\n\n\t\t\t\tgl.polygonOffset( factor, units );\n\n\t\t\t\tcurrentPolygonOffsetFactor = factor;\n\t\t\t\tcurrentPolygonOffsetUnits = units;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tdisable( 32823 );\n\n\t\t}\n\n\t}\n\n\tfunction setScissorTest( scissorTest ) {\n\n\t\tif ( scissorTest ) {\n\n\t\t\tenable( 3089 );\n\n\t\t} else {\n\n\t\t\tdisable( 3089 );\n\n\t\t}\n\n\t}\n\n\t// texture\n\n\tfunction activeTexture( webglSlot ) {\n\n\t\tif ( webglSlot === undefined ) webglSlot = 33984 + maxTextures - 1;\n\n\t\tif ( currentTextureSlot !== webglSlot ) {\n\n\t\t\tgl.activeTexture( webglSlot );\n\t\t\tcurrentTextureSlot = webglSlot;\n\n\t\t}\n\n\t}\n\n\tfunction bindTexture( webglType, webglTexture ) {\n\n\t\tif ( currentTextureSlot === null ) {\n\n\t\t\tactiveTexture();\n\n\t\t}\n\n\t\tlet boundTexture = currentBoundTextures[ currentTextureSlot ];\n\n\t\tif ( boundTexture === undefined ) {\n\n\t\t\tboundTexture = { type: undefined, texture: undefined };\n\t\t\tcurrentBoundTextures[ currentTextureSlot ] = boundTexture;\n\n\t\t}\n\n\t\tif ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) {\n\n\t\t\tgl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] );\n\n\t\t\tboundTexture.type = webglType;\n\t\t\tboundTexture.texture = webglTexture;\n\n\t\t}\n\n\t}\n\n\tfunction unbindTexture() {\n\n\t\tconst boundTexture = currentBoundTextures[ currentTextureSlot ];\n\n\t\tif ( boundTexture !== undefined && boundTexture.type !== undefined ) {\n\n\t\t\tgl.bindTexture( boundTexture.type, null );\n\n\t\t\tboundTexture.type = undefined;\n\t\t\tboundTexture.texture = undefined;\n\n\t\t}\n\n\t}\n\n\tfunction compressedTexImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.compressedTexImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage2D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage2D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\tfunction texImage3D() {\n\n\t\ttry {\n\n\t\t\tgl.texImage3D.apply( gl, arguments );\n\n\t\t} catch ( error ) {\n\n\t\t\tconsole.error( 'THREE.WebGLState:', error );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction scissor( scissor ) {\n\n\t\tif ( currentScissor.equals( scissor ) === false ) {\n\n\t\t\tgl.scissor( scissor.x, scissor.y, scissor.z, scissor.w );\n\t\t\tcurrentScissor.copy( scissor );\n\n\t\t}\n\n\t}\n\n\tfunction viewport( viewport ) {\n\n\t\tif ( currentViewport.equals( viewport ) === false ) {\n\n\t\t\tgl.viewport( viewport.x, viewport.y, viewport.z, viewport.w );\n\t\t\tcurrentViewport.copy( viewport );\n\n\t\t}\n\n\t}\n\n\t//\n\n\tfunction reset() {\n\n\t\t// reset state\n\n\t\tgl.disable( 3042 );\n\t\tgl.disable( 2884 );\n\t\tgl.disable( 2929 );\n\t\tgl.disable( 32823 );\n\t\tgl.disable( 3089 );\n\t\tgl.disable( 2960 );\n\t\tgl.disable( 32926 );\n\n\t\tgl.blendEquation( 32774 );\n\t\tgl.blendFunc( 1, 0 );\n\t\tgl.blendFuncSeparate( 1, 0, 1, 0 );\n\n\t\tgl.colorMask( true, true, true, true );\n\t\tgl.clearColor( 0, 0, 0, 0 );\n\n\t\tgl.depthMask( true );\n\t\tgl.depthFunc( 513 );\n\t\tgl.clearDepth( 1 );\n\n\t\tgl.stencilMask( 0xffffffff );\n\t\tgl.stencilFunc( 519, 0, 0xffffffff );\n\t\tgl.stencilOp( 7680, 7680, 7680 );\n\t\tgl.clearStencil( 0 );\n\n\t\tgl.cullFace( 1029 );\n\t\tgl.frontFace( 2305 );\n\n\t\tgl.polygonOffset( 0, 0 );\n\n\t\tgl.activeTexture( 33984 );\n\n\t\tgl.bindFramebuffer( 36160, null );\n\n\t\tif ( isWebGL2 === true ) {\n\n\t\t\tgl.bindFramebuffer( 36009, null );\n\t\t\tgl.bindFramebuffer( 36008, null );\n\n\t\t}\n\n\t\tgl.useProgram( null );\n\n\t\tgl.lineWidth( 1 );\n\n\t\tgl.scissor( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tgl.viewport( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\t// reset internals\n\n\t\tenabledCapabilities = {};\n\n\t\tcurrentTextureSlot = null;\n\t\tcurrentBoundTextures = {};\n\n\t\txrFramebuffer = null;\n\t\tcurrentBoundFramebuffers = {};\n\n\t\tcurrentProgram = null;\n\n\t\tcurrentBlendingEnabled = false;\n\t\tcurrentBlending = null;\n\t\tcurrentBlendEquation = null;\n\t\tcurrentBlendSrc = null;\n\t\tcurrentBlendDst = null;\n\t\tcurrentBlendEquationAlpha = null;\n\t\tcurrentBlendSrcAlpha = null;\n\t\tcurrentBlendDstAlpha = null;\n\t\tcurrentPremultipledAlpha = false;\n\n\t\tcurrentFlipSided = null;\n\t\tcurrentCullFace = null;\n\n\t\tcurrentLineWidth = null;\n\n\t\tcurrentPolygonOffsetFactor = null;\n\t\tcurrentPolygonOffsetUnits = null;\n\n\t\tcurrentScissor.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\t\tcurrentViewport.set( 0, 0, gl.canvas.width, gl.canvas.height );\n\n\t\tcolorBuffer.reset();\n\t\tdepthBuffer.reset();\n\t\tstencilBuffer.reset();\n\n\t}\n\n\treturn {\n\n\t\tbuffers: {\n\t\t\tcolor: colorBuffer,\n\t\t\tdepth: depthBuffer,\n\t\t\tstencil: stencilBuffer\n\t\t},\n\n\t\tenable: enable,\n\t\tdisable: disable,\n\n\t\tbindFramebuffer: bindFramebuffer,\n\t\tbindXRFramebuffer: bindXRFramebuffer,\n\n\t\tuseProgram: useProgram,\n\n\t\tsetBlending: setBlending,\n\t\tsetMaterial: setMaterial,\n\n\t\tsetFlipSided: setFlipSided,\n\t\tsetCullFace: setCullFace,\n\n\t\tsetLineWidth: setLineWidth,\n\t\tsetPolygonOffset: setPolygonOffset,\n\n\t\tsetScissorTest: setScissorTest,\n\n\t\tactiveTexture: activeTexture,\n\t\tbindTexture: bindTexture,\n\t\tunbindTexture: unbindTexture,\n\t\tcompressedTexImage2D: compressedTexImage2D,\n\t\ttexImage2D: texImage2D,\n\t\ttexImage3D: texImage3D,\n\n\t\tscissor: scissor,\n\t\tviewport: viewport,\n\n\t\treset: reset\n\n\t};\n\n}\n\nfunction WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\tconst maxTextures = capabilities.maxTextures;\n\tconst maxCubemapSize = capabilities.maxCubemapSize;\n\tconst maxTextureSize = capabilities.maxTextureSize;\n\tconst maxSamples = capabilities.maxSamples;\n\n\tconst _videoTextures = new WeakMap();\n\tlet _canvas;\n\n\t// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,\n\t// also OffscreenCanvas.getContext(\"webgl\"), but not OffscreenCanvas.getContext(\"2d\")!\n\t// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).\n\n\tlet useOffscreenCanvas = false;\n\n\ttry {\n\n\t\tuseOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'\n\t\t\t&& ( new OffscreenCanvas( 1, 1 ).getContext( '2d' ) ) !== null;\n\n\t} catch ( err ) {\n\n\t\t// Ignore any errors\n\n\t}\n\n\tfunction createCanvas( width, height ) {\n\n\t\t// Use OffscreenCanvas when available. Specially needed in web workers\n\n\t\treturn useOffscreenCanvas ?\n\t\t\tnew OffscreenCanvas( width, height ) : createElementNS( 'canvas' );\n\n\t}\n\n\tfunction resizeImage( image, needsPowerOfTwo, needsNewCanvas, maxSize ) {\n\n\t\tlet scale = 1;\n\n\t\t// handle case if texture exceeds max size\n\n\t\tif ( image.width > maxSize || image.height > maxSize ) {\n\n\t\t\tscale = maxSize / Math.max( image.width, image.height );\n\n\t\t}\n\n\t\t// only perform resize if necessary\n\n\t\tif ( scale < 1 || needsPowerOfTwo === true ) {\n\n\t\t\t// only perform resize for certain image types\n\n\t\t\tif ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||\n\t\t\t\t( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||\n\t\t\t\t( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {\n\n\t\t\t\tconst floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor;\n\n\t\t\t\tconst width = floor( scale * image.width );\n\t\t\t\tconst height = floor( scale * image.height );\n\n\t\t\t\tif ( _canvas === undefined ) _canvas = createCanvas( width, height );\n\n\t\t\t\t// cube textures can't reuse the same canvas\n\n\t\t\t\tconst canvas = needsNewCanvas ? createCanvas( width, height ) : _canvas;\n\n\t\t\t\tcanvas.width = width;\n\t\t\t\tcanvas.height = height;\n\n\t\t\t\tconst context = canvas.getContext( '2d' );\n\t\t\t\tcontext.drawImage( image, 0, 0, width, height );\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').' );\n\n\t\t\t\treturn canvas;\n\n\t\t\t} else {\n\n\t\t\t\tif ( 'data' in image ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').' );\n\n\t\t\t\t}\n\n\t\t\t\treturn image;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn image;\n\n\t}\n\n\tfunction isPowerOfTwo$1( image ) {\n\n\t\treturn isPowerOfTwo( image.width ) && isPowerOfTwo( image.height );\n\n\t}\n\n\tfunction textureNeedsPowerOfTwo( texture ) {\n\n\t\tif ( isWebGL2 ) return false;\n\n\t\treturn ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) ||\n\t\t\t( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter );\n\n\t}\n\n\tfunction textureNeedsGenerateMipmaps( texture, supportsMips ) {\n\n\t\treturn texture.generateMipmaps && supportsMips &&\n\t\t\ttexture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;\n\n\t}\n\n\tfunction generateMipmap( target, texture, width, height, depth = 1 ) {\n\n\t\t_gl.generateMipmap( target );\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\ttextureProperties.__maxMipLevel = Math.log2( Math.max( width, height, depth ) );\n\n\t}\n\n\tfunction getInternalFormat( internalFormatName, glFormat, glType, encoding ) {\n\n\t\tif ( isWebGL2 === false ) return glFormat;\n\n\t\tif ( internalFormatName !== null ) {\n\n\t\t\tif ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \\'' + internalFormatName + '\\'' );\n\n\t\t}\n\n\t\tlet internalFormat = glFormat;\n\n\t\tif ( glFormat === 6403 ) {\n\n\t\t\tif ( glType === 5126 ) internalFormat = 33326;\n\t\t\tif ( glType === 5131 ) internalFormat = 33325;\n\t\t\tif ( glType === 5121 ) internalFormat = 33321;\n\n\t\t}\n\n\t\tif ( glFormat === 6407 ) {\n\n\t\t\tif ( glType === 5126 ) internalFormat = 34837;\n\t\t\tif ( glType === 5131 ) internalFormat = 34843;\n\t\t\tif ( glType === 5121 ) internalFormat = 32849;\n\n\t\t}\n\n\t\tif ( glFormat === 6408 ) {\n\n\t\t\tif ( glType === 5126 ) internalFormat = 34836;\n\t\t\tif ( glType === 5131 ) internalFormat = 34842;\n\t\t\tif ( glType === 5121 ) internalFormat = ( encoding === sRGBEncoding ) ? 35907 : 32856;\n\n\t\t}\n\n\t\tif ( internalFormat === 33325 || internalFormat === 33326 ||\n\t\t\tinternalFormat === 34842 || internalFormat === 34836 ) {\n\n\t\t\textensions.get( 'EXT_color_buffer_float' );\n\n\t\t}\n\n\t\treturn internalFormat;\n\n\t}\n\n\t// Fallback filters for non-power-of-2 textures\n\n\tfunction filterFallback( f ) {\n\n\t\tif ( f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter ) {\n\n\t\t\treturn 9728;\n\n\t\t}\n\n\t\treturn 9729;\n\n\t}\n\n\t//\n\n\tfunction onTextureDispose( event ) {\n\n\t\tconst texture = event.target;\n\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\n\n\t\tdeallocateTexture( texture );\n\n\t\tif ( texture.isVideoTexture ) {\n\n\t\t\t_videoTextures.delete( texture );\n\n\t\t}\n\n\t\tinfo.memory.textures --;\n\n\t}\n\n\tfunction onRenderTargetDispose( event ) {\n\n\t\tconst renderTarget = event.target;\n\n\t\trenderTarget.removeEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tdeallocateRenderTarget( renderTarget );\n\n\t}\n\n\t//\n\n\tfunction deallocateTexture( texture ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( textureProperties.__webglInit === undefined ) return;\n\n\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\tproperties.remove( texture );\n\n\t}\n\n\tfunction deallocateRenderTarget( renderTarget ) {\n\n\t\tconst texture = renderTarget.texture;\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( ! renderTarget ) return;\n\n\t\tif ( textureProperties.__webglTexture !== undefined ) {\n\n\t\t\t_gl.deleteTexture( textureProperties.__webglTexture );\n\n\t\t\tinfo.memory.textures --;\n\n\t\t}\n\n\t\tif ( renderTarget.depthTexture ) {\n\n\t\t\trenderTarget.depthTexture.dispose();\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );\n\t\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer[ i ] );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );\n\t\t\tif ( renderTargetProperties.__webglDepthbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthbuffer );\n\t\t\tif ( renderTargetProperties.__webglMultisampledFramebuffer ) _gl.deleteFramebuffer( renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\tif ( renderTargetProperties.__webglColorRenderbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglColorRenderbuffer );\n\t\t\tif ( renderTargetProperties.__webglDepthRenderbuffer ) _gl.deleteRenderbuffer( renderTargetProperties.__webglDepthRenderbuffer );\n\n\t\t}\n\n\t\tif ( renderTarget.isWebGLMultipleRenderTargets ) {\n\n\t\t\tfor ( let i = 0, il = texture.length; i < il; i ++ ) {\n\n\t\t\t\tconst attachmentProperties = properties.get( texture[ i ] );\n\n\t\t\t\tif ( attachmentProperties.__webglTexture ) {\n\n\t\t\t\t\t_gl.deleteTexture( attachmentProperties.__webglTexture );\n\n\t\t\t\t\tinfo.memory.textures --;\n\n\t\t\t\t}\n\n\t\t\t\tproperties.remove( texture[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tproperties.remove( texture );\n\t\tproperties.remove( renderTarget );\n\n\t}\n\n\t//\n\n\tlet textureUnits = 0;\n\n\tfunction resetTextureUnits() {\n\n\t\ttextureUnits = 0;\n\n\t}\n\n\tfunction allocateTextureUnit() {\n\n\t\tconst textureUnit = textureUnits;\n\n\t\tif ( textureUnit >= maxTextures ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures );\n\n\t\t}\n\n\t\ttextureUnits += 1;\n\n\t\treturn textureUnit;\n\n\t}\n\n\t//\n\n\tfunction setTexture2D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.isVideoTexture ) updateVideoTexture( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tconst image = texture.image;\n\n\t\t\tif ( image === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but image is undefined' );\n\n\t\t\t} else if ( image.complete === false ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete' );\n\n\t\t\t} else {\n\n\t\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.activeTexture( 33984 + slot );\n\t\tstate.bindTexture( 3553, textureProperties.__webglTexture );\n\n\t}\n\n\tfunction setTexture2DArray( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.activeTexture( 33984 + slot );\n\t\tstate.bindTexture( 35866, textureProperties.__webglTexture );\n\n\t}\n\n\tfunction setTexture3D( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.activeTexture( 33984 + slot );\n\t\tstate.bindTexture( 32879, textureProperties.__webglTexture );\n\n\t}\n\n\tfunction setTextureCube( texture, slot ) {\n\n\t\tconst textureProperties = properties.get( texture );\n\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\n\n\t\t\tuploadCubeTexture( textureProperties, texture, slot );\n\t\t\treturn;\n\n\t\t}\n\n\t\tstate.activeTexture( 33984 + slot );\n\t\tstate.bindTexture( 34067, textureProperties.__webglTexture );\n\n\t}\n\n\tconst wrappingToGL = {\n\t\t[ RepeatWrapping ]: 10497,\n\t\t[ ClampToEdgeWrapping ]: 33071,\n\t\t[ MirroredRepeatWrapping ]: 33648\n\t};\n\n\tconst filterToGL = {\n\t\t[ NearestFilter ]: 9728,\n\t\t[ NearestMipmapNearestFilter ]: 9984,\n\t\t[ NearestMipmapLinearFilter ]: 9986,\n\n\t\t[ LinearFilter ]: 9729,\n\t\t[ LinearMipmapNearestFilter ]: 9985,\n\t\t[ LinearMipmapLinearFilter ]: 9987\n\t};\n\n\tfunction setTextureParameters( textureType, texture, supportsMips ) {\n\n\t\tif ( supportsMips ) {\n\n\t\t\t_gl.texParameteri( textureType, 10242, wrappingToGL[ texture.wrapS ] );\n\t\t\t_gl.texParameteri( textureType, 10243, wrappingToGL[ texture.wrapT ] );\n\n\t\t\tif ( textureType === 32879 || textureType === 35866 ) {\n\n\t\t\t\t_gl.texParameteri( textureType, 32882, wrappingToGL[ texture.wrapR ] );\n\n\t\t\t}\n\n\t\t\t_gl.texParameteri( textureType, 10240, filterToGL[ texture.magFilter ] );\n\t\t\t_gl.texParameteri( textureType, 10241, filterToGL[ texture.minFilter ] );\n\n\t\t} else {\n\n\t\t\t_gl.texParameteri( textureType, 10242, 33071 );\n\t\t\t_gl.texParameteri( textureType, 10243, 33071 );\n\n\t\t\tif ( textureType === 32879 || textureType === 35866 ) {\n\n\t\t\t\t_gl.texParameteri( textureType, 32882, 33071 );\n\n\t\t\t}\n\n\t\t\tif ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' );\n\n\t\t\t}\n\n\t\t\t_gl.texParameteri( textureType, 10240, filterFallback( texture.magFilter ) );\n\t\t\t_gl.texParameteri( textureType, 10241, filterFallback( texture.minFilter ) );\n\n\t\t\tif ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.' );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {\n\n\t\t\tconst extension = extensions.get( 'EXT_texture_filter_anisotropic' );\n\n\t\t\tif ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension for WebGL 1 and WebGL 2\n\t\t\tif ( isWebGL2 === false && ( texture.type === HalfFloatType && extensions.has( 'OES_texture_half_float_linear' ) === false ) ) return; // verify extension for WebGL 1 only\n\n\t\t\tif ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {\n\n\t\t\t\t_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );\n\t\t\t\tproperties.get( texture ).__currentAnisotropy = texture.anisotropy;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction initTexture( textureProperties, texture ) {\n\n\t\tif ( textureProperties.__webglInit === undefined ) {\n\n\t\t\ttextureProperties.__webglInit = true;\n\n\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\n\n\t\t\ttextureProperties.__webglTexture = _gl.createTexture();\n\n\t\t\tinfo.memory.textures ++;\n\n\t\t}\n\n\t}\n\n\tfunction uploadTexture( textureProperties, texture, slot ) {\n\n\t\tlet textureType = 3553;\n\n\t\tif ( texture.isDataTexture2DArray ) textureType = 35866;\n\t\tif ( texture.isDataTexture3D ) textureType = 32879;\n\n\t\tinitTexture( textureProperties, texture );\n\n\t\tstate.activeTexture( 33984 + slot );\n\t\tstate.bindTexture( textureType, textureProperties.__webglTexture );\n\n\t\t_gl.pixelStorei( 37440, texture.flipY );\n\t\t_gl.pixelStorei( 37441, texture.premultiplyAlpha );\n\t\t_gl.pixelStorei( 3317, texture.unpackAlignment );\n\t\t_gl.pixelStorei( 37443, 0 );\n\n\t\tconst needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;\n\t\tconst image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );\n\n\t\tconst supportsMips = isPowerOfTwo$1( image ) || isWebGL2,\n\t\t\tglFormat = utils.convert( texture.format );\n\n\t\tlet glType = utils.convert( texture.type ),\n\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );\n\n\t\tsetTextureParameters( textureType, texture, supportsMips );\n\n\t\tlet mipmap;\n\t\tconst mipmaps = texture.mipmaps;\n\n\t\tif ( texture.isDepthTexture ) {\n\n\t\t\t// populate depth texture with dummy data\n\n\t\t\tglInternalFormat = 6402;\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\tif ( texture.type === FloatType ) {\n\n\t\t\t\t\tglInternalFormat = 36012;\n\n\t\t\t\t} else if ( texture.type === UnsignedIntType ) {\n\n\t\t\t\t\tglInternalFormat = 33190;\n\n\t\t\t\t} else if ( texture.type === UnsignedInt248Type ) {\n\n\t\t\t\t\tglInternalFormat = 35056;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tglInternalFormat = 33189; // WebGL2 requires sized internalformat for glTexImage2D\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( texture.type === FloatType ) {\n\n\t\t\t\t\tconsole.error( 'WebGLRenderer: Floating point depth texture requires WebGL2.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// validation checks for WebGL 1\n\n\t\t\tif ( texture.format === DepthFormat && glInternalFormat === 6402 ) {\n\n\t\t\t\t// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n\t\t\t\t// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT\n\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\tif ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );\n\n\t\t\t\t\ttexture.type = UnsignedShortType;\n\t\t\t\t\tglType = utils.convert( texture.type );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( texture.format === DepthStencilFormat && glInternalFormat === 6402 ) {\n\n\t\t\t\t// Depth stencil textures need the DEPTH_STENCIL internal format\n\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\tglInternalFormat = 34041;\n\n\t\t\t\t// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n\t\t\t\t// DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.\n\t\t\t\t// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n\t\t\t\tif ( texture.type !== UnsignedInt248Type ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' );\n\n\t\t\t\t\ttexture.type = UnsignedInt248Type;\n\t\t\t\t\tglType = utils.convert( texture.type );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tstate.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );\n\n\t\t} else if ( texture.isDataTexture ) {\n\n\t\t\t// use manually created mipmaps if available\n\t\t\t// if there are no manual mipmaps\n\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\tif ( mipmaps.length > 0 && supportsMips ) {\n\n\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\tmipmap = mipmaps[ i ];\n\t\t\t\t\tstate.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t}\n\n\t\t\t\ttexture.generateMipmaps = false;\n\t\t\t\ttextureProperties.__maxMipLevel = mipmaps.length - 1;\n\n\t\t\t} else {\n\n\t\t\t\tstate.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );\n\t\t\t\ttextureProperties.__maxMipLevel = 0;\n\n\t\t\t}\n\n\t\t} else if ( texture.isCompressedTexture ) {\n\n\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\tmipmap = mipmaps[ i ];\n\n\t\t\t\tif ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) {\n\n\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\tstate.compressedTexImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage2D( 3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttextureProperties.__maxMipLevel = mipmaps.length - 1;\n\n\t\t} else if ( texture.isDataTexture2DArray ) {\n\n\t\t\tstate.texImage3D( 35866, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\t\t\ttextureProperties.__maxMipLevel = 0;\n\n\t\t} else if ( texture.isDataTexture3D ) {\n\n\t\t\tstate.texImage3D( 32879, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );\n\t\t\ttextureProperties.__maxMipLevel = 0;\n\n\t\t} else {\n\n\t\t\t// regular Texture (image, video, canvas)\n\n\t\t\t// use manually created mipmaps if available\n\t\t\t// if there are no manual mipmaps\n\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\n\n\t\t\tif ( mipmaps.length > 0 && supportsMips ) {\n\n\t\t\t\tfor ( let i = 0, il = mipmaps.length; i < il; i ++ ) {\n\n\t\t\t\t\tmipmap = mipmaps[ i ];\n\t\t\t\t\tstate.texImage2D( 3553, i, glInternalFormat, glFormat, glType, mipmap );\n\n\t\t\t\t}\n\n\t\t\t\ttexture.generateMipmaps = false;\n\t\t\t\ttextureProperties.__maxMipLevel = mipmaps.length - 1;\n\n\t\t\t} else {\n\n\t\t\t\tstate.texImage2D( 3553, 0, glInternalFormat, glFormat, glType, image );\n\t\t\t\ttextureProperties.__maxMipLevel = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\tgenerateMipmap( textureType, texture, image.width, image.height );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t}\n\n\tfunction uploadCubeTexture( textureProperties, texture, slot ) {\n\n\t\tif ( texture.image.length !== 6 ) return;\n\n\t\tinitTexture( textureProperties, texture );\n\n\t\tstate.activeTexture( 33984 + slot );\n\t\tstate.bindTexture( 34067, textureProperties.__webglTexture );\n\n\t\t_gl.pixelStorei( 37440, texture.flipY );\n\t\t_gl.pixelStorei( 37441, texture.premultiplyAlpha );\n\t\t_gl.pixelStorei( 3317, texture.unpackAlignment );\n\t\t_gl.pixelStorei( 37443, 0 );\n\n\t\tconst isCompressed = ( texture && ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture ) );\n\t\tconst isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );\n\n\t\tconst cubeImage = [];\n\n\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\tif ( ! isCompressed && ! isDataTexture ) {\n\n\t\t\t\tcubeImage[ i ] = resizeImage( texture.image[ i ], false, true, maxCubemapSize );\n\n\t\t\t} else {\n\n\t\t\t\tcubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst image = cubeImage[ 0 ],\n\t\t\tsupportsMips = isPowerOfTwo$1( image ) || isWebGL2,\n\t\t\tglFormat = utils.convert( texture.format ),\n\t\t\tglType = utils.convert( texture.type ),\n\t\t\tglInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );\n\n\t\tsetTextureParameters( 34067, texture, supportsMips );\n\n\t\tlet mipmaps;\n\n\t\tif ( isCompressed ) {\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tmipmaps = cubeImage[ i ].mipmaps;\n\n\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\tif ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) {\n\n\t\t\t\t\t\tif ( glFormat !== null ) {\n\n\t\t\t\t\t\t\tstate.compressedTexImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tstate.texImage2D( 34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttextureProperties.__maxMipLevel = mipmaps.length - 1;\n\n\t\t} else {\n\n\t\t\tmipmaps = texture.mipmaps;\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tif ( isDataTexture ) {\n\n\t\t\t\t\tstate.texImage2D( 34069 + i, 0, glInternalFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );\n\n\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\t\t\t\t\t\tconst mipmapImage = mipmap.image[ i ].image;\n\n\t\t\t\t\t\tstate.texImage2D( 34069 + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tstate.texImage2D( 34069 + i, 0, glInternalFormat, glFormat, glType, cubeImage[ i ] );\n\n\t\t\t\t\tfor ( let j = 0; j < mipmaps.length; j ++ ) {\n\n\t\t\t\t\t\tconst mipmap = mipmaps[ j ];\n\n\t\t\t\t\t\tstate.texImage2D( 34069 + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[ i ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\ttextureProperties.__maxMipLevel = mipmaps.length;\n\n\t\t}\n\n\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t// We assume images for cube map have the same size.\n\t\t\tgenerateMipmap( 34067, texture, image.width, image.height );\n\n\t\t}\n\n\t\ttextureProperties.__version = texture.version;\n\n\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\n\n\t}\n\n\t// Render targets\n\n\t// Setup storage for target texture and bind it to correct framebuffer\n\tfunction setupFrameBufferTexture( framebuffer, renderTarget, texture, attachment, textureTarget ) {\n\n\t\tconst glFormat = utils.convert( texture.format );\n\t\tconst glType = utils.convert( texture.type );\n\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );\n\n\t\tif ( textureTarget === 32879 || textureTarget === 35866 ) {\n\n\t\t\tstate.texImage3D( textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.depth, 0, glFormat, glType, null );\n\n\t\t} else {\n\n\t\t\tstate.texImage2D( textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null );\n\n\t\t}\n\n\t\tstate.bindFramebuffer( 36160, framebuffer );\n\t\t_gl.framebufferTexture2D( 36160, attachment, textureTarget, properties.get( texture ).__webglTexture, 0 );\n\t\tstate.bindFramebuffer( 36160, null );\n\n\t}\n\n\t// Setup storage for internal depth/stencil buffers and bind to correct framebuffer\n\tfunction setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) {\n\n\t\t_gl.bindRenderbuffer( 36161, renderbuffer );\n\n\t\tif ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {\n\n\t\t\tlet glInternalFormat = 33189;\n\n\t\t\tif ( isMultisample ) {\n\n\t\t\t\tconst depthTexture = renderTarget.depthTexture;\n\n\t\t\t\tif ( depthTexture && depthTexture.isDepthTexture ) {\n\n\t\t\t\t\tif ( depthTexture.type === FloatType ) {\n\n\t\t\t\t\t\tglInternalFormat = 36012;\n\n\t\t\t\t\t} else if ( depthTexture.type === UnsignedIntType ) {\n\n\t\t\t\t\t\tglInternalFormat = 33190;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\t_gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( 36161, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t\t_gl.framebufferRenderbuffer( 36160, 36096, 36161, renderbuffer );\n\n\t\t} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {\n\n\t\t\tif ( isMultisample ) {\n\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\t_gl.renderbufferStorageMultisample( 36161, samples, 35056, renderTarget.width, renderTarget.height );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( 36161, 34041, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\n\t\t\t_gl.framebufferRenderbuffer( 36160, 33306, 36161, renderbuffer );\n\n\t\t} else {\n\n\t\t\t// Use the first texture for MRT so far\n\t\t\tconst texture = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture[ 0 ] : renderTarget.texture;\n\n\t\t\tconst glFormat = utils.convert( texture.format );\n\t\t\tconst glType = utils.convert( texture.type );\n\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );\n\n\t\t\tif ( isMultisample ) {\n\n\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\n\t\t\t\t_gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.renderbufferStorage( 36161, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t}\n\n\t\t_gl.bindRenderbuffer( 36161, null );\n\n\t}\n\n\t// Setup resources for a Depth Texture for a FBO (needs an extension)\n\tfunction setupDepthTexture( framebuffer, renderTarget ) {\n\n\t\tconst isCube = ( renderTarget && renderTarget.isWebGLCubeRenderTarget );\n\t\tif ( isCube ) throw new Error( 'Depth Texture with cube render targets is not supported' );\n\n\t\tstate.bindFramebuffer( 36160, framebuffer );\n\n\t\tif ( ! ( renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture ) ) {\n\n\t\t\tthrow new Error( 'renderTarget.depthTexture must be an instance of THREE.DepthTexture' );\n\n\t\t}\n\n\t\t// upload an empty depth texture with framebuffer size\n\t\tif ( ! properties.get( renderTarget.depthTexture ).__webglTexture ||\n\t\t\t\trenderTarget.depthTexture.image.width !== renderTarget.width ||\n\t\t\t\trenderTarget.depthTexture.image.height !== renderTarget.height ) {\n\n\t\t\trenderTarget.depthTexture.image.width = renderTarget.width;\n\t\t\trenderTarget.depthTexture.image.height = renderTarget.height;\n\t\t\trenderTarget.depthTexture.needsUpdate = true;\n\n\t\t}\n\n\t\tsetTexture2D( renderTarget.depthTexture, 0 );\n\n\t\tconst webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;\n\n\t\tif ( renderTarget.depthTexture.format === DepthFormat ) {\n\n\t\t\t_gl.framebufferTexture2D( 36160, 36096, 3553, webglDepthTexture, 0 );\n\n\t\t} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {\n\n\t\t\t_gl.framebufferTexture2D( 36160, 33306, 3553, webglDepthTexture, 0 );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'Unknown depthTexture format' );\n\n\t\t}\n\n\t}\n\n\t// Setup GL resources for a non-texture depth buffer\n\tfunction setupDepthRenderbuffer( renderTarget ) {\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\n\t\tif ( renderTarget.depthTexture ) {\n\n\t\t\tif ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );\n\n\t\t\tsetupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );\n\n\t\t} else {\n\n\t\t\tif ( isCube ) {\n\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = [];\n\n\t\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\t\tstate.bindFramebuffer( 36160, renderTargetProperties.__webglFramebuffer[ i ] );\n\t\t\t\t\trenderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();\n\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget, false );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tstate.bindFramebuffer( 36160, renderTargetProperties.__webglFramebuffer );\n\t\t\t\trenderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();\n\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget, false );\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.bindFramebuffer( 36160, null );\n\n\t}\n\n\t// Set up GL resources for the render target\n\tfunction setupRenderTarget( renderTarget ) {\n\n\t\tconst texture = renderTarget.texture;\n\n\t\tconst renderTargetProperties = properties.get( renderTarget );\n\t\tconst textureProperties = properties.get( texture );\n\n\t\trenderTarget.addEventListener( 'dispose', onRenderTargetDispose );\n\n\t\tif ( renderTarget.isWebGLMultipleRenderTargets !== true ) {\n\n\t\t\ttextureProperties.__webglTexture = _gl.createTexture();\n\t\t\ttextureProperties.__version = texture.version;\n\t\t\tinfo.memory.textures ++;\n\n\t\t}\n\n\t\tconst isCube = ( renderTarget.isWebGLCubeRenderTarget === true );\n\t\tconst isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );\n\t\tconst isMultisample = ( renderTarget.isWebGLMultisampleRenderTarget === true );\n\t\tconst isRenderTarget3D = texture.isDataTexture3D || texture.isDataTexture2DArray;\n\t\tconst supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;\n\n\t\t// Handles WebGL2 RGBFormat fallback - #18858\n\n\t\tif ( isWebGL2 && texture.format === RGBFormat && ( texture.type === FloatType || texture.type === HalfFloatType ) ) {\n\n\t\t\ttexture.format = RGBAFormat;\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.' );\n\n\t\t}\n\n\t\t// Setup framebuffer\n\n\t\tif ( isCube ) {\n\n\t\t\trenderTargetProperties.__webglFramebuffer = [];\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer();\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\trenderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\n\n\t\t\tif ( isMultipleRenderTargets ) {\n\n\t\t\t\tif ( capabilities.drawBuffers ) {\n\n\t\t\t\t\tconst textures = renderTarget.texture;\n\n\t\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst attachmentProperties = properties.get( textures[ i ] );\n\n\t\t\t\t\t\tif ( attachmentProperties.__webglTexture === undefined ) {\n\n\t\t\t\t\t\t\tattachmentProperties.__webglTexture = _gl.createTexture();\n\n\t\t\t\t\t\t\tinfo.memory.textures ++;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.' );\n\n\t\t\t\t}\n\n\t\t\t} else if ( isMultisample ) {\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\trenderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();\n\t\t\t\t\trenderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer();\n\n\t\t\t\t\t_gl.bindRenderbuffer( 36161, renderTargetProperties.__webglColorRenderbuffer );\n\n\t\t\t\t\tconst glFormat = utils.convert( texture.format );\n\t\t\t\t\tconst glType = utils.convert( texture.type );\n\t\t\t\t\tconst glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );\n\t\t\t\t\tconst samples = getRenderTargetSamples( renderTarget );\n\t\t\t\t\t_gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );\n\n\t\t\t\t\tstate.bindFramebuffer( 36160, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\t\t_gl.framebufferRenderbuffer( 36160, 36064, 36161, renderTargetProperties.__webglColorRenderbuffer );\n\t\t\t\t\t_gl.bindRenderbuffer( 36161, null );\n\n\t\t\t\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\t\t\t\trenderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();\n\t\t\t\t\t\tsetupRenderBufferStorage( renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tstate.bindFramebuffer( 36160, null );\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Setup color buffer\n\n\t\tif ( isCube ) {\n\n\t\t\tstate.bindTexture( 34067, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( 34067, texture, supportsMips );\n\n\t\t\tfor ( let i = 0; i < 6; i ++ ) {\n\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, texture, 36064, 34069 + i );\n\n\t\t\t}\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( 34067, texture, renderTarget.width, renderTarget.height );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else if ( isMultipleRenderTargets ) {\n\n\t\t\tconst textures = renderTarget.texture;\n\n\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\tconst attachment = textures[ i ];\n\t\t\t\tconst attachmentProperties = properties.get( attachment );\n\n\t\t\t\tstate.bindTexture( 3553, attachmentProperties.__webglTexture );\n\t\t\t\tsetTextureParameters( 3553, attachment, supportsMips );\n\t\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, 36064 + i, 3553 );\n\n\t\t\t\tif ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {\n\n\t\t\t\t\tgenerateMipmap( 3553, attachment, renderTarget.width, renderTarget.height );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t} else {\n\n\t\t\tlet glTextureType = 3553;\n\n\t\t\tif ( isRenderTarget3D ) {\n\n\t\t\t\t// Render targets containing layers, i.e: Texture 3D and 2d arrays\n\n\t\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\t\tconst isTexture3D = texture.isDataTexture3D;\n\t\t\t\t\tglTextureType = isTexture3D ? 32879 : 35866;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.warn( 'THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tstate.bindTexture( glTextureType, textureProperties.__webglTexture );\n\t\t\tsetTextureParameters( glTextureType, texture, supportsMips );\n\t\t\tsetupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, texture, 36064, glTextureType );\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tgenerateMipmap( glTextureType, texture, renderTarget.width, renderTarget.height, renderTarget.depth );\n\n\t\t\t}\n\n\t\t\tstate.unbindTexture();\n\n\t\t}\n\n\t\t// Setup depth and stencil buffers\n\n\t\tif ( renderTarget.depthBuffer ) {\n\n\t\t\tsetupDepthRenderbuffer( renderTarget );\n\n\t\t}\n\n\t}\n\n\tfunction updateRenderTargetMipmap( renderTarget ) {\n\n\t\tconst supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;\n\n\t\tconst textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];\n\n\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\tconst texture = textures[ i ];\n\n\t\t\tif ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {\n\n\t\t\t\tconst target = renderTarget.isWebGLCubeRenderTarget ? 34067 : 3553;\n\t\t\t\tconst webglTexture = properties.get( texture ).__webglTexture;\n\n\t\t\t\tstate.bindTexture( target, webglTexture );\n\t\t\t\tgenerateMipmap( target, texture, renderTarget.width, renderTarget.height );\n\t\t\t\tstate.unbindTexture();\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction updateMultisampleRenderTarget( renderTarget ) {\n\n\t\tif ( renderTarget.isWebGLMultisampleRenderTarget ) {\n\n\t\t\tif ( isWebGL2 ) {\n\n\t\t\t\tconst width = renderTarget.width;\n\t\t\t\tconst height = renderTarget.height;\n\t\t\t\tlet mask = 16384;\n\n\t\t\t\tif ( renderTarget.depthBuffer ) mask |= 256;\n\t\t\t\tif ( renderTarget.stencilBuffer ) mask |= 1024;\n\n\t\t\t\tconst renderTargetProperties = properties.get( renderTarget );\n\n\t\t\t\tstate.bindFramebuffer( 36008, renderTargetProperties.__webglMultisampledFramebuffer );\n\t\t\t\tstate.bindFramebuffer( 36009, renderTargetProperties.__webglFramebuffer );\n\n\t\t\t\t_gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, 9728 );\n\n\t\t\t\tstate.bindFramebuffer( 36008, null );\n\t\t\t\tstate.bindFramebuffer( 36009, renderTargetProperties.__webglMultisampledFramebuffer );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.' );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction getRenderTargetSamples( renderTarget ) {\n\n\t\treturn ( isWebGL2 && renderTarget.isWebGLMultisampleRenderTarget ) ?\n\t\t\tMath.min( maxSamples, renderTarget.samples ) : 0;\n\n\t}\n\n\tfunction updateVideoTexture( texture ) {\n\n\t\tconst frame = info.render.frame;\n\n\t\t// Check the last frame we updated the VideoTexture\n\n\t\tif ( _videoTextures.get( texture ) !== frame ) {\n\n\t\t\t_videoTextures.set( texture, frame );\n\t\t\ttexture.update();\n\n\t\t}\n\n\t}\n\n\t// backwards compatibility\n\n\tlet warnedTexture2D = false;\n\tlet warnedTextureCube = false;\n\n\tfunction safeSetTexture2D( texture, slot ) {\n\n\t\tif ( texture && texture.isWebGLRenderTarget ) {\n\n\t\t\tif ( warnedTexture2D === false ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLTextures.safeSetTexture2D: don\\'t use render targets as textures. Use their .texture property instead.' );\n\t\t\t\twarnedTexture2D = true;\n\n\t\t\t}\n\n\t\t\ttexture = texture.texture;\n\n\t\t}\n\n\t\tsetTexture2D( texture, slot );\n\n\t}\n\n\tfunction safeSetTextureCube( texture, slot ) {\n\n\t\tif ( texture && texture.isWebGLCubeRenderTarget ) {\n\n\t\t\tif ( warnedTextureCube === false ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLTextures.safeSetTextureCube: don\\'t use cube render targets as textures. Use their .texture property instead.' );\n\t\t\t\twarnedTextureCube = true;\n\n\t\t\t}\n\n\t\t\ttexture = texture.texture;\n\n\t\t}\n\n\n\t\tsetTextureCube( texture, slot );\n\n\t}\n\n\t//\n\n\tthis.allocateTextureUnit = allocateTextureUnit;\n\tthis.resetTextureUnits = resetTextureUnits;\n\n\tthis.setTexture2D = setTexture2D;\n\tthis.setTexture2DArray = setTexture2DArray;\n\tthis.setTexture3D = setTexture3D;\n\tthis.setTextureCube = setTextureCube;\n\tthis.setupRenderTarget = setupRenderTarget;\n\tthis.updateRenderTargetMipmap = updateRenderTargetMipmap;\n\tthis.updateMultisampleRenderTarget = updateMultisampleRenderTarget;\n\n\tthis.safeSetTexture2D = safeSetTexture2D;\n\tthis.safeSetTextureCube = safeSetTextureCube;\n\n}\n\nfunction WebGLUtils( gl, extensions, capabilities ) {\n\n\tconst isWebGL2 = capabilities.isWebGL2;\n\n\tfunction convert( p ) {\n\n\t\tlet extension;\n\n\t\tif ( p === UnsignedByteType ) return 5121;\n\t\tif ( p === UnsignedShort4444Type ) return 32819;\n\t\tif ( p === UnsignedShort5551Type ) return 32820;\n\t\tif ( p === UnsignedShort565Type ) return 33635;\n\n\t\tif ( p === ByteType ) return 5120;\n\t\tif ( p === ShortType ) return 5122;\n\t\tif ( p === UnsignedShortType ) return 5123;\n\t\tif ( p === IntType ) return 5124;\n\t\tif ( p === UnsignedIntType ) return 5125;\n\t\tif ( p === FloatType ) return 5126;\n\n\t\tif ( p === HalfFloatType ) {\n\n\t\t\tif ( isWebGL2 ) return 5131;\n\n\t\t\textension = extensions.get( 'OES_texture_half_float' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.HALF_FLOAT_OES;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === AlphaFormat ) return 6406;\n\t\tif ( p === RGBFormat ) return 6407;\n\t\tif ( p === RGBAFormat ) return 6408;\n\t\tif ( p === LuminanceFormat ) return 6409;\n\t\tif ( p === LuminanceAlphaFormat ) return 6410;\n\t\tif ( p === DepthFormat ) return 6402;\n\t\tif ( p === DepthStencilFormat ) return 34041;\n\t\tif ( p === RedFormat ) return 6403;\n\n\t\t// WebGL2 formats.\n\n\t\tif ( p === RedIntegerFormat ) return 36244;\n\t\tif ( p === RGFormat ) return 33319;\n\t\tif ( p === RGIntegerFormat ) return 33320;\n\t\tif ( p === RGBIntegerFormat ) return 36248;\n\t\tif ( p === RGBAIntegerFormat ) return 36249;\n\n\t\tif ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format ||\n\t\t\tp === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\n\t\t\t\tif ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\n\t\t\t\tif ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n\t\t\t\tif ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format ||\n\t\t\tp === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\n\t\t\t\tif ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === RGB_ETC1_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc1' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.COMPRESSED_RGB_ETC1_WEBGL;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_etc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\tif ( p === RGB_ETC2_Format ) return extension.COMPRESSED_RGB8_ETC2;\n\t\t\t\tif ( p === RGBA_ETC2_EAC_Format ) return extension.COMPRESSED_RGBA8_ETC2_EAC;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format ||\n\t\t\tp === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format ||\n\t\t\tp === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format ||\n\t\t\tp === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format ||\n\t\t\tp === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ||\n\t\t\tp === SRGB8_ALPHA8_ASTC_4x4_Format || p === SRGB8_ALPHA8_ASTC_5x4_Format || p === SRGB8_ALPHA8_ASTC_5x5_Format ||\n\t\t\tp === SRGB8_ALPHA8_ASTC_6x5_Format || p === SRGB8_ALPHA8_ASTC_6x6_Format || p === SRGB8_ALPHA8_ASTC_8x5_Format ||\n\t\t\tp === SRGB8_ALPHA8_ASTC_8x6_Format || p === SRGB8_ALPHA8_ASTC_8x8_Format || p === SRGB8_ALPHA8_ASTC_10x5_Format ||\n\t\t\tp === SRGB8_ALPHA8_ASTC_10x6_Format || p === SRGB8_ALPHA8_ASTC_10x8_Format || p === SRGB8_ALPHA8_ASTC_10x10_Format ||\n\t\t\tp === SRGB8_ALPHA8_ASTC_12x10_Format || p === SRGB8_ALPHA8_ASTC_12x12_Format ) {\n\n\t\t\textension = extensions.get( 'WEBGL_compressed_texture_astc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\t// TODO Complete?\n\n\t\t\t\treturn p;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === RGBA_BPTC_Format ) {\n\n\t\t\textension = extensions.get( 'EXT_texture_compression_bptc' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\t// TODO Complete?\n\n\t\t\t\treturn p;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( p === UnsignedInt248Type ) {\n\n\t\t\tif ( isWebGL2 ) return 34042;\n\n\t\t\textension = extensions.get( 'WEBGL_depth_texture' );\n\n\t\t\tif ( extension !== null ) {\n\n\t\t\t\treturn extension.UNSIGNED_INT_24_8_WEBGL;\n\n\t\t\t} else {\n\n\t\t\t\treturn null;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn { convert: convert };\n\n}\n\nclass ArrayCamera extends PerspectiveCamera {\n\n\tconstructor( array = [] ) {\n\n\t\tsuper();\n\n\t\tthis.cameras = array;\n\n\t}\n\n}\n\nArrayCamera.prototype.isArrayCamera = true;\n\nclass Group extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'Group';\n\n\t}\n\n}\n\nGroup.prototype.isGroup = true;\n\nconst _moveEvent = { type: 'move' };\n\nclass WebXRController {\n\n\tconstructor() {\n\n\t\tthis._targetRay = null;\n\t\tthis._grip = null;\n\t\tthis._hand = null;\n\n\t}\n\n\tgetHandSpace() {\n\n\t\tif ( this._hand === null ) {\n\n\t\t\tthis._hand = new Group();\n\t\t\tthis._hand.matrixAutoUpdate = false;\n\t\t\tthis._hand.visible = false;\n\n\t\t\tthis._hand.joints = {};\n\t\t\tthis._hand.inputState = { pinching: false };\n\n\t\t}\n\n\t\treturn this._hand;\n\n\t}\n\n\tgetTargetRaySpace() {\n\n\t\tif ( this._targetRay === null ) {\n\n\t\t\tthis._targetRay = new Group();\n\t\t\tthis._targetRay.matrixAutoUpdate = false;\n\t\t\tthis._targetRay.visible = false;\n\t\t\tthis._targetRay.hasLinearVelocity = false;\n\t\t\tthis._targetRay.linearVelocity = new Vector3();\n\t\t\tthis._targetRay.hasAngularVelocity = false;\n\t\t\tthis._targetRay.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._targetRay;\n\n\t}\n\n\tgetGripSpace() {\n\n\t\tif ( this._grip === null ) {\n\n\t\t\tthis._grip = new Group();\n\t\t\tthis._grip.matrixAutoUpdate = false;\n\t\t\tthis._grip.visible = false;\n\t\t\tthis._grip.hasLinearVelocity = false;\n\t\t\tthis._grip.linearVelocity = new Vector3();\n\t\t\tthis._grip.hasAngularVelocity = false;\n\t\t\tthis._grip.angularVelocity = new Vector3();\n\n\t\t}\n\n\t\treturn this._grip;\n\n\t}\n\n\tdispatchEvent( event ) {\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.dispatchEvent( event );\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.dispatchEvent( event );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect( inputSource ) {\n\n\t\tthis.dispatchEvent( { type: 'disconnected', data: inputSource } );\n\n\t\tif ( this._targetRay !== null ) {\n\n\t\t\tthis._targetRay.visible = false;\n\n\t\t}\n\n\t\tif ( this._grip !== null ) {\n\n\t\t\tthis._grip.visible = false;\n\n\t\t}\n\n\t\tif ( this._hand !== null ) {\n\n\t\t\tthis._hand.visible = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tupdate( inputSource, frame, referenceSpace ) {\n\n\t\tlet inputPose = null;\n\t\tlet gripPose = null;\n\t\tlet handPose = null;\n\n\t\tconst targetRay = this._targetRay;\n\t\tconst grip = this._grip;\n\t\tconst hand = this._hand;\n\n\t\tif ( inputSource && frame.session.visibilityState !== 'visible-blurred' ) {\n\n\t\t\tif ( targetRay !== null ) {\n\n\t\t\t\tinputPose = frame.getPose( inputSource.targetRaySpace, referenceSpace );\n\n\t\t\t\tif ( inputPose !== null ) {\n\n\t\t\t\t\ttargetRay.matrix.fromArray( inputPose.transform.matrix );\n\t\t\t\t\ttargetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );\n\n\t\t\t\t\tif ( inputPose.linearVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = true;\n\t\t\t\t\t\ttargetRay.linearVelocity.copy( inputPose.linearVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasLinearVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( inputPose.angularVelocity ) {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = true;\n\t\t\t\t\t\ttargetRay.angularVelocity.copy( inputPose.angularVelocity );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttargetRay.hasAngularVelocity = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.dispatchEvent( _moveEvent );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( hand && inputSource.hand ) {\n\n\t\t\t\thandPose = true;\n\n\t\t\t\tfor ( const inputjoint of inputSource.hand.values() ) {\n\n\t\t\t\t\t// Update the joints groups with the XRJoint poses\n\t\t\t\t\tconst jointPose = frame.getJointPose( inputjoint, referenceSpace );\n\n\t\t\t\t\tif ( hand.joints[ inputjoint.jointName ] === undefined ) {\n\n\t\t\t\t\t\t// The transform of this joint will be updated with the joint pose on each frame\n\t\t\t\t\t\tconst joint = new Group();\n\t\t\t\t\t\tjoint.matrixAutoUpdate = false;\n\t\t\t\t\t\tjoint.visible = false;\n\t\t\t\t\t\thand.joints[ inputjoint.jointName ] = joint;\n\t\t\t\t\t\t// ??\n\t\t\t\t\t\thand.add( joint );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst joint = hand.joints[ inputjoint.jointName ];\n\n\t\t\t\t\tif ( jointPose !== null ) {\n\n\t\t\t\t\t\tjoint.matrix.fromArray( jointPose.transform.matrix );\n\t\t\t\t\t\tjoint.matrix.decompose( joint.position, joint.rotation, joint.scale );\n\t\t\t\t\t\tjoint.jointRadius = jointPose.radius;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tjoint.visible = jointPose !== null;\n\n\t\t\t\t}\n\n\t\t\t\t// Custom events\n\n\t\t\t\t// Check pinchz\n\t\t\t\tconst indexTip = hand.joints[ 'index-finger-tip' ];\n\t\t\t\tconst thumbTip = hand.joints[ 'thumb-tip' ];\n\t\t\t\tconst distance = indexTip.position.distanceTo( thumbTip.position );\n\n\t\t\t\tconst distanceToPinch = 0.02;\n\t\t\t\tconst threshold = 0.005;\n\n\t\t\t\tif ( hand.inputState.pinching && distance > distanceToPinch + threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = false;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchend',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t} else if ( ! hand.inputState.pinching && distance <= distanceToPinch - threshold ) {\n\n\t\t\t\t\thand.inputState.pinching = true;\n\t\t\t\t\tthis.dispatchEvent( {\n\t\t\t\t\t\ttype: 'pinchstart',\n\t\t\t\t\t\thandedness: inputSource.handedness,\n\t\t\t\t\t\ttarget: this\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( grip !== null && inputSource.gripSpace ) {\n\n\t\t\t\t\tgripPose = frame.getPose( inputSource.gripSpace, referenceSpace );\n\n\t\t\t\t\tif ( gripPose !== null ) {\n\n\t\t\t\t\t\tgrip.matrix.fromArray( gripPose.transform.matrix );\n\t\t\t\t\t\tgrip.matrix.decompose( grip.position, grip.rotation, grip.scale );\n\n\t\t\t\t\t\tif ( gripPose.linearVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = true;\n\t\t\t\t\t\t\tgrip.linearVelocity.copy( gripPose.linearVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasLinearVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( gripPose.angularVelocity ) {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = true;\n\t\t\t\t\t\t\tgrip.angularVelocity.copy( gripPose.angularVelocity );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tgrip.hasAngularVelocity = false;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( targetRay !== null ) {\n\n\t\t\ttargetRay.visible = ( inputPose !== null );\n\n\t\t}\n\n\t\tif ( grip !== null ) {\n\n\t\t\tgrip.visible = ( gripPose !== null );\n\n\t\t}\n\n\t\tif ( hand !== null ) {\n\n\t\t\thand.visible = ( handPose !== null );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass WebXRManager extends EventDispatcher {\n\n\tconstructor( renderer, gl ) {\n\n\t\tsuper();\n\n\t\tconst scope = this;\n\t\tconst state = renderer.state;\n\n\t\tlet session = null;\n\t\tlet framebufferScaleFactor = 1.0;\n\n\t\tlet referenceSpace = null;\n\t\tlet referenceSpaceType = 'local-floor';\n\n\t\tlet pose = null;\n\t\tlet glBinding = null;\n\t\tlet glFramebuffer = null;\n\t\tlet glProjLayer = null;\n\t\tlet glBaseLayer = null;\n\t\tlet isMultisample = false;\n\t\tlet glMultisampledFramebuffer = null;\n\t\tlet glColorRenderbuffer = null;\n\t\tlet glDepthRenderbuffer = null;\n\t\tlet xrFrame = null;\n\t\tlet depthStyle = null;\n\t\tlet clearStyle = null;\n\n\t\tconst controllers = [];\n\t\tconst inputSourcesMap = new Map();\n\n\t\t//\n\n\t\tconst cameraL = new PerspectiveCamera();\n\t\tcameraL.layers.enable( 1 );\n\t\tcameraL.viewport = new Vector4();\n\n\t\tconst cameraR = new PerspectiveCamera();\n\t\tcameraR.layers.enable( 2 );\n\t\tcameraR.viewport = new Vector4();\n\n\t\tconst cameras = [ cameraL, cameraR ];\n\n\t\tconst cameraVR = new ArrayCamera();\n\t\tcameraVR.layers.enable( 1 );\n\t\tcameraVR.layers.enable( 2 );\n\n\t\tlet _currentDepthNear = null;\n\t\tlet _currentDepthFar = null;\n\n\t\t//\n\n\t\tthis.cameraAutoUpdate = true;\n\t\tthis.enabled = false;\n\n\t\tthis.isPresenting = false;\n\n\t\tthis.getController = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getTargetRaySpace();\n\n\t\t};\n\n\t\tthis.getControllerGrip = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getGripSpace();\n\n\t\t};\n\n\t\tthis.getHand = function ( index ) {\n\n\t\t\tlet controller = controllers[ index ];\n\n\t\t\tif ( controller === undefined ) {\n\n\t\t\t\tcontroller = new WebXRController();\n\t\t\t\tcontrollers[ index ] = controller;\n\n\t\t\t}\n\n\t\t\treturn controller.getHandSpace();\n\n\t\t};\n\n\t\t//\n\n\t\tfunction onSessionEvent( event ) {\n\n\t\t\tconst controller = inputSourcesMap.get( event.inputSource );\n\n\t\t\tif ( controller ) {\n\n\t\t\t\tcontroller.dispatchEvent( { type: event.type, data: event.inputSource } );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction onSessionEnd() {\n\n\t\t\tinputSourcesMap.forEach( function ( controller, inputSource ) {\n\n\t\t\t\tcontroller.disconnect( inputSource );\n\n\t\t\t} );\n\n\t\t\tinputSourcesMap.clear();\n\n\t\t\t_currentDepthNear = null;\n\t\t\t_currentDepthFar = null;\n\n\t\t\t// restore framebuffer/rendering state\n\n\t\t\tstate.bindXRFramebuffer( null );\n\t\t\trenderer.setRenderTarget( renderer.getRenderTarget() );\n\n\t\t\tif ( glFramebuffer ) gl.deleteFramebuffer( glFramebuffer );\n\t\t\tif ( glMultisampledFramebuffer ) gl.deleteFramebuffer( glMultisampledFramebuffer );\n\t\t\tif ( glColorRenderbuffer ) gl.deleteRenderbuffer( glColorRenderbuffer );\n\t\t\tif ( glDepthRenderbuffer ) gl.deleteRenderbuffer( glDepthRenderbuffer );\n\t\t\tglFramebuffer = null;\n\t\t\tglMultisampledFramebuffer = null;\n\t\t\tglColorRenderbuffer = null;\n\t\t\tglDepthRenderbuffer = null;\n\t\t\tglBaseLayer = null;\n\t\t\tglProjLayer = null;\n\t\t\tglBinding = null;\n\t\t\tsession = null;\n\n\t\t\t//\n\n\t\t\tanimation.stop();\n\n\t\t\tscope.isPresenting = false;\n\n\t\t\tscope.dispatchEvent( { type: 'sessionend' } );\n\n\t\t}\n\n\t\tthis.setFramebufferScaleFactor = function ( value ) {\n\n\t\t\tframebufferScaleFactor = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change framebuffer scale while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.setReferenceSpaceType = function ( value ) {\n\n\t\t\treferenceSpaceType = value;\n\n\t\t\tif ( scope.isPresenting === true ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebXRManager: Cannot change reference space type while presenting.' );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getReferenceSpace = function () {\n\n\t\t\treturn referenceSpace;\n\n\t\t};\n\n\t\tthis.getBaseLayer = function () {\n\n\t\t\treturn glProjLayer !== null ? glProjLayer : glBaseLayer;\n\n\t\t};\n\n\t\tthis.getBinding = function () {\n\n\t\t\treturn glBinding;\n\n\t\t};\n\n\t\tthis.getFrame = function () {\n\n\t\t\treturn xrFrame;\n\n\t\t};\n\n\t\tthis.getSession = function () {\n\n\t\t\treturn session;\n\n\t\t};\n\n\t\tthis.setSession = async function ( value ) {\n\n\t\t\tsession = value;\n\n\t\t\tif ( session !== null ) {\n\n\t\t\t\tsession.addEventListener( 'select', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectstart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'selectend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeeze', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezestart', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'squeezeend', onSessionEvent );\n\t\t\t\tsession.addEventListener( 'end', onSessionEnd );\n\t\t\t\tsession.addEventListener( 'inputsourceschange', onInputSourcesChange );\n\n\t\t\t\tconst attributes = gl.getContextAttributes();\n\n\t\t\t\tif ( attributes.xrCompatible !== true ) {\n\n\t\t\t\t\tawait gl.makeXRCompatible();\n\n\t\t\t\t}\n\n\t\t\t\tif ( session.renderState.layers === undefined ) {\n\n\t\t\t\t\tconst layerInit = {\n\t\t\t\t\t\tantialias: attributes.antialias,\n\t\t\t\t\t\talpha: attributes.alpha,\n\t\t\t\t\t\tdepth: attributes.depth,\n\t\t\t\t\t\tstencil: attributes.stencil,\n\t\t\t\t\t\tframebufferScaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBaseLayer = new XRWebGLLayer( session, gl, layerInit );\n\n\t\t\t\t\tsession.updateRenderState( { baseLayer: glBaseLayer } );\n\n\t\t\t\t} else if ( gl instanceof WebGLRenderingContext ) {\n\n\t\t\t\t\t// Use old style webgl layer because we can't use MSAA\n\t\t\t\t\t// WebGL2 support.\n\n\t\t\t\t\tconst layerInit = {\n\t\t\t\t\t\tantialias: true,\n\t\t\t\t\t\talpha: attributes.alpha,\n\t\t\t\t\t\tdepth: attributes.depth,\n\t\t\t\t\t\tstencil: attributes.stencil,\n\t\t\t\t\t\tframebufferScaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBaseLayer = new XRWebGLLayer( session, gl, layerInit );\n\n\t\t\t\t\tsession.updateRenderState( { layers: [ glBaseLayer ] } );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tisMultisample = attributes.antialias;\n\t\t\t\t\tlet depthFormat = null;\n\n\n\t\t\t\t\tif ( attributes.depth ) {\n\n\t\t\t\t\t\tclearStyle = 256;\n\n\t\t\t\t\t\tif ( attributes.stencil ) clearStyle |= 1024;\n\n\t\t\t\t\t\tdepthStyle = attributes.stencil ? 33306 : 36096;\n\t\t\t\t\t\tdepthFormat = attributes.stencil ? 35056 : 33190;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst projectionlayerInit = {\n\t\t\t\t\t\tcolorFormat: attributes.alpha ? 32856 : 32849,\n\t\t\t\t\t\tdepthFormat: depthFormat,\n\t\t\t\t\t\tscaleFactor: framebufferScaleFactor\n\t\t\t\t\t};\n\n\t\t\t\t\tglBinding = new XRWebGLBinding( session, gl );\n\n\t\t\t\t\tglProjLayer = glBinding.createProjectionLayer( projectionlayerInit );\n\n\t\t\t\t\tglFramebuffer = gl.createFramebuffer();\n\n\t\t\t\t\tsession.updateRenderState( { layers: [ glProjLayer ] } );\n\n\t\t\t\t\tif ( isMultisample ) {\n\n\t\t\t\t\t\tglMultisampledFramebuffer = gl.createFramebuffer();\n\t\t\t\t\t\tglColorRenderbuffer = gl.createRenderbuffer();\n\t\t\t\t\t\tgl.bindRenderbuffer( 36161, glColorRenderbuffer );\n\t\t\t\t\t\tgl.renderbufferStorageMultisample(\n\t\t\t\t\t\t\t36161,\n\t\t\t\t\t\t\t4,\n\t\t\t\t\t\t\t32856,\n\t\t\t\t\t\t\tglProjLayer.textureWidth,\n\t\t\t\t\t\t\tglProjLayer.textureHeight );\n\t\t\t\t\t\tstate.bindFramebuffer( 36160, glMultisampledFramebuffer );\n\t\t\t\t\t\tgl.framebufferRenderbuffer( 36160, 36064, 36161, glColorRenderbuffer );\n\t\t\t\t\t\tgl.bindRenderbuffer( 36161, null );\n\n\t\t\t\t\t\tif ( depthFormat !== null ) {\n\n\t\t\t\t\t\t\tglDepthRenderbuffer = gl.createRenderbuffer();\n\t\t\t\t\t\t\tgl.bindRenderbuffer( 36161, glDepthRenderbuffer );\n\t\t\t\t\t\t\tgl.renderbufferStorageMultisample( 36161, 4, depthFormat, glProjLayer.textureWidth, glProjLayer.textureHeight );\n\t\t\t\t\t\t\tgl.framebufferRenderbuffer( 36160, depthStyle, 36161, glDepthRenderbuffer );\n\t\t\t\t\t\t\tgl.bindRenderbuffer( 36161, null );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstate.bindFramebuffer( 36160, null );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treferenceSpace = await session.requestReferenceSpace( referenceSpaceType );\n\n\t\t\t\tanimation.setContext( session );\n\t\t\t\tanimation.start();\n\n\t\t\t\tscope.isPresenting = true;\n\n\t\t\t\tscope.dispatchEvent( { type: 'sessionstart' } );\n\n\t\t\t}\n\n\t\t};\n\n\t\tfunction onInputSourcesChange( event ) {\n\n\t\t\tconst inputSources = session.inputSources;\n\n\t\t\t// Assign inputSources to available controllers\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tinputSourcesMap.set( inputSources[ i ], controllers[ i ] );\n\n\t\t\t}\n\n\t\t\t// Notify disconnected\n\n\t\t\tfor ( let i = 0; i < event.removed.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.removed[ i ];\n\t\t\t\tconst controller = inputSourcesMap.get( inputSource );\n\n\t\t\t\tif ( controller ) {\n\n\t\t\t\t\tcontroller.dispatchEvent( { type: 'disconnected', data: inputSource } );\n\t\t\t\t\tinputSourcesMap.delete( inputSource );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Notify connected\n\n\t\t\tfor ( let i = 0; i < event.added.length; i ++ ) {\n\n\t\t\t\tconst inputSource = event.added[ i ];\n\t\t\t\tconst controller = inputSourcesMap.get( inputSource );\n\n\t\t\t\tif ( controller ) {\n\n\t\t\t\t\tcontroller.dispatchEvent( { type: 'connected', data: inputSource } );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tconst cameraLPos = new Vector3();\n\t\tconst cameraRPos = new Vector3();\n\n\t\t/**\n\t\t * Assumes 2 cameras that are parallel and share an X-axis, and that\n\t\t * the cameras' projection and world matrices have already been set.\n\t\t * And that near and far planes are identical for both cameras.\n\t\t * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765\n\t\t */\n\t\tfunction setProjectionFromUnion( camera, cameraL, cameraR ) {\n\n\t\t\tcameraLPos.setFromMatrixPosition( cameraL.matrixWorld );\n\t\t\tcameraRPos.setFromMatrixPosition( cameraR.matrixWorld );\n\n\t\t\tconst ipd = cameraLPos.distanceTo( cameraRPos );\n\n\t\t\tconst projL = cameraL.projectionMatrix.elements;\n\t\t\tconst projR = cameraR.projectionMatrix.elements;\n\n\t\t\t// VR systems will have identical far and near planes, and\n\t\t\t// most likely identical top and bottom frustum extents.\n\t\t\t// Use the left camera for these values.\n\t\t\tconst near = projL[ 14 ] / ( projL[ 10 ] - 1 );\n\t\t\tconst far = projL[ 14 ] / ( projL[ 10 ] + 1 );\n\t\t\tconst topFov = ( projL[ 9 ] + 1 ) / projL[ 5 ];\n\t\t\tconst bottomFov = ( projL[ 9 ] - 1 ) / projL[ 5 ];\n\n\t\t\tconst leftFov = ( projL[ 8 ] - 1 ) / projL[ 0 ];\n\t\t\tconst rightFov = ( projR[ 8 ] + 1 ) / projR[ 0 ];\n\t\t\tconst left = near * leftFov;\n\t\t\tconst right = near * rightFov;\n\n\t\t\t// Calculate the new camera's position offset from the\n\t\t\t// left camera. xOffset should be roughly half `ipd`.\n\t\t\tconst zOffset = ipd / ( - leftFov + rightFov );\n\t\t\tconst xOffset = zOffset * - leftFov;\n\n\t\t\t// TODO: Better way to apply this offset?\n\t\t\tcameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.translateX( xOffset );\n\t\t\tcamera.translateZ( zOffset );\n\t\t\tcamera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t\t// Find the union of the frustum values of the cameras and scale\n\t\t\t// the values so that the near plane's position does not change in world space,\n\t\t\t// although must now be relative to the new union camera.\n\t\t\tconst near2 = near + zOffset;\n\t\t\tconst far2 = far + zOffset;\n\t\t\tconst left2 = left - xOffset;\n\t\t\tconst right2 = right + ( ipd - xOffset );\n\t\t\tconst top2 = topFov * far / far2 * near2;\n\t\t\tconst bottom2 = bottomFov * far / far2 * near2;\n\n\t\t\tcamera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );\n\n\t\t}\n\n\t\tfunction updateCamera( camera, parent ) {\n\n\t\t\tif ( parent === null ) {\n\n\t\t\t\tcamera.matrixWorld.copy( camera.matrix );\n\n\t\t\t} else {\n\n\t\t\t\tcamera.matrixWorld.multiplyMatrices( parent.matrixWorld, camera.matrix );\n\n\t\t\t}\n\n\t\t\tcamera.matrixWorldInverse.copy( camera.matrixWorld ).invert();\n\n\t\t}\n\n\t\tthis.updateCamera = function ( camera ) {\n\n\t\t\tif ( session === null ) return;\n\n\t\t\tcameraVR.near = cameraR.near = cameraL.near = camera.near;\n\t\t\tcameraVR.far = cameraR.far = cameraL.far = camera.far;\n\n\t\t\tif ( _currentDepthNear !== cameraVR.near || _currentDepthFar !== cameraVR.far ) {\n\n\t\t\t\t// Note that the new renderState won't apply until the next frame. See #18320\n\n\t\t\t\tsession.updateRenderState( {\n\t\t\t\t\tdepthNear: cameraVR.near,\n\t\t\t\t\tdepthFar: cameraVR.far\n\t\t\t\t} );\n\n\t\t\t\t_currentDepthNear = cameraVR.near;\n\t\t\t\t_currentDepthFar = cameraVR.far;\n\n\t\t\t}\n\n\t\t\tconst parent = camera.parent;\n\t\t\tconst cameras = cameraVR.cameras;\n\n\t\t\tupdateCamera( cameraVR, parent );\n\n\t\t\tfor ( let i = 0; i < cameras.length; i ++ ) {\n\n\t\t\t\tupdateCamera( cameras[ i ], parent );\n\n\t\t\t}\n\n\t\t\tcameraVR.matrixWorld.decompose( cameraVR.position, cameraVR.quaternion, cameraVR.scale );\n\n\t\t\t// update user camera and its children\n\n\t\t\tcamera.position.copy( cameraVR.position );\n\t\t\tcamera.quaternion.copy( cameraVR.quaternion );\n\t\t\tcamera.scale.copy( cameraVR.scale );\n\t\t\tcamera.matrix.copy( cameraVR.matrix );\n\t\t\tcamera.matrixWorld.copy( cameraVR.matrixWorld );\n\n\t\t\tconst children = camera.children;\n\n\t\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\t\tchildren[ i ].updateMatrixWorld( true );\n\n\t\t\t}\n\n\t\t\t// update projection matrix for proper view frustum culling\n\n\t\t\tif ( cameras.length === 2 ) {\n\n\t\t\t\tsetProjectionFromUnion( cameraVR, cameraL, cameraR );\n\n\t\t\t} else {\n\n\t\t\t\t// assume single camera setup (AR)\n\n\t\t\t\tcameraVR.projectionMatrix.copy( cameraL.projectionMatrix );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.getCamera = function () {\n\n\t\t\treturn cameraVR;\n\n\t\t};\n\n\t\tthis.getFoveation = function () {\n\n\t\t\tif ( glProjLayer !== null ) {\n\n\t\t\t\treturn glProjLayer.fixedFoveation;\n\n\t\t\t}\n\n\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\treturn glBaseLayer.fixedFoveation;\n\n\t\t\t}\n\n\t\t\treturn undefined;\n\n\t\t};\n\n\t\tthis.setFoveation = function ( foveation ) {\n\n\t\t\t// 0 = no foveation = full resolution\n\t\t\t// 1 = maximum foveation = the edges render at lower resolution\n\n\t\t\tif ( glProjLayer !== null ) {\n\n\t\t\t\tglProjLayer.fixedFoveation = foveation;\n\n\t\t\t}\n\n\t\t\tif ( glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined ) {\n\n\t\t\t\tglBaseLayer.fixedFoveation = foveation;\n\n\t\t\t}\n\n\t\t};\n\n\t\t// Animation Loop\n\n\t\tlet onAnimationFrameCallback = null;\n\n\t\tfunction onAnimationFrame( time, frame ) {\n\n\t\t\tpose = frame.getViewerPose( referenceSpace );\n\t\t\txrFrame = frame;\n\n\t\t\tif ( pose !== null ) {\n\n\t\t\t\tconst views = pose.views;\n\n\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\tstate.bindXRFramebuffer( glBaseLayer.framebuffer );\n\n\t\t\t\t}\n\n\t\t\t\tlet cameraVRNeedsUpdate = false;\n\n\t\t\t\t// check if it's necessary to rebuild cameraVR's camera list\n\n\t\t\t\tif ( views.length !== cameraVR.cameras.length ) {\n\n\t\t\t\t\tcameraVR.cameras.length = 0;\n\n\t\t\t\t\tcameraVRNeedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t\tfor ( let i = 0; i < views.length; i ++ ) {\n\n\t\t\t\t\tconst view = views[ i ];\n\n\t\t\t\t\tlet viewport = null;\n\n\t\t\t\t\tif ( glBaseLayer !== null ) {\n\n\t\t\t\t\t\tviewport = glBaseLayer.getViewport( view );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst glSubImage = glBinding.getViewSubImage( glProjLayer, view );\n\n\t\t\t\t\t\tstate.bindXRFramebuffer( glFramebuffer );\n\n\t\t\t\t\t\tif ( glSubImage.depthStencilTexture !== undefined ) {\n\n\t\t\t\t\t\t\tgl.framebufferTexture2D( 36160, depthStyle, 3553, glSubImage.depthStencilTexture, 0 );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgl.framebufferTexture2D( 36160, 36064, 3553, glSubImage.colorTexture, 0 );\n\n\t\t\t\t\t\tviewport = glSubImage.viewport;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst camera = cameras[ i ];\n\n\t\t\t\t\tcamera.matrix.fromArray( view.transform.matrix );\n\t\t\t\t\tcamera.projectionMatrix.fromArray( view.projectionMatrix );\n\t\t\t\t\tcamera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height );\n\n\t\t\t\t\tif ( i === 0 ) {\n\n\t\t\t\t\t\tcameraVR.matrix.copy( camera.matrix );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( cameraVRNeedsUpdate === true ) {\n\n\t\t\t\t\t\tcameraVR.cameras.push( camera );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( isMultisample ) {\n\n\t\t\t\t\tstate.bindXRFramebuffer( glMultisampledFramebuffer );\n\n\t\t\t\t\tif ( clearStyle !== null ) gl.clear( clearStyle );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tconst inputSources = session.inputSources;\n\n\t\t\tfor ( let i = 0; i < controllers.length; i ++ ) {\n\n\t\t\t\tconst controller = controllers[ i ];\n\t\t\t\tconst inputSource = inputSources[ i ];\n\n\t\t\t\tcontroller.update( inputSource, frame, referenceSpace );\n\n\t\t\t}\n\n\t\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );\n\n\t\t\tif ( isMultisample ) {\n\n\t\t\t\tconst width = glProjLayer.textureWidth;\n\t\t\t\tconst height = glProjLayer.textureHeight;\n\n\t\t\t\tstate.bindFramebuffer( 36008, glMultisampledFramebuffer );\n\t\t\t\tstate.bindFramebuffer( 36009, glFramebuffer );\n\t\t\t\t// Invalidate the depth here to avoid flush of the depth data to main memory.\n\t\t\t\tgl.invalidateFramebuffer( 36008, [ depthStyle ] );\n\t\t\t\tgl.invalidateFramebuffer( 36009, [ depthStyle ] );\n\t\t\t\tgl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, 16384, 9728 );\n\t\t\t\t// Invalidate the MSAA buffer because it's not needed anymore.\n\t\t\t\tgl.invalidateFramebuffer( 36008, [ 36064 ] );\n\t\t\t\tstate.bindFramebuffer( 36008, null );\n\t\t\t\tstate.bindFramebuffer( 36009, null );\n\n\t\t\t\tstate.bindFramebuffer( 36160, glMultisampledFramebuffer );\n\n\t\t\t}\n\n\t\t\txrFrame = null;\n\n\t\t}\n\n\t\tconst animation = new WebGLAnimation();\n\n\t\tanimation.setAnimationLoop( onAnimationFrame );\n\n\t\tthis.setAnimationLoop = function ( callback ) {\n\n\t\t\tonAnimationFrameCallback = callback;\n\n\t\t};\n\n\t\tthis.dispose = function () {};\n\n\t}\n\n}\n\nfunction WebGLMaterials( properties ) {\n\n\tfunction refreshFogUniforms( uniforms, fog ) {\n\n\t\tuniforms.fogColor.value.copy( fog.color );\n\n\t\tif ( fog.isFog ) {\n\n\t\t\tuniforms.fogNear.value = fog.near;\n\t\t\tuniforms.fogFar.value = fog.far;\n\n\t\t} else if ( fog.isFogExp2 ) {\n\n\t\t\tuniforms.fogDensity.value = fog.density;\n\n\t\t}\n\n\t}\n\n\tfunction refreshMaterialUniforms( uniforms, material, pixelRatio, height, transmissionRenderTarget ) {\n\n\t\tif ( material.isMeshBasicMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t} else if ( material.isMeshLambertMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsLambert( uniforms, material );\n\n\t\t} else if ( material.isMeshToonMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsToon( uniforms, material );\n\n\t\t} else if ( material.isMeshPhongMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsPhong( uniforms, material );\n\n\t\t} else if ( material.isMeshStandardMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\n\t\t\tif ( material.isMeshPhysicalMaterial ) {\n\n\t\t\t\trefreshUniformsPhysical( uniforms, material, transmissionRenderTarget );\n\n\t\t\t} else {\n\n\t\t\t\trefreshUniformsStandard( uniforms, material );\n\n\t\t\t}\n\n\t\t} else if ( material.isMeshMatcapMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsMatcap( uniforms, material );\n\n\t\t} else if ( material.isMeshDepthMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsDepth( uniforms, material );\n\n\t\t} else if ( material.isMeshDistanceMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsDistance( uniforms, material );\n\n\t\t} else if ( material.isMeshNormalMaterial ) {\n\n\t\t\trefreshUniformsCommon( uniforms, material );\n\t\t\trefreshUniformsNormal( uniforms, material );\n\n\t\t} else if ( material.isLineBasicMaterial ) {\n\n\t\t\trefreshUniformsLine( uniforms, material );\n\n\t\t\tif ( material.isLineDashedMaterial ) {\n\n\t\t\t\trefreshUniformsDash( uniforms, material );\n\n\t\t\t}\n\n\t\t} else if ( material.isPointsMaterial ) {\n\n\t\t\trefreshUniformsPoints( uniforms, material, pixelRatio, height );\n\n\t\t} else if ( material.isSpriteMaterial ) {\n\n\t\t\trefreshUniformsSprites( uniforms, material );\n\n\t\t} else if ( material.isShadowMaterial ) {\n\n\t\t\tuniforms.color.value.copy( material.color );\n\t\t\tuniforms.opacity.value = material.opacity;\n\n\t\t} else if ( material.isShaderMaterial ) {\n\n\t\t\tmaterial.uniformsNeedUpdate = false; // #15581\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsCommon( uniforms, material ) {\n\n\t\tuniforms.opacity.value = material.opacity;\n\n\t\tif ( material.color ) {\n\n\t\t\tuniforms.diffuse.value.copy( material.color );\n\n\t\t}\n\n\t\tif ( material.emissive ) {\n\n\t\t\tuniforms.emissive.value.copy( material.emissive ).multiplyScalar( material.emissiveIntensity );\n\n\t\t}\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t}\n\n\t\tif ( material.specularMap ) {\n\n\t\t\tuniforms.specularMap.value = material.specularMap;\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t\tconst envMap = properties.get( material ).envMap;\n\n\t\tif ( envMap ) {\n\n\t\t\tuniforms.envMap.value = envMap;\n\n\t\t\tuniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;\n\n\t\t\tuniforms.reflectivity.value = material.reflectivity;\n\t\t\tuniforms.ior.value = material.ior;\n\t\t\tuniforms.refractionRatio.value = material.refractionRatio;\n\n\t\t\tconst maxMipLevel = properties.get( envMap ).__maxMipLevel;\n\n\t\t\tif ( maxMipLevel !== undefined ) {\n\n\t\t\t\tuniforms.maxMipLevel.value = maxMipLevel;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.lightMap ) {\n\n\t\t\tuniforms.lightMap.value = material.lightMap;\n\t\t\tuniforms.lightMapIntensity.value = material.lightMapIntensity;\n\n\t\t}\n\n\t\tif ( material.aoMap ) {\n\n\t\t\tuniforms.aoMap.value = material.aoMap;\n\t\t\tuniforms.aoMapIntensity.value = material.aoMapIntensity;\n\n\t\t}\n\n\t\t// uv repeat and offset setting priorities\n\t\t// 1. color map\n\t\t// 2. specular map\n\t\t// 3. displacementMap map\n\t\t// 4. normal map\n\t\t// 5. bump map\n\t\t// 6. roughnessMap map\n\t\t// 7. metalnessMap map\n\t\t// 8. alphaMap map\n\t\t// 9. emissiveMap map\n\t\t// 10. clearcoat map\n\t\t// 11. clearcoat normal map\n\t\t// 12. clearcoat roughnessMap map\n\t\t// 13. specular intensity map\n\t\t// 14. specular tint map\n\t\t// 15. transmission map\n\t\t// 16. thickness map\n\n\t\tlet uvScaleMap;\n\n\t\tif ( material.map ) {\n\n\t\t\tuvScaleMap = material.map;\n\n\t\t} else if ( material.specularMap ) {\n\n\t\t\tuvScaleMap = material.specularMap;\n\n\t\t} else if ( material.displacementMap ) {\n\n\t\t\tuvScaleMap = material.displacementMap;\n\n\t\t} else if ( material.normalMap ) {\n\n\t\t\tuvScaleMap = material.normalMap;\n\n\t\t} else if ( material.bumpMap ) {\n\n\t\t\tuvScaleMap = material.bumpMap;\n\n\t\t} else if ( material.roughnessMap ) {\n\n\t\t\tuvScaleMap = material.roughnessMap;\n\n\t\t} else if ( material.metalnessMap ) {\n\n\t\t\tuvScaleMap = material.metalnessMap;\n\n\t\t} else if ( material.alphaMap ) {\n\n\t\t\tuvScaleMap = material.alphaMap;\n\n\t\t} else if ( material.emissiveMap ) {\n\n\t\t\tuvScaleMap = material.emissiveMap;\n\n\t\t} else if ( material.clearcoatMap ) {\n\n\t\t\tuvScaleMap = material.clearcoatMap;\n\n\t\t} else if ( material.clearcoatNormalMap ) {\n\n\t\t\tuvScaleMap = material.clearcoatNormalMap;\n\n\t\t} else if ( material.clearcoatRoughnessMap ) {\n\n\t\t\tuvScaleMap = material.clearcoatRoughnessMap;\n\n\t\t} else if ( material.specularIntensityMap ) {\n\n\t\t\tuvScaleMap = material.specularIntensityMap;\n\n\t\t} else if ( material.specularColorMap ) {\n\n\t\t\tuvScaleMap = material.specularColorMap;\n\n\t\t} else if ( material.transmissionMap ) {\n\n\t\t\tuvScaleMap = material.transmissionMap;\n\n\t\t} else if ( material.thicknessMap ) {\n\n\t\t\tuvScaleMap = material.thicknessMap;\n\n\t\t} else if ( material.sheenColorMap ) {\n\n\t\t\tuvScaleMap = material.sheenColorMap;\n\n\t\t} else if ( material.sheenRoughnessMap ) {\n\n\t\t\tuvScaleMap = material.sheenRoughnessMap;\n\n\t\t}\n\n\t\tif ( uvScaleMap !== undefined ) {\n\n\t\t\t// backwards compatibility\n\t\t\tif ( uvScaleMap.isWebGLRenderTarget ) {\n\n\t\t\t\tuvScaleMap = uvScaleMap.texture;\n\n\t\t\t}\n\n\t\t\tif ( uvScaleMap.matrixAutoUpdate === true ) {\n\n\t\t\t\tuvScaleMap.updateMatrix();\n\n\t\t\t}\n\n\t\t\tuniforms.uvTransform.value.copy( uvScaleMap.matrix );\n\n\t\t}\n\n\t\t// uv repeat and offset setting priorities for uv2\n\t\t// 1. ao map\n\t\t// 2. light map\n\n\t\tlet uv2ScaleMap;\n\n\t\tif ( material.aoMap ) {\n\n\t\t\tuv2ScaleMap = material.aoMap;\n\n\t\t} else if ( material.lightMap ) {\n\n\t\t\tuv2ScaleMap = material.lightMap;\n\n\t\t}\n\n\t\tif ( uv2ScaleMap !== undefined ) {\n\n\t\t\t// backwards compatibility\n\t\t\tif ( uv2ScaleMap.isWebGLRenderTarget ) {\n\n\t\t\t\tuv2ScaleMap = uv2ScaleMap.texture;\n\n\t\t\t}\n\n\t\t\tif ( uv2ScaleMap.matrixAutoUpdate === true ) {\n\n\t\t\t\tuv2ScaleMap.updateMatrix();\n\n\t\t\t}\n\n\t\t\tuniforms.uv2Transform.value.copy( uv2ScaleMap.matrix );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsLine( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\n\t}\n\n\tfunction refreshUniformsDash( uniforms, material ) {\n\n\t\tuniforms.dashSize.value = material.dashSize;\n\t\tuniforms.totalSize.value = material.dashSize + material.gapSize;\n\t\tuniforms.scale.value = material.scale;\n\n\t}\n\n\tfunction refreshUniformsPoints( uniforms, material, pixelRatio, height ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.size.value = material.size * pixelRatio;\n\t\tuniforms.scale.value = height * 0.5;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t\t// uv repeat and offset setting priorities\n\t\t// 1. color map\n\t\t// 2. alpha map\n\n\t\tlet uvScaleMap;\n\n\t\tif ( material.map ) {\n\n\t\t\tuvScaleMap = material.map;\n\n\t\t} else if ( material.alphaMap ) {\n\n\t\t\tuvScaleMap = material.alphaMap;\n\n\t\t}\n\n\t\tif ( uvScaleMap !== undefined ) {\n\n\t\t\tif ( uvScaleMap.matrixAutoUpdate === true ) {\n\n\t\t\t\tuvScaleMap.updateMatrix();\n\n\t\t\t}\n\n\t\t\tuniforms.uvTransform.value.copy( uvScaleMap.matrix );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsSprites( uniforms, material ) {\n\n\t\tuniforms.diffuse.value.copy( material.color );\n\t\tuniforms.opacity.value = material.opacity;\n\t\tuniforms.rotation.value = material.rotation;\n\n\t\tif ( material.map ) {\n\n\t\t\tuniforms.map.value = material.map;\n\n\t\t}\n\n\t\tif ( material.alphaMap ) {\n\n\t\t\tuniforms.alphaMap.value = material.alphaMap;\n\n\t\t}\n\n\t\tif ( material.alphaTest > 0 ) {\n\n\t\t\tuniforms.alphaTest.value = material.alphaTest;\n\n\t\t}\n\n\t\t// uv repeat and offset setting priorities\n\t\t// 1. color map\n\t\t// 2. alpha map\n\n\t\tlet uvScaleMap;\n\n\t\tif ( material.map ) {\n\n\t\t\tuvScaleMap = material.map;\n\n\t\t} else if ( material.alphaMap ) {\n\n\t\t\tuvScaleMap = material.alphaMap;\n\n\t\t}\n\n\t\tif ( uvScaleMap !== undefined ) {\n\n\t\t\tif ( uvScaleMap.matrixAutoUpdate === true ) {\n\n\t\t\t\tuvScaleMap.updateMatrix();\n\n\t\t\t}\n\n\t\t\tuniforms.uvTransform.value.copy( uvScaleMap.matrix );\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsLambert( uniforms, material ) {\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhong( uniforms, material ) {\n\n\t\tuniforms.specular.value.copy( material.specular );\n\t\tuniforms.shininess.value = Math.max( material.shininess, 1e-4 ); // to prevent pow( 0.0, 0.0 )\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\t\t\tif ( material.side === BackSide ) uniforms.bumpScale.value *= - 1;\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\t\t\tif ( material.side === BackSide ) uniforms.normalScale.value.negate();\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsToon( uniforms, material ) {\n\n\t\tif ( material.gradientMap ) {\n\n\t\t\tuniforms.gradientMap.value = material.gradientMap;\n\n\t\t}\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\t\t\tif ( material.side === BackSide ) uniforms.bumpScale.value *= - 1;\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\t\t\tif ( material.side === BackSide ) uniforms.normalScale.value.negate();\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsStandard( uniforms, material ) {\n\n\t\tuniforms.roughness.value = material.roughness;\n\t\tuniforms.metalness.value = material.metalness;\n\n\t\tif ( material.roughnessMap ) {\n\n\t\t\tuniforms.roughnessMap.value = material.roughnessMap;\n\n\t\t}\n\n\t\tif ( material.metalnessMap ) {\n\n\t\t\tuniforms.metalnessMap.value = material.metalnessMap;\n\n\t\t}\n\n\t\tif ( material.emissiveMap ) {\n\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\t\t\tif ( material.side === BackSide ) uniforms.bumpScale.value *= - 1;\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\t\t\tif ( material.side === BackSide ) uniforms.normalScale.value.negate();\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t\tconst envMap = properties.get( material ).envMap;\n\n\t\tif ( envMap ) {\n\n\t\t\t//uniforms.envMap.value = material.envMap; // part of uniforms common\n\t\t\tuniforms.envMapIntensity.value = material.envMapIntensity;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsPhysical( uniforms, material, transmissionRenderTarget ) {\n\n\t\trefreshUniformsStandard( uniforms, material );\n\n\t\tuniforms.ior.value = material.ior; // also part of uniforms common\n\n\t\tif ( material.sheen > 0 ) {\n\n\t\t\tuniforms.sheenColor.value.copy( material.sheenColor ).multiplyScalar( material.sheen );\n\n\t\t\tuniforms.sheenRoughness.value = material.sheenRoughness;\n\n\t\t\tif ( material.sheenColorMap ) {\n\n\t\t\t\tuniforms.sheenColorMap.value = material.sheenColorMap;\n\n\t\t\t}\n\n\t\t\tif ( material.sheenRoughnessMap ) {\n\n\t\t\t\tuniforms.sheenRoughnessMap.value = material.sheenRoughnessMap;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.clearcoat > 0 ) {\n\n\t\t\tuniforms.clearcoat.value = material.clearcoat;\n\t\t\tuniforms.clearcoatRoughness.value = material.clearcoatRoughness;\n\n\t\t\tif ( material.clearcoatMap ) {\n\n\t\t\t\tuniforms.clearcoatMap.value = material.clearcoatMap;\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatRoughnessMap ) {\n\n\t\t\t\tuniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;\n\n\t\t\t}\n\n\t\t\tif ( material.clearcoatNormalMap ) {\n\n\t\t\t\tuniforms.clearcoatNormalScale.value.copy( material.clearcoatNormalScale );\n\t\t\t\tuniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;\n\n\t\t\t\tif ( material.side === BackSide ) {\n\n\t\t\t\t\tuniforms.clearcoatNormalScale.value.negate();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( material.transmission > 0 ) {\n\n\t\t\tuniforms.transmission.value = material.transmission;\n\t\t\tuniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;\n\t\t\tuniforms.transmissionSamplerSize.value.set( transmissionRenderTarget.width, transmissionRenderTarget.height );\n\n\t\t\tif ( material.transmissionMap ) {\n\n\t\t\t\tuniforms.transmissionMap.value = material.transmissionMap;\n\n\t\t\t}\n\n\t\t\tuniforms.thickness.value = material.thickness;\n\n\t\t\tif ( material.thicknessMap ) {\n\n\t\t\t\tuniforms.thicknessMap.value = material.thicknessMap;\n\n\t\t\t}\n\n\t\t\tuniforms.attenuationDistance.value = material.attenuationDistance;\n\t\t\tuniforms.attenuationColor.value.copy( material.attenuationColor );\n\n\t\t}\n\n\t\tuniforms.specularIntensity.value = material.specularIntensity;\n\t\tuniforms.specularColor.value.copy( material.specularColor );\n\n\t\tif ( material.specularIntensityMap ) {\n\n\t\t\tuniforms.specularIntensityMap.value = material.specularIntensityMap;\n\n\t\t}\n\n\t\tif ( material.specularColorMap ) {\n\n\t\t\tuniforms.specularColorMap.value = material.specularColorMap;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsMatcap( uniforms, material ) {\n\n\t\tif ( material.matcap ) {\n\n\t\t\tuniforms.matcap.value = material.matcap;\n\n\t\t}\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\t\t\tif ( material.side === BackSide ) uniforms.bumpScale.value *= - 1;\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\t\t\tif ( material.side === BackSide ) uniforms.normalScale.value.negate();\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDepth( uniforms, material ) {\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t}\n\n\tfunction refreshUniformsDistance( uniforms, material ) {\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t\tuniforms.referencePosition.value.copy( material.referencePosition );\n\t\tuniforms.nearDistance.value = material.nearDistance;\n\t\tuniforms.farDistance.value = material.farDistance;\n\n\t}\n\n\tfunction refreshUniformsNormal( uniforms, material ) {\n\n\t\tif ( material.bumpMap ) {\n\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\n\t\t\tif ( material.side === BackSide ) uniforms.bumpScale.value *= - 1;\n\n\t\t}\n\n\t\tif ( material.normalMap ) {\n\n\t\t\tuniforms.normalMap.value = material.normalMap;\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\n\t\t\tif ( material.side === BackSide ) uniforms.normalScale.value.negate();\n\n\t\t}\n\n\t\tif ( material.displacementMap ) {\n\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\n\n\t\t}\n\n\t}\n\n\treturn {\n\t\trefreshFogUniforms: refreshFogUniforms,\n\t\trefreshMaterialUniforms: refreshMaterialUniforms\n\t};\n\n}\n\nfunction createCanvasElement() {\n\n\tconst canvas = createElementNS( 'canvas' );\n\tcanvas.style.display = 'block';\n\treturn canvas;\n\n}\n\nfunction WebGLRenderer( parameters = {} ) {\n\n\tconst _canvas = parameters.canvas !== undefined ? parameters.canvas : createCanvasElement(),\n\t\t_context = parameters.context !== undefined ? parameters.context : null,\n\n\t\t_alpha = parameters.alpha !== undefined ? parameters.alpha : false,\n\t\t_depth = parameters.depth !== undefined ? parameters.depth : true,\n\t\t_stencil = parameters.stencil !== undefined ? parameters.stencil : true,\n\t\t_antialias = parameters.antialias !== undefined ? parameters.antialias : false,\n\t\t_premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true,\n\t\t_preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false,\n\t\t_powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default',\n\t\t_failIfMajorPerformanceCaveat = parameters.failIfMajorPerformanceCaveat !== undefined ? parameters.failIfMajorPerformanceCaveat : false;\n\n\tlet currentRenderList = null;\n\tlet currentRenderState = null;\n\n\t// render() can be called from within a callback triggered by another render.\n\t// We track this so that the nested render call gets its list and state isolated from the parent render call.\n\n\tconst renderListStack = [];\n\tconst renderStateStack = [];\n\n\t// public properties\n\n\tthis.domElement = _canvas;\n\n\t// Debug configuration container\n\tthis.debug = {\n\n\t\t/**\n\t\t * Enables error checking and reporting when shader programs are being compiled\n\t\t * @type {boolean}\n\t\t */\n\t\tcheckShaderErrors: true\n\t};\n\n\t// clearing\n\n\tthis.autoClear = true;\n\tthis.autoClearColor = true;\n\tthis.autoClearDepth = true;\n\tthis.autoClearStencil = true;\n\n\t// scene graph\n\n\tthis.sortObjects = true;\n\n\t// user-defined clipping\n\n\tthis.clippingPlanes = [];\n\tthis.localClippingEnabled = false;\n\n\t// physically based shading\n\n\tthis.gammaFactor = 2.0;\t// for backwards compatibility\n\tthis.outputEncoding = LinearEncoding;\n\n\t// physical lights\n\n\tthis.physicallyCorrectLights = false;\n\n\t// tone mapping\n\n\tthis.toneMapping = NoToneMapping;\n\tthis.toneMappingExposure = 1.0;\n\n\t// internal properties\n\n\tconst _this = this;\n\n\tlet _isContextLost = false;\n\n\t// internal state cache\n\n\tlet _currentActiveCubeFace = 0;\n\tlet _currentActiveMipmapLevel = 0;\n\tlet _currentRenderTarget = null;\n\tlet _currentMaterialId = - 1;\n\n\tlet _currentCamera = null;\n\n\tconst _currentViewport = new Vector4();\n\tconst _currentScissor = new Vector4();\n\tlet _currentScissorTest = null;\n\n\t//\n\n\tlet _width = _canvas.width;\n\tlet _height = _canvas.height;\n\n\tlet _pixelRatio = 1;\n\tlet _opaqueSort = null;\n\tlet _transparentSort = null;\n\n\tconst _viewport = new Vector4( 0, 0, _width, _height );\n\tconst _scissor = new Vector4( 0, 0, _width, _height );\n\tlet _scissorTest = false;\n\n\t//\n\n\tconst _currentDrawBuffers = [];\n\n\t// frustum\n\n\tconst _frustum = new Frustum();\n\n\t// clipping\n\n\tlet _clippingEnabled = false;\n\tlet _localClippingEnabled = false;\n\n\t// transmission\n\n\tlet _transmissionRenderTarget = null;\n\n\t// camera matrices cache\n\n\tconst _projScreenMatrix = new Matrix4();\n\n\tconst _vector3 = new Vector3();\n\n\tconst _emptyScene = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };\n\n\tfunction getTargetPixelRatio() {\n\n\t\treturn _currentRenderTarget === null ? _pixelRatio : 1;\n\n\t}\n\n\t// initialize\n\n\tlet _gl = _context;\n\n\tfunction getContext( contextNames, contextAttributes ) {\n\n\t\tfor ( let i = 0; i < contextNames.length; i ++ ) {\n\n\t\t\tconst contextName = contextNames[ i ];\n\t\t\tconst context = _canvas.getContext( contextName, contextAttributes );\n\t\t\tif ( context !== null ) return context;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\ttry {\n\n\t\tconst contextAttributes = {\n\t\t\talpha: _alpha,\n\t\t\tdepth: _depth,\n\t\t\tstencil: _stencil,\n\t\t\tantialias: _antialias,\n\t\t\tpremultipliedAlpha: _premultipliedAlpha,\n\t\t\tpreserveDrawingBuffer: _preserveDrawingBuffer,\n\t\t\tpowerPreference: _powerPreference,\n\t\t\tfailIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat\n\t\t};\n\n\t\t// event listeners must be registered before WebGL context is created, see #12753\n\n\t\t_canvas.addEventListener( 'webglcontextlost', onContextLost, false );\n\t\t_canvas.addEventListener( 'webglcontextrestored', onContextRestore, false );\n\n\t\tif ( _gl === null ) {\n\n\t\t\tconst contextNames = [ 'webgl2', 'webgl', 'experimental-webgl' ];\n\n\t\t\tif ( _this.isWebGL1Renderer === true ) {\n\n\t\t\t\tcontextNames.shift();\n\n\t\t\t}\n\n\t\t\t_gl = getContext( contextNames, contextAttributes );\n\n\t\t\tif ( _gl === null ) {\n\n\t\t\t\tif ( getContext( contextNames ) ) {\n\n\t\t\t\t\tthrow new Error( 'Error creating WebGL context with your selected attributes.' );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( 'Error creating WebGL context.' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Some experimental-webgl implementations do not have getShaderPrecisionFormat\n\n\t\tif ( _gl.getShaderPrecisionFormat === undefined ) {\n\n\t\t\t_gl.getShaderPrecisionFormat = function () {\n\n\t\t\t\treturn { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 };\n\n\t\t\t};\n\n\t\t}\n\n\t} catch ( error ) {\n\n\t\tconsole.error( 'THREE.WebGLRenderer: ' + error.message );\n\t\tthrow error;\n\n\t}\n\n\tlet extensions, capabilities, state, info;\n\tlet properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;\n\tlet programCache, materials, renderLists, renderStates, clipping, shadowMap;\n\n\tlet background, morphtargets, bufferRenderer, indexedBufferRenderer;\n\n\tlet utils, bindingStates;\n\n\tfunction initGLContext() {\n\n\t\textensions = new WebGLExtensions( _gl );\n\n\t\tcapabilities = new WebGLCapabilities( _gl, extensions, parameters );\n\n\t\textensions.init( capabilities );\n\n\t\tutils = new WebGLUtils( _gl, extensions, capabilities );\n\n\t\tstate = new WebGLState( _gl, extensions, capabilities );\n\n\t\t_currentDrawBuffers[ 0 ] = 1029;\n\n\t\tinfo = new WebGLInfo( _gl );\n\t\tproperties = new WebGLProperties();\n\t\ttextures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );\n\t\tcubemaps = new WebGLCubeMaps( _this );\n\t\tcubeuvmaps = new WebGLCubeUVMaps( _this );\n\t\tattributes = new WebGLAttributes( _gl, capabilities );\n\t\tbindingStates = new WebGLBindingStates( _gl, extensions, attributes, capabilities );\n\t\tgeometries = new WebGLGeometries( _gl, attributes, info, bindingStates );\n\t\tobjects = new WebGLObjects( _gl, geometries, attributes, info );\n\t\tmorphtargets = new WebGLMorphtargets( _gl, capabilities, textures );\n\t\tclipping = new WebGLClipping( properties );\n\t\tprogramCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );\n\t\tmaterials = new WebGLMaterials( properties );\n\t\trenderLists = new WebGLRenderLists( properties );\n\t\trenderStates = new WebGLRenderStates( extensions, capabilities );\n\t\tbackground = new WebGLBackground( _this, cubemaps, state, objects, _premultipliedAlpha );\n\t\tshadowMap = new WebGLShadowMap( _this, objects, capabilities );\n\n\t\tbufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );\n\t\tindexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info, capabilities );\n\n\t\tinfo.programs = programCache.programs;\n\n\t\t_this.capabilities = capabilities;\n\t\t_this.extensions = extensions;\n\t\t_this.properties = properties;\n\t\t_this.renderLists = renderLists;\n\t\t_this.shadowMap = shadowMap;\n\t\t_this.state = state;\n\t\t_this.info = info;\n\n\t}\n\n\tinitGLContext();\n\n\t// xr\n\n\tconst xr = new WebXRManager( _this, _gl );\n\n\tthis.xr = xr;\n\n\t// API\n\n\tthis.getContext = function () {\n\n\t\treturn _gl;\n\n\t};\n\n\tthis.getContextAttributes = function () {\n\n\t\treturn _gl.getContextAttributes();\n\n\t};\n\n\tthis.forceContextLoss = function () {\n\n\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\tif ( extension ) extension.loseContext();\n\n\t};\n\n\tthis.forceContextRestore = function () {\n\n\t\tconst extension = extensions.get( 'WEBGL_lose_context' );\n\t\tif ( extension ) extension.restoreContext();\n\n\t};\n\n\tthis.getPixelRatio = function () {\n\n\t\treturn _pixelRatio;\n\n\t};\n\n\tthis.setPixelRatio = function ( value ) {\n\n\t\tif ( value === undefined ) return;\n\n\t\t_pixelRatio = value;\n\n\t\tthis.setSize( _width, _height, false );\n\n\t};\n\n\tthis.getSize = function ( target ) {\n\n\t\treturn target.set( _width, _height );\n\n\t};\n\n\tthis.setSize = function ( width, height, updateStyle ) {\n\n\t\tif ( xr.isPresenting ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: Can\\'t change size while VR device is presenting.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\t_width = width;\n\t\t_height = height;\n\n\t\t_canvas.width = Math.floor( width * _pixelRatio );\n\t\t_canvas.height = Math.floor( height * _pixelRatio );\n\n\t\tif ( updateStyle !== false ) {\n\n\t\t\t_canvas.style.width = width + 'px';\n\t\t\t_canvas.style.height = height + 'px';\n\n\t\t}\n\n\t\tthis.setViewport( 0, 0, width, height );\n\n\t};\n\n\tthis.getDrawingBufferSize = function ( target ) {\n\n\t\treturn target.set( _width * _pixelRatio, _height * _pixelRatio ).floor();\n\n\t};\n\n\tthis.setDrawingBufferSize = function ( width, height, pixelRatio ) {\n\n\t\t_width = width;\n\t\t_height = height;\n\n\t\t_pixelRatio = pixelRatio;\n\n\t\t_canvas.width = Math.floor( width * pixelRatio );\n\t\t_canvas.height = Math.floor( height * pixelRatio );\n\n\t\tthis.setViewport( 0, 0, width, height );\n\n\t};\n\n\tthis.getCurrentViewport = function ( target ) {\n\n\t\treturn target.copy( _currentViewport );\n\n\t};\n\n\tthis.getViewport = function ( target ) {\n\n\t\treturn target.copy( _viewport );\n\n\t};\n\n\tthis.setViewport = function ( x, y, width, height ) {\n\n\t\tif ( x.isVector4 ) {\n\n\t\t\t_viewport.set( x.x, x.y, x.z, x.w );\n\n\t\t} else {\n\n\t\t\t_viewport.set( x, y, width, height );\n\n\t\t}\n\n\t\tstate.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );\n\n\t};\n\n\tthis.getScissor = function ( target ) {\n\n\t\treturn target.copy( _scissor );\n\n\t};\n\n\tthis.setScissor = function ( x, y, width, height ) {\n\n\t\tif ( x.isVector4 ) {\n\n\t\t\t_scissor.set( x.x, x.y, x.z, x.w );\n\n\t\t} else {\n\n\t\t\t_scissor.set( x, y, width, height );\n\n\t\t}\n\n\t\tstate.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );\n\n\t};\n\n\tthis.getScissorTest = function () {\n\n\t\treturn _scissorTest;\n\n\t};\n\n\tthis.setScissorTest = function ( boolean ) {\n\n\t\tstate.setScissorTest( _scissorTest = boolean );\n\n\t};\n\n\tthis.setOpaqueSort = function ( method ) {\n\n\t\t_opaqueSort = method;\n\n\t};\n\n\tthis.setTransparentSort = function ( method ) {\n\n\t\t_transparentSort = method;\n\n\t};\n\n\t// Clearing\n\n\tthis.getClearColor = function ( target ) {\n\n\t\treturn target.copy( background.getClearColor() );\n\n\t};\n\n\tthis.setClearColor = function () {\n\n\t\tbackground.setClearColor.apply( background, arguments );\n\n\t};\n\n\tthis.getClearAlpha = function () {\n\n\t\treturn background.getClearAlpha();\n\n\t};\n\n\tthis.setClearAlpha = function () {\n\n\t\tbackground.setClearAlpha.apply( background, arguments );\n\n\t};\n\n\tthis.clear = function ( color, depth, stencil ) {\n\n\t\tlet bits = 0;\n\n\t\tif ( color === undefined || color ) bits |= 16384;\n\t\tif ( depth === undefined || depth ) bits |= 256;\n\t\tif ( stencil === undefined || stencil ) bits |= 1024;\n\n\t\t_gl.clear( bits );\n\n\t};\n\n\tthis.clearColor = function () {\n\n\t\tthis.clear( true, false, false );\n\n\t};\n\n\tthis.clearDepth = function () {\n\n\t\tthis.clear( false, true, false );\n\n\t};\n\n\tthis.clearStencil = function () {\n\n\t\tthis.clear( false, false, true );\n\n\t};\n\n\t//\n\n\tthis.dispose = function () {\n\n\t\t_canvas.removeEventListener( 'webglcontextlost', onContextLost, false );\n\t\t_canvas.removeEventListener( 'webglcontextrestored', onContextRestore, false );\n\n\t\trenderLists.dispose();\n\t\trenderStates.dispose();\n\t\tproperties.dispose();\n\t\tcubemaps.dispose();\n\t\tcubeuvmaps.dispose();\n\t\tobjects.dispose();\n\t\tbindingStates.dispose();\n\n\t\txr.dispose();\n\n\t\txr.removeEventListener( 'sessionstart', onXRSessionStart );\n\t\txr.removeEventListener( 'sessionend', onXRSessionEnd );\n\n\t\tif ( _transmissionRenderTarget ) {\n\n\t\t\t_transmissionRenderTarget.dispose();\n\t\t\t_transmissionRenderTarget = null;\n\n\t\t}\n\n\t\tanimation.stop();\n\n\t};\n\n\t// Events\n\n\tfunction onContextLost( event ) {\n\n\t\tevent.preventDefault();\n\n\t\tconsole.log( 'THREE.WebGLRenderer: Context Lost.' );\n\n\t\t_isContextLost = true;\n\n\t}\n\n\tfunction onContextRestore( /* event */ ) {\n\n\t\tconsole.log( 'THREE.WebGLRenderer: Context Restored.' );\n\n\t\t_isContextLost = false;\n\n\t\tconst infoAutoReset = info.autoReset;\n\t\tconst shadowMapEnabled = shadowMap.enabled;\n\t\tconst shadowMapAutoUpdate = shadowMap.autoUpdate;\n\t\tconst shadowMapNeedsUpdate = shadowMap.needsUpdate;\n\t\tconst shadowMapType = shadowMap.type;\n\n\t\tinitGLContext();\n\n\t\tinfo.autoReset = infoAutoReset;\n\t\tshadowMap.enabled = shadowMapEnabled;\n\t\tshadowMap.autoUpdate = shadowMapAutoUpdate;\n\t\tshadowMap.needsUpdate = shadowMapNeedsUpdate;\n\t\tshadowMap.type = shadowMapType;\n\n\t}\n\n\tfunction onMaterialDispose( event ) {\n\n\t\tconst material = event.target;\n\n\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\n\n\t\tdeallocateMaterial( material );\n\n\t}\n\n\t// Buffer deallocation\n\n\tfunction deallocateMaterial( material ) {\n\n\t\treleaseMaterialProgramReferences( material );\n\n\t\tproperties.remove( material );\n\n\t}\n\n\n\tfunction releaseMaterialProgramReferences( material ) {\n\n\t\tconst programs = properties.get( material ).programs;\n\n\t\tif ( programs !== undefined ) {\n\n\t\t\tprograms.forEach( function ( program ) {\n\n\t\t\t\tprogramCache.releaseProgram( program );\n\n\t\t\t} );\n\n\t\t}\n\n\t}\n\n\t// Buffer rendering\n\n\tthis.renderBufferDirect = function ( camera, scene, geometry, material, object, group ) {\n\n\t\tif ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)\n\n\t\tconst frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );\n\n\t\tconst program = setProgram( camera, scene, geometry, material, object );\n\n\t\tstate.setMaterial( material, frontFaceCW );\n\n\t\t//\n\n\t\tlet index = geometry.index;\n\t\tconst position = geometry.attributes.position;\n\n\t\t//\n\n\t\tif ( index === null ) {\n\n\t\t\tif ( position === undefined || position.count === 0 ) return;\n\n\t\t} else if ( index.count === 0 ) {\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t//\n\n\t\tlet rangeFactor = 1;\n\n\t\tif ( material.wireframe === true ) {\n\n\t\t\tindex = geometries.getWireframeAttribute( geometry );\n\t\t\trangeFactor = 2;\n\n\t\t}\n\n\t\tbindingStates.setup( object, material, program, geometry, index );\n\n\t\tlet attribute;\n\t\tlet renderer = bufferRenderer;\n\n\t\tif ( index !== null ) {\n\n\t\t\tattribute = attributes.get( index );\n\n\t\t\trenderer = indexedBufferRenderer;\n\t\t\trenderer.setIndex( attribute );\n\n\t\t}\n\n\t\t//\n\n\t\tconst dataCount = ( index !== null ) ? index.count : position.count;\n\n\t\tconst rangeStart = geometry.drawRange.start * rangeFactor;\n\t\tconst rangeCount = geometry.drawRange.count * rangeFactor;\n\n\t\tconst groupStart = group !== null ? group.start * rangeFactor : 0;\n\t\tconst groupCount = group !== null ? group.count * rangeFactor : Infinity;\n\n\t\tconst drawStart = Math.max( rangeStart, groupStart );\n\t\tconst drawEnd = Math.min( dataCount, rangeStart + rangeCount, groupStart + groupCount ) - 1;\n\n\t\tconst drawCount = Math.max( 0, drawEnd - drawStart + 1 );\n\n\t\tif ( drawCount === 0 ) return;\n\n\t\t//\n\n\t\tif ( object.isMesh ) {\n\n\t\t\tif ( material.wireframe === true ) {\n\n\t\t\t\tstate.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );\n\t\t\t\trenderer.setMode( 1 );\n\n\t\t\t} else {\n\n\t\t\t\trenderer.setMode( 4 );\n\n\t\t\t}\n\n\t\t} else if ( object.isLine ) {\n\n\t\t\tlet lineWidth = material.linewidth;\n\n\t\t\tif ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material\n\n\t\t\tstate.setLineWidth( lineWidth * getTargetPixelRatio() );\n\n\t\t\tif ( object.isLineSegments ) {\n\n\t\t\t\trenderer.setMode( 1 );\n\n\t\t\t} else if ( object.isLineLoop ) {\n\n\t\t\t\trenderer.setMode( 2 );\n\n\t\t\t} else {\n\n\t\t\t\trenderer.setMode( 3 );\n\n\t\t\t}\n\n\t\t} else if ( object.isPoints ) {\n\n\t\t\trenderer.setMode( 0 );\n\n\t\t} else if ( object.isSprite ) {\n\n\t\t\trenderer.setMode( 4 );\n\n\t\t}\n\n\t\tif ( object.isInstancedMesh ) {\n\n\t\t\trenderer.renderInstances( drawStart, drawCount, object.count );\n\n\t\t} else if ( geometry.isInstancedBufferGeometry ) {\n\n\t\t\tconst instanceCount = Math.min( geometry.instanceCount, geometry._maxInstanceCount );\n\n\t\t\trenderer.renderInstances( drawStart, drawCount, instanceCount );\n\n\t\t} else {\n\n\t\t\trenderer.render( drawStart, drawCount );\n\n\t\t}\n\n\t};\n\n\t// Compile\n\n\tthis.compile = function ( scene, camera ) {\n\n\t\tcurrentRenderState = renderStates.get( scene );\n\t\tcurrentRenderState.init();\n\n\t\trenderStateStack.push( currentRenderState );\n\n\t\tscene.traverseVisible( function ( object ) {\n\n\t\t\tif ( object.isLight && object.layers.test( camera.layers ) ) {\n\n\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t\tcurrentRenderState.setupLights( _this.physicallyCorrectLights );\n\n\t\tscene.traverse( function ( object ) {\n\n\t\t\tconst material = object.material;\n\n\t\t\tif ( material ) {\n\n\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\tfor ( let i = 0; i < material.length; i ++ ) {\n\n\t\t\t\t\t\tconst material2 = material[ i ];\n\n\t\t\t\t\t\tgetProgram( material2, scene, object );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tgetProgram( material, scene, object );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t\trenderStateStack.pop();\n\t\tcurrentRenderState = null;\n\n\t};\n\n\t// Animation Loop\n\n\tlet onAnimationFrameCallback = null;\n\n\tfunction onAnimationFrame( time ) {\n\n\t\tif ( onAnimationFrameCallback ) onAnimationFrameCallback( time );\n\n\t}\n\n\tfunction onXRSessionStart() {\n\n\t\tanimation.stop();\n\n\t}\n\n\tfunction onXRSessionEnd() {\n\n\t\tanimation.start();\n\n\t}\n\n\tconst animation = new WebGLAnimation();\n\tanimation.setAnimationLoop( onAnimationFrame );\n\n\tif ( typeof window !== 'undefined' ) animation.setContext( window );\n\n\tthis.setAnimationLoop = function ( callback ) {\n\n\t\tonAnimationFrameCallback = callback;\n\t\txr.setAnimationLoop( callback );\n\n\t\t( callback === null ) ? animation.stop() : animation.start();\n\n\t};\n\n\txr.addEventListener( 'sessionstart', onXRSessionStart );\n\txr.addEventListener( 'sessionend', onXRSessionEnd );\n\n\t// Rendering\n\n\tthis.render = function ( scene, camera ) {\n\n\t\tif ( camera !== undefined && camera.isCamera !== true ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( _isContextLost === true ) return;\n\n\t\t// update scene graph\n\n\t\tif ( scene.autoUpdate === true ) scene.updateMatrixWorld();\n\n\t\t// update camera matrices and frustum\n\n\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\tif ( xr.enabled === true && xr.isPresenting === true ) {\n\n\t\t\tif ( xr.cameraAutoUpdate === true ) xr.updateCamera( camera );\n\n\t\t\tcamera = xr.getCamera(); // use XR camera for rendering\n\n\t\t}\n\n\t\t//\n\t\tif ( scene.isScene === true ) scene.onBeforeRender( _this, scene, camera, _currentRenderTarget );\n\n\t\tcurrentRenderState = renderStates.get( scene, renderStateStack.length );\n\t\tcurrentRenderState.init();\n\n\t\trenderStateStack.push( currentRenderState );\n\n\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\t_frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t\t_localClippingEnabled = this.localClippingEnabled;\n\t\t_clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled, camera );\n\n\t\tcurrentRenderList = renderLists.get( scene, renderListStack.length );\n\t\tcurrentRenderList.init();\n\n\t\trenderListStack.push( currentRenderList );\n\n\t\tprojectObject( scene, camera, 0, _this.sortObjects );\n\n\t\tcurrentRenderList.finish();\n\n\t\tif ( _this.sortObjects === true ) {\n\n\t\t\tcurrentRenderList.sort( _opaqueSort, _transparentSort );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( _clippingEnabled === true ) clipping.beginShadows();\n\n\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\tshadowMap.render( shadowsArray, scene, camera );\n\n\t\tif ( _clippingEnabled === true ) clipping.endShadows();\n\n\t\t//\n\n\t\tif ( this.info.autoReset === true ) this.info.reset();\n\n\t\t//\n\n\t\tbackground.render( currentRenderList, scene );\n\n\t\t// render scene\n\n\t\tcurrentRenderState.setupLights( _this.physicallyCorrectLights );\n\n\t\tif ( camera.isArrayCamera ) {\n\n\t\t\tconst cameras = camera.cameras;\n\n\t\t\tfor ( let i = 0, l = cameras.length; i < l; i ++ ) {\n\n\t\t\t\tconst camera2 = cameras[ i ];\n\n\t\t\t\trenderScene( currentRenderList, scene, camera2, camera2.viewport );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\trenderScene( currentRenderList, scene, camera );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( _currentRenderTarget !== null ) {\n\n\t\t\t// resolve multisample renderbuffers to a single-sample texture if necessary\n\n\t\t\ttextures.updateMultisampleRenderTarget( _currentRenderTarget );\n\n\t\t\t// Generate mipmap if we're using any kind of mipmap filtering\n\n\t\t\ttextures.updateRenderTargetMipmap( _currentRenderTarget );\n\n\t\t}\n\n\t\t//\n\n\t\tif ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );\n\n\t\t// Ensure depth buffer writing is enabled so it can be cleared on next render\n\n\t\tstate.buffers.depth.setTest( true );\n\t\tstate.buffers.depth.setMask( true );\n\t\tstate.buffers.color.setMask( true );\n\n\t\tstate.setPolygonOffset( false );\n\n\t\t// _gl.finish();\n\n\t\tbindingStates.resetDefaultState();\n\t\t_currentMaterialId = - 1;\n\t\t_currentCamera = null;\n\n\t\trenderStateStack.pop();\n\n\t\tif ( renderStateStack.length > 0 ) {\n\n\t\t\tcurrentRenderState = renderStateStack[ renderStateStack.length - 1 ];\n\n\t\t} else {\n\n\t\t\tcurrentRenderState = null;\n\n\t\t}\n\n\t\trenderListStack.pop();\n\n\t\tif ( renderListStack.length > 0 ) {\n\n\t\t\tcurrentRenderList = renderListStack[ renderListStack.length - 1 ];\n\n\t\t} else {\n\n\t\t\tcurrentRenderList = null;\n\n\t\t}\n\n\t};\n\n\tfunction projectObject( object, camera, groupOrder, sortObjects ) {\n\n\t\tif ( object.visible === false ) return;\n\n\t\tconst visible = object.layers.test( camera.layers );\n\n\t\tif ( visible ) {\n\n\t\t\tif ( object.isGroup ) {\n\n\t\t\t\tgroupOrder = object.renderOrder;\n\n\t\t\t} else if ( object.isLOD ) {\n\n\t\t\t\tif ( object.autoUpdate === true ) object.update( camera );\n\n\t\t\t} else if ( object.isLight ) {\n\n\t\t\t\tcurrentRenderState.pushLight( object );\n\n\t\t\t\tif ( object.castShadow ) {\n\n\t\t\t\t\tcurrentRenderState.pushShadow( object );\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isSprite ) {\n\n\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) {\n\n\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t_vector3.setFromMatrixPosition( object.matrixWorld )\n\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\tif ( material.visible ) {\n\n\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else if ( object.isMesh || object.isLine || object.isPoints ) {\n\n\t\t\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\t\t\t// update skeleton only once in a frame\n\n\t\t\t\t\tif ( object.skeleton.frame !== info.render.frame ) {\n\n\t\t\t\t\t\tobject.skeleton.update();\n\t\t\t\t\t\tobject.skeleton.frame = info.render.frame;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {\n\n\t\t\t\t\tif ( sortObjects ) {\n\n\t\t\t\t\t\t_vector3.setFromMatrixPosition( object.matrixWorld )\n\t\t\t\t\t\t\t.applyMatrix4( _projScreenMatrix );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst geometry = objects.update( object );\n\t\t\t\t\tconst material = object.material;\n\n\t\t\t\t\tif ( Array.isArray( material ) ) {\n\n\t\t\t\t\t\tconst groups = geometry.groups;\n\n\t\t\t\t\t\tfor ( let i = 0, l = groups.length; i < l; i ++ ) {\n\n\t\t\t\t\t\t\tconst group = groups[ i ];\n\t\t\t\t\t\t\tconst groupMaterial = material[ group.materialIndex ];\n\n\t\t\t\t\t\t\tif ( groupMaterial && groupMaterial.visible ) {\n\n\t\t\t\t\t\t\t\tcurrentRenderList.push( object, geometry, groupMaterial, groupOrder, _vector3.z, group );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else if ( material.visible ) {\n\n\t\t\t\t\t\tcurrentRenderList.push( object, geometry, material, groupOrder, _vector3.z, null );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tprojectObject( children[ i ], camera, groupOrder, sortObjects );\n\n\t\t}\n\n\t}\n\n\tfunction renderScene( currentRenderList, scene, camera, viewport ) {\n\n\t\tconst opaqueObjects = currentRenderList.opaque;\n\t\tconst transmissiveObjects = currentRenderList.transmissive;\n\t\tconst transparentObjects = currentRenderList.transparent;\n\n\t\tcurrentRenderState.setupLightsView( camera );\n\n\t\tif ( transmissiveObjects.length > 0 ) renderTransmissionPass( opaqueObjects, scene, camera );\n\n\t\tif ( viewport ) state.viewport( _currentViewport.copy( viewport ) );\n\n\t\tif ( opaqueObjects.length > 0 ) renderObjects( opaqueObjects, scene, camera );\n\t\tif ( transmissiveObjects.length > 0 ) renderObjects( transmissiveObjects, scene, camera );\n\t\tif ( transparentObjects.length > 0 ) renderObjects( transparentObjects, scene, camera );\n\n\t}\n\n\tfunction renderTransmissionPass( opaqueObjects, scene, camera ) {\n\n\t\tif ( _transmissionRenderTarget === null ) {\n\n\t\t\tconst needsAntialias = _antialias === true && capabilities.isWebGL2 === true;\n\t\t\tconst renderTargetType = needsAntialias ? WebGLMultisampleRenderTarget : WebGLRenderTarget;\n\n\t\t\t_transmissionRenderTarget = new renderTargetType( 1024, 1024, {\n\t\t\t\tgenerateMipmaps: true,\n\t\t\t\ttype: utils.convert( HalfFloatType ) !== null ? HalfFloatType : UnsignedByteType,\n\t\t\t\tminFilter: LinearMipmapLinearFilter,\n\t\t\t\tmagFilter: NearestFilter,\n\t\t\t\twrapS: ClampToEdgeWrapping,\n\t\t\t\twrapT: ClampToEdgeWrapping\n\t\t\t} );\n\n\t\t}\n\n\t\tconst currentRenderTarget = _this.getRenderTarget();\n\t\t_this.setRenderTarget( _transmissionRenderTarget );\n\t\t_this.clear();\n\n\t\t// Turn off the features which can affect the frag color for opaque objects pass.\n\t\t// Otherwise they are applied twice in opaque objects pass and transmission objects pass.\n\t\tconst currentToneMapping = _this.toneMapping;\n\t\t_this.toneMapping = NoToneMapping;\n\n\t\trenderObjects( opaqueObjects, scene, camera );\n\n\t\t_this.toneMapping = currentToneMapping;\n\n\t\ttextures.updateMultisampleRenderTarget( _transmissionRenderTarget );\n\t\ttextures.updateRenderTargetMipmap( _transmissionRenderTarget );\n\n\t\t_this.setRenderTarget( currentRenderTarget );\n\n\t}\n\n\tfunction renderObjects( renderList, scene, camera ) {\n\n\t\tconst overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n\n\t\tfor ( let i = 0, l = renderList.length; i < l; i ++ ) {\n\n\t\t\tconst renderItem = renderList[ i ];\n\n\t\t\tconst object = renderItem.object;\n\t\t\tconst geometry = renderItem.geometry;\n\t\t\tconst material = overrideMaterial === null ? renderItem.material : overrideMaterial;\n\t\t\tconst group = renderItem.group;\n\n\t\t\tif ( object.layers.test( camera.layers ) ) {\n\n\t\t\t\trenderObject( object, scene, camera, geometry, material, group );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tfunction renderObject( object, scene, camera, geometry, material, group ) {\n\n\t\tobject.onBeforeRender( _this, scene, camera, geometry, material, group );\n\n\t\tobject.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\n\t\tobject.normalMatrix.getNormalMatrix( object.modelViewMatrix );\n\n\t\tmaterial.onBeforeRender( _this, scene, camera, geometry, object, group );\n\n\t\tif ( material.transparent === true && material.side === DoubleSide ) {\n\n\t\t\tmaterial.side = BackSide;\n\t\t\tmaterial.needsUpdate = true;\n\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\tmaterial.side = FrontSide;\n\t\t\tmaterial.needsUpdate = true;\n\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t\tmaterial.side = DoubleSide;\n\n\t\t} else {\n\n\t\t\t_this.renderBufferDirect( camera, scene, geometry, material, object, group );\n\n\t\t}\n\n\t\tobject.onAfterRender( _this, scene, camera, geometry, material, group );\n\n\t}\n\n\tfunction getProgram( material, scene, object ) {\n\n\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\tconst materialProperties = properties.get( material );\n\n\t\tconst lights = currentRenderState.state.lights;\n\t\tconst shadowsArray = currentRenderState.state.shadowsArray;\n\n\t\tconst lightsStateVersion = lights.state.version;\n\n\t\tconst parameters = programCache.getParameters( material, lights.state, shadowsArray, scene, object );\n\t\tconst programCacheKey = programCache.getProgramCacheKey( parameters );\n\n\t\tlet programs = materialProperties.programs;\n\n\t\t// always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change\n\n\t\tmaterialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\tmaterialProperties.fog = scene.fog;\n\t\tmaterialProperties.envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || materialProperties.environment );\n\n\t\tif ( programs === undefined ) {\n\n\t\t\t// new material\n\n\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\n\n\t\t\tprograms = new Map();\n\t\t\tmaterialProperties.programs = programs;\n\n\t\t}\n\n\t\tlet program = programs.get( programCacheKey );\n\n\t\tif ( program !== undefined ) {\n\n\t\t\t// early out if program and light state is identical\n\n\t\t\tif ( materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion ) {\n\n\t\t\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t\t\treturn program;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tparameters.uniforms = programCache.getUniforms( material );\n\n\t\t\tmaterial.onBuild( object, parameters, _this );\n\n\t\t\tmaterial.onBeforeCompile( parameters, _this );\n\n\t\t\tprogram = programCache.acquireProgram( parameters, programCacheKey );\n\t\t\tprograms.set( programCacheKey, program );\n\n\t\t\tmaterialProperties.uniforms = parameters.uniforms;\n\n\t\t}\n\n\t\tconst uniforms = materialProperties.uniforms;\n\n\t\tif ( ( ! material.isShaderMaterial && ! material.isRawShaderMaterial ) || material.clipping === true ) {\n\n\t\t\tuniforms.clippingPlanes = clipping.uniform;\n\n\t\t}\n\n\t\tupdateCommonMaterialProperties( material, parameters );\n\n\t\t// store the light setup it was created for\n\n\t\tmaterialProperties.needsLights = materialNeedsLights( material );\n\t\tmaterialProperties.lightsStateVersion = lightsStateVersion;\n\n\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t// wire up the material to this renderer's lighting state\n\n\t\t\tuniforms.ambientLightColor.value = lights.state.ambient;\n\t\t\tuniforms.lightProbe.value = lights.state.probe;\n\t\t\tuniforms.directionalLights.value = lights.state.directional;\n\t\t\tuniforms.directionalLightShadows.value = lights.state.directionalShadow;\n\t\t\tuniforms.spotLights.value = lights.state.spot;\n\t\t\tuniforms.spotLightShadows.value = lights.state.spotShadow;\n\t\t\tuniforms.rectAreaLights.value = lights.state.rectArea;\n\t\t\tuniforms.ltc_1.value = lights.state.rectAreaLTC1;\n\t\t\tuniforms.ltc_2.value = lights.state.rectAreaLTC2;\n\t\t\tuniforms.pointLights.value = lights.state.point;\n\t\t\tuniforms.pointLightShadows.value = lights.state.pointShadow;\n\t\t\tuniforms.hemisphereLights.value = lights.state.hemi;\n\n\t\t\tuniforms.directionalShadowMap.value = lights.state.directionalShadowMap;\n\t\t\tuniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;\n\t\t\tuniforms.spotShadowMap.value = lights.state.spotShadowMap;\n\t\t\tuniforms.spotShadowMatrix.value = lights.state.spotShadowMatrix;\n\t\t\tuniforms.pointShadowMap.value = lights.state.pointShadowMap;\n\t\t\tuniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;\n\t\t\t// TODO (abelnation): add area lights shadow info to uniforms\n\n\t\t}\n\n\t\tconst progUniforms = program.getUniforms();\n\t\tconst uniformsList = WebGLUniforms.seqWithValue( progUniforms.seq, uniforms );\n\n\t\tmaterialProperties.currentProgram = program;\n\t\tmaterialProperties.uniformsList = uniformsList;\n\n\t\treturn program;\n\n\t}\n\n\tfunction updateCommonMaterialProperties( material, parameters ) {\n\n\t\tconst materialProperties = properties.get( material );\n\n\t\tmaterialProperties.outputEncoding = parameters.outputEncoding;\n\t\tmaterialProperties.instancing = parameters.instancing;\n\t\tmaterialProperties.skinning = parameters.skinning;\n\t\tmaterialProperties.morphTargets = parameters.morphTargets;\n\t\tmaterialProperties.morphNormals = parameters.morphNormals;\n\t\tmaterialProperties.morphTargetsCount = parameters.morphTargetsCount;\n\t\tmaterialProperties.numClippingPlanes = parameters.numClippingPlanes;\n\t\tmaterialProperties.numIntersection = parameters.numClipIntersection;\n\t\tmaterialProperties.vertexAlphas = parameters.vertexAlphas;\n\t\tmaterialProperties.vertexTangents = parameters.vertexTangents;\n\n\t}\n\n\tfunction setProgram( camera, scene, geometry, material, object ) {\n\n\t\tif ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n\t\ttextures.resetTextureUnits();\n\n\t\tconst fog = scene.fog;\n\t\tconst environment = material.isMeshStandardMaterial ? scene.environment : null;\n\t\tconst encoding = ( _currentRenderTarget === null ) ? _this.outputEncoding : _currentRenderTarget.texture.encoding;\n\t\tconst envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );\n\t\tconst vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;\n\t\tconst vertexTangents = !! material.normalMap && !! geometry.attributes.tangent;\n\t\tconst morphTargets = !! geometry.morphAttributes.position;\n\t\tconst morphNormals = !! geometry.morphAttributes.normal;\n\t\tconst morphTargetsCount = !! geometry.morphAttributes.position ? geometry.morphAttributes.position.length : 0;\n\n\t\tconst materialProperties = properties.get( material );\n\t\tconst lights = currentRenderState.state.lights;\n\n\t\tif ( _clippingEnabled === true ) {\n\n\t\t\tif ( _localClippingEnabled === true || camera !== _currentCamera ) {\n\n\t\t\t\tconst useCache =\n\t\t\t\t\tcamera === _currentCamera &&\n\t\t\t\t\tmaterial.id === _currentMaterialId;\n\n\t\t\t\t// we might want to call this function with some ClippingGroup\n\t\t\t\t// object instead of the material, once it becomes feasible\n\t\t\t\t// (#8465, #8379)\n\t\t\t\tclipping.setState( material, camera, useCache );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//\n\n\t\tlet needsProgramChange = false;\n\n\t\tif ( material.version === materialProperties.__version ) {\n\n\t\t\tif ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t} else if ( materialProperties.outputEncoding !== encoding ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t} else if ( object.isInstancedMesh && materialProperties.instancing === false ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t} else if ( ! object.isInstancedMesh && materialProperties.instancing === true ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t} else if ( object.isSkinnedMesh && materialProperties.skinning === false ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t} else if ( ! object.isSkinnedMesh && materialProperties.skinning === true ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t} else if ( materialProperties.envMap !== envMap ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t} else if ( material.fog && materialProperties.fog !== fog ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t} else if ( materialProperties.numClippingPlanes !== undefined &&\n\t\t\t\t( materialProperties.numClippingPlanes !== clipping.numPlanes ||\n\t\t\t\tmaterialProperties.numIntersection !== clipping.numIntersection ) ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t} else if ( materialProperties.vertexAlphas !== vertexAlphas ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t} else if ( materialProperties.vertexTangents !== vertexTangents ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t} else if ( materialProperties.morphTargets !== morphTargets ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t} else if ( materialProperties.morphNormals !== morphNormals ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t} else if ( capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount ) {\n\n\t\t\t\tneedsProgramChange = true;\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tneedsProgramChange = true;\n\t\t\tmaterialProperties.__version = material.version;\n\n\t\t}\n\n\t\t//\n\n\t\tlet program = materialProperties.currentProgram;\n\n\t\tif ( needsProgramChange === true ) {\n\n\t\t\tprogram = getProgram( material, scene, object );\n\n\t\t}\n\n\t\tlet refreshProgram = false;\n\t\tlet refreshMaterial = false;\n\t\tlet refreshLights = false;\n\n\t\tconst p_uniforms = program.getUniforms(),\n\t\t\tm_uniforms = materialProperties.uniforms;\n\n\t\tif ( state.useProgram( program.program ) ) {\n\n\t\t\trefreshProgram = true;\n\t\t\trefreshMaterial = true;\n\t\t\trefreshLights = true;\n\n\t\t}\n\n\t\tif ( material.id !== _currentMaterialId ) {\n\n\t\t\t_currentMaterialId = material.id;\n\n\t\t\trefreshMaterial = true;\n\n\t\t}\n\n\t\tif ( refreshProgram || _currentCamera !== camera ) {\n\n\t\t\tp_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );\n\n\t\t\tif ( capabilities.logarithmicDepthBuffer ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'logDepthBufFC',\n\t\t\t\t\t2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );\n\n\t\t\t}\n\n\t\t\tif ( _currentCamera !== camera ) {\n\n\t\t\t\t_currentCamera = camera;\n\n\t\t\t\t// lighting uniforms depend on the camera so enforce an update\n\t\t\t\t// now, in case this material supports lights - or later, when\n\t\t\t\t// the next material that does gets activated:\n\n\t\t\t\trefreshMaterial = true;\t\t// set to true on material change\n\t\t\t\trefreshLights = true;\t\t// remains set until update done\n\n\t\t\t}\n\n\t\t\t// load material specific uniforms\n\t\t\t// (shader material also gets them for the sake of genericity)\n\n\t\t\tif ( material.isShaderMaterial ||\n\t\t\t\tmaterial.isMeshPhongMaterial ||\n\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\tmaterial.envMap ) {\n\n\t\t\t\tconst uCamPos = p_uniforms.map.cameraPosition;\n\n\t\t\t\tif ( uCamPos !== undefined ) {\n\n\t\t\t\t\tuCamPos.setValue( _gl,\n\t\t\t\t\t\t_vector3.setFromMatrixPosition( camera.matrixWorld ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( material.isMeshPhongMaterial ||\n\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\tmaterial.isMeshLambertMaterial ||\n\t\t\t\tmaterial.isMeshBasicMaterial ||\n\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\tmaterial.isShaderMaterial ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'isOrthographic', camera.isOrthographicCamera === true );\n\n\t\t\t}\n\n\t\t\tif ( material.isMeshPhongMaterial ||\n\t\t\t\tmaterial.isMeshToonMaterial ||\n\t\t\t\tmaterial.isMeshLambertMaterial ||\n\t\t\t\tmaterial.isMeshBasicMaterial ||\n\t\t\t\tmaterial.isMeshStandardMaterial ||\n\t\t\t\tmaterial.isShaderMaterial ||\n\t\t\t\tmaterial.isShadowMaterial ||\n\t\t\t\tobject.isSkinnedMesh ) {\n\n\t\t\t\tp_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// skinning and morph target uniforms must be set even if material didn't change\n\t\t// auto-setting of texture unit for bone and morph texture must go before other textures\n\t\t// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures\n\n\t\tif ( object.isSkinnedMesh ) {\n\n\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrix' );\n\t\t\tp_uniforms.setOptional( _gl, object, 'bindMatrixInverse' );\n\n\t\t\tconst skeleton = object.skeleton;\n\n\t\t\tif ( skeleton ) {\n\n\t\t\t\tif ( capabilities.floatVertexTextures ) {\n\n\t\t\t\t\tif ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();\n\n\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );\n\t\t\t\t\tp_uniforms.setValue( _gl, 'boneTextureSize', skeleton.boneTextureSize );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tp_uniforms.setOptional( _gl, skeleton, 'boneMatrices' );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( !! geometry && ( geometry.morphAttributes.position !== undefined || geometry.morphAttributes.normal !== undefined ) ) {\n\n\t\t\tmorphtargets.update( object, geometry, material, program );\n\n\t\t}\n\n\n\t\tif ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {\n\n\t\t\tmaterialProperties.receiveShadow = object.receiveShadow;\n\t\t\tp_uniforms.setValue( _gl, 'receiveShadow', object.receiveShadow );\n\n\t\t}\n\n\t\tif ( refreshMaterial ) {\n\n\t\t\tp_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );\n\n\t\t\tif ( materialProperties.needsLights ) {\n\n\t\t\t\t// the current material requires lighting info\n\n\t\t\t\t// note: all lighting uniforms are always set correctly\n\t\t\t\t// they simply reference the renderer's state for their\n\t\t\t\t// values\n\t\t\t\t//\n\t\t\t\t// use the current material's .needsUpdate flags to set\n\t\t\t\t// the GL state when required\n\n\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, refreshLights );\n\n\t\t\t}\n\n\t\t\t// refresh uniforms common to several materials\n\n\t\t\tif ( fog && material.fog ) {\n\n\t\t\t\tmaterials.refreshFogUniforms( m_uniforms, fog );\n\n\t\t\t}\n\n\t\t\tmaterials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget );\n\n\t\t\tWebGLUniforms.upload( _gl, materialProperties.uniformsList, m_uniforms, textures );\n\n\t\t}\n\n\t\tif ( material.isShaderMaterial && material.uniformsNeedUpdate === true ) {\n\n\t\t\tWebGLUniforms.upload( _gl, materialProperties.uniformsList, m_uniforms, textures );\n\t\t\tmaterial.uniformsNeedUpdate = false;\n\n\t\t}\n\n\t\tif ( material.isSpriteMaterial ) {\n\n\t\t\tp_uniforms.setValue( _gl, 'center', object.center );\n\n\t\t}\n\n\t\t// common matrices\n\n\t\tp_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );\n\t\tp_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );\n\t\tp_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );\n\n\t\treturn program;\n\n\t}\n\n\t// If uniforms are marked as clean, they don't need to be loaded to the GPU.\n\n\tfunction markUniformsLightsNeedsUpdate( uniforms, value ) {\n\n\t\tuniforms.ambientLightColor.needsUpdate = value;\n\t\tuniforms.lightProbe.needsUpdate = value;\n\n\t\tuniforms.directionalLights.needsUpdate = value;\n\t\tuniforms.directionalLightShadows.needsUpdate = value;\n\t\tuniforms.pointLights.needsUpdate = value;\n\t\tuniforms.pointLightShadows.needsUpdate = value;\n\t\tuniforms.spotLights.needsUpdate = value;\n\t\tuniforms.spotLightShadows.needsUpdate = value;\n\t\tuniforms.rectAreaLights.needsUpdate = value;\n\t\tuniforms.hemisphereLights.needsUpdate = value;\n\n\t}\n\n\tfunction materialNeedsLights( material ) {\n\n\t\treturn material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial ||\n\t\t\tmaterial.isMeshStandardMaterial || material.isShadowMaterial ||\n\t\t\t( material.isShaderMaterial && material.lights === true );\n\n\t}\n\n\tthis.getActiveCubeFace = function () {\n\n\t\treturn _currentActiveCubeFace;\n\n\t};\n\n\tthis.getActiveMipmapLevel = function () {\n\n\t\treturn _currentActiveMipmapLevel;\n\n\t};\n\n\tthis.getRenderTarget = function () {\n\n\t\treturn _currentRenderTarget;\n\n\t};\n\n\tthis.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {\n\n\t\t_currentRenderTarget = renderTarget;\n\t\t_currentActiveCubeFace = activeCubeFace;\n\t\t_currentActiveMipmapLevel = activeMipmapLevel;\n\n\t\tif ( renderTarget && properties.get( renderTarget ).__webglFramebuffer === undefined ) {\n\n\t\t\ttextures.setupRenderTarget( renderTarget );\n\n\t\t}\n\n\t\tlet framebuffer = null;\n\t\tlet isCube = false;\n\t\tlet isRenderTarget3D = false;\n\n\t\tif ( renderTarget ) {\n\n\t\t\tconst texture = renderTarget.texture;\n\n\t\t\tif ( texture.isDataTexture3D || texture.isDataTexture2DArray ) {\n\n\t\t\t\tisRenderTarget3D = true;\n\n\t\t\t}\n\n\t\t\tconst __webglFramebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\t\tif ( renderTarget.isWebGLCubeRenderTarget ) {\n\n\t\t\t\tframebuffer = __webglFramebuffer[ activeCubeFace ];\n\t\t\t\tisCube = true;\n\n\t\t\t} else if ( renderTarget.isWebGLMultisampleRenderTarget ) {\n\n\t\t\t\tframebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;\n\n\t\t\t} else {\n\n\t\t\t\tframebuffer = __webglFramebuffer;\n\n\t\t\t}\n\n\t\t\t_currentViewport.copy( renderTarget.viewport );\n\t\t\t_currentScissor.copy( renderTarget.scissor );\n\t\t\t_currentScissorTest = renderTarget.scissorTest;\n\n\t\t} else {\n\n\t\t\t_currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t_currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor();\n\t\t\t_currentScissorTest = _scissorTest;\n\n\t\t}\n\n\t\tconst framebufferBound = state.bindFramebuffer( 36160, framebuffer );\n\n\t\tif ( framebufferBound && capabilities.drawBuffers ) {\n\n\t\t\tlet needsUpdate = false;\n\n\t\t\tif ( renderTarget ) {\n\n\t\t\t\tif ( renderTarget.isWebGLMultipleRenderTargets ) {\n\n\t\t\t\t\tconst textures = renderTarget.texture;\n\n\t\t\t\t\tif ( _currentDrawBuffers.length !== textures.length || _currentDrawBuffers[ 0 ] !== 36064 ) {\n\n\t\t\t\t\t\tfor ( let i = 0, il = textures.length; i < il; i ++ ) {\n\n\t\t\t\t\t\t\t_currentDrawBuffers[ i ] = 36064 + i;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t_currentDrawBuffers.length = textures.length;\n\n\t\t\t\t\t\tneedsUpdate = true;\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( _currentDrawBuffers.length !== 1 || _currentDrawBuffers[ 0 ] !== 36064 ) {\n\n\t\t\t\t\t\t_currentDrawBuffers[ 0 ] = 36064;\n\t\t\t\t\t\t_currentDrawBuffers.length = 1;\n\n\t\t\t\t\t\tneedsUpdate = true;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif ( _currentDrawBuffers.length !== 1 || _currentDrawBuffers[ 0 ] !== 1029 ) {\n\n\t\t\t\t\t_currentDrawBuffers[ 0 ] = 1029;\n\t\t\t\t\t_currentDrawBuffers.length = 1;\n\n\t\t\t\t\tneedsUpdate = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( needsUpdate ) {\n\n\t\t\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t\t\t_gl.drawBuffers( _currentDrawBuffers );\n\n\t\t\t\t} else {\n\n\t\t\t\t\textensions.get( 'WEBGL_draw_buffers' ).drawBuffersWEBGL( _currentDrawBuffers );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tstate.viewport( _currentViewport );\n\t\tstate.scissor( _currentScissor );\n\t\tstate.setScissorTest( _currentScissorTest );\n\n\t\tif ( isCube ) {\n\n\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\t_gl.framebufferTexture2D( 36160, 36064, 34069 + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel );\n\n\t\t} else if ( isRenderTarget3D ) {\n\n\t\t\tconst textureProperties = properties.get( renderTarget.texture );\n\t\t\tconst layer = activeCubeFace || 0;\n\t\t\t_gl.framebufferTextureLayer( 36160, 36064, textureProperties.__webglTexture, activeMipmapLevel || 0, layer );\n\n\t\t}\n\n\t\t_currentMaterialId = - 1; // reset current material to ensure correct uniform bindings\n\n\t};\n\n\tthis.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {\n\n\t\tif ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {\n\n\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tlet framebuffer = properties.get( renderTarget ).__webglFramebuffer;\n\n\t\tif ( renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined ) {\n\n\t\t\tframebuffer = framebuffer[ activeCubeFaceIndex ];\n\n\t\t}\n\n\t\tif ( framebuffer ) {\n\n\t\t\tstate.bindFramebuffer( 36160, framebuffer );\n\n\t\t\ttry {\n\n\t\t\t\tconst texture = renderTarget.texture;\n\t\t\t\tconst textureFormat = texture.format;\n\t\t\t\tconst textureType = texture.type;\n\n\t\t\t\tif ( textureFormat !== RGBAFormat && utils.convert( textureFormat ) !== _gl.getParameter( 35739 ) ) {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tconst halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || ( capabilities.isWebGL2 && extensions.has( 'EXT_color_buffer_float' ) ) );\n\n\t\t\t\tif ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( 35738 ) && // Edge and Chrome Mac < 52 (#9513)\n\t\t\t\t\t! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.has( 'OES_texture_float' ) || extensions.has( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox\n\t\t\t\t\t! halfFloatSupportedByExt ) {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( _gl.checkFramebufferStatus( 36160 ) === 36053 ) {\n\n\t\t\t\t\t// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n\n\t\t\t\t\tif ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {\n\n\t\t\t\t\t\t_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.' );\n\n\t\t\t\t}\n\n\t\t\t} finally {\n\n\t\t\t\t// restore framebuffer of current render target if necessary\n\n\t\t\t\tconst framebuffer = ( _currentRenderTarget !== null ) ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;\n\t\t\t\tstate.bindFramebuffer( 36160, framebuffer );\n\n\t\t\t}\n\n\t\t}\n\n\t};\n\n\tthis.copyFramebufferToTexture = function ( position, texture, level = 0 ) {\n\n\t\tconst levelScale = Math.pow( 2, - level );\n\t\tconst width = Math.floor( texture.image.width * levelScale );\n\t\tconst height = Math.floor( texture.image.height * levelScale );\n\n\t\tlet glFormat = utils.convert( texture.format );\n\n\t\tif ( capabilities.isWebGL2 ) {\n\n\t\t\t// Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1120100\n\t\t\t// Not needed in Chrome 93+\n\n\t\t\tif ( glFormat === 6407 ) glFormat = 32849;\n\t\t\tif ( glFormat === 6408 ) glFormat = 32856;\n\n\t\t}\n\n\t\ttextures.setTexture2D( texture, 0 );\n\n\t\t_gl.copyTexImage2D( 3553, level, glFormat, position.x, position.y, width, height, 0 );\n\n\t\tstate.unbindTexture();\n\n\t};\n\n\tthis.copyTextureToTexture = function ( position, srcTexture, dstTexture, level = 0 ) {\n\n\t\tconst width = srcTexture.image.width;\n\t\tconst height = srcTexture.image.height;\n\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\tconst glType = utils.convert( dstTexture.type );\n\n\t\ttextures.setTexture2D( dstTexture, 0 );\n\n\t\t// As another texture upload may have changed pixelStorei\n\t\t// parameters, make sure they are correct for the dstTexture\n\t\t_gl.pixelStorei( 37440, dstTexture.flipY );\n\t\t_gl.pixelStorei( 37441, dstTexture.premultiplyAlpha );\n\t\t_gl.pixelStorei( 3317, dstTexture.unpackAlignment );\n\n\t\tif ( srcTexture.isDataTexture ) {\n\n\t\t\t_gl.texSubImage2D( 3553, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data );\n\n\t\t} else {\n\n\t\t\tif ( srcTexture.isCompressedTexture ) {\n\n\t\t\t\t_gl.compressedTexSubImage2D( 3553, level, position.x, position.y, srcTexture.mipmaps[ 0 ].width, srcTexture.mipmaps[ 0 ].height, glFormat, srcTexture.mipmaps[ 0 ].data );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.texSubImage2D( 3553, level, position.x, position.y, glFormat, glType, srcTexture.image );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Generate mipmaps only when copying level 0\n\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( 3553 );\n\n\t\tstate.unbindTexture();\n\n\t};\n\n\tthis.copyTextureToTexture3D = function ( sourceBox, position, srcTexture, dstTexture, level = 0 ) {\n\n\t\tif ( _this.isWebGL1Renderer ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst width = sourceBox.max.x - sourceBox.min.x + 1;\n\t\tconst height = sourceBox.max.y - sourceBox.min.y + 1;\n\t\tconst depth = sourceBox.max.z - sourceBox.min.z + 1;\n\t\tconst glFormat = utils.convert( dstTexture.format );\n\t\tconst glType = utils.convert( dstTexture.type );\n\t\tlet glTarget;\n\n\t\tif ( dstTexture.isDataTexture3D ) {\n\n\t\t\ttextures.setTexture3D( dstTexture, 0 );\n\t\t\tglTarget = 32879;\n\n\t\t} else if ( dstTexture.isDataTexture2DArray ) {\n\n\t\t\ttextures.setTexture2DArray( dstTexture, 0 );\n\t\t\tglTarget = 35866;\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\t_gl.pixelStorei( 37440, dstTexture.flipY );\n\t\t_gl.pixelStorei( 37441, dstTexture.premultiplyAlpha );\n\t\t_gl.pixelStorei( 3317, dstTexture.unpackAlignment );\n\n\t\tconst unpackRowLen = _gl.getParameter( 3314 );\n\t\tconst unpackImageHeight = _gl.getParameter( 32878 );\n\t\tconst unpackSkipPixels = _gl.getParameter( 3316 );\n\t\tconst unpackSkipRows = _gl.getParameter( 3315 );\n\t\tconst unpackSkipImages = _gl.getParameter( 32877 );\n\n\t\tconst image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ 0 ] : srcTexture.image;\n\n\t\t_gl.pixelStorei( 3314, image.width );\n\t\t_gl.pixelStorei( 32878, image.height );\n\t\t_gl.pixelStorei( 3316, sourceBox.min.x );\n\t\t_gl.pixelStorei( 3315, sourceBox.min.y );\n\t\t_gl.pixelStorei( 32877, sourceBox.min.z );\n\n\t\tif ( srcTexture.isDataTexture || srcTexture.isDataTexture3D ) {\n\n\t\t\t_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data );\n\n\t\t} else {\n\n\t\t\tif ( srcTexture.isCompressedTexture ) {\n\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.' );\n\t\t\t\t_gl.compressedTexSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data );\n\n\t\t\t} else {\n\n\t\t\t\t_gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image );\n\n\t\t\t}\n\n\t\t}\n\n\t\t_gl.pixelStorei( 3314, unpackRowLen );\n\t\t_gl.pixelStorei( 32878, unpackImageHeight );\n\t\t_gl.pixelStorei( 3316, unpackSkipPixels );\n\t\t_gl.pixelStorei( 3315, unpackSkipRows );\n\t\t_gl.pixelStorei( 32877, unpackSkipImages );\n\n\t\t// Generate mipmaps only when copying level 0\n\t\tif ( level === 0 && dstTexture.generateMipmaps ) _gl.generateMipmap( glTarget );\n\n\t\tstate.unbindTexture();\n\n\t};\n\n\tthis.initTexture = function ( texture ) {\n\n\t\ttextures.setTexture2D( texture, 0 );\n\n\t\tstate.unbindTexture();\n\n\t};\n\n\tthis.resetState = function () {\n\n\t\t_currentActiveCubeFace = 0;\n\t\t_currentActiveMipmapLevel = 0;\n\t\t_currentRenderTarget = null;\n\n\t\tstate.reset();\n\t\tbindingStates.reset();\n\n\t};\n\n\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) ); // eslint-disable-line no-undef\n\n\t}\n\n}\n\nWebGLRenderer.prototype.isWebGLRenderer = true;\n\nclass WebGL1Renderer extends WebGLRenderer {}\n\nWebGL1Renderer.prototype.isWebGL1Renderer = true;\n\nclass FogExp2 {\n\n\tconstructor( color, density = 0.00025 ) {\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\t\tthis.density = density;\n\n\t}\n\n\tclone() {\n\n\t\treturn new FogExp2( this.color, this.density );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'FogExp2',\n\t\t\tcolor: this.color.getHex(),\n\t\t\tdensity: this.density\n\t\t};\n\n\t}\n\n}\n\nFogExp2.prototype.isFogExp2 = true;\n\nclass Fog {\n\n\tconstructor( color, near = 1, far = 1000 ) {\n\n\t\tthis.name = '';\n\n\t\tthis.color = new Color( color );\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Fog( this.color, this.near, this.far );\n\n\t}\n\n\ttoJSON( /* meta */ ) {\n\n\t\treturn {\n\t\t\ttype: 'Fog',\n\t\t\tcolor: this.color.getHex(),\n\t\t\tnear: this.near,\n\t\t\tfar: this.far\n\t\t};\n\n\t}\n\n}\n\nFog.prototype.isFog = true;\n\nclass Scene extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'Scene';\n\n\t\tthis.background = null;\n\t\tthis.environment = null;\n\t\tthis.fog = null;\n\n\t\tthis.overrideMaterial = null;\n\n\t\tthis.autoUpdate = true; // checked by the renderer\n\n\t\tif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t\t\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) ); // eslint-disable-line no-undef\n\n\t\t}\n\n\t}\n\n\tcopy( source, recursive ) {\n\n\t\tsuper.copy( source, recursive );\n\n\t\tif ( source.background !== null ) this.background = source.background.clone();\n\t\tif ( source.environment !== null ) this.environment = source.environment.clone();\n\t\tif ( source.fog !== null ) this.fog = source.fog.clone();\n\n\t\tif ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();\n\n\t\tthis.autoUpdate = source.autoUpdate;\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.fog !== null ) data.object.fog = this.fog.toJSON();\n\n\t\treturn data;\n\n\t}\n\n}\n\nScene.prototype.isScene = true;\n\nclass InterleavedBuffer {\n\n\tconstructor( array, stride ) {\n\n\t\tthis.array = array;\n\t\tthis.stride = stride;\n\t\tthis.count = array !== undefined ? array.length / stride : 0;\n\n\t\tthis.usage = StaticDrawUsage;\n\t\tthis.updateRange = { offset: 0, count: - 1 };\n\n\t\tthis.version = 0;\n\n\t\tthis.uuid = generateUUID();\n\n\t}\n\n\tonUploadCallback() {}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetUsage( value ) {\n\n\t\tthis.usage = value;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.array = new source.array.constructor( source.array );\n\t\tthis.count = source.count;\n\t\tthis.stride = source.stride;\n\t\tthis.usage = source.usage;\n\n\t\treturn this;\n\n\t}\n\n\tcopyAt( index1, attribute, index2 ) {\n\n\t\tindex1 *= this.stride;\n\t\tindex2 *= attribute.stride;\n\n\t\tfor ( let i = 0, l = this.stride; i < l; i ++ ) {\n\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tset( value, offset = 0 ) {\n\n\t\tthis.array.set( value, offset );\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = this.array.slice( 0 ).buffer;\n\n\t\t}\n\n\t\tconst array = new this.array.constructor( data.arrayBuffers[ this.array.buffer._uuid ] );\n\n\t\tconst ib = new this.constructor( array, this.stride );\n\t\tib.setUsage( this.usage );\n\n\t\treturn ib;\n\n\t}\n\n\tonUpload( callback ) {\n\n\t\tthis.onUploadCallback = callback;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data.arrayBuffers === undefined ) {\n\n\t\t\tdata.arrayBuffers = {};\n\n\t\t}\n\n\t\t// generate UUID for array buffer if necessary\n\n\t\tif ( this.array.buffer._uuid === undefined ) {\n\n\t\t\tthis.array.buffer._uuid = generateUUID();\n\n\t\t}\n\n\t\tif ( data.arrayBuffers[ this.array.buffer._uuid ] === undefined ) {\n\n\t\t\tdata.arrayBuffers[ this.array.buffer._uuid ] = Array.prototype.slice.call( new Uint32Array( this.array.buffer ) );\n\n\t\t}\n\n\t\t//\n\n\t\treturn {\n\t\t\tuuid: this.uuid,\n\t\t\tbuffer: this.array.buffer._uuid,\n\t\t\ttype: this.array.constructor.name,\n\t\t\tstride: this.stride\n\t\t};\n\n\t}\n\n}\n\nInterleavedBuffer.prototype.isInterleavedBuffer = true;\n\nconst _vector$6 = /*@__PURE__*/ new Vector3();\n\nclass InterleavedBufferAttribute {\n\n\tconstructor( interleavedBuffer, itemSize, offset, normalized = false ) {\n\n\t\tthis.name = '';\n\n\t\tthis.data = interleavedBuffer;\n\t\tthis.itemSize = itemSize;\n\t\tthis.offset = offset;\n\n\t\tthis.normalized = normalized === true;\n\n\t}\n\n\tget count() {\n\n\t\treturn this.data.count;\n\n\t}\n\n\tget array() {\n\n\t\treturn this.data.array;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tthis.data.needsUpdate = value;\n\n\t}\n\n\tapplyMatrix4( m ) {\n\n\t\tfor ( let i = 0, l = this.data.count; i < l; i ++ ) {\n\n\t\t\t_vector$6.x = this.getX( i );\n\t\t\t_vector$6.y = this.getY( i );\n\t\t\t_vector$6.z = this.getZ( i );\n\n\t\t\t_vector$6.applyMatrix4( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tapplyNormalMatrix( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$6.x = this.getX( i );\n\t\t\t_vector$6.y = this.getY( i );\n\t\t\t_vector$6.z = this.getZ( i );\n\n\t\t\t_vector$6.applyNormalMatrix( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttransformDirection( m ) {\n\n\t\tfor ( let i = 0, l = this.count; i < l; i ++ ) {\n\n\t\t\t_vector$6.x = this.getX( i );\n\t\t\t_vector$6.y = this.getY( i );\n\t\t\t_vector$6.z = this.getZ( i );\n\n\t\t\t_vector$6.transformDirection( m );\n\n\t\t\tthis.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetX( index, x ) {\n\n\t\tthis.data.array[ index * this.data.stride + this.offset ] = x;\n\n\t\treturn this;\n\n\t}\n\n\tsetY( index, y ) {\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetZ( index, z ) {\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetW( index, w ) {\n\n\t\tthis.data.array[ index * this.data.stride + this.offset + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tgetX( index ) {\n\n\t\treturn this.data.array[ index * this.data.stride + this.offset ];\n\n\t}\n\n\tgetY( index ) {\n\n\t\treturn this.data.array[ index * this.data.stride + this.offset + 1 ];\n\n\t}\n\n\tgetZ( index ) {\n\n\t\treturn this.data.array[ index * this.data.stride + this.offset + 2 ];\n\n\t}\n\n\tgetW( index ) {\n\n\t\treturn this.data.array[ index * this.data.stride + this.offset + 3 ];\n\n\t}\n\n\tsetXY( index, x, y ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZ( index, x, y, z ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\n\t\treturn this;\n\n\t}\n\n\tsetXYZW( index, x, y, z, w ) {\n\n\t\tindex = index * this.data.stride + this.offset;\n\n\t\tthis.data.array[ index + 0 ] = x;\n\t\tthis.data.array[ index + 1 ] = y;\n\t\tthis.data.array[ index + 2 ] = z;\n\t\tthis.data.array[ index + 3 ] = w;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn new BufferAttribute( new this.array.constructor( array ), this.itemSize, this.normalized );\n\n\t\t} else {\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.clone( data );\n\n\t\t\t}\n\n\t\t\treturn new InterleavedBufferAttribute( data.interleavedBuffers[ this.data.uuid ], this.itemSize, this.offset, this.normalized );\n\n\t\t}\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tif ( data === undefined ) {\n\n\t\t\tconsole.log( 'THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.' );\n\n\t\t\tconst array = [];\n\n\t\t\tfor ( let i = 0; i < this.count; i ++ ) {\n\n\t\t\t\tconst index = i * this.data.stride + this.offset;\n\n\t\t\t\tfor ( let j = 0; j < this.itemSize; j ++ ) {\n\n\t\t\t\t\tarray.push( this.data.array[ index + j ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// deinterleave data and save it as an ordinary buffer attribute for now\n\n\t\t\treturn {\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\ttype: this.array.constructor.name,\n\t\t\t\tarray: array,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t} else {\n\n\t\t\t// save as true interlaved attribtue\n\n\t\t\tif ( data.interleavedBuffers === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers = {};\n\n\t\t\t}\n\n\t\t\tif ( data.interleavedBuffers[ this.data.uuid ] === undefined ) {\n\n\t\t\t\tdata.interleavedBuffers[ this.data.uuid ] = this.data.toJSON( data );\n\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tisInterleavedBufferAttribute: true,\n\t\t\t\titemSize: this.itemSize,\n\t\t\t\tdata: this.data.uuid,\n\t\t\t\toffset: this.offset,\n\t\t\t\tnormalized: this.normalized\n\t\t\t};\n\n\t\t}\n\n\t}\n\n}\n\nInterleavedBufferAttribute.prototype.isInterleavedBufferAttribute = true;\n\n/**\n * parameters = {\n * color: <hex>,\n * map: new THREE.Texture( <Image> ),\n * alphaMap: new THREE.Texture( <Image> ),\n * rotation: <float>,\n * sizeAttenuation: <bool>\n * }\n */\n\nclass SpriteMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'SpriteMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.rotation = 0;\n\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.transparent = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.rotation = source.rotation;\n\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\treturn this;\n\n\t}\n\n}\n\nSpriteMaterial.prototype.isSpriteMaterial = true;\n\nlet _geometry;\n\nconst _intersectPoint = /*@__PURE__*/ new Vector3();\nconst _worldScale = /*@__PURE__*/ new Vector3();\nconst _mvPosition = /*@__PURE__*/ new Vector3();\n\nconst _alignedPosition = /*@__PURE__*/ new Vector2();\nconst _rotatedPosition = /*@__PURE__*/ new Vector2();\nconst _viewWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _vA = /*@__PURE__*/ new Vector3();\nconst _vB = /*@__PURE__*/ new Vector3();\nconst _vC = /*@__PURE__*/ new Vector3();\n\nconst _uvA = /*@__PURE__*/ new Vector2();\nconst _uvB = /*@__PURE__*/ new Vector2();\nconst _uvC = /*@__PURE__*/ new Vector2();\n\nclass Sprite extends Object3D {\n\n\tconstructor( material ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Sprite';\n\n\t\tif ( _geometry === undefined ) {\n\n\t\t\t_geometry = new BufferGeometry();\n\n\t\t\tconst float32Array = new Float32Array( [\n\t\t\t\t- 0.5, - 0.5, 0, 0, 0,\n\t\t\t\t0.5, - 0.5, 0, 1, 0,\n\t\t\t\t0.5, 0.5, 0, 1, 1,\n\t\t\t\t- 0.5, 0.5, 0, 0, 1\n\t\t\t] );\n\n\t\t\tconst interleavedBuffer = new InterleavedBuffer( float32Array, 5 );\n\n\t\t\t_geometry.setIndex( [ 0, 1, 2,\t0, 2, 3 ] );\n\t\t\t_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );\n\t\t\t_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );\n\n\t\t}\n\n\t\tthis.geometry = _geometry;\n\t\tthis.material = ( material !== undefined ) ? material : new SpriteMaterial();\n\n\t\tthis.center = new Vector2( 0.5, 0.5 );\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tif ( raycaster.camera === null ) {\n\n\t\t\tconsole.error( 'THREE.Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.' );\n\n\t\t}\n\n\t\t_worldScale.setFromMatrixScale( this.matrixWorld );\n\n\t\t_viewWorldMatrix.copy( raycaster.camera.matrixWorld );\n\t\tthis.modelViewMatrix.multiplyMatrices( raycaster.camera.matrixWorldInverse, this.matrixWorld );\n\n\t\t_mvPosition.setFromMatrixPosition( this.modelViewMatrix );\n\n\t\tif ( raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false ) {\n\n\t\t\t_worldScale.multiplyScalar( - _mvPosition.z );\n\n\t\t}\n\n\t\tconst rotation = this.material.rotation;\n\t\tlet sin, cos;\n\n\t\tif ( rotation !== 0 ) {\n\n\t\t\tcos = Math.cos( rotation );\n\t\t\tsin = Math.sin( rotation );\n\n\t\t}\n\n\t\tconst center = this.center;\n\n\t\ttransformVertex( _vA.set( - 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vB.set( 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\ttransformVertex( _vC.set( 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\n\t\t_uvA.set( 0, 0 );\n\t\t_uvB.set( 1, 0 );\n\t\t_uvC.set( 1, 1 );\n\n\t\t// check first triangle\n\t\tlet intersect = raycaster.ray.intersectTriangle( _vA, _vB, _vC, false, _intersectPoint );\n\n\t\tif ( intersect === null ) {\n\n\t\t\t// check second triangle\n\t\t\ttransformVertex( _vB.set( - 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos );\n\t\t\t_uvB.set( 0, 1 );\n\n\t\t\tintersect = raycaster.ray.intersectTriangle( _vA, _vC, _vB, false, _intersectPoint );\n\t\t\tif ( intersect === null ) {\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( _intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tpoint: _intersectPoint.clone(),\n\t\t\tuv: Triangle.getUV( _intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() ),\n\t\t\tface: null,\n\t\t\tobject: this\n\n\t\t} );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tif ( source.center !== undefined ) this.center.copy( source.center );\n\n\t\tthis.material = source.material;\n\n\t\treturn this;\n\n\t}\n\n}\n\nSprite.prototype.isSprite = true;\n\nfunction transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {\n\n\t// compute position in camera space\n\t_alignedPosition.subVectors( vertexPosition, center ).addScalar( 0.5 ).multiply( scale );\n\n\t// to check if rotation is not zero\n\tif ( sin !== undefined ) {\n\n\t\t_rotatedPosition.x = ( cos * _alignedPosition.x ) - ( sin * _alignedPosition.y );\n\t\t_rotatedPosition.y = ( sin * _alignedPosition.x ) + ( cos * _alignedPosition.y );\n\n\t} else {\n\n\t\t_rotatedPosition.copy( _alignedPosition );\n\n\t}\n\n\n\tvertexPosition.copy( mvPosition );\n\tvertexPosition.x += _rotatedPosition.x;\n\tvertexPosition.y += _rotatedPosition.y;\n\n\t// transform to world space\n\tvertexPosition.applyMatrix4( _viewWorldMatrix );\n\n}\n\nconst _v1$2 = /*@__PURE__*/ new Vector3();\nconst _v2$1 = /*@__PURE__*/ new Vector3();\n\nclass LOD extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis._currentLevel = 0;\n\n\t\tthis.type = 'LOD';\n\n\t\tObject.defineProperties( this, {\n\t\t\tlevels: {\n\t\t\t\tenumerable: true,\n\t\t\t\tvalue: []\n\t\t\t},\n\t\t\tisLOD: {\n\t\t\t\tvalue: true,\n\t\t\t}\n\t\t} );\n\n\t\tthis.autoUpdate = true;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tconst levels = source.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tthis.addLevel( level.object.clone(), level.distance );\n\n\t\t}\n\n\t\tthis.autoUpdate = source.autoUpdate;\n\n\t\treturn this;\n\n\t}\n\n\taddLevel( object, distance = 0 ) {\n\n\t\tdistance = Math.abs( distance );\n\n\t\tconst levels = this.levels;\n\n\t\tlet l;\n\n\t\tfor ( l = 0; l < levels.length; l ++ ) {\n\n\t\t\tif ( distance < levels[ l ].distance ) {\n\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlevels.splice( l, 0, { distance: distance, object: object } );\n\n\t\tthis.add( object );\n\n\t\treturn this;\n\n\t}\n\n\tgetCurrentLevel() {\n\n\t\treturn this._currentLevel;\n\n\t}\n\n\tgetObjectForDistance( distance ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tif ( distance < levels[ i ].distance ) {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn levels[ i - 1 ].object;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 0 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = raycaster.ray.origin.distanceTo( _v1$2 );\n\n\t\t\tthis.getObjectForDistance( distance ).raycast( raycaster, intersects );\n\n\t\t}\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst levels = this.levels;\n\n\t\tif ( levels.length > 1 ) {\n\n\t\t\t_v1$2.setFromMatrixPosition( camera.matrixWorld );\n\t\t\t_v2$1.setFromMatrixPosition( this.matrixWorld );\n\n\t\t\tconst distance = _v1$2.distanceTo( _v2$1 ) / camera.zoom;\n\n\t\t\tlevels[ 0 ].object.visible = true;\n\n\t\t\tlet i, l;\n\n\t\t\tfor ( i = 1, l = levels.length; i < l; i ++ ) {\n\n\t\t\t\tif ( distance >= levels[ i ].distance ) {\n\n\t\t\t\t\tlevels[ i - 1 ].object.visible = false;\n\t\t\t\t\tlevels[ i ].object.visible = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._currentLevel = i - 1;\n\n\t\t\tfor ( ; i < l; i ++ ) {\n\n\t\t\t\tlevels[ i ].object.visible = false;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tif ( this.autoUpdate === false ) data.object.autoUpdate = false;\n\n\t\tdata.object.levels = [];\n\n\t\tconst levels = this.levels;\n\n\t\tfor ( let i = 0, l = levels.length; i < l; i ++ ) {\n\n\t\t\tconst level = levels[ i ];\n\n\t\t\tdata.object.levels.push( {\n\t\t\t\tobject: level.object.uuid,\n\t\t\t\tdistance: level.distance\n\t\t\t} );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nconst _basePosition = /*@__PURE__*/ new Vector3();\n\nconst _skinIndex = /*@__PURE__*/ new Vector4();\nconst _skinWeight = /*@__PURE__*/ new Vector4();\n\nconst _vector$5 = /*@__PURE__*/ new Vector3();\nconst _matrix = /*@__PURE__*/ new Matrix4();\n\nclass SkinnedMesh extends Mesh {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'SkinnedMesh';\n\n\t\tthis.bindMode = 'attached';\n\t\tthis.bindMatrix = new Matrix4();\n\t\tthis.bindMatrixInverse = new Matrix4();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.bindMode = source.bindMode;\n\t\tthis.bindMatrix.copy( source.bindMatrix );\n\t\tthis.bindMatrixInverse.copy( source.bindMatrixInverse );\n\n\t\tthis.skeleton = source.skeleton;\n\n\t\treturn this;\n\n\t}\n\n\tbind( skeleton, bindMatrix ) {\n\n\t\tthis.skeleton = skeleton;\n\n\t\tif ( bindMatrix === undefined ) {\n\n\t\t\tthis.updateMatrixWorld( true );\n\n\t\t\tthis.skeleton.calculateInverses();\n\n\t\t\tbindMatrix = this.matrixWorld;\n\n\t\t}\n\n\t\tthis.bindMatrix.copy( bindMatrix );\n\t\tthis.bindMatrixInverse.copy( bindMatrix ).invert();\n\n\t}\n\n\tpose() {\n\n\t\tthis.skeleton.pose();\n\n\t}\n\n\tnormalizeSkinWeights() {\n\n\t\tconst vector = new Vector4();\n\n\t\tconst skinWeight = this.geometry.attributes.skinWeight;\n\n\t\tfor ( let i = 0, l = skinWeight.count; i < l; i ++ ) {\n\n\t\t\tvector.x = skinWeight.getX( i );\n\t\t\tvector.y = skinWeight.getY( i );\n\t\t\tvector.z = skinWeight.getZ( i );\n\t\t\tvector.w = skinWeight.getW( i );\n\n\t\t\tconst scale = 1.0 / vector.manhattanLength();\n\n\t\t\tif ( scale !== Infinity ) {\n\n\t\t\t\tvector.multiplyScalar( scale );\n\n\t\t\t} else {\n\n\t\t\t\tvector.set( 1, 0, 0, 0 ); // do something reasonable\n\n\t\t\t}\n\n\t\t\tskinWeight.setXYZW( i, vector.x, vector.y, vector.z, vector.w );\n\n\t\t}\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.bindMode === 'attached' ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.matrixWorld ).invert();\n\n\t\t} else if ( this.bindMode === 'detached' ) {\n\n\t\t\tthis.bindMatrixInverse.copy( this.bindMatrix ).invert();\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode );\n\n\t\t}\n\n\t}\n\n\tboneTransform( index, target ) {\n\n\t\tconst skeleton = this.skeleton;\n\t\tconst geometry = this.geometry;\n\n\t\t_skinIndex.fromBufferAttribute( geometry.attributes.skinIndex, index );\n\t\t_skinWeight.fromBufferAttribute( geometry.attributes.skinWeight, index );\n\n\t\t_basePosition.copy( target ).applyMatrix4( this.bindMatrix );\n\n\t\ttarget.set( 0, 0, 0 );\n\n\t\tfor ( let i = 0; i < 4; i ++ ) {\n\n\t\t\tconst weight = _skinWeight.getComponent( i );\n\n\t\t\tif ( weight !== 0 ) {\n\n\t\t\t\tconst boneIndex = _skinIndex.getComponent( i );\n\n\t\t\t\t_matrix.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] );\n\n\t\t\t\ttarget.addScaledVector( _vector$5.copy( _basePosition ).applyMatrix4( _matrix ), weight );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn target.applyMatrix4( this.bindMatrixInverse );\n\n\t}\n\n}\n\nSkinnedMesh.prototype.isSkinnedMesh = true;\n\nclass Bone extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'Bone';\n\n\t}\n\n}\n\nBone.prototype.isBone = true;\n\nclass DataTexture extends Texture {\n\n\tconstructor( data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, encoding ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );\n\n\t\tthis.image = { data: data, width: width, height: height };\n\n\t\tthis.magFilter = magFilter;\n\t\tthis.minFilter = minFilter;\n\n\t\tthis.generateMipmaps = false;\n\t\tthis.flipY = false;\n\t\tthis.unpackAlignment = 1;\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\nDataTexture.prototype.isDataTexture = true;\n\nconst _offsetMatrix = /*@__PURE__*/ new Matrix4();\nconst _identityMatrix = /*@__PURE__*/ new Matrix4();\n\nclass Skeleton {\n\n\tconstructor( bones = [], boneInverses = [] ) {\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.bones = bones.slice( 0 );\n\t\tthis.boneInverses = boneInverses;\n\t\tthis.boneMatrices = null;\n\n\t\tthis.boneTexture = null;\n\t\tthis.boneTextureSize = 0;\n\n\t\tthis.frame = - 1;\n\n\t\tthis.init();\n\n\t}\n\n\tinit() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tthis.boneMatrices = new Float32Array( bones.length * 16 );\n\n\t\t// calculate inverse bone matrices if necessary\n\n\t\tif ( boneInverses.length === 0 ) {\n\n\t\t\tthis.calculateInverses();\n\n\t\t} else {\n\n\t\t\t// handle special case\n\n\t\t\tif ( bones.length !== boneInverses.length ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.' );\n\n\t\t\t\tthis.boneInverses = [];\n\n\t\t\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\t\t\tthis.boneInverses.push( new Matrix4() );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tcalculateInverses() {\n\n\t\tthis.boneInverses.length = 0;\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst inverse = new Matrix4();\n\n\t\t\tif ( this.bones[ i ] ) {\n\n\t\t\t\tinverse.copy( this.bones[ i ].matrixWorld ).invert();\n\n\t\t\t}\n\n\t\t\tthis.boneInverses.push( inverse );\n\n\t\t}\n\n\t}\n\n\tpose() {\n\n\t\t// recover the bind-time world matrices\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tbone.matrixWorld.copy( this.boneInverses[ i ] ).invert();\n\n\t\t\t}\n\n\t\t}\n\n\t\t// compute the local matrices, positions, rotations and scales\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone ) {\n\n\t\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t\tbone.matrix.copy( bone.parent.matrixWorld ).invert();\n\t\t\t\t\tbone.matrix.multiply( bone.matrixWorld );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tbone.matrix.copy( bone.matrixWorld );\n\n\t\t\t\t}\n\n\t\t\t\tbone.matrix.decompose( bone.position, bone.quaternion, bone.scale );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tupdate() {\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\t\tconst boneMatrices = this.boneMatrices;\n\t\tconst boneTexture = this.boneTexture;\n\n\t\t// flatten bone matrices to array\n\n\t\tfor ( let i = 0, il = bones.length; i < il; i ++ ) {\n\n\t\t\t// compute the offset between the current and the original transform\n\n\t\t\tconst matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix;\n\n\t\t\t_offsetMatrix.multiplyMatrices( matrix, boneInverses[ i ] );\n\t\t\t_offsetMatrix.toArray( boneMatrices, i * 16 );\n\n\t\t}\n\n\t\tif ( boneTexture !== null ) {\n\n\t\t\tboneTexture.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new Skeleton( this.bones, this.boneInverses );\n\n\t}\n\n\tcomputeBoneTexture() {\n\n\t\t// layout (1 matrix = 4 pixels)\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n\t\t// with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\n\t\t// 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\n\t\t// 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\n\t\t// 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\n\n\t\tlet size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix\n\t\tsize = ceilPowerOfTwo( size );\n\t\tsize = Math.max( size, 4 );\n\n\t\tconst boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel\n\t\tboneMatrices.set( this.boneMatrices ); // copy current values\n\n\t\tconst boneTexture = new DataTexture( boneMatrices, size, size, RGBAFormat, FloatType );\n\n\t\tthis.boneMatrices = boneMatrices;\n\t\tthis.boneTexture = boneTexture;\n\t\tthis.boneTextureSize = size;\n\n\t\treturn this;\n\n\t}\n\n\tgetBoneByName( name ) {\n\n\t\tfor ( let i = 0, il = this.bones.length; i < il; i ++ ) {\n\n\t\t\tconst bone = this.bones[ i ];\n\n\t\t\tif ( bone.name === name ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn undefined;\n\n\t}\n\n\tdispose( ) {\n\n\t\tif ( this.boneTexture !== null ) {\n\n\t\t\tthis.boneTexture.dispose();\n\n\t\t\tthis.boneTexture = null;\n\n\t\t}\n\n\t}\n\n\tfromJSON( json, bones ) {\n\n\t\tthis.uuid = json.uuid;\n\n\t\tfor ( let i = 0, l = json.bones.length; i < l; i ++ ) {\n\n\t\t\tconst uuid = json.bones[ i ];\n\t\t\tlet bone = bones[ uuid ];\n\n\t\t\tif ( bone === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.Skeleton: No bone found with UUID:', uuid );\n\t\t\t\tbone = new Bone();\n\n\t\t\t}\n\n\t\t\tthis.bones.push( bone );\n\t\t\tthis.boneInverses.push( new Matrix4().fromArray( json.boneInverses[ i ] ) );\n\n\t\t}\n\n\t\tthis.init();\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.5,\n\t\t\t\ttype: 'Skeleton',\n\t\t\t\tgenerator: 'Skeleton.toJSON'\n\t\t\t},\n\t\t\tbones: [],\n\t\t\tboneInverses: []\n\t\t};\n\n\t\tdata.uuid = this.uuid;\n\n\t\tconst bones = this.bones;\n\t\tconst boneInverses = this.boneInverses;\n\n\t\tfor ( let i = 0, l = bones.length; i < l; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\t\t\tdata.bones.push( bone.uuid );\n\n\t\t\tconst boneInverse = boneInverses[ i ];\n\t\t\tdata.boneInverses.push( boneInverse.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n}\n\nclass InstancedBufferAttribute extends BufferAttribute {\n\n\tconstructor( array, itemSize, normalized, meshPerAttribute = 1 ) {\n\n\t\tif ( typeof normalized === 'number' ) {\n\n\t\t\tmeshPerAttribute = normalized;\n\n\t\t\tnormalized = false;\n\n\t\t\tconsole.error( 'THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.' );\n\n\t\t}\n\n\t\tsuper( array, itemSize, normalized );\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.meshPerAttribute = this.meshPerAttribute;\n\n\t\tdata.isInstancedBufferAttribute = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nInstancedBufferAttribute.prototype.isInstancedBufferAttribute = true;\n\nconst _instanceLocalMatrix = /*@__PURE__*/ new Matrix4();\nconst _instanceWorldMatrix = /*@__PURE__*/ new Matrix4();\n\nconst _instanceIntersects = [];\n\nconst _mesh = /*@__PURE__*/ new Mesh();\n\nclass InstancedMesh extends Mesh {\n\n\tconstructor( geometry, material, count ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );\n\t\tthis.instanceColor = null;\n\n\t\tthis.count = count;\n\n\t\tthis.frustumCulled = false;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.instanceMatrix.copy( source.instanceMatrix );\n\n\t\tif ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();\n\n\t\tthis.count = source.count;\n\n\t\treturn this;\n\n\t}\n\n\tgetColorAt( index, color ) {\n\n\t\tcolor.fromArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tgetMatrixAt( index, matrix ) {\n\n\t\tmatrix.fromArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst raycastTimes = this.count;\n\n\t\t_mesh.geometry = this.geometry;\n\t\t_mesh.material = this.material;\n\n\t\tif ( _mesh.material === undefined ) return;\n\n\t\tfor ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {\n\n\t\t\t// calculate the world matrix for each instance\n\n\t\t\tthis.getMatrixAt( instanceId, _instanceLocalMatrix );\n\n\t\t\t_instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );\n\n\t\t\t// the mesh represents this single instance\n\n\t\t\t_mesh.matrixWorld = _instanceWorldMatrix;\n\n\t\t\t_mesh.raycast( raycaster, _instanceIntersects );\n\n\t\t\t// process the result of raycast\n\n\t\t\tfor ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {\n\n\t\t\t\tconst intersect = _instanceIntersects[ i ];\n\t\t\t\tintersect.instanceId = instanceId;\n\t\t\t\tintersect.object = this;\n\t\t\t\tintersects.push( intersect );\n\n\t\t\t}\n\n\t\t\t_instanceIntersects.length = 0;\n\n\t\t}\n\n\t}\n\n\tsetColorAt( index, color ) {\n\n\t\tif ( this.instanceColor === null ) {\n\n\t\t\tthis.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ), 3 );\n\n\t\t}\n\n\t\tcolor.toArray( this.instanceColor.array, index * 3 );\n\n\t}\n\n\tsetMatrixAt( index, matrix ) {\n\n\t\tmatrix.toArray( this.instanceMatrix.array, index * 16 );\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t}\n\n\tdispose() {\n\n\t\tthis.dispatchEvent( { type: 'dispose' } );\n\n\t}\n\n}\n\nInstancedMesh.prototype.isInstancedMesh = true;\n\n/**\n * parameters = {\n * color: <hex>,\n * opacity: <float>,\n *\n * linewidth: <float>,\n * linecap: \"round\",\n * linejoin: \"round\"\n * }\n */\n\nclass LineBasicMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'LineBasicMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.linewidth = 1;\n\t\tthis.linecap = 'round';\n\t\tthis.linejoin = 'round';\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.linewidth = source.linewidth;\n\t\tthis.linecap = source.linecap;\n\t\tthis.linejoin = source.linejoin;\n\n\t\treturn this;\n\n\t}\n\n}\n\nLineBasicMaterial.prototype.isLineBasicMaterial = true;\n\nconst _start$1 = /*@__PURE__*/ new Vector3();\nconst _end$1 = /*@__PURE__*/ new Vector3();\nconst _inverseMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _ray$1 = /*@__PURE__*/ new Ray();\nconst _sphere$1 = /*@__PURE__*/ new Sphere();\n\nclass Line extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Line';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.material = source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\t// we assume non-indexed geometry\n\n\t\t\tif ( geometry.index === null ) {\n\n\t\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\t\tconst lineDistances = [ 0 ];\n\n\t\t\t\tfor ( let i = 1, l = positionAttribute.count; i < l; i ++ ) {\n\n\t\t\t\t\t_start$1.fromBufferAttribute( positionAttribute, i - 1 );\n\t\t\t\t\t_end$1.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\t\tlineDistances[ i ] = lineDistances[ i - 1 ];\n\t\t\t\t\tlineDistances[ i ] += _start$1.distanceTo( _end$1 );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t\t}\n\n\t\t} else if ( geometry.isGeometry ) {\n\n\t\t\tconsole.error( 'THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Line.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere$1.copy( geometry.boundingSphere );\n\t\t_sphere$1.applyMatrix4( matrixWorld );\n\t\t_sphere$1.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere$1 ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix$1.copy( matrixWorld ).invert();\n\t\t_ray$1.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$1 );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tconst vStart = new Vector3();\n\t\tconst vEnd = new Vector3();\n\t\tconst interSegment = new Vector3();\n\t\tconst interRay = new Vector3();\n\t\tconst step = this.isLineSegments ? 2 : 1;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst attributes = geometry.attributes;\n\t\t\tconst positionAttribute = attributes.position;\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\t\tconst a = index.getX( i );\n\t\t\t\t\tconst b = index.getX( i + 1 );\n\n\t\t\t\t\tvStart.fromBufferAttribute( positionAttribute, a );\n\t\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, b );\n\n\t\t\t\t\tconst distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\t\tintersects.push( {\n\n\t\t\t\t\t\tdistance: distance,\n\t\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\t\tindex: i,\n\t\t\t\t\t\tface: null,\n\t\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\t\tobject: this\n\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, l = end - 1; i < l; i += step ) {\n\n\t\t\t\t\tvStart.fromBufferAttribute( positionAttribute, i );\n\t\t\t\t\tvEnd.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\t\tconst distSq = _ray$1.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\n\n\t\t\t\t\tif ( distSq > localThresholdSq ) continue;\n\n\t\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\n\n\t\t\t\t\tconst distance = raycaster.ray.origin.distanceTo( interRay );\n\n\t\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\n\n\t\t\t\t\tintersects.push( {\n\n\t\t\t\t\t\tdistance: distance,\n\t\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\n\t\t\t\t\t\t// point: raycaster.ray.at( distance ),\n\t\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\n\t\t\t\t\t\tindex: i,\n\t\t\t\t\t\tface: null,\n\t\t\t\t\t\tfaceIndex: null,\n\t\t\t\t\t\tobject: this\n\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else if ( geometry.isGeometry ) {\n\n\t\t\tconsole.error( 'THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' );\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\tconst morphAttributes = geometry.morphAttributes;\n\t\t\tconst keys = Object.keys( morphAttributes );\n\n\t\t\tif ( keys.length > 0 ) {\n\n\t\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst morphTargets = geometry.morphTargets;\n\n\t\t\tif ( morphTargets !== undefined && morphTargets.length > 0 ) {\n\n\t\t\t\tconsole.error( 'THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nLine.prototype.isLine = true;\n\nconst _start = /*@__PURE__*/ new Vector3();\nconst _end = /*@__PURE__*/ new Vector3();\n\nclass LineSegments extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'LineSegments';\n\n\t}\n\n\tcomputeLineDistances() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\t// we assume non-indexed geometry\n\n\t\t\tif ( geometry.index === null ) {\n\n\t\t\t\tconst positionAttribute = geometry.attributes.position;\n\t\t\t\tconst lineDistances = [];\n\n\t\t\t\tfor ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) {\n\n\t\t\t\t\t_start.fromBufferAttribute( positionAttribute, i );\n\t\t\t\t\t_end.fromBufferAttribute( positionAttribute, i + 1 );\n\n\t\t\t\t\tlineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ];\n\t\t\t\t\tlineDistances[ i + 1 ] = lineDistances[ i ] + _start.distanceTo( _end );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.setAttribute( 'lineDistance', new Float32BufferAttribute( lineDistances, 1 ) );\n\n\t\t\t} else {\n\n\t\t\t\tconsole.warn( 'THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.' );\n\n\t\t\t}\n\n\t\t} else if ( geometry.isGeometry ) {\n\n\t\t\tconsole.error( 'THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nLineSegments.prototype.isLineSegments = true;\n\nclass LineLoop extends Line {\n\n\tconstructor( geometry, material ) {\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'LineLoop';\n\n\t}\n\n}\n\nLineLoop.prototype.isLineLoop = true;\n\n/**\n * parameters = {\n * color: <hex>,\n * opacity: <float>,\n * map: new THREE.Texture( <Image> ),\n * alphaMap: new THREE.Texture( <Image> ),\n *\n * size: <float>,\n * sizeAttenuation: <bool>\n *\n * }\n */\n\nclass PointsMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PointsMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.size = 1;\n\t\tthis.sizeAttenuation = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.size = source.size;\n\t\tthis.sizeAttenuation = source.sizeAttenuation;\n\n\t\treturn this;\n\n\t}\n\n}\n\nPointsMaterial.prototype.isPointsMaterial = true;\n\nconst _inverseMatrix = /*@__PURE__*/ new Matrix4();\nconst _ray = /*@__PURE__*/ new Ray();\nconst _sphere = /*@__PURE__*/ new Sphere();\nconst _position$2 = /*@__PURE__*/ new Vector3();\n\nclass Points extends Object3D {\n\n\tconstructor( geometry = new BufferGeometry(), material = new PointsMaterial() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Points';\n\n\t\tthis.geometry = geometry;\n\t\tthis.material = material;\n\n\t\tthis.updateMorphTargets();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.material = source.material;\n\t\tthis.geometry = source.geometry;\n\n\t\treturn this;\n\n\t}\n\n\traycast( raycaster, intersects ) {\n\n\t\tconst geometry = this.geometry;\n\t\tconst matrixWorld = this.matrixWorld;\n\t\tconst threshold = raycaster.params.Points.threshold;\n\t\tconst drawRange = geometry.drawRange;\n\n\t\t// Checking boundingSphere distance to ray\n\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\n\n\t\t_sphere.copy( geometry.boundingSphere );\n\t\t_sphere.applyMatrix4( matrixWorld );\n\t\t_sphere.radius += threshold;\n\n\t\tif ( raycaster.ray.intersectsSphere( _sphere ) === false ) return;\n\n\t\t//\n\n\t\t_inverseMatrix.copy( matrixWorld ).invert();\n\t\t_ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix );\n\n\t\tconst localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\n\t\tconst localThresholdSq = localThreshold * localThreshold;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\tconst index = geometry.index;\n\t\t\tconst attributes = geometry.attributes;\n\t\t\tconst positionAttribute = attributes.position;\n\n\t\t\tif ( index !== null ) {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( index.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, il = end; i < il; i ++ ) {\n\n\t\t\t\t\tconst a = index.getX( i );\n\n\t\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, a );\n\n\t\t\t\t\ttestPoint( _position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tconst start = Math.max( 0, drawRange.start );\n\t\t\t\tconst end = Math.min( positionAttribute.count, ( drawRange.start + drawRange.count ) );\n\n\t\t\t\tfor ( let i = start, l = end; i < l; i ++ ) {\n\n\t\t\t\t\t_position$2.fromBufferAttribute( positionAttribute, i );\n\n\t\t\t\t\ttestPoint( _position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' );\n\n\t\t}\n\n\t}\n\n\tupdateMorphTargets() {\n\n\t\tconst geometry = this.geometry;\n\n\t\tif ( geometry.isBufferGeometry ) {\n\n\t\t\tconst morphAttributes = geometry.morphAttributes;\n\t\t\tconst keys = Object.keys( morphAttributes );\n\n\t\t\tif ( keys.length > 0 ) {\n\n\t\t\t\tconst morphAttribute = morphAttributes[ keys[ 0 ] ];\n\n\t\t\t\tif ( morphAttribute !== undefined ) {\n\n\t\t\t\t\tthis.morphTargetInfluences = [];\n\t\t\t\t\tthis.morphTargetDictionary = {};\n\n\t\t\t\t\tfor ( let m = 0, ml = morphAttribute.length; m < ml; m ++ ) {\n\n\t\t\t\t\t\tconst name = morphAttribute[ m ].name || String( m );\n\n\t\t\t\t\t\tthis.morphTargetInfluences.push( 0 );\n\t\t\t\t\t\tthis.morphTargetDictionary[ name ] = m;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tconst morphTargets = geometry.morphTargets;\n\n\t\t\tif ( morphTargets !== undefined && morphTargets.length > 0 ) {\n\n\t\t\t\tconsole.error( 'THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.' );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n}\n\nPoints.prototype.isPoints = true;\n\nfunction testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) {\n\n\tconst rayPointDistanceSq = _ray.distanceSqToPoint( point );\n\n\tif ( rayPointDistanceSq < localThresholdSq ) {\n\n\t\tconst intersectPoint = new Vector3();\n\n\t\t_ray.closestPointToPoint( point, intersectPoint );\n\t\tintersectPoint.applyMatrix4( matrixWorld );\n\n\t\tconst distance = raycaster.ray.origin.distanceTo( intersectPoint );\n\n\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\n\n\t\tintersects.push( {\n\n\t\t\tdistance: distance,\n\t\t\tdistanceToRay: Math.sqrt( rayPointDistanceSq ),\n\t\t\tpoint: intersectPoint,\n\t\t\tindex: index,\n\t\t\tface: null,\n\t\t\tobject: object\n\n\t\t} );\n\n\t}\n\n}\n\nclass VideoTexture extends Texture {\n\n\tconstructor( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.format = format !== undefined ? format : RGBFormat;\n\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : LinearFilter;\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : LinearFilter;\n\n\t\tthis.generateMipmaps = false;\n\n\t\tconst scope = this;\n\n\t\tfunction updateVideo() {\n\n\t\t\tscope.needsUpdate = true;\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t\tif ( 'requestVideoFrameCallback' in video ) {\n\n\t\t\tvideo.requestVideoFrameCallback( updateVideo );\n\n\t\t}\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor( this.image ).copy( this );\n\n\t}\n\n\tupdate() {\n\n\t\tconst video = this.image;\n\t\tconst hasVideoFrameCallback = 'requestVideoFrameCallback' in video;\n\n\t\tif ( hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA ) {\n\n\t\t\tthis.needsUpdate = true;\n\n\t\t}\n\n\t}\n\n}\n\nVideoTexture.prototype.isVideoTexture = true;\n\nclass CompressedTexture extends Texture {\n\n\tconstructor( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );\n\n\t\tthis.image = { width: width, height: height };\n\t\tthis.mipmaps = mipmaps;\n\n\t\t// no flipping for cube textures\n\t\t// (also flipping doesn't work for compressed textures )\n\n\t\tthis.flipY = false;\n\n\t\t// can't generate mipmaps for compressed textures\n\t\t// mips must be embedded in DDS files\n\n\t\tthis.generateMipmaps = false;\n\n\t}\n\n}\n\nCompressedTexture.prototype.isCompressedTexture = true;\n\nclass CanvasTexture extends Texture {\n\n\tconstructor( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\n\n\t\tsuper( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.needsUpdate = true;\n\n\t}\n\n}\n\nCanvasTexture.prototype.isCanvasTexture = true;\n\nclass DepthTexture extends Texture {\n\n\tconstructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {\n\n\t\tformat = format !== undefined ? format : DepthFormat;\n\n\t\tif ( format !== DepthFormat && format !== DepthStencilFormat ) {\n\n\t\t\tthrow new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );\n\n\t\t}\n\n\t\tif ( type === undefined && format === DepthFormat ) type = UnsignedShortType;\n\t\tif ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;\n\n\t\tsuper( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\n\n\t\tthis.image = { width: width, height: height };\n\n\t\tthis.magFilter = magFilter !== undefined ? magFilter : NearestFilter;\n\t\tthis.minFilter = minFilter !== undefined ? minFilter : NearestFilter;\n\n\t\tthis.flipY = false;\n\t\tthis.generateMipmaps\t= false;\n\n\t}\n\n\n}\n\nDepthTexture.prototype.isDepthTexture = true;\n\nclass CircleGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, segments = 8, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CircleGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tsegments: segments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tsegments = Math.max( 3, segments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// center point\n\n\t\tvertices.push( 0, 0, 0 );\n\t\tnormals.push( 0, 0, 1 );\n\t\tuvs.push( 0.5, 0.5 );\n\n\t\tfor ( let s = 0, i = 3; s <= segments; s ++, i += 3 ) {\n\n\t\t\tconst segment = thetaStart + s / segments * thetaLength;\n\n\t\t\t// vertex\n\n\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t// normal\n\n\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t// uvs\n\n\t\t\tuv.x = ( vertices[ i ] / radius + 1 ) / 2;\n\t\t\tuv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2;\n\n\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tindices.push( i, i + 1, 0 );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CircleGeometry( data.radius, data.segments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass CylinderGeometry extends BufferGeometry {\n\n\tconstructor( radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 8, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\t\tthis.type = 'CylinderGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradiusTop: radiusTop,\n\t\t\tradiusBottom: radiusBottom,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tconst scope = this;\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\theightSegments = Math.floor( heightSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet index = 0;\n\t\tconst indexArray = [];\n\t\tconst halfHeight = height / 2;\n\t\tlet groupStart = 0;\n\n\t\t// generate geometry\n\n\t\tgenerateTorso();\n\n\t\tif ( openEnded === false ) {\n\n\t\t\tif ( radiusTop > 0 ) generateCap( true );\n\t\t\tif ( radiusBottom > 0 ) generateCap( false );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\tfunction generateTorso() {\n\n\t\t\tconst normal = new Vector3();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\t// this will be used to calculate the normal\n\t\t\tconst slope = ( radiusBottom - radiusTop ) / height;\n\n\t\t\t// generate vertices, normals and uvs\n\n\t\t\tfor ( let y = 0; y <= heightSegments; y ++ ) {\n\n\t\t\t\tconst indexRow = [];\n\n\t\t\t\tconst v = y / heightSegments;\n\n\t\t\t\t// calculate the radius of the current row\n\n\t\t\t\tconst radius = v * ( radiusBottom - radiusTop ) + radiusTop;\n\n\t\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\t\tconst u = x / radialSegments;\n\n\t\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\t\tconst sinTheta = Math.sin( theta );\n\t\t\t\t\tconst cosTheta = Math.cos( theta );\n\n\t\t\t\t\t// vertex\n\n\t\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\t\tvertex.y = - v * height + halfHeight;\n\t\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t\t// normal\n\n\t\t\t\t\tnormal.set( sinTheta, slope, cosTheta ).normalize();\n\t\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t\t// uv\n\n\t\t\t\t\tuvs.push( u, 1 - v );\n\n\t\t\t\t\t// save index of vertex in respective row\n\n\t\t\t\t\tindexRow.push( index ++ );\n\n\t\t\t\t}\n\n\t\t\t\t// now save vertices of the row in our index array\n\n\t\t\t\tindexArray.push( indexRow );\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tfor ( let y = 0; y < heightSegments; y ++ ) {\n\n\t\t\t\t\t// we use the index array to access the correct indices\n\n\t\t\t\t\tconst a = indexArray[ y ][ x ];\n\t\t\t\t\tconst b = indexArray[ y + 1 ][ x ];\n\t\t\t\t\tconst c = indexArray[ y + 1 ][ x + 1 ];\n\t\t\t\t\tconst d = indexArray[ y ][ x + 1 ];\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t\t// update group counter\n\n\t\t\t\t\tgroupCount += 6;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, 0 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t\tfunction generateCap( top ) {\n\n\t\t\t// save the index of the first center vertex\n\t\t\tconst centerIndexStart = index;\n\n\t\t\tconst uv = new Vector2();\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tlet groupCount = 0;\n\n\t\t\tconst radius = ( top === true ) ? radiusTop : radiusBottom;\n\t\t\tconst sign = ( top === true ) ? 1 : - 1;\n\n\t\t\t// first we generate the center vertex data of the cap.\n\t\t\t// because the geometry needs one set of uvs per face,\n\t\t\t// we must generate a center vertex per face/segment\n\n\t\t\tfor ( let x = 1; x <= radialSegments; x ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertices.push( 0, halfHeight * sign, 0 );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( 0.5, 0.5 );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// save the index of the last center vertex\n\t\t\tconst centerIndexEnd = index;\n\n\t\t\t// now we generate the surrounding vertices, normals and uvs\n\n\t\t\tfor ( let x = 0; x <= radialSegments; x ++ ) {\n\n\t\t\t\tconst u = x / radialSegments;\n\t\t\t\tconst theta = u * thetaLength + thetaStart;\n\n\t\t\t\tconst cosTheta = Math.cos( theta );\n\t\t\t\tconst sinTheta = Math.sin( theta );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * sinTheta;\n\t\t\t\tvertex.y = halfHeight * sign;\n\t\t\t\tvertex.z = radius * cosTheta;\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, sign, 0 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( cosTheta * 0.5 ) + 0.5;\n\t\t\t\tuv.y = ( sinTheta * 0.5 * sign ) + 0.5;\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t// increase index\n\n\t\t\t\tindex ++;\n\n\t\t\t}\n\n\t\t\t// generate indices\n\n\t\t\tfor ( let x = 0; x < radialSegments; x ++ ) {\n\n\t\t\t\tconst c = centerIndexStart + x;\n\t\t\t\tconst i = centerIndexEnd + x;\n\n\t\t\t\tif ( top === true ) {\n\n\t\t\t\t\t// face top\n\n\t\t\t\t\tindices.push( i, i + 1, c );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// face bottom\n\n\t\t\t\t\tindices.push( i + 1, i, c );\n\n\t\t\t\t}\n\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t\t// add a group to the geometry. this will ensure multi material support\n\n\t\t\tscope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );\n\n\t\t\t// calculate new start value for groups\n\n\t\t\tgroupStart += groupCount;\n\n\t\t}\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new CylinderGeometry( data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ConeGeometry extends CylinderGeometry {\n\n\tconstructor( radius = 1, height = 1, radialSegments = 8, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper( 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength );\n\n\t\tthis.type = 'ConeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\theight: height,\n\t\t\tradialSegments: radialSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\topenEnded: openEnded,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new ConeGeometry( data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass PolyhedronGeometry extends BufferGeometry {\n\n\tconstructor( vertices = [], indices = [], radius = 1, detail = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'PolyhedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tvertices: vertices,\n\t\t\tindices: indices,\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t\t// default buffer data\n\n\t\tconst vertexBuffer = [];\n\t\tconst uvBuffer = [];\n\n\t\t// the subdivision creates the vertex buffer data\n\n\t\tsubdivide( detail );\n\n\t\t// all vertices should lie on a conceptual sphere with a given radius\n\n\t\tapplyRadius( radius );\n\n\t\t// finally, create the uv data\n\n\t\tgenerateUVs();\n\n\t\t// build non-indexed geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );\n\n\t\tif ( detail === 0 ) {\n\n\t\t\tthis.computeVertexNormals(); // flat normals\n\n\t\t} else {\n\n\t\t\tthis.normalizeNormals(); // smooth normals\n\n\t\t}\n\n\t\t// helper functions\n\n\t\tfunction subdivide( detail ) {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\t// iterate over all faces and apply a subdivison with the given detail value\n\n\t\t\tfor ( let i = 0; i < indices.length; i += 3 ) {\n\n\t\t\t\t// get the vertices of the face\n\n\t\t\t\tgetVertexByIndex( indices[ i + 0 ], a );\n\t\t\t\tgetVertexByIndex( indices[ i + 1 ], b );\n\t\t\t\tgetVertexByIndex( indices[ i + 2 ], c );\n\n\t\t\t\t// perform subdivision\n\n\t\t\t\tsubdivideFace( a, b, c, detail );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction subdivideFace( a, b, c, detail ) {\n\n\t\t\tconst cols = detail + 1;\n\n\t\t\t// we use this multidimensional array as a data structure for creating the subdivision\n\n\t\t\tconst v = [];\n\n\t\t\t// construct all of the vertices for this subdivision\n\n\t\t\tfor ( let i = 0; i <= cols; i ++ ) {\n\n\t\t\t\tv[ i ] = [];\n\n\t\t\t\tconst aj = a.clone().lerp( c, i / cols );\n\t\t\t\tconst bj = b.clone().lerp( c, i / cols );\n\n\t\t\t\tconst rows = cols - i;\n\n\t\t\t\tfor ( let j = 0; j <= rows; j ++ ) {\n\n\t\t\t\t\tif ( j === 0 && i === cols ) {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tv[ i ][ j ] = aj.clone().lerp( bj, j / rows );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// construct all of the faces\n\n\t\t\tfor ( let i = 0; i < cols; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j < 2 * ( cols - i ) - 1; j ++ ) {\n\n\t\t\t\t\tconst k = Math.floor( j / 2 );\n\n\t\t\t\t\tif ( j % 2 === 0 ) {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\t\t\t\t\t\tpushVertex( v[ i ][ k ] );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tpushVertex( v[ i ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k + 1 ] );\n\t\t\t\t\t\tpushVertex( v[ i + 1 ][ k ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction applyRadius( radius ) {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\t// iterate over the entire buffer and apply the radius to each vertex\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tvertex.normalize().multiplyScalar( radius );\n\n\t\t\t\tvertexBuffer[ i + 0 ] = vertex.x;\n\t\t\t\tvertexBuffer[ i + 1 ] = vertex.y;\n\t\t\t\tvertexBuffer[ i + 2 ] = vertex.z;\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tconst vertex = new Vector3();\n\n\t\t\tfor ( let i = 0; i < vertexBuffer.length; i += 3 ) {\n\n\t\t\t\tvertex.x = vertexBuffer[ i + 0 ];\n\t\t\t\tvertex.y = vertexBuffer[ i + 1 ];\n\t\t\t\tvertex.z = vertexBuffer[ i + 2 ];\n\n\t\t\t\tconst u = azimuth( vertex ) / 2 / Math.PI + 0.5;\n\t\t\t\tconst v = inclination( vertex ) / Math.PI + 0.5;\n\t\t\t\tuvBuffer.push( u, 1 - v );\n\n\t\t\t}\n\n\t\t\tcorrectUVs();\n\n\t\t\tcorrectSeam();\n\n\t\t}\n\n\t\tfunction correctSeam() {\n\n\t\t\t// handle case when face straddles the seam, see #3269\n\n\t\t\tfor ( let i = 0; i < uvBuffer.length; i += 6 ) {\n\n\t\t\t\t// uv data of a single face\n\n\t\t\t\tconst x0 = uvBuffer[ i + 0 ];\n\t\t\t\tconst x1 = uvBuffer[ i + 2 ];\n\t\t\t\tconst x2 = uvBuffer[ i + 4 ];\n\n\t\t\t\tconst max = Math.max( x0, x1, x2 );\n\t\t\t\tconst min = Math.min( x0, x1, x2 );\n\n\t\t\t\t// 0.9 is somewhat arbitrary\n\n\t\t\t\tif ( max > 0.9 && min < 0.1 ) {\n\n\t\t\t\t\tif ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1;\n\t\t\t\t\tif ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1;\n\t\t\t\t\tif ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction pushVertex( vertex ) {\n\n\t\t\tvertexBuffer.push( vertex.x, vertex.y, vertex.z );\n\n\t\t}\n\n\t\tfunction getVertexByIndex( index, vertex ) {\n\n\t\t\tconst stride = index * 3;\n\n\t\t\tvertex.x = vertices[ stride + 0 ];\n\t\t\tvertex.y = vertices[ stride + 1 ];\n\t\t\tvertex.z = vertices[ stride + 2 ];\n\n\t\t}\n\n\t\tfunction correctUVs() {\n\n\t\t\tconst a = new Vector3();\n\t\t\tconst b = new Vector3();\n\t\t\tconst c = new Vector3();\n\n\t\t\tconst centroid = new Vector3();\n\n\t\t\tconst uvA = new Vector2();\n\t\t\tconst uvB = new Vector2();\n\t\t\tconst uvC = new Vector2();\n\n\t\t\tfor ( let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) {\n\n\t\t\t\ta.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] );\n\t\t\t\tb.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] );\n\t\t\t\tc.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] );\n\n\t\t\t\tuvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] );\n\t\t\t\tuvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] );\n\t\t\t\tuvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] );\n\n\t\t\t\tcentroid.copy( a ).add( b ).add( c ).divideScalar( 3 );\n\n\t\t\t\tconst azi = azimuth( centroid );\n\n\t\t\t\tcorrectUV( uvA, j + 0, a, azi );\n\t\t\t\tcorrectUV( uvB, j + 2, b, azi );\n\t\t\t\tcorrectUV( uvC, j + 4, c, azi );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction correctUV( uv, stride, vector, azimuth ) {\n\n\t\t\tif ( ( azimuth < 0 ) && ( uv.x === 1 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = uv.x - 1;\n\n\t\t\t}\n\n\t\t\tif ( ( vector.x === 0 ) && ( vector.z === 0 ) ) {\n\n\t\t\t\tuvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Angle around the Y axis, counter-clockwise when looking from above.\n\n\t\tfunction azimuth( vector ) {\n\n\t\t\treturn Math.atan2( vector.z, - vector.x );\n\n\t\t}\n\n\n\t\t// Angle above the XZ plane.\n\n\t\tfunction inclination( vector ) {\n\n\t\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\n\n\t\t}\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new PolyhedronGeometry( data.vertices, data.indices, data.radius, data.details );\n\n\t}\n\n}\n\nclass DodecahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\t\tconst r = 1 / t;\n\n\t\tconst vertices = [\n\n\t\t\t// (±1, ±1, ±1)\n\t\t\t- 1, - 1, - 1,\t- 1, - 1, 1,\n\t\t\t- 1, 1, - 1, - 1, 1, 1,\n\t\t\t1, - 1, - 1, 1, - 1, 1,\n\t\t\t1, 1, - 1, 1, 1, 1,\n\n\t\t\t// (0, ±1/φ, ±φ)\n\t\t\t0, - r, - t, 0, - r, t,\n\t\t\t0, r, - t, 0, r, t,\n\n\t\t\t// (±1/φ, ±φ, 0)\n\t\t\t- r, - t, 0, - r, t, 0,\n\t\t\tr, - t, 0, r, t, 0,\n\n\t\t\t// (±φ, 0, ±1/φ)\n\t\t\t- t, 0, - r, t, 0, - r,\n\t\t\t- t, 0, r, t, 0, r\n\t\t];\n\n\t\tconst indices = [\n\t\t\t3, 11, 7, \t3, 7, 15, \t3, 15, 13,\n\t\t\t7, 19, 17, \t7, 17, 6, \t7, 6, 15,\n\t\t\t17, 4, 8, \t17, 8, 10, \t17, 10, 6,\n\t\t\t8, 0, 16, \t8, 16, 2, \t8, 2, 10,\n\t\t\t0, 12, 1, \t0, 1, 18, \t0, 18, 16,\n\t\t\t6, 10, 2, \t6, 2, 13, \t6, 13, 15,\n\t\t\t2, 16, 18, \t2, 18, 3, \t2, 3, 13,\n\t\t\t18, 1, 9, \t18, 9, 11, \t18, 11, 3,\n\t\t\t4, 14, 12, \t4, 12, 0, \t4, 0, 8,\n\t\t\t11, 9, 5, \t11, 5, 19, \t11, 19, 7,\n\t\t\t19, 5, 14, \t19, 14, 4, \t19, 4, 17,\n\t\t\t1, 12, 14, \t1, 14, 5, \t1, 5, 9\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'DodecahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new DodecahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nconst _v0 = new Vector3();\nconst _v1$1 = new Vector3();\nconst _normal = new Vector3();\nconst _triangle = new Triangle();\n\nclass EdgesGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null, thresholdAngle = 1 ) {\n\n\t\tsuper();\n\t\tthis.type = 'EdgesGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry,\n\t\t\tthresholdAngle: thresholdAngle\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\tconst precisionPoints = 4;\n\t\t\tconst precision = Math.pow( 10, precisionPoints );\n\t\t\tconst thresholdDot = Math.cos( DEG2RAD * thresholdAngle );\n\n\t\t\tconst indexAttr = geometry.getIndex();\n\t\t\tconst positionAttr = geometry.getAttribute( 'position' );\n\t\t\tconst indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n\n\t\t\tconst indexArr = [ 0, 0, 0 ];\n\t\t\tconst vertKeys = [ 'a', 'b', 'c' ];\n\t\t\tconst hashes = new Array( 3 );\n\n\t\t\tconst edgeData = {};\n\t\t\tconst vertices = [];\n\t\t\tfor ( let i = 0; i < indexCount; i += 3 ) {\n\n\t\t\t\tif ( indexAttr ) {\n\n\t\t\t\t\tindexArr[ 0 ] = indexAttr.getX( i );\n\t\t\t\t\tindexArr[ 1 ] = indexAttr.getX( i + 1 );\n\t\t\t\t\tindexArr[ 2 ] = indexAttr.getX( i + 2 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tindexArr[ 0 ] = i;\n\t\t\t\t\tindexArr[ 1 ] = i + 1;\n\t\t\t\t\tindexArr[ 2 ] = i + 2;\n\n\t\t\t\t}\n\n\t\t\t\tconst { a, b, c } = _triangle;\n\t\t\t\ta.fromBufferAttribute( positionAttr, indexArr[ 0 ] );\n\t\t\t\tb.fromBufferAttribute( positionAttr, indexArr[ 1 ] );\n\t\t\t\tc.fromBufferAttribute( positionAttr, indexArr[ 2 ] );\n\t\t\t\t_triangle.getNormal( _normal );\n\n\t\t\t\t// create hashes for the edge from the vertices\n\t\t\t\thashes[ 0 ] = `${ Math.round( a.x * precision ) },${ Math.round( a.y * precision ) },${ Math.round( a.z * precision ) }`;\n\t\t\t\thashes[ 1 ] = `${ Math.round( b.x * precision ) },${ Math.round( b.y * precision ) },${ Math.round( b.z * precision ) }`;\n\t\t\t\thashes[ 2 ] = `${ Math.round( c.x * precision ) },${ Math.round( c.y * precision ) },${ Math.round( c.z * precision ) }`;\n\n\t\t\t\t// skip degenerate triangles\n\t\t\t\tif ( hashes[ 0 ] === hashes[ 1 ] || hashes[ 1 ] === hashes[ 2 ] || hashes[ 2 ] === hashes[ 0 ] ) {\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\t// iterate over every edge\n\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t// get the first and next vertex making up the edge\n\t\t\t\t\tconst jNext = ( j + 1 ) % 3;\n\t\t\t\t\tconst vecHash0 = hashes[ j ];\n\t\t\t\t\tconst vecHash1 = hashes[ jNext ];\n\t\t\t\t\tconst v0 = _triangle[ vertKeys[ j ] ];\n\t\t\t\t\tconst v1 = _triangle[ vertKeys[ jNext ] ];\n\n\t\t\t\t\tconst hash = `${ vecHash0 }_${ vecHash1 }`;\n\t\t\t\t\tconst reverseHash = `${ vecHash1 }_${ vecHash0 }`;\n\n\t\t\t\t\tif ( reverseHash in edgeData && edgeData[ reverseHash ] ) {\n\n\t\t\t\t\t\t// if we found a sibling edge add it into the vertex array if\n\t\t\t\t\t\t// it meets the angle threshold and delete the edge from the map.\n\t\t\t\t\t\tif ( _normal.dot( edgeData[ reverseHash ].normal ) <= thresholdDot ) {\n\n\t\t\t\t\t\t\tvertices.push( v0.x, v0.y, v0.z );\n\t\t\t\t\t\t\tvertices.push( v1.x, v1.y, v1.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tedgeData[ reverseHash ] = null;\n\n\t\t\t\t\t} else if ( ! ( hash in edgeData ) ) {\n\n\t\t\t\t\t\t// if we've already got an edge here then skip adding a new one\n\t\t\t\t\t\tedgeData[ hash ] = {\n\n\t\t\t\t\t\t\tindex0: indexArr[ j ],\n\t\t\t\t\t\t\tindex1: indexArr[ jNext ],\n\t\t\t\t\t\t\tnormal: _normal.clone(),\n\n\t\t\t\t\t\t};\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// iterate over all remaining, unmatched edges and add them to the vertex array\n\t\t\tfor ( const key in edgeData ) {\n\n\t\t\t\tif ( edgeData[ key ] ) {\n\n\t\t\t\t\tconst { index0, index1 } = edgeData[ key ];\n\t\t\t\t\t_v0.fromBufferAttribute( positionAttr, index0 );\n\t\t\t\t\t_v1$1.fromBufferAttribute( positionAttr, index1 );\n\n\t\t\t\t\tvertices.push( _v0.x, _v0.y, _v0.z );\n\t\t\t\t\tvertices.push( _v1$1.x, _v1$1.y, _v1$1.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Extensible curve object.\n *\n * Some common of curve methods:\n * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )\n * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )\n * .getPoints(), .getSpacedPoints()\n * .getLength()\n * .updateArcLengths()\n *\n * This following curves inherit from THREE.Curve:\n *\n * -- 2D curves --\n * THREE.ArcCurve\n * THREE.CubicBezierCurve\n * THREE.EllipseCurve\n * THREE.LineCurve\n * THREE.QuadraticBezierCurve\n * THREE.SplineCurve\n *\n * -- 3D curves --\n * THREE.CatmullRomCurve3\n * THREE.CubicBezierCurve3\n * THREE.LineCurve3\n * THREE.QuadraticBezierCurve3\n *\n * A series of curves can be represented as a THREE.CurvePath.\n *\n **/\n\nclass Curve {\n\n\tconstructor() {\n\n\t\tthis.type = 'Curve';\n\n\t\tthis.arcLengthDivisions = 200;\n\n\t}\n\n\t// Virtual base class method to overwrite and implement in subclasses\n\t//\t- t [0 .. 1]\n\n\tgetPoint( /* t, optionalTarget */ ) {\n\n\t\tconsole.warn( 'THREE.Curve: .getPoint() not implemented.' );\n\t\treturn null;\n\n\t}\n\n\t// Get point at relative position in curve according to arc length\n\t// - u [0 .. 1]\n\n\tgetPointAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getPoint( t, optionalTarget );\n\n\t}\n\n\t// Get sequence of points using getPoint( t )\n\n\tgetPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPoint( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get sequence of points using getPointAt( u )\n\n\tgetSpacedPoints( divisions = 5 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let d = 0; d <= divisions; d ++ ) {\n\n\t\t\tpoints.push( this.getPointAt( d / divisions ) );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\t// Get total curve arc length\n\n\tgetLength() {\n\n\t\tconst lengths = this.getLengths();\n\t\treturn lengths[ lengths.length - 1 ];\n\n\t}\n\n\t// Get list of cumulative segment lengths\n\n\tgetLengths( divisions = this.arcLengthDivisions ) {\n\n\t\tif ( this.cacheArcLengths &&\n\t\t\t( this.cacheArcLengths.length === divisions + 1 ) &&\n\t\t\t! this.needsUpdate ) {\n\n\t\t\treturn this.cacheArcLengths;\n\n\t\t}\n\n\t\tthis.needsUpdate = false;\n\n\t\tconst cache = [];\n\t\tlet current, last = this.getPoint( 0 );\n\t\tlet sum = 0;\n\n\t\tcache.push( 0 );\n\n\t\tfor ( let p = 1; p <= divisions; p ++ ) {\n\n\t\t\tcurrent = this.getPoint( p / divisions );\n\t\t\tsum += current.distanceTo( last );\n\t\t\tcache.push( sum );\n\t\t\tlast = current;\n\n\t\t}\n\n\t\tthis.cacheArcLengths = cache;\n\n\t\treturn cache; // { sums: cache, sum: sum }; Sum is in the last element.\n\n\t}\n\n\tupdateArcLengths() {\n\n\t\tthis.needsUpdate = true;\n\t\tthis.getLengths();\n\n\t}\n\n\t// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\n\n\tgetUtoTmapping( u, distance ) {\n\n\t\tconst arcLengths = this.getLengths();\n\n\t\tlet i = 0;\n\t\tconst il = arcLengths.length;\n\n\t\tlet targetArcLength; // The targeted u distance value to get\n\n\t\tif ( distance ) {\n\n\t\t\ttargetArcLength = distance;\n\n\t\t} else {\n\n\t\t\ttargetArcLength = u * arcLengths[ il - 1 ];\n\n\t\t}\n\n\t\t// binary search for the index with largest value smaller than target u distance\n\n\t\tlet low = 0, high = il - 1, comparison;\n\n\t\twhile ( low <= high ) {\n\n\t\t\ti = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n\n\t\t\tcomparison = arcLengths[ i ] - targetArcLength;\n\n\t\t\tif ( comparison < 0 ) {\n\n\t\t\t\tlow = i + 1;\n\n\t\t\t} else if ( comparison > 0 ) {\n\n\t\t\t\thigh = i - 1;\n\n\t\t\t} else {\n\n\t\t\t\thigh = i;\n\t\t\t\tbreak;\n\n\t\t\t\t// DONE\n\n\t\t\t}\n\n\t\t}\n\n\t\ti = high;\n\n\t\tif ( arcLengths[ i ] === targetArcLength ) {\n\n\t\t\treturn i / ( il - 1 );\n\n\t\t}\n\n\t\t// we could get finer grain at lengths, or use simple interpolation between two points\n\n\t\tconst lengthBefore = arcLengths[ i ];\n\t\tconst lengthAfter = arcLengths[ i + 1 ];\n\n\t\tconst segmentLength = lengthAfter - lengthBefore;\n\n\t\t// determine where we are between the 'before' and 'after' points\n\n\t\tconst segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;\n\n\t\t// add that fractional amount to t\n\n\t\tconst t = ( i + segmentFraction ) / ( il - 1 );\n\n\t\treturn t;\n\n\t}\n\n\t// Returns a unit vector tangent at t\n\t// In case any sub curve does not implement its tangent derivation,\n\t// 2 points a small delta apart will be used to find its gradient\n\t// which seems to give a reasonable approximation\n\n\tgetTangent( t, optionalTarget ) {\n\n\t\tconst delta = 0.0001;\n\t\tlet t1 = t - delta;\n\t\tlet t2 = t + delta;\n\n\t\t// Capping in case of danger\n\n\t\tif ( t1 < 0 ) t1 = 0;\n\t\tif ( t2 > 1 ) t2 = 1;\n\n\t\tconst pt1 = this.getPoint( t1 );\n\t\tconst pt2 = this.getPoint( t2 );\n\n\t\tconst tangent = optionalTarget || ( ( pt1.isVector2 ) ? new Vector2() : new Vector3() );\n\n\t\ttangent.copy( pt2 ).sub( pt1 ).normalize();\n\n\t\treturn tangent;\n\n\t}\n\n\tgetTangentAt( u, optionalTarget ) {\n\n\t\tconst t = this.getUtoTmapping( u );\n\t\treturn this.getTangent( t, optionalTarget );\n\n\t}\n\n\tcomputeFrenetFrames( segments, closed ) {\n\n\t\t// see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\n\n\t\tconst normal = new Vector3();\n\n\t\tconst tangents = [];\n\t\tconst normals = [];\n\t\tconst binormals = [];\n\n\t\tconst vec = new Vector3();\n\t\tconst mat = new Matrix4();\n\n\t\t// compute the tangent vectors for each segment on the curve\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst u = i / segments;\n\n\t\t\ttangents[ i ] = this.getTangentAt( u, new Vector3() );\n\n\t\t}\n\n\t\t// select an initial normal vector perpendicular to the first tangent vector,\n\t\t// and in the direction of the minimum tangent xyz component\n\n\t\tnormals[ 0 ] = new Vector3();\n\t\tbinormals[ 0 ] = new Vector3();\n\t\tlet min = Number.MAX_VALUE;\n\t\tconst tx = Math.abs( tangents[ 0 ].x );\n\t\tconst ty = Math.abs( tangents[ 0 ].y );\n\t\tconst tz = Math.abs( tangents[ 0 ].z );\n\n\t\tif ( tx <= min ) {\n\n\t\t\tmin = tx;\n\t\t\tnormal.set( 1, 0, 0 );\n\n\t\t}\n\n\t\tif ( ty <= min ) {\n\n\t\t\tmin = ty;\n\t\t\tnormal.set( 0, 1, 0 );\n\n\t\t}\n\n\t\tif ( tz <= min ) {\n\n\t\t\tnormal.set( 0, 0, 1 );\n\n\t\t}\n\n\t\tvec.crossVectors( tangents[ 0 ], normal ).normalize();\n\n\t\tnormals[ 0 ].crossVectors( tangents[ 0 ], vec );\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );\n\n\n\t\t// compute the slowly-varying normal and binormal vectors for each segment on the curve\n\n\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\tnormals[ i ] = normals[ i - 1 ].clone();\n\n\t\t\tbinormals[ i ] = binormals[ i - 1 ].clone();\n\n\t\t\tvec.crossVectors( tangents[ i - 1 ], tangents[ i ] );\n\n\t\t\tif ( vec.length() > Number.EPSILON ) {\n\n\t\t\t\tvec.normalize();\n\n\t\t\t\tconst theta = Math.acos( clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors\n\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );\n\n\t\t\t}\n\n\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t}\n\n\t\t// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\n\n\t\tif ( closed === true ) {\n\n\t\t\tlet theta = Math.acos( clamp( normals[ 0 ].dot( normals[ segments ] ), - 1, 1 ) );\n\t\t\ttheta /= segments;\n\n\t\t\tif ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ segments ] ) ) > 0 ) {\n\n\t\t\t\ttheta = - theta;\n\n\t\t\t}\n\n\t\t\tfor ( let i = 1; i <= segments; i ++ ) {\n\n\t\t\t\t// twist a little...\n\t\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) );\n\t\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn {\n\t\t\ttangents: tangents,\n\t\t\tnormals: normals,\n\t\t\tbinormals: binormals\n\t\t};\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.arcLengthDivisions = source.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = {\n\t\t\tmetadata: {\n\t\t\t\tversion: 4.5,\n\t\t\t\ttype: 'Curve',\n\t\t\t\tgenerator: 'Curve.toJSON'\n\t\t\t}\n\t\t};\n\n\t\tdata.arcLengthDivisions = this.arcLengthDivisions;\n\t\tdata.type = this.type;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.arcLengthDivisions = json.arcLengthDivisions;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass EllipseCurve extends Curve {\n\n\tconstructor( aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'EllipseCurve';\n\n\t\tthis.aX = aX;\n\t\tthis.aY = aY;\n\n\t\tthis.xRadius = xRadius;\n\t\tthis.yRadius = yRadius;\n\n\t\tthis.aStartAngle = aStartAngle;\n\t\tthis.aEndAngle = aEndAngle;\n\n\t\tthis.aClockwise = aClockwise;\n\n\t\tthis.aRotation = aRotation;\n\n\t}\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst point = optionalTarget || new Vector2();\n\n\t\tconst twoPi = Math.PI * 2;\n\t\tlet deltaAngle = this.aEndAngle - this.aStartAngle;\n\t\tconst samePoints = Math.abs( deltaAngle ) < Number.EPSILON;\n\n\t\t// ensures that deltaAngle is 0 .. 2 PI\n\t\twhile ( deltaAngle < 0 ) deltaAngle += twoPi;\n\t\twhile ( deltaAngle > twoPi ) deltaAngle -= twoPi;\n\n\t\tif ( deltaAngle < Number.EPSILON ) {\n\n\t\t\tif ( samePoints ) {\n\n\t\t\t\tdeltaAngle = 0;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.aClockwise === true && ! samePoints ) {\n\n\t\t\tif ( deltaAngle === twoPi ) {\n\n\t\t\t\tdeltaAngle = - twoPi;\n\n\t\t\t} else {\n\n\t\t\t\tdeltaAngle = deltaAngle - twoPi;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst angle = this.aStartAngle + t * deltaAngle;\n\t\tlet x = this.aX + this.xRadius * Math.cos( angle );\n\t\tlet y = this.aY + this.yRadius * Math.sin( angle );\n\n\t\tif ( this.aRotation !== 0 ) {\n\n\t\t\tconst cos = Math.cos( this.aRotation );\n\t\t\tconst sin = Math.sin( this.aRotation );\n\n\t\t\tconst tx = x - this.aX;\n\t\t\tconst ty = y - this.aY;\n\n\t\t\t// Rotate the point about the center of the ellipse.\n\t\t\tx = tx * cos - ty * sin + this.aX;\n\t\t\ty = tx * sin + ty * cos + this.aY;\n\n\t\t}\n\n\t\treturn point.set( x, y );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.aX = source.aX;\n\t\tthis.aY = source.aY;\n\n\t\tthis.xRadius = source.xRadius;\n\t\tthis.yRadius = source.yRadius;\n\n\t\tthis.aStartAngle = source.aStartAngle;\n\t\tthis.aEndAngle = source.aEndAngle;\n\n\t\tthis.aClockwise = source.aClockwise;\n\n\t\tthis.aRotation = source.aRotation;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.aX = this.aX;\n\t\tdata.aY = this.aY;\n\n\t\tdata.xRadius = this.xRadius;\n\t\tdata.yRadius = this.yRadius;\n\n\t\tdata.aStartAngle = this.aStartAngle;\n\t\tdata.aEndAngle = this.aEndAngle;\n\n\t\tdata.aClockwise = this.aClockwise;\n\n\t\tdata.aRotation = this.aRotation;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.aX = json.aX;\n\t\tthis.aY = json.aY;\n\n\t\tthis.xRadius = json.xRadius;\n\t\tthis.yRadius = json.yRadius;\n\n\t\tthis.aStartAngle = json.aStartAngle;\n\t\tthis.aEndAngle = json.aEndAngle;\n\n\t\tthis.aClockwise = json.aClockwise;\n\n\t\tthis.aRotation = json.aRotation;\n\n\t\treturn this;\n\n\t}\n\n}\n\nEllipseCurve.prototype.isEllipseCurve = true;\n\nclass ArcCurve extends EllipseCurve {\n\n\tconstructor( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tsuper( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\tthis.type = 'ArcCurve';\n\n\t}\n\n}\n\nArcCurve.prototype.isArcCurve = true;\n\n/**\n * Centripetal CatmullRom Curve - which is useful for avoiding\n * cusps and self-intersections in non-uniform catmull rom curves.\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\n *\n * curve.type accepts centripetal(default), chordal and catmullrom\n * curve.tension is used for catmullrom which defaults to 0.5\n */\n\n\n/*\nBased on an optimized c++ solution in\n - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\n - http://ideone.com/NoEbVM\n\nThis CubicPoly class could be used for reusing some variables and calculations,\nbut for three.js curve use, it could be possible inlined and flatten into a single function call\nwhich can be placed in CurveUtils.\n*/\n\nfunction CubicPoly() {\n\n\tlet c0 = 0, c1 = 0, c2 = 0, c3 = 0;\n\n\t/*\n\t * Compute coefficients for a cubic polynomial\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\n\t * such that\n\t * p(0) = x0, p(1) = x1\n\t * and\n\t * p'(0) = t0, p'(1) = t1.\n\t */\n\tfunction init( x0, x1, t0, t1 ) {\n\n\t\tc0 = x0;\n\t\tc1 = t0;\n\t\tc2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1;\n\t\tc3 = 2 * x0 - 2 * x1 + t0 + t1;\n\n\t}\n\n\treturn {\n\n\t\tinitCatmullRom: function ( x0, x1, x2, x3, tension ) {\n\n\t\t\tinit( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) );\n\n\t\t},\n\n\t\tinitNonuniformCatmullRom: function ( x0, x1, x2, x3, dt0, dt1, dt2 ) {\n\n\t\t\t// compute tangents when parameterized in [t1,t2]\n\t\t\tlet t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1;\n\t\t\tlet t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2;\n\n\t\t\t// rescale tangents for parametrization in [0,1]\n\t\t\tt1 *= dt1;\n\t\t\tt2 *= dt1;\n\n\t\t\tinit( x1, x2, t1, t2 );\n\n\t\t},\n\n\t\tcalc: function ( t ) {\n\n\t\t\tconst t2 = t * t;\n\t\t\tconst t3 = t2 * t;\n\t\t\treturn c0 + c1 * t + c2 * t2 + c3 * t3;\n\n\t\t}\n\n\t};\n\n}\n\n//\n\nconst tmp = new Vector3();\nconst px = new CubicPoly(), py = new CubicPoly(), pz = new CubicPoly();\n\nclass CatmullRomCurve3 extends Curve {\n\n\tconstructor( points = [], closed = false, curveType = 'centripetal', tension = 0.5 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CatmullRomCurve3';\n\n\t\tthis.points = points;\n\t\tthis.closed = closed;\n\t\tthis.curveType = curveType;\n\t\tthis.tension = tension;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst l = points.length;\n\n\t\tconst p = ( l - ( this.closed ? 0 : 1 ) ) * t;\n\t\tlet intPoint = Math.floor( p );\n\t\tlet weight = p - intPoint;\n\n\t\tif ( this.closed ) {\n\n\t\t\tintPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / l ) + 1 ) * l;\n\n\t\t} else if ( weight === 0 && intPoint === l - 1 ) {\n\n\t\t\tintPoint = l - 2;\n\t\t\tweight = 1;\n\n\t\t}\n\n\t\tlet p0, p3; // 4 points (p1 & p2 defined below)\n\n\t\tif ( this.closed || intPoint > 0 ) {\n\n\t\t\tp0 = points[ ( intPoint - 1 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate first point\n\t\t\ttmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );\n\t\t\tp0 = tmp;\n\n\t\t}\n\n\t\tconst p1 = points[ intPoint % l ];\n\t\tconst p2 = points[ ( intPoint + 1 ) % l ];\n\n\t\tif ( this.closed || intPoint + 2 < l ) {\n\n\t\t\tp3 = points[ ( intPoint + 2 ) % l ];\n\n\t\t} else {\n\n\t\t\t// extrapolate last point\n\t\t\ttmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 1 ] );\n\t\t\tp3 = tmp;\n\n\t\t}\n\n\t\tif ( this.curveType === 'centripetal' || this.curveType === 'chordal' ) {\n\n\t\t\t// init Centripetal / Chordal Catmull-Rom\n\t\t\tconst pow = this.curveType === 'chordal' ? 0.5 : 0.25;\n\t\t\tlet dt0 = Math.pow( p0.distanceToSquared( p1 ), pow );\n\t\t\tlet dt1 = Math.pow( p1.distanceToSquared( p2 ), pow );\n\t\t\tlet dt2 = Math.pow( p2.distanceToSquared( p3 ), pow );\n\n\t\t\t// safety check for repeated points\n\t\t\tif ( dt1 < 1e-4 ) dt1 = 1.0;\n\t\t\tif ( dt0 < 1e-4 ) dt0 = dt1;\n\t\t\tif ( dt2 < 1e-4 ) dt2 = dt1;\n\n\t\t\tpx.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 );\n\t\t\tpy.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 );\n\t\t\tpz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 );\n\n\t\t} else if ( this.curveType === 'catmullrom' ) {\n\n\t\t\tpx.initCatmullRom( p0.x, p1.x, p2.x, p3.x, this.tension );\n\t\t\tpy.initCatmullRom( p0.y, p1.y, p2.y, p3.y, this.tension );\n\t\t\tpz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, this.tension );\n\n\t\t}\n\n\t\tpoint.set(\n\t\t\tpx.calc( weight ),\n\t\t\tpy.calc( weight ),\n\t\t\tpz.calc( weight )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\tthis.closed = source.closed;\n\t\tthis.curveType = source.curveType;\n\t\tthis.tension = source.tension;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\tdata.closed = this.closed;\n\t\tdata.curveType = this.curveType;\n\t\tdata.tension = this.tension;\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector3().fromArray( point ) );\n\n\t\t}\n\n\t\tthis.closed = json.closed;\n\t\tthis.curveType = json.curveType;\n\t\tthis.tension = json.tension;\n\n\t\treturn this;\n\n\t}\n\n}\n\nCatmullRomCurve3.prototype.isCatmullRomCurve3 = true;\n\n/**\n * Bezier Curves formulas obtained from\n * http://en.wikipedia.org/wiki/Bézier_curve\n */\n\nfunction CatmullRom( t, p0, p1, p2, p3 ) {\n\n\tconst v0 = ( p2 - p0 ) * 0.5;\n\tconst v1 = ( p3 - p1 ) * 0.5;\n\tconst t2 = t * t;\n\tconst t3 = t * t2;\n\treturn ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\n\n}\n\n//\n\nfunction QuadraticBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * p;\n\n}\n\nfunction QuadraticBezierP1( t, p ) {\n\n\treturn 2 * ( 1 - t ) * t * p;\n\n}\n\nfunction QuadraticBezierP2( t, p ) {\n\n\treturn t * t * p;\n\n}\n\nfunction QuadraticBezier( t, p0, p1, p2 ) {\n\n\treturn QuadraticBezierP0( t, p0 ) + QuadraticBezierP1( t, p1 ) +\n\t\tQuadraticBezierP2( t, p2 );\n\n}\n\n//\n\nfunction CubicBezierP0( t, p ) {\n\n\tconst k = 1 - t;\n\treturn k * k * k * p;\n\n}\n\nfunction CubicBezierP1( t, p ) {\n\n\tconst k = 1 - t;\n\treturn 3 * k * k * t * p;\n\n}\n\nfunction CubicBezierP2( t, p ) {\n\n\treturn 3 * ( 1 - t ) * t * t * p;\n\n}\n\nfunction CubicBezierP3( t, p ) {\n\n\treturn t * t * t * p;\n\n}\n\nfunction CubicBezier( t, p0, p1, p2, p3 ) {\n\n\treturn CubicBezierP0( t, p0 ) + CubicBezierP1( t, p1 ) + CubicBezierP2( t, p2 ) +\n\t\tCubicBezierP3( t, p3 );\n\n}\n\nclass CubicBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubicBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nCubicBezierCurve.prototype.isCubicBezierCurve = true;\n\nclass CubicBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'CubicBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2, v3 = this.v3;\n\n\t\tpoint.set(\n\t\t\tCubicBezier( t, v0.x, v1.x, v2.x, v3.x ),\n\t\t\tCubicBezier( t, v0.y, v1.y, v2.y, v3.y ),\n\t\t\tCubicBezier( t, v0.z, v1.z, v2.z, v3.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\t\tthis.v3.copy( source.v3 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\t\tdata.v3 = this.v3.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\t\tthis.v3.fromArray( json.v3 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nCubicBezierCurve3.prototype.isCubicBezierCurve3 = true;\n\nclass LineCurve extends Curve {\n\n\tconstructor( v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'LineCurve';\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\n\tgetTangent( t, optionalTarget ) {\n\n\t\tconst tangent = optionalTarget || new Vector2();\n\n\t\ttangent.copy( this.v2 ).sub( this.v1 ).normalize();\n\n\t\treturn tangent;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nLineCurve.prototype.isLineCurve = true;\n\nclass LineCurve3 extends Curve {\n\n\tconstructor( v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'LineCurve3';\n\t\tthis.isLineCurve3 = true;\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tif ( t === 1 ) {\n\n\t\t\tpoint.copy( this.v2 );\n\n\t\t} else {\n\n\t\t\tpoint.copy( this.v2 ).sub( this.v1 );\n\t\t\tpoint.multiplyScalar( t ).add( this.v1 );\n\n\t\t}\n\n\t\treturn point;\n\n\t}\n\t// Line curve is linear, so we can overwrite default getPointAt\n\tgetPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass QuadraticBezierCurve extends Curve {\n\n\tconstructor( v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'QuadraticBezierCurve';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nQuadraticBezierCurve.prototype.isQuadraticBezierCurve = true;\n\nclass QuadraticBezierCurve3 extends Curve {\n\n\tconstructor( v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3() ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'QuadraticBezierCurve3';\n\n\t\tthis.v0 = v0;\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector3() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst v0 = this.v0, v1 = this.v1, v2 = this.v2;\n\n\t\tpoint.set(\n\t\t\tQuadraticBezier( t, v0.x, v1.x, v2.x ),\n\t\t\tQuadraticBezier( t, v0.y, v1.y, v2.y ),\n\t\t\tQuadraticBezier( t, v0.z, v1.z, v2.z )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.v0.copy( source.v0 );\n\t\tthis.v1.copy( source.v1 );\n\t\tthis.v2.copy( source.v2 );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.v0 = this.v0.toArray();\n\t\tdata.v1 = this.v1.toArray();\n\t\tdata.v2 = this.v2.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.v0.fromArray( json.v0 );\n\t\tthis.v1.fromArray( json.v1 );\n\t\tthis.v2.fromArray( json.v2 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nQuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true;\n\nclass SplineCurve extends Curve {\n\n\tconstructor( points = [] ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'SplineCurve';\n\n\t\tthis.points = points;\n\n\t}\n\n\tgetPoint( t, optionalTarget = new Vector2() ) {\n\n\t\tconst point = optionalTarget;\n\n\t\tconst points = this.points;\n\t\tconst p = ( points.length - 1 ) * t;\n\n\t\tconst intPoint = Math.floor( p );\n\t\tconst weight = p - intPoint;\n\n\t\tconst p0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\n\t\tconst p1 = points[ intPoint ];\n\t\tconst p2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\n\t\tconst p3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\n\n\t\tpoint.set(\n\t\t\tCatmullRom( weight, p0.x, p1.x, p2.x, p3.x ),\n\t\t\tCatmullRom( weight, p0.y, p1.y, p2.y, p3.y )\n\t\t);\n\n\t\treturn point;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = source.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = source.points[ i ];\n\n\t\t\tthis.points.push( point.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.points = [];\n\n\t\tfor ( let i = 0, l = this.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = this.points[ i ];\n\t\t\tdata.points.push( point.toArray() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.points = [];\n\n\t\tfor ( let i = 0, l = json.points.length; i < l; i ++ ) {\n\n\t\t\tconst point = json.points[ i ];\n\t\t\tthis.points.push( new Vector2().fromArray( point ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nSplineCurve.prototype.isSplineCurve = true;\n\nvar Curves = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tArcCurve: ArcCurve,\n\tCatmullRomCurve3: CatmullRomCurve3,\n\tCubicBezierCurve: CubicBezierCurve,\n\tCubicBezierCurve3: CubicBezierCurve3,\n\tEllipseCurve: EllipseCurve,\n\tLineCurve: LineCurve,\n\tLineCurve3: LineCurve3,\n\tQuadraticBezierCurve: QuadraticBezierCurve,\n\tQuadraticBezierCurve3: QuadraticBezierCurve3,\n\tSplineCurve: SplineCurve\n});\n\n/**************************************************************\n *\tCurved Path - a curve path is simply a array of connected\n * curves, but retains the api of a curve\n **************************************************************/\n\nclass CurvePath extends Curve {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'CurvePath';\n\n\t\tthis.curves = [];\n\t\tthis.autoClose = false; // Automatically closes the path\n\n\t}\n\n\tadd( curve ) {\n\n\t\tthis.curves.push( curve );\n\n\t}\n\n\tclosePath() {\n\n\t\t// Add a line curve if start and end of lines are not connected\n\t\tconst startPoint = this.curves[ 0 ].getPoint( 0 );\n\t\tconst endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 );\n\n\t\tif ( ! startPoint.equals( endPoint ) ) {\n\n\t\t\tthis.curves.push( new LineCurve( endPoint, startPoint ) );\n\n\t\t}\n\n\t}\n\n\t// To get accurate point with reference to\n\t// entire path distance at time t,\n\t// following has to be done:\n\n\t// 1. Length of each sub path have to be known\n\t// 2. Locate and identify type of curve\n\t// 3. Get t for the curve\n\t// 4. Return curve.getPointAt(t')\n\n\tgetPoint( t, optionalTarget ) {\n\n\t\tconst d = t * this.getLength();\n\t\tconst curveLengths = this.getCurveLengths();\n\t\tlet i = 0;\n\n\t\t// To think about boundaries points.\n\n\t\twhile ( i < curveLengths.length ) {\n\n\t\t\tif ( curveLengths[ i ] >= d ) {\n\n\t\t\t\tconst diff = curveLengths[ i ] - d;\n\t\t\t\tconst curve = this.curves[ i ];\n\n\t\t\t\tconst segmentLength = curve.getLength();\n\t\t\t\tconst u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\n\n\t\t\t\treturn curve.getPointAt( u, optionalTarget );\n\n\t\t\t}\n\n\t\t\ti ++;\n\n\t\t}\n\n\t\treturn null;\n\n\t\t// loop where sum != 0, sum > d , sum+1 <d\n\n\t}\n\n\t// We cannot use the default THREE.Curve getPoint() with getLength() because in\n\t// THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath\n\t// getPoint() depends on getLength\n\n\tgetLength() {\n\n\t\tconst lens = this.getCurveLengths();\n\t\treturn lens[ lens.length - 1 ];\n\n\t}\n\n\t// cacheLengths must be recalculated.\n\tupdateArcLengths() {\n\n\t\tthis.needsUpdate = true;\n\t\tthis.cacheLengths = null;\n\t\tthis.getCurveLengths();\n\n\t}\n\n\t// Compute lengths and cache them\n\t// We cannot overwrite getLengths() because UtoT mapping uses it.\n\n\tgetCurveLengths() {\n\n\t\t// We use cache values if curves and cache array are same length\n\n\t\tif ( this.cacheLengths && this.cacheLengths.length === this.curves.length ) {\n\n\t\t\treturn this.cacheLengths;\n\n\t\t}\n\n\t\t// Get length of sub-curve\n\t\t// Push sums into cached array\n\n\t\tconst lengths = [];\n\t\tlet sums = 0;\n\n\t\tfor ( let i = 0, l = this.curves.length; i < l; i ++ ) {\n\n\t\t\tsums += this.curves[ i ].getLength();\n\t\t\tlengths.push( sums );\n\n\t\t}\n\n\t\tthis.cacheLengths = lengths;\n\n\t\treturn lengths;\n\n\t}\n\n\tgetSpacedPoints( divisions = 40 ) {\n\n\t\tconst points = [];\n\n\t\tfor ( let i = 0; i <= divisions; i ++ ) {\n\n\t\t\tpoints.push( this.getPoint( i / divisions ) );\n\n\t\t}\n\n\t\tif ( this.autoClose ) {\n\n\t\t\tpoints.push( points[ 0 ] );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\tgetPoints( divisions = 12 ) {\n\n\t\tconst points = [];\n\t\tlet last;\n\n\t\tfor ( let i = 0, curves = this.curves; i < curves.length; i ++ ) {\n\n\t\t\tconst curve = curves[ i ];\n\t\t\tconst resolution = ( curve && curve.isEllipseCurve ) ? divisions * 2\n\t\t\t\t: ( curve && ( curve.isLineCurve || curve.isLineCurve3 ) ) ? 1\n\t\t\t\t\t: ( curve && curve.isSplineCurve ) ? divisions * curve.points.length\n\t\t\t\t\t\t: divisions;\n\n\t\t\tconst pts = curve.getPoints( resolution );\n\n\t\t\tfor ( let j = 0; j < pts.length; j ++ ) {\n\n\t\t\t\tconst point = pts[ j ];\n\n\t\t\t\tif ( last && last.equals( point ) ) continue; // ensures no consecutive points are duplicates\n\n\t\t\t\tpoints.push( point );\n\t\t\t\tlast = point;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( this.autoClose && points.length > 1 && ! points[ points.length - 1 ].equals( points[ 0 ] ) ) {\n\n\t\t\tpoints.push( points[ 0 ] );\n\n\t\t}\n\n\t\treturn points;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = source.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = source.curves[ i ];\n\n\t\t\tthis.curves.push( curve.clone() );\n\n\t\t}\n\n\t\tthis.autoClose = source.autoClose;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.autoClose = this.autoClose;\n\t\tdata.curves = [];\n\n\t\tfor ( let i = 0, l = this.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = this.curves[ i ];\n\t\t\tdata.curves.push( curve.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.autoClose = json.autoClose;\n\t\tthis.curves = [];\n\n\t\tfor ( let i = 0, l = json.curves.length; i < l; i ++ ) {\n\n\t\t\tconst curve = json.curves[ i ];\n\t\t\tthis.curves.push( new Curves[ curve.type ]().fromJSON( curve ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Path extends CurvePath {\n\n\tconstructor( points ) {\n\n\t\tsuper();\n\t\tthis.type = 'Path';\n\n\t\tthis.currentPoint = new Vector2();\n\n\t\tif ( points ) {\n\n\t\t\tthis.setFromPoints( points );\n\n\t\t}\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.moveTo( points[ 0 ].x, points[ 0 ].y );\n\n\t\tfor ( let i = 1, l = points.length; i < l; i ++ ) {\n\n\t\t\tthis.lineTo( points[ i ].x, points[ i ].y );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPoint.set( x, y ); // TODO consider referencing vectors instead of copying?\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tconst curve = new LineCurve( this.currentPoint.clone(), new Vector2( x, y ) );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tconst curve = new QuadraticBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCPx, aCPy ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tconst curve = new CubicBezierCurve(\n\t\t\tthis.currentPoint.clone(),\n\t\t\tnew Vector2( aCP1x, aCP1y ),\n\t\t\tnew Vector2( aCP2x, aCP2y ),\n\t\t\tnew Vector2( aX, aY )\n\t\t);\n\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.set( aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts /*Array of Vector*/ ) {\n\n\t\tconst npts = [ this.currentPoint.clone() ].concat( pts );\n\n\t\tconst curve = new SplineCurve( npts );\n\t\tthis.curves.push( curve );\n\n\t\tthis.currentPoint.copy( pts[ pts.length - 1 ] );\n\n\t\treturn this;\n\n\t}\n\n\tarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absarc( aX + x0, aY + y0, aRadius,\n\t\t\taStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tabsarc( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\n\n\t\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\n\n\t\treturn this;\n\n\t}\n\n\tellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst x0 = this.currentPoint.x;\n\t\tconst y0 = this.currentPoint.y;\n\n\t\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\treturn this;\n\n\t}\n\n\tabsellipse( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\n\n\t\tconst curve = new EllipseCurve( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation );\n\n\t\tif ( this.curves.length > 0 ) {\n\n\t\t\t// if a previous curve is present, attempt to join\n\t\t\tconst firstPoint = curve.getPoint( 0 );\n\n\t\t\tif ( ! firstPoint.equals( this.currentPoint ) ) {\n\n\t\t\t\tthis.lineTo( firstPoint.x, firstPoint.y );\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis.curves.push( curve );\n\n\t\tconst lastPoint = curve.getPoint( 1 );\n\t\tthis.currentPoint.copy( lastPoint );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.currentPoint.copy( source.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.currentPoint = this.currentPoint.toArray();\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.currentPoint.fromArray( json.currentPoint );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Shape extends Path {\n\n\tconstructor( points ) {\n\n\t\tsuper( points );\n\n\t\tthis.uuid = generateUUID();\n\n\t\tthis.type = 'Shape';\n\n\t\tthis.holes = [];\n\n\t}\n\n\tgetPointsHoles( divisions ) {\n\n\t\tconst holesPts = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tholesPts[ i ] = this.holes[ i ].getPoints( divisions );\n\n\t\t}\n\n\t\treturn holesPts;\n\n\t}\n\n\t// get points of shape and holes (keypoints based on segments parameter)\n\n\textractPoints( divisions ) {\n\n\t\treturn {\n\n\t\t\tshape: this.getPoints( divisions ),\n\t\t\tholes: this.getPointsHoles( divisions )\n\n\t\t};\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = source.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = source.holes[ i ];\n\n\t\t\tthis.holes.push( hole.clone() );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.uuid = this.uuid;\n\t\tdata.holes = [];\n\n\t\tfor ( let i = 0, l = this.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = this.holes[ i ];\n\t\t\tdata.holes.push( hole.toJSON() );\n\n\t\t}\n\n\t\treturn data;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tsuper.fromJSON( json );\n\n\t\tthis.uuid = json.uuid;\n\t\tthis.holes = [];\n\n\t\tfor ( let i = 0, l = json.holes.length; i < l; i ++ ) {\n\n\t\t\tconst hole = json.holes[ i ];\n\t\t\tthis.holes.push( new Path().fromJSON( hole ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n}\n\n/**\n * Port from https://github.com/mapbox/earcut (v2.2.2)\n */\n\nconst Earcut = {\n\n\ttriangulate: function ( data, holeIndices, dim = 2 ) {\n\n\t\tconst hasHoles = holeIndices && holeIndices.length;\n\t\tconst outerLen = hasHoles ? holeIndices[ 0 ] * dim : data.length;\n\t\tlet outerNode = linkedList( data, 0, outerLen, dim, true );\n\t\tconst triangles = [];\n\n\t\tif ( ! outerNode || outerNode.next === outerNode.prev ) return triangles;\n\n\t\tlet minX, minY, maxX, maxY, x, y, invSize;\n\n\t\tif ( hasHoles ) outerNode = eliminateHoles( data, holeIndices, outerNode, dim );\n\n\t\t// if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n\t\tif ( data.length > 80 * dim ) {\n\n\t\t\tminX = maxX = data[ 0 ];\n\t\t\tminY = maxY = data[ 1 ];\n\n\t\t\tfor ( let i = dim; i < outerLen; i += dim ) {\n\n\t\t\t\tx = data[ i ];\n\t\t\t\ty = data[ i + 1 ];\n\t\t\t\tif ( x < minX ) minX = x;\n\t\t\t\tif ( y < minY ) minY = y;\n\t\t\t\tif ( x > maxX ) maxX = x;\n\t\t\t\tif ( y > maxY ) maxY = y;\n\n\t\t\t}\n\n\t\t\t// minX, minY and invSize are later used to transform coords into integers for z-order calculation\n\t\t\tinvSize = Math.max( maxX - minX, maxY - minY );\n\t\t\tinvSize = invSize !== 0 ? 1 / invSize : 0;\n\n\t\t}\n\n\t\tearcutLinked( outerNode, triangles, dim, minX, minY, invSize );\n\n\t\treturn triangles;\n\n\t}\n\n};\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList( data, start, end, dim, clockwise ) {\n\n\tlet i, last;\n\n\tif ( clockwise === ( signedArea( data, start, end, dim ) > 0 ) ) {\n\n\t\tfor ( i = start; i < end; i += dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t} else {\n\n\t\tfor ( i = end - dim; i >= start; i -= dim ) last = insertNode( i, data[ i ], data[ i + 1 ], last );\n\n\t}\n\n\tif ( last && equals( last, last.next ) ) {\n\n\t\tremoveNode( last );\n\t\tlast = last.next;\n\n\t}\n\n\treturn last;\n\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints( start, end ) {\n\n\tif ( ! start ) return start;\n\tif ( ! end ) end = start;\n\n\tlet p = start,\n\t\tagain;\n\tdo {\n\n\t\tagain = false;\n\n\t\tif ( ! p.steiner && ( equals( p, p.next ) || area( p.prev, p, p.next ) === 0 ) ) {\n\n\t\t\tremoveNode( p );\n\t\t\tp = end = p.prev;\n\t\t\tif ( p === p.next ) break;\n\t\t\tagain = true;\n\n\t\t} else {\n\n\t\t\tp = p.next;\n\n\t\t}\n\n\t} while ( again || p !== end );\n\n\treturn end;\n\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked( ear, triangles, dim, minX, minY, invSize, pass ) {\n\n\tif ( ! ear ) return;\n\n\t// interlink polygon nodes in z-order\n\tif ( ! pass && invSize ) indexCurve( ear, minX, minY, invSize );\n\n\tlet stop = ear,\n\t\tprev, next;\n\n\t// iterate through ears, slicing them one by one\n\twhile ( ear.prev !== ear.next ) {\n\n\t\tprev = ear.prev;\n\t\tnext = ear.next;\n\n\t\tif ( invSize ? isEarHashed( ear, minX, minY, invSize ) : isEar( ear ) ) {\n\n\t\t\t// cut off the triangle\n\t\t\ttriangles.push( prev.i / dim );\n\t\t\ttriangles.push( ear.i / dim );\n\t\t\ttriangles.push( next.i / dim );\n\n\t\t\tremoveNode( ear );\n\n\t\t\t// skipping the next vertex leads to less sliver triangles\n\t\t\tear = next.next;\n\t\t\tstop = next.next;\n\n\t\t\tcontinue;\n\n\t\t}\n\n\t\tear = next;\n\n\t\t// if we looped through the whole remaining polygon and can't find any more ears\n\t\tif ( ear === stop ) {\n\n\t\t\t// try filtering points and slicing again\n\t\t\tif ( ! pass ) {\n\n\t\t\t\tearcutLinked( filterPoints( ear ), triangles, dim, minX, minY, invSize, 1 );\n\n\t\t\t\t// if this didn't work, try curing all small self-intersections locally\n\n\t\t\t} else if ( pass === 1 ) {\n\n\t\t\t\tear = cureLocalIntersections( filterPoints( ear ), triangles, dim );\n\t\t\t\tearcutLinked( ear, triangles, dim, minX, minY, invSize, 2 );\n\n\t\t\t\t// as a last resort, try splitting the remaining polygon into two\n\n\t\t\t} else if ( pass === 2 ) {\n\n\t\t\t\tsplitEarcut( ear, triangles, dim, minX, minY, invSize );\n\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar( ear ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\t// now make sure we don't have other points inside the potential ear\n\tlet p = ear.next.next;\n\n\twhile ( p !== ear.prev ) {\n\n\t\tif ( pointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y ) &&\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.next;\n\n\t}\n\n\treturn true;\n\n}\n\nfunction isEarHashed( ear, minX, minY, invSize ) {\n\n\tconst a = ear.prev,\n\t\tb = ear,\n\t\tc = ear.next;\n\n\tif ( area( a, b, c ) >= 0 ) return false; // reflex, can't be an ear\n\n\t// triangle bbox; min & max are calculated like this for speed\n\tconst minTX = a.x < b.x ? ( a.x < c.x ? a.x : c.x ) : ( b.x < c.x ? b.x : c.x ),\n\t\tminTY = a.y < b.y ? ( a.y < c.y ? a.y : c.y ) : ( b.y < c.y ? b.y : c.y ),\n\t\tmaxTX = a.x > b.x ? ( a.x > c.x ? a.x : c.x ) : ( b.x > c.x ? b.x : c.x ),\n\t\tmaxTY = a.y > b.y ? ( a.y > c.y ? a.y : c.y ) : ( b.y > c.y ? b.y : c.y );\n\n\t// z-order range for the current triangle bbox;\n\tconst minZ = zOrder( minTX, minTY, minX, minY, invSize ),\n\t\tmaxZ = zOrder( maxTX, maxTY, minX, minY, invSize );\n\n\tlet p = ear.prevZ,\n\t\tn = ear.nextZ;\n\n\t// look for points inside the triangle in both directions\n\twhile ( p && p.z >= minZ && n && n.z <= maxZ ) {\n\n\t\tif ( p !== ear.prev && p !== ear.next &&\n\t\t\tpointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y ) &&\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t\tif ( n !== ear.prev && n !== ear.next &&\n\t\t\tpointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y ) &&\n\t\t\tarea( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\t// look for remaining points in decreasing z-order\n\twhile ( p && p.z >= minZ ) {\n\n\t\tif ( p !== ear.prev && p !== ear.next &&\n\t\t\tpointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y ) &&\n\t\t\tarea( p.prev, p, p.next ) >= 0 ) return false;\n\t\tp = p.prevZ;\n\n\t}\n\n\t// look for remaining points in increasing z-order\n\twhile ( n && n.z <= maxZ ) {\n\n\t\tif ( n !== ear.prev && n !== ear.next &&\n\t\t\tpointInTriangle( a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y ) &&\n\t\t\tarea( n.prev, n, n.next ) >= 0 ) return false;\n\t\tn = n.nextZ;\n\n\t}\n\n\treturn true;\n\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections( start, triangles, dim ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tconst a = p.prev,\n\t\t\tb = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim );\n\t\t\ttriangles.push( p.i / dim );\n\t\t\ttriangles.push( b.i / dim );\n\n\t\t\t// remove two nodes involved\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn filterPoints( p );\n\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut( start, triangles, dim, minX, minY, invSize ) {\n\n\t// look for a valid diagonal that divides the polygon into two\n\tlet a = start;\n\tdo {\n\n\t\tlet b = a.next.next;\n\t\twhile ( b !== a.prev ) {\n\n\t\t\tif ( a.i !== b.i && isValidDiagonal( a, b ) ) {\n\n\t\t\t\t// split the polygon in two by the diagonal\n\t\t\t\tlet c = splitPolygon( a, b );\n\n\t\t\t\t// filter colinear points around the cuts\n\t\t\t\ta = filterPoints( a, a.next );\n\t\t\t\tc = filterPoints( c, c.next );\n\n\t\t\t\t// run earcut on each half\n\t\t\t\tearcutLinked( a, triangles, dim, minX, minY, invSize );\n\t\t\t\tearcutLinked( c, triangles, dim, minX, minY, invSize );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tb = b.next;\n\n\t\t}\n\n\t\ta = a.next;\n\n\t} while ( a !== start );\n\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles( data, holeIndices, outerNode, dim ) {\n\n\tconst queue = [];\n\tlet i, len, start, end, list;\n\n\tfor ( i = 0, len = holeIndices.length; i < len; i ++ ) {\n\n\t\tstart = holeIndices[ i ] * dim;\n\t\tend = i < len - 1 ? holeIndices[ i + 1 ] * dim : data.length;\n\t\tlist = linkedList( data, start, end, dim, false );\n\t\tif ( list === list.next ) list.steiner = true;\n\t\tqueue.push( getLeftmost( list ) );\n\n\t}\n\n\tqueue.sort( compareX );\n\n\t// process holes from left to right\n\tfor ( i = 0; i < queue.length; i ++ ) {\n\n\t\teliminateHole( queue[ i ], outerNode );\n\t\touterNode = filterPoints( outerNode, outerNode.next );\n\n\t}\n\n\treturn outerNode;\n\n}\n\nfunction compareX( a, b ) {\n\n\treturn a.x - b.x;\n\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole( hole, outerNode ) {\n\n\touterNode = findHoleBridge( hole, outerNode );\n\tif ( outerNode ) {\n\n\t\tconst b = splitPolygon( outerNode, hole );\n\n\t\t// filter collinear points around the cuts\n\t\tfilterPoints( outerNode, outerNode.next );\n\t\tfilterPoints( b, b.next );\n\n\t}\n\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge( hole, outerNode ) {\n\n\tlet p = outerNode;\n\tconst hx = hole.x;\n\tconst hy = hole.y;\n\tlet qx = - Infinity, m;\n\n\t// find a segment intersected by a ray from the hole's leftmost point to the left;\n\t// segment's endpoint with lesser x will be potential connection point\n\tdo {\n\n\t\tif ( hy <= p.y && hy >= p.next.y && p.next.y !== p.y ) {\n\n\t\t\tconst x = p.x + ( hy - p.y ) * ( p.next.x - p.x ) / ( p.next.y - p.y );\n\t\t\tif ( x <= hx && x > qx ) {\n\n\t\t\t\tqx = x;\n\t\t\t\tif ( x === hx ) {\n\n\t\t\t\t\tif ( hy === p.y ) return p;\n\t\t\t\t\tif ( hy === p.next.y ) return p.next;\n\n\t\t\t\t}\n\n\t\t\t\tm = p.x < p.next.x ? p : p.next;\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== outerNode );\n\n\tif ( ! m ) return null;\n\n\tif ( hx === qx ) return m; // hole touches outer segment; pick leftmost endpoint\n\n\t// look for points inside the triangle of hole point, segment intersection and endpoint;\n\t// if there are no points found, we have a valid connection;\n\t// otherwise choose the point of the minimum angle with the ray as connection point\n\n\tconst stop = m,\n\t\tmx = m.x,\n\t\tmy = m.y;\n\tlet tanMin = Infinity, tan;\n\n\tp = m;\n\n\tdo {\n\n\t\tif ( hx >= p.x && p.x >= mx && hx !== p.x &&\n\t\t\t\tpointInTriangle( hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y ) ) {\n\n\t\t\ttan = Math.abs( hy - p.y ) / ( hx - p.x ); // tangential\n\n\t\t\tif ( locallyInside( p, hole ) && ( tan < tanMin || ( tan === tanMin && ( p.x > m.x || ( p.x === m.x && sectorContainsSector( m, p ) ) ) ) ) ) {\n\n\t\t\t\tm = p;\n\t\t\t\ttanMin = tan;\n\n\t\t\t}\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== stop );\n\n\treturn m;\n\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector( m, p ) {\n\n\treturn area( m.prev, m, p.prev ) < 0 && area( p.next, m, m.next ) < 0;\n\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve( start, minX, minY, invSize ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tif ( p.z === null ) p.z = zOrder( p.x, p.y, minX, minY, invSize );\n\t\tp.prevZ = p.prev;\n\t\tp.nextZ = p.next;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\tp.prevZ.nextZ = null;\n\tp.prevZ = null;\n\n\tsortLinked( p );\n\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked( list ) {\n\n\tlet i, p, q, e, tail, numMerges, pSize, qSize,\n\t\tinSize = 1;\n\n\tdo {\n\n\t\tp = list;\n\t\tlist = null;\n\t\ttail = null;\n\t\tnumMerges = 0;\n\n\t\twhile ( p ) {\n\n\t\t\tnumMerges ++;\n\t\t\tq = p;\n\t\t\tpSize = 0;\n\t\t\tfor ( i = 0; i < inSize; i ++ ) {\n\n\t\t\t\tpSize ++;\n\t\t\t\tq = q.nextZ;\n\t\t\t\tif ( ! q ) break;\n\n\t\t\t}\n\n\t\t\tqSize = inSize;\n\n\t\t\twhile ( pSize > 0 || ( qSize > 0 && q ) ) {\n\n\t\t\t\tif ( pSize !== 0 && ( qSize === 0 || ! q || p.z <= q.z ) ) {\n\n\t\t\t\t\te = p;\n\t\t\t\t\tp = p.nextZ;\n\t\t\t\t\tpSize --;\n\n\t\t\t\t} else {\n\n\t\t\t\t\te = q;\n\t\t\t\t\tq = q.nextZ;\n\t\t\t\t\tqSize --;\n\n\t\t\t\t}\n\n\t\t\t\tif ( tail ) tail.nextZ = e;\n\t\t\t\telse list = e;\n\n\t\t\t\te.prevZ = tail;\n\t\t\t\ttail = e;\n\n\t\t\t}\n\n\t\t\tp = q;\n\n\t\t}\n\n\t\ttail.nextZ = null;\n\t\tinSize *= 2;\n\n\t} while ( numMerges > 1 );\n\n\treturn list;\n\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder( x, y, minX, minY, invSize ) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\tx = 32767 * ( x - minX ) * invSize;\n\ty = 32767 * ( y - minY ) * invSize;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost( start ) {\n\n\tlet p = start,\n\t\tleftmost = start;\n\tdo {\n\n\t\tif ( p.x < leftmost.x || ( p.x === leftmost.x && p.y < leftmost.y ) ) leftmost = p;\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn leftmost;\n\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {\n\n\treturn ( cx - px ) * ( ay - py ) - ( ax - px ) * ( cy - py ) >= 0 &&\n\t\t\t( ax - px ) * ( by - py ) - ( bx - px ) * ( ay - py ) >= 0 &&\n\t\t\t( bx - px ) * ( cy - py ) - ( cx - px ) * ( by - py ) >= 0;\n\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal( a, b ) {\n\n\treturn a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // dones't intersect other edges\n\t\t( locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b ) && // locally visible\n\t\t( area( a.prev, a, b.prev ) || area( a, b.prev, b ) ) || // does not create opposite-facing sectors\n\t\tequals( a, b ) && area( a.prev, a, a.next ) > 0 && area( b.prev, b, b.next ) > 0 ); // special zero-length case\n\n}\n\n// signed area of a triangle\nfunction area( p, q, r ) {\n\n\treturn ( q.y - p.y ) * ( r.x - q.x ) - ( q.x - p.x ) * ( r.y - q.y );\n\n}\n\n// check if two points are equal\nfunction equals( p1, p2 ) {\n\n\treturn p1.x === p2.x && p1.y === p2.y;\n\n}\n\n// check if two segments intersect\nfunction intersects( p1, q1, p2, q2 ) {\n\n\tconst o1 = sign( area( p1, q1, p2 ) );\n\tconst o2 = sign( area( p1, q1, q2 ) );\n\tconst o3 = sign( area( p2, q2, p1 ) );\n\tconst o4 = sign( area( p2, q2, q1 ) );\n\n\tif ( o1 !== o2 && o3 !== o4 ) return true; // general case\n\n\tif ( o1 === 0 && onSegment( p1, p2, q1 ) ) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n\tif ( o2 === 0 && onSegment( p1, q2, q1 ) ) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n\tif ( o3 === 0 && onSegment( p2, p1, q2 ) ) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n\tif ( o4 === 0 && onSegment( p2, q1, q2 ) ) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n\treturn false;\n\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment( p, q, r ) {\n\n\treturn q.x <= Math.max( p.x, r.x ) && q.x >= Math.min( p.x, r.x ) && q.y <= Math.max( p.y, r.y ) && q.y >= Math.min( p.y, r.y );\n\n}\n\nfunction sign( num ) {\n\n\treturn num > 0 ? 1 : num < 0 ? - 1 : 0;\n\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon( a, b ) {\n\n\tlet p = a;\n\tdo {\n\n\t\tif ( p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n\t\t\t\tintersects( p, p.next, a, b ) ) return true;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn false;\n\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside( a, b ) {\n\n\treturn area( a.prev, a, a.next ) < 0 ?\n\t\tarea( a, b, a.next ) >= 0 && area( a, a.prev, b ) >= 0 :\n\t\tarea( a, b, a.prev ) < 0 || area( a, a.next, b ) < 0;\n\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside( a, b ) {\n\n\tlet p = a,\n\t\tinside = false;\n\tconst px = ( a.x + b.x ) / 2,\n\t\tpy = ( a.y + b.y ) / 2;\n\tdo {\n\n\t\tif ( ( ( p.y > py ) !== ( p.next.y > py ) ) && p.next.y !== p.y &&\n\t\t\t\t( px < ( p.next.x - p.x ) * ( py - p.y ) / ( p.next.y - p.y ) + p.x ) )\n\t\t\tinside = ! inside;\n\t\tp = p.next;\n\n\t} while ( p !== a );\n\n\treturn inside;\n\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon( a, b ) {\n\n\tconst a2 = new Node( a.i, a.x, a.y ),\n\t\tb2 = new Node( b.i, b.x, b.y ),\n\t\tan = a.next,\n\t\tbp = b.prev;\n\n\ta.next = b;\n\tb.prev = a;\n\n\ta2.next = an;\n\tan.prev = a2;\n\n\tb2.next = a2;\n\ta2.prev = b2;\n\n\tbp.next = b2;\n\tb2.prev = bp;\n\n\treturn b2;\n\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode( i, x, y, last ) {\n\n\tconst p = new Node( i, x, y );\n\n\tif ( ! last ) {\n\n\t\tp.prev = p;\n\t\tp.next = p;\n\n\t} else {\n\n\t\tp.next = last.next;\n\t\tp.prev = last;\n\t\tlast.next.prev = p;\n\t\tlast.next = p;\n\n\t}\n\n\treturn p;\n\n}\n\nfunction removeNode( p ) {\n\n\tp.next.prev = p.prev;\n\tp.prev.next = p.next;\n\n\tif ( p.prevZ ) p.prevZ.nextZ = p.nextZ;\n\tif ( p.nextZ ) p.nextZ.prevZ = p.prevZ;\n\n}\n\nfunction Node( i, x, y ) {\n\n\t// vertex index in coordinates array\n\tthis.i = i;\n\n\t// vertex coordinates\n\tthis.x = x;\n\tthis.y = y;\n\n\t// previous and next vertex nodes in a polygon ring\n\tthis.prev = null;\n\tthis.next = null;\n\n\t// z-order curve value\n\tthis.z = null;\n\n\t// previous and next nodes in z-order\n\tthis.prevZ = null;\n\tthis.nextZ = null;\n\n\t// indicates whether this is a steiner point\n\tthis.steiner = false;\n\n}\n\nfunction signedArea( data, start, end, dim ) {\n\n\tlet sum = 0;\n\tfor ( let i = start, j = end - dim; i < end; i += dim ) {\n\n\t\tsum += ( data[ j ] - data[ i ] ) * ( data[ i + 1 ] + data[ j + 1 ] );\n\t\tj = i;\n\n\t}\n\n\treturn sum;\n\n}\n\nclass ShapeUtils {\n\n\t// calculate area of the contour polygon\n\n\tstatic area( contour ) {\n\n\t\tconst n = contour.length;\n\t\tlet a = 0.0;\n\n\t\tfor ( let p = n - 1, q = 0; q < n; p = q ++ ) {\n\n\t\t\ta += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;\n\n\t\t}\n\n\t\treturn a * 0.5;\n\n\t}\n\n\tstatic isClockWise( pts ) {\n\n\t\treturn ShapeUtils.area( pts ) < 0;\n\n\t}\n\n\tstatic triangulateShape( contour, holes ) {\n\n\t\tconst vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\n\t\tconst holeIndices = []; // array of hole indices\n\t\tconst faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\n\n\t\tremoveDupEndPts( contour );\n\t\taddContour( vertices, contour );\n\n\t\t//\n\n\t\tlet holeIndex = contour.length;\n\n\t\tholes.forEach( removeDupEndPts );\n\n\t\tfor ( let i = 0; i < holes.length; i ++ ) {\n\n\t\t\tholeIndices.push( holeIndex );\n\t\t\tholeIndex += holes[ i ].length;\n\t\t\taddContour( vertices, holes[ i ] );\n\n\t\t}\n\n\t\t//\n\n\t\tconst triangles = Earcut.triangulate( vertices, holeIndices );\n\n\t\t//\n\n\t\tfor ( let i = 0; i < triangles.length; i += 3 ) {\n\n\t\t\tfaces.push( triangles.slice( i, i + 3 ) );\n\n\t\t}\n\n\t\treturn faces;\n\n\t}\n\n}\n\nfunction removeDupEndPts( points ) {\n\n\tconst l = points.length;\n\n\tif ( l > 2 && points[ l - 1 ].equals( points[ 0 ] ) ) {\n\n\t\tpoints.pop();\n\n\t}\n\n}\n\nfunction addContour( vertices, contour ) {\n\n\tfor ( let i = 0; i < contour.length; i ++ ) {\n\n\t\tvertices.push( contour[ i ].x );\n\t\tvertices.push( contour[ i ].y );\n\n\t}\n\n}\n\n/**\n * Creates extruded geometry from a path shape.\n *\n * parameters = {\n *\n * curveSegments: <int>, // number of points on the curves\n * steps: <int>, // number of points for z-side extrusions / used for subdividing segments of extrude spline too\n * depth: <float>, // Depth to extrude the shape\n *\n * bevelEnabled: <bool>, // turn on bevel\n * bevelThickness: <float>, // how deep into the original shape bevel goes\n * bevelSize: <float>, // how far from shape outline (including bevelOffset) is bevel\n * bevelOffset: <float>, // how far from shape outline does bevel start\n * bevelSegments: <int>, // number of bevel layers\n *\n * extrudePath: <THREE.Curve> // curve to extrude shape along\n *\n * UVGenerator: <Object> // object that provides UV generator functions\n *\n * }\n */\n\nclass ExtrudeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0.5, 0.5 ), new Vector2( - 0.5, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), options = {} ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ExtrudeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\toptions: options\n\t\t};\n\n\t\tshapes = Array.isArray( shapes ) ? shapes : [ shapes ];\n\n\t\tconst scope = this;\n\n\t\tconst verticesArray = [];\n\t\tconst uvArray = [];\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\t\t\taddShape( shape );\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );\n\n\t\tthis.computeVertexNormals();\n\n\t\t// functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst placeholder = [];\n\n\t\t\t// options\n\n\t\t\tconst curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\n\t\t\tconst steps = options.steps !== undefined ? options.steps : 1;\n\t\t\tlet depth = options.depth !== undefined ? options.depth : 1;\n\n\t\t\tlet bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\n\t\t\tlet bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;\n\t\t\tlet bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;\n\t\t\tlet bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\n\t\t\tlet bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\n\n\t\t\tconst extrudePath = options.extrudePath;\n\n\t\t\tconst uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;\n\n\t\t\t// deprecated options\n\n\t\t\tif ( options.amount !== undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ExtrudeBufferGeometry: amount has been renamed to depth.' );\n\t\t\t\tdepth = options.amount;\n\n\t\t\t}\n\n\t\t\t//\n\n\t\t\tlet extrudePts, extrudeByPath = false;\n\t\t\tlet splineTube, binormal, normal, position2;\n\n\t\t\tif ( extrudePath ) {\n\n\t\t\t\textrudePts = extrudePath.getSpacedPoints( steps );\n\n\t\t\t\textrudeByPath = true;\n\t\t\t\tbevelEnabled = false; // bevels not supported for path extrusion\n\n\t\t\t\t// SETUP TNB variables\n\n\t\t\t\t// TODO1 - have a .isClosed in spline?\n\n\t\t\t\tsplineTube = extrudePath.computeFrenetFrames( steps, false );\n\n\t\t\t\t// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\n\n\t\t\t\tbinormal = new Vector3();\n\t\t\t\tnormal = new Vector3();\n\t\t\t\tposition2 = new Vector3();\n\n\t\t\t}\n\n\t\t\t// Safeguards if bevels are not enabled\n\n\t\t\tif ( ! bevelEnabled ) {\n\n\t\t\t\tbevelSegments = 0;\n\t\t\t\tbevelThickness = 0;\n\t\t\t\tbevelSize = 0;\n\t\t\t\tbevelOffset = 0;\n\n\t\t\t}\n\n\t\t\t// Variables initialization\n\n\t\t\tconst shapePoints = shape.extractPoints( curveSegments );\n\n\t\t\tlet vertices = shapePoints.shape;\n\t\t\tconst holes = shapePoints.holes;\n\n\t\t\tconst reverse = ! ShapeUtils.isClockWise( vertices );\n\n\t\t\tif ( reverse ) {\n\n\t\t\t\tvertices = vertices.reverse();\n\n\t\t\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe ...\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\t\tif ( ShapeUtils.isClockWise( ahole ) ) {\n\n\t\t\t\t\t\tholes[ h ] = ahole.reverse();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( vertices, holes );\n\n\t\t\t/* Vertices */\n\n\t\t\tconst contour = vertices; // vertices has all points but contour has only points of circumference\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\tvertices = vertices.concat( ahole );\n\n\t\t\t}\n\n\n\t\t\tfunction scalePt2( pt, vec, size ) {\n\n\t\t\t\tif ( ! vec ) console.error( 'THREE.ExtrudeGeometry: vec does not exist' );\n\n\t\t\t\treturn vec.clone().multiplyScalar( size ).add( pt );\n\n\t\t\t}\n\n\t\t\tconst vlen = vertices.length, flen = faces.length;\n\n\n\t\t\t// Find directions for point movement\n\n\n\t\t\tfunction getBevelVec( inPt, inPrev, inNext ) {\n\n\t\t\t\t// computes for inPt the corresponding point inPt' on a new contour\n\t\t\t\t// shifted by 1 unit (length of normalized vector) to the left\n\t\t\t\t// if we walk along contour clockwise, this new contour is outside the old one\n\t\t\t\t//\n\t\t\t\t// inPt' is the intersection of the two lines parallel to the two\n\t\t\t\t// adjacent edges of inPt at a distance of 1 unit on the left side.\n\n\t\t\t\tlet v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\n\n\t\t\t\t// good reading for geometry algorithms (here: line-line intersection)\n\t\t\t\t// http://geomalgorithms.com/a05-_intersect-1.html\n\n\t\t\t\tconst v_prev_x = inPt.x - inPrev.x,\n\t\t\t\t\tv_prev_y = inPt.y - inPrev.y;\n\t\t\t\tconst v_next_x = inNext.x - inPt.x,\n\t\t\t\t\tv_next_y = inNext.y - inPt.y;\n\n\t\t\t\tconst v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );\n\n\t\t\t\t// check for collinear edges\n\t\t\t\tconst collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\tif ( Math.abs( collinear0 ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not collinear\n\n\t\t\t\t\t// length of vectors for normalizing\n\n\t\t\t\t\tconst v_prev_len = Math.sqrt( v_prev_lensq );\n\t\t\t\t\tconst v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );\n\n\t\t\t\t\t// shift adjacent points by unit vectors to the left\n\n\t\t\t\t\tconst ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );\n\t\t\t\t\tconst ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );\n\n\t\t\t\t\tconst ptNextShift_x = ( inNext.x - v_next_y / v_next_len );\n\t\t\t\t\tconst ptNextShift_y = ( inNext.y + v_next_x / v_next_len );\n\n\t\t\t\t\t// scaling factor for v_prev to intersection point\n\n\t\t\t\t\tconst sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -\n\t\t\t\t\t\t\t( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /\n\t\t\t\t\t\t( v_prev_x * v_next_y - v_prev_y * v_next_x );\n\n\t\t\t\t\t// vector from inPt to intersection point\n\n\t\t\t\t\tv_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );\n\t\t\t\t\tv_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );\n\n\t\t\t\t\t// Don't normalize!, otherwise sharp corners become ugly\n\t\t\t\t\t// but prevent crazy spikes\n\t\t\t\t\tconst v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );\n\t\t\t\t\tif ( v_trans_lensq <= 2 ) {\n\n\t\t\t\t\t\treturn new Vector2( v_trans_x, v_trans_y );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_trans_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// handle special case of collinear edges\n\n\t\t\t\t\tlet direction_eq = false; // assumes: opposite\n\n\t\t\t\t\tif ( v_prev_x > Number.EPSILON ) {\n\n\t\t\t\t\t\tif ( v_next_x > Number.EPSILON ) {\n\n\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif ( v_prev_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\tif ( v_next_x < - Number.EPSILON ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tif ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {\n\n\t\t\t\t\t\t\t\tdirection_eq = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( direction_eq ) {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight sequence\");\n\t\t\t\t\t\tv_trans_x = - v_prev_y;\n\t\t\t\t\t\tv_trans_y = v_prev_x;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// console.log(\"Warning: lines are a straight spike\");\n\t\t\t\t\t\tv_trans_x = v_prev_x;\n\t\t\t\t\t\tv_trans_y = v_prev_y;\n\t\t\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq / 2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\treturn new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );\n\n\t\t\t}\n\n\n\t\t\tconst contourMovements = [];\n\n\t\t\tfor ( let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t// console.log('i,j,k', i, j , k)\n\n\t\t\t\tcontourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );\n\n\t\t\t}\n\n\t\t\tconst holesMovements = [];\n\t\t\tlet oneHoleMovements, verticesMovements = contourMovements.concat();\n\n\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\tconst ahole = holes[ h ];\n\n\t\t\t\toneHoleMovements = [];\n\n\t\t\t\tfor ( let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\n\n\t\t\t\t\tif ( j === il ) j = 0;\n\t\t\t\t\tif ( k === il ) k = 0;\n\n\t\t\t\t\t// (j)---(i)---(k)\n\t\t\t\t\toneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );\n\n\t\t\t\t}\n\n\t\t\t\tholesMovements.push( oneHoleMovements );\n\t\t\t\tverticesMovements = verticesMovements.concat( oneHoleMovements );\n\n\t\t\t}\n\n\n\t\t\t// Loop bevelSegments, 1 for the front, 1 for the back\n\n\t\t\tfor ( let b = 0; b < bevelSegments; b ++ ) {\n\n\t\t\t\t//for ( b = bevelSegments; b > 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\n\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tv( vert.x, vert.y, - z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst bs = bevelSize + bevelOffset;\n\n\t\t\t// Back facing vertices\n\n\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\tv( vert.x, vert.y, 0 );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\n\n\t\t\t\t\tnormal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );\n\t\t\t\t\tbinormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\tposition2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );\n\n\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// Add stepped vertices...\n\t\t\t// Including front facing vertices\n\n\t\t\tfor ( let s = 1; s <= steps; s ++ ) {\n\n\t\t\t\tfor ( let i = 0; i < vlen; i ++ ) {\n\n\t\t\t\t\tconst vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\n\n\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\tv( vert.x, vert.y, depth / steps * s );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\n\n\t\t\t\t\t\tnormal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );\n\t\t\t\t\t\tbinormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );\n\n\t\t\t\t\t\tposition2.copy( extrudePts[ s ] ).add( normal ).add( binormal );\n\n\t\t\t\t\t\tv( position2.x, position2.y, position2.z );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\n\t\t\t// Add bevel segments planes\n\n\t\t\t//for ( b = 1; b <= bevelSegments; b ++ ) {\n\t\t\tfor ( let b = bevelSegments - 1; b >= 0; b -- ) {\n\n\t\t\t\tconst t = b / bevelSegments;\n\t\t\t\tconst z = bevelThickness * Math.cos( t * Math.PI / 2 );\n\t\t\t\tconst bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;\n\n\t\t\t\t// contract shape\n\n\t\t\t\tfor ( let i = 0, il = contour.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst vert = scalePt2( contour[ i ], contourMovements[ i ], bs );\n\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t}\n\n\t\t\t\t// expand holes\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\toneHoleMovements = holesMovements[ h ];\n\n\t\t\t\t\tfor ( let i = 0, il = ahole.length; i < il; i ++ ) {\n\n\t\t\t\t\t\tconst vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\n\n\t\t\t\t\t\tif ( ! extrudeByPath ) {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y, depth + z );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tv( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t/* Faces */\n\n\t\t\t// Top and bottom faces\n\n\t\t\tbuildLidFaces();\n\n\t\t\t// Sides faces\n\n\t\t\tbuildSideFaces();\n\n\n\t\t\t///// Internal functions\n\n\t\t\tfunction buildLidFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\n\t\t\t\tif ( bevelEnabled ) {\n\n\t\t\t\t\tlet layer = 0; // steps + 1\n\t\t\t\t\tlet offset = vlen * layer;\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tlayer = steps + bevelSegments * 2;\n\t\t\t\t\toffset = vlen * layer;\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Bottom faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 2 ], face[ 1 ], face[ 0 ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// Top faces\n\n\t\t\t\t\tfor ( let i = 0; i < flen; i ++ ) {\n\n\t\t\t\t\t\tconst face = faces[ i ];\n\t\t\t\t\t\tf3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 0 );\n\n\t\t\t}\n\n\t\t\t// Create faces for the z-sides of the shape\n\n\t\t\tfunction buildSideFaces() {\n\n\t\t\t\tconst start = verticesArray.length / 3;\n\t\t\t\tlet layeroffset = 0;\n\t\t\t\tsidewalls( contour, layeroffset );\n\t\t\t\tlayeroffset += contour.length;\n\n\t\t\t\tfor ( let h = 0, hl = holes.length; h < hl; h ++ ) {\n\n\t\t\t\t\tconst ahole = holes[ h ];\n\t\t\t\t\tsidewalls( ahole, layeroffset );\n\n\t\t\t\t\t//, true\n\t\t\t\t\tlayeroffset += ahole.length;\n\n\t\t\t\t}\n\n\n\t\t\t\tscope.addGroup( start, verticesArray.length / 3 - start, 1 );\n\n\n\t\t\t}\n\n\t\t\tfunction sidewalls( contour, layeroffset ) {\n\n\t\t\t\tlet i = contour.length;\n\n\t\t\t\twhile ( -- i >= 0 ) {\n\n\t\t\t\t\tconst j = i;\n\t\t\t\t\tlet k = i - 1;\n\t\t\t\t\tif ( k < 0 ) k = contour.length - 1;\n\n\t\t\t\t\t//console.log('b', i,j, i-1, k,vertices.length);\n\n\t\t\t\t\tfor ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {\n\n\t\t\t\t\t\tconst slen1 = vlen * s;\n\t\t\t\t\t\tconst slen2 = vlen * ( s + 1 );\n\n\t\t\t\t\t\tconst a = layeroffset + j + slen1,\n\t\t\t\t\t\t\tb = layeroffset + k + slen1,\n\t\t\t\t\t\t\tc = layeroffset + k + slen2,\n\t\t\t\t\t\t\td = layeroffset + j + slen2;\n\n\t\t\t\t\t\tf4( a, b, c, d );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tfunction v( x, y, z ) {\n\n\t\t\t\tplaceholder.push( x );\n\t\t\t\tplaceholder.push( y );\n\t\t\t\tplaceholder.push( z );\n\n\t\t\t}\n\n\n\t\t\tfunction f3( a, b, c ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\n\t\t\t}\n\n\t\t\tfunction f4( a, b, c, d ) {\n\n\t\t\t\taddVertex( a );\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( d );\n\n\t\t\t\taddVertex( b );\n\t\t\t\taddVertex( c );\n\t\t\t\taddVertex( d );\n\n\n\t\t\t\tconst nextIndex = verticesArray.length / 3;\n\t\t\t\tconst uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 );\n\n\t\t\t\taddUV( uvs[ 0 ] );\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t\taddUV( uvs[ 1 ] );\n\t\t\t\taddUV( uvs[ 2 ] );\n\t\t\t\taddUV( uvs[ 3 ] );\n\n\t\t\t}\n\n\t\t\tfunction addVertex( index ) {\n\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 0 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 1 ] );\n\t\t\t\tverticesArray.push( placeholder[ index * 3 + 2 ] );\n\n\t\t\t}\n\n\n\t\t\tfunction addUV( vector2 ) {\n\n\t\t\t\tuvArray.push( vector2.x );\n\t\t\t\tuvArray.push( vector2.y );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\t\tconst options = this.parameters.options;\n\n\t\treturn toJSON$1( shapes, options, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\tconst extrudePath = data.options.extrudePath;\n\n\t\tif ( extrudePath !== undefined ) {\n\n\t\t\tdata.options.extrudePath = new Curves[ extrudePath.type ]().fromJSON( extrudePath );\n\n\t\t}\n\n\t\treturn new ExtrudeGeometry( geometryShapes, data.options );\n\n\t}\n\n}\n\nconst WorldUVGenerator = {\n\n\tgenerateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\n\t\treturn [\n\t\t\tnew Vector2( a_x, a_y ),\n\t\t\tnew Vector2( b_x, b_y ),\n\t\t\tnew Vector2( c_x, c_y )\n\t\t];\n\n\t},\n\n\tgenerateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {\n\n\t\tconst a_x = vertices[ indexA * 3 ];\n\t\tconst a_y = vertices[ indexA * 3 + 1 ];\n\t\tconst a_z = vertices[ indexA * 3 + 2 ];\n\t\tconst b_x = vertices[ indexB * 3 ];\n\t\tconst b_y = vertices[ indexB * 3 + 1 ];\n\t\tconst b_z = vertices[ indexB * 3 + 2 ];\n\t\tconst c_x = vertices[ indexC * 3 ];\n\t\tconst c_y = vertices[ indexC * 3 + 1 ];\n\t\tconst c_z = vertices[ indexC * 3 + 2 ];\n\t\tconst d_x = vertices[ indexD * 3 ];\n\t\tconst d_y = vertices[ indexD * 3 + 1 ];\n\t\tconst d_z = vertices[ indexD * 3 + 2 ];\n\n\t\tif ( Math.abs( a_y - b_y ) < Math.abs( a_x - b_x ) ) {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_x, 1 - a_z ),\n\t\t\t\tnew Vector2( b_x, 1 - b_z ),\n\t\t\t\tnew Vector2( c_x, 1 - c_z ),\n\t\t\t\tnew Vector2( d_x, 1 - d_z )\n\t\t\t];\n\n\t\t} else {\n\n\t\t\treturn [\n\t\t\t\tnew Vector2( a_y, 1 - a_z ),\n\t\t\t\tnew Vector2( b_y, 1 - b_z ),\n\t\t\t\tnew Vector2( c_y, 1 - c_z ),\n\t\t\t\tnew Vector2( d_y, 1 - d_z )\n\t\t\t];\n\n\t\t}\n\n\t}\n\n};\n\nfunction toJSON$1( shapes, options, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\tif ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON();\n\n\treturn data;\n\n}\n\nclass IcosahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst t = ( 1 + Math.sqrt( 5 ) ) / 2;\n\n\t\tconst vertices = [\n\t\t\t- 1, t, 0, \t1, t, 0, \t- 1, - t, 0, \t1, - t, 0,\n\t\t\t0, - 1, t, \t0, 1, t,\t0, - 1, - t, \t0, 1, - t,\n\t\t\tt, 0, - 1, \tt, 0, 1, \t- t, 0, - 1, \t- t, 0, 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 11, 5, \t0, 5, 1, \t0, 1, 7, \t0, 7, 10, \t0, 10, 11,\n\t\t\t1, 5, 9, \t5, 11, 4,\t11, 10, 2,\t10, 7, 6,\t7, 1, 8,\n\t\t\t3, 9, 4, \t3, 4, 2,\t3, 2, 6,\t3, 6, 8,\t3, 8, 9,\n\t\t\t4, 9, 5, \t2, 4, 11,\t6, 2, 10,\t8, 6, 7,\t9, 8, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'IcosahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new IcosahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass LatheGeometry extends BufferGeometry {\n\n\tconstructor( points = [ new Vector2( 0, 0.5 ), new Vector2( 0.5, 0 ), new Vector2( 0, - 0.5 ) ], segments = 12, phiStart = 0, phiLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'LatheGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpoints: points,\n\t\t\tsegments: segments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength\n\t\t};\n\n\t\tsegments = Math.floor( segments );\n\n\t\t// clamp phiLength so it's in range of [ 0, 2PI ]\n\n\t\tphiLength = clamp( phiLength, 0, Math.PI * 2 );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst inverseSegments = 1.0 / segments;\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// generate vertices and uvs\n\n\t\tfor ( let i = 0; i <= segments; i ++ ) {\n\n\t\t\tconst phi = phiStart + i * inverseSegments * phiLength;\n\n\t\t\tconst sin = Math.sin( phi );\n\t\t\tconst cos = Math.cos( phi );\n\n\t\t\tfor ( let j = 0; j <= ( points.length - 1 ); j ++ ) {\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = points[ j ].x * sin;\n\t\t\t\tvertex.y = points[ j ].y;\n\t\t\t\tvertex.z = points[ j ].x * cos;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = i / segments;\n\t\t\t\tuv.y = j / ( points.length - 1 );\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\n\t\t\t}\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let i = 0; i < segments; i ++ ) {\n\n\t\t\tfor ( let j = 0; j < ( points.length - 1 ); j ++ ) {\n\n\t\t\t\tconst base = j + i * points.length;\n\n\t\t\t\tconst a = base;\n\t\t\t\tconst b = base + points.length;\n\t\t\t\tconst c = base + points.length + 1;\n\t\t\t\tconst d = base + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// generate normals\n\n\t\tthis.computeVertexNormals();\n\n\t\t// if the geometry is closed, we need to average the normals along the seam.\n\t\t// because the corresponding vertices are identical (but still have different UVs).\n\n\t\tif ( phiLength === Math.PI * 2 ) {\n\n\t\t\tconst normals = this.attributes.normal.array;\n\t\t\tconst n1 = new Vector3();\n\t\t\tconst n2 = new Vector3();\n\t\t\tconst n = new Vector3();\n\n\t\t\t// this is the buffer offset for the last line of vertices\n\n\t\t\tconst base = segments * points.length * 3;\n\n\t\t\tfor ( let i = 0, j = 0; i < points.length; i ++, j += 3 ) {\n\n\t\t\t\t// select the normal of the vertex in the first line\n\n\t\t\t\tn1.x = normals[ j + 0 ];\n\t\t\t\tn1.y = normals[ j + 1 ];\n\t\t\t\tn1.z = normals[ j + 2 ];\n\n\t\t\t\t// select the normal of the vertex in the last line\n\n\t\t\t\tn2.x = normals[ base + j + 0 ];\n\t\t\t\tn2.y = normals[ base + j + 1 ];\n\t\t\t\tn2.z = normals[ base + j + 2 ];\n\n\t\t\t\t// average normals\n\n\t\t\t\tn.addVectors( n1, n2 ).normalize();\n\n\t\t\t\t// assign the new values to both normals\n\n\t\t\t\tnormals[ j + 0 ] = normals[ base + j + 0 ] = n.x;\n\t\t\t\tnormals[ j + 1 ] = normals[ base + j + 1 ] = n.y;\n\t\t\t\tnormals[ j + 2 ] = normals[ base + j + 2 ] = n.z;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new LatheGeometry( data.points, data.segments, data.phiStart, data.phiLength );\n\n\t}\n\n}\n\nclass OctahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 0, 0, \t- 1, 0, 0,\t0, 1, 0,\n\t\t\t0, - 1, 0, \t0, 0, 1,\t0, 0, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t0, 2, 4,\t0, 4, 3,\t0, 3, 5,\n\t\t\t0, 5, 2,\t1, 2, 5,\t1, 5, 3,\n\t\t\t1, 3, 4,\t1, 4, 2\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'OctahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new OctahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass RingGeometry extends BufferGeometry {\n\n\tconstructor( innerRadius = 0.5, outerRadius = 1, thetaSegments = 8, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'RingGeometry';\n\n\t\tthis.parameters = {\n\t\t\tinnerRadius: innerRadius,\n\t\t\touterRadius: outerRadius,\n\t\t\tthetaSegments: thetaSegments,\n\t\t\tphiSegments: phiSegments,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\tthetaSegments = Math.max( 3, thetaSegments );\n\t\tphiSegments = Math.max( 1, phiSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// some helper variables\n\n\t\tlet radius = innerRadius;\n\t\tconst radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );\n\t\tconst vertex = new Vector3();\n\t\tconst uv = new Vector2();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= phiSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= thetaSegments; i ++ ) {\n\n\t\t\t\t// values are generate from the inside of the ring to the outside\n\n\t\t\t\tconst segment = thetaStart + i / thetaSegments * thetaLength;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = radius * Math.cos( segment );\n\t\t\t\tvertex.y = radius * Math.sin( segment );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormals.push( 0, 0, 1 );\n\n\t\t\t\t// uv\n\n\t\t\t\tuv.x = ( vertex.x / outerRadius + 1 ) / 2;\n\t\t\t\tuv.y = ( vertex.y / outerRadius + 1 ) / 2;\n\n\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t}\n\n\t\t\t// increase the radius for next row of vertices\n\n\t\t\tradius += radiusStep;\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let j = 0; j < phiSegments; j ++ ) {\n\n\t\t\tconst thetaSegmentLevel = j * ( thetaSegments + 1 );\n\n\t\t\tfor ( let i = 0; i < thetaSegments; i ++ ) {\n\n\t\t\t\tconst segment = i + thetaSegmentLevel;\n\n\t\t\t\tconst a = segment;\n\t\t\t\tconst b = segment + thetaSegments + 1;\n\t\t\t\tconst c = segment + thetaSegments + 2;\n\t\t\t\tconst d = segment + 1;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new RingGeometry( data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass ShapeGeometry extends BufferGeometry {\n\n\tconstructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), curveSegments = 12 ) {\n\n\t\tsuper();\n\t\tthis.type = 'ShapeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tshapes: shapes,\n\t\t\tcurveSegments: curveSegments\n\t\t};\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tlet groupStart = 0;\n\t\tlet groupCount = 0;\n\n\t\t// allow single and array values for \"shapes\" parameter\n\n\t\tif ( Array.isArray( shapes ) === false ) {\n\n\t\t\taddShape( shapes );\n\n\t\t} else {\n\n\t\t\tfor ( let i = 0; i < shapes.length; i ++ ) {\n\n\t\t\t\taddShape( shapes[ i ] );\n\n\t\t\t\tthis.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support\n\n\t\t\t\tgroupStart += groupCount;\n\t\t\t\tgroupCount = 0;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\n\t\t// helper functions\n\n\t\tfunction addShape( shape ) {\n\n\t\t\tconst indexOffset = vertices.length / 3;\n\t\t\tconst points = shape.extractPoints( curveSegments );\n\n\t\t\tlet shapeVertices = points.shape;\n\t\t\tconst shapeHoles = points.holes;\n\n\t\t\t// check direction of vertices\n\n\t\t\tif ( ShapeUtils.isClockWise( shapeVertices ) === false ) {\n\n\t\t\t\tshapeVertices = shapeVertices.reverse();\n\n\t\t\t}\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\n\t\t\t\tif ( ShapeUtils.isClockWise( shapeHole ) === true ) {\n\n\t\t\t\t\tshapeHoles[ i ] = shapeHole.reverse();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconst faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles );\n\n\t\t\t// join vertices of inner and outer paths to a single array\n\n\t\t\tfor ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {\n\n\t\t\t\tconst shapeHole = shapeHoles[ i ];\n\t\t\t\tshapeVertices = shapeVertices.concat( shapeHole );\n\n\t\t\t}\n\n\t\t\t// vertices, normals, uvs\n\n\t\t\tfor ( let i = 0, l = shapeVertices.length; i < l; i ++ ) {\n\n\t\t\t\tconst vertex = shapeVertices[ i ];\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, 0 );\n\t\t\t\tnormals.push( 0, 0, 1 );\n\t\t\t\tuvs.push( vertex.x, vertex.y ); // world uvs\n\n\t\t\t}\n\n\t\t\t// incides\n\n\t\t\tfor ( let i = 0, l = faces.length; i < l; i ++ ) {\n\n\t\t\t\tconst face = faces[ i ];\n\n\t\t\t\tconst a = face[ 0 ] + indexOffset;\n\t\t\t\tconst b = face[ 1 ] + indexOffset;\n\t\t\t\tconst c = face[ 2 ] + indexOffset;\n\n\t\t\t\tindices.push( a, b, c );\n\t\t\t\tgroupCount += 3;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tconst shapes = this.parameters.shapes;\n\n\t\treturn toJSON( shapes, data );\n\n\t}\n\n\tstatic fromJSON( data, shapes ) {\n\n\t\tconst geometryShapes = [];\n\n\t\tfor ( let j = 0, jl = data.shapes.length; j < jl; j ++ ) {\n\n\t\t\tconst shape = shapes[ data.shapes[ j ] ];\n\n\t\t\tgeometryShapes.push( shape );\n\n\t\t}\n\n\t\treturn new ShapeGeometry( geometryShapes, data.curveSegments );\n\n\t}\n\n}\n\nfunction toJSON( shapes, data ) {\n\n\tdata.shapes = [];\n\n\tif ( Array.isArray( shapes ) ) {\n\n\t\tfor ( let i = 0, l = shapes.length; i < l; i ++ ) {\n\n\t\t\tconst shape = shapes[ i ];\n\n\t\t\tdata.shapes.push( shape.uuid );\n\n\t\t}\n\n\t} else {\n\n\t\tdata.shapes.push( shapes.uuid );\n\n\t}\n\n\treturn data;\n\n}\n\nclass SphereGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI ) {\n\n\t\tsuper();\n\t\tthis.type = 'SphereGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\twidthSegments: widthSegments,\n\t\t\theightSegments: heightSegments,\n\t\t\tphiStart: phiStart,\n\t\t\tphiLength: phiLength,\n\t\t\tthetaStart: thetaStart,\n\t\t\tthetaLength: thetaLength\n\t\t};\n\n\t\twidthSegments = Math.max( 3, Math.floor( widthSegments ) );\n\t\theightSegments = Math.max( 2, Math.floor( heightSegments ) );\n\n\t\tconst thetaEnd = Math.min( thetaStart + thetaLength, Math.PI );\n\n\t\tlet index = 0;\n\t\tconst grid = [];\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let iy = 0; iy <= heightSegments; iy ++ ) {\n\n\t\t\tconst verticesRow = [];\n\n\t\t\tconst v = iy / heightSegments;\n\n\t\t\t// special case for the poles\n\n\t\t\tlet uOffset = 0;\n\n\t\t\tif ( iy == 0 && thetaStart == 0 ) {\n\n\t\t\t\tuOffset = 0.5 / widthSegments;\n\n\t\t\t} else if ( iy == heightSegments && thetaEnd == Math.PI ) {\n\n\t\t\t\tuOffset = - 0.5 / widthSegments;\n\n\t\t\t}\n\n\t\t\tfor ( let ix = 0; ix <= widthSegments; ix ++ ) {\n\n\t\t\t\tconst u = ix / widthSegments;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\t\t\t\tvertex.y = radius * Math.cos( thetaStart + v * thetaLength );\n\t\t\t\tvertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.copy( vertex ).normalize();\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( u + uOffset, 1 - v );\n\n\t\t\t\tverticesRow.push( index ++ );\n\n\t\t\t}\n\n\t\t\tgrid.push( verticesRow );\n\n\t\t}\n\n\t\t// indices\n\n\t\tfor ( let iy = 0; iy < heightSegments; iy ++ ) {\n\n\t\t\tfor ( let ix = 0; ix < widthSegments; ix ++ ) {\n\n\t\t\t\tconst a = grid[ iy ][ ix + 1 ];\n\t\t\t\tconst b = grid[ iy ][ ix ];\n\t\t\t\tconst c = grid[ iy + 1 ][ ix ];\n\t\t\t\tconst d = grid[ iy + 1 ][ ix + 1 ];\n\n\t\t\t\tif ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d );\n\t\t\t\tif ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new SphereGeometry( data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength );\n\n\t}\n\n}\n\nclass TetrahedronGeometry extends PolyhedronGeometry {\n\n\tconstructor( radius = 1, detail = 0 ) {\n\n\t\tconst vertices = [\n\t\t\t1, 1, 1, \t- 1, - 1, 1, \t- 1, 1, - 1, \t1, - 1, - 1\n\t\t];\n\n\t\tconst indices = [\n\t\t\t2, 1, 0, \t0, 3, 2,\t1, 3, 0,\t2, 3, 1\n\t\t];\n\n\t\tsuper( vertices, indices, radius, detail );\n\n\t\tthis.type = 'TetrahedronGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\tdetail: detail\n\t\t};\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TetrahedronGeometry( data.radius, data.detail );\n\n\t}\n\n}\n\nclass TorusGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, radialSegments = 8, tubularSegments = 6, arc = Math.PI * 2 ) {\n\n\t\tsuper();\n\t\tthis.type = 'TorusGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\tradialSegments: radialSegments,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tarc: arc\n\t\t};\n\n\t\tradialSegments = Math.floor( radialSegments );\n\t\ttubularSegments = Math.floor( tubularSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst center = new Vector3();\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tconst u = i / tubularSegments * arc;\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );\n\t\t\t\tvertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );\n\t\t\t\tvertex.z = tube * Math.sin( v );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal\n\n\t\t\t\tcenter.x = radius * Math.cos( u );\n\t\t\t\tcenter.y = radius * Math.sin( u );\n\t\t\t\tnormal.subVectors( vertex, center ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= radialSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= tubularSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( tubularSegments + 1 ) * j + i - 1;\n\t\t\t\tconst b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;\n\t\t\t\tconst c = ( tubularSegments + 1 ) * ( j - 1 ) + i;\n\t\t\t\tconst d = ( tubularSegments + 1 ) * j + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc );\n\n\t}\n\n}\n\nclass TorusKnotGeometry extends BufferGeometry {\n\n\tconstructor( radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3 ) {\n\n\t\tsuper();\n\t\tthis.type = 'TorusKnotGeometry';\n\n\t\tthis.parameters = {\n\t\t\tradius: radius,\n\t\t\ttube: tube,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradialSegments: radialSegments,\n\t\t\tp: p,\n\t\t\tq: q\n\t\t};\n\n\t\ttubularSegments = Math.floor( tubularSegments );\n\t\tradialSegments = Math.floor( radialSegments );\n\n\t\t// buffers\n\n\t\tconst indices = [];\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\n\t\tconst P1 = new Vector3();\n\t\tconst P2 = new Vector3();\n\n\t\tconst B = new Vector3();\n\t\tconst T = new Vector3();\n\t\tconst N = new Vector3();\n\n\t\t// generate vertices, normals and uvs\n\n\t\tfor ( let i = 0; i <= tubularSegments; ++ i ) {\n\n\t\t\t// the radian \"u\" is used to calculate the position on the torus curve of the current tubular segement\n\n\t\t\tconst u = i / tubularSegments * p * Math.PI * 2;\n\n\t\t\t// now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.\n\t\t\t// these points are used to create a special \"coordinate space\", which is necessary to calculate the correct vertex positions\n\n\t\t\tcalculatePositionOnCurve( u, p, q, radius, P1 );\n\t\t\tcalculatePositionOnCurve( u + 0.01, p, q, radius, P2 );\n\n\t\t\t// calculate orthonormal basis\n\n\t\t\tT.subVectors( P2, P1 );\n\t\t\tN.addVectors( P2, P1 );\n\t\t\tB.crossVectors( T, N );\n\t\t\tN.crossVectors( B, T );\n\n\t\t\t// normalize B, N. T can be ignored, we don't use it\n\n\t\t\tB.normalize();\n\t\t\tN.normalize();\n\n\t\t\tfor ( let j = 0; j <= radialSegments; ++ j ) {\n\n\t\t\t\t// now calculate the vertices. they are nothing more than an extrusion of the torus curve.\n\t\t\t\t// because we extrude a shape in the xy-plane, there is no need to calculate a z-value.\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\t\t\t\tconst cx = - tube * Math.cos( v );\n\t\t\t\tconst cy = tube * Math.sin( v );\n\n\t\t\t\t// now calculate the final vertex position.\n\t\t\t\t// first we orient the extrusion with our basis vectos, then we add it to the current position on the curve\n\n\t\t\t\tvertex.x = P1.x + ( cx * N.x + cy * B.x );\n\t\t\t\tvertex.y = P1.y + ( cx * N.y + cy * B.y );\n\t\t\t\tvertex.z = P1.z + ( cx * N.z + cy * B.z );\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t\t// normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)\n\n\t\t\t\tnormal.subVectors( vertex, P1 ).normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// uv\n\n\t\t\t\tuvs.push( i / tubularSegments );\n\t\t\t\tuvs.push( j / radialSegments );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// generate indices\n\n\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t// indices\n\n\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t// faces\n\n\t\t\t\tindices.push( a, b, d );\n\t\t\t\tindices.push( b, c, d );\n\n\t\t\t}\n\n\t\t}\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// this function calculates the current position on the torus curve\n\n\t\tfunction calculatePositionOnCurve( u, p, q, radius, position ) {\n\n\t\t\tconst cu = Math.cos( u );\n\t\t\tconst su = Math.sin( u );\n\t\t\tconst quOverP = q / p * u;\n\t\t\tconst cs = Math.cos( quOverP );\n\n\t\t\tposition.x = radius * ( 2 + cs ) * 0.5 * cu;\n\t\t\tposition.y = radius * ( 2 + cs ) * su * 0.5;\n\t\t\tposition.z = radius * Math.sin( quOverP ) * 0.5;\n\n\t\t}\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\treturn new TorusKnotGeometry( data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q );\n\n\t}\n\n}\n\nclass TubeGeometry extends BufferGeometry {\n\n\tconstructor( path = new QuadraticBezierCurve3( new Vector3( - 1, - 1, 0 ), new Vector3( - 1, 1, 0 ), new Vector3( 1, 1, 0 ) ), tubularSegments = 64, radius = 1, radialSegments = 8, closed = false ) {\n\n\t\tsuper();\n\t\tthis.type = 'TubeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tpath: path,\n\t\t\ttubularSegments: tubularSegments,\n\t\t\tradius: radius,\n\t\t\tradialSegments: radialSegments,\n\t\t\tclosed: closed\n\t\t};\n\n\t\tconst frames = path.computeFrenetFrames( tubularSegments, closed );\n\n\t\t// expose internals\n\n\t\tthis.tangents = frames.tangents;\n\t\tthis.normals = frames.normals;\n\t\tthis.binormals = frames.binormals;\n\n\t\t// helper variables\n\n\t\tconst vertex = new Vector3();\n\t\tconst normal = new Vector3();\n\t\tconst uv = new Vector2();\n\t\tlet P = new Vector3();\n\n\t\t// buffer\n\n\t\tconst vertices = [];\n\t\tconst normals = [];\n\t\tconst uvs = [];\n\t\tconst indices = [];\n\n\t\t// create buffer data\n\n\t\tgenerateBufferData();\n\n\t\t// build geometry\n\n\t\tthis.setIndex( indices );\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tthis.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );\n\n\t\t// functions\n\n\t\tfunction generateBufferData() {\n\n\t\t\tfor ( let i = 0; i < tubularSegments; i ++ ) {\n\n\t\t\t\tgenerateSegment( i );\n\n\t\t\t}\n\n\t\t\t// if the geometry is not closed, generate the last row of vertices and normals\n\t\t\t// at the regular position on the given path\n\t\t\t//\n\t\t\t// if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)\n\n\t\t\tgenerateSegment( ( closed === false ) ? tubularSegments : 0 );\n\n\t\t\t// uvs are generated in a separate function.\n\t\t\t// this makes it easy compute correct values for closed geometries\n\n\t\t\tgenerateUVs();\n\n\t\t\t// finally create faces\n\n\t\t\tgenerateIndices();\n\n\t\t}\n\n\t\tfunction generateSegment( i ) {\n\n\t\t\t// we use getPointAt to sample evenly distributed points from the given path\n\n\t\t\tP = path.getPointAt( i / tubularSegments, P );\n\n\t\t\t// retrieve corresponding normal and binormal\n\n\t\t\tconst N = frames.normals[ i ];\n\t\t\tconst B = frames.binormals[ i ];\n\n\t\t\t// generate normals and vertices for the current segment\n\n\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\tconst v = j / radialSegments * Math.PI * 2;\n\n\t\t\t\tconst sin = Math.sin( v );\n\t\t\t\tconst cos = - Math.cos( v );\n\n\t\t\t\t// normal\n\n\t\t\t\tnormal.x = ( cos * N.x + sin * B.x );\n\t\t\t\tnormal.y = ( cos * N.y + sin * B.y );\n\t\t\t\tnormal.z = ( cos * N.z + sin * B.z );\n\t\t\t\tnormal.normalize();\n\n\t\t\t\tnormals.push( normal.x, normal.y, normal.z );\n\n\t\t\t\t// vertex\n\n\t\t\t\tvertex.x = P.x + radius * normal.x;\n\t\t\t\tvertex.y = P.y + radius * normal.y;\n\t\t\t\tvertex.z = P.z + radius * normal.z;\n\n\t\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateIndices() {\n\n\t\t\tfor ( let j = 1; j <= tubularSegments; j ++ ) {\n\n\t\t\t\tfor ( let i = 1; i <= radialSegments; i ++ ) {\n\n\t\t\t\t\tconst a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );\n\t\t\t\t\tconst b = ( radialSegments + 1 ) * j + ( i - 1 );\n\t\t\t\t\tconst c = ( radialSegments + 1 ) * j + i;\n\t\t\t\t\tconst d = ( radialSegments + 1 ) * ( j - 1 ) + i;\n\n\t\t\t\t\t// faces\n\n\t\t\t\t\tindices.push( a, b, d );\n\t\t\t\t\tindices.push( b, c, d );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfunction generateUVs() {\n\n\t\t\tfor ( let i = 0; i <= tubularSegments; i ++ ) {\n\n\t\t\t\tfor ( let j = 0; j <= radialSegments; j ++ ) {\n\n\t\t\t\t\tuv.x = i / tubularSegments;\n\t\t\t\t\tuv.y = j / radialSegments;\n\n\t\t\t\t\tuvs.push( uv.x, uv.y );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON();\n\n\t\tdata.path = this.parameters.path.toJSON();\n\n\t\treturn data;\n\n\t}\n\n\tstatic fromJSON( data ) {\n\n\t\t// This only works for built-in curves (e.g. CatmullRomCurve3).\n\t\t// User defined curves or instances of CurvePath will not be deserialized.\n\t\treturn new TubeGeometry(\n\t\t\tnew Curves[ data.path.type ]().fromJSON( data.path ),\n\t\t\tdata.tubularSegments,\n\t\t\tdata.radius,\n\t\t\tdata.radialSegments,\n\t\t\tdata.closed\n\t\t);\n\n\t}\n\n}\n\nclass WireframeGeometry extends BufferGeometry {\n\n\tconstructor( geometry = null ) {\n\n\t\tsuper();\n\t\tthis.type = 'WireframeGeometry';\n\n\t\tthis.parameters = {\n\t\t\tgeometry: geometry\n\t\t};\n\n\t\tif ( geometry !== null ) {\n\n\t\t\t// buffer\n\n\t\t\tconst vertices = [];\n\t\t\tconst edges = new Set();\n\n\t\t\t// helper variables\n\n\t\t\tconst start = new Vector3();\n\t\t\tconst end = new Vector3();\n\n\t\t\tif ( geometry.index !== null ) {\n\n\t\t\t\t// indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\t\t\t\tconst indices = geometry.index;\n\t\t\t\tlet groups = geometry.groups;\n\n\t\t\t\tif ( groups.length === 0 ) {\n\n\t\t\t\t\tgroups = [ { start: 0, count: indices.count, materialIndex: 0 } ];\n\n\t\t\t\t}\n\n\t\t\t\t// create a data structure that contains all eges without duplicates\n\n\t\t\t\tfor ( let o = 0, ol = groups.length; o < ol; ++ o ) {\n\n\t\t\t\t\tconst group = groups[ o ];\n\n\t\t\t\t\tconst groupStart = group.start;\n\t\t\t\t\tconst groupCount = group.count;\n\n\t\t\t\t\tfor ( let i = groupStart, l = ( groupStart + groupCount ); i < l; i += 3 ) {\n\n\t\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t\tconst index1 = indices.getX( i + j );\n\t\t\t\t\t\t\tconst index2 = indices.getX( i + ( j + 1 ) % 3 );\n\n\t\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\t// non-indexed BufferGeometry\n\n\t\t\t\tconst position = geometry.attributes.position;\n\n\t\t\t\tfor ( let i = 0, l = ( position.count / 3 ); i < l; i ++ ) {\n\n\t\t\t\t\tfor ( let j = 0; j < 3; j ++ ) {\n\n\t\t\t\t\t\t// three edges per triangle, an edge is represented as (index1, index2)\n\t\t\t\t\t\t// e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)\n\n\t\t\t\t\t\tconst index1 = 3 * i + j;\n\t\t\t\t\t\tconst index2 = 3 * i + ( ( j + 1 ) % 3 );\n\n\t\t\t\t\t\tstart.fromBufferAttribute( position, index1 );\n\t\t\t\t\t\tend.fromBufferAttribute( position, index2 );\n\n\t\t\t\t\t\tif ( isUniqueEdge( start, end, edges ) === true ) {\n\n\t\t\t\t\t\t\tvertices.push( start.x, start.y, start.z );\n\t\t\t\t\t\t\tvertices.push( end.x, end.y, end.z );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// build geometry\n\n\t\t\tthis.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\n\t\t}\n\n\t}\n\n}\n\nfunction isUniqueEdge( start, end, edges ) {\n\n\tconst hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`;\n\tconst hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge\n\n\tif ( edges.has( hash1 ) === true || edges.has( hash2 ) === true ) {\n\n\t\treturn false;\n\n\t} else {\n\n\t\tedges.add( hash1, hash2 );\n\t\treturn true;\n\n\t}\n\n}\n\nvar Geometries = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tBoxGeometry: BoxGeometry,\n\tBoxBufferGeometry: BoxGeometry,\n\tCircleGeometry: CircleGeometry,\n\tCircleBufferGeometry: CircleGeometry,\n\tConeGeometry: ConeGeometry,\n\tConeBufferGeometry: ConeGeometry,\n\tCylinderGeometry: CylinderGeometry,\n\tCylinderBufferGeometry: CylinderGeometry,\n\tDodecahedronGeometry: DodecahedronGeometry,\n\tDodecahedronBufferGeometry: DodecahedronGeometry,\n\tEdgesGeometry: EdgesGeometry,\n\tExtrudeGeometry: ExtrudeGeometry,\n\tExtrudeBufferGeometry: ExtrudeGeometry,\n\tIcosahedronGeometry: IcosahedronGeometry,\n\tIcosahedronBufferGeometry: IcosahedronGeometry,\n\tLatheGeometry: LatheGeometry,\n\tLatheBufferGeometry: LatheGeometry,\n\tOctahedronGeometry: OctahedronGeometry,\n\tOctahedronBufferGeometry: OctahedronGeometry,\n\tPlaneGeometry: PlaneGeometry,\n\tPlaneBufferGeometry: PlaneGeometry,\n\tPolyhedronGeometry: PolyhedronGeometry,\n\tPolyhedronBufferGeometry: PolyhedronGeometry,\n\tRingGeometry: RingGeometry,\n\tRingBufferGeometry: RingGeometry,\n\tShapeGeometry: ShapeGeometry,\n\tShapeBufferGeometry: ShapeGeometry,\n\tSphereGeometry: SphereGeometry,\n\tSphereBufferGeometry: SphereGeometry,\n\tTetrahedronGeometry: TetrahedronGeometry,\n\tTetrahedronBufferGeometry: TetrahedronGeometry,\n\tTorusGeometry: TorusGeometry,\n\tTorusBufferGeometry: TorusGeometry,\n\tTorusKnotGeometry: TorusKnotGeometry,\n\tTorusKnotBufferGeometry: TorusKnotGeometry,\n\tTubeGeometry: TubeGeometry,\n\tTubeBufferGeometry: TubeGeometry,\n\tWireframeGeometry: WireframeGeometry\n});\n\n/**\n * parameters = {\n * color: <THREE.Color>\n * }\n */\n\nclass ShadowMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ShadowMaterial';\n\n\t\tthis.color = new Color( 0x000000 );\n\t\tthis.transparent = true;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\treturn this;\n\n\t}\n\n}\n\nShadowMaterial.prototype.isShadowMaterial = true;\n\n/**\n * parameters = {\n * color: <hex>,\n * roughness: <float>,\n * metalness: <float>,\n * opacity: <float>,\n *\n * map: new THREE.Texture( <Image> ),\n *\n * lightMap: new THREE.Texture( <Image> ),\n * lightMapIntensity: <float>\n *\n * aoMap: new THREE.Texture( <Image> ),\n * aoMapIntensity: <float>\n *\n * emissive: <hex>,\n * emissiveIntensity: <float>\n * emissiveMap: new THREE.Texture( <Image> ),\n *\n * bumpMap: new THREE.Texture( <Image> ),\n * bumpScale: <float>,\n *\n * normalMap: new THREE.Texture( <Image> ),\n * normalMapType: THREE.TangentSpaceNormalMap,\n * normalScale: <Vector2>,\n *\n * displacementMap: new THREE.Texture( <Image> ),\n * displacementScale: <float>,\n * displacementBias: <float>,\n *\n * roughnessMap: new THREE.Texture( <Image> ),\n *\n * metalnessMap: new THREE.Texture( <Image> ),\n *\n * alphaMap: new THREE.Texture( <Image> ),\n *\n * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),\n * envMapIntensity: <float>\n *\n * refractionRatio: <float>,\n *\n * wireframe: <boolean>,\n * wireframeLinewidth: <float>,\n *\n * flatShading: <bool>\n * }\n */\n\nclass MeshStandardMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.type = 'MeshStandardMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.roughness = 1.0;\n\t\tthis.metalness = 0.0;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.roughnessMap = null;\n\n\t\tthis.metalnessMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.envMapIntensity = 1.0;\n\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'STANDARD': '' };\n\n\t\tthis.color.copy( source.color );\n\t\tthis.roughness = source.roughness;\n\t\tthis.metalness = source.metalness;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.roughnessMap = source.roughnessMap;\n\n\t\tthis.metalnessMap = source.metalnessMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.envMapIntensity = source.envMapIntensity;\n\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\treturn this;\n\n\t}\n\n}\n\nMeshStandardMaterial.prototype.isMeshStandardMaterial = true;\n\n/**\n * parameters = {\n * clearcoat: <float>,\n * clearcoatMap: new THREE.Texture( <Image> ),\n * clearcoatRoughness: <float>,\n * clearcoatRoughnessMap: new THREE.Texture( <Image> ),\n * clearcoatNormalScale: <Vector2>,\n * clearcoatNormalMap: new THREE.Texture( <Image> ),\n *\n * ior: <float>,\n * reflectivity: <float>,\n *\n * sheen: <float>,\n * sheenColor: <Color>,\n * sheenColorMap: new THREE.Texture( <Image> ),\n * sheenRoughness: <float>,\n * sheenRoughnessMap: new THREE.Texture( <Image> ),\n *\n * transmission: <float>,\n * transmissionMap: new THREE.Texture( <Image> ),\n *\n * thickness: <float>,\n * thicknessMap: new THREE.Texture( <Image> ),\n * attenuationDistance: <float>,\n * attenuationColor: <Color>,\n *\n * specularIntensity: <float>,\n * specularIntensityMap: new THREE.Texture( <Image> ),\n * specularColor: <Color>,\n * specularColorMap: new THREE.Texture( <Image> )\n * }\n */\n\nclass MeshPhysicalMaterial extends MeshStandardMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.type = 'MeshPhysicalMaterial';\n\n\t\tthis.clearcoatMap = null;\n\t\tthis.clearcoatRoughness = 0.0;\n\t\tthis.clearcoatRoughnessMap = null;\n\t\tthis.clearcoatNormalScale = new Vector2( 1, 1 );\n\t\tthis.clearcoatNormalMap = null;\n\n\t\tthis.ior = 1.5;\n\n\t\tObject.defineProperty( this, 'reflectivity', {\n\t\t\tget: function () {\n\n\t\t\t\treturn ( clamp( 2.5 * ( this.ior - 1 ) / ( this.ior + 1 ), 0, 1 ) );\n\n\t\t\t},\n\t\t\tset: function ( reflectivity ) {\n\n\t\t\t\tthis.ior = ( 1 + 0.4 * reflectivity ) / ( 1 - 0.4 * reflectivity );\n\n\t\t\t}\n\t\t} );\n\n\t\tthis.sheenColor = new Color( 0x000000 );\n\t\tthis.sheenColorMap = null;\n\t\tthis.sheenRoughness = 1.0;\n\t\tthis.sheenRoughnessMap = null;\n\n\t\tthis.transmissionMap = null;\n\n\t\tthis.thickness = 0.01;\n\t\tthis.thicknessMap = null;\n\t\tthis.attenuationDistance = 0.0;\n\t\tthis.attenuationColor = new Color( 1, 1, 1 );\n\n\t\tthis.specularIntensity = 1.0;\n\t\tthis.specularIntensityMap = null;\n\t\tthis.specularColor = new Color( 1, 1, 1 );\n\t\tthis.specularColorMap = null;\n\n\t\tthis._sheen = 0.0;\n\t\tthis._clearcoat = 0;\n\t\tthis._transmission = 0;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tget sheen() {\n\n\t\treturn this._sheen;\n\n\t}\n\n\tset sheen( value ) {\n\n\t\tif ( this._sheen > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._sheen = value;\n\n\t}\n\n\tget clearcoat() {\n\n\t\treturn this._clearcoat;\n\n\t}\n\n\tset clearcoat( value ) {\n\n\t\tif ( this._clearcoat > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._clearcoat = value;\n\n\t}\n\n\tget transmission() {\n\n\t\treturn this._transmission;\n\n\t}\n\n\tset transmission( value ) {\n\n\t\tif ( this._transmission > 0 !== value > 0 ) {\n\n\t\t\tthis.version ++;\n\n\t\t}\n\n\t\tthis._transmission = value;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = {\n\n\t\t\t'STANDARD': '',\n\t\t\t'PHYSICAL': ''\n\n\t\t};\n\n\t\tthis.clearcoat = source.clearcoat;\n\t\tthis.clearcoatMap = source.clearcoatMap;\n\t\tthis.clearcoatRoughness = source.clearcoatRoughness;\n\t\tthis.clearcoatRoughnessMap = source.clearcoatRoughnessMap;\n\t\tthis.clearcoatNormalMap = source.clearcoatNormalMap;\n\t\tthis.clearcoatNormalScale.copy( source.clearcoatNormalScale );\n\n\t\tthis.ior = source.ior;\n\n\t\tthis.sheen = source.sheen;\n\t\tthis.sheenColor.copy( source.sheenColor );\n\t\tthis.sheenColorMap = source.sheenColorMap;\n\t\tthis.sheenRoughness = source.sheenRoughness;\n\t\tthis.sheenRoughnessMap = source.sheenRoughnessMap;\n\n\t\tthis.transmission = source.transmission;\n\t\tthis.transmissionMap = source.transmissionMap;\n\n\t\tthis.thickness = source.thickness;\n\t\tthis.thicknessMap = source.thicknessMap;\n\t\tthis.attenuationDistance = source.attenuationDistance;\n\t\tthis.attenuationColor.copy( source.attenuationColor );\n\n\t\tthis.specularIntensity = source.specularIntensity;\n\t\tthis.specularIntensityMap = source.specularIntensityMap;\n\t\tthis.specularColor.copy( source.specularColor );\n\t\tthis.specularColorMap = source.specularColorMap;\n\n\t\treturn this;\n\n\t}\n\n}\n\nMeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true;\n\n/**\n * parameters = {\n * color: <hex>,\n * specular: <hex>,\n * shininess: <float>,\n * opacity: <float>,\n *\n * map: new THREE.Texture( <Image> ),\n *\n * lightMap: new THREE.Texture( <Image> ),\n * lightMapIntensity: <float>\n *\n * aoMap: new THREE.Texture( <Image> ),\n * aoMapIntensity: <float>\n *\n * emissive: <hex>,\n * emissiveIntensity: <float>\n * emissiveMap: new THREE.Texture( <Image> ),\n *\n * bumpMap: new THREE.Texture( <Image> ),\n * bumpScale: <float>,\n *\n * normalMap: new THREE.Texture( <Image> ),\n * normalMapType: THREE.TangentSpaceNormalMap,\n * normalScale: <Vector2>,\n *\n * displacementMap: new THREE.Texture( <Image> ),\n * displacementScale: <float>,\n * displacementBias: <float>,\n *\n * specularMap: new THREE.Texture( <Image> ),\n *\n * alphaMap: new THREE.Texture( <Image> ),\n *\n * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),\n * combine: THREE.MultiplyOperation,\n * reflectivity: <float>,\n * refractionRatio: <float>,\n *\n * wireframe: <boolean>,\n * wireframeLinewidth: <float>,\n *\n * flatShading: <bool>\n * }\n */\n\nclass MeshPhongMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'MeshPhongMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\t\tthis.specular = new Color( 0x111111 );\n\t\tthis.shininess = 30;\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.flatShading = false;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.specular.copy( source.specular );\n\t\tthis.shininess = source.shininess;\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\treturn this;\n\n\t}\n\n}\n\nMeshPhongMaterial.prototype.isMeshPhongMaterial = true;\n\n/**\n * parameters = {\n * color: <hex>,\n *\n * map: new THREE.Texture( <Image> ),\n * gradientMap: new THREE.Texture( <Image> ),\n *\n * lightMap: new THREE.Texture( <Image> ),\n * lightMapIntensity: <float>\n *\n * aoMap: new THREE.Texture( <Image> ),\n * aoMapIntensity: <float>\n *\n * emissive: <hex>,\n * emissiveIntensity: <float>\n * emissiveMap: new THREE.Texture( <Image> ),\n *\n * bumpMap: new THREE.Texture( <Image> ),\n * bumpScale: <float>,\n *\n * normalMap: new THREE.Texture( <Image> ),\n * normalMapType: THREE.TangentSpaceNormalMap,\n * normalScale: <Vector2>,\n *\n * displacementMap: new THREE.Texture( <Image> ),\n * displacementScale: <float>,\n * displacementBias: <float>,\n *\n * alphaMap: new THREE.Texture( <Image> ),\n *\n * wireframe: <boolean>,\n * wireframeLinewidth: <float>,\n *\n * }\n */\n\nclass MeshToonMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.defines = { 'TOON': '' };\n\n\t\tthis.type = 'MeshToonMaterial';\n\n\t\tthis.color = new Color( 0xffffff );\n\n\t\tthis.map = null;\n\t\tthis.gradientMap = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\t\tthis.gradientMap = source.gradientMap;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\treturn this;\n\n\t}\n\n}\n\nMeshToonMaterial.prototype.isMeshToonMaterial = true;\n\n/**\n * parameters = {\n * opacity: <float>,\n *\n * bumpMap: new THREE.Texture( <Image> ),\n * bumpScale: <float>,\n *\n * normalMap: new THREE.Texture( <Image> ),\n * normalMapType: THREE.TangentSpaceNormalMap,\n * normalScale: <Vector2>,\n *\n * displacementMap: new THREE.Texture( <Image> ),\n * displacementScale: <float>,\n * displacementBias: <float>,\n *\n * wireframe: <boolean>,\n * wireframeLinewidth: <float>\n *\n * flatShading: <bool>\n * }\n */\n\nclass MeshNormalMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'MeshNormalMaterial';\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\n\t\tthis.fog = false;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\treturn this;\n\n\t}\n\n}\n\nMeshNormalMaterial.prototype.isMeshNormalMaterial = true;\n\n/**\n * parameters = {\n * color: <hex>,\n * opacity: <float>,\n *\n * map: new THREE.Texture( <Image> ),\n *\n * lightMap: new THREE.Texture( <Image> ),\n * lightMapIntensity: <float>\n *\n * aoMap: new THREE.Texture( <Image> ),\n * aoMapIntensity: <float>\n *\n * emissive: <hex>,\n * emissiveIntensity: <float>\n * emissiveMap: new THREE.Texture( <Image> ),\n *\n * specularMap: new THREE.Texture( <Image> ),\n *\n * alphaMap: new THREE.Texture( <Image> ),\n *\n * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),\n * combine: THREE.Multiply,\n * reflectivity: <float>,\n * refractionRatio: <float>,\n *\n * wireframe: <boolean>,\n * wireframeLinewidth: <float>,\n *\n * }\n */\n\nclass MeshLambertMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'MeshLambertMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.map = null;\n\n\t\tthis.lightMap = null;\n\t\tthis.lightMapIntensity = 1.0;\n\n\t\tthis.aoMap = null;\n\t\tthis.aoMapIntensity = 1.0;\n\n\t\tthis.emissive = new Color( 0x000000 );\n\t\tthis.emissiveIntensity = 1.0;\n\t\tthis.emissiveMap = null;\n\n\t\tthis.specularMap = null;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.envMap = null;\n\t\tthis.combine = MultiplyOperation;\n\t\tthis.reflectivity = 1;\n\t\tthis.refractionRatio = 0.98;\n\n\t\tthis.wireframe = false;\n\t\tthis.wireframeLinewidth = 1;\n\t\tthis.wireframeLinecap = 'round';\n\t\tthis.wireframeLinejoin = 'round';\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.map = source.map;\n\n\t\tthis.lightMap = source.lightMap;\n\t\tthis.lightMapIntensity = source.lightMapIntensity;\n\n\t\tthis.aoMap = source.aoMap;\n\t\tthis.aoMapIntensity = source.aoMapIntensity;\n\n\t\tthis.emissive.copy( source.emissive );\n\t\tthis.emissiveMap = source.emissiveMap;\n\t\tthis.emissiveIntensity = source.emissiveIntensity;\n\n\t\tthis.specularMap = source.specularMap;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.envMap = source.envMap;\n\t\tthis.combine = source.combine;\n\t\tthis.reflectivity = source.reflectivity;\n\t\tthis.refractionRatio = source.refractionRatio;\n\n\t\tthis.wireframe = source.wireframe;\n\t\tthis.wireframeLinewidth = source.wireframeLinewidth;\n\t\tthis.wireframeLinecap = source.wireframeLinecap;\n\t\tthis.wireframeLinejoin = source.wireframeLinejoin;\n\n\t\treturn this;\n\n\t}\n\n}\n\nMeshLambertMaterial.prototype.isMeshLambertMaterial = true;\n\n/**\n * parameters = {\n * color: <hex>,\n * opacity: <float>,\n *\n * matcap: new THREE.Texture( <Image> ),\n *\n * map: new THREE.Texture( <Image> ),\n *\n * bumpMap: new THREE.Texture( <Image> ),\n * bumpScale: <float>,\n *\n * normalMap: new THREE.Texture( <Image> ),\n * normalMapType: THREE.TangentSpaceNormalMap,\n * normalScale: <Vector2>,\n *\n * displacementMap: new THREE.Texture( <Image> ),\n * displacementScale: <float>,\n * displacementBias: <float>,\n *\n * alphaMap: new THREE.Texture( <Image> ),\n *\n * flatShading: <bool>\n * }\n */\n\nclass MeshMatcapMaterial extends Material {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.type = 'MeshMatcapMaterial';\n\n\t\tthis.color = new Color( 0xffffff ); // diffuse\n\n\t\tthis.matcap = null;\n\n\t\tthis.map = null;\n\n\t\tthis.bumpMap = null;\n\t\tthis.bumpScale = 1;\n\n\t\tthis.normalMap = null;\n\t\tthis.normalMapType = TangentSpaceNormalMap;\n\t\tthis.normalScale = new Vector2( 1, 1 );\n\n\t\tthis.displacementMap = null;\n\t\tthis.displacementScale = 1;\n\t\tthis.displacementBias = 0;\n\n\t\tthis.alphaMap = null;\n\n\t\tthis.flatShading = false;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.defines = { 'MATCAP': '' };\n\n\t\tthis.color.copy( source.color );\n\n\t\tthis.matcap = source.matcap;\n\n\t\tthis.map = source.map;\n\n\t\tthis.bumpMap = source.bumpMap;\n\t\tthis.bumpScale = source.bumpScale;\n\n\t\tthis.normalMap = source.normalMap;\n\t\tthis.normalMapType = source.normalMapType;\n\t\tthis.normalScale.copy( source.normalScale );\n\n\t\tthis.displacementMap = source.displacementMap;\n\t\tthis.displacementScale = source.displacementScale;\n\t\tthis.displacementBias = source.displacementBias;\n\n\t\tthis.alphaMap = source.alphaMap;\n\n\t\tthis.flatShading = source.flatShading;\n\n\t\treturn this;\n\n\t}\n\n}\n\nMeshMatcapMaterial.prototype.isMeshMatcapMaterial = true;\n\n/**\n * parameters = {\n * color: <hex>,\n * opacity: <float>,\n *\n * linewidth: <float>,\n *\n * scale: <float>,\n * dashSize: <float>,\n * gapSize: <float>\n * }\n */\n\nclass LineDashedMaterial extends LineBasicMaterial {\n\n\tconstructor( parameters ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'LineDashedMaterial';\n\n\t\tthis.scale = 1;\n\t\tthis.dashSize = 3;\n\t\tthis.gapSize = 1;\n\n\t\tthis.setValues( parameters );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.scale = source.scale;\n\t\tthis.dashSize = source.dashSize;\n\t\tthis.gapSize = source.gapSize;\n\n\t\treturn this;\n\n\t}\n\n}\n\nLineDashedMaterial.prototype.isLineDashedMaterial = true;\n\nvar Materials = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tShadowMaterial: ShadowMaterial,\n\tSpriteMaterial: SpriteMaterial,\n\tRawShaderMaterial: RawShaderMaterial,\n\tShaderMaterial: ShaderMaterial,\n\tPointsMaterial: PointsMaterial,\n\tMeshPhysicalMaterial: MeshPhysicalMaterial,\n\tMeshStandardMaterial: MeshStandardMaterial,\n\tMeshPhongMaterial: MeshPhongMaterial,\n\tMeshToonMaterial: MeshToonMaterial,\n\tMeshNormalMaterial: MeshNormalMaterial,\n\tMeshLambertMaterial: MeshLambertMaterial,\n\tMeshDepthMaterial: MeshDepthMaterial,\n\tMeshDistanceMaterial: MeshDistanceMaterial,\n\tMeshBasicMaterial: MeshBasicMaterial,\n\tMeshMatcapMaterial: MeshMatcapMaterial,\n\tLineDashedMaterial: LineDashedMaterial,\n\tLineBasicMaterial: LineBasicMaterial,\n\tMaterial: Material\n});\n\nconst AnimationUtils = {\n\n\t// same as Array.prototype.slice, but also works on typed arrays\n\tarraySlice: function ( array, from, to ) {\n\n\t\tif ( AnimationUtils.isTypedArray( array ) ) {\n\n\t\t\t// in ios9 array.subarray(from, undefined) will return empty array\n\t\t\t// but array.subarray(from) or array.subarray(from, len) is correct\n\t\t\treturn new array.constructor( array.subarray( from, to !== undefined ? to : array.length ) );\n\n\t\t}\n\n\t\treturn array.slice( from, to );\n\n\t},\n\n\t// converts an array to a specific type\n\tconvertArray: function ( array, type, forceClone ) {\n\n\t\tif ( ! array || // let 'undefined' and 'null' pass\n\t\t\t! forceClone && array.constructor === type ) return array;\n\n\t\tif ( typeof type.BYTES_PER_ELEMENT === 'number' ) {\n\n\t\t\treturn new type( array ); // create typed array\n\n\t\t}\n\n\t\treturn Array.prototype.slice.call( array ); // create Array\n\n\t},\n\n\tisTypedArray: function ( object ) {\n\n\t\treturn ArrayBuffer.isView( object ) &&\n\t\t\t! ( object instanceof DataView );\n\n\t},\n\n\t// returns an array by which times and values can be sorted\n\tgetKeyframeOrder: function ( times ) {\n\n\t\tfunction compareTime( i, j ) {\n\n\t\t\treturn times[ i ] - times[ j ];\n\n\t\t}\n\n\t\tconst n = times.length;\n\t\tconst result = new Array( n );\n\t\tfor ( let i = 0; i !== n; ++ i ) result[ i ] = i;\n\n\t\tresult.sort( compareTime );\n\n\t\treturn result;\n\n\t},\n\n\t// uses the array previously returned by 'getKeyframeOrder' to sort data\n\tsortedArray: function ( values, stride, order ) {\n\n\t\tconst nValues = values.length;\n\t\tconst result = new values.constructor( nValues );\n\n\t\tfor ( let i = 0, dstOffset = 0; dstOffset !== nValues; ++ i ) {\n\n\t\t\tconst srcOffset = order[ i ] * stride;\n\n\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\tresult[ dstOffset ++ ] = values[ srcOffset + j ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\n\t},\n\n\t// function for parsing AOS keyframe formats\n\tflattenJSON: function ( jsonKeys, times, values, valuePropertyName ) {\n\n\t\tlet i = 1, key = jsonKeys[ 0 ];\n\n\t\twhile ( key !== undefined && key[ valuePropertyName ] === undefined ) {\n\n\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t}\n\n\t\tif ( key === undefined ) return; // no data\n\n\t\tlet value = key[ valuePropertyName ];\n\t\tif ( value === undefined ) return; // no data\n\n\t\tif ( Array.isArray( value ) ) {\n\n\t\t\tdo {\n\n\t\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\ttimes.push( key.time );\n\t\t\t\t\tvalues.push.apply( values, value ); // push all elements\n\n\t\t\t\t}\n\n\t\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t\t} while ( key !== undefined );\n\n\t\t} else if ( value.toArray !== undefined ) {\n\n\t\t\t// ...assume THREE.Math-ish\n\n\t\t\tdo {\n\n\t\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\ttimes.push( key.time );\n\t\t\t\t\tvalue.toArray( values, values.length );\n\n\t\t\t\t}\n\n\t\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t\t} while ( key !== undefined );\n\n\t\t} else {\n\n\t\t\t// otherwise push as-is\n\n\t\t\tdo {\n\n\t\t\t\tvalue = key[ valuePropertyName ];\n\n\t\t\t\tif ( value !== undefined ) {\n\n\t\t\t\t\ttimes.push( key.time );\n\t\t\t\t\tvalues.push( value );\n\n\t\t\t\t}\n\n\t\t\t\tkey = jsonKeys[ i ++ ];\n\n\t\t\t} while ( key !== undefined );\n\n\t\t}\n\n\t},\n\n\tsubclip: function ( sourceClip, name, startFrame, endFrame, fps = 30 ) {\n\n\t\tconst clip = sourceClip.clone();\n\n\t\tclip.name = name;\n\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\t\tconst track = clip.tracks[ i ];\n\t\t\tconst valueSize = track.getValueSize();\n\n\t\t\tconst times = [];\n\t\t\tconst values = [];\n\n\t\t\tfor ( let j = 0; j < track.times.length; ++ j ) {\n\n\t\t\t\tconst frame = track.times[ j ] * fps;\n\n\t\t\t\tif ( frame < startFrame || frame >= endFrame ) continue;\n\n\t\t\t\ttimes.push( track.times[ j ] );\n\n\t\t\t\tfor ( let k = 0; k < valueSize; ++ k ) {\n\n\t\t\t\t\tvalues.push( track.values[ j * valueSize + k ] );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( times.length === 0 ) continue;\n\n\t\t\ttrack.times = AnimationUtils.convertArray( times, track.times.constructor );\n\t\t\ttrack.values = AnimationUtils.convertArray( values, track.values.constructor );\n\n\t\t\ttracks.push( track );\n\n\t\t}\n\n\t\tclip.tracks = tracks;\n\n\t\t// find minimum .times value across all tracks in the trimmed clip\n\n\t\tlet minStartTime = Infinity;\n\n\t\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\t\tif ( minStartTime > clip.tracks[ i ].times[ 0 ] ) {\n\n\t\t\t\tminStartTime = clip.tracks[ i ].times[ 0 ];\n\n\t\t\t}\n\n\t\t}\n\n\t\t// shift all tracks such that clip begins at t=0\n\n\t\tfor ( let i = 0; i < clip.tracks.length; ++ i ) {\n\n\t\t\tclip.tracks[ i ].shift( - 1 * minStartTime );\n\n\t\t}\n\n\t\tclip.resetDuration();\n\n\t\treturn clip;\n\n\t},\n\n\tmakeClipAdditive: function ( targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30 ) {\n\n\t\tif ( fps <= 0 ) fps = 30;\n\n\t\tconst numTracks = referenceClip.tracks.length;\n\t\tconst referenceTime = referenceFrame / fps;\n\n\t\t// Make each track's values relative to the values at the reference frame\n\t\tfor ( let i = 0; i < numTracks; ++ i ) {\n\n\t\t\tconst referenceTrack = referenceClip.tracks[ i ];\n\t\t\tconst referenceTrackType = referenceTrack.ValueTypeName;\n\n\t\t\t// Skip this track if it's non-numeric\n\t\t\tif ( referenceTrackType === 'bool' || referenceTrackType === 'string' ) continue;\n\n\t\t\t// Find the track in the target clip whose name and type matches the reference track\n\t\t\tconst targetTrack = targetClip.tracks.find( function ( track ) {\n\n\t\t\t\treturn track.name === referenceTrack.name\n\t\t\t\t\t&& track.ValueTypeName === referenceTrackType;\n\n\t\t\t} );\n\n\t\t\tif ( targetTrack === undefined ) continue;\n\n\t\t\tlet referenceOffset = 0;\n\t\t\tconst referenceValueSize = referenceTrack.getValueSize();\n\n\t\t\tif ( referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\t\treferenceOffset = referenceValueSize / 3;\n\n\t\t\t}\n\n\t\t\tlet targetOffset = 0;\n\t\t\tconst targetValueSize = targetTrack.getValueSize();\n\n\t\t\tif ( targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) {\n\n\t\t\t\ttargetOffset = targetValueSize / 3;\n\n\t\t\t}\n\n\t\t\tconst lastIndex = referenceTrack.times.length - 1;\n\t\t\tlet referenceValue;\n\n\t\t\t// Find the value to subtract out of the track\n\t\t\tif ( referenceTime <= referenceTrack.times[ 0 ] ) {\n\n\t\t\t\t// Reference frame is earlier than the first keyframe, so just use the first keyframe\n\t\t\t\tconst startIndex = referenceOffset;\n\t\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\t\treferenceValue = AnimationUtils.arraySlice( referenceTrack.values, startIndex, endIndex );\n\n\t\t\t} else if ( referenceTime >= referenceTrack.times[ lastIndex ] ) {\n\n\t\t\t\t// Reference frame is after the last keyframe, so just use the last keyframe\n\t\t\t\tconst startIndex = lastIndex * referenceValueSize + referenceOffset;\n\t\t\t\tconst endIndex = startIndex + referenceValueSize - referenceOffset;\n\t\t\t\treferenceValue = AnimationUtils.arraySlice( referenceTrack.values, startIndex, endIndex );\n\n\t\t\t} else {\n\n\t\t\t\t// Interpolate to the reference value\n\t\t\t\tconst interpolant = referenceTrack.createInterpolant();\n\t\t\t\tconst startIndex = referenceOffset;\n\t\t\t\tconst endIndex = referenceValueSize - referenceOffset;\n\t\t\t\tinterpolant.evaluate( referenceTime );\n\t\t\t\treferenceValue = AnimationUtils.arraySlice( interpolant.resultBuffer, startIndex, endIndex );\n\n\t\t\t}\n\n\t\t\t// Conjugate the quaternion\n\t\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\t\tconst referenceQuat = new Quaternion().fromArray( referenceValue ).normalize().conjugate();\n\t\t\t\treferenceQuat.toArray( referenceValue );\n\n\t\t\t}\n\n\t\t\t// Subtract the reference value from all of the track values\n\n\t\t\tconst numTimes = targetTrack.times.length;\n\t\t\tfor ( let j = 0; j < numTimes; ++ j ) {\n\n\t\t\t\tconst valueStart = j * targetValueSize + targetOffset;\n\n\t\t\t\tif ( referenceTrackType === 'quaternion' ) {\n\n\t\t\t\t\t// Multiply the conjugate for quaternion track types\n\t\t\t\t\tQuaternion.multiplyQuaternionsFlat(\n\t\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\t\tvalueStart,\n\t\t\t\t\t\treferenceValue,\n\t\t\t\t\t\t0,\n\t\t\t\t\t\ttargetTrack.values,\n\t\t\t\t\t\tvalueStart\n\t\t\t\t\t);\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconst valueEnd = targetValueSize - targetOffset * 2;\n\n\t\t\t\t\t// Subtract each value for all other numeric track types\n\t\t\t\t\tfor ( let k = 0; k < valueEnd; ++ k ) {\n\n\t\t\t\t\t\ttargetTrack.values[ valueStart + k ] -= referenceValue[ k ];\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\ttargetClip.blendMode = AdditiveAnimationBlendMode;\n\n\t\treturn targetClip;\n\n\t}\n\n};\n\n/**\n * Abstract base class of interpolants over parametric samples.\n *\n * The parameter domain is one dimensional, typically the time or a path\n * along a curve defined by the data.\n *\n * The sample values can have any dimensionality and derived classes may\n * apply special interpretations to the data.\n *\n * This class provides the interval seek in a Template Method, deferring\n * the actual interpolation to derived classes.\n *\n * Time complexity is O(1) for linear access crossing at most two points\n * and O(log N) for random access, where N is the number of positions.\n *\n * References:\n *\n * \t\thttp://www.oodesign.com/template-method-pattern.html\n *\n */\n\nclass Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tthis.parameterPositions = parameterPositions;\n\t\tthis._cachedIndex = 0;\n\n\t\tthis.resultBuffer = resultBuffer !== undefined ?\n\t\t\tresultBuffer : new sampleValues.constructor( sampleSize );\n\t\tthis.sampleValues = sampleValues;\n\t\tthis.valueSize = sampleSize;\n\n\t\tthis.settings = null;\n\t\tthis.DefaultSettings_ = {};\n\n\t}\n\n\tevaluate( t ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet i1 = this._cachedIndex,\n\t\t\tt1 = pp[ i1 ],\n\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\tvalidate_interval: {\n\n\t\t\tseek: {\n\n\t\t\t\tlet right;\n\n\t\t\t\tlinear_scan: {\n\n\t\t\t\t\t//- See http://jsperf.com/comparison-to-undefined/3\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\n\t\t\t\t\t//- \t\t\t\tif ( t >= t1 || t1 === undefined ) {\n\t\t\t\t\tforward_scan: if ( ! ( t < t1 ) ) {\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 + 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\t\t\t\tif ( t < t0 ) break forward_scan;\n\n\t\t\t\t\t\t\t\t// after end\n\n\t\t\t\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\t\t\t\treturn this.afterEnd_( i1 - 1, t, t0 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt0 = t1;\n\t\t\t\t\t\t\tt1 = pp[ ++ i1 ];\n\n\t\t\t\t\t\t\tif ( t < t1 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the right side of the index\n\t\t\t\t\t\tright = pp.length;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t//- slower code:\n\t\t\t\t\t//-\t\t\t\t\tif ( t < t0 || t0 === undefined ) {\n\t\t\t\t\tif ( ! ( t >= t0 ) ) {\n\n\t\t\t\t\t\t// looping?\n\n\t\t\t\t\t\tconst t1global = pp[ 1 ];\n\n\t\t\t\t\t\tif ( t < t1global ) {\n\n\t\t\t\t\t\t\ti1 = 2; // + 1, using the scan for the details\n\t\t\t\t\t\t\tt0 = t1global;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// linear reverse scan\n\n\t\t\t\t\t\tfor ( let giveUpAt = i1 - 2; ; ) {\n\n\t\t\t\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\t\t\t\t// before start\n\n\t\t\t\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\t\t\t\treturn this.beforeStart_( 0, t, t1 );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif ( i1 === giveUpAt ) break; // this loop\n\n\t\t\t\t\t\t\tt1 = t0;\n\t\t\t\t\t\t\tt0 = pp[ -- i1 - 1 ];\n\n\t\t\t\t\t\t\tif ( t >= t0 ) {\n\n\t\t\t\t\t\t\t\t// we have arrived at the sought interval\n\t\t\t\t\t\t\t\tbreak seek;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// prepare binary search on the left side of the index\n\t\t\t\t\t\tright = i1;\n\t\t\t\t\t\ti1 = 0;\n\t\t\t\t\t\tbreak linear_scan;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// the interval is valid\n\n\t\t\t\t\tbreak validate_interval;\n\n\t\t\t\t} // linear scan\n\n\t\t\t\t// binary search\n\n\t\t\t\twhile ( i1 < right ) {\n\n\t\t\t\t\tconst mid = ( i1 + right ) >>> 1;\n\n\t\t\t\t\tif ( t < pp[ mid ] ) {\n\n\t\t\t\t\t\tright = mid;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ti1 = mid + 1;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tt1 = pp[ i1 ];\n\t\t\t\tt0 = pp[ i1 - 1 ];\n\n\t\t\t\t// check boundary cases, again\n\n\t\t\t\tif ( t0 === undefined ) {\n\n\t\t\t\t\tthis._cachedIndex = 0;\n\t\t\t\t\treturn this.beforeStart_( 0, t, t1 );\n\n\t\t\t\t}\n\n\t\t\t\tif ( t1 === undefined ) {\n\n\t\t\t\t\ti1 = pp.length;\n\t\t\t\t\tthis._cachedIndex = i1;\n\t\t\t\t\treturn this.afterEnd_( i1 - 1, t0, t );\n\n\t\t\t\t}\n\n\t\t\t} // seek\n\n\t\t\tthis._cachedIndex = i1;\n\n\t\t\tthis.intervalChanged_( i1, t0, t1 );\n\n\t\t} // validate_interval\n\n\t\treturn this.interpolate_( i1, t0, t, t1 );\n\n\t}\n\n\tgetSettings_() {\n\n\t\treturn this.settings || this.DefaultSettings_;\n\n\t}\n\n\tcopySampleValue_( index ) {\n\n\t\t// copies a sample value to the result buffer\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = index * stride;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] = values[ offset + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n\t// Template methods for derived classes:\n\n\tinterpolate_( /* i1, t0, t, t1 */ ) {\n\n\t\tthrow new Error( 'call to abstract method' );\n\t\t// implementations shall return this.resultBuffer\n\n\t}\n\n\tintervalChanged_( /* i1, t0, t1 */ ) {\n\n\t\t// empty\n\n\t}\n\n}\n\n// ALIAS DEFINITIONS\n\nInterpolant.prototype.beforeStart_ = Interpolant.prototype.copySampleValue_;\nInterpolant.prototype.afterEnd_ = Interpolant.prototype.copySampleValue_;\n\n/**\n * Fast and simple cubic spline interpolant.\n *\n * It was derived from a Hermitian construction setting the first derivative\n * at each sample position to the linear slope between neighboring positions\n * over their parameter interval.\n */\n\nclass CubicInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t\tthis._weightPrev = - 0;\n\t\tthis._offsetPrev = - 0;\n\t\tthis._weightNext = - 0;\n\t\tthis._offsetNext = - 0;\n\n\t\tthis.DefaultSettings_ = {\n\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\n\t\t};\n\n\t}\n\n\tintervalChanged_( i1, t0, t1 ) {\n\n\t\tconst pp = this.parameterPositions;\n\t\tlet iPrev = i1 - 2,\n\t\t\tiNext = i1 + 1,\n\n\t\t\ttPrev = pp[ iPrev ],\n\t\t\ttNext = pp[ iNext ];\n\n\t\tif ( tPrev === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingStart ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(t0) = 0\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = 2 * t0 - t1;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiPrev = pp.length - 2;\n\t\t\t\t\ttPrev = t0 + pp[ iPrev ] - pp[ iPrev + 1 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(t0) = 0 a.k.a. Natural Spline\n\t\t\t\t\tiPrev = i1;\n\t\t\t\t\ttPrev = t1;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tNext === undefined ) {\n\n\t\t\tswitch ( this.getSettings_().endingEnd ) {\n\n\t\t\t\tcase ZeroSlopeEnding:\n\n\t\t\t\t\t// f'(tN) = 0\n\t\t\t\t\tiNext = i1;\n\t\t\t\t\ttNext = 2 * t1 - t0;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase WrapAroundEnding:\n\n\t\t\t\t\t// use the other end of the curve\n\t\t\t\t\tiNext = 1;\n\t\t\t\t\ttNext = t1 + pp[ 1 ] - pp[ 0 ];\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault: // ZeroCurvatureEnding\n\n\t\t\t\t\t// f''(tN) = 0, a.k.a. Natural Spline\n\t\t\t\t\tiNext = i1 - 1;\n\t\t\t\t\ttNext = t0;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst halfDt = ( t1 - t0 ) * 0.5,\n\t\t\tstride = this.valueSize;\n\n\t\tthis._weightPrev = halfDt / ( t0 - tPrev );\n\t\tthis._weightNext = halfDt / ( tNext - t1 );\n\t\tthis._offsetPrev = iPrev * stride;\n\t\tthis._offsetNext = iNext * stride;\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\to1 = i1 * stride,\t\to0 = o1 - stride,\n\t\t\toP = this._offsetPrev, \toN = this._offsetNext,\n\t\t\twP = this._weightPrev,\twN = this._weightNext,\n\n\t\t\tp = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tpp = p * p,\n\t\t\tppp = pp * p;\n\n\t\t// evaluate polynomials\n\n\t\tconst sP = - wP * ppp + 2 * wP * pp - wP * p;\n\t\tconst s0 = ( 1 + wP ) * ppp + ( - 1.5 - 2 * wP ) * pp + ( - 0.5 + wP ) * p + 1;\n\t\tconst s1 = ( - 1 - wN ) * ppp + ( 1.5 + wN ) * pp + 0.5 * p;\n\t\tconst sN = wN * ppp - wN * pp;\n\n\t\t// combine data linearly\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tsP * values[ oP + i ] +\n\t\t\t\t\ts0 * values[ o0 + i ] +\n\t\t\t\t\ts1 * values[ o1 + i ] +\n\t\t\t\t\tsN * values[ oN + i ];\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\nclass LinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\toffset1 = i1 * stride,\n\t\t\toffset0 = offset1 - stride,\n\n\t\t\tweight1 = ( t - t0 ) / ( t1 - t0 ),\n\t\t\tweight0 = 1 - weight1;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tresult[ i ] =\n\t\t\t\t\tvalues[ offset0 + i ] * weight0 +\n\t\t\t\t\tvalues[ offset1 + i ] * weight1;\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n *\n * Interpolant that evaluates to the sample value at the position preceeding\n * the parameter.\n */\n\nclass DiscreteInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1 /*, t0, t, t1 */ ) {\n\n\t\treturn this.copySampleValue_( i1 - 1 );\n\n\t}\n\n}\n\nclass KeyframeTrack {\n\n\tconstructor( name, times, values, interpolation ) {\n\n\t\tif ( name === undefined ) throw new Error( 'THREE.KeyframeTrack: track name is undefined' );\n\t\tif ( times === undefined || times.length === 0 ) throw new Error( 'THREE.KeyframeTrack: no keyframes in track named ' + name );\n\n\t\tthis.name = name;\n\n\t\tthis.times = AnimationUtils.convertArray( times, this.TimeBufferType );\n\t\tthis.values = AnimationUtils.convertArray( values, this.ValueBufferType );\n\n\t\tthis.setInterpolation( interpolation || this.DefaultInterpolation );\n\n\t}\n\n\t// Serialization (in static context, because of constructor invocation\n\t// and automatic invocation of .toJSON):\n\n\tstatic toJSON( track ) {\n\n\t\tconst trackType = track.constructor;\n\n\t\tlet json;\n\n\t\t// derived classes can define a static toJSON method\n\t\tif ( trackType.toJSON !== this.toJSON ) {\n\n\t\t\tjson = trackType.toJSON( track );\n\n\t\t} else {\n\n\t\t\t// by default, we assume the data can be serialized as-is\n\t\t\tjson = {\n\n\t\t\t\t'name': track.name,\n\t\t\t\t'times': AnimationUtils.convertArray( track.times, Array ),\n\t\t\t\t'values': AnimationUtils.convertArray( track.values, Array )\n\n\t\t\t};\n\n\t\t\tconst interpolation = track.getInterpolation();\n\n\t\t\tif ( interpolation !== track.DefaultInterpolation ) {\n\n\t\t\t\tjson.interpolation = interpolation;\n\n\t\t\t}\n\n\t\t}\n\n\t\tjson.type = track.ValueTypeName; // mandatory\n\n\t\treturn json;\n\n\t}\n\n\tInterpolantFactoryMethodDiscrete( result ) {\n\n\t\treturn new DiscreteInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new LinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tInterpolantFactoryMethodSmooth( result ) {\n\n\t\treturn new CubicInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n\tsetInterpolation( interpolation ) {\n\n\t\tlet factoryMethod;\n\n\t\tswitch ( interpolation ) {\n\n\t\t\tcase InterpolateDiscrete:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodDiscrete;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateLinear:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodLinear;\n\n\t\t\t\tbreak;\n\n\t\t\tcase InterpolateSmooth:\n\n\t\t\t\tfactoryMethod = this.InterpolantFactoryMethodSmooth;\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tif ( factoryMethod === undefined ) {\n\n\t\t\tconst message = 'unsupported interpolation for ' +\n\t\t\t\tthis.ValueTypeName + ' keyframe track named ' + this.name;\n\n\t\t\tif ( this.createInterpolant === undefined ) {\n\n\t\t\t\t// fall back to default, unless the default itself is messed up\n\t\t\t\tif ( interpolation !== this.DefaultInterpolation ) {\n\n\t\t\t\t\tthis.setInterpolation( this.DefaultInterpolation );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new Error( message ); // fatal, in this case\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tconsole.warn( 'THREE.KeyframeTrack:', message );\n\t\t\treturn this;\n\n\t\t}\n\n\t\tthis.createInterpolant = factoryMethod;\n\n\t\treturn this;\n\n\t}\n\n\tgetInterpolation() {\n\n\t\tswitch ( this.createInterpolant ) {\n\n\t\t\tcase this.InterpolantFactoryMethodDiscrete:\n\n\t\t\t\treturn InterpolateDiscrete;\n\n\t\t\tcase this.InterpolantFactoryMethodLinear:\n\n\t\t\t\treturn InterpolateLinear;\n\n\t\t\tcase this.InterpolantFactoryMethodSmooth:\n\n\t\t\t\treturn InterpolateSmooth;\n\n\t\t}\n\n\t}\n\n\tgetValueSize() {\n\n\t\treturn this.values.length / this.times.length;\n\n\t}\n\n\t// move all keyframes either forwards or backwards in time\n\tshift( timeOffset ) {\n\n\t\tif ( timeOffset !== 0.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] += timeOffset;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// scale all keyframe times by a factor (useful for frame <-> seconds conversions)\n\tscale( timeScale ) {\n\n\t\tif ( timeScale !== 1.0 ) {\n\n\t\t\tconst times = this.times;\n\n\t\t\tfor ( let i = 0, n = times.length; i !== n; ++ i ) {\n\n\t\t\t\ttimes[ i ] *= timeScale;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// removes keyframes before and after animation without changing any values within the range [startTime, endTime].\n\t// IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values\n\ttrim( startTime, endTime ) {\n\n\t\tconst times = this.times,\n\t\t\tnKeys = times.length;\n\n\t\tlet from = 0,\n\t\t\tto = nKeys - 1;\n\n\t\twhile ( from !== nKeys && times[ from ] < startTime ) {\n\n\t\t\t++ from;\n\n\t\t}\n\n\t\twhile ( to !== - 1 && times[ to ] > endTime ) {\n\n\t\t\t-- to;\n\n\t\t}\n\n\t\t++ to; // inclusive -> exclusive bound\n\n\t\tif ( from !== 0 || to !== nKeys ) {\n\n\t\t\t// empty tracks are forbidden, so keep at least one keyframe\n\t\t\tif ( from >= to ) {\n\n\t\t\t\tto = Math.max( to, 1 );\n\t\t\t\tfrom = to - 1;\n\n\t\t\t}\n\n\t\t\tconst stride = this.getValueSize();\n\t\t\tthis.times = AnimationUtils.arraySlice( times, from, to );\n\t\t\tthis.values = AnimationUtils.arraySlice( this.values, from * stride, to * stride );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tconst valueSize = this.getValueSize();\n\t\tif ( valueSize - Math.floor( valueSize ) !== 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Invalid value size in track.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tconst times = this.times,\n\t\t\tvalues = this.values,\n\n\t\t\tnKeys = times.length;\n\n\t\tif ( nKeys === 0 ) {\n\n\t\t\tconsole.error( 'THREE.KeyframeTrack: Track is empty.', this );\n\t\t\tvalid = false;\n\n\t\t}\n\n\t\tlet prevTime = null;\n\n\t\tfor ( let i = 0; i !== nKeys; i ++ ) {\n\n\t\t\tconst currTime = times[ i ];\n\n\t\t\tif ( typeof currTime === 'number' && isNaN( currTime ) ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( prevTime !== null && prevTime > currTime ) {\n\n\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime );\n\t\t\t\tvalid = false;\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tprevTime = currTime;\n\n\t\t}\n\n\t\tif ( values !== undefined ) {\n\n\t\t\tif ( AnimationUtils.isTypedArray( values ) ) {\n\n\t\t\t\tfor ( let i = 0, n = values.length; i !== n; ++ i ) {\n\n\t\t\t\t\tconst value = values[ i ];\n\n\t\t\t\t\tif ( isNaN( value ) ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.KeyframeTrack: Value is not a valid number.', this, i, value );\n\t\t\t\t\t\tvalid = false;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\t// removes equivalent sequential keys as common in morph target sequences\n\t// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)\n\toptimize() {\n\n\t\t// times or values may be shared with other tracks, so overwriting is unsafe\n\t\tconst times = AnimationUtils.arraySlice( this.times ),\n\t\t\tvalues = AnimationUtils.arraySlice( this.values ),\n\t\t\tstride = this.getValueSize(),\n\n\t\t\tsmoothInterpolation = this.getInterpolation() === InterpolateSmooth,\n\n\t\t\tlastIndex = times.length - 1;\n\n\t\tlet writeIndex = 1;\n\n\t\tfor ( let i = 1; i < lastIndex; ++ i ) {\n\n\t\t\tlet keep = false;\n\n\t\t\tconst time = times[ i ];\n\t\t\tconst timeNext = times[ i + 1 ];\n\n\t\t\t// remove adjacent keyframes scheduled at the same time\n\n\t\t\tif ( time !== timeNext && ( i !== 1 || time !== times[ 0 ] ) ) {\n\n\t\t\t\tif ( ! smoothInterpolation ) {\n\n\t\t\t\t\t// remove unnecessary keyframes same as their neighbors\n\n\t\t\t\t\tconst offset = i * stride,\n\t\t\t\t\t\toffsetP = offset - stride,\n\t\t\t\t\t\toffsetN = offset + stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tconst value = values[ offset + j ];\n\n\t\t\t\t\t\tif ( value !== values[ offsetP + j ] ||\n\t\t\t\t\t\t\tvalue !== values[ offsetN + j ] ) {\n\n\t\t\t\t\t\t\tkeep = true;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tkeep = true;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// in-place compaction\n\n\t\t\tif ( keep ) {\n\n\t\t\t\tif ( i !== writeIndex ) {\n\n\t\t\t\t\ttimes[ writeIndex ] = times[ i ];\n\n\t\t\t\t\tconst readOffset = i * stride,\n\t\t\t\t\t\twriteOffset = writeIndex * stride;\n\n\t\t\t\t\tfor ( let j = 0; j !== stride; ++ j ) {\n\n\t\t\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t++ writeIndex;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// flush last keyframe (compaction looks ahead)\n\n\t\tif ( lastIndex > 0 ) {\n\n\t\t\ttimes[ writeIndex ] = times[ lastIndex ];\n\n\t\t\tfor ( let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++ j ) {\n\n\t\t\t\tvalues[ writeOffset + j ] = values[ readOffset + j ];\n\n\t\t\t}\n\n\t\t\t++ writeIndex;\n\n\t\t}\n\n\t\tif ( writeIndex !== times.length ) {\n\n\t\t\tthis.times = AnimationUtils.arraySlice( times, 0, writeIndex );\n\t\t\tthis.values = AnimationUtils.arraySlice( values, 0, writeIndex * stride );\n\n\t\t} else {\n\n\t\t\tthis.times = times;\n\t\t\tthis.values = values;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst times = AnimationUtils.arraySlice( this.times, 0 );\n\t\tconst values = AnimationUtils.arraySlice( this.values, 0 );\n\n\t\tconst TypedKeyframeTrack = this.constructor;\n\t\tconst track = new TypedKeyframeTrack( this.name, times, values );\n\n\t\t// Interpolant argument to constructor is not saved, so copy the factory method directly.\n\t\ttrack.createInterpolant = this.createInterpolant;\n\n\t\treturn track;\n\n\t}\n\n}\n\nKeyframeTrack.prototype.TimeBufferType = Float32Array;\nKeyframeTrack.prototype.ValueBufferType = Float32Array;\nKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\n\n/**\n * A Track of Boolean keyframe values.\n */\nclass BooleanKeyframeTrack extends KeyframeTrack {}\n\nBooleanKeyframeTrack.prototype.ValueTypeName = 'bool';\nBooleanKeyframeTrack.prototype.ValueBufferType = Array;\nBooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of keyframe values that represent color.\n */\nclass ColorKeyframeTrack extends KeyframeTrack {}\n\nColorKeyframeTrack.prototype.ValueTypeName = 'color';\n\n/**\n * A Track of numeric keyframe values.\n */\nclass NumberKeyframeTrack extends KeyframeTrack {}\n\nNumberKeyframeTrack.prototype.ValueTypeName = 'number';\n\n/**\n * Spherical linear unit quaternion interpolant.\n */\n\nclass QuaternionLinearInterpolant extends Interpolant {\n\n\tconstructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {\n\n\t\tsuper( parameterPositions, sampleValues, sampleSize, resultBuffer );\n\n\t}\n\n\tinterpolate_( i1, t0, t, t1 ) {\n\n\t\tconst result = this.resultBuffer,\n\t\t\tvalues = this.sampleValues,\n\t\t\tstride = this.valueSize,\n\n\t\t\talpha = ( t - t0 ) / ( t1 - t0 );\n\n\t\tlet offset = i1 * stride;\n\n\t\tfor ( let end = offset + stride; offset !== end; offset += 4 ) {\n\n\t\t\tQuaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha );\n\n\t\t}\n\n\t\treturn result;\n\n\t}\n\n}\n\n/**\n * A Track of quaternion keyframe values.\n */\nclass QuaternionKeyframeTrack extends KeyframeTrack {\n\n\tInterpolantFactoryMethodLinear( result ) {\n\n\t\treturn new QuaternionLinearInterpolant( this.times, this.values, this.getValueSize(), result );\n\n\t}\n\n}\n\nQuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';\n// ValueBufferType is inherited\nQuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\nQuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track that interpolates Strings\n */\nclass StringKeyframeTrack extends KeyframeTrack {}\n\nStringKeyframeTrack.prototype.ValueTypeName = 'string';\nStringKeyframeTrack.prototype.ValueBufferType = Array;\nStringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of vectored keyframe values.\n */\nclass VectorKeyframeTrack extends KeyframeTrack {}\n\nVectorKeyframeTrack.prototype.ValueTypeName = 'vector';\n\nclass AnimationClip {\n\n\tconstructor( name, duration = - 1, tracks, blendMode = NormalAnimationBlendMode ) {\n\n\t\tthis.name = name;\n\t\tthis.tracks = tracks;\n\t\tthis.duration = duration;\n\t\tthis.blendMode = blendMode;\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// this means it should figure out its duration by scanning the tracks\n\t\tif ( this.duration < 0 ) {\n\n\t\t\tthis.resetDuration();\n\n\t\t}\n\n\t}\n\n\n\tstatic parse( json ) {\n\n\t\tconst tracks = [],\n\t\t\tjsonTracks = json.tracks,\n\t\t\tframeTime = 1.0 / ( json.fps || 1.0 );\n\n\t\tfor ( let i = 0, n = jsonTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( parseKeyframeTrack( jsonTracks[ i ] ).scale( frameTime ) );\n\n\t\t}\n\n\t\tconst clip = new this( json.name, json.duration, tracks, json.blendMode );\n\t\tclip.uuid = json.uuid;\n\n\t\treturn clip;\n\n\t}\n\n\tstatic toJSON( clip ) {\n\n\t\tconst tracks = [],\n\t\t\tclipTracks = clip.tracks;\n\n\t\tconst json = {\n\n\t\t\t'name': clip.name,\n\t\t\t'duration': clip.duration,\n\t\t\t'tracks': tracks,\n\t\t\t'uuid': clip.uuid,\n\t\t\t'blendMode': clip.blendMode\n\n\t\t};\n\n\t\tfor ( let i = 0, n = clipTracks.length; i !== n; ++ i ) {\n\n\t\t\ttracks.push( KeyframeTrack.toJSON( clipTracks[ i ] ) );\n\n\t\t}\n\n\t\treturn json;\n\n\t}\n\n\tstatic CreateFromMorphTargetSequence( name, morphTargetSequence, fps, noLoop ) {\n\n\t\tconst numMorphTargets = morphTargetSequence.length;\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < numMorphTargets; i ++ ) {\n\n\t\t\tlet times = [];\n\t\t\tlet values = [];\n\n\t\t\ttimes.push(\n\t\t\t\t( i + numMorphTargets - 1 ) % numMorphTargets,\n\t\t\t\ti,\n\t\t\t\t( i + 1 ) % numMorphTargets );\n\n\t\t\tvalues.push( 0, 1, 0 );\n\n\t\t\tconst order = AnimationUtils.getKeyframeOrder( times );\n\t\t\ttimes = AnimationUtils.sortedArray( times, 1, order );\n\t\t\tvalues = AnimationUtils.sortedArray( values, 1, order );\n\n\t\t\t// if there is a key at the first frame, duplicate it as the\n\t\t\t// last frame as well for perfect loop.\n\t\t\tif ( ! noLoop && times[ 0 ] === 0 ) {\n\n\t\t\t\ttimes.push( numMorphTargets );\n\t\t\t\tvalues.push( values[ 0 ] );\n\n\t\t\t}\n\n\t\t\ttracks.push(\n\t\t\t\tnew NumberKeyframeTrack(\n\t\t\t\t\t'.morphTargetInfluences[' + morphTargetSequence[ i ].name + ']',\n\t\t\t\t\ttimes, values\n\t\t\t\t).scale( 1.0 / fps ) );\n\n\t\t}\n\n\t\treturn new this( name, - 1, tracks );\n\n\t}\n\n\tstatic findByName( objectOrClipArray, name ) {\n\n\t\tlet clipArray = objectOrClipArray;\n\n\t\tif ( ! Array.isArray( objectOrClipArray ) ) {\n\n\t\t\tconst o = objectOrClipArray;\n\t\t\tclipArray = o.geometry && o.geometry.animations || o.animations;\n\n\t\t}\n\n\t\tfor ( let i = 0; i < clipArray.length; i ++ ) {\n\n\t\t\tif ( clipArray[ i ].name === name ) {\n\n\t\t\t\treturn clipArray[ i ];\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\tstatic CreateClipsFromMorphTargetSequences( morphTargets, fps, noLoop ) {\n\n\t\tconst animationToMorphTargets = {};\n\n\t\t// tested with https://regex101.com/ on trick sequences\n\t\t// such flamingo_flyA_003, flamingo_run1_003, crdeath0059\n\t\tconst pattern = /^([\\w-]*?)([\\d]+)$/;\n\n\t\t// sort morph target names into animation groups based\n\t\t// patterns like Walk_001, Walk_002, Run_001, Run_002\n\t\tfor ( let i = 0, il = morphTargets.length; i < il; i ++ ) {\n\n\t\t\tconst morphTarget = morphTargets[ i ];\n\t\t\tconst parts = morphTarget.name.match( pattern );\n\n\t\t\tif ( parts && parts.length > 1 ) {\n\n\t\t\t\tconst name = parts[ 1 ];\n\n\t\t\t\tlet animationMorphTargets = animationToMorphTargets[ name ];\n\n\t\t\t\tif ( ! animationMorphTargets ) {\n\n\t\t\t\t\tanimationToMorphTargets[ name ] = animationMorphTargets = [];\n\n\t\t\t\t}\n\n\t\t\t\tanimationMorphTargets.push( morphTarget );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst clips = [];\n\n\t\tfor ( const name in animationToMorphTargets ) {\n\n\t\t\tclips.push( this.CreateFromMorphTargetSequence( name, animationToMorphTargets[ name ], fps, noLoop ) );\n\n\t\t}\n\n\t\treturn clips;\n\n\t}\n\n\t// parse the animation.hierarchy format\n\tstatic parseAnimation( animation, bones ) {\n\n\t\tif ( ! animation ) {\n\n\t\t\tconsole.error( 'THREE.AnimationClip: No animation in JSONLoader data.' );\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {\n\n\t\t\t// only return track if there are actually keys.\n\t\t\tif ( animationKeys.length !== 0 ) {\n\n\t\t\t\tconst times = [];\n\t\t\t\tconst values = [];\n\n\t\t\t\tAnimationUtils.flattenJSON( animationKeys, times, values, propertyName );\n\n\t\t\t\t// empty keys are filtered out, so check again\n\t\t\t\tif ( times.length !== 0 ) {\n\n\t\t\t\t\tdestTracks.push( new trackType( trackName, times, values ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tconst tracks = [];\n\n\t\tconst clipName = animation.name || 'default';\n\t\tconst fps = animation.fps || 30;\n\t\tconst blendMode = animation.blendMode;\n\n\t\t// automatic length determination in AnimationClip.\n\t\tlet duration = animation.length || - 1;\n\n\t\tconst hierarchyTracks = animation.hierarchy || [];\n\n\t\tfor ( let h = 0; h < hierarchyTracks.length; h ++ ) {\n\n\t\t\tconst animationKeys = hierarchyTracks[ h ].keys;\n\n\t\t\t// skip empty tracks\n\t\t\tif ( ! animationKeys || animationKeys.length === 0 ) continue;\n\n\t\t\t// process morph targets\n\t\t\tif ( animationKeys[ 0 ].morphTargets ) {\n\n\t\t\t\t// figure out all morph targets used in this track\n\t\t\t\tconst morphTargetNames = {};\n\n\t\t\t\tlet k;\n\n\t\t\t\tfor ( k = 0; k < animationKeys.length; k ++ ) {\n\n\t\t\t\t\tif ( animationKeys[ k ].morphTargets ) {\n\n\t\t\t\t\t\tfor ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {\n\n\t\t\t\t\t\t\tmorphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = - 1;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t// create a track for each morph target with all zero\n\t\t\t\t// morphTargetInfluences except for the keys in which\n\t\t\t\t// the morphTarget is named.\n\t\t\t\tfor ( const morphTargetName in morphTargetNames ) {\n\n\t\t\t\t\tconst times = [];\n\t\t\t\t\tconst values = [];\n\n\t\t\t\t\tfor ( let m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) {\n\n\t\t\t\t\t\tconst animationKey = animationKeys[ k ];\n\n\t\t\t\t\t\ttimes.push( animationKey.time );\n\t\t\t\t\t\tvalues.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) );\n\n\t\t\t\t}\n\n\t\t\t\tduration = morphTargetNames.length * ( fps || 1.0 );\n\n\t\t\t} else {\n\n\t\t\t\t// ...assume skeletal animation\n\n\t\t\t\tconst boneName = '.bones[' + bones[ h ].name + ']';\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.position',\n\t\t\t\t\tanimationKeys, 'pos', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tQuaternionKeyframeTrack, boneName + '.quaternion',\n\t\t\t\t\tanimationKeys, 'rot', tracks );\n\n\t\t\t\taddNonemptyTrack(\n\t\t\t\t\tVectorKeyframeTrack, boneName + '.scale',\n\t\t\t\t\tanimationKeys, 'scl', tracks );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( tracks.length === 0 ) {\n\n\t\t\treturn null;\n\n\t\t}\n\n\t\tconst clip = new this( clipName, duration, tracks, blendMode );\n\n\t\treturn clip;\n\n\t}\n\n\tresetDuration() {\n\n\t\tconst tracks = this.tracks;\n\t\tlet duration = 0;\n\n\t\tfor ( let i = 0, n = tracks.length; i !== n; ++ i ) {\n\n\t\t\tconst track = this.tracks[ i ];\n\n\t\t\tduration = Math.max( duration, track.times[ track.times.length - 1 ] );\n\n\t\t}\n\n\t\tthis.duration = duration;\n\n\t\treturn this;\n\n\t}\n\n\ttrim() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].trim( 0, this.duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tvalidate() {\n\n\t\tlet valid = true;\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tvalid = valid && this.tracks[ i ].validate();\n\n\t\t}\n\n\t\treturn valid;\n\n\t}\n\n\toptimize() {\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\tthis.tracks[ i ].optimize();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\tconst tracks = [];\n\n\t\tfor ( let i = 0; i < this.tracks.length; i ++ ) {\n\n\t\t\ttracks.push( this.tracks[ i ].clone() );\n\n\t\t}\n\n\t\treturn new this.constructor( this.name, this.duration, tracks, this.blendMode );\n\n\t}\n\n\ttoJSON() {\n\n\t\treturn this.constructor.toJSON( this );\n\n\t}\n\n}\n\nfunction getTrackTypeForValueTypeName( typeName ) {\n\n\tswitch ( typeName.toLowerCase() ) {\n\n\t\tcase 'scalar':\n\t\tcase 'double':\n\t\tcase 'float':\n\t\tcase 'number':\n\t\tcase 'integer':\n\n\t\t\treturn NumberKeyframeTrack;\n\n\t\tcase 'vector':\n\t\tcase 'vector2':\n\t\tcase 'vector3':\n\t\tcase 'vector4':\n\n\t\t\treturn VectorKeyframeTrack;\n\n\t\tcase 'color':\n\n\t\t\treturn ColorKeyframeTrack;\n\n\t\tcase 'quaternion':\n\n\t\t\treturn QuaternionKeyframeTrack;\n\n\t\tcase 'bool':\n\t\tcase 'boolean':\n\n\t\t\treturn BooleanKeyframeTrack;\n\n\t\tcase 'string':\n\n\t\t\treturn StringKeyframeTrack;\n\n\t}\n\n\tthrow new Error( 'THREE.KeyframeTrack: Unsupported typeName: ' + typeName );\n\n}\n\nfunction parseKeyframeTrack( json ) {\n\n\tif ( json.type === undefined ) {\n\n\t\tthrow new Error( 'THREE.KeyframeTrack: track type undefined, can not parse' );\n\n\t}\n\n\tconst trackType = getTrackTypeForValueTypeName( json.type );\n\n\tif ( json.times === undefined ) {\n\n\t\tconst times = [], values = [];\n\n\t\tAnimationUtils.flattenJSON( json.keys, times, values, 'value' );\n\n\t\tjson.times = times;\n\t\tjson.values = values;\n\n\t}\n\n\t// derived classes can define a static parse method\n\tif ( trackType.parse !== undefined ) {\n\n\t\treturn trackType.parse( json );\n\n\t} else {\n\n\t\t// by default, we assume a constructor compatible with the base\n\t\treturn new trackType( json.name, json.times, json.values, json.interpolation );\n\n\t}\n\n}\n\nconst Cache = {\n\n\tenabled: false,\n\n\tfiles: {},\n\n\tadd: function ( key, file ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Adding key:', key );\n\n\t\tthis.files[ key ] = file;\n\n\t},\n\n\tget: function ( key ) {\n\n\t\tif ( this.enabled === false ) return;\n\n\t\t// console.log( 'THREE.Cache', 'Checking key:', key );\n\n\t\treturn this.files[ key ];\n\n\t},\n\n\tremove: function ( key ) {\n\n\t\tdelete this.files[ key ];\n\n\t},\n\n\tclear: function () {\n\n\t\tthis.files = {};\n\n\t}\n\n};\n\nclass LoadingManager {\n\n\tconstructor( onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tlet isLoading = false;\n\t\tlet itemsLoaded = 0;\n\t\tlet itemsTotal = 0;\n\t\tlet urlModifier = undefined;\n\t\tconst handlers = [];\n\n\t\t// Refer to #5689 for the reason why we don't set .onStart\n\t\t// in the constructor\n\n\t\tthis.onStart = undefined;\n\t\tthis.onLoad = onLoad;\n\t\tthis.onProgress = onProgress;\n\t\tthis.onError = onError;\n\n\t\tthis.itemStart = function ( url ) {\n\n\t\t\titemsTotal ++;\n\n\t\t\tif ( isLoading === false ) {\n\n\t\t\t\tif ( scope.onStart !== undefined ) {\n\n\t\t\t\t\tscope.onStart( url, itemsLoaded, itemsTotal );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tisLoading = true;\n\n\t\t};\n\n\t\tthis.itemEnd = function ( url ) {\n\n\t\t\titemsLoaded ++;\n\n\t\t\tif ( scope.onProgress !== undefined ) {\n\n\t\t\t\tscope.onProgress( url, itemsLoaded, itemsTotal );\n\n\t\t\t}\n\n\t\t\tif ( itemsLoaded === itemsTotal ) {\n\n\t\t\t\tisLoading = false;\n\n\t\t\t\tif ( scope.onLoad !== undefined ) {\n\n\t\t\t\t\tscope.onLoad();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.itemError = function ( url ) {\n\n\t\t\tif ( scope.onError !== undefined ) {\n\n\t\t\t\tscope.onError( url );\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.resolveURL = function ( url ) {\n\n\t\t\tif ( urlModifier ) {\n\n\t\t\t\treturn urlModifier( url );\n\n\t\t\t}\n\n\t\t\treturn url;\n\n\t\t};\n\n\t\tthis.setURLModifier = function ( transform ) {\n\n\t\t\turlModifier = transform;\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.addHandler = function ( regex, loader ) {\n\n\t\t\thandlers.push( regex, loader );\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.removeHandler = function ( regex ) {\n\n\t\t\tconst index = handlers.indexOf( regex );\n\n\t\t\tif ( index !== - 1 ) {\n\n\t\t\t\thandlers.splice( index, 2 );\n\n\t\t\t}\n\n\t\t\treturn this;\n\n\t\t};\n\n\t\tthis.getHandler = function ( file ) {\n\n\t\t\tfor ( let i = 0, l = handlers.length; i < l; i += 2 ) {\n\n\t\t\t\tconst regex = handlers[ i ];\n\t\t\t\tconst loader = handlers[ i + 1 ];\n\n\t\t\t\tif ( regex.global ) regex.lastIndex = 0; // see #17920\n\n\t\t\t\tif ( regex.test( file ) ) {\n\n\t\t\t\t\treturn loader;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn null;\n\n\t\t};\n\n\t}\n\n}\n\nconst DefaultLoadingManager = new LoadingManager();\n\nclass Loader {\n\n\tconstructor( manager ) {\n\n\t\tthis.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;\n\n\t\tthis.crossOrigin = 'anonymous';\n\t\tthis.withCredentials = false;\n\t\tthis.path = '';\n\t\tthis.resourcePath = '';\n\t\tthis.requestHeader = {};\n\n\t}\n\n\tload( /* url, onLoad, onProgress, onError */ ) {}\n\n\tloadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\treturn new Promise( function ( resolve, reject ) {\n\n\t\t\tscope.load( url, resolve, onProgress, reject );\n\n\t\t} );\n\n\t}\n\n\tparse( /* data */ ) {}\n\n\tsetCrossOrigin( crossOrigin ) {\n\n\t\tthis.crossOrigin = crossOrigin;\n\t\treturn this;\n\n\t}\n\n\tsetWithCredentials( value ) {\n\n\t\tthis.withCredentials = value;\n\t\treturn this;\n\n\t}\n\n\tsetPath( path ) {\n\n\t\tthis.path = path;\n\t\treturn this;\n\n\t}\n\n\tsetResourcePath( resourcePath ) {\n\n\t\tthis.resourcePath = resourcePath;\n\t\treturn this;\n\n\t}\n\n\tsetRequestHeader( requestHeader ) {\n\n\t\tthis.requestHeader = requestHeader;\n\t\treturn this;\n\n\t}\n\n}\n\nconst loading = {};\n\nclass FileLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tthis.manager.itemStart( url );\n\n\t\t\tsetTimeout( () => {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\t// Check if request is duplicate\n\n\t\tif ( loading[ url ] !== undefined ) {\n\n\t\t\tloading[ url ].push( {\n\n\t\t\t\tonLoad: onLoad,\n\t\t\t\tonProgress: onProgress,\n\t\t\t\tonError: onError\n\n\t\t\t} );\n\n\t\t\treturn;\n\n\t\t}\n\n\t\t// Initialise array for duplicate requests\n\t\tloading[ url ] = [];\n\n\t\tloading[ url ].push( {\n\t\t\tonLoad: onLoad,\n\t\t\tonProgress: onProgress,\n\t\t\tonError: onError,\n\t\t} );\n\n\t\t// create request\n\t\tconst req = new Request( url, {\n\t\t\theaders: new Headers( this.requestHeader ),\n\t\t\tcredentials: this.withCredentials ? 'include' : 'same-origin',\n\t\t\t// An abort controller could be added within a future PR\n\t\t} );\n\n\t\t// start the fetch\n\t\tfetch( req )\n\t\t\t.then( response => {\n\n\t\t\t\tif ( response.status === 200 || response.status === 0 ) {\n\n\t\t\t\t\t// Some browsers return HTTP Status 0 when using non-http protocol\n\t\t\t\t\t// e.g. 'file://' or 'data://'. Handle as success.\n\n\t\t\t\t\tif ( response.status === 0 ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.FileLoader: HTTP Status 0 received.' );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\t\tconst reader = response.body.getReader();\n\t\t\t\t\tconst contentLength = response.headers.get( 'Content-Length' );\n\t\t\t\t\tconst total = contentLength ? parseInt( contentLength ) : 0;\n\t\t\t\t\tconst lengthComputable = total !== 0;\n\t\t\t\t\tlet loaded = 0;\n\n\t\t\t\t\t// periodically read data into the new stream tracking while download progress\n\t\t\t\t\treturn new ReadableStream( {\n\t\t\t\t\t\tstart( controller ) {\n\n\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\tfunction readData() {\n\n\t\t\t\t\t\t\t\treader.read().then( ( { done, value } ) => {\n\n\t\t\t\t\t\t\t\t\tif ( done ) {\n\n\t\t\t\t\t\t\t\t\t\tcontroller.close();\n\n\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\tloaded += value.byteLength;\n\n\t\t\t\t\t\t\t\t\t\tconst event = new ProgressEvent( 'progress', { lengthComputable, loaded, total } );\n\t\t\t\t\t\t\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\t\t\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\t\t\t\t\t\t\tif ( callback.onProgress ) callback.onProgress( event );\n\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tcontroller.enqueue( value );\n\t\t\t\t\t\t\t\t\t\treadData();\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow Error( `fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}` );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( stream => {\n\n\t\t\t\tconst response = new Response( stream );\n\n\t\t\t\tswitch ( this.responseType ) {\n\n\t\t\t\t\tcase 'arraybuffer':\n\n\t\t\t\t\t\treturn response.arrayBuffer();\n\n\t\t\t\t\tcase 'blob':\n\n\t\t\t\t\t\treturn response.blob();\n\n\t\t\t\t\tcase 'document':\n\n\t\t\t\t\t\treturn response.text()\n\t\t\t\t\t\t\t.then( text => {\n\n\t\t\t\t\t\t\t\tconst parser = new DOMParser();\n\t\t\t\t\t\t\t\treturn parser.parseFromString( text, this.mimeType );\n\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\tcase 'json':\n\n\t\t\t\t\t\treturn response.json();\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\treturn response.text();\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( data => {\n\n\t\t\t\t// Add to cache only on HTTP success, so that we do not cache\n\t\t\t\t// error response bodies as proper responses to requests.\n\t\t\t\tCache.add( url, data );\n\n\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onLoad ) callback.onLoad( data );\n\n\t\t\t\t}\n\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t} )\n\t\t\t.catch( err => {\n\n\t\t\t\t// Abort errors and other errors are handled the same\n\n\t\t\t\tconst callbacks = loading[ url ];\n\t\t\t\tdelete loading[ url ];\n\n\t\t\t\tfor ( let i = 0, il = callbacks.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst callback = callbacks[ i ];\n\t\t\t\t\tif ( callback.onError ) callback.onError( err );\n\n\t\t\t\t}\n\n\t\t\t\tthis.manager.itemError( url );\n\t\t\t\tthis.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\tthis.manager.itemStart( url );\n\n\t}\n\n\tsetResponseType( value ) {\n\n\t\tthis.responseType = value;\n\t\treturn this;\n\n\t}\n\n\tsetMimeType( value ) {\n\n\t\tthis.mimeType = value;\n\t\treturn this;\n\n\t}\n\n}\n\nclass AnimationLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst animations = [];\n\n\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\tconst clip = AnimationClip.parse( json[ i ] );\n\n\t\t\tanimations.push( clip );\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to block based textures loader (dds, pvr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass CompressedTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst images = [];\n\n\t\tconst texture = new CompressedTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( url[ i ], function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\timages[ i ] = {\n\t\t\t\t\twidth: texDatas.width,\n\t\t\t\t\theight: texDatas.height,\n\t\t\t\t\tformat: texDatas.format,\n\t\t\t\t\tmipmaps: texDatas.mipmaps\n\t\t\t\t};\n\n\t\t\t\tloaded += 1;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\tif ( texDatas.mipmapCount === 1 ) texture.minFilter = LinearFilter;\n\n\t\t\t\t\ttexture.image = images;\n\t\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\tif ( Array.isArray( url ) ) {\n\n\t\t\tfor ( let i = 0, il = url.length; i < il; ++ i ) {\n\n\t\t\t\tloadTexture( i );\n\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// compressed cubemap texture stored in a single DDS file\n\n\t\t\tloader.load( url, function ( buffer ) {\n\n\t\t\t\tconst texDatas = scope.parse( buffer, true );\n\n\t\t\t\tif ( texDatas.isCubemap ) {\n\n\t\t\t\t\tconst faces = texDatas.mipmaps.length / texDatas.mipmapCount;\n\n\t\t\t\t\tfor ( let f = 0; f < faces; f ++ ) {\n\n\t\t\t\t\t\timages[ f ] = { mipmaps: [] };\n\n\t\t\t\t\t\tfor ( let i = 0; i < texDatas.mipmapCount; i ++ ) {\n\n\t\t\t\t\t\t\timages[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );\n\t\t\t\t\t\t\timages[ f ].format = texDatas.format;\n\t\t\t\t\t\t\timages[ f ].width = texDatas.width;\n\t\t\t\t\t\t\timages[ f ].height = texDatas.height;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttexture.image = images;\n\n\t\t\t\t} else {\n\n\t\t\t\t\ttexture.image.width = texDatas.width;\n\t\t\t\t\ttexture.image.height = texDatas.height;\n\t\t\t\t\ttexture.mipmaps = texDatas.mipmaps;\n\n\t\t\t\t}\n\n\t\t\t\tif ( texDatas.mipmapCount === 1 ) {\n\n\t\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t\t}\n\n\t\t\t\ttexture.format = texDatas.format;\n\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t}, onProgress, onError );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass ImageLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst image = createElementNS( 'img' );\n\n\t\tfunction onImageLoad() {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tCache.add( url, this );\n\n\t\t\tif ( onLoad ) onLoad( this );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction onImageError( event ) {\n\n\t\t\tremoveEventListeners();\n\n\t\t\tif ( onError ) onError( event );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t}\n\n\t\tfunction removeEventListeners() {\n\n\t\t\timage.removeEventListener( 'load', onImageLoad, false );\n\t\t\timage.removeEventListener( 'error', onImageError, false );\n\n\t\t}\n\n\t\timage.addEventListener( 'load', onImageLoad, false );\n\t\timage.addEventListener( 'error', onImageError, false );\n\n\t\tif ( url.substr( 0, 5 ) !== 'data:' ) {\n\n\t\t\tif ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;\n\n\t\t}\n\n\t\tscope.manager.itemStart( url );\n\n\t\timage.src = url;\n\n\t\treturn image;\n\n\t}\n\n}\n\nclass CubeTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( urls, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new CubeTexture();\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tlet loaded = 0;\n\n\t\tfunction loadTexture( i ) {\n\n\t\t\tloader.load( urls[ i ], function ( image ) {\n\n\t\t\t\ttexture.images[ i ] = image;\n\n\t\t\t\tloaded ++;\n\n\t\t\t\tif ( loaded === 6 ) {\n\n\t\t\t\t\ttexture.needsUpdate = true;\n\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\n\n\t\t\t\t}\n\n\t\t\t}, undefined, onError );\n\n\t\t}\n\n\t\tfor ( let i = 0; i < urls.length; ++ i ) {\n\n\t\t\tloadTexture( i );\n\n\t\t}\n\n\t\treturn texture;\n\n\t}\n\n}\n\n/**\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\n\nclass DataTextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst texture = new DataTexture();\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setPath( this.path );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\tconst texData = scope.parse( buffer );\n\n\t\t\tif ( ! texData ) return;\n\n\t\t\tif ( texData.image !== undefined ) {\n\n\t\t\t\ttexture.image = texData.image;\n\n\t\t\t} else if ( texData.data !== undefined ) {\n\n\t\t\t\ttexture.image.width = texData.width;\n\t\t\t\ttexture.image.height = texData.height;\n\t\t\t\ttexture.image.data = texData.data;\n\n\t\t\t}\n\n\t\t\ttexture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;\n\t\t\ttexture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;\n\n\t\t\ttexture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;\n\t\t\ttexture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;\n\n\t\t\ttexture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;\n\n\t\t\tif ( texData.encoding !== undefined ) {\n\n\t\t\t\ttexture.encoding = texData.encoding;\n\n\t\t\t}\n\n\t\t\tif ( texData.flipY !== undefined ) {\n\n\t\t\t\ttexture.flipY = texData.flipY;\n\n\t\t\t}\n\n\t\t\tif ( texData.format !== undefined ) {\n\n\t\t\t\ttexture.format = texData.format;\n\n\t\t\t}\n\n\t\t\tif ( texData.type !== undefined ) {\n\n\t\t\t\ttexture.type = texData.type;\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmaps !== undefined ) {\n\n\t\t\t\ttexture.mipmaps = texData.mipmaps;\n\t\t\t\ttexture.minFilter = LinearMipmapLinearFilter; // presumably...\n\n\t\t\t}\n\n\t\t\tif ( texData.mipmapCount === 1 ) {\n\n\t\t\t\ttexture.minFilter = LinearFilter;\n\n\t\t\t}\n\n\t\t\tif ( texData.generateMipmaps !== undefined ) {\n\n\t\t\t\ttexture.generateMipmaps = texData.generateMipmaps;\n\n\t\t\t}\n\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad ) onLoad( texture, texData );\n\n\t\t}, onProgress, onError );\n\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass TextureLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst texture = new Texture();\n\n\t\tconst loader = new ImageLoader( this.manager );\n\t\tloader.setCrossOrigin( this.crossOrigin );\n\t\tloader.setPath( this.path );\n\n\t\tloader.load( url, function ( image ) {\n\n\t\t\ttexture.image = image;\n\t\t\ttexture.needsUpdate = true;\n\n\t\t\tif ( onLoad !== undefined ) {\n\n\t\t\t\tonLoad( texture );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t\treturn texture;\n\n\t}\n\n}\n\nclass Light extends Object3D {\n\n\tconstructor( color, intensity = 1 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Light';\n\n\t\tthis.color = new Color( color );\n\t\tthis.intensity = intensity;\n\n\t}\n\n\tdispose() {\n\n\t\t// Empty here in base class; some subclasses override.\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.color.copy( source.color );\n\t\tthis.intensity = source.intensity;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.color = this.color.getHex();\n\t\tdata.object.intensity = this.intensity;\n\n\t\tif ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();\n\n\t\tif ( this.distance !== undefined ) data.object.distance = this.distance;\n\t\tif ( this.angle !== undefined ) data.object.angle = this.angle;\n\t\tif ( this.decay !== undefined ) data.object.decay = this.decay;\n\t\tif ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;\n\n\t\tif ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();\n\n\t\treturn data;\n\n\t}\n\n}\n\nLight.prototype.isLight = true;\n\nclass HemisphereLight extends Light {\n\n\tconstructor( skyColor, groundColor, intensity ) {\n\n\t\tsuper( skyColor, intensity );\n\n\t\tthis.type = 'HemisphereLight';\n\n\t\tthis.position.copy( Object3D.DefaultUp );\n\t\tthis.updateMatrix();\n\n\t\tthis.groundColor = new Color( groundColor );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tLight.prototype.copy.call( this, source );\n\n\t\tthis.groundColor.copy( source.groundColor );\n\n\t\treturn this;\n\n\t}\n\n}\n\nHemisphereLight.prototype.isHemisphereLight = true;\n\nconst _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld$1 = /*@__PURE__*/ new Vector3();\nconst _lookTarget$1 = /*@__PURE__*/ new Vector3();\n\nclass LightShadow {\n\n\tconstructor( camera ) {\n\n\t\tthis.camera = camera;\n\n\t\tthis.bias = 0;\n\t\tthis.normalBias = 0;\n\t\tthis.radius = 1;\n\t\tthis.blurSamples = 8;\n\n\t\tthis.mapSize = new Vector2( 512, 512 );\n\n\t\tthis.map = null;\n\t\tthis.mapPass = null;\n\t\tthis.matrix = new Matrix4();\n\n\t\tthis.autoUpdate = true;\n\t\tthis.needsUpdate = false;\n\n\t\tthis._frustum = new Frustum();\n\t\tthis._frameExtents = new Vector2( 1, 1 );\n\n\t\tthis._viewportCount = 1;\n\n\t\tthis._viewports = [\n\n\t\t\tnew Vector4( 0, 0, 1, 1 )\n\n\t\t];\n\n\t}\n\n\tgetViewportCount() {\n\n\t\treturn this._viewportCount;\n\n\t}\n\n\tgetFrustum() {\n\n\t\treturn this._frustum;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst shadowCamera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\t_lightPositionWorld$1.setFromMatrixPosition( light.matrixWorld );\n\t\tshadowCamera.position.copy( _lightPositionWorld$1 );\n\n\t\t_lookTarget$1.setFromMatrixPosition( light.target.matrixWorld );\n\t\tshadowCamera.lookAt( _lookTarget$1 );\n\t\tshadowCamera.updateMatrixWorld();\n\n\t\t_projScreenMatrix$1.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix$1 );\n\n\t\tshadowMatrix.set(\n\t\t\t0.5, 0.0, 0.0, 0.5,\n\t\t\t0.0, 0.5, 0.0, 0.5,\n\t\t\t0.0, 0.0, 0.5, 0.5,\n\t\t\t0.0, 0.0, 0.0, 1.0\n\t\t);\n\n\t\tshadowMatrix.multiply( shadowCamera.projectionMatrix );\n\t\tshadowMatrix.multiply( shadowCamera.matrixWorldInverse );\n\n\t}\n\n\tgetViewport( viewportIndex ) {\n\n\t\treturn this._viewports[ viewportIndex ];\n\n\t}\n\n\tgetFrameExtents() {\n\n\t\treturn this._frameExtents;\n\n\t}\n\n\tdispose() {\n\n\t\tif ( this.map ) {\n\n\t\t\tthis.map.dispose();\n\n\t\t}\n\n\t\tif ( this.mapPass ) {\n\n\t\t\tthis.mapPass.dispose();\n\n\t\t}\n\n\t}\n\n\tcopy( source ) {\n\n\t\tthis.camera = source.camera.clone();\n\n\t\tthis.bias = source.bias;\n\t\tthis.radius = source.radius;\n\n\t\tthis.mapSize.copy( source.mapSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst object = {};\n\n\t\tif ( this.bias !== 0 ) object.bias = this.bias;\n\t\tif ( this.normalBias !== 0 ) object.normalBias = this.normalBias;\n\t\tif ( this.radius !== 1 ) object.radius = this.radius;\n\t\tif ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();\n\n\t\tobject.camera = this.camera.toJSON( false ).object;\n\t\tdelete object.camera.matrix;\n\n\t\treturn object;\n\n\t}\n\n}\n\nclass SpotLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 50, 1, 0.5, 500 ) );\n\n\t\tthis.focus = 1;\n\n\t}\n\n\tupdateMatrices( light ) {\n\n\t\tconst camera = this.camera;\n\n\t\tconst fov = RAD2DEG * 2 * light.angle * this.focus;\n\t\tconst aspect = this.mapSize.width / this.mapSize.height;\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( fov !== camera.fov || aspect !== camera.aspect || far !== camera.far ) {\n\n\t\t\tcamera.fov = fov;\n\t\t\tcamera.aspect = aspect;\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\tsuper.updateMatrices( light );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.focus = source.focus;\n\n\t\treturn this;\n\n\t}\n\n}\n\nSpotLightShadow.prototype.isSpotLightShadow = true;\n\nclass SpotLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 1 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.type = 'SpotLight';\n\n\t\tthis.position.copy( Object3D.DefaultUp );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.distance = distance;\n\t\tthis.angle = angle;\n\t\tthis.penumbra = penumbra;\n\t\tthis.decay = decay; // for physically correct lights, should be 2.\n\n\t\tthis.shadow = new SpotLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd)\n\t\treturn this.intensity * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / Math.PI;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.distance = source.distance;\n\t\tthis.angle = source.angle;\n\t\tthis.penumbra = source.penumbra;\n\t\tthis.decay = source.decay;\n\n\t\tthis.target = source.target.clone();\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nSpotLight.prototype.isSpotLight = true;\n\nconst _projScreenMatrix = /*@__PURE__*/ new Matrix4();\nconst _lightPositionWorld = /*@__PURE__*/ new Vector3();\nconst _lookTarget = /*@__PURE__*/ new Vector3();\n\nclass PointLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new PerspectiveCamera( 90, 1, 0.5, 500 ) );\n\n\t\tthis._frameExtents = new Vector2( 4, 2 );\n\n\t\tthis._viewportCount = 6;\n\n\t\tthis._viewports = [\n\t\t\t// These viewports map a cube-map onto a 2D texture with the\n\t\t\t// following orientation:\n\t\t\t//\n\t\t\t// xzXZ\n\t\t\t// y Y\n\t\t\t//\n\t\t\t// X - Positive x direction\n\t\t\t// x - Negative x direction\n\t\t\t// Y - Positive y direction\n\t\t\t// y - Negative y direction\n\t\t\t// Z - Positive z direction\n\t\t\t// z - Negative z direction\n\n\t\t\t// positive X\n\t\t\tnew Vector4( 2, 1, 1, 1 ),\n\t\t\t// negative X\n\t\t\tnew Vector4( 0, 1, 1, 1 ),\n\t\t\t// positive Z\n\t\t\tnew Vector4( 3, 1, 1, 1 ),\n\t\t\t// negative Z\n\t\t\tnew Vector4( 1, 1, 1, 1 ),\n\t\t\t// positive Y\n\t\t\tnew Vector4( 3, 0, 1, 1 ),\n\t\t\t// negative Y\n\t\t\tnew Vector4( 1, 0, 1, 1 )\n\t\t];\n\n\t\tthis._cubeDirections = [\n\t\t\tnew Vector3( 1, 0, 0 ), new Vector3( - 1, 0, 0 ), new Vector3( 0, 0, 1 ),\n\t\t\tnew Vector3( 0, 0, - 1 ), new Vector3( 0, 1, 0 ), new Vector3( 0, - 1, 0 )\n\t\t];\n\n\t\tthis._cubeUps = [\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 1, 0 ),\n\t\t\tnew Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ),\tnew Vector3( 0, 0, - 1 )\n\t\t];\n\n\t}\n\n\tupdateMatrices( light, viewportIndex = 0 ) {\n\n\t\tconst camera = this.camera;\n\t\tconst shadowMatrix = this.matrix;\n\n\t\tconst far = light.distance || camera.far;\n\n\t\tif ( far !== camera.far ) {\n\n\t\t\tcamera.far = far;\n\t\t\tcamera.updateProjectionMatrix();\n\n\t\t}\n\n\t\t_lightPositionWorld.setFromMatrixPosition( light.matrixWorld );\n\t\tcamera.position.copy( _lightPositionWorld );\n\n\t\t_lookTarget.copy( camera.position );\n\t\t_lookTarget.add( this._cubeDirections[ viewportIndex ] );\n\t\tcamera.up.copy( this._cubeUps[ viewportIndex ] );\n\t\tcamera.lookAt( _lookTarget );\n\t\tcamera.updateMatrixWorld();\n\n\t\tshadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z );\n\n\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\n\t\tthis._frustum.setFromProjectionMatrix( _projScreenMatrix );\n\n\t}\n\n}\n\nPointLightShadow.prototype.isPointLightShadow = true;\n\nclass PointLight extends Light {\n\n\tconstructor( color, intensity, distance = 0, decay = 1 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.type = 'PointLight';\n\n\t\tthis.distance = distance;\n\t\tthis.decay = decay; // for physically correct lights, should be 2.\n\n\t\tthis.shadow = new PointLightShadow();\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in candela)\n\t\t// for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd)\n\t\treturn this.intensity * 4 * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in candela) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( 4 * Math.PI );\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.distance = source.distance;\n\t\tthis.decay = source.decay;\n\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nPointLight.prototype.isPointLight = true;\n\nclass DirectionalLightShadow extends LightShadow {\n\n\tconstructor() {\n\n\t\tsuper( new OrthographicCamera( - 5, 5, 5, - 5, 0.5, 500 ) );\n\n\t}\n\n}\n\nDirectionalLightShadow.prototype.isDirectionalLightShadow = true;\n\nclass DirectionalLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.type = 'DirectionalLight';\n\n\t\tthis.position.copy( Object3D.DefaultUp );\n\t\tthis.updateMatrix();\n\n\t\tthis.target = new Object3D();\n\n\t\tthis.shadow = new DirectionalLightShadow();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.shadow.dispose();\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.target = source.target.clone();\n\t\tthis.shadow = source.shadow.clone();\n\n\t\treturn this;\n\n\t}\n\n}\n\nDirectionalLight.prototype.isDirectionalLight = true;\n\nclass AmbientLight extends Light {\n\n\tconstructor( color, intensity ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.type = 'AmbientLight';\n\n\t}\n\n}\n\nAmbientLight.prototype.isAmbientLight = true;\n\nclass RectAreaLight extends Light {\n\n\tconstructor( color, intensity, width = 10, height = 10 ) {\n\n\t\tsuper( color, intensity );\n\n\t\tthis.type = 'RectAreaLight';\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t}\n\n\tget power() {\n\n\t\t// compute the light's luminous power (in lumens) from its intensity (in nits)\n\t\treturn this.intensity * this.width * this.height * Math.PI;\n\n\t}\n\n\tset power( power ) {\n\n\t\t// set the light's intensity (in nits) from the desired luminous power (in lumens)\n\t\tthis.intensity = power / ( this.width * this.height * Math.PI );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.width = source.width;\n\t\tthis.height = source.height;\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.width = this.width;\n\t\tdata.object.height = this.height;\n\n\t\treturn data;\n\n\t}\n\n}\n\nRectAreaLight.prototype.isRectAreaLight = true;\n\n/**\n * Primary reference:\n * https://graphics.stanford.edu/papers/envmap/envmap.pdf\n *\n * Secondary reference:\n * https://www.ppsloan.org/publications/StupidSH36.pdf\n */\n\n// 3-band SH defined by 9 coefficients\n\nclass SphericalHarmonics3 {\n\n\tconstructor() {\n\n\t\tthis.coefficients = [];\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients.push( new Vector3() );\n\n\t\t}\n\n\t}\n\n\tset( coefficients ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].copy( coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tzero() {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].set( 0, 0, 0 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// get the radiance in the direction of the normal\n\t// target is a Vector3\n\tgetAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.282095 );\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 0.488603 * y );\n\t\ttarget.addScaledVector( coeff[ 2 ], 0.488603 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 0.488603 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 1.092548 * ( x * y ) );\n\t\ttarget.addScaledVector( coeff[ 5 ], 1.092548 * ( y * z ) );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.315392 * ( 3.0 * z * z - 1.0 ) );\n\t\ttarget.addScaledVector( coeff[ 7 ], 1.092548 * ( x * z ) );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.546274 * ( x * x - y * y ) );\n\n\t\treturn target;\n\n\t}\n\n\t// get the irradiance (radiance convolved with cosine lobe) in the direction of the normal\n\t// target is a Vector3\n\t// https://graphics.stanford.edu/papers/envmap/envmap.pdf\n\tgetIrradianceAt( normal, target ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\tconst coeff = this.coefficients;\n\n\t\t// band 0\n\t\ttarget.copy( coeff[ 0 ] ).multiplyScalar( 0.886227 ); // π * 0.282095\n\n\t\t// band 1\n\t\ttarget.addScaledVector( coeff[ 1 ], 2.0 * 0.511664 * y ); // ( 2 * π / 3 ) * 0.488603\n\t\ttarget.addScaledVector( coeff[ 2 ], 2.0 * 0.511664 * z );\n\t\ttarget.addScaledVector( coeff[ 3 ], 2.0 * 0.511664 * x );\n\n\t\t// band 2\n\t\ttarget.addScaledVector( coeff[ 4 ], 2.0 * 0.429043 * x * y ); // ( π / 4 ) * 1.092548\n\t\ttarget.addScaledVector( coeff[ 5 ], 2.0 * 0.429043 * y * z );\n\t\ttarget.addScaledVector( coeff[ 6 ], 0.743125 * z * z - 0.247708 ); // ( π / 4 ) * 0.315392 * 3\n\t\ttarget.addScaledVector( coeff[ 7 ], 2.0 * 0.429043 * x * z );\n\t\ttarget.addScaledVector( coeff[ 8 ], 0.429043 * ( x * x - y * y ) ); // ( π / 4 ) * 0.546274\n\n\t\treturn target;\n\n\t}\n\n\tadd( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].add( sh.coefficients[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\taddScaledSH( sh, s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].addScaledVector( sh.coefficients[ i ], s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tscale( s ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].multiplyScalar( s );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tlerp( sh, alpha ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tthis.coefficients[ i ].lerp( sh.coefficients[ i ], alpha );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tequals( sh ) {\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tif ( ! this.coefficients[ i ].equals( sh.coefficients[ i ] ) ) {\n\n\t\t\t\treturn false;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn true;\n\n\t}\n\n\tcopy( sh ) {\n\n\t\treturn this.set( sh.coefficients );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tfromArray( array, offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].fromArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\ttoArray( array = [], offset = 0 ) {\n\n\t\tconst coefficients = this.coefficients;\n\n\t\tfor ( let i = 0; i < 9; i ++ ) {\n\n\t\t\tcoefficients[ i ].toArray( array, offset + ( i * 3 ) );\n\n\t\t}\n\n\t\treturn array;\n\n\t}\n\n\t// evaluate the basis functions\n\t// shBasis is an Array[ 9 ]\n\tstatic getBasisAt( normal, shBasis ) {\n\n\t\t// normal is assumed to be unit length\n\n\t\tconst x = normal.x, y = normal.y, z = normal.z;\n\n\t\t// band 0\n\t\tshBasis[ 0 ] = 0.282095;\n\n\t\t// band 1\n\t\tshBasis[ 1 ] = 0.488603 * y;\n\t\tshBasis[ 2 ] = 0.488603 * z;\n\t\tshBasis[ 3 ] = 0.488603 * x;\n\n\t\t// band 2\n\t\tshBasis[ 4 ] = 1.092548 * x * y;\n\t\tshBasis[ 5 ] = 1.092548 * y * z;\n\t\tshBasis[ 6 ] = 0.315392 * ( 3 * z * z - 1 );\n\t\tshBasis[ 7 ] = 1.092548 * x * z;\n\t\tshBasis[ 8 ] = 0.546274 * ( x * x - y * y );\n\n\t}\n\n}\n\nSphericalHarmonics3.prototype.isSphericalHarmonics3 = true;\n\nclass LightProbe extends Light {\n\n\tconstructor( sh = new SphericalHarmonics3(), intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\tthis.sh = sh;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.sh.copy( source.sh );\n\n\t\treturn this;\n\n\t}\n\n\tfromJSON( json ) {\n\n\t\tthis.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();\n\t\tthis.sh.fromArray( json.sh );\n\n\t\treturn this;\n\n\t}\n\n\ttoJSON( meta ) {\n\n\t\tconst data = super.toJSON( meta );\n\n\t\tdata.object.sh = this.sh.toArray();\n\n\t\treturn data;\n\n\t}\n\n}\n\nLightProbe.prototype.isLightProbe = true;\n\nclass MaterialLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\t\tthis.textures = {};\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst textures = this.textures;\n\n\t\tfunction getTexture( name ) {\n\n\t\t\tif ( textures[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.MaterialLoader: Undefined texture', name );\n\n\t\t\t}\n\n\t\t\treturn textures[ name ];\n\n\t\t}\n\n\t\tconst material = new Materials[ json.type ]();\n\n\t\tif ( json.uuid !== undefined ) material.uuid = json.uuid;\n\t\tif ( json.name !== undefined ) material.name = json.name;\n\t\tif ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );\n\t\tif ( json.roughness !== undefined ) material.roughness = json.roughness;\n\t\tif ( json.metalness !== undefined ) material.metalness = json.metalness;\n\t\tif ( json.sheen !== undefined ) material.sheen = json.sheen;\n\t\tif ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );\n\t\tif ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;\n\t\tif ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );\n\t\tif ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );\n\t\tif ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;\n\t\tif ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );\n\t\tif ( json.shininess !== undefined ) material.shininess = json.shininess;\n\t\tif ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;\n\t\tif ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;\n\t\tif ( json.transmission !== undefined ) material.transmission = json.transmission;\n\t\tif ( json.thickness !== undefined ) material.thickness = json.thickness;\n\t\tif ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;\n\t\tif ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );\n\t\tif ( json.fog !== undefined ) material.fog = json.fog;\n\t\tif ( json.flatShading !== undefined ) material.flatShading = json.flatShading;\n\t\tif ( json.blending !== undefined ) material.blending = json.blending;\n\t\tif ( json.combine !== undefined ) material.combine = json.combine;\n\t\tif ( json.side !== undefined ) material.side = json.side;\n\t\tif ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;\n\t\tif ( json.opacity !== undefined ) material.opacity = json.opacity;\n\t\tif ( json.format !== undefined ) material.format = json.format;\n\t\tif ( json.transparent !== undefined ) material.transparent = json.transparent;\n\t\tif ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;\n\t\tif ( json.depthTest !== undefined ) material.depthTest = json.depthTest;\n\t\tif ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;\n\t\tif ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;\n\n\t\tif ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;\n\t\tif ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;\n\t\tif ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;\n\t\tif ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;\n\t\tif ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;\n\t\tif ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;\n\t\tif ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;\n\t\tif ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;\n\n\t\tif ( json.wireframe !== undefined ) material.wireframe = json.wireframe;\n\t\tif ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;\n\t\tif ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;\n\t\tif ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;\n\n\t\tif ( json.rotation !== undefined ) material.rotation = json.rotation;\n\n\t\tif ( json.linewidth !== 1 ) material.linewidth = json.linewidth;\n\t\tif ( json.dashSize !== undefined ) material.dashSize = json.dashSize;\n\t\tif ( json.gapSize !== undefined ) material.gapSize = json.gapSize;\n\t\tif ( json.scale !== undefined ) material.scale = json.scale;\n\n\t\tif ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;\n\t\tif ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;\n\t\tif ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;\n\n\t\tif ( json.dithering !== undefined ) material.dithering = json.dithering;\n\n\t\tif ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;\n\t\tif ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;\n\n\t\tif ( json.visible !== undefined ) material.visible = json.visible;\n\n\t\tif ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;\n\n\t\tif ( json.userData !== undefined ) material.userData = json.userData;\n\n\t\tif ( json.vertexColors !== undefined ) {\n\n\t\t\tif ( typeof json.vertexColors === 'number' ) {\n\n\t\t\t\tmaterial.vertexColors = ( json.vertexColors > 0 ) ? true : false;\n\n\t\t\t} else {\n\n\t\t\t\tmaterial.vertexColors = json.vertexColors;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Shader Material\n\n\t\tif ( json.uniforms !== undefined ) {\n\n\t\t\tfor ( const name in json.uniforms ) {\n\n\t\t\t\tconst uniform = json.uniforms[ name ];\n\n\t\t\t\tmaterial.uniforms[ name ] = {};\n\n\t\t\t\tswitch ( uniform.type ) {\n\n\t\t\t\t\tcase 't':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = getTexture( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'c':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Color().setHex( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v2':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector2().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'v4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Vector4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm3':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'm4':\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tmaterial.uniforms[ name ].value = uniform.value;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json.defines !== undefined ) material.defines = json.defines;\n\t\tif ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;\n\t\tif ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;\n\n\t\tif ( json.extensions !== undefined ) {\n\n\t\t\tfor ( const key in json.extensions ) {\n\n\t\t\t\tmaterial.extensions[ key ] = json.extensions[ key ];\n\n\t\t\t}\n\n\t\t}\n\n\t\t// Deprecated\n\n\t\tif ( json.shading !== undefined ) material.flatShading = json.shading === 1; // THREE.FlatShading\n\n\t\t// for PointsMaterial\n\n\t\tif ( json.size !== undefined ) material.size = json.size;\n\t\tif ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;\n\n\t\t// maps\n\n\t\tif ( json.map !== undefined ) material.map = getTexture( json.map );\n\t\tif ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );\n\n\t\tif ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );\n\n\t\tif ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );\n\t\tif ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;\n\n\t\tif ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );\n\t\tif ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;\n\t\tif ( json.normalScale !== undefined ) {\n\n\t\t\tlet normalScale = json.normalScale;\n\n\t\t\tif ( Array.isArray( normalScale ) === false ) {\n\n\t\t\t\t// Blender exporter used to export a scalar. See #7459\n\n\t\t\t\tnormalScale = [ normalScale, normalScale ];\n\n\t\t\t}\n\n\t\t\tmaterial.normalScale = new Vector2().fromArray( normalScale );\n\n\t\t}\n\n\t\tif ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );\n\t\tif ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;\n\t\tif ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;\n\n\t\tif ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );\n\t\tif ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );\n\n\t\tif ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );\n\t\tif ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;\n\n\t\tif ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );\n\t\tif ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );\n\t\tif ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );\n\n\t\tif ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );\n\t\tif ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;\n\n\t\tif ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;\n\t\tif ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;\n\n\t\tif ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );\n\t\tif ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;\n\n\t\tif ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );\n\t\tif ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;\n\n\t\tif ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );\n\n\t\tif ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );\n\t\tif ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );\n\t\tif ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );\n\t\tif ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );\n\n\t\tif ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );\n\t\tif ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );\n\n\t\tif ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );\n\t\tif ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );\n\n\t\treturn material;\n\n\t}\n\n\tsetTextures( value ) {\n\n\t\tthis.textures = value;\n\t\treturn this;\n\n\t}\n\n}\n\nclass LoaderUtils {\n\n\tstatic decodeText( array ) {\n\n\t\tif ( typeof TextDecoder !== 'undefined' ) {\n\n\t\t\treturn new TextDecoder().decode( array );\n\n\t\t}\n\n\t\t// Avoid the String.fromCharCode.apply(null, array) shortcut, which\n\t\t// throws a \"maximum call stack size exceeded\" error for large arrays.\n\n\t\tlet s = '';\n\n\t\tfor ( let i = 0, il = array.length; i < il; i ++ ) {\n\n\t\t\t// Implicitly assumes little-endian.\n\t\t\ts += String.fromCharCode( array[ i ] );\n\n\t\t}\n\n\t\ttry {\n\n\t\t\t// merges multi-byte utf-8 characters.\n\n\t\t\treturn decodeURIComponent( escape( s ) );\n\n\t\t} catch ( e ) { // see #16358\n\n\t\t\treturn s;\n\n\t\t}\n\n\t}\n\n\tstatic extractUrlBase( url ) {\n\n\t\tconst index = url.lastIndexOf( '/' );\n\n\t\tif ( index === - 1 ) return './';\n\n\t\treturn url.substr( 0, index + 1 );\n\n\t}\n\n\tstatic resolveURL( url, path ) {\n\n\t\t// Invalid URL\n\t\tif ( typeof url !== 'string' || url === '' ) return '';\n\n\t\t// Host Relative URL\n\t\tif ( /^https?:\\/\\//i.test( path ) && /^\\//.test( url ) ) {\n\n\t\t\tpath = path.replace( /(^https?:\\/\\/[^\\/]+).*/i, '$1' );\n\n\t\t}\n\n\t\t// Absolute URL http://,https://,//\n\t\tif ( /^(https?:)?\\/\\//i.test( url ) ) return url;\n\n\t\t// Data URI\n\t\tif ( /^data:.*,.*$/i.test( url ) ) return url;\n\n\t\t// Blob URL\n\t\tif ( /^blob:.*$/i.test( url ) ) return url;\n\n\t\t// Relative URL\n\t\treturn path + url;\n\n\t}\n\n}\n\nclass InstancedBufferGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'InstancedBufferGeometry';\n\t\tthis.instanceCount = Infinity;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.instanceCount = source.instanceCount;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\ttoJSON() {\n\n\t\tconst data = super.toJSON( this );\n\n\t\tdata.instanceCount = this.instanceCount;\n\n\t\tdata.isInstancedBufferGeometry = true;\n\n\t\treturn data;\n\n\t}\n\n}\n\nInstancedBufferGeometry.prototype.isInstancedBufferGeometry = true;\n\nclass BufferGeometryLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( scope.manager );\n\t\tloader.setPath( scope.path );\n\t\tloader.setRequestHeader( scope.requestHeader );\n\t\tloader.setWithCredentials( scope.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\ttry {\n\n\t\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tparse( json ) {\n\n\t\tconst interleavedBufferMap = {};\n\t\tconst arrayBufferMap = {};\n\n\t\tfunction getInterleavedBuffer( json, uuid ) {\n\n\t\t\tif ( interleavedBufferMap[ uuid ] !== undefined ) return interleavedBufferMap[ uuid ];\n\n\t\t\tconst interleavedBuffers = json.interleavedBuffers;\n\t\t\tconst interleavedBuffer = interleavedBuffers[ uuid ];\n\n\t\t\tconst buffer = getArrayBuffer( json, interleavedBuffer.buffer );\n\n\t\t\tconst array = getTypedArray( interleavedBuffer.type, buffer );\n\t\t\tconst ib = new InterleavedBuffer( array, interleavedBuffer.stride );\n\t\t\tib.uuid = interleavedBuffer.uuid;\n\n\t\t\tinterleavedBufferMap[ uuid ] = ib;\n\n\t\t\treturn ib;\n\n\t\t}\n\n\t\tfunction getArrayBuffer( json, uuid ) {\n\n\t\t\tif ( arrayBufferMap[ uuid ] !== undefined ) return arrayBufferMap[ uuid ];\n\n\t\t\tconst arrayBuffers = json.arrayBuffers;\n\t\t\tconst arrayBuffer = arrayBuffers[ uuid ];\n\n\t\t\tconst ab = new Uint32Array( arrayBuffer ).buffer;\n\n\t\t\tarrayBufferMap[ uuid ] = ab;\n\n\t\t\treturn ab;\n\n\t\t}\n\n\t\tconst geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();\n\n\t\tconst index = json.data.index;\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst typedArray = getTypedArray( index.type, index.array );\n\t\t\tgeometry.setIndex( new BufferAttribute( typedArray, 1 ) );\n\n\t\t}\n\n\t\tconst attributes = json.data.attributes;\n\n\t\tfor ( const key in attributes ) {\n\n\t\t\tconst attribute = attributes[ key ];\n\t\t\tlet bufferAttribute;\n\n\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t} else {\n\n\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\tconst bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;\n\t\t\t\tbufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t}\n\n\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\tif ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );\n\n\t\t\tif ( attribute.updateRange !== undefined ) {\n\n\t\t\t\tbufferAttribute.updateRange.offset = attribute.updateRange.offset;\n\t\t\t\tbufferAttribute.updateRange.count = attribute.updateRange.count;\n\n\t\t\t}\n\n\t\t\tgeometry.setAttribute( key, bufferAttribute );\n\n\t\t}\n\n\t\tconst morphAttributes = json.data.morphAttributes;\n\n\t\tif ( morphAttributes ) {\n\n\t\t\tfor ( const key in morphAttributes ) {\n\n\t\t\t\tconst attributeArray = morphAttributes[ key ];\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, il = attributeArray.length; i < il; i ++ ) {\n\n\t\t\t\t\tconst attribute = attributeArray[ i ];\n\t\t\t\t\tlet bufferAttribute;\n\n\t\t\t\t\tif ( attribute.isInterleavedBufferAttribute ) {\n\n\t\t\t\t\t\tconst interleavedBuffer = getInterleavedBuffer( json.data, attribute.data );\n\t\t\t\t\t\tbufferAttribute = new InterleavedBufferAttribute( interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst typedArray = getTypedArray( attribute.type, attribute.array );\n\t\t\t\t\t\tbufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;\n\t\t\t\t\tarray.push( bufferAttribute );\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.morphAttributes[ key ] = array;\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst morphTargetsRelative = json.data.morphTargetsRelative;\n\n\t\tif ( morphTargetsRelative ) {\n\n\t\t\tgeometry.morphTargetsRelative = true;\n\n\t\t}\n\n\t\tconst groups = json.data.groups || json.data.drawcalls || json.data.offsets;\n\n\t\tif ( groups !== undefined ) {\n\n\t\t\tfor ( let i = 0, n = groups.length; i !== n; ++ i ) {\n\n\t\t\t\tconst group = groups[ i ];\n\n\t\t\t\tgeometry.addGroup( group.start, group.count, group.materialIndex );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst boundingSphere = json.data.boundingSphere;\n\n\t\tif ( boundingSphere !== undefined ) {\n\n\t\t\tconst center = new Vector3();\n\n\t\t\tif ( boundingSphere.center !== undefined ) {\n\n\t\t\t\tcenter.fromArray( boundingSphere.center );\n\n\t\t\t}\n\n\t\t\tgeometry.boundingSphere = new Sphere( center, boundingSphere.radius );\n\n\t\t}\n\n\t\tif ( json.name ) geometry.name = json.name;\n\t\tif ( json.userData ) geometry.userData = json.userData;\n\n\t\treturn geometry;\n\n\t}\n\n}\n\nclass ObjectLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( text ) {\n\n\t\t\tlet json = null;\n\n\t\t\ttry {\n\n\t\t\t\tjson = JSON.parse( text );\n\n\t\t\t} catch ( error ) {\n\n\t\t\t\tif ( onError !== undefined ) onError( error );\n\n\t\t\t\tconsole.error( 'THREE:ObjectLoader: Can\\'t parse ' + url + '.', error.message );\n\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tconst metadata = json.metadata;\n\n\t\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\t\tconsole.error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tscope.parse( json, onLoad );\n\n\t\t}, onProgress, onError );\n\n\t}\n\n\tasync loadAsync( url, onProgress ) {\n\n\t\tconst scope = this;\n\n\t\tconst path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path;\n\t\tthis.resourcePath = this.resourcePath || path;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\n\t\tconst text = await loader.loadAsync( url, onProgress );\n\n\t\tconst json = JSON.parse( text );\n\n\t\tconst metadata = json.metadata;\n\n\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\tthrow new Error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\n\t\t}\n\n\t\treturn await scope.parseAsync( json );\n\n\t}\n\n\tparse( json, onLoad ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = this.parseImages( json.images, function () {\n\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\n\n\t\t} );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\n\t\t//\n\n\t\tif ( onLoad !== undefined ) {\n\n\t\t\tlet hasImages = false;\n\n\t\t\tfor ( const uuid in images ) {\n\n\t\t\t\tif ( images[ uuid ] instanceof HTMLImageElement ) {\n\n\t\t\t\t\thasImages = true;\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( hasImages === false ) onLoad( object );\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tasync parseAsync( json ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );\n\t\tconst shapes = this.parseShapes( json.shapes );\n\t\tconst geometries = this.parseGeometries( json.geometries, shapes );\n\n\t\tconst images = await this.parseImagesAsync( json.images );\n\n\t\tconst textures = this.parseTextures( json.textures, images );\n\t\tconst materials = this.parseMaterials( json.materials, textures );\n\n\t\tconst object = this.parseObject( json.object, geometries, materials, textures, animations );\n\t\tconst skeletons = this.parseSkeletons( json.skeletons, object );\n\n\t\tthis.bindSkeletons( object, skeletons );\n\n\t\treturn object;\n\n\t}\n\n\tparseShapes( json ) {\n\n\t\tconst shapes = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst shape = new Shape().fromJSON( json[ i ] );\n\n\t\t\t\tshapes[ shape.uuid ] = shape;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn shapes;\n\n\t}\n\n\tparseSkeletons( json, object ) {\n\n\t\tconst skeletons = {};\n\t\tconst bones = {};\n\n\t\t// generate bone lookup table\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isBone ) bones[ child.uuid ] = child;\n\n\t\t} );\n\n\t\t// create skeletons\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst skeleton = new Skeleton().fromJSON( json[ i ], bones );\n\n\t\t\t\tskeletons[ skeleton.uuid ] = skeleton;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn skeletons;\n\n\t}\n\n\tparseGeometries( json, shapes ) {\n\n\t\tconst geometries = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst bufferGeometryLoader = new BufferGeometryLoader();\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tlet geometry;\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tswitch ( data.type ) {\n\n\t\t\t\t\tcase 'BufferGeometry':\n\t\t\t\t\tcase 'InstancedBufferGeometry':\n\n\t\t\t\t\t\tgeometry = bufferGeometryLoader.parse( data );\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'Geometry':\n\n\t\t\t\t\t\tconsole.error( 'THREE.ObjectLoader: The legacy Geometry type is no longer supported.' );\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\n\t\t\t\t\t\tif ( data.type in Geometries ) {\n\n\t\t\t\t\t\t\tgeometry = Geometries[ data.type ].fromJSON( data, shapes );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tconsole.warn( `THREE.ObjectLoader: Unsupported geometry type \"${ data.type }\"` );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tgeometry.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) geometry.name = data.name;\n\t\t\t\tif ( geometry.isBufferGeometry === true && data.userData !== undefined ) geometry.userData = data.userData;\n\n\t\t\t\tgeometries[ data.uuid ] = geometry;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn geometries;\n\n\t}\n\n\tparseMaterials( json, textures ) {\n\n\t\tconst cache = {}; // MultiMaterial\n\t\tconst materials = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tconst loader = new MaterialLoader();\n\t\t\tloader.setTextures( textures );\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( data.type === 'MultiMaterial' ) {\n\n\t\t\t\t\t// Deprecated\n\n\t\t\t\t\tconst array = [];\n\n\t\t\t\t\tfor ( let j = 0; j < data.materials.length; j ++ ) {\n\n\t\t\t\t\t\tconst material = data.materials[ j ];\n\n\t\t\t\t\t\tif ( cache[ material.uuid ] === undefined ) {\n\n\t\t\t\t\t\t\tcache[ material.uuid ] = loader.parse( material );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tarray.push( cache[ material.uuid ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmaterials[ data.uuid ] = array;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( cache[ data.uuid ] === undefined ) {\n\n\t\t\t\t\t\tcache[ data.uuid ] = loader.parse( data );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tmaterials[ data.uuid ] = cache[ data.uuid ];\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn materials;\n\n\t}\n\n\tparseAnimations( json ) {\n\n\t\tconst animations = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0; i < json.length; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tconst clip = AnimationClip.parse( data );\n\n\t\t\t\tanimations[ clip.uuid ] = clip;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn animations;\n\n\t}\n\n\tparseImages( json, onLoad ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tfunction loadImage( url ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\treturn loader.load( url, function () {\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, undefined, function () {\n\n\t\t\t\tscope.manager.itemError( url );\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t} );\n\n\t\t}\n\n\t\tfunction deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn loadImage( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tconst manager = new LoadingManager( onLoad );\n\n\t\t\tloader = new ImageLoader( manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\timages[ image.uuid ] = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timages[ image.uuid ].push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timages[ image.uuid ].push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = deserializeImage( image.url );\n\n\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\timages[ image.uuid ] = deserializedImage;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tasync parseImagesAsync( json ) {\n\n\t\tconst scope = this;\n\t\tconst images = {};\n\n\t\tlet loader;\n\n\t\tasync function deserializeImage( image ) {\n\n\t\t\tif ( typeof image === 'string' ) {\n\n\t\t\t\tconst url = image;\n\n\t\t\t\tconst path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( url ) ? url : scope.resourcePath + url;\n\n\t\t\t\treturn await loader.loadAsync( path );\n\n\t\t\t} else {\n\n\t\t\t\tif ( image.data ) {\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: getTypedArray( image.type, image.data ),\n\t\t\t\t\t\twidth: image.width,\n\t\t\t\t\t\theight: image.height\n\t\t\t\t\t};\n\n\t\t\t\t} else {\n\n\t\t\t\t\treturn null;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( json !== undefined && json.length > 0 ) {\n\n\t\t\tloader = new ImageLoader( this.manager );\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\n\n\t\t\tfor ( let i = 0, il = json.length; i < il; i ++ ) {\n\n\t\t\t\tconst image = json[ i ];\n\t\t\t\tconst url = image.url;\n\n\t\t\t\tif ( Array.isArray( url ) ) {\n\n\t\t\t\t\t// load array of images e.g CubeTexture\n\n\t\t\t\t\timages[ image.uuid ] = [];\n\n\t\t\t\t\tfor ( let j = 0, jl = url.length; j < jl; j ++ ) {\n\n\t\t\t\t\t\tconst currentUrl = url[ j ];\n\n\t\t\t\t\t\tconst deserializedImage = await deserializeImage( currentUrl );\n\n\t\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\t\tif ( deserializedImage instanceof HTMLImageElement ) {\n\n\t\t\t\t\t\t\t\timages[ image.uuid ].push( deserializedImage );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// special case: handle array of data textures for cube textures\n\n\t\t\t\t\t\t\t\timages[ image.uuid ].push( new DataTexture( deserializedImage.data, deserializedImage.width, deserializedImage.height ) );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// load single image\n\n\t\t\t\t\tconst deserializedImage = await deserializeImage( image.url );\n\n\t\t\t\t\tif ( deserializedImage !== null ) {\n\n\t\t\t\t\t\timages[ image.uuid ] = deserializedImage;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn images;\n\n\t}\n\n\tparseTextures( json, images ) {\n\n\t\tfunction parseConstant( value, type ) {\n\n\t\t\tif ( typeof value === 'number' ) return value;\n\n\t\t\tconsole.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value );\n\n\t\t\treturn type[ value ];\n\n\t\t}\n\n\t\tconst textures = {};\n\n\t\tif ( json !== undefined ) {\n\n\t\t\tfor ( let i = 0, l = json.length; i < l; i ++ ) {\n\n\t\t\t\tconst data = json[ i ];\n\n\t\t\t\tif ( data.image === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No \"image\" specified for', data.uuid );\n\n\t\t\t\t}\n\n\t\t\t\tif ( images[ data.image ] === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined image', data.image );\n\n\t\t\t\t}\n\n\t\t\t\tlet texture;\n\t\t\t\tconst image = images[ data.image ];\n\n\t\t\t\tif ( Array.isArray( image ) ) {\n\n\t\t\t\t\ttexture = new CubeTexture( image );\n\n\t\t\t\t\tif ( image.length === 6 ) texture.needsUpdate = true;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif ( image && image.data ) {\n\n\t\t\t\t\t\ttexture = new DataTexture( image.data, image.width, image.height );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttexture = new Texture( image );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( image ) texture.needsUpdate = true; // textures can have undefined image data\n\n\t\t\t\t}\n\n\t\t\t\ttexture.uuid = data.uuid;\n\n\t\t\t\tif ( data.name !== undefined ) texture.name = data.name;\n\n\t\t\t\tif ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping, TEXTURE_MAPPING );\n\n\t\t\t\tif ( data.offset !== undefined ) texture.offset.fromArray( data.offset );\n\t\t\t\tif ( data.repeat !== undefined ) texture.repeat.fromArray( data.repeat );\n\t\t\t\tif ( data.center !== undefined ) texture.center.fromArray( data.center );\n\t\t\t\tif ( data.rotation !== undefined ) texture.rotation = data.rotation;\n\n\t\t\t\tif ( data.wrap !== undefined ) {\n\n\t\t\t\t\ttexture.wrapS = parseConstant( data.wrap[ 0 ], TEXTURE_WRAPPING );\n\t\t\t\t\ttexture.wrapT = parseConstant( data.wrap[ 1 ], TEXTURE_WRAPPING );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.format !== undefined ) texture.format = data.format;\n\t\t\t\tif ( data.type !== undefined ) texture.type = data.type;\n\t\t\t\tif ( data.encoding !== undefined ) texture.encoding = data.encoding;\n\n\t\t\t\tif ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );\n\t\t\t\tif ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;\n\n\t\t\t\tif ( data.flipY !== undefined ) texture.flipY = data.flipY;\n\n\t\t\t\tif ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;\n\t\t\t\tif ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;\n\n\t\t\t\tif ( data.userData !== undefined ) texture.userData = data.userData;\n\n\t\t\t\ttextures[ data.uuid ] = texture;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn textures;\n\n\t}\n\n\tparseObject( data, geometries, materials, textures, animations ) {\n\n\t\tlet object;\n\n\t\tfunction getGeometry( name ) {\n\n\t\t\tif ( geometries[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined geometry', name );\n\n\t\t\t}\n\n\t\t\treturn geometries[ name ];\n\n\t\t}\n\n\t\tfunction getMaterial( name ) {\n\n\t\t\tif ( name === undefined ) return undefined;\n\n\t\t\tif ( Array.isArray( name ) ) {\n\n\t\t\t\tconst array = [];\n\n\t\t\t\tfor ( let i = 0, l = name.length; i < l; i ++ ) {\n\n\t\t\t\t\tconst uuid = name[ i ];\n\n\t\t\t\t\tif ( materials[ uuid ] === undefined ) {\n\n\t\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', uuid );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tarray.push( materials[ uuid ] );\n\n\t\t\t\t}\n\n\t\t\t\treturn array;\n\n\t\t\t}\n\n\t\t\tif ( materials[ name ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', name );\n\n\t\t\t}\n\n\t\t\treturn materials[ name ];\n\n\t\t}\n\n\t\tfunction getTexture( uuid ) {\n\n\t\t\tif ( textures[ uuid ] === undefined ) {\n\n\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined texture', uuid );\n\n\t\t\t}\n\n\t\t\treturn textures[ uuid ];\n\n\t\t}\n\n\t\tlet geometry, material;\n\n\t\tswitch ( data.type ) {\n\n\t\t\tcase 'Scene':\n\n\t\t\t\tobject = new Scene();\n\n\t\t\t\tif ( data.background !== undefined ) {\n\n\t\t\t\t\tif ( Number.isInteger( data.background ) ) {\n\n\t\t\t\t\t\tobject.background = new Color( data.background );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tobject.background = getTexture( data.background );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.environment !== undefined ) {\n\n\t\t\t\t\tobject.environment = getTexture( data.environment );\n\n\t\t\t\t}\n\n\t\t\t\tif ( data.fog !== undefined ) {\n\n\t\t\t\t\tif ( data.fog.type === 'Fog' ) {\n\n\t\t\t\t\t\tobject.fog = new Fog( data.fog.color, data.fog.near, data.fog.far );\n\n\t\t\t\t\t} else if ( data.fog.type === 'FogExp2' ) {\n\n\t\t\t\t\t\tobject.fog = new FogExp2( data.fog.color, data.fog.density );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PerspectiveCamera':\n\n\t\t\t\tobject = new PerspectiveCamera( data.fov, data.aspect, data.near, data.far );\n\n\t\t\t\tif ( data.focus !== undefined ) object.focus = data.focus;\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.filmGauge !== undefined ) object.filmGauge = data.filmGauge;\n\t\t\t\tif ( data.filmOffset !== undefined ) object.filmOffset = data.filmOffset;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'OrthographicCamera':\n\n\t\t\t\tobject = new OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );\n\n\t\t\t\tif ( data.zoom !== undefined ) object.zoom = data.zoom;\n\t\t\t\tif ( data.view !== undefined ) object.view = Object.assign( {}, data.view );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'AmbientLight':\n\n\t\t\t\tobject = new AmbientLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'DirectionalLight':\n\n\t\t\t\tobject = new DirectionalLight( data.color, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointLight':\n\n\t\t\t\tobject = new PointLight( data.color, data.intensity, data.distance, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'RectAreaLight':\n\n\t\t\t\tobject = new RectAreaLight( data.color, data.intensity, data.width, data.height );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SpotLight':\n\n\t\t\t\tobject = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'HemisphereLight':\n\n\t\t\t\tobject = new HemisphereLight( data.color, data.groundColor, data.intensity );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LightProbe':\n\n\t\t\t\tobject = new LightProbe().fromJSON( data );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'SkinnedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t \tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new SkinnedMesh( geometry, material );\n\n\t\t\t\tif ( data.bindMode !== undefined ) object.bindMode = data.bindMode;\n\t\t\t\tif ( data.bindMatrix !== undefined ) object.bindMatrix.fromArray( data.bindMatrix );\n\t\t\t\tif ( data.skeleton !== undefined ) object.skeleton = data.skeleton;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Mesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\n\t\t\t\tobject = new Mesh( geometry, material );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'InstancedMesh':\n\n\t\t\t\tgeometry = getGeometry( data.geometry );\n\t\t\t\tmaterial = getMaterial( data.material );\n\t\t\t\tconst count = data.count;\n\t\t\t\tconst instanceMatrix = data.instanceMatrix;\n\t\t\t\tconst instanceColor = data.instanceColor;\n\n\t\t\t\tobject = new InstancedMesh( geometry, material, count );\n\t\t\t\tobject.instanceMatrix = new InstancedBufferAttribute( new Float32Array( instanceMatrix.array ), 16 );\n\t\t\t\tif ( instanceColor !== undefined ) object.instanceColor = new InstancedBufferAttribute( new Float32Array( instanceColor.array ), instanceColor.itemSize );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LOD':\n\n\t\t\t\tobject = new LOD();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Line':\n\n\t\t\t\tobject = new Line( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineLoop':\n\n\t\t\t\tobject = new LineLoop( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'LineSegments':\n\n\t\t\t\tobject = new LineSegments( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'PointCloud':\n\t\t\tcase 'Points':\n\n\t\t\t\tobject = new Points( getGeometry( data.geometry ), getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Sprite':\n\n\t\t\t\tobject = new Sprite( getMaterial( data.material ) );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Group':\n\n\t\t\t\tobject = new Group();\n\n\t\t\t\tbreak;\n\n\t\t\tcase 'Bone':\n\n\t\t\t\tobject = new Bone();\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tobject = new Object3D();\n\n\t\t}\n\n\t\tobject.uuid = data.uuid;\n\n\t\tif ( data.name !== undefined ) object.name = data.name;\n\n\t\tif ( data.matrix !== undefined ) {\n\n\t\t\tobject.matrix.fromArray( data.matrix );\n\n\t\t\tif ( data.matrixAutoUpdate !== undefined ) object.matrixAutoUpdate = data.matrixAutoUpdate;\n\t\t\tif ( object.matrixAutoUpdate ) object.matrix.decompose( object.position, object.quaternion, object.scale );\n\n\t\t} else {\n\n\t\t\tif ( data.position !== undefined ) object.position.fromArray( data.position );\n\t\t\tif ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );\n\t\t\tif ( data.quaternion !== undefined ) object.quaternion.fromArray( data.quaternion );\n\t\t\tif ( data.scale !== undefined ) object.scale.fromArray( data.scale );\n\n\t\t}\n\n\t\tif ( data.castShadow !== undefined ) object.castShadow = data.castShadow;\n\t\tif ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;\n\n\t\tif ( data.shadow ) {\n\n\t\t\tif ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;\n\t\t\tif ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;\n\t\t\tif ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;\n\t\t\tif ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );\n\t\t\tif ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );\n\n\t\t}\n\n\t\tif ( data.visible !== undefined ) object.visible = data.visible;\n\t\tif ( data.frustumCulled !== undefined ) object.frustumCulled = data.frustumCulled;\n\t\tif ( data.renderOrder !== undefined ) object.renderOrder = data.renderOrder;\n\t\tif ( data.userData !== undefined ) object.userData = data.userData;\n\t\tif ( data.layers !== undefined ) object.layers.mask = data.layers;\n\n\t\tif ( data.children !== undefined ) {\n\n\t\t\tconst children = data.children;\n\n\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\tobject.add( this.parseObject( children[ i ], geometries, materials, textures, animations ) );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.animations !== undefined ) {\n\n\t\t\tconst objectAnimations = data.animations;\n\n\t\t\tfor ( let i = 0; i < objectAnimations.length; i ++ ) {\n\n\t\t\t\tconst uuid = objectAnimations[ i ];\n\n\t\t\t\tobject.animations.push( animations[ uuid ] );\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( data.type === 'LOD' ) {\n\n\t\t\tif ( data.autoUpdate !== undefined ) object.autoUpdate = data.autoUpdate;\n\n\t\t\tconst levels = data.levels;\n\n\t\t\tfor ( let l = 0; l < levels.length; l ++ ) {\n\n\t\t\t\tconst level = levels[ l ];\n\t\t\t\tconst child = object.getObjectByProperty( 'uuid', level.object );\n\n\t\t\t\tif ( child !== undefined ) {\n\n\t\t\t\t\tobject.addLevel( child, level.distance );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn object;\n\n\t}\n\n\tbindSkeletons( object, skeletons ) {\n\n\t\tif ( Object.keys( skeletons ).length === 0 ) return;\n\n\t\tobject.traverse( function ( child ) {\n\n\t\t\tif ( child.isSkinnedMesh === true && child.skeleton !== undefined ) {\n\n\t\t\t\tconst skeleton = skeletons[ child.skeleton ];\n\n\t\t\t\tif ( skeleton === undefined ) {\n\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tchild.bind( skeleton, child.bindMatrix );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} );\n\n\t}\n\n\t/* DEPRECATED */\n\n\tsetTexturePath( value ) {\n\n\t\tconsole.warn( 'THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().' );\n\t\treturn this.setResourcePath( value );\n\n\t}\n\n}\n\nconst TEXTURE_MAPPING = {\n\tUVMapping: UVMapping,\n\tCubeReflectionMapping: CubeReflectionMapping,\n\tCubeRefractionMapping: CubeRefractionMapping,\n\tEquirectangularReflectionMapping: EquirectangularReflectionMapping,\n\tEquirectangularRefractionMapping: EquirectangularRefractionMapping,\n\tCubeUVReflectionMapping: CubeUVReflectionMapping,\n\tCubeUVRefractionMapping: CubeUVRefractionMapping\n};\n\nconst TEXTURE_WRAPPING = {\n\tRepeatWrapping: RepeatWrapping,\n\tClampToEdgeWrapping: ClampToEdgeWrapping,\n\tMirroredRepeatWrapping: MirroredRepeatWrapping\n};\n\nconst TEXTURE_FILTER = {\n\tNearestFilter: NearestFilter,\n\tNearestMipmapNearestFilter: NearestMipmapNearestFilter,\n\tNearestMipmapLinearFilter: NearestMipmapLinearFilter,\n\tLinearFilter: LinearFilter,\n\tLinearMipmapNearestFilter: LinearMipmapNearestFilter,\n\tLinearMipmapLinearFilter: LinearMipmapLinearFilter\n};\n\nclass ImageBitmapLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t\tif ( typeof createImageBitmap === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' );\n\n\t\t}\n\n\t\tif ( typeof fetch === 'undefined' ) {\n\n\t\t\tconsole.warn( 'THREE.ImageBitmapLoader: fetch() not supported.' );\n\n\t\t}\n\n\t\tthis.options = { premultiplyAlpha: 'none' };\n\n\t}\n\n\tsetOptions( options ) {\n\n\t\tthis.options = options;\n\n\t\treturn this;\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tif ( url === undefined ) url = '';\n\n\t\tif ( this.path !== undefined ) url = this.path + url;\n\n\t\turl = this.manager.resolveURL( url );\n\n\t\tconst scope = this;\n\n\t\tconst cached = Cache.get( url );\n\n\t\tif ( cached !== undefined ) {\n\n\t\t\tscope.manager.itemStart( url );\n\n\t\t\tsetTimeout( function () {\n\n\t\t\t\tif ( onLoad ) onLoad( cached );\n\n\t\t\t\tscope.manager.itemEnd( url );\n\n\t\t\t}, 0 );\n\n\t\t\treturn cached;\n\n\t\t}\n\n\t\tconst fetchOptions = {};\n\t\tfetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';\n\t\tfetchOptions.headers = this.requestHeader;\n\n\t\tfetch( url, fetchOptions ).then( function ( res ) {\n\n\t\t\treturn res.blob();\n\n\t\t} ).then( function ( blob ) {\n\n\t\t\treturn createImageBitmap( blob, Object.assign( scope.options, { colorSpaceConversion: 'none' } ) );\n\n\t\t} ).then( function ( imageBitmap ) {\n\n\t\t\tCache.add( url, imageBitmap );\n\n\t\t\tif ( onLoad ) onLoad( imageBitmap );\n\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} ).catch( function ( e ) {\n\n\t\t\tif ( onError ) onError( e );\n\n\t\t\tscope.manager.itemError( url );\n\t\t\tscope.manager.itemEnd( url );\n\n\t\t} );\n\n\t\tscope.manager.itemStart( url );\n\n\t}\n\n}\n\nImageBitmapLoader.prototype.isImageBitmapLoader = true;\n\nlet _context;\n\nconst AudioContext = {\n\n\tgetContext: function () {\n\n\t\tif ( _context === undefined ) {\n\n\t\t\t_context = new ( window.AudioContext || window.webkitAudioContext )();\n\n\t\t}\n\n\t\treturn _context;\n\n\t},\n\n\tsetContext: function ( value ) {\n\n\t\t_context = value;\n\n\t}\n\n};\n\nclass AudioLoader extends Loader {\n\n\tconstructor( manager ) {\n\n\t\tsuper( manager );\n\n\t}\n\n\tload( url, onLoad, onProgress, onError ) {\n\n\t\tconst scope = this;\n\n\t\tconst loader = new FileLoader( this.manager );\n\t\tloader.setResponseType( 'arraybuffer' );\n\t\tloader.setPath( this.path );\n\t\tloader.setRequestHeader( this.requestHeader );\n\t\tloader.setWithCredentials( this.withCredentials );\n\t\tloader.load( url, function ( buffer ) {\n\n\t\t\ttry {\n\n\t\t\t\t// Create a copy of the buffer. The `decodeAudioData` method\n\t\t\t\t// detaches the buffer when complete, preventing reuse.\n\t\t\t\tconst bufferCopy = buffer.slice( 0 );\n\n\t\t\t\tconst context = AudioContext.getContext();\n\t\t\t\tcontext.decodeAudioData( bufferCopy, function ( audioBuffer ) {\n\n\t\t\t\t\tonLoad( audioBuffer );\n\n\t\t\t\t} );\n\n\t\t\t} catch ( e ) {\n\n\t\t\t\tif ( onError ) {\n\n\t\t\t\t\tonError( e );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( e );\n\n\t\t\t\t}\n\n\t\t\t\tscope.manager.itemError( url );\n\n\t\t\t}\n\n\t\t}, onProgress, onError );\n\n\t}\n\n}\n\nclass HemisphereLightProbe extends LightProbe {\n\n\tconstructor( skyColor, groundColor, intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\tconst color1 = new Color().set( skyColor );\n\t\tconst color2 = new Color().set( groundColor );\n\n\t\tconst sky = new Vector3( color1.r, color1.g, color1.b );\n\t\tconst ground = new Vector3( color2.r, color2.g, color2.b );\n\n\t\t// without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI );\n\t\tconst c0 = Math.sqrt( Math.PI );\n\t\tconst c1 = c0 * Math.sqrt( 0.75 );\n\n\t\tthis.sh.coefficients[ 0 ].copy( sky ).add( ground ).multiplyScalar( c0 );\n\t\tthis.sh.coefficients[ 1 ].copy( sky ).sub( ground ).multiplyScalar( c1 );\n\n\t}\n\n}\n\nHemisphereLightProbe.prototype.isHemisphereLightProbe = true;\n\nclass AmbientLightProbe extends LightProbe {\n\n\tconstructor( color, intensity = 1 ) {\n\n\t\tsuper( undefined, intensity );\n\n\t\tconst color1 = new Color().set( color );\n\n\t\t// without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI );\n\t\tthis.sh.coefficients[ 0 ].set( color1.r, color1.g, color1.b ).multiplyScalar( 2 * Math.sqrt( Math.PI ) );\n\n\t}\n\n}\n\nAmbientLightProbe.prototype.isAmbientLightProbe = true;\n\nconst _eyeRight = /*@__PURE__*/ new Matrix4();\nconst _eyeLeft = /*@__PURE__*/ new Matrix4();\n\nclass StereoCamera {\n\n\tconstructor() {\n\n\t\tthis.type = 'StereoCamera';\n\n\t\tthis.aspect = 1;\n\n\t\tthis.eyeSep = 0.064;\n\n\t\tthis.cameraL = new PerspectiveCamera();\n\t\tthis.cameraL.layers.enable( 1 );\n\t\tthis.cameraL.matrixAutoUpdate = false;\n\n\t\tthis.cameraR = new PerspectiveCamera();\n\t\tthis.cameraR.layers.enable( 2 );\n\t\tthis.cameraR.matrixAutoUpdate = false;\n\n\t\tthis._cache = {\n\t\t\tfocus: null,\n\t\t\tfov: null,\n\t\t\taspect: null,\n\t\t\tnear: null,\n\t\t\tfar: null,\n\t\t\tzoom: null,\n\t\t\teyeSep: null\n\t\t};\n\n\t}\n\n\tupdate( camera ) {\n\n\t\tconst cache = this._cache;\n\n\t\tconst needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov ||\n\t\t\tcache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near ||\n\t\t\tcache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;\n\n\t\tif ( needsUpdate ) {\n\n\t\t\tcache.focus = camera.focus;\n\t\t\tcache.fov = camera.fov;\n\t\t\tcache.aspect = camera.aspect * this.aspect;\n\t\t\tcache.near = camera.near;\n\t\t\tcache.far = camera.far;\n\t\t\tcache.zoom = camera.zoom;\n\t\t\tcache.eyeSep = this.eyeSep;\n\n\t\t\t// Off-axis stereoscopic effect based on\n\t\t\t// http://paulbourke.net/stereographics/stereorender/\n\n\t\t\tconst projectionMatrix = camera.projectionMatrix.clone();\n\t\t\tconst eyeSepHalf = cache.eyeSep / 2;\n\t\t\tconst eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;\n\t\t\tconst ymax = ( cache.near * Math.tan( DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;\n\t\t\tlet xmin, xmax;\n\n\t\t\t// translate xOffset\n\n\t\t\t_eyeLeft.elements[ 12 ] = - eyeSepHalf;\n\t\t\t_eyeRight.elements[ 12 ] = eyeSepHalf;\n\n\t\t\t// for left eye\n\n\t\t\txmin = - ymax * cache.aspect + eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect + eyeSepOnProjection;\n\n\t\t\tprojectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\tprojectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraL.projectionMatrix.copy( projectionMatrix );\n\n\t\t\t// for right eye\n\n\t\t\txmin = - ymax * cache.aspect - eyeSepOnProjection;\n\t\t\txmax = ymax * cache.aspect - eyeSepOnProjection;\n\n\t\t\tprojectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );\n\t\t\tprojectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );\n\n\t\t\tthis.cameraR.projectionMatrix.copy( projectionMatrix );\n\n\t\t}\n\n\t\tthis.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft );\n\t\tthis.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight );\n\n\t}\n\n}\n\nclass Clock {\n\n\tconstructor( autoStart = true ) {\n\n\t\tthis.autoStart = autoStart;\n\n\t\tthis.startTime = 0;\n\t\tthis.oldTime = 0;\n\t\tthis.elapsedTime = 0;\n\n\t\tthis.running = false;\n\n\t}\n\n\tstart() {\n\n\t\tthis.startTime = now();\n\n\t\tthis.oldTime = this.startTime;\n\t\tthis.elapsedTime = 0;\n\t\tthis.running = true;\n\n\t}\n\n\tstop() {\n\n\t\tthis.getElapsedTime();\n\t\tthis.running = false;\n\t\tthis.autoStart = false;\n\n\t}\n\n\tgetElapsedTime() {\n\n\t\tthis.getDelta();\n\t\treturn this.elapsedTime;\n\n\t}\n\n\tgetDelta() {\n\n\t\tlet diff = 0;\n\n\t\tif ( this.autoStart && ! this.running ) {\n\n\t\t\tthis.start();\n\t\t\treturn 0;\n\n\t\t}\n\n\t\tif ( this.running ) {\n\n\t\t\tconst newTime = now();\n\n\t\t\tdiff = ( newTime - this.oldTime ) / 1000;\n\t\t\tthis.oldTime = newTime;\n\n\t\t\tthis.elapsedTime += diff;\n\n\t\t}\n\n\t\treturn diff;\n\n\t}\n\n}\n\nfunction now() {\n\n\treturn ( typeof performance === 'undefined' ? Date : performance ).now(); // see #10732\n\n}\n\nconst _position$1 = /*@__PURE__*/ new Vector3();\nconst _quaternion$1 = /*@__PURE__*/ new Quaternion();\nconst _scale$1 = /*@__PURE__*/ new Vector3();\nconst _orientation$1 = /*@__PURE__*/ new Vector3();\n\nclass AudioListener extends Object3D {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.type = 'AudioListener';\n\n\t\tthis.context = AudioContext.getContext();\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( this.context.destination );\n\n\t\tthis.filter = null;\n\n\t\tthis.timeDelta = 0;\n\n\t\t// private\n\n\t\tthis._clock = new Clock();\n\n\t}\n\n\tgetInput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tremoveFilter() {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\t\t\tthis.gain.connect( this.context.destination );\n\t\t\tthis.filter = null;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.filter;\n\n\t}\n\n\tsetFilter( value ) {\n\n\t\tif ( this.filter !== null ) {\n\n\t\t\tthis.gain.disconnect( this.filter );\n\t\t\tthis.filter.disconnect( this.context.destination );\n\n\t\t} else {\n\n\t\t\tthis.gain.disconnect( this.context.destination );\n\n\t\t}\n\n\t\tthis.filter = value;\n\t\tthis.gain.connect( this.filter );\n\t\tthis.filter.connect( this.context.destination );\n\n\t\treturn this;\n\n\t}\n\n\tgetMasterVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetMasterVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tconst listener = this.context.listener;\n\t\tconst up = this.up;\n\n\t\tthis.timeDelta = this._clock.getDelta();\n\n\t\tthis.matrixWorld.decompose( _position$1, _quaternion$1, _scale$1 );\n\n\t\t_orientation$1.set( 0, 0, - 1 ).applyQuaternion( _quaternion$1 );\n\n\t\tif ( listener.positionX ) {\n\n\t\t\t// code path for Chrome (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.timeDelta;\n\n\t\t\tlistener.positionX.linearRampToValueAtTime( _position$1.x, endTime );\n\t\t\tlistener.positionY.linearRampToValueAtTime( _position$1.y, endTime );\n\t\t\tlistener.positionZ.linearRampToValueAtTime( _position$1.z, endTime );\n\t\t\tlistener.forwardX.linearRampToValueAtTime( _orientation$1.x, endTime );\n\t\t\tlistener.forwardY.linearRampToValueAtTime( _orientation$1.y, endTime );\n\t\t\tlistener.forwardZ.linearRampToValueAtTime( _orientation$1.z, endTime );\n\t\t\tlistener.upX.linearRampToValueAtTime( up.x, endTime );\n\t\t\tlistener.upY.linearRampToValueAtTime( up.y, endTime );\n\t\t\tlistener.upZ.linearRampToValueAtTime( up.z, endTime );\n\n\t\t} else {\n\n\t\t\tlistener.setPosition( _position$1.x, _position$1.y, _position$1.z );\n\t\t\tlistener.setOrientation( _orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass Audio extends Object3D {\n\n\tconstructor( listener ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'Audio';\n\n\t\tthis.listener = listener;\n\t\tthis.context = listener.context;\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( listener.getInput() );\n\n\t\tthis.autoplay = false;\n\n\t\tthis.buffer = null;\n\t\tthis.detune = 0;\n\t\tthis.loop = false;\n\t\tthis.loopStart = 0;\n\t\tthis.loopEnd = 0;\n\t\tthis.offset = 0;\n\t\tthis.duration = undefined;\n\t\tthis.playbackRate = 1;\n\t\tthis.isPlaying = false;\n\t\tthis.hasPlaybackControl = true;\n\t\tthis.source = null;\n\t\tthis.sourceType = 'empty';\n\n\t\tthis._startedAt = 0;\n\t\tthis._progress = 0;\n\t\tthis._connected = false;\n\n\t\tthis.filters = [];\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.gain;\n\n\t}\n\n\tsetNodeSource( audioNode ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'audioNode';\n\t\tthis.source = audioNode;\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaElementSource( mediaElement ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaNode';\n\t\tthis.source = this.context.createMediaElementSource( mediaElement );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetMediaStreamSource( mediaStream ) {\n\n\t\tthis.hasPlaybackControl = false;\n\t\tthis.sourceType = 'mediaStreamNode';\n\t\tthis.source = this.context.createMediaStreamSource( mediaStream );\n\t\tthis.connect();\n\n\t\treturn this;\n\n\t}\n\n\tsetBuffer( audioBuffer ) {\n\n\t\tthis.buffer = audioBuffer;\n\t\tthis.sourceType = 'buffer';\n\n\t\tif ( this.autoplay ) this.play();\n\n\t\treturn this;\n\n\t}\n\n\tplay( delay = 0 ) {\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: Audio is already playing.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._startedAt = this.context.currentTime + delay;\n\n\t\tconst source = this.context.createBufferSource();\n\t\tsource.buffer = this.buffer;\n\t\tsource.loop = this.loop;\n\t\tsource.loopStart = this.loopStart;\n\t\tsource.loopEnd = this.loopEnd;\n\t\tsource.onended = this.onEnded.bind( this );\n\t\tsource.start( this._startedAt, this._progress + this.offset, this.duration );\n\n\t\tthis.isPlaying = true;\n\n\t\tthis.source = source;\n\n\t\tthis.setDetune( this.detune );\n\t\tthis.setPlaybackRate( this.playbackRate );\n\n\t\treturn this.connect();\n\n\t}\n\n\tpause() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\t// update current progress\n\n\t\t\tthis._progress += Math.max( this.context.currentTime - this._startedAt, 0 ) * this.playbackRate;\n\n\t\t\tif ( this.loop === true ) {\n\n\t\t\t\t// ensure _progress does not exceed duration with looped audios\n\n\t\t\t\tthis._progress = this._progress % ( this.duration || this.buffer.duration );\n\n\t\t\t}\n\n\t\t\tthis.source.stop();\n\t\t\tthis.source.onended = null;\n\n\t\t\tthis.isPlaying = false;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis._progress = 0;\n\n\t\tthis.source.stop();\n\t\tthis.source.onended = null;\n\t\tthis.isPlaying = false;\n\n\t\treturn this;\n\n\t}\n\n\tconnect() {\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.connect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].connect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].connect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.connect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = true;\n\n\t\treturn this;\n\n\t}\n\n\tdisconnect() {\n\n\t\tif ( this.filters.length > 0 ) {\n\n\t\t\tthis.source.disconnect( this.filters[ 0 ] );\n\n\t\t\tfor ( let i = 1, l = this.filters.length; i < l; i ++ ) {\n\n\t\t\t\tthis.filters[ i - 1 ].disconnect( this.filters[ i ] );\n\n\t\t\t}\n\n\t\t\tthis.filters[ this.filters.length - 1 ].disconnect( this.getOutput() );\n\n\t\t} else {\n\n\t\t\tthis.source.disconnect( this.getOutput() );\n\n\t\t}\n\n\t\tthis._connected = false;\n\n\t\treturn this;\n\n\t}\n\n\tgetFilters() {\n\n\t\treturn this.filters;\n\n\t}\n\n\tsetFilters( value ) {\n\n\t\tif ( ! value ) value = [];\n\n\t\tif ( this._connected === true ) {\n\n\t\t\tthis.disconnect();\n\t\t\tthis.filters = value.slice();\n\t\t\tthis.connect();\n\n\t\t} else {\n\n\t\t\tthis.filters = value.slice();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetDetune( value ) {\n\n\t\tthis.detune = value;\n\n\t\tif ( this.source.detune === undefined ) return; // only set detune when available\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetDetune() {\n\n\t\treturn this.detune;\n\n\t}\n\n\tgetFilter() {\n\n\t\treturn this.getFilters()[ 0 ];\n\n\t}\n\n\tsetFilter( filter ) {\n\n\t\treturn this.setFilters( filter ? [ filter ] : [] );\n\n\t}\n\n\tsetPlaybackRate( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.playbackRate = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.playbackRate.setTargetAtTime( this.playbackRate, this.context.currentTime, 0.01 );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tgetPlaybackRate() {\n\n\t\treturn this.playbackRate;\n\n\t}\n\n\tonEnded() {\n\n\t\tthis.isPlaying = false;\n\n\t}\n\n\tgetLoop() {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn false;\n\n\t\t}\n\n\t\treturn this.loop;\n\n\t}\n\n\tsetLoop( value ) {\n\n\t\tif ( this.hasPlaybackControl === false ) {\n\n\t\t\tconsole.warn( 'THREE.Audio: this Audio has no playback control.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tthis.loop = value;\n\n\t\tif ( this.isPlaying === true ) {\n\n\t\t\tthis.source.loop = this.loop;\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopStart( value ) {\n\n\t\tthis.loopStart = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoopEnd( value ) {\n\n\t\tthis.loopEnd = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetVolume() {\n\n\t\treturn this.gain.gain.value;\n\n\t}\n\n\tsetVolume( value ) {\n\n\t\tthis.gain.gain.setTargetAtTime( value, this.context.currentTime, 0.01 );\n\n\t\treturn this;\n\n\t}\n\n}\n\nconst _position = /*@__PURE__*/ new Vector3();\nconst _quaternion = /*@__PURE__*/ new Quaternion();\nconst _scale = /*@__PURE__*/ new Vector3();\nconst _orientation = /*@__PURE__*/ new Vector3();\n\nclass PositionalAudio extends Audio {\n\n\tconstructor( listener ) {\n\n\t\tsuper( listener );\n\n\t\tthis.panner = this.context.createPanner();\n\t\tthis.panner.panningModel = 'HRTF';\n\t\tthis.panner.connect( this.gain );\n\n\t}\n\n\tgetOutput() {\n\n\t\treturn this.panner;\n\n\t}\n\n\tgetRefDistance() {\n\n\t\treturn this.panner.refDistance;\n\n\t}\n\n\tsetRefDistance( value ) {\n\n\t\tthis.panner.refDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetRolloffFactor() {\n\n\t\treturn this.panner.rolloffFactor;\n\n\t}\n\n\tsetRolloffFactor( value ) {\n\n\t\tthis.panner.rolloffFactor = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetDistanceModel() {\n\n\t\treturn this.panner.distanceModel;\n\n\t}\n\n\tsetDistanceModel( value ) {\n\n\t\tthis.panner.distanceModel = value;\n\n\t\treturn this;\n\n\t}\n\n\tgetMaxDistance() {\n\n\t\treturn this.panner.maxDistance;\n\n\t}\n\n\tsetMaxDistance( value ) {\n\n\t\tthis.panner.maxDistance = value;\n\n\t\treturn this;\n\n\t}\n\n\tsetDirectionalCone( coneInnerAngle, coneOuterAngle, coneOuterGain ) {\n\n\t\tthis.panner.coneInnerAngle = coneInnerAngle;\n\t\tthis.panner.coneOuterAngle = coneOuterAngle;\n\t\tthis.panner.coneOuterGain = coneOuterGain;\n\n\t\treturn this;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t\tif ( this.hasPlaybackControl === true && this.isPlaying === false ) return;\n\n\t\tthis.matrixWorld.decompose( _position, _quaternion, _scale );\n\n\t\t_orientation.set( 0, 0, 1 ).applyQuaternion( _quaternion );\n\n\t\tconst panner = this.panner;\n\n\t\tif ( panner.positionX ) {\n\n\t\t\t// code path for Chrome and Firefox (see #14393)\n\n\t\t\tconst endTime = this.context.currentTime + this.listener.timeDelta;\n\n\t\t\tpanner.positionX.linearRampToValueAtTime( _position.x, endTime );\n\t\t\tpanner.positionY.linearRampToValueAtTime( _position.y, endTime );\n\t\t\tpanner.positionZ.linearRampToValueAtTime( _position.z, endTime );\n\t\t\tpanner.orientationX.linearRampToValueAtTime( _orientation.x, endTime );\n\t\t\tpanner.orientationY.linearRampToValueAtTime( _orientation.y, endTime );\n\t\t\tpanner.orientationZ.linearRampToValueAtTime( _orientation.z, endTime );\n\n\t\t} else {\n\n\t\t\tpanner.setPosition( _position.x, _position.y, _position.z );\n\t\t\tpanner.setOrientation( _orientation.x, _orientation.y, _orientation.z );\n\n\t\t}\n\n\t}\n\n}\n\nclass AudioAnalyser {\n\n\tconstructor( audio, fftSize = 2048 ) {\n\n\t\tthis.analyser = audio.context.createAnalyser();\n\t\tthis.analyser.fftSize = fftSize;\n\n\t\tthis.data = new Uint8Array( this.analyser.frequencyBinCount );\n\n\t\taudio.getOutput().connect( this.analyser );\n\n\t}\n\n\n\tgetFrequencyData() {\n\n\t\tthis.analyser.getByteFrequencyData( this.data );\n\n\t\treturn this.data;\n\n\t}\n\n\tgetAverageFrequency() {\n\n\t\tlet value = 0;\n\t\tconst data = this.getFrequencyData();\n\n\t\tfor ( let i = 0; i < data.length; i ++ ) {\n\n\t\t\tvalue += data[ i ];\n\n\t\t}\n\n\t\treturn value / data.length;\n\n\t}\n\n}\n\nclass PropertyMixer {\n\n\tconstructor( binding, typeName, valueSize ) {\n\n\t\tthis.binding = binding;\n\t\tthis.valueSize = valueSize;\n\n\t\tlet mixFunction,\n\t\t\tmixFunctionAdditive,\n\t\t\tsetIdentity;\n\n\t\t// buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]\n\t\t//\n\t\t// interpolators can use .buffer as their .result\n\t\t// the data then goes to 'incoming'\n\t\t//\n\t\t// 'accu0' and 'accu1' are used frame-interleaved for\n\t\t// the cumulative result and are compared to detect\n\t\t// changes\n\t\t//\n\t\t// 'orig' stores the original state of the property\n\t\t//\n\t\t// 'add' is used for additive cumulative results\n\t\t//\n\t\t// 'work' is optional and is only present for quaternion types. It is used\n\t\t// to store intermediate quaternion multiplication results\n\n\t\tswitch ( typeName ) {\n\n\t\t\tcase 'quaternion':\n\t\t\t\tmixFunction = this._slerp;\n\t\t\t\tmixFunctionAdditive = this._slerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityQuaternion;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 6 );\n\t\t\t\tthis._workIndex = 5;\n\t\t\t\tbreak;\n\n\t\t\tcase 'string':\n\t\t\tcase 'bool':\n\t\t\t\tmixFunction = this._select;\n\n\t\t\t\t// Use the regular mix function and for additive on these types,\n\t\t\t\t// additive is not relevant for non-numeric types\n\t\t\t\tmixFunctionAdditive = this._select;\n\n\t\t\t\tsetIdentity = this._setAdditiveIdentityOther;\n\n\t\t\t\tthis.buffer = new Array( valueSize * 5 );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tmixFunction = this._lerp;\n\t\t\t\tmixFunctionAdditive = this._lerpAdditive;\n\t\t\t\tsetIdentity = this._setAdditiveIdentityNumeric;\n\n\t\t\t\tthis.buffer = new Float64Array( valueSize * 5 );\n\n\t\t}\n\n\t\tthis._mixBufferRegion = mixFunction;\n\t\tthis._mixBufferRegionAdditive = mixFunctionAdditive;\n\t\tthis._setIdentity = setIdentity;\n\t\tthis._origIndex = 3;\n\t\tthis._addIndex = 4;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tthis.useCount = 0;\n\t\tthis.referenceCount = 0;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'accu<i>'\n\taccumulate( accuIndex, weight ) {\n\n\t\t// note: happily accumulating nothing when weight = 0, the caller knows\n\t\t// the weight and shouldn't have made the call in the first place\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = accuIndex * stride + stride;\n\n\t\tlet currentWeight = this.cumulativeWeight;\n\n\t\tif ( currentWeight === 0 ) {\n\n\t\t\t// accuN := incoming * weight\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ offset + i ] = buffer[ i ];\n\n\t\t\t}\n\n\t\t\tcurrentWeight = weight;\n\n\t\t} else {\n\n\t\t\t// accuN := accuN + incoming * weight\n\n\t\t\tcurrentWeight += weight;\n\t\t\tconst mix = weight / currentWeight;\n\t\t\tthis._mixBufferRegion( buffer, offset, 0, mix, stride );\n\n\t\t}\n\n\t\tthis.cumulativeWeight = currentWeight;\n\n\t}\n\n\t// accumulate data in the 'incoming' region into 'add'\n\taccumulateAdditive( weight ) {\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\t\t\toffset = stride * this._addIndex;\n\n\t\tif ( this.cumulativeWeightAdditive === 0 ) {\n\n\t\t\t// add = identity\n\n\t\t\tthis._setIdentity();\n\n\t\t}\n\n\t\t// add := add + incoming * weight\n\n\t\tthis._mixBufferRegionAdditive( buffer, offset, 0, weight, stride );\n\t\tthis.cumulativeWeightAdditive += weight;\n\n\t}\n\n\t// apply the state of 'accu<i>' to the binding when accus differ\n\tapply( accuIndex ) {\n\n\t\tconst stride = this.valueSize,\n\t\t\tbuffer = this.buffer,\n\t\t\toffset = accuIndex * stride + stride,\n\n\t\t\tweight = this.cumulativeWeight,\n\t\t\tweightAdditive = this.cumulativeWeightAdditive,\n\n\t\t\tbinding = this.binding;\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\tif ( weight < 1 ) {\n\n\t\t\t// accuN := accuN + original * ( 1 - cumulativeWeight )\n\n\t\t\tconst originalValueOffset = stride * this._origIndex;\n\n\t\t\tthis._mixBufferRegion(\n\t\t\t\tbuffer, offset, originalValueOffset, 1 - weight, stride );\n\n\t\t}\n\n\t\tif ( weightAdditive > 0 ) {\n\n\t\t\t// accuN := accuN + additive accuN\n\n\t\t\tthis._mixBufferRegionAdditive( buffer, offset, this._addIndex * stride, 1, stride );\n\n\t\t}\n\n\t\tfor ( let i = stride, e = stride + stride; i !== e; ++ i ) {\n\n\t\t\tif ( buffer[ i ] !== buffer[ i + stride ] ) {\n\n\t\t\t\t// value has changed -> update scene graph\n\n\t\t\t\tbinding.setValue( buffer, offset );\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remember the state of the bound property and copy it to both accus\n\tsaveOriginalState() {\n\n\t\tconst binding = this.binding;\n\n\t\tconst buffer = this.buffer,\n\t\t\tstride = this.valueSize,\n\n\t\t\toriginalValueOffset = stride * this._origIndex;\n\n\t\tbinding.getValue( buffer, originalValueOffset );\n\n\t\t// accu[0..1] := orig -- initially detect changes against the original\n\t\tfor ( let i = stride, e = originalValueOffset; i !== e; ++ i ) {\n\n\t\t\tbuffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ];\n\n\t\t}\n\n\t\t// Add to identity for additive\n\t\tthis._setIdentity();\n\n\t\tthis.cumulativeWeight = 0;\n\t\tthis.cumulativeWeightAdditive = 0;\n\n\t}\n\n\t// apply the state previously taken via 'saveOriginalState' to the binding\n\trestoreOriginalState() {\n\n\t\tconst originalValueOffset = this.valueSize * 3;\n\t\tthis.binding.setValue( this.buffer, originalValueOffset );\n\n\t}\n\n\t_setAdditiveIdentityNumeric() {\n\n\t\tconst startIndex = this._addIndex * this.valueSize;\n\t\tconst endIndex = startIndex + this.valueSize;\n\n\t\tfor ( let i = startIndex; i < endIndex; i ++ ) {\n\n\t\t\tthis.buffer[ i ] = 0;\n\n\t\t}\n\n\t}\n\n\t_setAdditiveIdentityQuaternion() {\n\n\t\tthis._setAdditiveIdentityNumeric();\n\t\tthis.buffer[ this._addIndex * this.valueSize + 3 ] = 1;\n\n\t}\n\n\t_setAdditiveIdentityOther() {\n\n\t\tconst startIndex = this._origIndex * this.valueSize;\n\t\tconst targetIndex = this._addIndex * this.valueSize;\n\n\t\tfor ( let i = 0; i < this.valueSize; i ++ ) {\n\n\t\t\tthis.buffer[ targetIndex + i ] = this.buffer[ startIndex + i ];\n\n\t\t}\n\n\t}\n\n\n\t// mix functions\n\n\t_select( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tif ( t >= 0.5 ) {\n\n\t\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\t\tbuffer[ dstOffset + i ] = buffer[ srcOffset + i ];\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_slerp( buffer, dstOffset, srcOffset, t ) {\n\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t );\n\n\t}\n\n\t_slerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst workOffset = this._workIndex * stride;\n\n\t\t// Store result in intermediate buffer offset\n\t\tQuaternion.multiplyQuaternionsFlat( buffer, workOffset, buffer, dstOffset, buffer, srcOffset );\n\n\t\t// Slerp to the intermediate result\n\t\tQuaternion.slerpFlat( buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t );\n\n\t}\n\n\t_lerp( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tconst s = 1 - t;\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] * s + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n\t_lerpAdditive( buffer, dstOffset, srcOffset, t, stride ) {\n\n\t\tfor ( let i = 0; i !== stride; ++ i ) {\n\n\t\t\tconst j = dstOffset + i;\n\n\t\t\tbuffer[ j ] = buffer[ j ] + buffer[ srcOffset + i ] * t;\n\n\t\t}\n\n\t}\n\n}\n\n// Characters [].:/ are reserved for track binding syntax.\nconst _RESERVED_CHARS_RE = '\\\\[\\\\]\\\\.:\\\\/';\nconst _reservedRe = new RegExp( '[' + _RESERVED_CHARS_RE + ']', 'g' );\n\n// Attempts to allow node names from any language. ES5's `\\w` regexp matches\n// only latin characters, and the unicode \\p{L} is not yet supported. So\n// instead, we exclude reserved characters and match everything else.\nconst _wordChar = '[^' + _RESERVED_CHARS_RE + ']';\nconst _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace( '\\\\.', '' ) + ']';\n\n// Parent directories, delimited by '/' or ':'. Currently unused, but must\n// be matched to parse the rest of the track name.\nconst _directoryRe = /((?:WC+[\\/:])*)/.source.replace( 'WC', _wordChar );\n\n// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.\nconst _nodeRe = /(WCOD+)?/.source.replace( 'WCOD', _wordCharOrDot );\n\n// Object on target node, and accessor. May not contain reserved\n// characters. Accessor may contain any character except closing bracket.\nconst _objectRe = /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace( 'WC', _wordChar );\n\n// Property and accessor. May not contain reserved characters. Accessor may\n// contain any non-bracket characters.\nconst _propertyRe = /\\.(WC+)(?:\\[(.+)\\])?/.source.replace( 'WC', _wordChar );\n\nconst _trackRe = new RegExp( ''\n\t+ '^'\n\t+ _directoryRe\n\t+ _nodeRe\n\t+ _objectRe\n\t+ _propertyRe\n\t+ '$'\n);\n\nconst _supportedObjectNames = [ 'material', 'materials', 'bones' ];\n\nclass Composite {\n\n\tconstructor( targetGroup, path, optionalParsedPath ) {\n\n\t\tconst parsedPath = optionalParsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis._targetGroup = targetGroup;\n\t\tthis._bindings = targetGroup.subscribe_( path, parsedPath );\n\n\t}\n\n\tgetValue( array, offset ) {\n\n\t\tthis.bind(); // bind all binding\n\n\t\tconst firstValidIndex = this._targetGroup.nCachedObjects_,\n\t\t\tbinding = this._bindings[ firstValidIndex ];\n\n\t\t// and only call .getValue on the first\n\t\tif ( binding !== undefined ) binding.getValue( array, offset );\n\n\t}\n\n\tsetValue( array, offset ) {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].setValue( array, offset );\n\n\t\t}\n\n\t}\n\n\tbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].bind();\n\n\t\t}\n\n\t}\n\n\tunbind() {\n\n\t\tconst bindings = this._bindings;\n\n\t\tfor ( let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tbindings[ i ].unbind();\n\n\t\t}\n\n\t}\n\n}\n\n// Note: This class uses a State pattern on a per-method basis:\n// 'bind' sets 'this.getValue' / 'setValue' and shadows the\n// prototype version of these methods with one that represents\n// the bound state. When the property is not found, the methods\n// become no-ops.\nclass PropertyBinding {\n\n\tconstructor( rootNode, path, parsedPath ) {\n\n\t\tthis.path = path;\n\t\tthis.parsedPath = parsedPath || PropertyBinding.parseTrackName( path );\n\n\t\tthis.node = PropertyBinding.findNode( rootNode, this.parsedPath.nodeName ) || rootNode;\n\n\t\tthis.rootNode = rootNode;\n\n\t\t// initial state of these methods that calls 'bind'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n\n\tstatic create( root, path, parsedPath ) {\n\n\t\tif ( ! ( root && root.isAnimationObjectGroup ) ) {\n\n\t\t\treturn new PropertyBinding( root, path, parsedPath );\n\n\t\t} else {\n\n\t\t\treturn new PropertyBinding.Composite( root, path, parsedPath );\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Replaces spaces with underscores and removes unsupported characters from\n\t * node names, to ensure compatibility with parseTrackName().\n\t *\n\t * @param {string} name Node name to be sanitized.\n\t * @return {string}\n\t */\n\tstatic sanitizeNodeName( name ) {\n\n\t\treturn name.replace( /\\s/g, '_' ).replace( _reservedRe, '' );\n\n\t}\n\n\tstatic parseTrackName( trackName ) {\n\n\t\tconst matches = _trackRe.exec( trackName );\n\n\t\tif ( ! matches ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );\n\n\t\t}\n\n\t\tconst results = {\n\t\t\t// directoryName: matches[ 1 ], // (tschw) currently unused\n\t\t\tnodeName: matches[ 2 ],\n\t\t\tobjectName: matches[ 3 ],\n\t\t\tobjectIndex: matches[ 4 ],\n\t\t\tpropertyName: matches[ 5 ], // required\n\t\t\tpropertyIndex: matches[ 6 ]\n\t\t};\n\n\t\tconst lastDot = results.nodeName && results.nodeName.lastIndexOf( '.' );\n\n\t\tif ( lastDot !== undefined && lastDot !== - 1 ) {\n\n\t\t\tconst objectName = results.nodeName.substring( lastDot + 1 );\n\n\t\t\t// Object names must be checked against an allowlist. Otherwise, there\n\t\t\t// is no way to parse 'foo.bar.baz': 'baz' must be a property, but\n\t\t\t// 'bar' could be the objectName, or part of a nodeName (which can\n\t\t\t// include '.' characters).\n\t\t\tif ( _supportedObjectNames.indexOf( objectName ) !== - 1 ) {\n\n\t\t\t\tresults.nodeName = results.nodeName.substring( 0, lastDot );\n\t\t\t\tresults.objectName = objectName;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( results.propertyName === null || results.propertyName.length === 0 ) {\n\n\t\t\tthrow new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );\n\n\t\t}\n\n\t\treturn results;\n\n\t}\n\n\tstatic findNode( root, nodeName ) {\n\n\t\tif ( ! nodeName || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {\n\n\t\t\treturn root;\n\n\t\t}\n\n\t\t// search into skeleton bones.\n\t\tif ( root.skeleton ) {\n\n\t\t\tconst bone = root.skeleton.getBoneByName( nodeName );\n\n\t\t\tif ( bone !== undefined ) {\n\n\t\t\t\treturn bone;\n\n\t\t\t}\n\n\t\t}\n\n\t\t// search into node subtree.\n\t\tif ( root.children ) {\n\n\t\t\tconst searchNodeSubtree = function ( children ) {\n\n\t\t\t\tfor ( let i = 0; i < children.length; i ++ ) {\n\n\t\t\t\t\tconst childNode = children[ i ];\n\n\t\t\t\t\tif ( childNode.name === nodeName || childNode.uuid === nodeName ) {\n\n\t\t\t\t\t\treturn childNode;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tconst result = searchNodeSubtree( childNode.children );\n\n\t\t\t\t\tif ( result ) return result;\n\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\n\t\t\t};\n\n\t\t\tconst subTreeNode = searchNodeSubtree( root.children );\n\n\t\t\tif ( subTreeNode ) {\n\n\t\t\t\treturn subTreeNode;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// these are used to \"bind\" a nonexistent property\n\t_getValue_unavailable() {}\n\t_setValue_unavailable() {}\n\n\t// Getters\n\n\t_getValue_direct( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.targetObject[ this.propertyName ];\n\n\t}\n\n\t_getValue_array( buffer, offset ) {\n\n\t\tconst source = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = source.length; i !== n; ++ i ) {\n\n\t\t\tbuffer[ offset ++ ] = source[ i ];\n\n\t\t}\n\n\t}\n\n\t_getValue_arrayElement( buffer, offset ) {\n\n\t\tbuffer[ offset ] = this.resolvedProperty[ this.propertyIndex ];\n\n\t}\n\n\t_getValue_toArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.toArray( buffer, offset );\n\n\t}\n\n\t// Direct\n\n\t_setValue_direct( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_direct_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_direct_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.targetObject[ this.propertyName ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// EntireArray\n\n\t_setValue_array( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t}\n\n\t_setValue_array_setNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tconst dest = this.resolvedProperty;\n\n\t\tfor ( let i = 0, n = dest.length; i !== n; ++ i ) {\n\n\t\t\tdest[ i ] = buffer[ offset ++ ];\n\n\t\t}\n\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// ArrayElement\n\n\t_setValue_arrayElement( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\n\t}\n\n\t_setValue_arrayElement_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_arrayElement_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty[ this.propertyIndex ] = buffer[ offset ];\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t// HasToFromArray\n\n\t_setValue_fromArray( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\n\t}\n\n\t_setValue_fromArray_setNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.needsUpdate = true;\n\n\t}\n\n\t_setValue_fromArray_setMatrixWorldNeedsUpdate( buffer, offset ) {\n\n\t\tthis.resolvedProperty.fromArray( buffer, offset );\n\t\tthis.targetObject.matrixWorldNeedsUpdate = true;\n\n\t}\n\n\t_getValue_unbound( targetArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.getValue( targetArray, offset );\n\n\t}\n\n\t_setValue_unbound( sourceArray, offset ) {\n\n\t\tthis.bind();\n\t\tthis.setValue( sourceArray, offset );\n\n\t}\n\n\t// create getter / setter pair for a property in the scene graph\n\tbind() {\n\n\t\tlet targetObject = this.node;\n\t\tconst parsedPath = this.parsedPath;\n\n\t\tconst objectName = parsedPath.objectName;\n\t\tconst propertyName = parsedPath.propertyName;\n\t\tlet propertyIndex = parsedPath.propertyIndex;\n\n\t\tif ( ! targetObject ) {\n\n\t\t\ttargetObject = PropertyBinding.findNode( this.rootNode, parsedPath.nodeName ) || this.rootNode;\n\n\t\t\tthis.node = targetObject;\n\n\t\t}\n\n\t\t// set fail state so we can just 'return' on error\n\t\tthis.getValue = this._getValue_unavailable;\n\t\tthis.setValue = this._setValue_unavailable;\n\n\t\t// ensure there is a value node\n\t\tif ( ! targetObject ) {\n\n\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to update node for track: ' + this.path + ' but it wasn\\'t found.' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tif ( objectName ) {\n\n\t\t\tlet objectIndex = parsedPath.objectIndex;\n\n\t\t\t// special cases were we need to reach deeper into the hierarchy to get the face materials....\n\t\t\tswitch ( objectName ) {\n\n\t\t\t\tcase 'materials':\n\n\t\t\t\t\tif ( ! targetObject.material ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material as node does not have a material.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! targetObject.material.materials ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject.material.materials;\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'bones':\n\n\t\t\t\t\tif ( ! targetObject.skeleton ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\t// potential future optimization: skip this if propertyIndex is already an integer\n\t\t\t\t\t// and convert the integer string to a true integer.\n\n\t\t\t\t\ttargetObject = targetObject.skeleton.bones;\n\n\t\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\t\tfor ( let i = 0; i < targetObject.length; i ++ ) {\n\n\t\t\t\t\t\tif ( targetObject[ i ].name === objectIndex ) {\n\n\t\t\t\t\t\t\tobjectIndex = i;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tif ( targetObject[ objectName ] === undefined ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to objectName of node undefined.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\ttargetObject = targetObject[ objectName ];\n\n\t\t\t}\n\n\n\t\t\tif ( objectIndex !== undefined ) {\n\n\t\t\t\tif ( targetObject[ objectIndex ] === undefined ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\ttargetObject = targetObject[ objectIndex ];\n\n\t\t\t}\n\n\t\t}\n\n\t\t// resolve property\n\t\tconst nodeProperty = targetObject[ propertyName ];\n\n\t\tif ( nodeProperty === undefined ) {\n\n\t\t\tconst nodeName = parsedPath.nodeName;\n\n\t\t\tconsole.error( 'THREE.PropertyBinding: Trying to update property for track: ' + nodeName +\n\t\t\t\t'.' + propertyName + ' but it wasn\\'t found.', targetObject );\n\t\t\treturn;\n\n\t\t}\n\n\t\t// determine versioning scheme\n\t\tlet versioning = this.Versioning.None;\n\n\t\tthis.targetObject = targetObject;\n\n\t\tif ( targetObject.needsUpdate !== undefined ) { // material\n\n\t\t\tversioning = this.Versioning.NeedsUpdate;\n\n\t\t} else if ( targetObject.matrixWorldNeedsUpdate !== undefined ) { // node transform\n\n\t\t\tversioning = this.Versioning.MatrixWorldNeedsUpdate;\n\n\t\t}\n\n\t\t// determine how the property gets bound\n\t\tlet bindingType = this.BindingType.Direct;\n\n\t\tif ( propertyIndex !== undefined ) {\n\n\t\t\t// access a sub element of the property array (only primitives are supported right now)\n\n\t\t\tif ( propertyName === 'morphTargetInfluences' ) {\n\n\t\t\t\t// potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.\n\n\t\t\t\t// support resolving morphTarget names into indices.\n\t\t\t\tif ( ! targetObject.geometry ) {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t\tif ( targetObject.geometry.isBufferGeometry ) {\n\n\t\t\t\t\tif ( ! targetObject.geometry.morphAttributes ) {\n\n\t\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this );\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( targetObject.morphTargetDictionary[ propertyIndex ] !== undefined ) {\n\n\t\t\t\t\t\tpropertyIndex = targetObject.morphTargetDictionary[ propertyIndex ];\n\n\t\t\t\t\t}\n\n\n\t\t\t\t} else {\n\n\t\t\t\t\tconsole.error( 'THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.', this );\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tbindingType = this.BindingType.ArrayElement;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\t\t\tthis.propertyIndex = propertyIndex;\n\n\t\t} else if ( nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined ) {\n\n\t\t\t// must use copy for Object3D.Euler/Quaternion\n\n\t\t\tbindingType = this.BindingType.HasFromToArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else if ( Array.isArray( nodeProperty ) ) {\n\n\t\t\tbindingType = this.BindingType.EntireArray;\n\n\t\t\tthis.resolvedProperty = nodeProperty;\n\n\t\t} else {\n\n\t\t\tthis.propertyName = propertyName;\n\n\t\t}\n\n\t\t// select getter / setter\n\t\tthis.getValue = this.GetterByBindingType[ bindingType ];\n\t\tthis.setValue = this.SetterByBindingTypeAndVersioning[ bindingType ][ versioning ];\n\n\t}\n\n\tunbind() {\n\n\t\tthis.node = null;\n\n\t\t// back to the prototype version of getValue / setValue\n\t\t// note: avoiding to mutate the shape of 'this' via 'delete'\n\t\tthis.getValue = this._getValue_unbound;\n\t\tthis.setValue = this._setValue_unbound;\n\n\t}\n\n}\n\nPropertyBinding.Composite = Composite;\n\nPropertyBinding.prototype.BindingType = {\n\tDirect: 0,\n\tEntireArray: 1,\n\tArrayElement: 2,\n\tHasFromToArray: 3\n};\n\nPropertyBinding.prototype.Versioning = {\n\tNone: 0,\n\tNeedsUpdate: 1,\n\tMatrixWorldNeedsUpdate: 2\n};\n\nPropertyBinding.prototype.GetterByBindingType = [\n\n\tPropertyBinding.prototype._getValue_direct,\n\tPropertyBinding.prototype._getValue_array,\n\tPropertyBinding.prototype._getValue_arrayElement,\n\tPropertyBinding.prototype._getValue_toArray,\n\n];\n\nPropertyBinding.prototype.SetterByBindingTypeAndVersioning = [\n\n\t[\n\t\t// Direct\n\t\tPropertyBinding.prototype._setValue_direct,\n\t\tPropertyBinding.prototype._setValue_direct_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// EntireArray\n\n\t\tPropertyBinding.prototype._setValue_array,\n\t\tPropertyBinding.prototype._setValue_array_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// ArrayElement\n\t\tPropertyBinding.prototype._setValue_arrayElement,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate,\n\n\t], [\n\n\t\t// HasToFromArray\n\t\tPropertyBinding.prototype._setValue_fromArray,\n\t\tPropertyBinding.prototype._setValue_fromArray_setNeedsUpdate,\n\t\tPropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate,\n\n\t]\n\n];\n\n/**\n *\n * A group of objects that receives a shared animation state.\n *\n * Usage:\n *\n * - Add objects you would otherwise pass as 'root' to the\n * constructor or the .clipAction method of AnimationMixer.\n *\n * - Instead pass this object as 'root'.\n *\n * - You can also add and remove objects later when the mixer\n * is running.\n *\n * Note:\n *\n * Objects of this class appear as one object to the mixer,\n * so cache control of the individual objects must be done\n * on the group.\n *\n * Limitation:\n *\n * - The animated properties must be compatible among the\n * all objects in the group.\n *\n * - A single property can either be controlled through a\n * target group or directly, but not both.\n */\n\nclass AnimationObjectGroup {\n\n\tconstructor() {\n\n\t\tthis.uuid = generateUUID();\n\n\t\t// cached objects followed by the active ones\n\t\tthis._objects = Array.prototype.slice.call( arguments );\n\n\t\tthis.nCachedObjects_ = 0; // threshold\n\t\t// note: read by PropertyBinding.Composite\n\n\t\tconst indices = {};\n\t\tthis._indicesByUUID = indices; // for bookkeeping\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tindices[ arguments[ i ].uuid ] = i;\n\n\t\t}\n\n\t\tthis._paths = []; // inside: string\n\t\tthis._parsedPaths = []; // inside: { we don't care, here }\n\t\tthis._bindings = []; // inside: Array< PropertyBinding >\n\t\tthis._bindingsIndicesByPath = {}; // inside: indices in these arrays\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tobjects: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._objects.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn this.total - scope.nCachedObjects_;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tget bindingsPerObject() {\n\n\t\t\t\treturn scope._bindings.length;\n\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\tadd() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tpaths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet knownObject = undefined,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid;\n\t\t\tlet index = indicesByUUID[ uuid ];\n\n\t\t\tif ( index === undefined ) {\n\n\t\t\t\t// unknown object -> add it to the ACTIVE region\n\n\t\t\t\tindex = nObjects ++;\n\t\t\t\tindicesByUUID[ uuid ] = index;\n\t\t\t\tobjects.push( object );\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tbindings[ j ].push( new PropertyBinding( object, paths[ j ], parsedPaths[ j ] ) );\n\n\t\t\t\t}\n\n\t\t\t} else if ( index < nCachedObjects ) {\n\n\t\t\t\tknownObject = objects[ index ];\n\n\t\t\t\t// move existing object to the ACTIVE region\n\n\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ];\n\n\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = firstActiveIndex;\n\t\t\t\tobjects[ firstActiveIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ];\n\n\t\t\t\t\tlet binding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\n\t\t\t\t\tif ( binding === undefined ) {\n\n\t\t\t\t\t\t// since we do not bother to create new bindings\n\t\t\t\t\t\t// for objects that are cached, the binding may\n\t\t\t\t\t\t// or may not exist\n\n\t\t\t\t\t\tbinding = new PropertyBinding( object, paths[ j ], parsedPaths[ j ] );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t} else if ( objects[ index ] !== knownObject ) {\n\n\t\t\t\tconsole.error( 'THREE.AnimationObjectGroup: Different objects with the same UUID ' +\n\t\t\t\t\t'detected. Clean the caches or recreate your infrastructure when reloading scenes.' );\n\n\t\t\t} // else the object is already where we want it to be\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\tremove() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined && index >= nCachedObjects ) {\n\n\t\t\t\t// move existing object into the CACHED region\n\n\t\t\t\tconst lastCachedIndex = nCachedObjects ++,\n\t\t\t\t\tfirstActiveObject = objects[ lastCachedIndex ];\n\n\t\t\t\tindicesByUUID[ firstActiveObject.uuid ] = index;\n\t\t\t\tobjects[ index ] = firstActiveObject;\n\n\t\t\t\tindicesByUUID[ uuid ] = lastCachedIndex;\n\t\t\t\tobjects[ lastCachedIndex ] = object;\n\n\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\tfirstActive = bindingsForPath[ lastCachedIndex ],\n\t\t\t\t\t\tbinding = bindingsForPath[ index ];\n\n\t\t\t\t\tbindingsForPath[ index ] = firstActive;\n\t\t\t\t\tbindingsForPath[ lastCachedIndex ] = binding;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// remove & forget\n\tuncache() {\n\n\t\tconst objects = this._objects,\n\t\t\tindicesByUUID = this._indicesByUUID,\n\t\t\tbindings = this._bindings,\n\t\t\tnBindings = bindings.length;\n\n\t\tlet nCachedObjects = this.nCachedObjects_,\n\t\t\tnObjects = objects.length;\n\n\t\tfor ( let i = 0, n = arguments.length; i !== n; ++ i ) {\n\n\t\t\tconst object = arguments[ i ],\n\t\t\t\tuuid = object.uuid,\n\t\t\t\tindex = indicesByUUID[ uuid ];\n\n\t\t\tif ( index !== undefined ) {\n\n\t\t\t\tdelete indicesByUUID[ uuid ];\n\n\t\t\t\tif ( index < nCachedObjects ) {\n\n\t\t\t\t\t// object is cached, shrink the CACHED region\n\n\t\t\t\t\tconst firstActiveIndex = -- nCachedObjects,\n\t\t\t\t\t\tlastCachedObject = objects[ firstActiveIndex ],\n\t\t\t\t\t\tlastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\t// last cached object takes this object's place\n\t\t\t\t\tindicesByUUID[ lastCachedObject.uuid ] = index;\n\t\t\t\t\tobjects[ index ] = lastCachedObject;\n\n\t\t\t\t\t// last object goes to the activated slot and pop\n\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = firstActiveIndex;\n\t\t\t\t\tobjects[ firstActiveIndex ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ],\n\t\t\t\t\t\t\tlastCached = bindingsForPath[ firstActiveIndex ],\n\t\t\t\t\t\t\tlast = bindingsForPath[ lastIndex ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = lastCached;\n\t\t\t\t\t\tbindingsForPath[ firstActiveIndex ] = last;\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// object is active, just swap with the last and pop\n\n\t\t\t\t\tconst lastIndex = -- nObjects,\n\t\t\t\t\t\tlastObject = objects[ lastIndex ];\n\n\t\t\t\t\tif ( lastIndex > 0 ) {\n\n\t\t\t\t\t\tindicesByUUID[ lastObject.uuid ] = index;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tobjects[ index ] = lastObject;\n\t\t\t\t\tobjects.pop();\n\n\t\t\t\t\t// accounting is done, now do the same for all bindings\n\n\t\t\t\t\tfor ( let j = 0, m = nBindings; j !== m; ++ j ) {\n\n\t\t\t\t\t\tconst bindingsForPath = bindings[ j ];\n\n\t\t\t\t\t\tbindingsForPath[ index ] = bindingsForPath[ lastIndex ];\n\t\t\t\t\t\tbindingsForPath.pop();\n\n\t\t\t\t\t}\n\n\t\t\t\t} // cached or active\n\n\t\t\t} // if object is known\n\n\t\t} // for arguments\n\n\t\tthis.nCachedObjects_ = nCachedObjects;\n\n\t}\n\n\t// Internal interface used by befriended PropertyBinding.Composite:\n\n\tsubscribe_( path, parsedPath ) {\n\n\t\t// returns an array of bindings for the given path that is changed\n\t\t// according to the contained objects in the group\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath;\n\t\tlet index = indicesByPath[ path ];\n\t\tconst bindings = this._bindings;\n\n\t\tif ( index !== undefined ) return bindings[ index ];\n\n\t\tconst paths = this._paths,\n\t\t\tparsedPaths = this._parsedPaths,\n\t\t\tobjects = this._objects,\n\t\t\tnObjects = objects.length,\n\t\t\tnCachedObjects = this.nCachedObjects_,\n\t\t\tbindingsForPath = new Array( nObjects );\n\n\t\tindex = bindings.length;\n\n\t\tindicesByPath[ path ] = index;\n\n\t\tpaths.push( path );\n\t\tparsedPaths.push( parsedPath );\n\t\tbindings.push( bindingsForPath );\n\n\t\tfor ( let i = nCachedObjects, n = objects.length; i !== n; ++ i ) {\n\n\t\t\tconst object = objects[ i ];\n\t\t\tbindingsForPath[ i ] = new PropertyBinding( object, path, parsedPath );\n\n\t\t}\n\n\t\treturn bindingsForPath;\n\n\t}\n\n\tunsubscribe_( path ) {\n\n\t\t// tells the group to forget about a property path and no longer\n\t\t// update the array previously obtained with 'subscribe_'\n\n\t\tconst indicesByPath = this._bindingsIndicesByPath,\n\t\t\tindex = indicesByPath[ path ];\n\n\t\tif ( index !== undefined ) {\n\n\t\t\tconst paths = this._paths,\n\t\t\t\tparsedPaths = this._parsedPaths,\n\t\t\t\tbindings = this._bindings,\n\t\t\t\tlastBindingsIndex = bindings.length - 1,\n\t\t\t\tlastBindings = bindings[ lastBindingsIndex ],\n\t\t\t\tlastBindingsPath = path[ lastBindingsIndex ];\n\n\t\t\tindicesByPath[ lastBindingsPath ] = index;\n\n\t\t\tbindings[ index ] = lastBindings;\n\t\t\tbindings.pop();\n\n\t\t\tparsedPaths[ index ] = parsedPaths[ lastBindingsIndex ];\n\t\t\tparsedPaths.pop();\n\n\t\t\tpaths[ index ] = paths[ lastBindingsIndex ];\n\t\t\tpaths.pop();\n\n\t\t}\n\n\t}\n\n}\n\nAnimationObjectGroup.prototype.isAnimationObjectGroup = true;\n\nclass AnimationAction {\n\n\tconstructor( mixer, clip, localRoot = null, blendMode = clip.blendMode ) {\n\n\t\tthis._mixer = mixer;\n\t\tthis._clip = clip;\n\t\tthis._localRoot = localRoot;\n\t\tthis.blendMode = blendMode;\n\n\t\tconst tracks = clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tinterpolants = new Array( nTracks );\n\n\t\tconst interpolantSettings = {\n\t\t\tendingStart: ZeroCurvatureEnding,\n\t\t\tendingEnd: ZeroCurvatureEnding\n\t\t};\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst interpolant = tracks[ i ].createInterpolant( null );\n\t\t\tinterpolants[ i ] = interpolant;\n\t\t\tinterpolant.settings = interpolantSettings;\n\n\t\t}\n\n\t\tthis._interpolantSettings = interpolantSettings;\n\n\t\tthis._interpolants = interpolants; // bound by the mixer\n\n\t\t// inside: PropertyMixer (managed by the mixer)\n\t\tthis._propertyBindings = new Array( nTracks );\n\n\t\tthis._cacheIndex = null; // for the memory manager\n\t\tthis._byClipCacheIndex = null; // for the memory manager\n\n\t\tthis._timeScaleInterpolant = null;\n\t\tthis._weightInterpolant = null;\n\n\t\tthis.loop = LoopRepeat;\n\t\tthis._loopCount = - 1;\n\n\t\t// global mixer time when the action is to be started\n\t\t// it's set back to 'null' upon start of the action\n\t\tthis._startTime = null;\n\n\t\t// scaled local time of the action\n\t\t// gets clamped or wrapped to 0..clip.duration according to loop\n\t\tthis.time = 0;\n\n\t\tthis.timeScale = 1;\n\t\tthis._effectiveTimeScale = 1;\n\n\t\tthis.weight = 1;\n\t\tthis._effectiveWeight = 1;\n\n\t\tthis.repetitions = Infinity; // no. of repetitions when looping\n\n\t\tthis.paused = false; // true -> zero effective time scale\n\t\tthis.enabled = true; // false -> zero effective weight\n\n\t\tthis.clampWhenFinished = false;// keep feeding the last frame?\n\n\t\tthis.zeroSlopeAtStart = true;// for smooth interpolation w/o separate\n\t\tthis.zeroSlopeAtEnd = true;// clips for start, loop and end\n\n\t}\n\n\t// State & Scheduling\n\n\tplay() {\n\n\t\tthis._mixer._activateAction( this );\n\n\t\treturn this;\n\n\t}\n\n\tstop() {\n\n\t\tthis._mixer._deactivateAction( this );\n\n\t\treturn this.reset();\n\n\t}\n\n\treset() {\n\n\t\tthis.paused = false;\n\t\tthis.enabled = true;\n\n\t\tthis.time = 0; // restart clip\n\t\tthis._loopCount = - 1;// forget previous loops\n\t\tthis._startTime = null;// forget scheduling\n\n\t\treturn this.stopFading().stopWarping();\n\n\t}\n\n\tisRunning() {\n\n\t\treturn this.enabled && ! this.paused && this.timeScale !== 0 &&\n\t\t\tthis._startTime === null && this._mixer._isActiveAction( this );\n\n\t}\n\n\t// return true when play has been called\n\tisScheduled() {\n\n\t\treturn this._mixer._isActiveAction( this );\n\n\t}\n\n\tstartAt( time ) {\n\n\t\tthis._startTime = time;\n\n\t\treturn this;\n\n\t}\n\n\tsetLoop( mode, repetitions ) {\n\n\t\tthis.loop = mode;\n\t\tthis.repetitions = repetitions;\n\n\t\treturn this;\n\n\t}\n\n\t// Weight\n\n\t// set the weight stopping any scheduled fading\n\t// although .enabled = false yields an effective weight of zero, this\n\t// method does *not* change .enabled, because it would be confusing\n\tsetEffectiveWeight( weight ) {\n\n\t\tthis.weight = weight;\n\n\t\t// note: same logic as when updated at runtime\n\t\tthis._effectiveWeight = this.enabled ? weight : 0;\n\n\t\treturn this.stopFading();\n\n\t}\n\n\t// return the weight considering fading and .enabled\n\tgetEffectiveWeight() {\n\n\t\treturn this._effectiveWeight;\n\n\t}\n\n\tfadeIn( duration ) {\n\n\t\treturn this._scheduleFading( duration, 0, 1 );\n\n\t}\n\n\tfadeOut( duration ) {\n\n\t\treturn this._scheduleFading( duration, 1, 0 );\n\n\t}\n\n\tcrossFadeFrom( fadeOutAction, duration, warp ) {\n\n\t\tfadeOutAction.fadeOut( duration );\n\t\tthis.fadeIn( duration );\n\n\t\tif ( warp ) {\n\n\t\t\tconst fadeInDuration = this._clip.duration,\n\t\t\t\tfadeOutDuration = fadeOutAction._clip.duration,\n\n\t\t\t\tstartEndRatio = fadeOutDuration / fadeInDuration,\n\t\t\t\tendStartRatio = fadeInDuration / fadeOutDuration;\n\n\t\t\tfadeOutAction.warp( 1.0, startEndRatio, duration );\n\t\t\tthis.warp( endStartRatio, 1.0, duration );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tcrossFadeTo( fadeInAction, duration, warp ) {\n\n\t\treturn fadeInAction.crossFadeFrom( this, duration, warp );\n\n\t}\n\n\tstopFading() {\n\n\t\tconst weightInterpolant = this._weightInterpolant;\n\n\t\tif ( weightInterpolant !== null ) {\n\n\t\t\tthis._weightInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( weightInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Time Scale Control\n\n\t// set the time scale stopping any scheduled warping\n\t// although .paused = true yields an effective time scale of zero, this\n\t// method does *not* change .paused, because it would be confusing\n\tsetEffectiveTimeScale( timeScale ) {\n\n\t\tthis.timeScale = timeScale;\n\t\tthis._effectiveTimeScale = this.paused ? 0 : timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\t// return the time scale considering warping and .paused\n\tgetEffectiveTimeScale() {\n\n\t\treturn this._effectiveTimeScale;\n\n\t}\n\n\tsetDuration( duration ) {\n\n\t\tthis.timeScale = this._clip.duration / duration;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\tsyncWith( action ) {\n\n\t\tthis.time = action.time;\n\t\tthis.timeScale = action.timeScale;\n\n\t\treturn this.stopWarping();\n\n\t}\n\n\thalt( duration ) {\n\n\t\treturn this.warp( this._effectiveTimeScale, 0, duration );\n\n\t}\n\n\twarp( startTimeScale, endTimeScale, duration ) {\n\n\t\tconst mixer = this._mixer,\n\t\t\tnow = mixer.time,\n\t\t\ttimeScale = this.timeScale;\n\n\t\tlet interpolant = this._timeScaleInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._timeScaleInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\ttimes[ 1 ] = now + duration;\n\n\t\tvalues[ 0 ] = startTimeScale / timeScale;\n\t\tvalues[ 1 ] = endTimeScale / timeScale;\n\n\t\treturn this;\n\n\t}\n\n\tstopWarping() {\n\n\t\tconst timeScaleInterpolant = this._timeScaleInterpolant;\n\n\t\tif ( timeScaleInterpolant !== null ) {\n\n\t\t\tthis._timeScaleInterpolant = null;\n\t\t\tthis._mixer._takeBackControlInterpolant( timeScaleInterpolant );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Object Accessors\n\n\tgetMixer() {\n\n\t\treturn this._mixer;\n\n\t}\n\n\tgetClip() {\n\n\t\treturn this._clip;\n\n\t}\n\n\tgetRoot() {\n\n\t\treturn this._localRoot || this._mixer._root;\n\n\t}\n\n\t// Interna\n\n\t_update( time, deltaTime, timeDirection, accuIndex ) {\n\n\t\t// called by the mixer\n\n\t\tif ( ! this.enabled ) {\n\n\t\t\t// call ._updateWeight() to update ._effectiveWeight\n\n\t\t\tthis._updateWeight( time );\n\t\t\treturn;\n\n\t\t}\n\n\t\tconst startTime = this._startTime;\n\n\t\tif ( startTime !== null ) {\n\n\t\t\t// check for scheduled start of action\n\n\t\t\tconst timeRunning = ( time - startTime ) * timeDirection;\n\t\t\tif ( timeRunning < 0 || timeDirection === 0 ) {\n\n\t\t\t\treturn; // yet to come / don't decide when delta = 0\n\n\t\t\t}\n\n\t\t\t// start\n\n\t\t\tthis._startTime = null; // unschedule\n\t\t\tdeltaTime = timeDirection * timeRunning;\n\n\t\t}\n\n\t\t// apply time scale and advance time\n\n\t\tdeltaTime *= this._updateTimeScale( time );\n\t\tconst clipTime = this._updateTime( deltaTime );\n\n\t\t// note: _updateTime may disable the action resulting in\n\t\t// an effective weight of 0\n\n\t\tconst weight = this._updateWeight( time );\n\n\t\tif ( weight > 0 ) {\n\n\t\t\tconst interpolants = this._interpolants;\n\t\t\tconst propertyMixers = this._propertyBindings;\n\n\t\t\tswitch ( this.blendMode ) {\n\n\t\t\t\tcase AdditiveAnimationBlendMode:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulateAdditive( weight );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase NormalAnimationBlendMode:\n\t\t\t\tdefault:\n\n\t\t\t\t\tfor ( let j = 0, m = interpolants.length; j !== m; ++ j ) {\n\n\t\t\t\t\t\tinterpolants[ j ].evaluate( clipTime );\n\t\t\t\t\t\tpropertyMixers[ j ].accumulate( accuIndex, weight );\n\n\t\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_updateWeight( time ) {\n\n\t\tlet weight = 0;\n\n\t\tif ( this.enabled ) {\n\n\t\t\tweight = this.weight;\n\t\t\tconst interpolant = this._weightInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\tweight *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopFading();\n\n\t\t\t\t\tif ( interpolantValue === 0 ) {\n\n\t\t\t\t\t\t// faded out, disable\n\t\t\t\t\t\tthis.enabled = false;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveWeight = weight;\n\t\treturn weight;\n\n\t}\n\n\t_updateTimeScale( time ) {\n\n\t\tlet timeScale = 0;\n\n\t\tif ( ! this.paused ) {\n\n\t\t\ttimeScale = this.timeScale;\n\n\t\t\tconst interpolant = this._timeScaleInterpolant;\n\n\t\t\tif ( interpolant !== null ) {\n\n\t\t\t\tconst interpolantValue = interpolant.evaluate( time )[ 0 ];\n\n\t\t\t\ttimeScale *= interpolantValue;\n\n\t\t\t\tif ( time > interpolant.parameterPositions[ 1 ] ) {\n\n\t\t\t\t\tthis.stopWarping();\n\n\t\t\t\t\tif ( timeScale === 0 ) {\n\n\t\t\t\t\t\t// motion has halted, pause\n\t\t\t\t\t\tthis.paused = true;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// warp done - apply final time scale\n\t\t\t\t\t\tthis.timeScale = timeScale;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tthis._effectiveTimeScale = timeScale;\n\t\treturn timeScale;\n\n\t}\n\n\t_updateTime( deltaTime ) {\n\n\t\tconst duration = this._clip.duration;\n\t\tconst loop = this.loop;\n\n\t\tlet time = this.time + deltaTime;\n\t\tlet loopCount = this._loopCount;\n\n\t\tconst pingPong = ( loop === LoopPingPong );\n\n\t\tif ( deltaTime === 0 ) {\n\n\t\t\tif ( loopCount === - 1 ) return time;\n\n\t\t\treturn ( pingPong && ( loopCount & 1 ) === 1 ) ? duration - time : time;\n\n\t\t}\n\n\t\tif ( loop === LoopOnce ) {\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tthis._loopCount = 0;\n\t\t\t\tthis._setEndings( true, true, false );\n\n\t\t\t}\n\n\t\t\thandle_stop: {\n\n\t\t\t\tif ( time >= duration ) {\n\n\t\t\t\t\ttime = duration;\n\n\t\t\t\t} else if ( time < 0 ) {\n\n\t\t\t\t\ttime = 0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tbreak handle_stop;\n\n\t\t\t\t}\n\n\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\telse this.enabled = false;\n\n\t\t\t\tthis.time = time;\n\n\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\tdirection: deltaTime < 0 ? - 1 : 1\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t} else { // repetitive Repeat or PingPong\n\n\t\t\tif ( loopCount === - 1 ) {\n\n\t\t\t\t// just started\n\n\t\t\t\tif ( deltaTime >= 0 ) {\n\n\t\t\t\t\tloopCount = 0;\n\n\t\t\t\t\tthis._setEndings( true, this.repetitions === 0, pingPong );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// when looping in reverse direction, the initial\n\t\t\t\t\t// transition through zero counts as a repetition,\n\t\t\t\t\t// so leave loopCount at -1\n\n\t\t\t\t\tthis._setEndings( this.repetitions === 0, true, pingPong );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif ( time >= duration || time < 0 ) {\n\n\t\t\t\t// wrap around\n\n\t\t\t\tconst loopDelta = Math.floor( time / duration ); // signed\n\t\t\t\ttime -= duration * loopDelta;\n\n\t\t\t\tloopCount += Math.abs( loopDelta );\n\n\t\t\t\tconst pending = this.repetitions - loopCount;\n\n\t\t\t\tif ( pending <= 0 ) {\n\n\t\t\t\t\t// have to stop (switch state, clamp time, fire event)\n\n\t\t\t\t\tif ( this.clampWhenFinished ) this.paused = true;\n\t\t\t\t\telse this.enabled = false;\n\n\t\t\t\t\ttime = deltaTime > 0 ? duration : 0;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'finished', action: this,\n\t\t\t\t\t\tdirection: deltaTime > 0 ? 1 : - 1\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// keep running\n\n\t\t\t\t\tif ( pending === 1 ) {\n\n\t\t\t\t\t\t// entering the last round\n\n\t\t\t\t\t\tconst atStart = deltaTime < 0;\n\t\t\t\t\t\tthis._setEndings( atStart, ! atStart, pingPong );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tthis._setEndings( false, false, pingPong );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._loopCount = loopCount;\n\n\t\t\t\t\tthis.time = time;\n\n\t\t\t\t\tthis._mixer.dispatchEvent( {\n\t\t\t\t\t\ttype: 'loop', action: this, loopDelta: loopDelta\n\t\t\t\t\t} );\n\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tthis.time = time;\n\n\t\t\t}\n\n\t\t\tif ( pingPong && ( loopCount & 1 ) === 1 ) {\n\n\t\t\t\t// invert time for the \"pong round\"\n\n\t\t\t\treturn duration - time;\n\n\t\t\t}\n\n\t\t}\n\n\t\treturn time;\n\n\t}\n\n\t_setEndings( atStart, atEnd, pingPong ) {\n\n\t\tconst settings = this._interpolantSettings;\n\n\t\tif ( pingPong ) {\n\n\t\t\tsettings.endingStart = ZeroSlopeEnding;\n\t\t\tsettings.endingEnd = ZeroSlopeEnding;\n\n\t\t} else {\n\n\t\t\t// assuming for LoopOnce atStart == atEnd == true\n\n\t\t\tif ( atStart ) {\n\n\t\t\t\tsettings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingStart = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t\tif ( atEnd ) {\n\n\t\t\t\tsettings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;\n\n\t\t\t} else {\n\n\t\t\t\tsettings.endingEnd \t = WrapAroundEnding;\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_scheduleFading( duration, weightNow, weightThen ) {\n\n\t\tconst mixer = this._mixer, now = mixer.time;\n\t\tlet interpolant = this._weightInterpolant;\n\n\t\tif ( interpolant === null ) {\n\n\t\t\tinterpolant = mixer._lendControlInterpolant();\n\t\t\tthis._weightInterpolant = interpolant;\n\n\t\t}\n\n\t\tconst times = interpolant.parameterPositions,\n\t\t\tvalues = interpolant.sampleValues;\n\n\t\ttimes[ 0 ] = now;\n\t\tvalues[ 0 ] = weightNow;\n\t\ttimes[ 1 ] = now + duration;\n\t\tvalues[ 1 ] = weightThen;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass AnimationMixer extends EventDispatcher {\n\n\tconstructor( root ) {\n\n\t\tsuper();\n\n\t\tthis._root = root;\n\t\tthis._initMemoryManager();\n\t\tthis._accuIndex = 0;\n\t\tthis.time = 0;\n\t\tthis.timeScale = 1.0;\n\n\t}\n\n\t_bindAction( action, prototypeAction ) {\n\n\t\tconst root = action._localRoot || this._root,\n\t\t\ttracks = action._clip.tracks,\n\t\t\tnTracks = tracks.length,\n\t\t\tbindings = action._propertyBindings,\n\t\t\tinterpolants = action._interpolants,\n\t\t\trootUuid = root.uuid,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName;\n\n\t\tlet bindingsByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingsByName === undefined ) {\n\n\t\t\tbindingsByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingsByName;\n\n\t\t}\n\n\t\tfor ( let i = 0; i !== nTracks; ++ i ) {\n\n\t\t\tconst track = tracks[ i ],\n\t\t\t\ttrackName = track.name;\n\n\t\t\tlet binding = bindingsByName[ trackName ];\n\n\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t} else {\n\n\t\t\t\tbinding = bindings[ i ];\n\n\t\t\t\tif ( binding !== undefined ) {\n\n\t\t\t\t\t// existing binding, make sure the cache knows\n\n\t\t\t\t\tif ( binding._cacheIndex === null ) {\n\n\t\t\t\t\t\t++ binding.referenceCount;\n\t\t\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\n\t\t\t\t}\n\n\t\t\t\tconst path = prototypeAction && prototypeAction.\n\t\t\t\t\t_propertyBindings[ i ].binding.parsedPath;\n\n\t\t\t\tbinding = new PropertyMixer(\n\t\t\t\t\tPropertyBinding.create( root, trackName, path ),\n\t\t\t\t\ttrack.ValueTypeName, track.getValueSize() );\n\n\t\t\t\t++ binding.referenceCount;\n\t\t\t\tthis._addInactiveBinding( binding, rootUuid, trackName );\n\n\t\t\t\tbindings[ i ] = binding;\n\n\t\t\t}\n\n\t\t\tinterpolants[ i ].resultBuffer = binding.buffer;\n\n\t\t}\n\n\t}\n\n\t_activateAction( action ) {\n\n\t\tif ( ! this._isActiveAction( action ) ) {\n\n\t\t\tif ( action._cacheIndex === null ) {\n\n\t\t\t\t// this action has been forgotten by the cache, but the user\n\t\t\t\t// appears to be still using it -> rebind\n\n\t\t\t\tconst rootUuid = ( action._localRoot || this._root ).uuid,\n\t\t\t\t\tclipUuid = action._clip.uuid,\n\t\t\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\t\t\tthis._bindAction( action,\n\t\t\t\t\tactionsForClip && actionsForClip.knownActions[ 0 ] );\n\n\t\t\t\tthis._addInactiveAction( action, clipUuid, rootUuid );\n\n\t\t\t}\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// increment reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( binding.useCount ++ === 0 ) {\n\n\t\t\t\t\tthis._lendBinding( binding );\n\t\t\t\t\tbinding.saveOriginalState();\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._lendAction( action );\n\n\t\t}\n\n\t}\n\n\t_deactivateAction( action ) {\n\n\t\tif ( this._isActiveAction( action ) ) {\n\n\t\t\tconst bindings = action._propertyBindings;\n\n\t\t\t// decrement reference counts / sort out state\n\t\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\t\tconst binding = bindings[ i ];\n\n\t\t\t\tif ( -- binding.useCount === 0 ) {\n\n\t\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\t\tthis._takeBackBinding( binding );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tthis._takeBackAction( action );\n\n\t\t}\n\n\t}\n\n\t// Memory manager\n\n\t_initMemoryManager() {\n\n\t\tthis._actions = []; // 'nActiveActions' followed by inactive ones\n\t\tthis._nActiveActions = 0;\n\n\t\tthis._actionsByClip = {};\n\t\t// inside:\n\t\t// {\n\t\t// \tknownActions: Array< AnimationAction > - used as prototypes\n\t\t// \tactionByRoot: AnimationAction - lookup\n\t\t// }\n\n\n\t\tthis._bindings = []; // 'nActiveBindings' followed by inactive ones\n\t\tthis._nActiveBindings = 0;\n\n\t\tthis._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >\n\n\n\t\tthis._controlInterpolants = []; // same game as above\n\t\tthis._nActiveControlInterpolants = 0;\n\n\t\tconst scope = this;\n\n\t\tthis.stats = {\n\n\t\t\tactions: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._actions.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveActions;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tbindings: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._bindings.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveBindings;\n\n\t\t\t\t}\n\t\t\t},\n\t\t\tcontrolInterpolants: {\n\t\t\t\tget total() {\n\n\t\t\t\t\treturn scope._controlInterpolants.length;\n\n\t\t\t\t},\n\t\t\t\tget inUse() {\n\n\t\t\t\t\treturn scope._nActiveControlInterpolants;\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t};\n\n\t}\n\n\t// Memory management for AnimationAction objects\n\n\t_isActiveAction( action ) {\n\n\t\tconst index = action._cacheIndex;\n\t\treturn index !== null && index < this._nActiveActions;\n\n\t}\n\n\t_addInactiveAction( action, clipUuid, rootUuid ) {\n\n\t\tconst actions = this._actions,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tlet actionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip === undefined ) {\n\n\t\t\tactionsForClip = {\n\n\t\t\t\tknownActions: [ action ],\n\t\t\t\tactionByRoot: {}\n\n\t\t\t};\n\n\t\t\taction._byClipCacheIndex = 0;\n\n\t\t\tactionsByClip[ clipUuid ] = actionsForClip;\n\n\t\t} else {\n\n\t\t\tconst knownActions = actionsForClip.knownActions;\n\n\t\t\taction._byClipCacheIndex = knownActions.length;\n\t\t\tknownActions.push( action );\n\n\t\t}\n\n\t\taction._cacheIndex = actions.length;\n\t\tactions.push( action );\n\n\t\tactionsForClip.actionByRoot[ rootUuid ] = action;\n\n\t}\n\n\t_removeInactiveAction( action ) {\n\n\t\tconst actions = this._actions,\n\t\t\tlastInactiveAction = actions[ actions.length - 1 ],\n\t\t\tcacheIndex = action._cacheIndex;\n\n\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\tactions.pop();\n\n\t\taction._cacheIndex = null;\n\n\n\t\tconst clipUuid = action._clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ],\n\t\t\tknownActionsForClip = actionsForClip.knownActions,\n\n\t\t\tlastKnownAction =\n\t\t\t\tknownActionsForClip[ knownActionsForClip.length - 1 ],\n\n\t\t\tbyClipCacheIndex = action._byClipCacheIndex;\n\n\t\tlastKnownAction._byClipCacheIndex = byClipCacheIndex;\n\t\tknownActionsForClip[ byClipCacheIndex ] = lastKnownAction;\n\t\tknownActionsForClip.pop();\n\n\t\taction._byClipCacheIndex = null;\n\n\n\t\tconst actionByRoot = actionsForClip.actionByRoot,\n\t\t\trootUuid = ( action._localRoot || this._root ).uuid;\n\n\t\tdelete actionByRoot[ rootUuid ];\n\n\t\tif ( knownActionsForClip.length === 0 ) {\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t\tthis._removeInactiveBindingsForAction( action );\n\n\t}\n\n\t_removeInactiveBindingsForAction( action ) {\n\n\t\tconst bindings = action._propertyBindings;\n\n\t\tfor ( let i = 0, n = bindings.length; i !== n; ++ i ) {\n\n\t\t\tconst binding = bindings[ i ];\n\n\t\t\tif ( -- binding.referenceCount === 0 ) {\n\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t_lendAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions >| inactive actions ]\n\t\t// s a\n\t\t// <-swap->\n\t\t// a s\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveActions ++,\n\n\t\t\tfirstInactiveAction = actions[ lastActiveIndex ];\n\n\t\taction._cacheIndex = lastActiveIndex;\n\t\tactions[ lastActiveIndex ] = action;\n\n\t\tfirstInactiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = firstInactiveAction;\n\n\t}\n\n\t_takeBackAction( action ) {\n\n\t\t// [ active actions | inactive actions ]\n\t\t// [ active actions |< inactive actions ]\n\t\t// a s\n\t\t// <-swap->\n\t\t// s a\n\n\t\tconst actions = this._actions,\n\t\t\tprevIndex = action._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveActions,\n\n\t\t\tlastActiveAction = actions[ firstInactiveIndex ];\n\n\t\taction._cacheIndex = firstInactiveIndex;\n\t\tactions[ firstInactiveIndex ] = action;\n\n\t\tlastActiveAction._cacheIndex = prevIndex;\n\t\tactions[ prevIndex ] = lastActiveAction;\n\n\t}\n\n\t// Memory management for PropertyMixer objects\n\n\t_addInactiveBinding( binding, rootUuid, trackName ) {\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindings = this._bindings;\n\n\t\tlet bindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName === undefined ) {\n\n\t\t\tbindingByName = {};\n\t\t\tbindingsByRoot[ rootUuid ] = bindingByName;\n\n\t\t}\n\n\t\tbindingByName[ trackName ] = binding;\n\n\t\tbinding._cacheIndex = bindings.length;\n\t\tbindings.push( binding );\n\n\t}\n\n\t_removeInactiveBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tpropBinding = binding.binding,\n\t\t\trootUuid = propBinding.rootNode.uuid,\n\t\t\ttrackName = propBinding.path,\n\t\t\tbindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ],\n\n\t\t\tlastInactiveBinding = bindings[ bindings.length - 1 ],\n\t\t\tcacheIndex = binding._cacheIndex;\n\n\t\tlastInactiveBinding._cacheIndex = cacheIndex;\n\t\tbindings[ cacheIndex ] = lastInactiveBinding;\n\t\tbindings.pop();\n\n\t\tdelete bindingByName[ trackName ];\n\n\t\tif ( Object.keys( bindingByName ).length === 0 ) {\n\n\t\t\tdelete bindingsByRoot[ rootUuid ];\n\n\t\t}\n\n\t}\n\n\t_lendBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tlastActiveIndex = this._nActiveBindings ++,\n\n\t\t\tfirstInactiveBinding = bindings[ lastActiveIndex ];\n\n\t\tbinding._cacheIndex = lastActiveIndex;\n\t\tbindings[ lastActiveIndex ] = binding;\n\n\t\tfirstInactiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = firstInactiveBinding;\n\n\t}\n\n\t_takeBackBinding( binding ) {\n\n\t\tconst bindings = this._bindings,\n\t\t\tprevIndex = binding._cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveBindings,\n\n\t\t\tlastActiveBinding = bindings[ firstInactiveIndex ];\n\n\t\tbinding._cacheIndex = firstInactiveIndex;\n\t\tbindings[ firstInactiveIndex ] = binding;\n\n\t\tlastActiveBinding._cacheIndex = prevIndex;\n\t\tbindings[ prevIndex ] = lastActiveBinding;\n\n\t}\n\n\n\t// Memory management of Interpolants for weight and time scale\n\n\t_lendControlInterpolant() {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tlastActiveIndex = this._nActiveControlInterpolants ++;\n\n\t\tlet interpolant = interpolants[ lastActiveIndex ];\n\n\t\tif ( interpolant === undefined ) {\n\n\t\t\tinterpolant = new LinearInterpolant(\n\t\t\t\tnew Float32Array( 2 ), new Float32Array( 2 ),\n\t\t\t\t1, this._controlInterpolantsResultBuffer );\n\n\t\t\tinterpolant.__cacheIndex = lastActiveIndex;\n\t\t\tinterpolants[ lastActiveIndex ] = interpolant;\n\n\t\t}\n\n\t\treturn interpolant;\n\n\t}\n\n\t_takeBackControlInterpolant( interpolant ) {\n\n\t\tconst interpolants = this._controlInterpolants,\n\t\t\tprevIndex = interpolant.__cacheIndex,\n\n\t\t\tfirstInactiveIndex = -- this._nActiveControlInterpolants,\n\n\t\t\tlastActiveInterpolant = interpolants[ firstInactiveIndex ];\n\n\t\tinterpolant.__cacheIndex = firstInactiveIndex;\n\t\tinterpolants[ firstInactiveIndex ] = interpolant;\n\n\t\tlastActiveInterpolant.__cacheIndex = prevIndex;\n\t\tinterpolants[ prevIndex ] = lastActiveInterpolant;\n\n\t}\n\n\t// return an action for a clip optionally using a custom root target\n\t// object (this method allocates a lot of dynamic memory in case a\n\t// previously unknown clip/root combination is specified)\n\tclipAction( clip, optionalRoot, blendMode ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid;\n\n\t\tlet clipObject = typeof clip === 'string' ? AnimationClip.findByName( root, clip ) : clip;\n\n\t\tconst clipUuid = clipObject !== null ? clipObject.uuid : clip;\n\n\t\tconst actionsForClip = this._actionsByClip[ clipUuid ];\n\t\tlet prototypeAction = null;\n\n\t\tif ( blendMode === undefined ) {\n\n\t\t\tif ( clipObject !== null ) {\n\n\t\t\t\tblendMode = clipObject.blendMode;\n\n\t\t\t} else {\n\n\t\t\t\tblendMode = NormalAnimationBlendMode;\n\n\t\t\t}\n\n\t\t}\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\tconst existingAction = actionsForClip.actionByRoot[ rootUuid ];\n\n\t\t\tif ( existingAction !== undefined && existingAction.blendMode === blendMode ) {\n\n\t\t\t\treturn existingAction;\n\n\t\t\t}\n\n\t\t\t// we know the clip, so we don't have to parse all\n\t\t\t// the bindings again but can just copy\n\t\t\tprototypeAction = actionsForClip.knownActions[ 0 ];\n\n\t\t\t// also, take the clip from the prototype action\n\t\t\tif ( clipObject === null )\n\t\t\t\tclipObject = prototypeAction._clip;\n\n\t\t}\n\n\t\t// clip must be known when specified via string\n\t\tif ( clipObject === null ) return null;\n\n\t\t// allocate all resources required to run it\n\t\tconst newAction = new AnimationAction( this, clipObject, optionalRoot, blendMode );\n\n\t\tthis._bindAction( newAction, prototypeAction );\n\n\t\t// and make the action known to the memory manager\n\t\tthis._addInactiveAction( newAction, clipUuid, rootUuid );\n\n\t\treturn newAction;\n\n\t}\n\n\t// get an existing action\n\texistingAction( clip, optionalRoot ) {\n\n\t\tconst root = optionalRoot || this._root,\n\t\t\trootUuid = root.uuid,\n\n\t\t\tclipObject = typeof clip === 'string' ?\n\t\t\t\tAnimationClip.findByName( root, clip ) : clip,\n\n\t\t\tclipUuid = clipObject ? clipObject.uuid : clip,\n\n\t\t\tactionsForClip = this._actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\treturn actionsForClip.actionByRoot[ rootUuid ] || null;\n\n\t\t}\n\n\t\treturn null;\n\n\t}\n\n\t// deactivates all previously scheduled actions\n\tstopAllAction() {\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions;\n\n\t\tfor ( let i = nActions - 1; i >= 0; -- i ) {\n\n\t\t\tactions[ i ].stop();\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// advance the time and update apply the animation\n\tupdate( deltaTime ) {\n\n\t\tdeltaTime *= this.timeScale;\n\n\t\tconst actions = this._actions,\n\t\t\tnActions = this._nActiveActions,\n\n\t\t\ttime = this.time += deltaTime,\n\t\t\ttimeDirection = Math.sign( deltaTime ),\n\n\t\t\taccuIndex = this._accuIndex ^= 1;\n\n\t\t// run active actions\n\n\t\tfor ( let i = 0; i !== nActions; ++ i ) {\n\n\t\t\tconst action = actions[ i ];\n\n\t\t\taction._update( time, deltaTime, timeDirection, accuIndex );\n\n\t\t}\n\n\t\t// update scene graph\n\n\t\tconst bindings = this._bindings,\n\t\t\tnBindings = this._nActiveBindings;\n\n\t\tfor ( let i = 0; i !== nBindings; ++ i ) {\n\n\t\t\tbindings[ i ].apply( accuIndex );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\t// Allows you to seek to a specific time in an animation.\n\tsetTime( timeInSeconds ) {\n\n\t\tthis.time = 0; // Zero out time attribute for AnimationMixer object;\n\t\tfor ( let i = 0; i < this._actions.length; i ++ ) {\n\n\t\t\tthis._actions[ i ].time = 0; // Zero out time attribute for all associated AnimationAction objects.\n\n\t\t}\n\n\t\treturn this.update( timeInSeconds ); // Update used to set exact time. Returns \"this\" AnimationMixer object.\n\n\t}\n\n\t// return this mixer's root target object\n\tgetRoot() {\n\n\t\treturn this._root;\n\n\t}\n\n\t// free all resources specific to a particular clip\n\tuncacheClip( clip ) {\n\n\t\tconst actions = this._actions,\n\t\t\tclipUuid = clip.uuid,\n\t\t\tactionsByClip = this._actionsByClip,\n\t\t\tactionsForClip = actionsByClip[ clipUuid ];\n\n\t\tif ( actionsForClip !== undefined ) {\n\n\t\t\t// note: just calling _removeInactiveAction would mess up the\n\t\t\t// iteration state and also require updating the state we can\n\t\t\t// just throw away\n\n\t\t\tconst actionsToRemove = actionsForClip.knownActions;\n\n\t\t\tfor ( let i = 0, n = actionsToRemove.length; i !== n; ++ i ) {\n\n\t\t\t\tconst action = actionsToRemove[ i ];\n\n\t\t\t\tthis._deactivateAction( action );\n\n\t\t\t\tconst cacheIndex = action._cacheIndex,\n\t\t\t\t\tlastInactiveAction = actions[ actions.length - 1 ];\n\n\t\t\t\taction._cacheIndex = null;\n\t\t\t\taction._byClipCacheIndex = null;\n\n\t\t\t\tlastInactiveAction._cacheIndex = cacheIndex;\n\t\t\t\tactions[ cacheIndex ] = lastInactiveAction;\n\t\t\t\tactions.pop();\n\n\t\t\t\tthis._removeInactiveBindingsForAction( action );\n\n\t\t\t}\n\n\t\t\tdelete actionsByClip[ clipUuid ];\n\n\t\t}\n\n\t}\n\n\t// free all resources specific to a particular root target object\n\tuncacheRoot( root ) {\n\n\t\tconst rootUuid = root.uuid,\n\t\t\tactionsByClip = this._actionsByClip;\n\n\t\tfor ( const clipUuid in actionsByClip ) {\n\n\t\t\tconst actionByRoot = actionsByClip[ clipUuid ].actionByRoot,\n\t\t\t\taction = actionByRoot[ rootUuid ];\n\n\t\t\tif ( action !== undefined ) {\n\n\t\t\t\tthis._deactivateAction( action );\n\t\t\t\tthis._removeInactiveAction( action );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst bindingsByRoot = this._bindingsByRootAndName,\n\t\t\tbindingByName = bindingsByRoot[ rootUuid ];\n\n\t\tif ( bindingByName !== undefined ) {\n\n\t\t\tfor ( const trackName in bindingByName ) {\n\n\t\t\t\tconst binding = bindingByName[ trackName ];\n\t\t\t\tbinding.restoreOriginalState();\n\t\t\t\tthis._removeInactiveBinding( binding );\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t// remove a targeted clip from the cache\n\tuncacheAction( clip, optionalRoot ) {\n\n\t\tconst action = this.existingAction( clip, optionalRoot );\n\n\t\tif ( action !== null ) {\n\n\t\t\tthis._deactivateAction( action );\n\t\t\tthis._removeInactiveAction( action );\n\n\t\t}\n\n\t}\n\n}\n\nAnimationMixer.prototype._controlInterpolantsResultBuffer = new Float32Array( 1 );\n\nclass Uniform {\n\n\tconstructor( value ) {\n\n\t\tif ( typeof value === 'string' ) {\n\n\t\t\tconsole.warn( 'THREE.Uniform: Type parameter is no longer needed.' );\n\t\t\tvalue = arguments[ 1 ];\n\n\t\t}\n\n\t\tthis.value = value;\n\n\t}\n\n\tclone() {\n\n\t\treturn new Uniform( this.value.clone === undefined ? this.value : this.value.clone() );\n\n\t}\n\n}\n\nclass InstancedInterleavedBuffer extends InterleavedBuffer {\n\n\tconstructor( array, stride, meshPerAttribute = 1 ) {\n\n\t\tsuper( array, stride );\n\n\t\tthis.meshPerAttribute = meshPerAttribute;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source );\n\n\t\tthis.meshPerAttribute = source.meshPerAttribute;\n\n\t\treturn this;\n\n\t}\n\n\tclone( data ) {\n\n\t\tconst ib = super.clone( data );\n\n\t\tib.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn ib;\n\n\t}\n\n\ttoJSON( data ) {\n\n\t\tconst json = super.toJSON( data );\n\n\t\tjson.isInstancedInterleavedBuffer = true;\n\t\tjson.meshPerAttribute = this.meshPerAttribute;\n\n\t\treturn json;\n\n\t}\n\n}\n\nInstancedInterleavedBuffer.prototype.isInstancedInterleavedBuffer = true;\n\nclass GLBufferAttribute {\n\n\tconstructor( buffer, type, itemSize, elementSize, count ) {\n\n\t\tthis.buffer = buffer;\n\t\tthis.type = type;\n\t\tthis.itemSize = itemSize;\n\t\tthis.elementSize = elementSize;\n\t\tthis.count = count;\n\n\t\tthis.version = 0;\n\n\t}\n\n\tset needsUpdate( value ) {\n\n\t\tif ( value === true ) this.version ++;\n\n\t}\n\n\tsetBuffer( buffer ) {\n\n\t\tthis.buffer = buffer;\n\n\t\treturn this;\n\n\t}\n\n\tsetType( type, elementSize ) {\n\n\t\tthis.type = type;\n\t\tthis.elementSize = elementSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetItemSize( itemSize ) {\n\n\t\tthis.itemSize = itemSize;\n\n\t\treturn this;\n\n\t}\n\n\tsetCount( count ) {\n\n\t\tthis.count = count;\n\n\t\treturn this;\n\n\t}\n\n}\n\nGLBufferAttribute.prototype.isGLBufferAttribute = true;\n\nclass Raycaster {\n\n\tconstructor( origin, direction, near = 0, far = Infinity ) {\n\n\t\tthis.ray = new Ray( origin, direction );\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.near = near;\n\t\tthis.far = far;\n\t\tthis.camera = null;\n\t\tthis.layers = new Layers();\n\n\t\tthis.params = {\n\t\t\tMesh: {},\n\t\t\tLine: { threshold: 1 },\n\t\t\tLOD: {},\n\t\t\tPoints: { threshold: 1 },\n\t\t\tSprite: {}\n\t\t};\n\n\t}\n\n\tset( origin, direction ) {\n\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\n\n\t\tthis.ray.set( origin, direction );\n\n\t}\n\n\tsetFromCamera( coords, camera ) {\n\n\t\tif ( camera && camera.isPerspectiveCamera ) {\n\n\t\t\tthis.ray.origin.setFromMatrixPosition( camera.matrixWorld );\n\t\t\tthis.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();\n\t\t\tthis.camera = camera;\n\n\t\t} else if ( camera && camera.isOrthographicCamera ) {\n\n\t\t\tthis.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera\n\t\t\tthis.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );\n\t\t\tthis.camera = camera;\n\n\t\t} else {\n\n\t\t\tconsole.error( 'THREE.Raycaster: Unsupported camera type: ' + camera.type );\n\n\t\t}\n\n\t}\n\n\tintersectObject( object, recursive = true, intersects = [] ) {\n\n\t\tintersectObject( object, this, intersects, recursive );\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n\tintersectObjects( objects, recursive = true, intersects = [] ) {\n\n\t\tfor ( let i = 0, l = objects.length; i < l; i ++ ) {\n\n\t\t\tintersectObject( objects[ i ], this, intersects, recursive );\n\n\t\t}\n\n\t\tintersects.sort( ascSort );\n\n\t\treturn intersects;\n\n\t}\n\n}\n\nfunction ascSort( a, b ) {\n\n\treturn a.distance - b.distance;\n\n}\n\nfunction intersectObject( object, raycaster, intersects, recursive ) {\n\n\tif ( object.layers.test( raycaster.layers ) ) {\n\n\t\tobject.raycast( raycaster, intersects );\n\n\t}\n\n\tif ( recursive === true ) {\n\n\t\tconst children = object.children;\n\n\t\tfor ( let i = 0, l = children.length; i < l; i ++ ) {\n\n\t\t\tintersectObject( children[ i ], raycaster, intersects, true );\n\n\t\t}\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system\n *\n * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.\n * The azimuthal angle (theta) is measured from the positive z-axis.\n */\n\nclass Spherical {\n\n\tconstructor( radius = 1, phi = 0, theta = 0 ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi; // polar angle\n\t\tthis.theta = theta; // azimuthal angle\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, phi, theta ) {\n\n\t\tthis.radius = radius;\n\t\tthis.phi = phi;\n\t\tthis.theta = theta;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.phi = other.phi;\n\t\tthis.theta = other.theta;\n\n\t\treturn this;\n\n\t}\n\n\t// restrict phi to be betwee EPS and PI-EPS\n\tmakeSafe() {\n\n\t\tconst EPS = 0.000001;\n\t\tthis.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + y * y + z * z );\n\n\t\tif ( this.radius === 0 ) {\n\n\t\t\tthis.theta = 0;\n\t\t\tthis.phi = 0;\n\n\t\t} else {\n\n\t\t\tthis.theta = Math.atan2( x, z );\n\t\t\tthis.phi = Math.acos( clamp( y / this.radius, - 1, 1 ) );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system\n */\n\nclass Cylindrical {\n\n\tconstructor( radius = 1, theta = 0, y = 0 ) {\n\n\t\tthis.radius = radius; // distance from the origin to a point in the x-z plane\n\t\tthis.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\n\t\tthis.y = y; // height above the x-z plane\n\n\t\treturn this;\n\n\t}\n\n\tset( radius, theta, y ) {\n\n\t\tthis.radius = radius;\n\t\tthis.theta = theta;\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tcopy( other ) {\n\n\t\tthis.radius = other.radius;\n\t\tthis.theta = other.theta;\n\t\tthis.y = other.y;\n\n\t\treturn this;\n\n\t}\n\n\tsetFromVector3( v ) {\n\n\t\treturn this.setFromCartesianCoords( v.x, v.y, v.z );\n\n\t}\n\n\tsetFromCartesianCoords( x, y, z ) {\n\n\t\tthis.radius = Math.sqrt( x * x + z * z );\n\t\tthis.theta = Math.atan2( x, z );\n\t\tthis.y = y;\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$4 = /*@__PURE__*/ new Vector2();\n\nclass Box2 {\n\n\tconstructor( min = new Vector2( + Infinity, + Infinity ), max = new Vector2( - Infinity, - Infinity ) ) {\n\n\t\tthis.min = min;\n\t\tthis.max = max;\n\n\t}\n\n\tset( min, max ) {\n\n\t\tthis.min.copy( min );\n\t\tthis.max.copy( max );\n\n\t\treturn this;\n\n\t}\n\n\tsetFromPoints( points ) {\n\n\t\tthis.makeEmpty();\n\n\t\tfor ( let i = 0, il = points.length; i < il; i ++ ) {\n\n\t\t\tthis.expandByPoint( points[ i ] );\n\n\t\t}\n\n\t\treturn this;\n\n\t}\n\n\tsetFromCenterAndSize( center, size ) {\n\n\t\tconst halfSize = _vector$4.copy( size ).multiplyScalar( 0.5 );\n\t\tthis.min.copy( center ).sub( halfSize );\n\t\tthis.max.copy( center ).add( halfSize );\n\n\t\treturn this;\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n\tcopy( box ) {\n\n\t\tthis.min.copy( box.min );\n\t\tthis.max.copy( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tmakeEmpty() {\n\n\t\tthis.min.x = this.min.y = + Infinity;\n\t\tthis.max.x = this.max.y = - Infinity;\n\n\t\treturn this;\n\n\t}\n\n\tisEmpty() {\n\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\n\n\t}\n\n\tgetSize( target ) {\n\n\t\treturn this.isEmpty() ? target.set( 0, 0 ) : target.subVectors( this.max, this.min );\n\n\t}\n\n\texpandByPoint( point ) {\n\n\t\tthis.min.min( point );\n\t\tthis.max.max( point );\n\n\t\treturn this;\n\n\t}\n\n\texpandByVector( vector ) {\n\n\t\tthis.min.sub( vector );\n\t\tthis.max.add( vector );\n\n\t\treturn this;\n\n\t}\n\n\texpandByScalar( scalar ) {\n\n\t\tthis.min.addScalar( - scalar );\n\t\tthis.max.addScalar( scalar );\n\n\t\treturn this;\n\n\t}\n\n\tcontainsPoint( point ) {\n\n\t\treturn point.x < this.min.x || point.x > this.max.x ||\n\t\t\tpoint.y < this.min.y || point.y > this.max.y ? false : true;\n\n\t}\n\n\tcontainsBox( box ) {\n\n\t\treturn this.min.x <= box.min.x && box.max.x <= this.max.x &&\n\t\t\tthis.min.y <= box.min.y && box.max.y <= this.max.y;\n\n\t}\n\n\tgetParameter( point, target ) {\n\n\t\t// This can potentially have a divide by zero if the box\n\t\t// has a size dimension of 0.\n\n\t\treturn target.set(\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y )\n\t\t);\n\n\t}\n\n\tintersectsBox( box ) {\n\n\t\t// using 4 splitting planes to rule out intersections\n\n\t\treturn box.max.x < this.min.x || box.min.x > this.max.x ||\n\t\t\tbox.max.y < this.min.y || box.min.y > this.max.y ? false : true;\n\n\t}\n\n\tclampPoint( point, target ) {\n\n\t\treturn target.copy( point ).clamp( this.min, this.max );\n\n\t}\n\n\tdistanceToPoint( point ) {\n\n\t\tconst clampedPoint = _vector$4.copy( point ).clamp( this.min, this.max );\n\t\treturn clampedPoint.sub( point ).length();\n\n\t}\n\n\tintersect( box ) {\n\n\t\tthis.min.max( box.min );\n\t\tthis.max.min( box.max );\n\n\t\treturn this;\n\n\t}\n\n\tunion( box ) {\n\n\t\tthis.min.min( box.min );\n\t\tthis.max.max( box.max );\n\n\t\treturn this;\n\n\t}\n\n\ttranslate( offset ) {\n\n\t\tthis.min.add( offset );\n\t\tthis.max.add( offset );\n\n\t\treturn this;\n\n\t}\n\n\tequals( box ) {\n\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\n\n\t}\n\n}\n\nBox2.prototype.isBox2 = true;\n\nconst _startP = /*@__PURE__*/ new Vector3();\nconst _startEnd = /*@__PURE__*/ new Vector3();\n\nclass Line3 {\n\n\tconstructor( start = new Vector3(), end = new Vector3() ) {\n\n\t\tthis.start = start;\n\t\tthis.end = end;\n\n\t}\n\n\tset( start, end ) {\n\n\t\tthis.start.copy( start );\n\t\tthis.end.copy( end );\n\n\t\treturn this;\n\n\t}\n\n\tcopy( line ) {\n\n\t\tthis.start.copy( line.start );\n\t\tthis.end.copy( line.end );\n\n\t\treturn this;\n\n\t}\n\n\tgetCenter( target ) {\n\n\t\treturn target.addVectors( this.start, this.end ).multiplyScalar( 0.5 );\n\n\t}\n\n\tdelta( target ) {\n\n\t\treturn target.subVectors( this.end, this.start );\n\n\t}\n\n\tdistanceSq() {\n\n\t\treturn this.start.distanceToSquared( this.end );\n\n\t}\n\n\tdistance() {\n\n\t\treturn this.start.distanceTo( this.end );\n\n\t}\n\n\tat( t, target ) {\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tclosestPointToPointParameter( point, clampToLine ) {\n\n\t\t_startP.subVectors( point, this.start );\n\t\t_startEnd.subVectors( this.end, this.start );\n\n\t\tconst startEnd2 = _startEnd.dot( _startEnd );\n\t\tconst startEnd_startP = _startEnd.dot( _startP );\n\n\t\tlet t = startEnd_startP / startEnd2;\n\n\t\tif ( clampToLine ) {\n\n\t\t\tt = clamp( t, 0, 1 );\n\n\t\t}\n\n\t\treturn t;\n\n\t}\n\n\tclosestPointToPoint( point, clampToLine, target ) {\n\n\t\tconst t = this.closestPointToPointParameter( point, clampToLine );\n\n\t\treturn this.delta( target ).multiplyScalar( t ).add( this.start );\n\n\t}\n\n\tapplyMatrix4( matrix ) {\n\n\t\tthis.start.applyMatrix4( matrix );\n\t\tthis.end.applyMatrix4( matrix );\n\n\t\treturn this;\n\n\t}\n\n\tequals( line ) {\n\n\t\treturn line.start.equals( this.start ) && line.end.equals( this.end );\n\n\t}\n\n\tclone() {\n\n\t\treturn new this.constructor().copy( this );\n\n\t}\n\n}\n\nconst _vector$3 = /*@__PURE__*/ new Vector3();\n\nclass SpotLightHelper extends Object3D {\n\n\tconstructor( light, color ) {\n\n\t\tsuper();\n\t\tthis.light = light;\n\t\tthis.light.updateMatrixWorld();\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst positions = [\n\t\t\t0, 0, 0, \t0, 0, 1,\n\t\t\t0, 0, 0, \t1, 0, 1,\n\t\t\t0, 0, 0,\t- 1, 0, 1,\n\t\t\t0, 0, 0, \t0, 1, 1,\n\t\t\t0, 0, 0, \t0, - 1, 1\n\t\t];\n\n\t\tfor ( let i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {\n\n\t\t\tconst p1 = ( i / l ) * Math.PI * 2;\n\t\t\tconst p2 = ( j / l ) * Math.PI * 2;\n\n\t\t\tpositions.push(\n\t\t\t\tMath.cos( p1 ), Math.sin( p1 ), 1,\n\t\t\t\tMath.cos( p2 ), Math.sin( p2 ), 1\n\t\t\t);\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.cone = new LineSegments( geometry, material );\n\t\tthis.add( this.cone );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.cone.geometry.dispose();\n\t\tthis.cone.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tthis.light.updateMatrixWorld();\n\n\t\tconst coneLength = this.light.distance ? this.light.distance : 1000;\n\t\tconst coneWidth = coneLength * Math.tan( this.light.angle );\n\n\t\tthis.cone.scale.set( coneWidth, coneWidth, coneLength );\n\n\t\t_vector$3.setFromMatrixPosition( this.light.target.matrixWorld );\n\n\t\tthis.cone.lookAt( _vector$3 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.cone.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.cone.material.color.copy( this.light.color );\n\n\t\t}\n\n\t}\n\n}\n\nconst _vector$2 = /*@__PURE__*/ new Vector3();\nconst _boneMatrix = /*@__PURE__*/ new Matrix4();\nconst _matrixWorldInv = /*@__PURE__*/ new Matrix4();\n\n\nclass SkeletonHelper extends LineSegments {\n\n\tconstructor( object ) {\n\n\t\tconst bones = getBoneList( object );\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst color1 = new Color( 0, 0, 1 );\n\t\tconst color2 = new Color( 0, 1, 0 );\n\n\t\tfor ( let i = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tvertices.push( 0, 0, 0 );\n\t\t\t\tcolors.push( color1.r, color1.g, color1.b );\n\t\t\t\tcolors.push( color2.r, color2.g, color2.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'SkeletonHelper';\n\t\tthis.isSkeletonHelper = true;\n\n\t\tthis.root = object;\n\t\tthis.bones = bones;\n\n\t\tthis.matrix = object.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst bones = this.bones;\n\n\t\tconst geometry = this.geometry;\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\t_matrixWorldInv.copy( this.root.matrixWorld ).invert();\n\n\t\tfor ( let i = 0, j = 0; i < bones.length; i ++ ) {\n\n\t\t\tconst bone = bones[ i ];\n\n\t\t\tif ( bone.parent && bone.parent.isBone ) {\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\t_boneMatrix.multiplyMatrices( _matrixWorldInv, bone.parent.matrixWorld );\n\t\t\t\t_vector$2.setFromMatrixPosition( _boneMatrix );\n\t\t\t\tposition.setXYZ( j + 1, _vector$2.x, _vector$2.y, _vector$2.z );\n\n\t\t\t\tj += 2;\n\n\t\t\t}\n\n\t\t}\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n}\n\n\nfunction getBoneList( object ) {\n\n\tconst boneList = [];\n\n\tif ( object && object.isBone ) {\n\n\t\tboneList.push( object );\n\n\t}\n\n\tfor ( let i = 0; i < object.children.length; i ++ ) {\n\n\t\tboneList.push.apply( boneList, getBoneList( object.children[ i ] ) );\n\n\t}\n\n\treturn boneList;\n\n}\n\nclass PointLightHelper extends Mesh {\n\n\tconstructor( light, sphereSize, color ) {\n\n\t\tconst geometry = new SphereGeometry( sphereSize, 4, 2 );\n\t\tconst material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.light = light;\n\t\tthis.light.updateMatrixWorld();\n\n\t\tthis.color = color;\n\n\t\tthis.type = 'PointLightHelper';\n\n\t\tthis.matrix = this.light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\n\t\t/*\n\t// TODO: delete this comment?\n\tconst distanceGeometry = new THREE.IcosahedronBufferGeometry( 1, 2 );\n\tconst distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\n\n\tthis.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\n\tthis.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\n\n\tconst d = light.distance;\n\n\tif ( d === 0.0 ) {\n\n\t\tthis.lightDistance.visible = false;\n\n\t} else {\n\n\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t}\n\n\tthis.add( this.lightDistance );\n\t*/\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\t/*\n\t\tconst d = this.light.distance;\n\n\t\tif ( d === 0.0 ) {\n\n\t\t\tthis.lightDistance.visible = false;\n\n\t\t} else {\n\n\t\t\tthis.lightDistance.visible = true;\n\t\t\tthis.lightDistance.scale.set( d, d, d );\n\n\t\t}\n\t\t*/\n\n\t}\n\n}\n\nconst _vector$1 = /*@__PURE__*/ new Vector3();\nconst _color1 = /*@__PURE__*/ new Color();\nconst _color2 = /*@__PURE__*/ new Color();\n\nclass HemisphereLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\t\tthis.light = light;\n\t\tthis.light.updateMatrixWorld();\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tconst geometry = new OctahedronGeometry( size );\n\t\tgeometry.rotateY( Math.PI * 0.5 );\n\n\t\tthis.material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );\n\t\tif ( this.color === undefined ) this.material.vertexColors = true;\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\t\tconst colors = new Float32Array( position.count * 3 );\n\n\t\tgeometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) );\n\n\t\tthis.add( new Mesh( geometry, this.material ) );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.children[ 0 ].geometry.dispose();\n\t\tthis.children[ 0 ].material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\tconst mesh = this.children[ 0 ];\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tconst colors = mesh.geometry.getAttribute( 'color' );\n\n\t\t\t_color1.copy( this.light.color );\n\t\t\t_color2.copy( this.light.groundColor );\n\n\t\t\tfor ( let i = 0, l = colors.count; i < l; i ++ ) {\n\n\t\t\t\tconst color = ( i < ( l / 2 ) ) ? _color1 : _color2;\n\n\t\t\t\tcolors.setXYZ( i, color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t\tcolors.needsUpdate = true;\n\n\t\t}\n\n\t\tmesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() );\n\n\t}\n\n}\n\nclass GridHelper extends LineSegments {\n\n\tconstructor( size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst center = divisions / 2;\n\t\tconst step = size / divisions;\n\t\tconst halfSize = size / 2;\n\n\t\tconst vertices = [], colors = [];\n\n\t\tfor ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {\n\n\t\t\tvertices.push( - halfSize, 0, k, halfSize, 0, k );\n\t\t\tvertices.push( k, 0, - halfSize, k, 0, halfSize );\n\n\t\t\tconst color = i === center ? color1 : color2;\n\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\t\t\tcolor.toArray( colors, j ); j += 3;\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'GridHelper';\n\n\t}\n\n}\n\nclass PolarGridHelper extends LineSegments {\n\n\tconstructor( radius = 10, radials = 16, circles = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888 ) {\n\n\t\tcolor1 = new Color( color1 );\n\t\tcolor2 = new Color( color2 );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\t// create the radials\n\n\t\tfor ( let i = 0; i <= radials; i ++ ) {\n\n\t\t\tconst v = ( i / radials ) * ( Math.PI * 2 );\n\n\t\t\tconst x = Math.sin( v ) * radius;\n\t\t\tconst z = Math.cos( v ) * radius;\n\n\t\t\tvertices.push( 0, 0, 0 );\n\t\t\tvertices.push( x, 0, z );\n\n\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\tcolors.push( color.r, color.g, color.b );\n\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t}\n\n\t\t// create the circles\n\n\t\tfor ( let i = 0; i <= circles; i ++ ) {\n\n\t\t\tconst color = ( i & 1 ) ? color1 : color2;\n\n\t\t\tconst r = radius - ( radius / circles * i );\n\n\t\t\tfor ( let j = 0; j < divisions; j ++ ) {\n\n\t\t\t\t// first vertex\n\n\t\t\t\tlet v = ( j / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tlet x = Math.sin( v ) * r;\n\t\t\t\tlet z = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t\t// second vertex\n\n\t\t\t\tv = ( ( j + 1 ) / divisions ) * ( Math.PI * 2 );\n\n\t\t\t\tx = Math.sin( v ) * r;\n\t\t\t\tz = Math.cos( v ) * r;\n\n\t\t\t\tvertices.push( x, 0, z );\n\t\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\t}\n\n\t\t}\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'PolarGridHelper';\n\n\t}\n\n}\n\nconst _v1 = /*@__PURE__*/ new Vector3();\nconst _v2 = /*@__PURE__*/ new Vector3();\nconst _v3 = /*@__PURE__*/ new Vector3();\n\nclass DirectionalLightHelper extends Object3D {\n\n\tconstructor( light, size, color ) {\n\n\t\tsuper();\n\t\tthis.light = light;\n\t\tthis.light.updateMatrixWorld();\n\n\t\tthis.matrix = light.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.color = color;\n\n\t\tif ( size === undefined ) size = 1;\n\n\t\tlet geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [\n\t\t\t- size, size, 0,\n\t\t\tsize, size, 0,\n\t\t\tsize, - size, 0,\n\t\t\t- size, - size, 0,\n\t\t\t- size, size, 0\n\t\t], 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { fog: false, toneMapped: false } );\n\n\t\tthis.lightPlane = new Line( geometry, material );\n\t\tthis.add( this.lightPlane );\n\n\t\tgeometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 0, 1 ], 3 ) );\n\n\t\tthis.targetLine = new Line( geometry, material );\n\t\tthis.add( this.targetLine );\n\n\t\tthis.update();\n\n\t}\n\n\tdispose() {\n\n\t\tthis.lightPlane.geometry.dispose();\n\t\tthis.lightPlane.material.dispose();\n\t\tthis.targetLine.geometry.dispose();\n\t\tthis.targetLine.material.dispose();\n\n\t}\n\n\tupdate() {\n\n\t\t_v1.setFromMatrixPosition( this.light.matrixWorld );\n\t\t_v2.setFromMatrixPosition( this.light.target.matrixWorld );\n\t\t_v3.subVectors( _v2, _v1 );\n\n\t\tthis.lightPlane.lookAt( _v2 );\n\n\t\tif ( this.color !== undefined ) {\n\n\t\t\tthis.lightPlane.material.color.set( this.color );\n\t\t\tthis.targetLine.material.color.set( this.color );\n\n\t\t} else {\n\n\t\t\tthis.lightPlane.material.color.copy( this.light.color );\n\t\t\tthis.targetLine.material.color.copy( this.light.color );\n\n\t\t}\n\n\t\tthis.targetLine.lookAt( _v2 );\n\t\tthis.targetLine.scale.z = _v3.length();\n\n\t}\n\n}\n\nconst _vector = /*@__PURE__*/ new Vector3();\nconst _camera = /*@__PURE__*/ new Camera();\n\n/**\n *\t- shows frustum, line of sight and up of the camera\n *\t- suitable for fast updates\n * \t- based on frustum visualization in lightgl.js shadowmap example\n *\t\thttp://evanw.github.com/lightgl.js/tests/shadowmap.html\n */\n\nclass CameraHelper extends LineSegments {\n\n\tconstructor( camera ) {\n\n\t\tconst geometry = new BufferGeometry();\n\t\tconst material = new LineBasicMaterial( { color: 0xffffff, vertexColors: true, toneMapped: false } );\n\n\t\tconst vertices = [];\n\t\tconst colors = [];\n\n\t\tconst pointMap = {};\n\n\t\t// colors\n\n\t\tconst colorFrustum = new Color( 0xffaa00 );\n\t\tconst colorCone = new Color( 0xff0000 );\n\t\tconst colorUp = new Color( 0x00aaff );\n\t\tconst colorTarget = new Color( 0xffffff );\n\t\tconst colorCross = new Color( 0x333333 );\n\n\t\t// near\n\n\t\taddLine( 'n1', 'n2', colorFrustum );\n\t\taddLine( 'n2', 'n4', colorFrustum );\n\t\taddLine( 'n4', 'n3', colorFrustum );\n\t\taddLine( 'n3', 'n1', colorFrustum );\n\n\t\t// far\n\n\t\taddLine( 'f1', 'f2', colorFrustum );\n\t\taddLine( 'f2', 'f4', colorFrustum );\n\t\taddLine( 'f4', 'f3', colorFrustum );\n\t\taddLine( 'f3', 'f1', colorFrustum );\n\n\t\t// sides\n\n\t\taddLine( 'n1', 'f1', colorFrustum );\n\t\taddLine( 'n2', 'f2', colorFrustum );\n\t\taddLine( 'n3', 'f3', colorFrustum );\n\t\taddLine( 'n4', 'f4', colorFrustum );\n\n\t\t// cone\n\n\t\taddLine( 'p', 'n1', colorCone );\n\t\taddLine( 'p', 'n2', colorCone );\n\t\taddLine( 'p', 'n3', colorCone );\n\t\taddLine( 'p', 'n4', colorCone );\n\n\t\t// up\n\n\t\taddLine( 'u1', 'u2', colorUp );\n\t\taddLine( 'u2', 'u3', colorUp );\n\t\taddLine( 'u3', 'u1', colorUp );\n\n\t\t// target\n\n\t\taddLine( 'c', 't', colorTarget );\n\t\taddLine( 'p', 'c', colorCross );\n\n\t\t// cross\n\n\t\taddLine( 'cn1', 'cn2', colorCross );\n\t\taddLine( 'cn3', 'cn4', colorCross );\n\n\t\taddLine( 'cf1', 'cf2', colorCross );\n\t\taddLine( 'cf3', 'cf4', colorCross );\n\n\t\tfunction addLine( a, b, color ) {\n\n\t\t\taddPoint( a, color );\n\t\t\taddPoint( b, color );\n\n\t\t}\n\n\t\tfunction addPoint( id, color ) {\n\n\t\t\tvertices.push( 0, 0, 0 );\n\t\t\tcolors.push( color.r, color.g, color.b );\n\n\t\t\tif ( pointMap[ id ] === undefined ) {\n\n\t\t\t\tpointMap[ id ] = [];\n\n\t\t\t}\n\n\t\t\tpointMap[ id ].push( ( vertices.length / 3 ) - 1 );\n\n\t\t}\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'CameraHelper';\n\n\t\tthis.camera = camera;\n\t\tif ( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix();\n\n\t\tthis.matrix = camera.matrixWorld;\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.pointMap = pointMap;\n\n\t\tthis.update();\n\n\t}\n\n\tupdate() {\n\n\t\tconst geometry = this.geometry;\n\t\tconst pointMap = this.pointMap;\n\n\t\tconst w = 1, h = 1;\n\n\t\t// we need just camera projection matrix inverse\n\t\t// world matrix must be identity\n\n\t\t_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );\n\n\t\t// center / target\n\n\t\tsetPoint( 'c', pointMap, geometry, _camera, 0, 0, - 1 );\n\t\tsetPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );\n\n\t\t// near\n\n\t\tsetPoint( 'n1', pointMap, geometry, _camera, - w, - h, - 1 );\n\t\tsetPoint( 'n2', pointMap, geometry, _camera, w, - h, - 1 );\n\t\tsetPoint( 'n3', pointMap, geometry, _camera, - w, h, - 1 );\n\t\tsetPoint( 'n4', pointMap, geometry, _camera, w, h, - 1 );\n\n\t\t// far\n\n\t\tsetPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );\n\t\tsetPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );\n\t\tsetPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );\n\t\tsetPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );\n\n\t\t// up\n\n\t\tsetPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, - 1 );\n\t\tsetPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, - 1 );\n\n\t\t// cross\n\n\t\tsetPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );\n\t\tsetPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );\n\t\tsetPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );\n\t\tsetPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );\n\n\t\tsetPoint( 'cn1', pointMap, geometry, _camera, - w, 0, - 1 );\n\t\tsetPoint( 'cn2', pointMap, geometry, _camera, w, 0, - 1 );\n\t\tsetPoint( 'cn3', pointMap, geometry, _camera, 0, - h, - 1 );\n\t\tsetPoint( 'cn4', pointMap, geometry, _camera, 0, h, - 1 );\n\n\t\tgeometry.getAttribute( 'position' ).needsUpdate = true;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\n\nfunction setPoint( point, pointMap, geometry, camera, x, y, z ) {\n\n\t_vector.set( x, y, z ).unproject( camera );\n\n\tconst points = pointMap[ point ];\n\n\tif ( points !== undefined ) {\n\n\t\tconst position = geometry.getAttribute( 'position' );\n\n\t\tfor ( let i = 0, l = points.length; i < l; i ++ ) {\n\n\t\t\tposition.setXYZ( points[ i ], _vector.x, _vector.y, _vector.z );\n\n\t\t}\n\n\t}\n\n}\n\nconst _box = /*@__PURE__*/ new Box3();\n\nclass BoxHelper extends LineSegments {\n\n\tconstructor( object, color = 0xffff00 ) {\n\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\t\tconst positions = new Float32Array( 8 * 3 );\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\t\tgeometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.object = object;\n\t\tthis.type = 'BoxHelper';\n\n\t\tthis.matrixAutoUpdate = false;\n\n\t\tthis.update();\n\n\t}\n\n\tupdate( object ) {\n\n\t\tif ( object !== undefined ) {\n\n\t\t\tconsole.warn( 'THREE.BoxHelper: .update() has no longer arguments.' );\n\n\t\t}\n\n\t\tif ( this.object !== undefined ) {\n\n\t\t\t_box.setFromObject( this.object );\n\n\t\t}\n\n\t\tif ( _box.isEmpty() ) return;\n\n\t\tconst min = _box.min;\n\t\tconst max = _box.max;\n\n\t\t/*\n\t\t\t5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/\n\n\t\tconst position = this.geometry.attributes.position;\n\t\tconst array = position.array;\n\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\n\n\t\tposition.needsUpdate = true;\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\n\t}\n\n\tsetFromObject( object ) {\n\n\t\tthis.object = object;\n\t\tthis.update();\n\n\t\treturn this;\n\n\t}\n\n\tcopy( source ) {\n\n\t\tLineSegments.prototype.copy.call( this, source );\n\n\t\tthis.object = source.object;\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass Box3Helper extends LineSegments {\n\n\tconstructor( box, color = 0xffff00 ) {\n\n\t\tconst indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\n\t\tconst 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 ];\n\n\t\tconst geometry = new BufferGeometry();\n\n\t\tgeometry.setIndex( new BufferAttribute( indices, 1 ) );\n\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.box = box;\n\n\t\tthis.type = 'Box3Helper';\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tconst box = this.box;\n\n\t\tif ( box.isEmpty() ) return;\n\n\t\tbox.getCenter( this.position );\n\n\t\tbox.getSize( this.scale );\n\n\t\tthis.scale.multiplyScalar( 0.5 );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n}\n\nclass PlaneHelper extends Line {\n\n\tconstructor( plane, size = 1, hex = 0xffff00 ) {\n\n\t\tconst color = hex;\n\n\t\tconst 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, 0, 0, 1, 0, 0, 0 ];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );\n\t\tgeometry.computeBoundingSphere();\n\n\t\tsuper( geometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\n\t\tthis.type = 'PlaneHelper';\n\n\t\tthis.plane = plane;\n\n\t\tthis.size = size;\n\n\t\tconst positions2 = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, - 1, 1, 1, - 1, 1 ];\n\n\t\tconst geometry2 = new BufferGeometry();\n\t\tgeometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );\n\t\tgeometry2.computeBoundingSphere();\n\n\t\tthis.add( new Mesh( geometry2, new MeshBasicMaterial( { color: color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false } ) ) );\n\n\t}\n\n\tupdateMatrixWorld( force ) {\n\n\t\tlet scale = - this.plane.constant;\n\n\t\tif ( Math.abs( scale ) < 1e-8 ) scale = 1e-8; // sign does not matter\n\n\t\tthis.scale.set( 0.5 * this.size, 0.5 * this.size, scale );\n\n\t\tthis.children[ 0 ].material.side = ( scale < 0 ) ? BackSide : FrontSide; // renderer flips side when determinant < 0; flipping not wanted here\n\n\t\tthis.lookAt( this.plane.normal );\n\n\t\tsuper.updateMatrixWorld( force );\n\n\t}\n\n}\n\nconst _axis = /*@__PURE__*/ new Vector3();\nlet _lineGeometry, _coneGeometry;\n\nclass ArrowHelper extends Object3D {\n\n\t// dir is assumed to be normalized\n\n\tconstructor( dir = new Vector3( 0, 0, 1 ), origin = new Vector3( 0, 0, 0 ), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tsuper();\n\n\t\tthis.type = 'ArrowHelper';\n\n\t\tif ( _lineGeometry === undefined ) {\n\n\t\t\t_lineGeometry = new BufferGeometry();\n\t\t\t_lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );\n\n\t\t\t_coneGeometry = new CylinderGeometry( 0, 0.5, 1, 5, 1 );\n\t\t\t_coneGeometry.translate( 0, - 0.5, 0 );\n\n\t\t}\n\n\t\tthis.position.copy( origin );\n\n\t\tthis.line = new Line( _lineGeometry, new LineBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.line.matrixAutoUpdate = false;\n\t\tthis.add( this.line );\n\n\t\tthis.cone = new Mesh( _coneGeometry, new MeshBasicMaterial( { color: color, toneMapped: false } ) );\n\t\tthis.cone.matrixAutoUpdate = false;\n\t\tthis.add( this.cone );\n\n\t\tthis.setDirection( dir );\n\t\tthis.setLength( length, headLength, headWidth );\n\n\t}\n\n\tsetDirection( dir ) {\n\n\t\t// dir is assumed to be normalized\n\n\t\tif ( dir.y > 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 0, 0, 0, 1 );\n\n\t\t} else if ( dir.y < - 0.99999 ) {\n\n\t\t\tthis.quaternion.set( 1, 0, 0, 0 );\n\n\t\t} else {\n\n\t\t\t_axis.set( dir.z, 0, - dir.x ).normalize();\n\n\t\t\tconst radians = Math.acos( dir.y );\n\n\t\t\tthis.quaternion.setFromAxisAngle( _axis, radians );\n\n\t\t}\n\n\t}\n\n\tsetLength( length, headLength = length * 0.2, headWidth = headLength * 0.2 ) {\n\n\t\tthis.line.scale.set( 1, Math.max( 0.0001, length - headLength ), 1 ); // see #17458\n\t\tthis.line.updateMatrix();\n\n\t\tthis.cone.scale.set( headWidth, headLength, headWidth );\n\t\tthis.cone.position.y = length;\n\t\tthis.cone.updateMatrix();\n\n\t}\n\n\tsetColor( color ) {\n\n\t\tthis.line.material.color.set( color );\n\t\tthis.cone.material.color.set( color );\n\n\t}\n\n\tcopy( source ) {\n\n\t\tsuper.copy( source, false );\n\n\t\tthis.line.copy( source.line );\n\t\tthis.cone.copy( source.cone );\n\n\t\treturn this;\n\n\t}\n\n}\n\nclass AxesHelper extends LineSegments {\n\n\tconstructor( size = 1 ) {\n\n\t\tconst vertices = [\n\t\t\t0, 0, 0,\tsize, 0, 0,\n\t\t\t0, 0, 0,\t0, size, 0,\n\t\t\t0, 0, 0,\t0, 0, size\n\t\t];\n\n\t\tconst colors = [\n\t\t\t1, 0, 0,\t1, 0.6, 0,\n\t\t\t0, 1, 0,\t0.6, 1, 0,\n\t\t\t0, 0, 1,\t0, 0.6, 1\n\t\t];\n\n\t\tconst geometry = new BufferGeometry();\n\t\tgeometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );\n\t\tgeometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );\n\n\t\tconst material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );\n\n\t\tsuper( geometry, material );\n\n\t\tthis.type = 'AxesHelper';\n\n\t}\n\n\tsetColors( xAxisColor, yAxisColor, zAxisColor ) {\n\n\t\tconst color = new Color();\n\t\tconst array = this.geometry.attributes.color.array;\n\n\t\tcolor.set( xAxisColor );\n\t\tcolor.toArray( array, 0 );\n\t\tcolor.toArray( array, 3 );\n\n\t\tcolor.set( yAxisColor );\n\t\tcolor.toArray( array, 6 );\n\t\tcolor.toArray( array, 9 );\n\n\t\tcolor.set( zAxisColor );\n\t\tcolor.toArray( array, 12 );\n\t\tcolor.toArray( array, 15 );\n\n\t\tthis.geometry.attributes.color.needsUpdate = true;\n\n\t\treturn this;\n\n\t}\n\n\tdispose() {\n\n\t\tthis.geometry.dispose();\n\t\tthis.material.dispose();\n\n\t}\n\n}\n\nclass ShapePath {\n\n\tconstructor() {\n\n\t\tthis.type = 'ShapePath';\n\n\t\tthis.color = new Color();\n\n\t\tthis.subPaths = [];\n\t\tthis.currentPath = null;\n\n\t}\n\n\tmoveTo( x, y ) {\n\n\t\tthis.currentPath = new Path();\n\t\tthis.subPaths.push( this.currentPath );\n\t\tthis.currentPath.moveTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tlineTo( x, y ) {\n\n\t\tthis.currentPath.lineTo( x, y );\n\n\t\treturn this;\n\n\t}\n\n\tquadraticCurveTo( aCPx, aCPy, aX, aY ) {\n\n\t\tthis.currentPath.quadraticCurveTo( aCPx, aCPy, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tbezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY ) {\n\n\t\tthis.currentPath.bezierCurveTo( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY );\n\n\t\treturn this;\n\n\t}\n\n\tsplineThru( pts ) {\n\n\t\tthis.currentPath.splineThru( pts );\n\n\t\treturn this;\n\n\t}\n\n\ttoShapes( isCCW, noHoles ) {\n\n\t\tfunction toShapesNoHoles( inSubpaths ) {\n\n\t\t\tconst shapes = [];\n\n\t\t\tfor ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {\n\n\t\t\t\tconst tmpPath = inSubpaths[ i ];\n\n\t\t\t\tconst tmpShape = new Shape();\n\t\t\t\ttmpShape.curves = tmpPath.curves;\n\n\t\t\t\tshapes.push( tmpShape );\n\n\t\t\t}\n\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tfunction isPointInsidePolygon( inPt, inPolygon ) {\n\n\t\t\tconst polyLen = inPolygon.length;\n\n\t\t\t// inPt on polygon contour => immediate success or\n\t\t\t// toggling of inside/outside at every single! intersection point of an edge\n\t\t\t// with the horizontal line through inPt, left of inPt\n\t\t\t// not counting lowerY endpoints of edges and whole edges on that line\n\t\t\tlet inside = false;\n\t\t\tfor ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {\n\n\t\t\t\tlet edgeLowPt = inPolygon[ p ];\n\t\t\t\tlet edgeHighPt = inPolygon[ q ];\n\n\t\t\t\tlet edgeDx = edgeHighPt.x - edgeLowPt.x;\n\t\t\t\tlet edgeDy = edgeHighPt.y - edgeLowPt.y;\n\n\t\t\t\tif ( Math.abs( edgeDy ) > Number.EPSILON ) {\n\n\t\t\t\t\t// not parallel\n\t\t\t\t\tif ( edgeDy < 0 ) {\n\n\t\t\t\t\t\tedgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;\n\t\t\t\t\t\tedgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) \t\tcontinue;\n\n\t\t\t\t\tif ( inPt.y === edgeLowPt.y ) {\n\n\t\t\t\t\t\tif ( inPt.x === edgeLowPt.x )\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\t// continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconst perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );\n\t\t\t\t\t\tif ( perpEdge === 0 )\t\t\t\treturn\ttrue;\t\t// inPt is on contour ?\n\t\t\t\t\t\tif ( perpEdge < 0 ) \t\t\t\tcontinue;\n\t\t\t\t\t\tinside = ! inside;\t\t// true intersection left of inPt\n\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// parallel or collinear\n\t\t\t\t\tif ( inPt.y !== edgeLowPt.y ) \t\tcontinue;\t\t\t// parallel\n\t\t\t\t\t// edge lies on the same horizontal line as inPt\n\t\t\t\t\tif ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||\n\t\t\t\t\t\t ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) )\t\treturn\ttrue;\t// inPt: Point on contour !\n\t\t\t\t\t// continue;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn\tinside;\n\n\t\t}\n\n\t\tconst isClockWise = ShapeUtils.isClockWise;\n\n\t\tconst subPaths = this.subPaths;\n\t\tif ( subPaths.length === 0 ) return [];\n\n\t\tif ( noHoles === true )\treturn\ttoShapesNoHoles( subPaths );\n\n\n\t\tlet solid, tmpPath, tmpShape;\n\t\tconst shapes = [];\n\n\t\tif ( subPaths.length === 1 ) {\n\n\t\t\ttmpPath = subPaths[ 0 ];\n\t\t\ttmpShape = new Shape();\n\t\t\ttmpShape.curves = tmpPath.curves;\n\t\t\tshapes.push( tmpShape );\n\t\t\treturn shapes;\n\n\t\t}\n\n\t\tlet holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );\n\t\tholesFirst = isCCW ? ! holesFirst : holesFirst;\n\n\t\t// console.log(\"Holes first\", holesFirst);\n\n\t\tconst betterShapeHoles = [];\n\t\tconst newShapes = [];\n\t\tlet newShapeHoles = [];\n\t\tlet mainIdx = 0;\n\t\tlet tmpPoints;\n\n\t\tnewShapes[ mainIdx ] = undefined;\n\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\tfor ( let i = 0, l = subPaths.length; i < l; i ++ ) {\n\n\t\t\ttmpPath = subPaths[ i ];\n\t\t\ttmpPoints = tmpPath.getPoints();\n\t\t\tsolid = isClockWise( tmpPoints );\n\t\t\tsolid = isCCW ? ! solid : solid;\n\n\t\t\tif ( solid ) {\n\n\t\t\t\tif ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) )\tmainIdx ++;\n\n\t\t\t\tnewShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };\n\t\t\t\tnewShapes[ mainIdx ].s.curves = tmpPath.curves;\n\n\t\t\t\tif ( holesFirst )\tmainIdx ++;\n\t\t\t\tnewShapeHoles[ mainIdx ] = [];\n\n\t\t\t\t//console.log('cw', i);\n\n\t\t\t} else {\n\n\t\t\t\tnewShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );\n\n\t\t\t\t//console.log('ccw', i);\n\n\t\t\t}\n\n\t\t}\n\n\t\t// only Holes? -> probably all Shapes with wrong orientation\n\t\tif ( ! newShapes[ 0 ] )\treturn\ttoShapesNoHoles( subPaths );\n\n\n\t\tif ( newShapes.length > 1 ) {\n\n\t\t\tlet ambiguous = false;\n\t\t\tconst toChange = [];\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tbetterShapeHoles[ sIdx ] = [];\n\n\t\t\t}\n\n\t\t\tfor ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\n\n\t\t\t\tconst sho = newShapeHoles[ sIdx ];\n\n\t\t\t\tfor ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {\n\n\t\t\t\t\tconst ho = sho[ hIdx ];\n\t\t\t\t\tlet hole_unassigned = true;\n\n\t\t\t\t\tfor ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {\n\n\t\t\t\t\t\tif ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {\n\n\t\t\t\t\t\t\tif ( sIdx !== s2Idx )\ttoChange.push( { froms: sIdx, tos: s2Idx, hole: hIdx } );\n\t\t\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\t\t\thole_unassigned = false;\n\t\t\t\t\t\t\t\tbetterShapeHoles[ s2Idx ].push( ho );\n\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\tambiguous = true;\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( hole_unassigned ) {\n\n\t\t\t\t\t\tbetterShapeHoles[ sIdx ].push( ho );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t// console.log(\"ambiguous: \", ambiguous);\n\n\t\t\tif ( toChange.length > 0 ) {\n\n\t\t\t\t// console.log(\"to change: \", toChange);\n\t\t\t\tif ( ! ambiguous )\tnewShapeHoles = betterShapeHoles;\n\n\t\t\t}\n\n\t\t}\n\n\t\tlet tmpHoles;\n\n\t\tfor ( let i = 0, il = newShapes.length; i < il; i ++ ) {\n\n\t\t\ttmpShape = newShapes[ i ].s;\n\t\t\tshapes.push( tmpShape );\n\t\t\ttmpHoles = newShapeHoles[ i ];\n\n\t\t\tfor ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {\n\n\t\t\t\ttmpShape.holes.push( tmpHoles[ j ].h );\n\n\t\t\t}\n\n\t\t}\n\n\t\t//console.log(\"shape\", shapes);\n\n\t\treturn shapes;\n\n\t}\n\n}\n\nconst _floatView = new Float32Array( 1 );\nconst _int32View = new Int32Array( _floatView.buffer );\n\nclass DataUtils {\n\n\t// Converts float32 to float16 (stored as uint16 value).\n\n\tstatic toHalfFloat( val ) {\n\n\t\tif ( val > 65504 ) {\n\n\t\t\tconsole.warn( 'THREE.DataUtils.toHalfFloat(): value exceeds 65504.' );\n\n\t\t\tval = 65504; // maximum representable value in float16\n\n\t\t}\n\n\t\t// Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410\n\n\t\t/* This method is faster than the OpenEXR implementation (very often\n\t\t* used, eg. in Ogre), with the additional benefit of rounding, inspired\n\t\t* by James Tursa?s half-precision code. */\n\n\t\t_floatView[ 0 ] = val;\n\t\tconst x = _int32View[ 0 ];\n\n\t\tlet bits = ( x >> 16 ) & 0x8000; /* Get the sign */\n\t\tlet m = ( x >> 12 ) & 0x07ff; /* Keep one extra bit for rounding */\n\t\tconst e = ( x >> 23 ) & 0xff; /* Using int is faster here */\n\n\t\t/* If zero, or denormal, or exponent underflows too much for a denormal\n\t\t\t* half, return signed zero. */\n\t\tif ( e < 103 ) return bits;\n\n\t\t/* If NaN, return NaN. If Inf or exponent overflow, return Inf. */\n\t\tif ( e > 142 ) {\n\n\t\t\tbits |= 0x7c00;\n\t\t\t/* If exponent was 0xff and one mantissa bit was set, it means NaN,\n\t\t\t\t\t\t* not Inf, so make sure we set one mantissa bit too. */\n\t\t\tbits |= ( ( e == 255 ) ? 0 : 1 ) && ( x & 0x007fffff );\n\t\t\treturn bits;\n\n\t\t}\n\n\t\t/* If exponent underflows but not too much, return a denormal */\n\t\tif ( e < 113 ) {\n\n\t\t\tm |= 0x0800;\n\t\t\t/* Extra rounding may overflow and set mantissa to 0 and exponent\n\t\t\t\t* to 1, which is OK. */\n\t\t\tbits |= ( m >> ( 114 - e ) ) + ( ( m >> ( 113 - e ) ) & 1 );\n\t\t\treturn bits;\n\n\t\t}\n\n\t\tbits |= ( ( e - 112 ) << 10 ) | ( m >> 1 );\n\t\t/* Extra rounding. An overflow will set mantissa to 0 and increment\n\t\t\t* the exponent, which is OK. */\n\t\tbits += m & 1;\n\t\treturn bits;\n\n\t}\n\n}\n\nconst LineStrip = 0;\nconst LinePieces = 1;\nconst NoColors = 0;\nconst FaceColors = 1;\nconst VertexColors = 2;\n\nfunction MeshFaceMaterial( materials ) {\n\n\tconsole.warn( 'THREE.MeshFaceMaterial has been removed. Use an Array instead.' );\n\treturn materials;\n\n}\n\nfunction MultiMaterial( materials = [] ) {\n\n\tconsole.warn( 'THREE.MultiMaterial has been removed. Use an Array instead.' );\n\tmaterials.isMultiMaterial = true;\n\tmaterials.materials = materials;\n\tmaterials.clone = function () {\n\n\t\treturn materials.slice();\n\n\t};\n\n\treturn materials;\n\n}\n\nfunction PointCloud( geometry, material ) {\n\n\tconsole.warn( 'THREE.PointCloud has been renamed to THREE.Points.' );\n\treturn new Points( geometry, material );\n\n}\n\nfunction Particle( material ) {\n\n\tconsole.warn( 'THREE.Particle has been renamed to THREE.Sprite.' );\n\treturn new Sprite( material );\n\n}\n\nfunction ParticleSystem( geometry, material ) {\n\n\tconsole.warn( 'THREE.ParticleSystem has been renamed to THREE.Points.' );\n\treturn new Points( geometry, material );\n\n}\n\nfunction PointCloudMaterial( parameters ) {\n\n\tconsole.warn( 'THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.' );\n\treturn new PointsMaterial( parameters );\n\n}\n\nfunction ParticleBasicMaterial( parameters ) {\n\n\tconsole.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.' );\n\treturn new PointsMaterial( parameters );\n\n}\n\nfunction ParticleSystemMaterial( parameters ) {\n\n\tconsole.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.' );\n\treturn new PointsMaterial( parameters );\n\n}\n\nfunction Vertex( x, y, z ) {\n\n\tconsole.warn( 'THREE.Vertex has been removed. Use THREE.Vector3 instead.' );\n\treturn new Vector3( x, y, z );\n\n}\n\n//\n\nfunction DynamicBufferAttribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead.' );\n\treturn new BufferAttribute( array, itemSize ).setUsage( DynamicDrawUsage );\n\n}\n\nfunction Int8Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.' );\n\treturn new Int8BufferAttribute( array, itemSize );\n\n}\n\nfunction Uint8Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.' );\n\treturn new Uint8BufferAttribute( array, itemSize );\n\n}\n\nfunction Uint8ClampedAttribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.' );\n\treturn new Uint8ClampedBufferAttribute( array, itemSize );\n\n}\n\nfunction Int16Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.' );\n\treturn new Int16BufferAttribute( array, itemSize );\n\n}\n\nfunction Uint16Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.' );\n\treturn new Uint16BufferAttribute( array, itemSize );\n\n}\n\nfunction Int32Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.' );\n\treturn new Int32BufferAttribute( array, itemSize );\n\n}\n\nfunction Uint32Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.' );\n\treturn new Uint32BufferAttribute( array, itemSize );\n\n}\n\nfunction Float32Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.' );\n\treturn new Float32BufferAttribute( array, itemSize );\n\n}\n\nfunction Float64Attribute( array, itemSize ) {\n\n\tconsole.warn( 'THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.' );\n\treturn new Float64BufferAttribute( array, itemSize );\n\n}\n\n//\n\nCurve.create = function ( construct, getPoint ) {\n\n\tconsole.log( 'THREE.Curve.create() has been deprecated' );\n\n\tconstruct.prototype = Object.create( Curve.prototype );\n\tconstruct.prototype.constructor = construct;\n\tconstruct.prototype.getPoint = getPoint;\n\n\treturn construct;\n\n};\n\n//\n\nPath.prototype.fromPoints = function ( points ) {\n\n\tconsole.warn( 'THREE.Path: .fromPoints() has been renamed to .setFromPoints().' );\n\treturn this.setFromPoints( points );\n\n};\n\n//\n\nfunction AxisHelper( size ) {\n\n\tconsole.warn( 'THREE.AxisHelper has been renamed to THREE.AxesHelper.' );\n\treturn new AxesHelper( size );\n\n}\n\nfunction BoundingBoxHelper( object, color ) {\n\n\tconsole.warn( 'THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.' );\n\treturn new BoxHelper( object, color );\n\n}\n\nfunction EdgesHelper( object, hex ) {\n\n\tconsole.warn( 'THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.' );\n\treturn new LineSegments( new EdgesGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );\n\n}\n\nGridHelper.prototype.setColors = function () {\n\n\tconsole.error( 'THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.' );\n\n};\n\nSkeletonHelper.prototype.update = function () {\n\n\tconsole.error( 'THREE.SkeletonHelper: update() no longer needs to be called.' );\n\n};\n\nfunction WireframeHelper( object, hex ) {\n\n\tconsole.warn( 'THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.' );\n\treturn new LineSegments( new WireframeGeometry( object.geometry ), new LineBasicMaterial( { color: hex !== undefined ? hex : 0xffffff } ) );\n\n}\n\n//\n\nLoader.prototype.extractUrlBase = function ( url ) {\n\n\tconsole.warn( 'THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.' );\n\treturn LoaderUtils.extractUrlBase( url );\n\n};\n\nLoader.Handlers = {\n\n\tadd: function ( /* regex, loader */ ) {\n\n\t\tconsole.error( 'THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.' );\n\n\t},\n\n\tget: function ( /* file */ ) {\n\n\t\tconsole.error( 'THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.' );\n\n\t}\n\n};\n\nfunction XHRLoader( manager ) {\n\n\tconsole.warn( 'THREE.XHRLoader has been renamed to THREE.FileLoader.' );\n\treturn new FileLoader( manager );\n\n}\n\nfunction BinaryTextureLoader( manager ) {\n\n\tconsole.warn( 'THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.' );\n\treturn new DataTextureLoader( manager );\n\n}\n\n//\n\nBox2.prototype.center = function ( optionalTarget ) {\n\n\tconsole.warn( 'THREE.Box2: .center() has been renamed to .getCenter().' );\n\treturn this.getCenter( optionalTarget );\n\n};\n\nBox2.prototype.empty = function () {\n\n\tconsole.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' );\n\treturn this.isEmpty();\n\n};\n\nBox2.prototype.isIntersectionBox = function ( box ) {\n\n\tconsole.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' );\n\treturn this.intersectsBox( box );\n\n};\n\nBox2.prototype.size = function ( optionalTarget ) {\n\n\tconsole.warn( 'THREE.Box2: .size() has been renamed to .getSize().' );\n\treturn this.getSize( optionalTarget );\n\n};\n\n//\n\nBox3.prototype.center = function ( optionalTarget ) {\n\n\tconsole.warn( 'THREE.Box3: .center() has been renamed to .getCenter().' );\n\treturn this.getCenter( optionalTarget );\n\n};\n\nBox3.prototype.empty = function () {\n\n\tconsole.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' );\n\treturn this.isEmpty();\n\n};\n\nBox3.prototype.isIntersectionBox = function ( box ) {\n\n\tconsole.warn( 'THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().' );\n\treturn this.intersectsBox( box );\n\n};\n\nBox3.prototype.isIntersectionSphere = function ( sphere ) {\n\n\tconsole.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' );\n\treturn this.intersectsSphere( sphere );\n\n};\n\nBox3.prototype.size = function ( optionalTarget ) {\n\n\tconsole.warn( 'THREE.Box3: .size() has been renamed to .getSize().' );\n\treturn this.getSize( optionalTarget );\n\n};\n\n//\n\nSphere.prototype.empty = function () {\n\n\tconsole.warn( 'THREE.Sphere: .empty() has been renamed to .isEmpty().' );\n\treturn this.isEmpty();\n\n};\n\n//\n\nFrustum.prototype.setFromMatrix = function ( m ) {\n\n\tconsole.warn( 'THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().' );\n\treturn this.setFromProjectionMatrix( m );\n\n};\n\n//\n\nLine3.prototype.center = function ( optionalTarget ) {\n\n\tconsole.warn( 'THREE.Line3: .center() has been renamed to .getCenter().' );\n\treturn this.getCenter( optionalTarget );\n\n};\n\n//\n\nMatrix3.prototype.flattenToArrayOffset = function ( array, offset ) {\n\n\tconsole.warn( 'THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.' );\n\treturn this.toArray( array, offset );\n\n};\n\nMatrix3.prototype.multiplyVector3 = function ( vector ) {\n\n\tconsole.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' );\n\treturn vector.applyMatrix3( this );\n\n};\n\nMatrix3.prototype.multiplyVector3Array = function ( /* a */ ) {\n\n\tconsole.error( 'THREE.Matrix3: .multiplyVector3Array() has been removed.' );\n\n};\n\nMatrix3.prototype.applyToBufferAttribute = function ( attribute ) {\n\n\tconsole.warn( 'THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.' );\n\treturn attribute.applyMatrix3( this );\n\n};\n\nMatrix3.prototype.applyToVector3Array = function ( /* array, offset, length */ ) {\n\n\tconsole.error( 'THREE.Matrix3: .applyToVector3Array() has been removed.' );\n\n};\n\nMatrix3.prototype.getInverse = function ( matrix ) {\n\n\tconsole.warn( 'THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead.' );\n\treturn this.copy( matrix ).invert();\n\n};\n\n//\n\nMatrix4.prototype.extractPosition = function ( m ) {\n\n\tconsole.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' );\n\treturn this.copyPosition( m );\n\n};\n\nMatrix4.prototype.flattenToArrayOffset = function ( array, offset ) {\n\n\tconsole.warn( 'THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.' );\n\treturn this.toArray( array, offset );\n\n};\n\nMatrix4.prototype.getPosition = function () {\n\n\tconsole.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' );\n\treturn new Vector3().setFromMatrixColumn( this, 3 );\n\n};\n\nMatrix4.prototype.setRotationFromQuaternion = function ( q ) {\n\n\tconsole.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' );\n\treturn this.makeRotationFromQuaternion( q );\n\n};\n\nMatrix4.prototype.multiplyToArray = function () {\n\n\tconsole.warn( 'THREE.Matrix4: .multiplyToArray() has been removed.' );\n\n};\n\nMatrix4.prototype.multiplyVector3 = function ( vector ) {\n\n\tconsole.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.' );\n\treturn vector.applyMatrix4( this );\n\n};\n\nMatrix4.prototype.multiplyVector4 = function ( vector ) {\n\n\tconsole.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' );\n\treturn vector.applyMatrix4( this );\n\n};\n\nMatrix4.prototype.multiplyVector3Array = function ( /* a */ ) {\n\n\tconsole.error( 'THREE.Matrix4: .multiplyVector3Array() has been removed.' );\n\n};\n\nMatrix4.prototype.rotateAxis = function ( v ) {\n\n\tconsole.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' );\n\tv.transformDirection( this );\n\n};\n\nMatrix4.prototype.crossVector = function ( vector ) {\n\n\tconsole.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' );\n\treturn vector.applyMatrix4( this );\n\n};\n\nMatrix4.prototype.translate = function () {\n\n\tconsole.error( 'THREE.Matrix4: .translate() has been removed.' );\n\n};\n\nMatrix4.prototype.rotateX = function () {\n\n\tconsole.error( 'THREE.Matrix4: .rotateX() has been removed.' );\n\n};\n\nMatrix4.prototype.rotateY = function () {\n\n\tconsole.error( 'THREE.Matrix4: .rotateY() has been removed.' );\n\n};\n\nMatrix4.prototype.rotateZ = function () {\n\n\tconsole.error( 'THREE.Matrix4: .rotateZ() has been removed.' );\n\n};\n\nMatrix4.prototype.rotateByAxis = function () {\n\n\tconsole.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' );\n\n};\n\nMatrix4.prototype.applyToBufferAttribute = function ( attribute ) {\n\n\tconsole.warn( 'THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.' );\n\treturn attribute.applyMatrix4( this );\n\n};\n\nMatrix4.prototype.applyToVector3Array = function ( /* array, offset, length */ ) {\n\n\tconsole.error( 'THREE.Matrix4: .applyToVector3Array() has been removed.' );\n\n};\n\nMatrix4.prototype.makeFrustum = function ( left, right, bottom, top, near, far ) {\n\n\tconsole.warn( 'THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.' );\n\treturn this.makePerspective( left, right, top, bottom, near, far );\n\n};\n\nMatrix4.prototype.getInverse = function ( matrix ) {\n\n\tconsole.warn( 'THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead.' );\n\treturn this.copy( matrix ).invert();\n\n};\n\n//\n\nPlane.prototype.isIntersectionLine = function ( line ) {\n\n\tconsole.warn( 'THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().' );\n\treturn this.intersectsLine( line );\n\n};\n\n//\n\nQuaternion.prototype.multiplyVector3 = function ( vector ) {\n\n\tconsole.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' );\n\treturn vector.applyQuaternion( this );\n\n};\n\nQuaternion.prototype.inverse = function ( ) {\n\n\tconsole.warn( 'THREE.Quaternion: .inverse() has been renamed to invert().' );\n\treturn this.invert();\n\n};\n\n//\n\nRay.prototype.isIntersectionBox = function ( box ) {\n\n\tconsole.warn( 'THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().' );\n\treturn this.intersectsBox( box );\n\n};\n\nRay.prototype.isIntersectionPlane = function ( plane ) {\n\n\tconsole.warn( 'THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().' );\n\treturn this.intersectsPlane( plane );\n\n};\n\nRay.prototype.isIntersectionSphere = function ( sphere ) {\n\n\tconsole.warn( 'THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().' );\n\treturn this.intersectsSphere( sphere );\n\n};\n\n//\n\nTriangle.prototype.area = function () {\n\n\tconsole.warn( 'THREE.Triangle: .area() has been renamed to .getArea().' );\n\treturn this.getArea();\n\n};\n\nTriangle.prototype.barycoordFromPoint = function ( point, target ) {\n\n\tconsole.warn( 'THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().' );\n\treturn this.getBarycoord( point, target );\n\n};\n\nTriangle.prototype.midpoint = function ( target ) {\n\n\tconsole.warn( 'THREE.Triangle: .midpoint() has been renamed to .getMidpoint().' );\n\treturn this.getMidpoint( target );\n\n};\n\nTriangle.prototypenormal = function ( target ) {\n\n\tconsole.warn( 'THREE.Triangle: .normal() has been renamed to .getNormal().' );\n\treturn this.getNormal( target );\n\n};\n\nTriangle.prototype.plane = function ( target ) {\n\n\tconsole.warn( 'THREE.Triangle: .plane() has been renamed to .getPlane().' );\n\treturn this.getPlane( target );\n\n};\n\nTriangle.barycoordFromPoint = function ( point, a, b, c, target ) {\n\n\tconsole.warn( 'THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().' );\n\treturn Triangle.getBarycoord( point, a, b, c, target );\n\n};\n\nTriangle.normal = function ( a, b, c, target ) {\n\n\tconsole.warn( 'THREE.Triangle: .normal() has been renamed to .getNormal().' );\n\treturn Triangle.getNormal( a, b, c, target );\n\n};\n\n//\n\nShape.prototype.extractAllPoints = function ( divisions ) {\n\n\tconsole.warn( 'THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.' );\n\treturn this.extractPoints( divisions );\n\n};\n\nShape.prototype.extrude = function ( options ) {\n\n\tconsole.warn( 'THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.' );\n\treturn new ExtrudeGeometry( this, options );\n\n};\n\nShape.prototype.makeGeometry = function ( options ) {\n\n\tconsole.warn( 'THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.' );\n\treturn new ShapeGeometry( this, options );\n\n};\n\n//\n\nVector2.prototype.fromAttribute = function ( attribute, index, offset ) {\n\n\tconsole.warn( 'THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().' );\n\treturn this.fromBufferAttribute( attribute, index, offset );\n\n};\n\nVector2.prototype.distanceToManhattan = function ( v ) {\n\n\tconsole.warn( 'THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().' );\n\treturn this.manhattanDistanceTo( v );\n\n};\n\nVector2.prototype.lengthManhattan = function () {\n\n\tconsole.warn( 'THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().' );\n\treturn this.manhattanLength();\n\n};\n\n//\n\nVector3.prototype.setEulerFromRotationMatrix = function () {\n\n\tconsole.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' );\n\n};\n\nVector3.prototype.setEulerFromQuaternion = function () {\n\n\tconsole.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' );\n\n};\n\nVector3.prototype.getPositionFromMatrix = function ( m ) {\n\n\tconsole.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' );\n\treturn this.setFromMatrixPosition( m );\n\n};\n\nVector3.prototype.getScaleFromMatrix = function ( m ) {\n\n\tconsole.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' );\n\treturn this.setFromMatrixScale( m );\n\n};\n\nVector3.prototype.getColumnFromMatrix = function ( index, matrix ) {\n\n\tconsole.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' );\n\treturn this.setFromMatrixColumn( matrix, index );\n\n};\n\nVector3.prototype.applyProjection = function ( m ) {\n\n\tconsole.warn( 'THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.' );\n\treturn this.applyMatrix4( m );\n\n};\n\nVector3.prototype.fromAttribute = function ( attribute, index, offset ) {\n\n\tconsole.warn( 'THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().' );\n\treturn this.fromBufferAttribute( attribute, index, offset );\n\n};\n\nVector3.prototype.distanceToManhattan = function ( v ) {\n\n\tconsole.warn( 'THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().' );\n\treturn this.manhattanDistanceTo( v );\n\n};\n\nVector3.prototype.lengthManhattan = function () {\n\n\tconsole.warn( 'THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().' );\n\treturn this.manhattanLength();\n\n};\n\n//\n\nVector4.prototype.fromAttribute = function ( attribute, index, offset ) {\n\n\tconsole.warn( 'THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().' );\n\treturn this.fromBufferAttribute( attribute, index, offset );\n\n};\n\nVector4.prototype.lengthManhattan = function () {\n\n\tconsole.warn( 'THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().' );\n\treturn this.manhattanLength();\n\n};\n\n//\n\nObject3D.prototype.getChildByName = function ( name ) {\n\n\tconsole.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );\n\treturn this.getObjectByName( name );\n\n};\n\nObject3D.prototype.renderDepth = function () {\n\n\tconsole.warn( 'THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.' );\n\n};\n\nObject3D.prototype.translate = function ( distance, axis ) {\n\n\tconsole.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' );\n\treturn this.translateOnAxis( axis, distance );\n\n};\n\nObject3D.prototype.getWorldRotation = function () {\n\n\tconsole.error( 'THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.' );\n\n};\n\nObject3D.prototype.applyMatrix = function ( matrix ) {\n\n\tconsole.warn( 'THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().' );\n\treturn this.applyMatrix4( matrix );\n\n};\n\nObject.defineProperties( Object3D.prototype, {\n\n\teulerOrder: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );\n\t\t\treturn this.rotation.order;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );\n\t\t\tthis.rotation.order = value;\n\n\t\t}\n\t},\n\tuseQuaternion: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );\n\n\t\t}\n\t}\n\n} );\n\nMesh.prototype.setDrawMode = function () {\n\n\tconsole.error( 'THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.' );\n\n};\n\nObject.defineProperties( Mesh.prototype, {\n\n\tdrawMode: {\n\t\tget: function () {\n\n\t\t\tconsole.error( 'THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.' );\n\t\t\treturn TrianglesDrawMode;\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.error( 'THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.' );\n\n\t\t}\n\t}\n\n} );\n\nSkinnedMesh.prototype.initBones = function () {\n\n\tconsole.error( 'THREE.SkinnedMesh: initBones() has been removed.' );\n\n};\n\n//\n\nPerspectiveCamera.prototype.setLens = function ( focalLength, filmGauge ) {\n\n\tconsole.warn( 'THREE.PerspectiveCamera.setLens is deprecated. ' +\n\t\t\t'Use .setFocalLength and .filmGauge for a photographic setup.' );\n\n\tif ( filmGauge !== undefined ) this.filmGauge = filmGauge;\n\tthis.setFocalLength( focalLength );\n\n};\n\n//\n\nObject.defineProperties( Light.prototype, {\n\tonlyShadow: {\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Light: .onlyShadow has been removed.' );\n\n\t\t}\n\t},\n\tshadowCameraFov: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraFov is now .shadow.camera.fov.' );\n\t\t\tthis.shadow.camera.fov = value;\n\n\t\t}\n\t},\n\tshadowCameraLeft: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraLeft is now .shadow.camera.left.' );\n\t\t\tthis.shadow.camera.left = value;\n\n\t\t}\n\t},\n\tshadowCameraRight: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraRight is now .shadow.camera.right.' );\n\t\t\tthis.shadow.camera.right = value;\n\n\t\t}\n\t},\n\tshadowCameraTop: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraTop is now .shadow.camera.top.' );\n\t\t\tthis.shadow.camera.top = value;\n\n\t\t}\n\t},\n\tshadowCameraBottom: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.' );\n\t\t\tthis.shadow.camera.bottom = value;\n\n\t\t}\n\t},\n\tshadowCameraNear: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraNear is now .shadow.camera.near.' );\n\t\t\tthis.shadow.camera.near = value;\n\n\t\t}\n\t},\n\tshadowCameraFar: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraFar is now .shadow.camera.far.' );\n\t\t\tthis.shadow.camera.far = value;\n\n\t\t}\n\t},\n\tshadowCameraVisible: {\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.' );\n\n\t\t}\n\t},\n\tshadowBias: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowBias is now .shadow.bias.' );\n\t\t\tthis.shadow.bias = value;\n\n\t\t}\n\t},\n\tshadowDarkness: {\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowDarkness has been removed.' );\n\n\t\t}\n\t},\n\tshadowMapWidth: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.' );\n\t\t\tthis.shadow.mapSize.width = value;\n\n\t\t}\n\t},\n\tshadowMapHeight: {\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.' );\n\t\t\tthis.shadow.mapSize.height = value;\n\n\t\t}\n\t}\n} );\n\n//\n\nObject.defineProperties( BufferAttribute.prototype, {\n\n\tlength: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.BufferAttribute: .length has been deprecated. Use .count instead.' );\n\t\t\treturn this.array.length;\n\n\t\t}\n\t},\n\tdynamic: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.' );\n\t\t\treturn this.usage === DynamicDrawUsage;\n\n\t\t},\n\t\tset: function ( /* value */ ) {\n\n\t\t\tconsole.warn( 'THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.' );\n\t\t\tthis.setUsage( DynamicDrawUsage );\n\n\t\t}\n\t}\n\n} );\n\nBufferAttribute.prototype.setDynamic = function ( value ) {\n\n\tconsole.warn( 'THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.' );\n\tthis.setUsage( value === true ? DynamicDrawUsage : StaticDrawUsage );\n\treturn this;\n\n};\n\nBufferAttribute.prototype.copyIndicesArray = function ( /* indices */ ) {\n\n\tconsole.error( 'THREE.BufferAttribute: .copyIndicesArray() has been removed.' );\n\n},\n\nBufferAttribute.prototype.setArray = function ( /* array */ ) {\n\n\tconsole.error( 'THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers' );\n\n};\n\n//\n\nBufferGeometry.prototype.addIndex = function ( index ) {\n\n\tconsole.warn( 'THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().' );\n\tthis.setIndex( index );\n\n};\n\nBufferGeometry.prototype.addAttribute = function ( name, attribute ) {\n\n\tconsole.warn( 'THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().' );\n\n\tif ( ! ( attribute && attribute.isBufferAttribute ) && ! ( attribute && attribute.isInterleavedBufferAttribute ) ) {\n\n\t\tconsole.warn( 'THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).' );\n\n\t\treturn this.setAttribute( name, new BufferAttribute( arguments[ 1 ], arguments[ 2 ] ) );\n\n\t}\n\n\tif ( name === 'index' ) {\n\n\t\tconsole.warn( 'THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.' );\n\t\tthis.setIndex( attribute );\n\n\t\treturn this;\n\n\t}\n\n\treturn this.setAttribute( name, attribute );\n\n};\n\nBufferGeometry.prototype.addDrawCall = function ( start, count, indexOffset ) {\n\n\tif ( indexOffset !== undefined ) {\n\n\t\tconsole.warn( 'THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.' );\n\n\t}\n\n\tconsole.warn( 'THREE.BufferGeometry: .addDrawCall() is now .addGroup().' );\n\tthis.addGroup( start, count );\n\n};\n\nBufferGeometry.prototype.clearDrawCalls = function () {\n\n\tconsole.warn( 'THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().' );\n\tthis.clearGroups();\n\n};\n\nBufferGeometry.prototype.computeOffsets = function () {\n\n\tconsole.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.' );\n\n};\n\nBufferGeometry.prototype.removeAttribute = function ( name ) {\n\n\tconsole.warn( 'THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().' );\n\n\treturn this.deleteAttribute( name );\n\n};\n\nBufferGeometry.prototype.applyMatrix = function ( matrix ) {\n\n\tconsole.warn( 'THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().' );\n\treturn this.applyMatrix4( matrix );\n\n};\n\nObject.defineProperties( BufferGeometry.prototype, {\n\n\tdrawcalls: {\n\t\tget: function () {\n\n\t\t\tconsole.error( 'THREE.BufferGeometry: .drawcalls has been renamed to .groups.' );\n\t\t\treturn this.groups;\n\n\t\t}\n\t},\n\toffsets: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.BufferGeometry: .offsets has been renamed to .groups.' );\n\t\t\treturn this.groups;\n\n\t\t}\n\t}\n\n} );\n\nInterleavedBuffer.prototype.setDynamic = function ( value ) {\n\n\tconsole.warn( 'THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.' );\n\tthis.setUsage( value === true ? DynamicDrawUsage : StaticDrawUsage );\n\treturn this;\n\n};\n\nInterleavedBuffer.prototype.setArray = function ( /* array */ ) {\n\n\tconsole.error( 'THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers' );\n\n};\n\n//\n\nExtrudeGeometry.prototype.getArrays = function () {\n\n\tconsole.error( 'THREE.ExtrudeGeometry: .getArrays() has been removed.' );\n\n};\n\nExtrudeGeometry.prototype.addShapeList = function () {\n\n\tconsole.error( 'THREE.ExtrudeGeometry: .addShapeList() has been removed.' );\n\n};\n\nExtrudeGeometry.prototype.addShape = function () {\n\n\tconsole.error( 'THREE.ExtrudeGeometry: .addShape() has been removed.' );\n\n};\n\n//\n\nScene.prototype.dispose = function () {\n\n\tconsole.error( 'THREE.Scene: .dispose() has been removed.' );\n\n};\n\n//\n\nUniform.prototype.onUpdate = function () {\n\n\tconsole.warn( 'THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.' );\n\treturn this;\n\n};\n\n//\n\nObject.defineProperties( Material.prototype, {\n\n\twrapAround: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.Material: .wrapAround has been removed.' );\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Material: .wrapAround has been removed.' );\n\n\t\t}\n\t},\n\n\toverdraw: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.Material: .overdraw has been removed.' );\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.Material: .overdraw has been removed.' );\n\n\t\t}\n\t},\n\n\twrapRGB: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.Material: .wrapRGB has been removed.' );\n\t\t\treturn new Color();\n\n\t\t}\n\t},\n\n\tshading: {\n\t\tget: function () {\n\n\t\t\tconsole.error( 'THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.' );\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.' );\n\t\t\tthis.flatShading = ( value === FlatShading );\n\n\t\t}\n\t},\n\n\tstencilMask: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.' );\n\t\t\treturn this.stencilFuncMask;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.' );\n\t\t\tthis.stencilFuncMask = value;\n\n\t\t}\n\t},\n\n\tvertexTangents: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.' + this.type + ': .vertexTangents has been removed.' );\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.' + this.type + ': .vertexTangents has been removed.' );\n\n\t\t}\n\t},\n\n} );\n\nObject.defineProperties( ShaderMaterial.prototype, {\n\n\tderivatives: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );\n\t\t\treturn this.extensions.derivatives;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );\n\t\t\tthis.extensions.derivatives = value;\n\n\t\t}\n\t}\n\n} );\n\n//\n\nWebGLRenderer.prototype.clearTarget = function ( renderTarget, color, depth, stencil ) {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.' );\n\tthis.setRenderTarget( renderTarget );\n\tthis.clear( color, depth, stencil );\n\n};\n\nWebGLRenderer.prototype.animate = function ( callback ) {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .animate() is now .setAnimationLoop().' );\n\tthis.setAnimationLoop( callback );\n\n};\n\nWebGLRenderer.prototype.getCurrentRenderTarget = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().' );\n\treturn this.getRenderTarget();\n\n};\n\nWebGLRenderer.prototype.getMaxAnisotropy = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().' );\n\treturn this.capabilities.getMaxAnisotropy();\n\n};\n\nWebGLRenderer.prototype.getPrecision = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.' );\n\treturn this.capabilities.precision;\n\n};\n\nWebGLRenderer.prototype.resetGLState = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .resetGLState() is now .state.reset().' );\n\treturn this.state.reset();\n\n};\n\nWebGLRenderer.prototype.supportsFloatTextures = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \\'OES_texture_float\\' ).' );\n\treturn this.extensions.get( 'OES_texture_float' );\n\n};\n\nWebGLRenderer.prototype.supportsHalfFloatTextures = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \\'OES_texture_half_float\\' ).' );\n\treturn this.extensions.get( 'OES_texture_half_float' );\n\n};\n\nWebGLRenderer.prototype.supportsStandardDerivatives = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \\'OES_standard_derivatives\\' ).' );\n\treturn this.extensions.get( 'OES_standard_derivatives' );\n\n};\n\nWebGLRenderer.prototype.supportsCompressedTextureS3TC = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \\'WEBGL_compressed_texture_s3tc\\' ).' );\n\treturn this.extensions.get( 'WEBGL_compressed_texture_s3tc' );\n\n};\n\nWebGLRenderer.prototype.supportsCompressedTexturePVRTC = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \\'WEBGL_compressed_texture_pvrtc\\' ).' );\n\treturn this.extensions.get( 'WEBGL_compressed_texture_pvrtc' );\n\n};\n\nWebGLRenderer.prototype.supportsBlendMinMax = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \\'EXT_blend_minmax\\' ).' );\n\treturn this.extensions.get( 'EXT_blend_minmax' );\n\n};\n\nWebGLRenderer.prototype.supportsVertexTextures = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.' );\n\treturn this.capabilities.vertexTextures;\n\n};\n\nWebGLRenderer.prototype.supportsInstancedArrays = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \\'ANGLE_instanced_arrays\\' ).' );\n\treturn this.extensions.get( 'ANGLE_instanced_arrays' );\n\n};\n\nWebGLRenderer.prototype.enableScissorTest = function ( boolean ) {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().' );\n\tthis.setScissorTest( boolean );\n\n};\n\nWebGLRenderer.prototype.initMaterial = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );\n\n};\n\nWebGLRenderer.prototype.addPrePlugin = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' );\n\n};\n\nWebGLRenderer.prototype.addPostPlugin = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' );\n\n};\n\nWebGLRenderer.prototype.updateShadowMap = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' );\n\n};\n\nWebGLRenderer.prototype.setFaceCulling = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .setFaceCulling() has been removed.' );\n\n};\n\nWebGLRenderer.prototype.allocTextureUnit = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .allocTextureUnit() has been removed.' );\n\n};\n\nWebGLRenderer.prototype.setTexture = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .setTexture() has been removed.' );\n\n};\n\nWebGLRenderer.prototype.setTexture2D = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .setTexture2D() has been removed.' );\n\n};\n\nWebGLRenderer.prototype.setTextureCube = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .setTextureCube() has been removed.' );\n\n};\n\nWebGLRenderer.prototype.getActiveMipMapLevel = function () {\n\n\tconsole.warn( 'THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().' );\n\treturn this.getActiveMipmapLevel();\n\n};\n\nObject.defineProperties( WebGLRenderer.prototype, {\n\n\tshadowMapEnabled: {\n\t\tget: function () {\n\n\t\t\treturn this.shadowMap.enabled;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.' );\n\t\t\tthis.shadowMap.enabled = value;\n\n\t\t}\n\t},\n\tshadowMapType: {\n\t\tget: function () {\n\n\t\t\treturn this.shadowMap.type;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.' );\n\t\t\tthis.shadowMap.type = value;\n\n\t\t}\n\t},\n\tshadowMapCullFace: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.' );\n\t\t\treturn undefined;\n\n\t\t},\n\t\tset: function ( /* value */ ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.' );\n\n\t\t}\n\t},\n\tcontext: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.' );\n\t\t\treturn this.getContext();\n\n\t\t}\n\t},\n\tvr: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .vr has been renamed to .xr' );\n\t\t\treturn this.xr;\n\n\t\t}\n\t},\n\tgammaInput: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.' );\n\t\t\treturn false;\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.' );\n\n\t\t}\n\t},\n\tgammaOutput: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.' );\n\t\t\treturn false;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.' );\n\t\t\tthis.outputEncoding = ( value === true ) ? sRGBEncoding : LinearEncoding;\n\n\t\t}\n\t},\n\ttoneMappingWhitePoint: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.' );\n\t\t\treturn 1.0;\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.' );\n\n\t\t}\n\t},\n\n} );\n\nObject.defineProperties( WebGLShadowMap.prototype, {\n\n\tcullFace: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.' );\n\t\t\treturn undefined;\n\n\t\t},\n\t\tset: function ( /* cullFace */ ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.' );\n\n\t\t}\n\t},\n\trenderReverseSided: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.' );\n\t\t\treturn undefined;\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.' );\n\n\t\t}\n\t},\n\trenderSingleSided: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.' );\n\t\t\treturn undefined;\n\n\t\t},\n\t\tset: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.' );\n\n\t\t}\n\t}\n\n} );\n\nfunction WebGLRenderTargetCube( width, height, options ) {\n\n\tconsole.warn( 'THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options ).' );\n\treturn new WebGLCubeRenderTarget( width, options );\n\n}\n\n//\n\nObject.defineProperties( WebGLRenderTarget.prototype, {\n\n\twrapS: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );\n\t\t\treturn this.texture.wrapS;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );\n\t\t\tthis.texture.wrapS = value;\n\n\t\t}\n\t},\n\twrapT: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );\n\t\t\treturn this.texture.wrapT;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );\n\t\t\tthis.texture.wrapT = value;\n\n\t\t}\n\t},\n\tmagFilter: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );\n\t\t\treturn this.texture.magFilter;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );\n\t\t\tthis.texture.magFilter = value;\n\n\t\t}\n\t},\n\tminFilter: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );\n\t\t\treturn this.texture.minFilter;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );\n\t\t\tthis.texture.minFilter = value;\n\n\t\t}\n\t},\n\tanisotropy: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );\n\t\t\treturn this.texture.anisotropy;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );\n\t\t\tthis.texture.anisotropy = value;\n\n\t\t}\n\t},\n\toffset: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );\n\t\t\treturn this.texture.offset;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );\n\t\t\tthis.texture.offset = value;\n\n\t\t}\n\t},\n\trepeat: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );\n\t\t\treturn this.texture.repeat;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );\n\t\t\tthis.texture.repeat = value;\n\n\t\t}\n\t},\n\tformat: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );\n\t\t\treturn this.texture.format;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );\n\t\t\tthis.texture.format = value;\n\n\t\t}\n\t},\n\ttype: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );\n\t\t\treturn this.texture.type;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );\n\t\t\tthis.texture.type = value;\n\n\t\t}\n\t},\n\tgenerateMipmaps: {\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );\n\t\t\treturn this.texture.generateMipmaps;\n\n\t\t},\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );\n\t\t\tthis.texture.generateMipmaps = value;\n\n\t\t}\n\t}\n\n} );\n\n//\n\nAudio.prototype.load = function ( file ) {\n\n\tconsole.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' );\n\tconst scope = this;\n\tconst audioLoader = new AudioLoader();\n\taudioLoader.load( file, function ( buffer ) {\n\n\t\tscope.setBuffer( buffer );\n\n\t} );\n\treturn this;\n\n};\n\n\nAudioAnalyser.prototype.getData = function () {\n\n\tconsole.warn( 'THREE.AudioAnalyser: .getData() is now .getFrequencyData().' );\n\treturn this.getFrequencyData();\n\n};\n\n//\n\nCubeCamera.prototype.updateCubeMap = function ( renderer, scene ) {\n\n\tconsole.warn( 'THREE.CubeCamera: .updateCubeMap() is now .update().' );\n\treturn this.update( renderer, scene );\n\n};\n\nCubeCamera.prototype.clear = function ( renderer, color, depth, stencil ) {\n\n\tconsole.warn( 'THREE.CubeCamera: .clear() is now .renderTarget.clear().' );\n\treturn this.renderTarget.clear( renderer, color, depth, stencil );\n\n};\n\nImageUtils.crossOrigin = undefined;\n\nImageUtils.loadTexture = function ( url, mapping, onLoad, onError ) {\n\n\tconsole.warn( 'THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.' );\n\n\tconst loader = new TextureLoader();\n\tloader.setCrossOrigin( this.crossOrigin );\n\n\tconst texture = loader.load( url, onLoad, undefined, onError );\n\n\tif ( mapping ) texture.mapping = mapping;\n\n\treturn texture;\n\n};\n\nImageUtils.loadTextureCube = function ( urls, mapping, onLoad, onError ) {\n\n\tconsole.warn( 'THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.' );\n\n\tconst loader = new CubeTextureLoader();\n\tloader.setCrossOrigin( this.crossOrigin );\n\n\tconst texture = loader.load( urls, onLoad, undefined, onError );\n\n\tif ( mapping ) texture.mapping = mapping;\n\n\treturn texture;\n\n};\n\nImageUtils.loadCompressedTexture = function () {\n\n\tconsole.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' );\n\n};\n\nImageUtils.loadCompressedTextureCube = function () {\n\n\tconsole.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' );\n\n};\n\n//\n\nfunction CanvasRenderer() {\n\n\tconsole.error( 'THREE.CanvasRenderer has been removed' );\n\n}\n\n//\n\nfunction JSONLoader() {\n\n\tconsole.error( 'THREE.JSONLoader has been removed.' );\n\n}\n\n//\n\nconst SceneUtils = {\n\n\tcreateMultiMaterialObject: function ( /* geometry, materials */ ) {\n\n\t\tconsole.error( 'THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js' );\n\n\t},\n\n\tdetach: function ( /* child, parent, scene */ ) {\n\n\t\tconsole.error( 'THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js' );\n\n\t},\n\n\tattach: function ( /* child, scene, parent */ ) {\n\n\t\tconsole.error( 'THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js' );\n\n\t}\n\n};\n\n//\n\nfunction LensFlare() {\n\n\tconsole.error( 'THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js' );\n\n}\n\n//\n\nfunction ParametricGeometry() {\n\n\tconsole.error( 'THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js' );\n\treturn new BufferGeometry();\n\n}\n\nfunction TextGeometry() {\n\n\tconsole.error( 'THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js' );\n\treturn new BufferGeometry();\n\n}\n\nfunction FontLoader() {\n\n\tconsole.error( 'THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js' );\n\n}\n\nfunction Font() {\n\n\tconsole.error( 'THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js' );\n\n}\n\nfunction ImmediateRenderObject() {\n\n\tconsole.error( 'THREE.ImmediateRenderObject has been removed.' );\n\n}\n\nif ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {\n\n\t/* eslint-disable no-undef */\n\t__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {\n\t\trevision: REVISION,\n\t} } ) );\n\t/* eslint-enable no-undef */\n\n}\n\nif ( typeof window !== 'undefined' ) {\n\n\tif ( window.__THREE__ ) {\n\n\t\tconsole.warn( 'WARNING: Multiple instances of Three.js being imported.' );\n\n\t} else {\n\n\t\twindow.__THREE__ = REVISION;\n\n\t}\n\n}\n\nexport { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightProbe, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, AxisHelper, BackSide, BasicDepthPacking, BasicShadowMap, BinaryTextureLoader, Bone, BooleanKeyframeTrack, BoundingBoxHelper, Box2, Box3, Box3Helper, BoxGeometry as BoxBufferGeometry, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasRenderer, CanvasTexture, CatmullRomCurve3, CineonToneMapping, CircleGeometry as CircleBufferGeometry, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, CompressedTexture, CompressedTextureLoader, ConeGeometry as ConeBufferGeometry, ConeGeometry, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubeUVRefractionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry as CylinderBufferGeometry, CylinderGeometry, Cylindrical, DataTexture, DataTexture2DArray, DataTexture3D, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry as DodecahedronBufferGeometry, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicBufferAttribute, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EdgesHelper, EllipseCurve, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry as ExtrudeBufferGeometry, ExtrudeGeometry, FaceColors, FileLoader, FlatShading, Float16BufferAttribute, Float32Attribute, Float32BufferAttribute, Float64Attribute, Float64BufferAttribute, FloatType, Fog, FogExp2, Font, FontLoader, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GammaEncoding, GreaterDepth, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, HemisphereLightProbe, IcosahedronGeometry as IcosahedronBufferGeometry, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, ImmediateRenderObject, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16Attribute, Int16BufferAttribute, Int32Attribute, Int32BufferAttribute, Int8Attribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, JSONLoader, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry as LatheBufferGeometry, LatheGeometry, Layers, LensFlare, LessDepth, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LinePieces, LineSegments, LineStrip, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearToneMapping, Loader, LoaderUtils, LoadingManager, LogLuvEncoding, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils as Math, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshFaceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiMaterial, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverDepth, NeverStencilFunc, NoBlending, NoColors, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry as OctahedronBufferGeometry, OctahedronGeometry, OneFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, ParametricGeometry, Particle, ParticleBasicMaterial, ParticleSystem, ParticleSystemMaterial, Path, PerspectiveCamera, Plane, PlaneGeometry as PlaneBufferGeometry, PlaneGeometry, PlaneHelper, PointCloud, PointCloudMaterial, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry as PolyhedronBufferGeometry, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, REVISION, RGBADepthPacking, 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, RGBDEncoding, RGBEEncoding, RGBEFormat, RGBFormat, RGBIntegerFormat, RGBM16Encoding, RGBM7Encoding, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry as RingBufferGeometry, RingGeometry, SRGB8_ALPHA8_ASTC_10x10_Format, SRGB8_ALPHA8_ASTC_10x5_Format, SRGB8_ALPHA8_ASTC_10x6_Format, SRGB8_ALPHA8_ASTC_10x8_Format, SRGB8_ALPHA8_ASTC_12x10_Format, SRGB8_ALPHA8_ASTC_12x12_Format, SRGB8_ALPHA8_ASTC_4x4_Format, SRGB8_ALPHA8_ASTC_5x4_Format, SRGB8_ALPHA8_ASTC_5x5_Format, SRGB8_ALPHA8_ASTC_6x5_Format, SRGB8_ALPHA8_ASTC_6x6_Format, SRGB8_ALPHA8_ASTC_8x5_Format, SRGB8_ALPHA8_ASTC_8x6_Format, SRGB8_ALPHA8_ASTC_8x8_Format, Scene, SceneUtils, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry as ShapeBufferGeometry, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, SmoothShading, Sphere, SphereGeometry as SphereBufferGeometry, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry as TetrahedronBufferGeometry, TetrahedronGeometry, TextGeometry, Texture, TextureLoader, TorusGeometry as TorusBufferGeometry, TorusGeometry, TorusKnotGeometry as TorusKnotBufferGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry as TubeBufferGeometry, TubeGeometry, UVMapping, Uint16Attribute, Uint16BufferAttribute, Uint32Attribute, Uint32BufferAttribute, Uint8Attribute, Uint8BufferAttribute, Uint8ClampedAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShort565Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, Vertex, VertexColors, VideoTexture, WebGL1Renderer, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLMultisampleRenderTarget, WebGLRenderTarget, WebGLRenderTargetCube, WebGLRenderer, WebGLUtils, WireframeGeometry, WireframeHelper, WrapAroundEnding, XHRLoader, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, sRGBEncoding };\n","const DEG2RAD = Math.PI / 180;\nconst RAD2DEG = 180 / Math.PI;\nconst WGS84A = 6378137.0;\nconst WGS84B = 6356752.31424518;\n\n/**\n * Convert coordinates from geodetic (WGS84) reference to local topocentric\n * (ENU) reference.\n *\n * @param {number} lng Longitude in degrees.\n * @param {number} lat Latitude in degrees.\n * @param {number} alt Altitude in meters.\n * @param {number} refLng Reference longitude in degrees.\n * @param {number} refLat Reference latitude in degrees.\n * @param {number} refAlt Reference altitude in meters.\n * @returns {Array<number>} The x, y, z local topocentric ENU coordinates.\n */\nexport function geodeticToEnu(\n lng: number,\n lat: number,\n alt: number,\n refLng: number,\n refLat: number,\n refAlt: number)\n : number[] {\n\n const ecef = geodeticToEcef(\n lng,\n lat,\n alt);\n\n return ecefToEnu(\n ecef[0],\n ecef[1],\n ecef[2],\n refLng,\n refLat,\n refAlt);\n}\n\n/**\n * Convert coordinates from local topocentric (ENU) reference to\n * geodetic (WGS84) reference.\n *\n * @param {number} x Topocentric ENU coordinate in East direction.\n * @param {number} y Topocentric ENU coordinate in North direction.\n * @param {number} z Topocentric ENU coordinate in Up direction.\n * @param {number} refLng Reference longitude in degrees.\n * @param {number} refLat Reference latitude in degrees.\n * @param {number} refAlt Reference altitude in meters.\n * @returns {Array<number>} The longitude, latitude in degrees\n * and altitude in meters.\n */\nexport function enuToGeodetic(\n x: number,\n y: number,\n z: number,\n refLng: number,\n refLat: number,\n refAlt: number)\n : number[] {\n\n const ecef = enuToEcef(\n x,\n y,\n z,\n refLng,\n refLat,\n refAlt);\n\n return ecefToGeodetic(\n ecef[0],\n ecef[1],\n ecef[2]);\n}\n\n/**\n * Convert coordinates from Earth-Centered, Earth-Fixed (ECEF) reference\n * to local topocentric (ENU) reference.\n *\n * @param {number} X ECEF X-value.\n * @param {number} Y ECEF Y-value.\n * @param {number} Z ECEF Z-value.\n * @param {number} refLng Reference longitude in degrees.\n * @param {number} refLat Reference latitude in degrees.\n * @param {number} refAlt Reference altitude in meters.\n * @returns {Array<number>} The x, y, z topocentric ENU coordinates in East, North\n * and Up directions respectively.\n */\nexport function ecefToEnu(\n X: number,\n Y: number,\n Z: number,\n refLng: number,\n refLat: number,\n refAlt: number)\n : number[] {\n\n const refEcef = geodeticToEcef(\n refLng,\n refLat,\n refAlt);\n\n const V = [\n X - refEcef[0],\n Y - refEcef[1],\n Z - refEcef[2],\n ];\n\n refLng = refLng * DEG2RAD;\n refLat = refLat * DEG2RAD;\n\n const cosLng = Math.cos(refLng);\n const sinLng = Math.sin(refLng);\n const cosLat = Math.cos(refLat);\n const sinLat = Math.sin(refLat);\n\n const x = -sinLng * V[0] + cosLng * V[1];\n const y = -sinLat * cosLng * V[0] - sinLat * sinLng * V[1] + cosLat * V[2];\n const z = cosLat * cosLng * V[0] + cosLat * sinLng * V[1] + sinLat * V[2];\n\n return [x, y, z];\n}\n\n/**\n * Convert coordinates from local topocentric (ENU) reference\n * to Earth-Centered, Earth-Fixed (ECEF) reference.\n *\n * @param {number} x Topocentric ENU coordinate in East direction.\n * @param {number} y Topocentric ENU coordinate in North direction.\n * @param {number} z Topocentric ENU coordinate in Up direction.\n * @param {number} refLng Reference longitude in degrees.\n * @param {number} refLat Reference latitude in degrees.\n * @param {number} refAlt Reference altitude in meters.\n * @returns {Array<number>} The X, Y, Z ECEF coordinates.\n */\nexport function enuToEcef(\n x: number,\n y: number,\n z: number,\n refLng: number,\n refLat: number,\n refAlt: number)\n : number[] {\n\n const refEcef = geodeticToEcef(\n refLng,\n refLat,\n refAlt);\n\n refLng = refLng * DEG2RAD;\n refLat = refLat * DEG2RAD;\n\n const cosLng = Math.cos(refLng);\n const sinLng = Math.sin(refLng);\n const cosLat = Math.cos(refLat);\n const sinLat = Math.sin(refLat);\n\n const X =\n -sinLng * x\n - sinLat * cosLng * y\n + cosLat * cosLng * z\n + refEcef[0];\n\n const Y =\n cosLng * x\n - sinLat * sinLng * y\n + cosLat * sinLng * z\n + refEcef[1];\n\n const Z =\n cosLat * y +\n sinLat * z +\n refEcef[2];\n\n return [X, Y, Z];\n}\n\n/**\n * Convert coordinates from geodetic reference (WGS84) to Earth-Centered,\n * Earth-Fixed (ECEF) reference.\n *\n * @param {number} lng Longitude in degrees.\n * @param {number} lat Latitude in degrees.\n * @param {number} alt Altitude in meters.\n * @returns {Array<number>} The X, Y, Z ECEF coordinates.\n */\nexport function geodeticToEcef(\n lng: number,\n lat: number,\n alt: number)\n : number[] {\n const a = WGS84A;\n const b = WGS84B;\n\n lng = lng * DEG2RAD;\n lat = lat * DEG2RAD;\n\n const cosLng = Math.cos(lng);\n const sinLng = Math.sin(lng);\n const cosLat = Math.cos(lat);\n const sinLat = Math.sin(lat);\n\n const a2 = a * a;\n const b2 = b * b;\n\n const L = 1.0 / Math.sqrt(a2 * cosLat * cosLat + b2 * sinLat * sinLat);\n\n const nhcl = (a2 * L + alt) * cosLat;\n\n const X = nhcl * cosLng;\n const Y = nhcl * sinLng;\n const Z = (b2 * L + alt) * sinLat;\n\n return [X, Y, Z];\n}\n\n/**\n * Convert coordinates from Earth-Centered, Earth-Fixed (ECEF) reference\n * to geodetic reference (WGS84).\n *\n * @param {number} X ECEF X-value.\n * @param {number} Y ECEF Y-value.\n * @param {number} Z ECEF Z-value.\n * @returns {Array<number>} The longitude, latitude in degrees\n * and altitude in meters.\n */\nexport function ecefToGeodetic(\n X: number,\n Y: number,\n Z: number)\n : number[] {\n const a = WGS84A;\n const b = WGS84B;\n\n const a2 = a * a;\n const b2 = b * b;\n\n const a2mb2 = a2 - b2;\n\n const ea = Math.sqrt(a2mb2 / a2);\n const eb = Math.sqrt(a2mb2 / b2);\n\n const p = Math.sqrt(X * X + Y * Y);\n const theta = Math.atan2(Z * a, p * b);\n\n const sinTheta = Math.sin(theta);\n const cosTheta = Math.cos(theta);\n\n const lng = Math.atan2(Y, X);\n const lat = Math.atan2(\n Z + eb * eb * b * sinTheta * sinTheta * sinTheta,\n p - ea * ea * a * cosTheta * cosTheta * cosTheta);\n\n const sinLat = Math.sin(lat);\n const cosLat = Math.cos(lat);\n\n const N = a / Math.sqrt(1 - ea * ea * sinLat * sinLat);\n const alt = p / cosLat - N;\n\n return [\n lng * RAD2DEG,\n lat * RAD2DEG,\n alt];\n}\n","import * as THREE from \"three\";\n\nimport { LngLat } from \"../api/interfaces/LngLat\";\nimport { enuToGeodetic } from \"../geo/GeoCoords\";\n\n/**\n * @class GraphCalculator\n *\n * @classdesc Represents a calculator for graph entities.\n */\nexport class GraphCalculator {\n /**\n * Get the bounding box corners for a circle with radius of a threshold\n * with center in a geodetic position.\n *\n * @param {LngLat} lngLat - Longitude, latitude to encode.\n * @param {number} threshold - Threshold distance from the position in meters.\n *\n * @returns {Array<LngLat>} The south west and north east corners of the\n * bounding box.\n */\n public boundingBoxCorners(\n lngLat: LngLat,\n threshold: number)\n : [LngLat, LngLat] {\n\n const sw = enuToGeodetic(\n -threshold,\n -threshold,\n 0,\n lngLat.lng,\n lngLat.lat,\n 0);\n\n const ne = enuToGeodetic(\n threshold,\n threshold,\n 0,\n lngLat.lng,\n lngLat.lat,\n 0);\n\n return [\n { lat: sw[1], lng: sw[0] },\n { lat: ne[1], lng: ne[0] },\n ];\n }\n\n /**\n * Convert a compass angle to an angle axis rotation vector.\n *\n * @param {number} compassAngle - The compass angle in degrees.\n * @param {number} orientation - The orientation of the original image.\n *\n * @returns {Array<number>} Angle axis rotation vector.\n */\n public rotationFromCompass(\n compassAngle: number,\n orientation: number)\n : number[] {\n\n let x = 0;\n let y = 0;\n let z = 0;\n\n switch (orientation) {\n case 1:\n x = Math.PI / 2;\n break;\n case 3:\n x = -Math.PI / 2;\n z = Math.PI;\n break;\n case 6:\n y = -Math.PI / 2;\n z = -Math.PI / 2;\n break;\n case 8:\n y = Math.PI / 2;\n z = Math.PI / 2;\n break;\n default:\n break;\n }\n\n const rz = new THREE.Matrix4()\n .makeRotationZ(z);\n const euler = new THREE.Euler(\n x,\n y,\n compassAngle * Math.PI / 180,\n \"XYZ\");\n const re = new THREE.Matrix4()\n .makeRotationFromEuler(euler);\n\n const rotation = new THREE.Vector4()\n .setAxisAngleFromRotationMatrix(\n re.multiply(rz));\n\n return rotation\n .multiplyScalar(rotation.w)\n .toArray()\n .slice(0, 3);\n }\n}\n","import { Observable } from \"rxjs\";\nimport { map } from \"rxjs/operators\";\n\nimport { ImageCache } from \"./ImageCache\";\nimport { NavigationEdge } from \"./edge/interfaces/NavigationEdge\";\nimport { NavigationEdgeStatus } from \"./interfaces/NavigationEdgeStatus\";\n\nimport { CoreImageEnt } from \"../api/ents/CoreImageEnt\";\nimport { SpatialImageEnt } from \"../api/ents/SpatialImageEnt\";\nimport { LngLat } from \"../api/interfaces/LngLat\";\nimport { MeshContract } from \"../api/contracts/MeshContract\";\n\n/**\n * @class Image\n *\n * @classdesc Represents a image in the navigation graph.\n *\n * Explanation of position and bearing properties:\n *\n * When images are uploaded they will have GPS information in the EXIF, this is what\n * is called `originalLngLat` {@link Image.originalLngLat}.\n *\n * When Structure from Motions has been run for a image a `computedLngLat` that\n * differs from the `originalLngLat` will be created. It is different because\n * GPS positions are not very exact and SfM aligns the camera positions according\n * to the 3D reconstruction {@link Image.computedLngLat}.\n *\n * At last there exist a `lngLat` property which evaluates to\n * the `computedLngLat` from SfM if it exists but falls back\n * to the `originalLngLat` from the EXIF GPS otherwise {@link Image.lngLat}.\n *\n * Everything that is done in in the Viewer is based on the SfM positions,\n * i.e. `computedLngLat`. That is why the smooth transitions go in the right\n * direction (nd not in strange directions because of bad GPS).\n *\n * E.g. when placing a marker in the Viewer it is relative to the SfM\n * position i.e. the `computedLngLat`.\n *\n * The same concept as above also applies to the compass angle (or bearing) properties\n * `originalCa`, `computedCa` and `ca`.\n */\nexport class Image {\n private _cache: ImageCache;\n private _core: CoreImageEnt;\n private _spatial: SpatialImageEnt;\n\n /**\n * Create a new image instance.\n *\n * @description Images are always created internally by the library.\n * Images can not be added to the library through any API method.\n *\n * @param {CoreImageEnt} core- Raw core image data.\n * @ignore\n */\n constructor(core: CoreImageEnt) {\n if (!core) {\n throw new Error(`Incorrect core image data ${core}`);\n }\n\n this._cache = null;\n this._core = core;\n this._spatial = null;\n }\n\n /**\n * Get assets cached.\n *\n * @description The assets that need to be cached for this property\n * to report true are the following: fill properties, image and mesh.\n * The library ensures that the current image will always have the\n * assets cached.\n *\n * @returns {boolean} Value indicating whether all assets have been\n * cached.\n *\n * @ignore\n */\n public get assetsCached(): boolean {\n return this._core != null &&\n this._spatial != null &&\n this._cache != null &&\n this._cache.image != null &&\n this._cache.mesh != null;\n }\n\n /**\n * Get cameraParameters.\n *\n * @description Will be undefined if SfM has\n * not been run.\n *\n * Camera type dependent parameters.\n *\n * For perspective and fisheye camera types,\n * the camera parameters array should be\n * constructed according to\n *\n * `[focal, k1, k2]`\n *\n * where focal is the camera focal length,\n * and k1, k2 are radial distortion parameters.\n *\n * For spherical camera type the camera\n * parameters are unset or emtpy array.\n *\n * @returns {Array<number>} The parameters\n * related to the camera type.\n */\n public get cameraParameters(): number[] {\n return this._spatial.camera_parameters;\n }\n\n /**\n * Get cameraType.\n *\n * @description Will be undefined if SfM has not been run.\n *\n * @returns {string} The camera type that captured the image.\n */\n public get cameraType(): string {\n return this._spatial.camera_type;\n }\n\n /**\n * Get capturedAt.\n *\n * @description Timestamp of the image capture date\n * and time represented as a Unix epoch timestamp in milliseconds.\n *\n * @returns {number} Timestamp when the image was captured.\n */\n public get capturedAt(): number {\n return this._spatial.captured_at;\n }\n\n /**\n * Get clusterId.\n *\n * @returns {string} Globally unique id of the SfM cluster to which\n * the image belongs.\n */\n public get clusterId(): string {\n return !!this._spatial.cluster ?\n this._spatial.cluster.id :\n null;\n }\n\n /**\n * Get clusterUrl.\n *\n * @returns {string} Url to the cluster reconstruction file.\n *\n * @ignore\n */\n public get clusterUrl(): string {\n return !!this._spatial.cluster ?\n this._spatial.cluster.url :\n null;\n }\n\n /**\n * Get compassAngle.\n *\n * @description If the SfM computed compass angle exists it will\n * be returned, otherwise the original EXIF compass angle.\n *\n * @returns {number} Compass angle, measured in degrees\n * clockwise with respect to north.\n */\n public get compassAngle(): number {\n return this._spatial.computed_compass_angle != null ?\n this._spatial.computed_compass_angle :\n this._spatial.compass_angle;\n }\n\n /**\n * Get complete.\n *\n * @description The library ensures that the current image will\n * always be full.\n *\n * @returns {boolean} Value indicating whether the image has all\n * properties filled.\n *\n * @ignore\n */\n public get complete(): boolean {\n return this._spatial != null;\n }\n\n /**\n * Get computedAltitude.\n *\n * @description If SfM has not been run the computed altitude is\n * set to a default value of two meters.\n *\n * @returns {number} Altitude, in meters.\n */\n public get computedAltitude(): number {\n return this._spatial.computed_altitude;\n }\n\n /**\n * Get computedCompassAngle.\n *\n * @description Will not be set if SfM has not been run.\n *\n * @returns {number} SfM computed compass angle, measured\n * in degrees clockwise with respect to north.\n */\n public get computedCompassAngle(): number {\n return this._spatial.computed_compass_angle;\n }\n\n /**\n * Get computedLngLat.\n *\n * @description Will not be set if SfM has not been run.\n *\n * @returns {LngLat} SfM computed longitude, latitude in WGS84 datum,\n * measured in degrees.\n */\n public get computedLngLat(): LngLat {\n return this._core.computed_geometry;\n }\n\n /**\n * Get creatorId.\n *\n * @description Note that the creator ID will not be set when using\n * the Mapillary API.\n *\n * @returns {string} Globally unique id of the user who uploaded\n * the image.\n */\n public get creatorId(): string {\n return this._spatial.creator.id;\n }\n\n /**\n * Get creatorUsername.\n *\n * @description Note that the creator username will not be set when\n * using the Mapillary API.\n *\n * @returns {string} Username of the creator who uploaded\n * the image.\n */\n public get creatorUsername(): string {\n return this._spatial.creator.username;\n }\n\n\n /**\n * Get exifOrientation.\n *\n * @returns {number} EXIF orientation of original image.\n */\n public get exifOrientation(): number {\n return this._spatial.exif_orientation;\n }\n\n /**\n * Get height.\n *\n * @returns {number} Height of original image, not adjusted\n * for orientation.\n */\n public get height(): number {\n return this._spatial.height;\n }\n\n /**\n * Get image.\n *\n * @description The image will always be set on the current image.\n *\n * @returns {HTMLImageElement} Cached image element of the image.\n */\n public get image(): HTMLImageElement {\n return this._cache.image;\n }\n\n /**\n * Get image$.\n *\n * @returns {Observable<HTMLImageElement>} Observable emitting\n * the cached image when it is updated.\n *\n * @ignore\n */\n public get image$(): Observable<HTMLImageElement> {\n return this._cache.image$;\n }\n\n /**\n * Get id.\n *\n * @returns {string} Globally unique id of the image.\n */\n public get id(): string {\n return this._core.id;\n }\n\n /**\n * Get lngLat.\n *\n * @description If the SfM computed longitude, latitude exist\n * it will be returned, otherwise the original EXIF latitude\n * longitude.\n *\n * @returns {LngLat} Longitude, latitude in WGS84 datum,\n * measured in degrees.\n */\n public get lngLat(): LngLat {\n return this._core.computed_geometry != null ?\n this._core.computed_geometry :\n this._core.geometry;\n }\n\n /**\n * Get merged.\n *\n * @returns {boolean} Value indicating whether SfM has been\n * run on the image and the image has been merged into a\n * connected component.\n */\n public get merged(): boolean {\n return this._spatial != null &&\n this._spatial.merge_id != null;\n }\n\n /**\n * Get mergeId.\n *\n * @description Will not be set if SfM has not yet been run on\n * image.\n *\n * @returns {stirng} Id of connected component to which image\n * belongs after the aligning merge.\n */\n public get mergeId(): string {\n return this._spatial.merge_id;\n }\n\n /**\n * Get mesh.\n *\n * @description The mesh will always be set on the current image.\n *\n * @returns {MeshContract} SfM triangulated mesh of reconstructed\n * atomic 3D points.\n */\n public get mesh(): MeshContract {\n return this._cache.mesh;\n }\n\n /**\n * Get originalAltitude.\n *\n * @returns {number} EXIF altitude, in meters, if available.\n */\n public get originalAltitude(): number {\n return this._spatial.altitude;\n }\n\n /**\n * Get originalCompassAngle.\n *\n * @returns {number} Original EXIF compass angle, measured in\n * degrees.\n */\n public get originalCompassAngle(): number {\n return this._spatial.compass_angle;\n }\n\n /**\n * Get originalLngLat.\n *\n * @returns {LngLat} Original EXIF longitude, latitude in\n * WGS84 datum, measured in degrees.\n */\n public get originalLngLat(): LngLat {\n return this._core.geometry;\n }\n\n /**\n * Get ownerId.\n *\n * @returns {string} Globally unique id of the owner to which\n * the image belongs. If the image does not belong to an\n * owner the owner id will be undefined.\n */\n public get ownerId(): string {\n return !!this._spatial.owner ?\n this._spatial.owner.id :\n null;\n }\n\n /**\n * Get private.\n *\n * @returns {boolean} Value specifying if image is accessible to\n * organization members only or to everyone.\n */\n public get private(): boolean {\n return this._spatial.private;\n }\n\n /**\n * Get qualityScore.\n *\n * @returns {number} A number between zero and one\n * determining the quality of the image. Blurriness\n * (motion blur / out-of-focus), occlusion (camera\n * mount, ego vehicle, water-drops), windshield\n * reflections, bad illumination (exposure, glare),\n * and bad weather condition (fog, rain, snow)\n * affect the quality score.\n *\n * @description Value should be on the interval [0, 1].\n */\n public get qualityScore(): number {\n return this._spatial.quality_score;\n }\n\n /**\n * Get rotation.\n *\n * @description Will not be set if SfM has not been run.\n *\n * @returns {Array<number>} Rotation vector in angle axis representation.\n */\n public get rotation(): number[] {\n return this._spatial.computed_rotation;\n }\n\n /**\n * Get scale.\n *\n * @description Will not be set if SfM has not been run.\n *\n * @returns {number} Scale of reconstruction the image\n * belongs to.\n */\n public get scale(): number {\n return this._spatial.atomic_scale;\n }\n\n /**\n * Get sequenceId.\n *\n * @returns {string} Globally unique id of the sequence\n * to which the image belongs.\n */\n public get sequenceId(): string {\n return !!this._core.sequence ?\n this._core.sequence.id :\n null;\n }\n\n /**\n * Get sequenceEdges.\n *\n * @returns {NavigationEdgeStatus} Value describing the status of the\n * sequence edges.\n *\n * @ignore\n */\n public get sequenceEdges(): NavigationEdgeStatus {\n return this._cache.sequenceEdges;\n }\n\n /**\n * Get sequenceEdges$.\n *\n * @description Internal observable, should not be used as an API.\n *\n * @returns {Observable<NavigationEdgeStatus>} Observable emitting\n * values describing the status of the sequence edges.\n *\n * @ignore\n */\n public get sequenceEdges$(): Observable<NavigationEdgeStatus> {\n return this._cache.sequenceEdges$;\n }\n\n /**\n * Get spatialEdges.\n *\n * @returns {NavigationEdgeStatus} Value describing the status of the\n * spatial edges.\n *\n * @ignore\n */\n public get spatialEdges(): NavigationEdgeStatus {\n return this._cache.spatialEdges;\n }\n\n /**\n * Get spatialEdges$.\n *\n * @description Internal observable, should not be used as an API.\n *\n * @returns {Observable<NavigationEdgeStatus>} Observable emitting\n * values describing the status of the spatial edges.\n *\n * @ignore\n */\n public get spatialEdges$(): Observable<NavigationEdgeStatus> {\n return this._cache.spatialEdges$;\n }\n\n /**\n * Get width.\n *\n * @returns {number} Width of original image, not\n * adjusted for orientation.\n */\n public get width(): number {\n return this._spatial.width;\n }\n\n /**\n * Cache the image and mesh assets.\n *\n * @description The assets are always cached internally by the\n * library prior to setting a image as the current image.\n *\n * @returns {Observable<Image>} Observable emitting this image whenever the\n * load status has changed and when the mesh or image has been fully loaded.\n *\n * @ignore\n */\n public cacheAssets$(): Observable<Image> {\n return this._cache\n .cacheAssets$(this._spatial, this.merged)\n .pipe(\n map((): Image => { return this; }));\n }\n\n /**\n * Cache the image asset.\n *\n * @description Use for caching a differently sized image than\n * the one currently held by the image.\n *\n * @returns {Observable<Image>} Observable emitting this image whenever the\n * load status has changed and when the mesh or image has been fully loaded.\n *\n * @ignore\n */\n public cacheImage$(): Observable<Image> {\n return this._cache\n .cacheImage$(this._spatial)\n .pipe(\n map((): Image => { return this; }));\n }\n\n /**\n * Cache the sequence edges.\n *\n * @description The sequence edges are cached asynchronously\n * internally by the library.\n *\n * @param {Array<NavigationEdge>} edges - Sequence edges to cache.\n * @ignore\n */\n public cacheSequenceEdges(edges: NavigationEdge[]): void {\n this._cache.cacheSequenceEdges(edges);\n }\n\n /**\n * Cache the spatial edges.\n *\n * @description The spatial edges are cached asynchronously\n * internally by the library.\n *\n * @param {Array<NavigationEdge>} edges - Spatial edges to cache.\n * @ignore\n */\n public cacheSpatialEdges(edges: NavigationEdge[]): void {\n this._cache.cacheSpatialEdges(edges);\n }\n\n /**\n * Dispose the image.\n *\n * @description Disposes all cached assets.\n * @ignore\n */\n public dispose(): void {\n if (this._cache != null) {\n this._cache.dispose();\n this._cache = null;\n }\n\n this._core = null;\n this._spatial = null;\n }\n\n /**\n * Initialize the image cache.\n *\n * @description The image cache is initialized internally by\n * the library.\n *\n * @param {ImageCache} cache - The image cache to set as cache.\n * @ignore\n */\n public initializeCache(cache: ImageCache): void {\n if (this._cache != null) {\n throw new Error(`Image cache already initialized (${this.id}).`);\n }\n\n this._cache = cache;\n }\n\n /**\n * Complete an image with spatial properties.\n *\n * @description The image is completed internally by\n * the library.\n *\n * @param {SpatialImageEnt} fill - The spatial image struct.\n * @ignore\n */\n public makeComplete(fill: SpatialImageEnt): void {\n if (fill == null) {\n throw new Error(\"Fill can not be null.\");\n }\n\n this._spatial = fill;\n }\n\n /**\n * Reset the sequence edges.\n *\n * @ignore\n */\n public resetSequenceEdges(): void {\n this._cache.resetSequenceEdges();\n }\n\n /**\n * Reset the spatial edges.\n *\n * @ignore\n */\n public resetSpatialEdges(): void {\n this._cache.resetSpatialEdges();\n }\n\n /**\n * Clears the image and mesh assets, aborts\n * any outstanding requests and resets edges.\n *\n * @ignore\n */\n public uncache(): void {\n if (this._cache == null) {\n return;\n }\n\n this._cache.dispose();\n this._cache = null;\n }\n}\n","import {\n combineLatest as observableCombineLatest,\n of as observableOf,\n Observable,\n Subject,\n Subscriber,\n Subscription,\n} from \"rxjs\";\n\nimport {\n finalize,\n first,\n map,\n publishReplay,\n refCount,\n startWith,\n tap,\n} from \"rxjs/operators\";\n\nimport { NavigationEdge } from \"./edge/interfaces/NavigationEdge\";\nimport { NavigationEdgeStatus } from \"./interfaces/NavigationEdgeStatus\";\n\nimport { MeshContract } from \"../api/contracts/MeshContract\";\nimport { IDataProvider } from \"../api/interfaces/IDataProvider\";\nimport { SpatialImageEnt } from \"../api/ents/SpatialImageEnt\";\n\n/**\n * @class ImageCache\n *\n * @classdesc Represents the cached properties of a image.\n */\nexport class ImageCache {\n private _disposed: boolean;\n\n private _provider: IDataProvider;\n\n private _image: HTMLImageElement;\n private _mesh: MeshContract;\n private _sequenceEdges: NavigationEdgeStatus;\n private _spatialEdges: NavigationEdgeStatus;\n\n private _imageAborter: Function;\n private _meshAborter: Function;\n\n private _imageChanged$: Subject<HTMLImageElement>;\n private _image$: Observable<HTMLImageElement>;\n private _sequenceEdgesChanged$: Subject<NavigationEdgeStatus>;\n private _sequenceEdges$: Observable<NavigationEdgeStatus>;\n private _spatialEdgesChanged$: Subject<NavigationEdgeStatus>;\n private _spatialEdges$: Observable<NavigationEdgeStatus>;\n\n private _cachingAssets$: Observable<ImageCache>;\n\n private _iamgeSubscription: Subscription;\n private _sequenceEdgesSubscription: Subscription;\n private _spatialEdgesSubscription: Subscription;\n\n /**\n * Create a new image cache instance.\n */\n constructor(provider: IDataProvider) {\n this._disposed = false;\n\n this._provider = provider;\n\n this._image = null;\n this._mesh = null;\n this._sequenceEdges = { cached: false, edges: [] };\n this._spatialEdges = { cached: false, edges: [] };\n\n this._imageChanged$ = new Subject<HTMLImageElement>();\n this._image$ = this._imageChanged$.pipe(\n startWith(null),\n publishReplay(1),\n refCount());\n\n this._iamgeSubscription = this._image$.subscribe();\n\n this._sequenceEdgesChanged$ = new Subject<NavigationEdgeStatus>();\n this._sequenceEdges$ = this._sequenceEdgesChanged$.pipe(\n startWith(this._sequenceEdges),\n publishReplay(1),\n refCount());\n\n this._sequenceEdgesSubscription = this._sequenceEdges$.subscribe(() => { /*noop*/ });\n\n this._spatialEdgesChanged$ = new Subject<NavigationEdgeStatus>();\n this._spatialEdges$ = this._spatialEdgesChanged$.pipe(\n startWith(this._spatialEdges),\n publishReplay(1),\n refCount());\n\n this._spatialEdgesSubscription = this._spatialEdges$.subscribe(() => { /*noop*/ });\n\n this._cachingAssets$ = null;\n }\n\n /**\n * Get image.\n *\n * @description Will not be set when assets have not been cached\n * or when the object has been disposed.\n *\n * @returns {HTMLImageElement} Cached image element of the image.\n */\n public get image(): HTMLImageElement {\n return this._image;\n }\n\n /**\n * Get image$.\n *\n * @returns {Observable<HTMLImageElement>} Observable emitting\n * the cached image when it is updated.\n */\n public get image$(): Observable<HTMLImageElement> {\n return this._image$;\n }\n\n /**\n * Get mesh.\n *\n * @description Will not be set when assets have not been cached\n * or when the object has been disposed.\n *\n * @returns {MeshContract} SfM triangulated mesh of reconstructed\n * atomic 3D points.\n */\n public get mesh(): MeshContract {\n return this._mesh;\n }\n\n /**\n * Get sequenceEdges.\n *\n * @returns {NavigationEdgeStatus} Value describing the status of the\n * sequence edges.\n */\n public get sequenceEdges(): NavigationEdgeStatus {\n return this._sequenceEdges;\n }\n\n /**\n * Get sequenceEdges$.\n *\n * @returns {Observable<NavigationEdgeStatus>} Observable emitting\n * values describing the status of the sequence edges.\n */\n public get sequenceEdges$(): Observable<NavigationEdgeStatus> {\n return this._sequenceEdges$;\n }\n\n /**\n * Get spatialEdges.\n *\n * @returns {NavigationEdgeStatus} Value describing the status of the\n * spatial edges.\n */\n public get spatialEdges(): NavigationEdgeStatus {\n return this._spatialEdges;\n }\n\n /**\n * Get spatialEdges$.\n *\n * @returns {Observable<NavigationEdgeStatus>} Observable emitting\n * values describing the status of the spatial edges.\n */\n public get spatialEdges$(): Observable<NavigationEdgeStatus> {\n return this._spatialEdges$;\n }\n\n /**\n * Cache the image and mesh assets.\n *\n * @param {SpatialImageEnt} spatial - Spatial props of the image to cache.\n * @param {boolean} spherical - Value indicating whether image is a spherical.\n * @param {boolean} merged - Value indicating whether image is merged.\n * @returns {Observable<ImageCache>} Observable emitting this image\n * cache whenever the load status has changed and when the mesh or image\n * has been fully loaded.\n */\n public cacheAssets$(\n spatial: SpatialImageEnt,\n merged: boolean): Observable<ImageCache> {\n if (this._cachingAssets$ != null) {\n return this._cachingAssets$;\n }\n\n this._cachingAssets$ = observableCombineLatest(\n this._cacheImage$(spatial),\n this._cacheMesh$(spatial, merged)).pipe(\n map(\n ([image, mesh]: [HTMLImageElement, MeshContract]): ImageCache => {\n this._image = image;\n this._mesh = mesh;\n\n return this;\n }),\n finalize(\n (): void => {\n this._cachingAssets$ = null;\n }),\n publishReplay(1),\n refCount());\n\n this._cachingAssets$.pipe(\n first(\n (imageCache: ImageCache): boolean => {\n return !!imageCache._image;\n }))\n .subscribe(\n (): void => {\n this._imageChanged$.next(this._image);\n },\n (): void => { /*noop*/ });\n\n return this._cachingAssets$;\n }\n\n /**\n * Cache an image with a higher resolution than the current one.\n *\n * @param {SpatialImageEnt} spatial - Spatial props.\n * @returns {Observable<ImageCache>} Observable emitting a single item,\n * the image cache, when the image has been cached. If supplied image\n * size is not larger than the current image size the image cache is\n * returned immediately.\n */\n public cacheImage$(spatial: SpatialImageEnt): Observable<ImageCache> {\n if (this._image != null) { return observableOf<ImageCache>(this); }\n\n const cacheImage$ = this._cacheImage$(spatial)\n .pipe(\n first(\n (image: HTMLImageElement): boolean => {\n return !!image;\n }),\n tap(\n (image: HTMLImageElement): void => {\n this._disposeImage();\n this._image = image;\n }),\n map(\n (): ImageCache => {\n return this;\n }),\n publishReplay(1),\n refCount());\n\n cacheImage$\n .subscribe(\n (): void => {\n this._imageChanged$.next(this._image);\n },\n (): void => { /*noop*/ });\n\n return cacheImage$;\n }\n\n /**\n * Cache the sequence edges.\n *\n * @param {Array<NavigationEdge>} edges - Sequence edges to cache.\n */\n public cacheSequenceEdges(edges: NavigationEdge[]): void {\n this._sequenceEdges = { cached: true, edges: edges };\n this._sequenceEdgesChanged$.next(this._sequenceEdges);\n }\n\n /**\n * Cache the spatial edges.\n *\n * @param {Array<NavigationEdge>} edges - Spatial edges to cache.\n */\n public cacheSpatialEdges(edges: NavigationEdge[]): void {\n this._spatialEdges = { cached: true, edges: edges };\n this._spatialEdgesChanged$.next(this._spatialEdges);\n }\n\n /**\n * Dispose the image cache.\n *\n * @description Disposes all cached assets and unsubscribes to\n * all streams.\n */\n public dispose(): void {\n this._iamgeSubscription.unsubscribe();\n this._sequenceEdgesSubscription.unsubscribe();\n this._spatialEdgesSubscription.unsubscribe();\n\n this._disposeImage();\n\n this._mesh = null;\n this._sequenceEdges = { cached: false, edges: [] };\n this._spatialEdges = { cached: false, edges: [] };\n\n this._imageChanged$.next(null);\n this._sequenceEdgesChanged$.next(this._sequenceEdges);\n this._spatialEdgesChanged$.next(this._spatialEdges);\n\n this._disposed = true;\n\n if (this._imageAborter != null) {\n this._imageAborter();\n this._imageAborter = null;\n }\n\n if (this._meshAborter != null) {\n this._meshAborter();\n this._meshAborter = null;\n }\n\n }\n\n /**\n * Reset the sequence edges.\n */\n public resetSequenceEdges(): void {\n this._sequenceEdges = { cached: false, edges: [] };\n this._sequenceEdgesChanged$.next(this._sequenceEdges);\n }\n\n /**\n * Reset the spatial edges.\n */\n public resetSpatialEdges(): void {\n this._spatialEdges = { cached: false, edges: [] };\n this._spatialEdgesChanged$.next(this._spatialEdges);\n }\n\n /**\n * Cache the image.\n *\n * @param {SpatialImageEnt} spatial - Spatial image.\n * @param {boolean} spherical - Value indicating whether image is a spherical.\n * @returns {Observable<ILoadStatusObject<HTMLImageElement>>} Observable\n * emitting a load status object every time the load status changes\n * and completes when the image is fully loaded.\n */\n private _cacheImage$(spatial: SpatialImageEnt): Observable<HTMLImageElement> {\n return Observable.create(\n (subscriber: Subscriber<HTMLImageElement>): void => {\n const abort = new Promise<void>(\n (_, reject): void => {\n this._imageAborter = reject;\n });\n\n const url = spatial.thumb.url;\n if (!url) {\n const thumbId = spatial.thumb.id;\n const message =\n `Incorrect thumb URL for ${spatial.id} ` +\n `(${thumbId}, ${url})`;\n subscriber.error(new Error(message));\n return;\n }\n\n this._provider.getImageBuffer(url, abort)\n .then(\n (buffer: ArrayBuffer): void => {\n this._imageAborter = null;\n\n const image = new Image();\n image.crossOrigin = \"Anonymous\";\n\n image.onload = () => {\n if (this._disposed) {\n window.URL.revokeObjectURL(image.src);\n const message =\n `Image load was aborted (${url})`;\n subscriber.error(new Error(message));\n return;\n }\n\n subscriber.next(image);\n subscriber.complete();\n };\n\n image.onerror = () => {\n this._imageAborter = null;\n\n subscriber.error(\n new Error(\n `Failed to load image (${url})`));\n };\n\n const blob: Blob = new Blob([buffer]);\n image.src = window.URL.createObjectURL(blob);\n },\n (error: Error): void => {\n this._imageAborter = null;\n subscriber.error(error);\n });\n });\n }\n\n /**\n * Cache the mesh.\n *\n * @param {SpatialImageEnt} spatial - Spatial props.\n * @param {boolean} merged - Value indicating whether image is merged.\n * @returns {Observable<ILoadStatusObject<MeshContract>>} Observable emitting\n * a load status object every time the load status changes and completes\n * when the mesh is fully loaded.\n */\n private _cacheMesh$(spatial: SpatialImageEnt, merged: boolean): Observable<MeshContract> {\n return Observable.create(\n (subscriber: Subscriber<MeshContract>): void => {\n if (!merged) {\n subscriber.next(this._createEmptyMesh());\n subscriber.complete();\n return;\n }\n\n const url = spatial.mesh.url;\n if (!url) {\n const meshId = spatial.mesh.id;\n const message =\n `Incorrect mesh URL for ${spatial.id} ` +\n `(${meshId}, ${url})`;\n console.warn(message);\n subscriber.next(this._createEmptyMesh());\n subscriber.complete();\n return;\n }\n\n const abort: Promise<void> = new Promise(\n (_, reject): void => {\n this._meshAborter = reject;\n });\n\n this._provider.getMesh(url, abort)\n .then(\n (mesh: MeshContract): void => {\n this._meshAborter = null;\n\n if (this._disposed) {\n return;\n }\n\n subscriber.next(mesh);\n subscriber.complete();\n },\n (error: Error): void => {\n this._meshAborter = null;\n console.error(error);\n subscriber.next(this._createEmptyMesh());\n subscriber.complete();\n });\n });\n }\n\n /**\n * Create a load status object with an empty mesh.\n *\n * @returns {ILoadStatusObject<MeshContract>} Load status object\n * with empty mesh.\n */\n private _createEmptyMesh(): MeshContract {\n return { faces: [], vertices: [] };\n }\n\n private _disposeImage(): void {\n if (this._image != null) {\n window.URL.revokeObjectURL(this._image.src);\n }\n\n this._image = null;\n }\n}\n","import { SequenceEnt } from \"../api/ents/SequenceEnt\";\n\n/**\n * @class Sequence\n *\n * @classdesc Represents a sequence of ordered images.\n */\nexport class Sequence {\n private _id: string;\n private _imageIds: string[];\n\n /**\n * Create a new sequene instance.\n *\n * @param {SequenceEnt} sequence - Raw sequence data.\n */\n constructor(sequence: SequenceEnt) {\n this._id = sequence.id;\n this._imageIds = sequence.image_ids;\n }\n\n /**\n * Get id.\n *\n * @returns {string} Unique sequence id.\n */\n public get id(): string {\n return this._id;\n }\n\n /**\n * Get ids.\n *\n * @returns {Array<string>} Array of ordered image ids in the sequence.\n */\n public get imageIds(): string[] {\n return this._imageIds;\n }\n\n /**\n * Dispose the sequence.\n *\n * @description Disposes all cached assets.\n */\n public dispose(): void {\n this._id = null;\n this._imageIds = null;\n }\n\n /**\n * Find the next image id in the sequence with respect to\n * the provided image id.\n *\n * @param {string} id - Reference image id.\n * @returns {string} Next id in sequence if it exists, null otherwise.\n */\n public findNext(id: string): string {\n let i: number = this._imageIds.indexOf(id);\n\n if ((i + 1) >= this._imageIds.length || i === -1) {\n return null;\n } else {\n return this._imageIds[i + 1];\n }\n }\n\n /**\n * Find the previous image id in the sequence with respect to\n * the provided image id.\n *\n * @param {string} id - Reference image id.\n * @returns {string} Previous id in sequence if it exists, null otherwise.\n */\n public findPrev(id: string): string {\n let i: number = this._imageIds.indexOf(id);\n\n if (i === 0 || i === -1) {\n return null;\n } else {\n return this._imageIds[i - 1];\n }\n }\n}\n","export class EdgeCalculatorCoefficients {\n public sphericalPreferredDistance: number;\n public sphericalMotion: number;\n public sphericalSequencePenalty: number;\n public sphericalMergeCCPenalty: number;\n\n public stepPreferredDistance: number;\n public stepMotion: number;\n public stepRotation: number;\n public stepSequencePenalty: number;\n public stepMergeCCPenalty: number;\n\n public similarDistance: number;\n public similarRotation: number;\n\n public turnDistance: number;\n public turnMotion: number;\n public turnSequencePenalty: number;\n public turnMergeCCPenalty: number;\n\n constructor() {\n this.sphericalPreferredDistance = 2;\n this.sphericalMotion = 2;\n this.sphericalSequencePenalty = 1;\n this.sphericalMergeCCPenalty = 4;\n\n this.stepPreferredDistance = 4;\n this.stepMotion = 3;\n this.stepRotation = 4;\n this.stepSequencePenalty = 2;\n this.stepMergeCCPenalty = 6;\n\n this.similarDistance = 2;\n this.similarRotation = 3;\n\n this.turnDistance = 4;\n this.turnMotion = 2;\n this.turnSequencePenalty = 1;\n this.turnMergeCCPenalty = 4;\n }\n}\n","/**\n * Enumeration for edge directions\n * @enum {number}\n * @readonly\n * @description Directions for edges in image graph describing\n * sequence, spatial and image type relations between nodes.\n */\nexport enum NavigationDirection {\n /**\n * Next image in the sequence.\n */\n Next,\n\n /**\n * Previous image in the sequence.\n */\n Prev,\n\n /**\n * Step to the left keeping viewing direction.\n */\n StepLeft,\n\n /**\n * Step to the right keeping viewing direction.\n */\n StepRight,\n\n /**\n * Step forward keeping viewing direction.\n */\n StepForward,\n\n /**\n * Step backward keeping viewing direction.\n */\n StepBackward,\n\n /**\n * Turn 90 degrees counter clockwise.\n */\n TurnLeft,\n\n /**\n * Turn 90 degrees clockwise.\n */\n TurnRight,\n\n /**\n * Turn 180 degrees.\n */\n TurnU,\n\n /**\n * Spherical in general direction.\n */\n Spherical,\n\n /**\n * Looking in roughly the same direction at rougly the same position.\n */\n Similar,\n}\n","import { NavigationDirection } from \"./NavigationDirection\";\nimport { SphericalDirection } from \"./interfaces/SphericalDirection\";\nimport { StepDirection } from \"./interfaces/StepDirection\";\nimport { TurnDirection } from \"./interfaces/TurnDirection\";\n\nexport class EdgeCalculatorDirections {\n\n public steps: { [direction: string]: StepDirection } = {};\n public turns: { [direction: string]: TurnDirection } = {};\n public spherical: { [direction: string]: SphericalDirection } = {};\n\n constructor() {\n this.steps[NavigationDirection.StepForward] = {\n direction: NavigationDirection.StepForward,\n motionChange: 0,\n useFallback: true,\n };\n\n this.steps[NavigationDirection.StepBackward] = {\n direction: NavigationDirection.StepBackward,\n motionChange: Math.PI,\n useFallback: true,\n };\n\n this.steps[NavigationDirection.StepLeft] = {\n direction: NavigationDirection.StepLeft,\n motionChange: Math.PI / 2,\n useFallback: false,\n };\n\n this.steps[NavigationDirection.StepRight] = {\n direction: NavigationDirection.StepRight,\n motionChange: -Math.PI / 2,\n useFallback: false,\n };\n\n this.turns[NavigationDirection.TurnLeft] = {\n direction: NavigationDirection.TurnLeft,\n directionChange: Math.PI / 2,\n motionChange: Math.PI / 4,\n };\n\n this.turns[NavigationDirection.TurnRight] = {\n direction: NavigationDirection.TurnRight,\n directionChange: -Math.PI / 2,\n motionChange: -Math.PI / 4,\n };\n\n this.turns[NavigationDirection.TurnU] = {\n direction: NavigationDirection.TurnU,\n directionChange: Math.PI,\n motionChange: null,\n };\n\n this.spherical[NavigationDirection.StepForward] = {\n direction: NavigationDirection.StepForward,\n directionChange: 0,\n next: NavigationDirection.StepLeft,\n prev: NavigationDirection.StepRight,\n };\n\n this.spherical[NavigationDirection.StepBackward] = {\n direction: NavigationDirection.StepBackward,\n directionChange: Math.PI,\n next: NavigationDirection.StepRight,\n prev: NavigationDirection.StepLeft,\n };\n\n this.spherical[NavigationDirection.StepLeft] = {\n direction: NavigationDirection.StepLeft,\n directionChange: Math.PI / 2,\n next: NavigationDirection.StepBackward,\n prev: NavigationDirection.StepForward,\n };\n\n this.spherical[NavigationDirection.StepRight] = {\n direction: NavigationDirection.StepRight,\n directionChange: -Math.PI / 2,\n next: NavigationDirection.StepForward,\n prev: NavigationDirection.StepBackward,\n };\n }\n}\n","export class EdgeCalculatorSettings {\n public sphericalMinDistance: number;\n public sphericalMaxDistance: number;\n public sphericalPreferredDistance: number;\n public sphericalMaxItems: number;\n public sphericalMaxStepTurnChange: number;\n\n public rotationMaxDistance: number;\n public rotationMaxDirectionChange: number;\n public rotationMaxVerticalDirectionChange: number;\n\n public similarMaxDirectionChange: number;\n public similarMaxDistance: number;\n public similarMinTimeDifference: number;\n\n public stepMaxDistance: number;\n public stepMaxDirectionChange: number;\n public stepMaxDrift: number;\n public stepPreferredDistance: number;\n\n public turnMaxDistance: number;\n public turnMaxDirectionChange: number;\n public turnMaxRigDistance: number;\n public turnMinRigDirectionChange: number;\n\n constructor() {\n this.sphericalMinDistance = 0.1;\n this.sphericalMaxDistance = 20;\n this.sphericalPreferredDistance = 5;\n this.sphericalMaxItems = 4;\n this.sphericalMaxStepTurnChange = Math.PI / 8;\n\n this.rotationMaxDistance = this.turnMaxRigDistance;\n this.rotationMaxDirectionChange = Math.PI / 6;\n this.rotationMaxVerticalDirectionChange = Math.PI / 8;\n\n this.similarMaxDirectionChange = Math.PI / 8;\n this.similarMaxDistance = 12;\n this.similarMinTimeDifference = 12 * 3600 * 1000;\n\n this.stepMaxDistance = 20;\n this.stepMaxDirectionChange = Math.PI / 6;\n this.stepMaxDrift = Math.PI / 6;\n this.stepPreferredDistance = 4;\n\n this.turnMaxDistance = 15;\n this.turnMaxDirectionChange = 2 * Math.PI / 9;\n this.turnMaxRigDistance = 0.65;\n this.turnMinRigDirectionChange = Math.PI / 6;\n }\n\n public get maxDistance(): number {\n return Math.max(\n this.sphericalMaxDistance,\n this.similarMaxDistance,\n this.stepMaxDistance,\n this.turnMaxDistance);\n }\n}\n","/**\n * @class MapillaryError\n *\n * @classdesc Generic Mapillary error.\n */\nexport class MapillaryError extends Error {\n constructor(message?: string) {\n super(message);\n\n Object.setPrototypeOf(this, MapillaryError.prototype);\n\n this.name = \"MapillaryError\";\n }\n}\n","import { MapillaryError } from \"./MapillaryError\";\n\nexport class ArgumentMapillaryError extends MapillaryError {\n constructor(message?: string) {\n super(message != null ? message : \"The argument is not valid.\");\n\n Object.setPrototypeOf(this, ArgumentMapillaryError.prototype);\n\n this.name = \"ArgumentMapillaryError\";\n }\n}\n","import * as THREE from \"three\";\n\n/**\n * @class Spatial\n *\n * @classdesc Provides methods for scalar, vector and matrix calculations.\n */\nexport class Spatial {\n private _epsilon: number = 1e-9;\n\n /**\n * Converts azimuthal phi rotation (counter-clockwise with origin on X-axis) to\n * bearing (clockwise with origin at north or Y-axis).\n *\n * @param {number} phi - Azimuthal phi angle in radians.\n * @returns {number} Bearing in radians.\n */\n public azimuthalToBearing(phi: number): number {\n return -phi + Math.PI / 2;\n }\n\n /**\n * Converts degrees to radians.\n *\n * @param {number} deg - Degrees.\n * @returns {number} Radians.\n */\n public degToRad(deg: number): number {\n return Math.PI * deg / 180;\n }\n\n /**\n * Converts radians to degrees.\n *\n * @param {number} rad - Radians.\n * @returns {number} Degrees.\n */\n public radToDeg(rad: number): number {\n return 180 * rad / Math.PI;\n }\n\n /**\n * Creates a rotation matrix from an angle-axis vector.\n *\n * @param {Array<number>} angleAxis - Angle-axis representation of a rotation.\n * @returns {THREE.Matrix4} Rotation matrix.\n */\n public rotationMatrix(angleAxis: number[]): THREE.Matrix4 {\n let axis: THREE.Vector3 =\n new THREE.Vector3(angleAxis[0], angleAxis[1], angleAxis[2]);\n let angle: number = axis.length();\n if (angle > 0) {\n axis.normalize();\n }\n\n return new THREE.Matrix4().makeRotationAxis(axis, angle);\n }\n\n /**\n * Rotates a vector according to a angle-axis rotation vector.\n *\n * @param {Array<number>} vector - Vector to rotate.\n * @param {Array<number>} angleAxis - Angle-axis representation of a rotation.\n * @returns {THREE.Vector3} Rotated vector.\n */\n public rotate(vector: number[], angleAxis: number[]): THREE.Vector3 {\n let v: THREE.Vector3 = new THREE.Vector3(vector[0], vector[1], vector[2]);\n let rotationMatrix: THREE.Matrix4 = this.rotationMatrix(angleAxis);\n v.applyMatrix4(rotationMatrix);\n\n return v;\n }\n\n /**\n * Calculates the optical center from a rotation vector\n * on the angle-axis representation and a translation vector\n * according to C = -R^T t.\n *\n * @param {Array<number>} rotation - Angle-axis representation of a rotation.\n * @param {Array<number>} translation - Translation vector.\n * @returns {THREE.Vector3} Optical center.\n */\n public opticalCenter(rotation: number[], translation: number[]): THREE.Vector3 {\n let angleAxis: number[] = [-rotation[0], -rotation[1], -rotation[2]];\n let vector: number[] = [-translation[0], -translation[1], -translation[2]];\n\n return this.rotate(vector, angleAxis);\n }\n\n /**\n * Calculates the viewing direction from a rotation vector\n * on the angle-axis representation.\n *\n * @param {number[]} rotation - Angle-axis representation of a rotation.\n * @returns {THREE.Vector3} Viewing direction.\n */\n public viewingDirection(rotation: number[]): THREE.Vector3 {\n let angleAxis: number[] = [-rotation[0], -rotation[1], -rotation[2]];\n\n return this.rotate([0, 0, 1], angleAxis);\n }\n\n /**\n * Wrap a number on the interval [min, max].\n *\n * @param {number} value - Value to wrap.\n * @param {number} min - Lower endpoint of interval.\n * @param {number} max - Upper endpoint of interval.\n * @returns {number} The wrapped number.\n */\n public wrap(value: number, min: number, max: number): number {\n if (max < min) {\n throw new Error(\"Invalid arguments: max must be larger than min.\");\n }\n\n let interval: number = (max - min);\n\n while (value > max || value < min) {\n if (value > max) {\n value = value - interval;\n } else if (value < min) {\n value = value + interval;\n }\n }\n\n return value;\n }\n\n /**\n * Wrap an angle on the interval [-Pi, Pi].\n *\n * @param {number} angle - Value to wrap.\n * @returns {number} Wrapped angle.\n */\n public wrapAngle(angle: number): number {\n return this.wrap(angle, -Math.PI, Math.PI);\n }\n\n /**\n * Limit the value to the interval [min, max] by changing the value to\n * the nearest available one when it is outside the interval.\n *\n * @param {number} value - Value to clamp.\n * @param {number} min - Minimum of the interval.\n * @param {number} max - Maximum of the interval.\n * @returns {number} Clamped value.\n */\n public clamp(value: number, min: number, max: number): number {\n if (value < min) {\n return min;\n }\n\n if (value > max) {\n return max;\n }\n\n return value;\n }\n\n /**\n * Calculates the counter-clockwise angle from the first\n * vector (x1, y1)^T to the second (x2, y2)^T.\n *\n * @param {number} x1 - X coordinate of first vector.\n * @param {number} y1 - Y coordinate of first vector.\n * @param {number} x2 - X coordinate of second vector.\n * @param {number} y2 - Y coordinate of second vector.\n * @returns {number} Counter clockwise angle between the vectors.\n */\n public angleBetweenVector2(x1: number, y1: number, x2: number, y2: number): number {\n let angle: number = Math.atan2(y2, x2) - Math.atan2(y1, x1);\n\n return this.wrapAngle(angle);\n }\n\n /**\n * Calculates the minimum (absolute) angle change for rotation\n * from one angle to another on the [-Pi, Pi] interval.\n *\n * @param {number} angle1 - Start angle.\n * @param {number} angle2 - Destination angle.\n * @returns {number} Absolute angle change between angles.\n */\n public angleDifference(angle1: number, angle2: number): number {\n let angle: number = angle2 - angle1;\n\n return this.wrapAngle(angle);\n }\n\n /**\n * Calculates the relative rotation angle between two\n * angle-axis vectors.\n *\n * @param {number} rotation1 - First angle-axis vector.\n * @param {number} rotation2 - Second angle-axis vector.\n * @returns {number} Relative rotation angle.\n */\n public relativeRotationAngle(rotation1: number[], rotation2: number[]): number {\n let R1T: THREE.Matrix4 = this.rotationMatrix(\n [-rotation1[0], -rotation1[1], -rotation1[2]]);\n let R2: THREE.Matrix4 = this.rotationMatrix(rotation2);\n\n let R: THREE.Matrix4 = R1T.multiply(R2);\n let elements: number[] = R.elements;\n\n // from Tr(R) = 1 + 2 * cos(theta)\n let tr: number = elements[0] + elements[5] + elements[10];\n let theta: number = Math.acos(Math.max(Math.min((tr - 1) / 2, 1), -1));\n\n return theta;\n }\n\n /**\n * Calculates the angle from a vector to a plane.\n *\n * @param {Array<number>} vector - The vector.\n * @param {Array<number>} planeNormal - Normal of the plane.\n * @returns {number} Angle from between plane and vector.\n */\n public angleToPlane(vector: number[], planeNormal: number[]): number {\n let v: THREE.Vector3 = new THREE.Vector3().fromArray(vector);\n let norm: number = v.length();\n\n if (norm < this._epsilon) {\n return 0;\n }\n\n let projection: number = v.dot(new THREE.Vector3().fromArray(planeNormal));\n\n return Math.asin(projection / norm);\n }\n\n public azimuthal(direction: number[], up: number[]): number {\n const directionVector: THREE.Vector3 = new THREE.Vector3().fromArray(direction);\n const upVector: THREE.Vector3 = new THREE.Vector3().fromArray(up);\n\n const upProjection: number = directionVector.clone().dot(upVector);\n const planeProjection: THREE.Vector3 = directionVector.clone().sub(upVector.clone().multiplyScalar(upProjection));\n\n return Math.atan2(planeProjection.y, planeProjection.x);\n }\n\n /**\n * Calculates the distance between two coordinates\n * (longitude, latitude pairs) in meters according to\n * the haversine formula.\n *\n * @param {number} lat1 - Latitude of the first coordinate in degrees.\n * @param {number} lng1 - Longitude of the first coordinate in degrees.\n * @param {number} lat2 - Latitude of the second coordinate in degrees.\n * @param {number} lng2 - Longitude of the second coordinate in degrees.\n * @returns {number} Distance between lat lon positions in meters.\n */\n public distanceFromLngLat(\n lng1: number,\n lat1: number,\n lng2: number,\n lat2: number)\n : number {\n let r: number = 6371000;\n let dLat: number = this.degToRad(lat2 - lat1);\n let dLng: number = this.degToRad(lng2 - lng1);\n\n let hav: number =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(this.degToRad(lat1)) * Math.cos(this.degToRad(lat2)) *\n Math.sin(dLng / 2) * Math.sin(dLng / 2);\n\n let d: number = 2 * r * Math.atan2(Math.sqrt(hav), Math.sqrt(1 - hav));\n\n return d;\n }\n}\n","import * as THREE from \"three\";\n\nimport { Spatial } from \"./Spatial\";\nimport { Transform } from \"./Transform\";\nimport { ViewportCoords } from \"./ViewportCoords\";\nimport { LngLatAlt } from \"../api/interfaces/LngLatAlt\";\nimport { geodeticToEnu } from \"./GeoCoords\";\n\nconst spatial = new Spatial();\n\nexport function isSpherical(cameraType: string): boolean {\n return cameraType === \"spherical\";\n}\n\nexport function isFisheye(cameraType: string): boolean {\n return cameraType === \"fisheye\";\n}\n\nexport function computeTranslation(position: LngLatAlt, rotation: number[], reference: LngLatAlt): number[] {\n const C = geodeticToEnu(\n position.lng,\n position.lat,\n position.alt,\n reference.lng,\n reference.lat,\n reference.alt);\n\n const RC: THREE.Vector3 = spatial.rotate(C, rotation);\n const translation: number[] = [-RC.x, -RC.y, -RC.z];\n\n return translation;\n}\n\nexport function computeProjectedPoints(\n transform: Transform,\n basicVertices: number[][],\n basicDirections: number[][],\n pointsPerLine: number,\n viewportCoords: ViewportCoords): number[][] {\n\n const basicPoints: number[][] = [];\n\n for (let side: number = 0; side < basicVertices.length; ++side) {\n const v: number[] = basicVertices[side];\n const d: number[] = basicDirections[side];\n\n for (let i: number = 0; i <= pointsPerLine; ++i) {\n basicPoints.push([v[0] + d[0] * i / pointsPerLine,\n v[1] + d[1] * i / pointsPerLine]);\n }\n }\n\n const camera: THREE.Camera = new THREE.Camera();\n camera.up.copy(transform.upVector());\n camera.position.copy(new THREE.Vector3().fromArray(transform.unprojectSfM([0, 0], 0)));\n camera.lookAt(new THREE.Vector3().fromArray(transform.unprojectSfM([0, 0], 10)));\n camera.updateMatrix();\n camera.updateMatrixWorld(true);\n\n const projectedPoints: number[][] = basicPoints\n .map(\n (basicPoint: number[]): number[] => {\n const worldPoint: number[] = transform.unprojectBasic(basicPoint, 10000);\n const cameraPoint: number[] = viewportCoords.worldToCamera(worldPoint, camera);\n\n return [\n Math.abs(cameraPoint[0] / cameraPoint[2]),\n Math.abs(cameraPoint[1] / cameraPoint[2]),\n ];\n });\n\n return projectedPoints;\n}\n","import * as THREE from \"three\";\n\nimport { EdgeCalculatorCoefficients } from \"./EdgeCalculatorCoefficients\";\nimport { EdgeCalculatorDirections } from \"./EdgeCalculatorDirections\";\nimport { EdgeCalculatorSettings } from \"./EdgeCalculatorSettings\";\nimport { NavigationDirection } from \"./NavigationDirection\";\nimport { NavigationEdge } from \"./interfaces/NavigationEdge\";\nimport { PotentialEdge } from \"./interfaces/PotentialEdge\";\nimport { StepDirection } from \"./interfaces/StepDirection\";\nimport { TurnDirection } from \"./interfaces/TurnDirection\";\n\nimport { Image } from \"../Image\";\nimport { Sequence } from \"../Sequence\";\n\nimport { ArgumentMapillaryError } from \"../../error/ArgumentMapillaryError\";\nimport { Spatial } from \"../../geo/Spatial\";\nimport { isSpherical } from \"../../geo/Geo\";\nimport { geodeticToEnu } from \"../../geo/GeoCoords\";\n\n/**\n * @class EdgeCalculator\n *\n * @classdesc Represents a class for calculating node edges.\n */\nexport class EdgeCalculator {\n\n private _spatial: Spatial;\n\n private _settings: EdgeCalculatorSettings;\n private _directions: EdgeCalculatorDirections;\n private _coefficients: EdgeCalculatorCoefficients;\n\n /**\n * Create a new edge calculator instance.\n *\n * @param {EdgeCalculatorSettings} settings - Settings struct.\n * @param {EdgeCalculatorDirections} directions - Directions struct.\n * @param {EdgeCalculatorCoefficients} coefficients - Coefficients struct.\n */\n constructor(\n settings?: EdgeCalculatorSettings,\n directions?: EdgeCalculatorDirections,\n coefficients?: EdgeCalculatorCoefficients) {\n\n this._spatial = new Spatial();\n\n this._settings = settings != null ? settings : new EdgeCalculatorSettings();\n this._directions = directions != null ? directions : new EdgeCalculatorDirections();\n this._coefficients = coefficients != null ? coefficients : new EdgeCalculatorCoefficients();\n }\n\n /**\n * Returns the potential edges to destination nodes for a set\n * of nodes with respect to a source node.\n *\n * @param {Image} node - Source node.\n * @param {Array<Image>} nodes - Potential destination nodes.\n * @param {Array<string>} fallbackIds - Ids for destination nodes\n * that should be returned even if they do not meet the\n * criteria for a potential edge.\n * @throws {ArgumentMapillaryError} If node is not full.\n */\n public getPotentialEdges(node: Image, potentialImages: Image[], fallbackIds: string[]): PotentialEdge[] {\n if (!node.complete) {\n throw new ArgumentMapillaryError(\"Image has to be full.\");\n }\n\n if (!node.merged) {\n return [];\n }\n\n let currentDirection: THREE.Vector3 =\n this._spatial.viewingDirection(node.rotation);\n let currentVerticalDirection: number =\n this._spatial.angleToPlane(currentDirection.toArray(), [0, 0, 1]);\n\n let potentialEdges: PotentialEdge[] = [];\n\n for (let potential of potentialImages) {\n if (!potential.merged ||\n potential.id === node.id) {\n continue;\n }\n\n let enu = geodeticToEnu(\n potential.lngLat.lng,\n potential.lngLat.lat,\n potential.computedAltitude,\n node.lngLat.lng,\n node.lngLat.lat,\n node.computedAltitude);\n\n let motion: THREE.Vector3 = new THREE.Vector3(enu[0], enu[1], enu[2]);\n let distance: number = motion.length();\n\n if (distance > this._settings.maxDistance &&\n fallbackIds.indexOf(potential.id) < 0) {\n continue;\n }\n\n let motionChange: number = this._spatial.angleBetweenVector2(\n currentDirection.x,\n currentDirection.y,\n motion.x,\n motion.y);\n\n let verticalMotion: number = this._spatial.angleToPlane(motion.toArray(), [0, 0, 1]);\n\n let direction: THREE.Vector3 =\n this._spatial.viewingDirection(potential.rotation);\n\n let directionChange: number = this._spatial.angleBetweenVector2(\n currentDirection.x,\n currentDirection.y,\n direction.x,\n direction.y);\n\n let verticalDirection: number = this._spatial.angleToPlane(direction.toArray(), [0, 0, 1]);\n let verticalDirectionChange: number = verticalDirection - currentVerticalDirection;\n\n let rotation: number = this._spatial.relativeRotationAngle(\n node.rotation,\n potential.rotation);\n\n let worldMotionAzimuth: number =\n this._spatial.angleBetweenVector2(1, 0, motion.x, motion.y);\n\n let sameSequence: boolean = potential.sequenceId != null &&\n node.sequenceId != null &&\n potential.sequenceId === node.sequenceId;\n\n let sameMergeCC: boolean =\n potential.mergeId === node.mergeId;\n\n let sameUser: boolean =\n potential.creatorId === node.creatorId;\n\n let potentialEdge: PotentialEdge = {\n capturedAt: potential.capturedAt,\n directionChange: directionChange,\n distance: distance,\n spherical: isSpherical(potential.cameraType),\n id: potential.id,\n motionChange: motionChange,\n rotation: rotation,\n sameMergeCC: sameMergeCC,\n sameSequence: sameSequence,\n sameUser: sameUser,\n sequenceId: potential.sequenceId,\n verticalDirectionChange: verticalDirectionChange,\n verticalMotion: verticalMotion,\n worldMotionAzimuth: worldMotionAzimuth,\n };\n\n potentialEdges.push(potentialEdge);\n }\n\n return potentialEdges;\n }\n\n /**\n * Computes the sequence edges for a node.\n *\n * @param {Image} node - Source node.\n * @throws {ArgumentMapillaryError} If node is not full.\n */\n public computeSequenceEdges(node: Image, sequence: Sequence): NavigationEdge[] {\n if (!node.complete) {\n throw new ArgumentMapillaryError(\"Image has to be full.\");\n }\n\n if (node.sequenceId !== sequence.id) {\n throw new ArgumentMapillaryError(\"Image and sequence does not correspond.\");\n }\n\n let edges: NavigationEdge[] = [];\n\n let nextId: string = sequence.findNext(node.id);\n if (nextId != null) {\n edges.push({\n data: {\n direction: NavigationDirection.Next,\n worldMotionAzimuth: Number.NaN,\n },\n source: node.id,\n target: nextId,\n });\n }\n\n let prevId: string = sequence.findPrev(node.id);\n if (prevId != null) {\n edges.push({\n data: {\n direction: NavigationDirection.Prev,\n worldMotionAzimuth: Number.NaN,\n },\n source: node.id,\n target: prevId,\n });\n }\n\n return edges;\n }\n\n /**\n * Computes the similar edges for a node.\n *\n * @description Similar edges for perspective images\n * look roughly in the same direction and are positioned closed to the node.\n * Similar edges for spherical only target other spherical.\n *\n * @param {Image} node - Source node.\n * @param {Array<PotentialEdge>} potentialEdges - Potential edges.\n * @throws {ArgumentMapillaryError} If node is not full.\n */\n public computeSimilarEdges(node: Image, potentialEdges: PotentialEdge[]): NavigationEdge[] {\n if (!node.complete) {\n throw new ArgumentMapillaryError(\"Image has to be full.\");\n }\n\n let nodeSpherical: boolean = isSpherical(node.cameraType);\n let sequenceGroups: { [key: string]: PotentialEdge[] } = {};\n\n for (let potentialEdge of potentialEdges) {\n if (potentialEdge.sequenceId == null) {\n continue;\n }\n\n if (potentialEdge.sameSequence) {\n continue;\n }\n\n if (nodeSpherical) {\n if (!potentialEdge.spherical) {\n continue;\n }\n } else {\n if (!potentialEdge.spherical &&\n Math.abs(potentialEdge.directionChange) > this._settings.similarMaxDirectionChange) {\n continue;\n }\n }\n\n if (potentialEdge.distance > this._settings.similarMaxDistance) {\n continue;\n }\n\n if (potentialEdge.sameUser &&\n Math.abs(potentialEdge.capturedAt - node.capturedAt) <\n this._settings.similarMinTimeDifference) {\n continue;\n }\n\n if (sequenceGroups[potentialEdge.sequenceId] == null) {\n sequenceGroups[potentialEdge.sequenceId] = [];\n }\n\n sequenceGroups[potentialEdge.sequenceId].push(potentialEdge);\n\n }\n\n let similarEdges: PotentialEdge[] = [];\n\n let calculateScore =\n isSpherical(node.cameraType) ?\n (potentialEdge: PotentialEdge): number => {\n return potentialEdge.distance;\n } :\n (potentialEdge: PotentialEdge): number => {\n return this._coefficients.similarDistance * potentialEdge.distance +\n this._coefficients.similarRotation * potentialEdge.rotation;\n };\n\n for (let sequenceId in sequenceGroups) {\n if (!sequenceGroups.hasOwnProperty(sequenceId)) {\n continue;\n }\n\n let lowestScore: number = Number.MAX_VALUE;\n let similarEdge: PotentialEdge = null;\n\n for (let potentialEdge of sequenceGroups[sequenceId]) {\n let score: number = calculateScore(potentialEdge);\n\n if (score < lowestScore) {\n lowestScore = score;\n similarEdge = potentialEdge;\n }\n }\n\n if (similarEdge == null) {\n continue;\n }\n\n similarEdges.push(similarEdge);\n }\n\n return similarEdges\n .map<NavigationEdge>(\n (potentialEdge: PotentialEdge): NavigationEdge => {\n return {\n data: {\n direction: NavigationDirection.Similar,\n worldMotionAzimuth: potentialEdge.worldMotionAzimuth,\n },\n source: node.id,\n target: potentialEdge.id,\n };\n });\n }\n\n /**\n * Computes the step edges for a perspective node.\n *\n * @description Step edge targets can only be other perspective nodes.\n * Returns an empty array for spherical.\n *\n * @param {Image} node - Source node.\n * @param {Array<PotentialEdge>} potentialEdges - Potential edges.\n * @param {string} prevId - Id of previous node in sequence.\n * @param {string} nextId - Id of next node in sequence.\n * @throws {ArgumentMapillaryError} If node is not full.\n */\n public computeStepEdges(\n node: Image,\n potentialEdges: PotentialEdge[],\n prevId: string,\n nextId: string): NavigationEdge[] {\n\n if (!node.complete) {\n throw new ArgumentMapillaryError(\"Image has to be full.\");\n }\n\n let edges: NavigationEdge[] = [];\n\n if (isSpherical(node.cameraType)) {\n return edges;\n }\n\n for (let k in this._directions.steps) {\n if (!this._directions.steps.hasOwnProperty(k)) {\n continue;\n }\n\n let step: StepDirection = this._directions.steps[k];\n\n let lowestScore: number = Number.MAX_VALUE;\n let edge: PotentialEdge = null;\n let fallback: PotentialEdge = null;\n\n for (let potential of potentialEdges) {\n if (potential.spherical) {\n continue;\n }\n\n if (Math.abs(potential.directionChange) > this._settings.stepMaxDirectionChange) {\n continue;\n }\n\n let motionDifference: number =\n this._spatial.angleDifference(step.motionChange, potential.motionChange);\n let directionMotionDifference: number =\n this._spatial.angleDifference(potential.directionChange, motionDifference);\n let drift: number =\n Math.max(Math.abs(motionDifference), Math.abs(directionMotionDifference));\n\n if (Math.abs(drift) > this._settings.stepMaxDrift) {\n continue;\n }\n\n let potentialId: string = potential.id;\n if (step.useFallback && (potentialId === prevId || potentialId === nextId)) {\n fallback = potential;\n }\n\n if (potential.distance > this._settings.stepMaxDistance) {\n continue;\n }\n\n motionDifference = Math.sqrt(\n motionDifference * motionDifference +\n potential.verticalMotion * potential.verticalMotion);\n\n let score: number =\n this._coefficients.stepPreferredDistance *\n Math.abs(potential.distance - this._settings.stepPreferredDistance) /\n this._settings.stepMaxDistance +\n this._coefficients.stepMotion * motionDifference / this._settings.stepMaxDrift +\n this._coefficients.stepRotation * potential.rotation / this._settings.stepMaxDirectionChange +\n this._coefficients.stepSequencePenalty * (potential.sameSequence ? 0 : 1) +\n this._coefficients.stepMergeCCPenalty * (potential.sameMergeCC ? 0 : 1);\n\n if (score < lowestScore) {\n lowestScore = score;\n edge = potential;\n }\n }\n\n edge = edge == null ? fallback : edge;\n if (edge != null) {\n edges.push({\n data: {\n direction: step.direction,\n worldMotionAzimuth: edge.worldMotionAzimuth,\n },\n source: node.id,\n target: edge.id,\n });\n }\n }\n\n return edges;\n }\n\n /**\n * Computes the turn edges for a perspective node.\n *\n * @description Turn edge targets can only be other perspective images.\n * Returns an empty array for spherical.\n *\n * @param {Image} node - Source node.\n * @param {Array<PotentialEdge>} potentialEdges - Potential edges.\n * @throws {ArgumentMapillaryError} If node is not full.\n */\n public computeTurnEdges(node: Image, potentialEdges: PotentialEdge[]): NavigationEdge[] {\n if (!node.complete) {\n throw new ArgumentMapillaryError(\"Image has to be full.\");\n }\n\n let edges: NavigationEdge[] = [];\n\n if (isSpherical(node.cameraType)) {\n return edges;\n }\n\n for (let k in this._directions.turns) {\n if (!this._directions.turns.hasOwnProperty(k)) {\n continue;\n }\n\n let turn: TurnDirection = this._directions.turns[k];\n\n let lowestScore: number = Number.MAX_VALUE;\n let edge: PotentialEdge = null;\n\n for (let potential of potentialEdges) {\n if (potential.spherical) {\n continue;\n }\n\n if (potential.distance > this._settings.turnMaxDistance) {\n continue;\n }\n\n let rig: boolean =\n turn.direction !== NavigationDirection.TurnU &&\n potential.distance < this._settings.turnMaxRigDistance &&\n Math.abs(potential.directionChange) > this._settings.turnMinRigDirectionChange;\n\n let directionDifference: number = this._spatial.angleDifference(\n turn.directionChange, potential.directionChange);\n\n let score: number;\n\n if (\n rig &&\n potential.directionChange * turn.directionChange > 0 &&\n Math.abs(potential.directionChange) < Math.abs(turn.directionChange)) {\n score = -Math.PI / 2 + Math.abs(potential.directionChange);\n } else {\n if (Math.abs(directionDifference) > this._settings.turnMaxDirectionChange) {\n continue;\n }\n\n let motionDifference: number = turn.motionChange ?\n this._spatial.angleDifference(turn.motionChange, potential.motionChange) : 0;\n\n motionDifference = Math.sqrt(\n motionDifference * motionDifference +\n potential.verticalMotion * potential.verticalMotion);\n\n score =\n this._coefficients.turnDistance * potential.distance /\n this._settings.turnMaxDistance +\n this._coefficients.turnMotion * motionDifference / Math.PI +\n this._coefficients.turnSequencePenalty * (potential.sameSequence ? 0 : 1) +\n this._coefficients.turnMergeCCPenalty * (potential.sameMergeCC ? 0 : 1);\n }\n\n if (score < lowestScore) {\n lowestScore = score;\n edge = potential;\n }\n }\n\n if (edge != null) {\n edges.push({\n data: {\n direction: turn.direction,\n worldMotionAzimuth: edge.worldMotionAzimuth,\n },\n source: node.id,\n target: edge.id,\n });\n }\n }\n\n return edges;\n }\n\n /**\n * Computes the spherical edges for a perspective node.\n *\n * @description Perspective to spherical edge targets can only be\n * spherical nodes. Returns an empty array for spherical.\n *\n * @param {Image} node - Source node.\n * @param {Array<PotentialEdge>} potentialEdges - Potential edges.\n * @throws {ArgumentMapillaryError} If node is not full.\n */\n public computePerspectiveToSphericalEdges(node: Image, potentialEdges: PotentialEdge[]): NavigationEdge[] {\n if (!node.complete) {\n throw new ArgumentMapillaryError(\"Image has to be full.\");\n }\n\n if (isSpherical(node.cameraType)) {\n return [];\n }\n\n let lowestScore: number = Number.MAX_VALUE;\n let edge: PotentialEdge = null;\n\n for (let potential of potentialEdges) {\n if (!potential.spherical) {\n continue;\n }\n\n let score: number =\n this._coefficients.sphericalPreferredDistance *\n Math.abs(potential.distance - this._settings.sphericalPreferredDistance) /\n this._settings.sphericalMaxDistance +\n this._coefficients.sphericalMotion * Math.abs(potential.motionChange) / Math.PI +\n this._coefficients.sphericalMergeCCPenalty * (potential.sameMergeCC ? 0 : 1);\n\n if (score < lowestScore) {\n lowestScore = score;\n edge = potential;\n }\n }\n\n if (edge == null) {\n return [];\n }\n\n return [\n {\n data: {\n direction: NavigationDirection.Spherical,\n worldMotionAzimuth: edge.worldMotionAzimuth,\n },\n source: node.id,\n target: edge.id,\n },\n ];\n }\n\n /**\n * Computes the spherical and step edges for a spherical node.\n *\n * @description Spherical to spherical edge targets can only be\n * spherical nodes. spherical to step edge targets can only be perspective\n * nodes.\n *\n * @param {Image} node - Source node.\n * @param {Array<PotentialEdge>} potentialEdges - Potential edges.\n * @throws {ArgumentMapillaryError} If node is not full.\n */\n public computeSphericalEdges(node: Image, potentialEdges: PotentialEdge[]): NavigationEdge[] {\n if (!node.complete) {\n throw new ArgumentMapillaryError(\"Image has to be full.\");\n }\n\n if (!isSpherical(node.cameraType)) {\n return [];\n }\n\n let sphericalEdges: NavigationEdge[] = [];\n let potentialSpherical: PotentialEdge[] = [];\n let potentialSteps: [NavigationDirection, PotentialEdge][] = [];\n\n for (let potential of potentialEdges) {\n if (potential.distance > this._settings.sphericalMaxDistance) {\n continue;\n }\n\n if (potential.spherical) {\n if (potential.distance < this._settings.sphericalMinDistance) {\n continue;\n }\n\n potentialSpherical.push(potential);\n } else {\n for (let k in this._directions.spherical) {\n if (!this._directions.spherical.hasOwnProperty(k)) {\n continue;\n }\n\n let spherical = this._directions.spherical[k];\n\n let turn: number = this._spatial.angleDifference(\n potential.directionChange,\n potential.motionChange);\n\n let turnChange: number = this._spatial.angleDifference(spherical.directionChange, turn);\n\n if (Math.abs(turnChange) > this._settings.sphericalMaxStepTurnChange) {\n continue;\n }\n\n potentialSteps.push([spherical.direction, potential]);\n\n // break if step direction found\n break;\n }\n }\n }\n\n let maxRotationDifference: number = Math.PI / this._settings.sphericalMaxItems;\n let occupiedAngles: number[] = [];\n let stepAngles: number[] = [];\n\n for (let index: number = 0; index < this._settings.sphericalMaxItems; index++) {\n let rotation: number = index / this._settings.sphericalMaxItems * 2 * Math.PI;\n\n let lowestScore: number = Number.MAX_VALUE;\n let edge: PotentialEdge = null;\n\n for (let potential of potentialSpherical) {\n let motionDifference: number = this._spatial.angleDifference(rotation, potential.motionChange);\n\n if (Math.abs(motionDifference) > maxRotationDifference) {\n continue;\n }\n\n let occupiedDifference: number = Number.MAX_VALUE;\n for (let occupiedAngle of occupiedAngles) {\n let difference: number = Math.abs(this._spatial.angleDifference(occupiedAngle, potential.motionChange));\n if (difference < occupiedDifference) {\n occupiedDifference = difference;\n }\n }\n\n if (occupiedDifference <= maxRotationDifference) {\n continue;\n }\n\n let score: number =\n this._coefficients.sphericalPreferredDistance *\n Math.abs(potential.distance - this._settings.sphericalPreferredDistance) /\n this._settings.sphericalMaxDistance +\n this._coefficients.sphericalMotion * Math.abs(motionDifference) / maxRotationDifference +\n this._coefficients.sphericalSequencePenalty * (potential.sameSequence ? 0 : 1) +\n this._coefficients.sphericalMergeCCPenalty * (potential.sameMergeCC ? 0 : 1);\n\n if (score < lowestScore) {\n lowestScore = score;\n edge = potential;\n }\n }\n\n if (edge != null) {\n occupiedAngles.push(edge.motionChange);\n sphericalEdges.push({\n data: {\n direction: NavigationDirection.Spherical,\n worldMotionAzimuth: edge.worldMotionAzimuth,\n },\n source: node.id,\n target: edge.id,\n });\n } else {\n stepAngles.push(rotation);\n }\n }\n\n let occupiedStepAngles: { [direction: string]: number[] } = {};\n occupiedStepAngles[NavigationDirection.Spherical] = occupiedAngles;\n occupiedStepAngles[NavigationDirection.StepForward] = [];\n occupiedStepAngles[NavigationDirection.StepLeft] = [];\n occupiedStepAngles[NavigationDirection.StepBackward] = [];\n occupiedStepAngles[NavigationDirection.StepRight] = [];\n\n for (let stepAngle of stepAngles) {\n let occupations: [NavigationDirection, PotentialEdge][] = [];\n\n for (let k in this._directions.spherical) {\n if (!this._directions.spherical.hasOwnProperty(k)) {\n continue;\n }\n\n let spherical = this._directions.spherical[k];\n\n let allOccupiedAngles: number[] = occupiedStepAngles[NavigationDirection.Spherical]\n .concat(occupiedStepAngles[spherical.direction])\n .concat(occupiedStepAngles[spherical.prev])\n .concat(occupiedStepAngles[spherical.next]);\n\n let lowestScore: number = Number.MAX_VALUE;\n let edge: [NavigationDirection, PotentialEdge] = null;\n\n for (let potential of potentialSteps) {\n if (potential[0] !== spherical.direction) {\n continue;\n }\n\n let motionChange: number = this._spatial.angleDifference(stepAngle, potential[1].motionChange);\n\n if (Math.abs(motionChange) > maxRotationDifference) {\n continue;\n }\n\n let minOccupiedDifference: number = Number.MAX_VALUE;\n for (let occupiedAngle of allOccupiedAngles) {\n let occupiedDifference: number =\n Math.abs(this._spatial.angleDifference(occupiedAngle, potential[1].motionChange));\n\n if (occupiedDifference < minOccupiedDifference) {\n minOccupiedDifference = occupiedDifference;\n }\n }\n\n if (minOccupiedDifference <= maxRotationDifference) {\n continue;\n }\n\n let score: number = this._coefficients.sphericalPreferredDistance *\n Math.abs(potential[1].distance - this._settings.sphericalPreferredDistance) /\n this._settings.sphericalMaxDistance +\n this._coefficients.sphericalMotion * Math.abs(motionChange) / maxRotationDifference +\n this._coefficients.sphericalMergeCCPenalty * (potential[1].sameMergeCC ? 0 : 1);\n\n if (score < lowestScore) {\n lowestScore = score;\n edge = potential;\n }\n }\n\n if (edge != null) {\n occupations.push(edge);\n sphericalEdges.push({\n data: {\n direction: edge[0],\n worldMotionAzimuth: edge[1].worldMotionAzimuth,\n },\n source: node.id,\n target: edge[1].id,\n });\n }\n }\n\n for (let occupation of occupations) {\n occupiedStepAngles[occupation[0]].push(occupation[1].motionChange);\n }\n }\n\n return sphericalEdges;\n }\n}\n","import { MapillaryError } from \"./MapillaryError\";\n\nexport class GraphMapillaryError extends MapillaryError {\n constructor(message: string) {\n super(message);\n\n Object.setPrototypeOf(this, GraphMapillaryError.prototype);\n\n this.name = \"GraphMapillaryError\";\n }\n}\n","import {\n concat as observableConcat,\n empty as observableEmpty,\n from as observableFrom,\n merge as observableMerge,\n of as observableOf,\n Observable,\n Subject,\n Subscription,\n} from \"rxjs\";\n\nimport {\n catchError,\n finalize,\n map,\n mergeAll,\n mergeMap,\n last,\n publish,\n publishReplay,\n reduce,\n refCount,\n tap,\n} from \"rxjs/operators\";\n\nimport { FilterCreator, FilterFunction } from \"./FilterCreator\";\nimport { FilterExpression } from \"./FilterExpression\";\nimport { GraphCalculator } from \"./GraphCalculator\";\nimport { Image } from \"./Image\";\nimport { ImageCache } from \"./ImageCache\";\nimport { Sequence } from \"./Sequence\";\nimport { GraphConfiguration } from \"./interfaces/GraphConfiguration\";\nimport { EdgeCalculator } from \"./edge/EdgeCalculator\";\nimport { NavigationEdge } from \"./edge/interfaces/NavigationEdge\";\nimport { PotentialEdge } from \"./edge/interfaces/PotentialEdge\";\n\nimport { APIWrapper } from \"../api/APIWrapper\";\nimport { SpatialImageEnt } from \"../api/ents/SpatialImageEnt\";\nimport { LngLat } from \"../api/interfaces/LngLat\";\nimport { GraphMapillaryError } from \"../error/GraphMapillaryError\";\nimport { SpatialImagesContract } from \"../api/contracts/SpatialImagesContract\";\nimport { ImagesContract } from \"../api/contracts/ImagesContract\";\nimport { SequenceContract } from \"../api/contracts/SequenceContract\";\nimport { CoreImagesContract } from \"../api/contracts/CoreImagesContract\";\n\ntype NodeTiles = {\n cache: string[];\n caching: string[];\n};\n\ntype SpatialArea = {\n all: { [key: string]: Image; };\n cacheKeys: string[];\n cacheNodes: { [key: string]: Image; };\n};\n\ntype NodeAccess = {\n node: Image;\n accessed: number;\n};\n\ntype TileAccess = {\n nodes: Image[];\n accessed: number;\n};\n\ntype SequenceAccess = {\n sequence: Sequence;\n accessed: number;\n};\n\nexport type NodeIndexItem = {\n lat: number;\n lng: number;\n node: Image;\n};\n\n/**\n * @class Graph\n *\n * @classdesc Represents a graph of nodes with edges.\n */\nexport class Graph {\n private static _spatialIndex: new (...args: any[]) => any;\n\n private _api: APIWrapper;\n\n /**\n * Nodes that have initialized cache with a timestamp of last access.\n */\n private _cachedNodes: { [key: string]: NodeAccess; };\n\n /**\n * Nodes for which the required tiles are cached.\n */\n private _cachedNodeTiles: { [key: string]: boolean; };\n\n /**\n * Sequences for which the nodes are cached.\n */\n private _cachedSequenceNodes: { [sequenceKey: string]: boolean; };\n\n /**\n * Nodes for which the spatial edges are cached.\n */\n private _cachedSpatialEdges: { [key: string]: Image; };\n\n /**\n * Cached tiles with a timestamp of last access.\n */\n private _cachedTiles: { [h: string]: TileAccess; };\n\n /**\n * Nodes for which fill properties are being retreived.\n */\n private _cachingFill$: { [key: string]: Observable<Graph>; };\n\n /**\n * Nodes for which full properties are being retrieved.\n */\n private _cachingFull$: { [key: string]: Observable<Graph>; };\n\n /**\n * Sequences for which the nodes are being retrieved.\n */\n private _cachingSequenceNodes$: { [sequenceKey: string]: Observable<Graph>; };\n\n /**\n * Sequences that are being retrieved.\n */\n private _cachingSequences$: { [sequenceKey: string]: Observable<Graph>; };\n\n /**\n * Nodes for which the spatial area fill properties are being retrieved.\n */\n private _cachingSpatialArea$: { [key: string]: Observable<Graph>[]; };\n\n /**\n * Tiles that are being retrieved.\n */\n private _cachingTiles$: { [h: string]: Observable<Graph>; };\n\n private _changed$: Subject<Graph>;\n\n private _defaultAlt: number;\n private _edgeCalculator: EdgeCalculator;\n private _graphCalculator: GraphCalculator;\n private _configuration: GraphConfiguration;\n\n private _filter: FilterFunction;\n private _filterCreator: FilterCreator;\n private _filterSubject$: Subject<FilterFunction>;\n private _filter$: Observable<FilterFunction>;\n private _filterSubscription: Subscription;\n\n /**\n * All nodes in the graph.\n */\n private _nodes: { [key: string]: Image; };\n\n /**\n * Contains all nodes in the graph. Used for fast spatial lookups.\n */\n private _nodeIndex: any;\n\n /**\n * All node index items sorted in tiles for easy uncache.\n */\n private _nodeIndexTiles: { [h: string]: NodeIndexItem[]; };\n\n /**\n * Node to tile dictionary for easy tile access updates.\n */\n private _nodeToTile: { [key: string]: string; };\n\n /**\n * Nodes retrieved before tiles, stored on tile level.\n */\n private _preStored: { [h: string]: { [key: string]: Image; }; };\n\n /**\n * Tiles required for a node to retrive spatial area.\n */\n private _requiredNodeTiles: { [key: string]: NodeTiles; };\n\n /**\n * Other nodes required for node to calculate spatial edges.\n */\n private _requiredSpatialArea: { [key: string]: SpatialArea; };\n\n /**\n * All sequences in graph with a timestamp of last access.\n */\n private _sequences: { [skey: string]: SequenceAccess; };\n\n private _tileThreshold: number;\n\n /**\n * Create a new graph instance.\n *\n * @param {APIWrapper} [api] - API instance for retrieving data.\n * @param {rbush.RBush<NodeIndexItem>} [nodeIndex] - Node index for fast spatial retreival.\n * @param {GraphCalculator} [graphCalculator] - Instance for graph calculations.\n * @param {EdgeCalculator} [edgeCalculator] - Instance for edge calculations.\n * @param {FilterCreator} [filterCreator] - Instance for filter creation.\n * @param {GraphConfiguration} [configuration] - Configuration struct.\n */\n constructor(\n api: APIWrapper,\n nodeIndex?: any,\n graphCalculator?: GraphCalculator,\n edgeCalculator?: EdgeCalculator,\n filterCreator?: FilterCreator,\n configuration?: GraphConfiguration) {\n\n this._api = api;\n\n this._cachedNodes = {};\n this._cachedNodeTiles = {};\n this._cachedSequenceNodes = {};\n this._cachedSpatialEdges = {};\n this._cachedTiles = {};\n\n this._cachingFill$ = {};\n this._cachingFull$ = {};\n this._cachingSequenceNodes$ = {};\n this._cachingSequences$ = {};\n this._cachingSpatialArea$ = {};\n this._cachingTiles$ = {};\n\n this._changed$ = new Subject<Graph>();\n\n this._filterCreator = filterCreator ?? new FilterCreator();\n this._filter = this._filterCreator.createFilter(undefined);\n this._filterSubject$ = new Subject<FilterFunction>();\n this._filter$ =\n observableConcat(\n observableOf(this._filter),\n this._filterSubject$).pipe(\n publishReplay(1),\n refCount());\n this._filterSubscription = this._filter$.subscribe(() => { /*noop*/ });\n\n this._defaultAlt = 2;\n this._edgeCalculator = edgeCalculator ?? new EdgeCalculator();\n this._graphCalculator = graphCalculator ?? new GraphCalculator();\n this._configuration = configuration ?? {\n maxSequences: 50,\n maxUnusedImages: 100,\n maxUnusedPreStoredImages: 30,\n maxUnusedTiles: 20,\n };\n\n this._nodes = {};\n this._nodeIndex = nodeIndex ?? new Graph._spatialIndex(16);\n this._nodeIndexTiles = {};\n this._nodeToTile = {};\n\n this._preStored = {};\n\n this._requiredNodeTiles = {};\n this._requiredSpatialArea = {};\n\n this._sequences = {};\n this._tileThreshold = 20;\n }\n\n public static register(spatialIndex: new (...args: any[]) => any): void {\n Graph._spatialIndex = spatialIndex;\n }\n\n /**\n * Get api.\n *\n * @returns {APIWrapper} The API instance used by\n * the graph.\n */\n public get api(): APIWrapper {\n return this._api;\n }\n\n /**\n * Get changed$.\n *\n * @returns {Observable<Graph>} Observable emitting\n * the graph every time it has changed.\n */\n public get changed$(): Observable<Graph> {\n return this._changed$;\n }\n\n /**\n * Get filter$.\n *\n * @returns {Observable<FilterFunction>} Observable emitting\n * the filter every time it has changed.\n */\n public get filter$(): Observable<FilterFunction> {\n return this._filter$;\n }\n\n /**\n * Caches the full node data for all images within a bounding\n * box.\n *\n * @description The node assets are not cached.\n *\n * @param {LngLat} sw - South west corner of bounding box.\n * @param {LngLat} ne - North east corner of bounding box.\n * @returns {Observable<Array<Image>>} Observable emitting\n * the full nodes in the bounding box.\n */\n public cacheBoundingBox$(sw: LngLat, ne: LngLat): Observable<Image[]> {\n const cacheTiles$ = this._api.data.geometry.bboxToCellIds(sw, ne)\n .filter(\n (h: string): boolean => {\n return !(h in this._cachedTiles);\n })\n .map(\n (h: string): Observable<Graph> => {\n return h in this._cachingTiles$ ?\n this._cachingTiles$[h] :\n this._cacheTile$(h);\n });\n\n if (cacheTiles$.length === 0) {\n cacheTiles$.push(observableOf(this));\n }\n\n return observableFrom(cacheTiles$).pipe(\n mergeAll(),\n last(),\n mergeMap(\n (): Observable<Image[]> => {\n const nodes = <Image[]>this._nodeIndex\n .search({\n maxX: ne.lng,\n maxY: ne.lat,\n minX: sw.lng,\n minY: sw.lat,\n })\n .map(\n (item: NodeIndexItem): Image => {\n return item.node;\n });\n\n const fullNodes: Image[] = [];\n const coreNodes: string[] = [];\n\n for (const node of nodes) {\n if (node.complete) {\n fullNodes.push(node);\n } else {\n coreNodes.push(node.id);\n }\n }\n\n const coreNodeBatches: string[][] = [];\n const batchSize = 200;\n while (coreNodes.length > 0) {\n coreNodeBatches.push(coreNodes.splice(0, batchSize));\n }\n\n const fullNodes$ = observableOf(fullNodes);\n const fillNodes$ = coreNodeBatches\n .map((batch: string[]): Observable<Image[]> => {\n return this._api\n .getSpatialImages$(batch)\n .pipe(\n map((items: SpatialImagesContract)\n : Image[] => {\n const result: Image[] = [];\n for (const item of items) {\n const exists = this\n .hasNode(item.node_id);\n if (!exists) { continue; }\n\n const node = this\n .getNode(item.node_id);\n if (!node.complete) {\n this._makeFull(node, item.node);\n }\n result.push(node);\n }\n return result;\n }));\n });\n\n return observableMerge(\n fullNodes$,\n observableFrom(fillNodes$).pipe(\n mergeAll()));\n }),\n reduce(\n (acc: Image[], value: Image[]): Image[] => {\n return acc.concat(value);\n }));\n }\n\n /**\n * Caches the full node data for all images of a cell.\n *\n * @description The node assets are not cached.\n *\n * @param {string} cellId - Cell id.\n * @returns {Observable<Array<Image>>} Observable\n * emitting the full nodes of the cell.\n */\n public cacheCell$(cellId: string): Observable<Image[]> {\n const cacheCell$ = cellId in this._cachedTiles ?\n observableOf(this) :\n cellId in this._cachingTiles$ ?\n this._cachingTiles$[cellId] :\n this._cacheTile$(cellId);\n\n return cacheCell$.pipe(\n mergeMap((): Observable<Image[]> => {\n const cachedCell = this._cachedTiles[cellId];\n cachedCell.accessed = new Date().getTime();\n const cellNodes = cachedCell.nodes;\n\n const fullNodes: Image[] = [];\n const coreNodes: string[] = [];\n for (const node of cellNodes) {\n if (node.complete) {\n fullNodes.push(node);\n } else {\n coreNodes.push(node.id);\n }\n }\n\n const coreNodeBatches: string[][] = [];\n const batchSize: number = 200;\n while (coreNodes.length > 0) {\n coreNodeBatches.push(coreNodes.splice(0, batchSize));\n }\n\n const fullNodes$ = observableOf(fullNodes);\n const fillNodes$ = coreNodeBatches\n .map((batch: string[]): Observable<Image[]> => {\n return this._api.getSpatialImages$(batch).pipe(\n map((items: SpatialImagesContract):\n Image[] => {\n const filled: Image[] = [];\n for (const item of items) {\n if (!item.node) {\n console.warn(\n `Image is empty (${item.node})`);\n continue;\n }\n\n const id = item.node_id;\n if (!this.hasNode(id)) { continue; }\n const node = this.getNode(id);\n if (!node.complete) {\n this._makeFull(node, item.node);\n }\n filled.push(node);\n }\n return filled;\n }));\n });\n\n return observableMerge(\n fullNodes$,\n observableFrom(fillNodes$).pipe(\n mergeAll()));\n }),\n reduce(\n (acc: Image[], value: Image[]): Image[] => {\n return acc.concat(value);\n }));\n }\n\n /**\n * Retrieve and cache node fill properties.\n *\n * @param {string} key - Key of node to fill.\n * @returns {Observable<Graph>} Observable emitting the graph\n * when the node has been updated.\n * @throws {GraphMapillaryError} When the operation is not valid on the\n * current graph.\n */\n public cacheFill$(key: string): Observable<Graph> {\n if (key in this._cachingFull$) {\n throw new GraphMapillaryError(`Cannot fill node while caching full (${key}).`);\n }\n\n if (!this.hasNode(key)) {\n throw new GraphMapillaryError(`Cannot fill node that does not exist in graph (${key}).`);\n }\n\n if (key in this._cachingFill$) {\n return this._cachingFill$[key];\n }\n\n const node = this.getNode(key);\n if (node.complete) {\n throw new GraphMapillaryError(`Cannot fill node that is already full (${key}).`);\n }\n\n this._cachingFill$[key] = this._api.getSpatialImages$([key]).pipe(\n tap(\n (items: SpatialImagesContract): void => {\n for (const item of items) {\n if (!item.node) {\n console.warn(`Image is empty ${item.node_id}`);\n }\n if (!node.complete) {\n this._makeFull(node, item.node);\n }\n delete this._cachingFill$[item.node_id];\n }\n }),\n map((): Graph => { return this; }),\n finalize(\n (): void => {\n if (key in this._cachingFill$) {\n delete this._cachingFill$[key];\n }\n\n this._changed$.next(this);\n }),\n publish(),\n refCount());\n\n return this._cachingFill$[key];\n }\n\n /**\n * Retrieve and cache full node properties.\n *\n * @param {string} key - Key of node to fill.\n * @returns {Observable<Graph>} Observable emitting the graph\n * when the node has been updated.\n * @throws {GraphMapillaryError} When the operation is not valid on the\n * current graph.\n */\n public cacheFull$(key: string): Observable<Graph> {\n if (key in this._cachingFull$) {\n return this._cachingFull$[key];\n }\n\n if (this.hasNode(key)) {\n throw new GraphMapillaryError(`Cannot cache full node that already exist in graph (${key}).`);\n }\n\n this._cachingFull$[key] = this._api.getImages$([key]).pipe(\n tap(\n (items: ImagesContract): void => {\n for (const item of items) {\n if (!item.node) {\n throw new GraphMapillaryError(\n `Image does not exist (${key}, ${item.node}).`);\n }\n\n const id = item.node_id;\n if (this.hasNode(id)) {\n const node = this.getNode(key);\n if (!node.complete) {\n this._makeFull(node, item.node);\n }\n } else {\n if (item.node.sequence.id == null) {\n throw new GraphMapillaryError(\n `Image has no sequence key (${key}).`);\n }\n\n const node = new Image(item.node);\n this._makeFull(node, item.node);\n\n const cellId = this._api.data.geometry\n .lngLatToCellId(node.originalLngLat);\n this._preStore(cellId, node);\n this._setNode(node);\n\n delete this._cachingFull$[id];\n }\n }\n }),\n map((): Graph => this),\n finalize(\n (): void => {\n if (key in this._cachingFull$) {\n delete this._cachingFull$[key];\n }\n\n this._changed$.next(this);\n }),\n publish(),\n refCount());\n\n return this._cachingFull$[key];\n }\n\n /**\n * Retrieve and cache a node sequence.\n *\n * @param {string} key - Key of node for which to retrieve sequence.\n * @returns {Observable<Graph>} Observable emitting the graph\n * when the sequence has been retrieved.\n * @throws {GraphMapillaryError} When the operation is not valid on the\n * current graph.\n */\n public cacheNodeSequence$(key: string): Observable<Graph> {\n if (!this.hasNode(key)) {\n throw new GraphMapillaryError(`Cannot cache sequence edges of node that does not exist in graph (${key}).`);\n }\n\n let node: Image = this.getNode(key);\n if (node.sequenceId in this._sequences) {\n throw new GraphMapillaryError(`Sequence already cached (${key}), (${node.sequenceId}).`);\n }\n\n return this._cacheSequence$(node.sequenceId);\n }\n\n /**\n * Retrieve and cache a sequence.\n *\n * @param {string} sequenceKey - Key of sequence to cache.\n * @returns {Observable<Graph>} Observable emitting the graph\n * when the sequence has been retrieved.\n * @throws {GraphMapillaryError} When the operation is not valid on the\n * current graph.\n */\n public cacheSequence$(sequenceKey: string): Observable<Graph> {\n if (sequenceKey in this._sequences) {\n throw new GraphMapillaryError(`Sequence already cached (${sequenceKey})`);\n }\n\n return this._cacheSequence$(sequenceKey);\n }\n\n /**\n * Cache sequence edges for a node.\n *\n * @param {string} key - Key of node.\n * @throws {GraphMapillaryError} When the operation is not valid on the\n * current graph.\n */\n public cacheSequenceEdges(key: string): void {\n let node: Image = this.getNode(key);\n\n if (!(node.sequenceId in this._sequences)) {\n throw new GraphMapillaryError(`Sequence is not cached (${key}), (${node.sequenceId})`);\n }\n\n let sequence: Sequence = this._sequences[node.sequenceId].sequence;\n let edges: NavigationEdge[] = this._edgeCalculator.computeSequenceEdges(node, sequence);\n\n node.cacheSequenceEdges(edges);\n }\n\n /**\n * Retrieve and cache full nodes for all keys in a sequence.\n *\n * @param {string} sequenceKey - Key of sequence.\n * @param {string} referenceNodeKey - Key of node to use as reference\n * for optimized caching.\n * @returns {Observable<Graph>} Observable emitting the graph\n * when the nodes of the sequence has been cached.\n */\n public cacheSequenceNodes$(sequenceKey: string, referenceNodeKey?: string): Observable<Graph> {\n if (!this.hasSequence(sequenceKey)) {\n throw new GraphMapillaryError(\n `Cannot cache sequence nodes of sequence that does not exist in graph (${sequenceKey}).`);\n }\n\n if (this.hasSequenceNodes(sequenceKey)) {\n throw new GraphMapillaryError(`Sequence nodes already cached (${sequenceKey}).`);\n }\n\n const sequence: Sequence = this.getSequence(sequenceKey);\n if (sequence.id in this._cachingSequenceNodes$) {\n return this._cachingSequenceNodes$[sequence.id];\n }\n\n const batches: string[][] = [];\n const keys: string[] = sequence.imageIds.slice();\n\n const referenceBatchSize: number = 50;\n if (!!referenceNodeKey && keys.length > referenceBatchSize) {\n const referenceIndex: number = keys.indexOf(referenceNodeKey);\n const startIndex: number = Math.max(\n 0,\n Math.min(\n referenceIndex - referenceBatchSize / 2,\n keys.length - referenceBatchSize));\n\n batches.push(keys.splice(startIndex, referenceBatchSize));\n }\n\n const batchSize: number = 200;\n while (keys.length > 0) {\n batches.push(keys.splice(0, batchSize));\n }\n\n let batchesToCache: number = batches.length;\n const sequenceNodes$: Observable<Graph> = observableFrom(batches).pipe(\n mergeMap(\n (batch: string[]): Observable<Graph> => {\n return this._api.getImages$(batch).pipe(\n tap(\n (items: ImagesContract): void => {\n for (const item of items) {\n if (!item.node) {\n console.warn(\n `Image empty (${item.node_id})`);\n continue;\n }\n const id = item.node_id;\n if (this.hasNode(id)) {\n const node = this.getNode(id);\n if (!node.complete) {\n this._makeFull(node, item.node);\n }\n } else {\n if (item.node.sequence.id == null) {\n console.warn(`Sequence missing, discarding node (${item.node_id})`);\n }\n\n const node = new Image(item.node);\n this._makeFull(node, item.node);\n\n const cellId = this._api.data.geometry\n .lngLatToCellId(node.originalLngLat);\n this._preStore(cellId, node);\n this._setNode(node);\n }\n }\n\n batchesToCache--;\n }),\n map((): Graph => this));\n },\n 6),\n last(),\n finalize(\n (): void => {\n delete this._cachingSequenceNodes$[sequence.id];\n\n if (batchesToCache === 0) {\n this._cachedSequenceNodes[sequence.id] = true;\n }\n }),\n publish(),\n refCount());\n\n this._cachingSequenceNodes$[sequence.id] = sequenceNodes$;\n\n return sequenceNodes$;\n }\n\n /**\n * Retrieve and cache full nodes for a node spatial area.\n *\n * @param {string} key - Key of node for which to retrieve sequence.\n * @returns {Observable<Graph>} Observable emitting the graph\n * when the nodes in the spatial area has been made full.\n * @throws {GraphMapillaryError} When the operation is not valid on the\n * current graph.\n */\n public cacheSpatialArea$(key: string): Observable<Graph>[] {\n if (!this.hasNode(key)) {\n throw new GraphMapillaryError(`Cannot cache spatial area of node that does not exist in graph (${key}).`);\n }\n\n if (key in this._cachedSpatialEdges) {\n throw new GraphMapillaryError(`Image already spatially cached (${key}).`);\n }\n\n if (!(key in this._requiredSpatialArea)) {\n throw new GraphMapillaryError(`Spatial area not determined (${key}).`);\n }\n\n let spatialArea: SpatialArea = this._requiredSpatialArea[key];\n if (Object.keys(spatialArea.cacheNodes).length === 0) {\n throw new GraphMapillaryError(`Spatial nodes already cached (${key}).`);\n }\n\n if (key in this._cachingSpatialArea$) {\n return this._cachingSpatialArea$[key];\n }\n\n let batches: string[][] = [];\n while (spatialArea.cacheKeys.length > 0) {\n batches.push(spatialArea.cacheKeys.splice(0, 200));\n }\n\n let batchesToCache: number = batches.length;\n let spatialNodes$: Observable<Graph>[] = [];\n\n for (let batch of batches) {\n let spatialNodeBatch$: Observable<Graph> = this._api.getSpatialImages$(batch).pipe(\n tap(\n (items: SpatialImagesContract): void => {\n for (const item of items) {\n if (!item.node) {\n console.warn(`Image is empty (${item.node_id})`);\n continue;\n }\n\n const id = item.node_id;\n const spatialNode = spatialArea.cacheNodes[id];\n if (spatialNode.complete) {\n delete spatialArea.cacheNodes[id];\n continue;\n }\n\n this._makeFull(spatialNode, item.node);\n delete spatialArea.cacheNodes[id];\n }\n\n if (--batchesToCache === 0) {\n delete this._cachingSpatialArea$[key];\n }\n }),\n map((): Graph => { return this; }),\n catchError(\n (error: Error): Observable<Graph> => {\n for (let batchKey of batch) {\n if (batchKey in spatialArea.all) {\n delete spatialArea.all[batchKey];\n }\n\n if (batchKey in spatialArea.cacheNodes) {\n delete spatialArea.cacheNodes[batchKey];\n }\n }\n\n if (--batchesToCache === 0) {\n delete this._cachingSpatialArea$[key];\n }\n\n throw error;\n }),\n finalize(\n (): void => {\n if (Object.keys(spatialArea.cacheNodes).length === 0) {\n this._changed$.next(this);\n }\n }),\n publish(),\n refCount());\n\n spatialNodes$.push(spatialNodeBatch$);\n }\n\n this._cachingSpatialArea$[key] = spatialNodes$;\n\n return spatialNodes$;\n }\n\n /**\n * Cache spatial edges for a node.\n *\n * @param {string} key - Key of node.\n * @throws {GraphMapillaryError} When the operation is not valid on the\n * current graph.\n */\n public cacheSpatialEdges(key: string): void {\n if (key in this._cachedSpatialEdges) {\n throw new GraphMapillaryError(`Spatial edges already cached (${key}).`);\n }\n\n let node: Image = this.getNode(key);\n let sequence: Sequence = this._sequences[node.sequenceId].sequence;\n\n let fallbackKeys: string[] = [];\n let prevKey: string = sequence.findPrev(node.id);\n if (prevKey != null) {\n fallbackKeys.push(prevKey);\n }\n\n let nextKey: string = sequence.findNext(node.id);\n if (nextKey != null) {\n fallbackKeys.push(nextKey);\n }\n\n let allSpatialNodes: { [key: string]: Image; } = this._requiredSpatialArea[key].all;\n let potentialNodes: Image[] = [];\n let filter: FilterFunction = this._filter;\n for (let spatialNodeKey in allSpatialNodes) {\n if (!allSpatialNodes.hasOwnProperty(spatialNodeKey)) {\n continue;\n }\n\n let spatialNode: Image = allSpatialNodes[spatialNodeKey];\n\n if (filter(spatialNode)) {\n potentialNodes.push(spatialNode);\n }\n }\n\n let potentialEdges: PotentialEdge[] =\n this._edgeCalculator.getPotentialEdges(node, potentialNodes, fallbackKeys);\n\n let edges: NavigationEdge[] =\n this._edgeCalculator.computeStepEdges(\n node,\n potentialEdges,\n prevKey,\n nextKey);\n\n edges = edges.concat(this._edgeCalculator.computeTurnEdges(node, potentialEdges));\n edges = edges.concat(this._edgeCalculator.computeSphericalEdges(node, potentialEdges));\n edges = edges.concat(this._edgeCalculator.computePerspectiveToSphericalEdges(node, potentialEdges));\n edges = edges.concat(this._edgeCalculator.computeSimilarEdges(node, potentialEdges));\n\n node.cacheSpatialEdges(edges);\n\n this._cachedSpatialEdges[key] = node;\n delete this._requiredSpatialArea[key];\n delete this._cachedNodeTiles[key];\n }\n\n /**\n * Retrieve and cache tiles for a node.\n *\n * @param {string} key - Key of node for which to retrieve tiles.\n * @returns {Array<Observable<Graph>>} Array of observables emitting\n * the graph for each tile required for the node has been cached.\n * @throws {GraphMapillaryError} When the operation is not valid on the\n * current graph.\n */\n public cacheTiles$(key: string): Observable<Graph>[] {\n if (key in this._cachedNodeTiles) {\n throw new GraphMapillaryError(`Tiles already cached (${key}).`);\n }\n\n if (key in this._cachedSpatialEdges) {\n throw new GraphMapillaryError(`Spatial edges already cached so tiles considered cached (${key}).`);\n }\n\n if (!(key in this._requiredNodeTiles)) {\n throw new GraphMapillaryError(`Tiles have not been determined (${key}).`);\n }\n\n let nodeTiles: NodeTiles = this._requiredNodeTiles[key];\n if (nodeTiles.cache.length === 0 &&\n nodeTiles.caching.length === 0) {\n throw new GraphMapillaryError(`Tiles already cached (${key}).`);\n }\n\n if (!this.hasNode(key)) {\n throw new GraphMapillaryError(`Cannot cache tiles of node that does not exist in graph (${key}).`);\n }\n\n let hs: string[] = nodeTiles.cache.slice();\n nodeTiles.caching = this._requiredNodeTiles[key].caching.concat(hs);\n nodeTiles.cache = [];\n\n let cacheTiles$: Observable<Graph>[] = [];\n\n for (let h of nodeTiles.caching) {\n const cacheTile$: Observable<Graph> = h in this._cachingTiles$ ?\n this._cachingTiles$[h] :\n this._cacheTile$(h);\n\n cacheTiles$.push(\n cacheTile$.pipe(\n tap(\n (graph: Graph): void => {\n let index: number = nodeTiles.caching.indexOf(h);\n if (index > -1) {\n nodeTiles.caching.splice(index, 1);\n }\n\n if (nodeTiles.caching.length === 0 &&\n nodeTiles.cache.length === 0) {\n delete this._requiredNodeTiles[key];\n\n this._cachedNodeTiles[key] = true;\n }\n }),\n catchError(\n (error: Error): Observable<Graph> => {\n let index: number = nodeTiles.caching.indexOf(h);\n if (index > -1) {\n nodeTiles.caching.splice(index, 1);\n }\n\n if (nodeTiles.caching.length === 0 &&\n nodeTiles.cache.length === 0) {\n delete this._requiredNodeTiles[key];\n\n this._cachedNodeTiles[key] = true;\n }\n\n throw error;\n }),\n finalize(\n (): void => {\n this._changed$.next(this);\n }),\n publish(),\n refCount()));\n }\n\n return cacheTiles$;\n }\n\n /**\n * Initialize the cache for a node.\n *\n * @param {string} key - Key of node.\n * @throws {GraphMapillaryError} When the operation is not valid on the\n * current graph.\n */\n public initializeCache(key: string): void {\n if (key in this._cachedNodes) {\n throw new GraphMapillaryError(`Image already in cache (${key}).`);\n }\n\n const node: Image = this.getNode(key);\n const provider = this._api.data;\n node.initializeCache(new ImageCache(provider));\n\n const accessed: number = new Date().getTime();\n this._cachedNodes[key] = { accessed: accessed, node: node };\n\n this._updateCachedTileAccess(key, accessed);\n }\n\n /**\n * Get a value indicating if the graph is fill caching a node.\n *\n * @param {string} key - Key of node.\n * @returns {boolean} Value indicating if the node is being fill cached.\n */\n public isCachingFill(key: string): boolean {\n return key in this._cachingFill$;\n }\n\n /**\n * Get a value indicating if the graph is fully caching a node.\n *\n * @param {string} key - Key of node.\n * @returns {boolean} Value indicating if the node is being fully cached.\n */\n public isCachingFull(key: string): boolean {\n return key in this._cachingFull$;\n }\n\n /**\n * Get a value indicating if the graph is caching a sequence of a node.\n *\n * @param {string} key - Key of node.\n * @returns {boolean} Value indicating if the sequence of a node is\n * being cached.\n */\n public isCachingNodeSequence(key: string): boolean {\n let node: Image = this.getNode(key);\n\n return node.sequenceId in this._cachingSequences$;\n }\n\n /**\n * Get a value indicating if the graph is caching a sequence.\n *\n * @param {string} sequenceKey - Key of sequence.\n * @returns {boolean} Value indicating if the sequence is\n * being cached.\n */\n public isCachingSequence(sequenceKey: string): boolean {\n return sequenceKey in this._cachingSequences$;\n }\n\n /**\n * Get a value indicating if the graph is caching sequence nodes.\n *\n * @param {string} sequenceKey - Key of sequence.\n * @returns {boolean} Value indicating if the sequence nodes are\n * being cached.\n */\n public isCachingSequenceNodes(sequenceKey: string): boolean {\n return sequenceKey in this._cachingSequenceNodes$;\n }\n\n /**\n * Get a value indicating if the graph is caching the tiles\n * required for calculating spatial edges of a node.\n *\n * @param {string} key - Key of node.\n * @returns {boolean} Value indicating if the tiles of\n * a node are being cached.\n */\n public isCachingTiles(key: string): boolean {\n return key in this._requiredNodeTiles &&\n this._requiredNodeTiles[key].cache.length === 0 &&\n this._requiredNodeTiles[key].caching.length > 0;\n }\n\n /**\n * Get a value indicating if the cache has been initialized\n * for a node.\n *\n * @param {string} key - Key of node.\n * @returns {boolean} Value indicating if the cache has been\n * initialized for a node.\n */\n public hasInitializedCache(key: string): boolean {\n return key in this._cachedNodes;\n }\n\n /**\n * Get a value indicating if a node exist in the graph.\n *\n * @param {string} key - Key of node.\n * @returns {boolean} Value indicating if a node exist in the graph.\n */\n public hasNode(key: string): boolean {\n let accessed: number = new Date().getTime();\n\n this._updateCachedNodeAccess(key, accessed);\n this._updateCachedTileAccess(key, accessed);\n\n return key in this._nodes;\n }\n\n /**\n * Get a value indicating if a node sequence exist in the graph.\n *\n * @param {string} key - Key of node.\n * @returns {boolean} Value indicating if a node sequence exist\n * in the graph.\n */\n public hasNodeSequence(key: string): boolean {\n let node: Image = this.getNode(key);\n let sequenceKey: string = node.sequenceId;\n\n let hasNodeSequence: boolean = sequenceKey in this._sequences;\n\n if (hasNodeSequence) {\n this._sequences[sequenceKey].accessed = new Date().getTime();\n }\n\n return hasNodeSequence;\n }\n\n /**\n * Get a value indicating if a sequence exist in the graph.\n *\n * @param {string} sequenceKey - Key of sequence.\n * @returns {boolean} Value indicating if a sequence exist\n * in the graph.\n */\n public hasSequence(sequenceKey: string): boolean {\n let hasSequence: boolean = sequenceKey in this._sequences;\n\n if (hasSequence) {\n this._sequences[sequenceKey].accessed = new Date().getTime();\n }\n\n return hasSequence;\n }\n\n /**\n * Get a value indicating if sequence nodes has been cached in the graph.\n *\n * @param {string} sequenceKey - Key of sequence.\n * @returns {boolean} Value indicating if a sequence nodes has been\n * cached in the graph.\n */\n public hasSequenceNodes(sequenceKey: string): boolean {\n return sequenceKey in this._cachedSequenceNodes;\n }\n\n /**\n * Get a value indicating if the graph has fully cached\n * all nodes in the spatial area of a node.\n *\n * @param {string} key - Key of node.\n * @returns {boolean} Value indicating if the spatial area\n * of a node has been cached.\n */\n public hasSpatialArea(key: string): boolean {\n if (!this.hasNode(key)) {\n throw new GraphMapillaryError(`Spatial area nodes cannot be determined if node not in graph (${key}).`);\n }\n\n if (key in this._cachedSpatialEdges) {\n return true;\n }\n\n if (key in this._requiredSpatialArea) {\n return Object\n .keys(this._requiredSpatialArea[key].cacheNodes)\n .length === 0;\n }\n\n let node = this.getNode(key);\n let bbox = this._graphCalculator\n .boundingBoxCorners(\n node.lngLat,\n this._tileThreshold);\n\n let spatialItems = <NodeIndexItem[]>this._nodeIndex\n .search({\n maxX: bbox[1].lng,\n maxY: bbox[1].lat,\n minX: bbox[0].lng,\n minY: bbox[0].lat,\n });\n\n let spatialNodes: SpatialArea = {\n all: {},\n cacheKeys: [],\n cacheNodes: {},\n };\n\n for (let spatialItem of spatialItems) {\n spatialNodes.all[spatialItem.node.id] = spatialItem.node;\n\n if (!spatialItem.node.complete) {\n spatialNodes.cacheKeys.push(spatialItem.node.id);\n spatialNodes.cacheNodes[spatialItem.node.id] = spatialItem.node;\n }\n }\n\n this._requiredSpatialArea[key] = spatialNodes;\n\n return spatialNodes.cacheKeys.length === 0;\n }\n\n /**\n * Get a value indicating if the graph has a tiles required\n * for a node.\n *\n * @param {string} key - Key of node.\n * @returns {boolean} Value indicating if the the tiles required\n * by a node has been cached.\n */\n public hasTiles(key: string): boolean {\n if (key in this._cachedNodeTiles) {\n return true;\n }\n\n if (key in this._cachedSpatialEdges) {\n return true;\n }\n\n if (!this.hasNode(key)) {\n throw new GraphMapillaryError(`Image does not exist in graph (${key}).`);\n }\n\n let nodeTiles: NodeTiles = { cache: [], caching: [] };\n\n if (!(key in this._requiredNodeTiles)) {\n const node = this.getNode(key);\n const [sw, ne] = this._graphCalculator\n .boundingBoxCorners(\n node.lngLat,\n this._tileThreshold);\n\n nodeTiles.cache = this._api.data.geometry\n .bboxToCellIds(sw, ne)\n .filter(\n (h: string): boolean => {\n return !(h in this._cachedTiles);\n });\n\n if (nodeTiles.cache.length > 0) {\n this._requiredNodeTiles[key] = nodeTiles;\n }\n } else {\n nodeTiles = this._requiredNodeTiles[key];\n }\n\n return nodeTiles.cache.length === 0 && nodeTiles.caching.length === 0;\n }\n\n /**\n * Get a node.\n *\n * @param {string} key - Key of node.\n * @returns {Image} Retrieved node.\n */\n public getNode(key: string): Image {\n let accessed: number = new Date().getTime();\n\n this._updateCachedNodeAccess(key, accessed);\n this._updateCachedTileAccess(key, accessed);\n\n return this._nodes[key];\n }\n\n /**\n * Get a sequence.\n *\n * @param {string} sequenceKey - Key of sequence.\n * @returns {Image} Retrieved sequence.\n */\n public getSequence(sequenceKey: string): Sequence {\n let sequenceAccess: SequenceAccess = this._sequences[sequenceKey];\n sequenceAccess.accessed = new Date().getTime();\n\n return sequenceAccess.sequence;\n }\n\n /**\n * Reset all spatial edges of the graph nodes.\n */\n public resetSpatialEdges(): void {\n let cachedKeys: string[] = Object.keys(this._cachedSpatialEdges);\n\n for (let cachedKey of cachedKeys) {\n let node: Image = this._cachedSpatialEdges[cachedKey];\n node.resetSpatialEdges();\n\n delete this._cachedSpatialEdges[cachedKey];\n }\n }\n\n /**\n * Reset the complete graph but keep the nodes corresponding\n * to the supplied keys. All other nodes will be disposed.\n *\n * @param {Array<string>} keepKeys - Keys for nodes to keep\n * in graph after reset.\n */\n public reset(keepKeys: string[]): void {\n const nodes: Image[] = [];\n for (const key of keepKeys) {\n if (!this.hasNode(key)) {\n throw new Error(`Image does not exist ${key}`);\n }\n\n const node: Image = this.getNode(key);\n node.resetSequenceEdges();\n node.resetSpatialEdges();\n nodes.push(node);\n }\n\n for (let cachedKey of Object.keys(this._cachedNodes)) {\n if (keepKeys.indexOf(cachedKey) !== -1) {\n continue;\n }\n\n this._cachedNodes[cachedKey].node.dispose();\n delete this._cachedNodes[cachedKey];\n }\n\n this._cachedNodeTiles = {};\n this._cachedSpatialEdges = {};\n this._cachedTiles = {};\n\n this._cachingFill$ = {};\n this._cachingFull$ = {};\n this._cachingSequences$ = {};\n this._cachingSpatialArea$ = {};\n this._cachingTiles$ = {};\n\n this._nodes = {};\n this._nodeToTile = {};\n\n this._preStored = {};\n\n for (const node of nodes) {\n this._nodes[node.id] = node;\n\n const h: string = this._api.data.geometry.lngLatToCellId(node.originalLngLat);\n this._preStore(h, node);\n }\n\n this._requiredNodeTiles = {};\n this._requiredSpatialArea = {};\n\n this._sequences = {};\n\n this._nodeIndexTiles = {};\n this._nodeIndex.clear();\n }\n\n /**\n * Set the spatial node filter.\n *\n * @emits FilterFunction The filter function to the {@link Graph.filter$}\n * observable.\n *\n * @param {FilterExpression} filter - Filter expression to be applied\n * when calculating spatial edges.\n */\n public setFilter(filter: FilterExpression): void {\n this._filter = this._filterCreator.createFilter(filter);\n this._filterSubject$.next(this._filter);\n }\n\n /**\n * Uncache the graph according to the graph configuration.\n *\n * @description Uncaches unused tiles, unused nodes and\n * sequences according to the numbers specified in the\n * graph configuration. Sequences does not have a direct\n * reference to either tiles or nodes and may be uncached\n * even if they are related to the nodes that should be kept.\n *\n * @param {Array<string>} keepIds - Ids of nodes to keep in\n * graph unrelated to last access. Tiles related to those keys\n * will also be kept in graph.\n * @param {Array<string>} keepCellIds - Ids of cells to keep in\n * graph unrelated to last access. The nodes of the cells may\n * still be uncached if not specified in the keep ids param\n * but are guaranteed to not be disposed.\n * @param {string} keepSequenceId - Optional id of sequence\n * for which the belonging nodes should not be disposed or\n * removed from the graph. These nodes may still be uncached if\n * not specified in keep ids param but are guaranteed to not\n * be disposed.\n */\n public uncache(\n keepIds: string[],\n keepCellIds: string[],\n keepSequenceId?: string)\n : void {\n\n const idsInUse: { [id: string]: boolean; } = {};\n\n this._addNewKeys(idsInUse, this._cachingFull$);\n this._addNewKeys(idsInUse, this._cachingFill$);\n this._addNewKeys(idsInUse, this._cachingSpatialArea$);\n this._addNewKeys(idsInUse, this._requiredNodeTiles);\n this._addNewKeys(idsInUse, this._requiredSpatialArea);\n\n for (const key of keepIds) {\n if (key in idsInUse) { continue; }\n idsInUse[key] = true;\n }\n\n const tileThreshold = this._tileThreshold;\n const calculator = this._graphCalculator;\n const geometry = this._api.data.geometry;\n const keepCells = new Set<string>(keepCellIds);\n for (let id in idsInUse) {\n if (!idsInUse.hasOwnProperty(id)) { continue; }\n\n const node = this._nodes[id];\n const [sw, ne] = calculator\n .boundingBoxCorners(\n node.lngLat,\n tileThreshold,\n );\n const nodeCellIds = geometry.bboxToCellIds(sw, ne);\n\n for (const nodeCellId of nodeCellIds) {\n if (!keepCells.has(nodeCellId)) {\n keepCells.add(nodeCellId);\n }\n }\n }\n\n const potentialCells: [string, TileAccess][] = [];\n for (let cellId in this._cachedTiles) {\n if (!this._cachedTiles.hasOwnProperty(cellId) ||\n keepCells.has(cellId)) {\n continue;\n }\n potentialCells.push([cellId, this._cachedTiles[cellId]]);\n }\n\n const uncacheCells = potentialCells\n .sort(\n (h1: [string, TileAccess], h2: [string, TileAccess]): number => {\n return h2[1].accessed - h1[1].accessed;\n })\n .slice(this._configuration.maxUnusedTiles)\n .map(\n (h: [string, TileAccess]): string => {\n return h[0];\n });\n\n for (let uncacheCell of uncacheCells) {\n this._uncacheTile(uncacheCell, keepSequenceId);\n }\n\n const potentialPreStored: [NodeAccess, string][] = [];\n const nonCachedPreStored: [string, string][] = [];\n for (let cellId in this._preStored) {\n if (!this._preStored.hasOwnProperty(cellId) ||\n cellId in this._cachingTiles$) {\n continue;\n }\n\n const prestoredNodes = this._preStored[cellId];\n for (let id in prestoredNodes) {\n if (!prestoredNodes.hasOwnProperty(id) || id in idsInUse) {\n continue;\n }\n\n if (prestoredNodes[id].sequenceId === keepSequenceId) {\n continue;\n }\n\n if (id in this._cachedNodes) {\n potentialPreStored.push([this._cachedNodes[id], cellId]);\n } else {\n nonCachedPreStored.push([id, cellId]);\n }\n }\n }\n\n const uncachePreStored = potentialPreStored\n .sort(\n ([na1]: [NodeAccess, string], [na2]: [NodeAccess, string]): number => {\n return na2.accessed - na1.accessed;\n })\n .slice(this._configuration.maxUnusedPreStoredImages)\n .map(\n ([na, h]: [NodeAccess, string]): [string, string] => {\n return [na.node.id, h];\n });\n\n this._uncachePreStored(nonCachedPreStored);\n this._uncachePreStored(uncachePreStored);\n\n const potentialNodes: NodeAccess[] = [];\n for (let id in this._cachedNodes) {\n if (!this._cachedNodes.hasOwnProperty(id) || id in idsInUse) {\n continue;\n }\n\n potentialNodes.push(this._cachedNodes[id]);\n }\n\n const uncacheNodes = potentialNodes\n .sort(\n (n1: NodeAccess, n2: NodeAccess): number => {\n return n2.accessed - n1.accessed;\n })\n .slice(this._configuration.maxUnusedImages);\n\n for (const nodeAccess of uncacheNodes) {\n nodeAccess.node.uncache();\n const id = nodeAccess.node.id;\n delete this._cachedNodes[id];\n\n if (id in this._cachedNodeTiles) {\n delete this._cachedNodeTiles[id];\n }\n\n if (id in this._cachedSpatialEdges) {\n delete this._cachedSpatialEdges[id];\n }\n }\n\n const potentialSequences: SequenceAccess[] = [];\n for (let sequenceId in this._sequences) {\n if (!this._sequences.hasOwnProperty(sequenceId) ||\n sequenceId in this._cachingSequences$ ||\n sequenceId === keepSequenceId) {\n continue;\n }\n\n potentialSequences.push(this._sequences[sequenceId]);\n }\n\n const uncacheSequences = potentialSequences\n .sort(\n (s1: SequenceAccess, s2: SequenceAccess): number => {\n return s2.accessed - s1.accessed;\n })\n .slice(this._configuration.maxSequences);\n\n for (const sequenceAccess of uncacheSequences) {\n const sequenceId = sequenceAccess.sequence.id;\n\n delete this._sequences[sequenceId];\n\n if (sequenceId in this._cachedSequenceNodes) {\n delete this._cachedSequenceNodes[sequenceId];\n }\n\n sequenceAccess.sequence.dispose();\n }\n }\n\n /**\n * Updates existing cells with new core nodes.\n *\n * @description Non-existing cells are discarded\n * and not requested at all.\n *\n * Existing nodes are not changed.\n *\n * New nodes are not made full or getting assets\n * cached.\n *\n * @param {Array<string>} cellIds - Cell ids.\n * @returns {Observable<Array<Image>>} Observable\n * emitting the updated cells.\n */\n public updateCells$(cellIds: string[]): Observable<string> {\n const cachedCells = this._cachedTiles;\n const cachingCells = this._cachingTiles$;\n return observableFrom(cellIds)\n .pipe(\n mergeMap(\n (cellId: string): Observable<string> => {\n if (cellId in cachedCells) {\n return this._updateCell$(cellId);\n }\n if (cellId in cachingCells) {\n return cachingCells[cellId]\n .pipe(\n catchError((): Observable<Graph> => {\n return observableOf(this);\n }),\n mergeMap(() => this._updateCell$(cellId)));\n }\n return observableEmpty();\n }\n ));\n }\n\n /**\n * Unsubscribes all subscriptions.\n *\n * @description Afterwards, you must not call any other methods\n * on the graph instance.\n */\n public unsubscribe(): void {\n this._filterSubscription.unsubscribe();\n }\n\n private _addNewKeys<T>(keys: { [key: string]: boolean; }, dict: { [key: string]: T; }): void {\n for (let key in dict) {\n if (!dict.hasOwnProperty(key) || !this.hasNode(key)) {\n continue;\n }\n\n if (!(key in keys)) {\n keys[key] = true;\n }\n }\n }\n\n private _cacheSequence$(sequenceId: string): Observable<Graph> {\n if (sequenceId in this._cachingSequences$) {\n return this._cachingSequences$[sequenceId];\n }\n\n this._cachingSequences$[sequenceId] = this._api\n .getSequence$(sequenceId)\n .pipe(\n tap(\n (sequence: SequenceContract): void => {\n if (!sequence) {\n console.warn(\n `Sequence does not exist ` +\n `(${sequenceId})`);\n } else {\n if (!(sequence.id in this._sequences)) {\n this._sequences[sequence.id] = {\n accessed: new Date().getTime(),\n sequence: new Sequence(sequence),\n };\n }\n\n delete this._cachingSequences$[sequenceId];\n }\n\n\n }),\n map((): Graph => { return this; }),\n finalize(\n (): void => {\n if (sequenceId in this._cachingSequences$) {\n delete this._cachingSequences$[sequenceId];\n }\n\n this._changed$.next(this);\n }),\n publish(),\n refCount());\n\n return this._cachingSequences$[sequenceId];\n }\n\n private _cacheTile$(cellId: string): Observable<Graph> {\n this._cachingTiles$[cellId] = this._api\n .getCoreImages$(cellId)\n .pipe(\n tap((contract: CoreImagesContract): void => {\n if (cellId in this._cachedTiles) {\n return;\n }\n const cores = contract.images;\n this._nodeIndexTiles[cellId] = [];\n this._cachedTiles[cellId] = {\n accessed: new Date().getTime(),\n nodes: [],\n };\n const hCache = this._cachedTiles[cellId].nodes;\n const preStored = this._removeFromPreStore(cellId);\n\n for (const core of cores) {\n if (!core) { break; }\n\n if (core.sequence.id == null) {\n console.warn(`Sequence missing, discarding ` +\n `node (${core.id})`);\n continue;\n }\n\n if (preStored != null && core.id in preStored) {\n const preStoredNode = preStored[core.id];\n delete preStored[core.id];\n hCache.push(preStoredNode);\n const preStoredNodeIndexItem: NodeIndexItem = {\n lat: preStoredNode.lngLat.lat,\n lng: preStoredNode.lngLat.lng,\n node: preStoredNode,\n };\n this._nodeIndex.insert(preStoredNodeIndexItem);\n this._nodeIndexTiles[cellId]\n .push(preStoredNodeIndexItem);\n this._nodeToTile[preStoredNode.id] = cellId;\n continue;\n }\n\n const node = new Image(core);\n hCache.push(node);\n const nodeIndexItem: NodeIndexItem = {\n lat: node.lngLat.lat,\n lng: node.lngLat.lng,\n node: node,\n };\n\n this._nodeIndex.insert(nodeIndexItem);\n this._nodeIndexTiles[cellId].push(nodeIndexItem);\n this._nodeToTile[node.id] = cellId;\n\n this._setNode(node);\n }\n\n delete this._cachingTiles$[cellId];\n }),\n map((): Graph => this),\n catchError(\n (error: Error): Observable<Graph> => {\n delete this._cachingTiles$[cellId];\n\n throw error;\n }),\n publish(),\n refCount());\n\n return this._cachingTiles$[cellId];\n }\n\n private _makeFull(node: Image, fillNode: SpatialImageEnt): void {\n if (fillNode.computed_altitude == null) {\n fillNode.computed_altitude = this._defaultAlt;\n }\n\n if (fillNode.computed_rotation == null) {\n fillNode.computed_rotation = this._graphCalculator.rotationFromCompass(fillNode.compass_angle, fillNode.exif_orientation);\n }\n\n node.makeComplete(fillNode);\n }\n\n private _preStore(h: string, node: Image): void {\n if (!(h in this._preStored)) {\n this._preStored[h] = {};\n }\n\n this._preStored[h][node.id] = node;\n }\n\n private _removeFromPreStore(h: string): { [key: string]: Image; } {\n let preStored: { [key: string]: Image; } = null;\n\n if (h in this._preStored) {\n preStored = this._preStored[h];\n delete this._preStored[h];\n }\n\n return preStored;\n }\n\n private _setNode(node: Image): void {\n let key: string = node.id;\n\n if (this.hasNode(key)) {\n throw new GraphMapillaryError(`Image already exist (${key}).`);\n }\n\n this._nodes[key] = node;\n }\n\n private _uncacheTile(h: string, keepSequenceKey: string): void {\n for (let node of this._cachedTiles[h].nodes) {\n let key: string = node.id;\n\n delete this._nodeToTile[key];\n\n if (key in this._cachedNodes) {\n delete this._cachedNodes[key];\n }\n\n if (key in this._cachedNodeTiles) {\n delete this._cachedNodeTiles[key];\n }\n\n if (key in this._cachedSpatialEdges) {\n delete this._cachedSpatialEdges[key];\n }\n\n if (node.sequenceId === keepSequenceKey) {\n this._preStore(h, node);\n node.uncache();\n } else {\n delete this._nodes[key];\n\n if (node.sequenceId in this._cachedSequenceNodes) {\n delete this._cachedSequenceNodes[node.sequenceId];\n }\n\n node.dispose();\n }\n }\n\n for (let nodeIndexItem of this._nodeIndexTiles[h]) {\n this._nodeIndex.remove(nodeIndexItem);\n }\n\n delete this._nodeIndexTiles[h];\n delete this._cachedTiles[h];\n }\n\n private _uncachePreStored(preStored: [string, string][]): void {\n let hs: { [h: string]: boolean; } = {};\n for (let [key, h] of preStored) {\n if (key in this._nodes) {\n delete this._nodes[key];\n }\n\n if (key in this._cachedNodes) {\n delete this._cachedNodes[key];\n }\n\n let node: Image = this._preStored[h][key];\n\n if (node.sequenceId in this._cachedSequenceNodes) {\n delete this._cachedSequenceNodes[node.sequenceId];\n }\n\n delete this._preStored[h][key];\n\n node.dispose();\n\n hs[h] = true;\n }\n\n for (let h in hs) {\n if (!hs.hasOwnProperty(h)) {\n continue;\n }\n\n if (Object.keys(this._preStored[h]).length === 0) {\n delete this._preStored[h];\n }\n }\n }\n\n private _updateCachedTileAccess(key: string, accessed: number): void {\n if (key in this._nodeToTile) {\n this._cachedTiles[this._nodeToTile[key]].accessed = accessed;\n }\n }\n\n private _updateCachedNodeAccess(key: string, accessed: number): void {\n if (key in this._cachedNodes) {\n this._cachedNodes[key].accessed = accessed;\n }\n }\n\n private _updateCell$(cellId: string): Observable<string> {\n return this._api.getCoreImages$(cellId).pipe(\n mergeMap(\n (contract: CoreImagesContract): Observable<string> => {\n if (!(cellId in this._cachedTiles)) {\n return observableEmpty();\n }\n\n const nodeIndex = this._nodeIndex;\n const nodeIndexCell = this._nodeIndexTiles[cellId];\n const nodeToCell = this._nodeToTile;\n const cell = this._cachedTiles[cellId];\n cell.accessed = new Date().getTime();\n const cellNodes = cell.nodes;\n\n const cores = contract.images;\n for (const core of cores) {\n if (core == null) { break; }\n if (this.hasNode(core.id)) { continue; }\n\n if (core.sequence.id == null) {\n console.warn(`Sequence missing, discarding ` +\n `node (${core.id})`);\n continue;\n }\n\n const node = new Image(core);\n cellNodes.push(node);\n const nodeIndexItem: NodeIndexItem = {\n lat: node.lngLat.lat,\n lng: node.lngLat.lng,\n node: node,\n };\n nodeIndex.insert(nodeIndexItem);\n nodeIndexCell.push(nodeIndexItem);\n nodeToCell[node.id] = cellId;\n this._setNode(node);\n }\n return observableOf(cellId);\n }),\n catchError(\n (error: Error): Observable<string> => {\n console.error(error);\n return observableEmpty();\n }));\n }\n}\n","import {\n Observable,\n Subject,\n} from \"rxjs\";\nimport { LngLat } from \"../../api/interfaces/LngLat\";\nimport { Marker } from \"./marker/Marker\";\n\ninterface MarkerIndexItem extends LngLat {\n marker: Marker;\n};\n\nexport class MarkerSet {\n private static _spatialIndex: new (...args: any[]) => any;\n\n private _hash: { [id: string]: MarkerIndexItem };\n private _index: any;\n\n private _indexChanged$: Subject<MarkerSet>;\n private _updated$: Subject<Marker[]>;\n\n constructor() {\n this._hash = {};\n this._index = new MarkerSet._spatialIndex(16);\n\n this._indexChanged$ = new Subject<MarkerSet>();\n this._updated$ = new Subject<Marker[]>();\n }\n\n public static register(spatialIndex: new (...args: any[]) => any): void {\n MarkerSet._spatialIndex = spatialIndex;\n }\n\n public get changed$(): Observable<MarkerSet> {\n return this._indexChanged$;\n }\n\n public get updated$(): Observable<Marker[]> {\n return this._updated$;\n }\n\n public add(markers: Marker[]): void {\n const updated: Marker[] = [];\n const hash: { [id: string]: MarkerIndexItem } = this._hash;\n const index = this._index;\n\n for (const marker of markers) {\n const id: string = marker.id;\n\n if (id in hash) {\n index.remove(hash[id]);\n updated.push(marker);\n }\n\n const item: MarkerIndexItem = {\n lat: marker.lngLat.lat,\n lng: marker.lngLat.lng,\n marker: marker,\n };\n\n hash[id] = item;\n index.insert(item);\n }\n\n if (updated.length > 0) {\n this._updated$.next(updated);\n }\n\n if (markers.length > updated.length) {\n this._indexChanged$.next(this);\n }\n }\n\n public has(id: string): boolean {\n return id in this._hash;\n }\n\n public get(id: string): Marker {\n return this.has(id) ? this._hash[id].marker : undefined;\n }\n\n public getAll(): Marker[] {\n return this._index\n .all()\n .map(\n (indexItem: MarkerIndexItem): Marker => {\n return indexItem.marker;\n });\n }\n\n public remove(ids: string[]): void {\n const hash: { [id: string]: MarkerIndexItem } = this._hash;\n const index = this._index;\n\n let changed: boolean = false;\n for (const id of ids) {\n if (!(id in hash)) {\n continue;\n }\n\n const item: MarkerIndexItem = hash[id];\n index.remove(item);\n delete hash[id];\n changed = true;\n }\n\n if (changed) {\n this._indexChanged$.next(this);\n }\n }\n\n public removeAll(): void {\n this._hash = {};\n this._index.clear();\n\n this._indexChanged$.next(this);\n }\n\n public search([sw, ne]: [LngLat, LngLat]): Marker[] {\n return this._index\n .search({\n maxX: ne.lng,\n maxY: ne.lat,\n minX: sw.lng,\n minY: sw.lat,\n })\n .map(\n (indexItem: MarkerIndexItem): Marker => {\n return indexItem.marker;\n });\n }\n\n public update(marker: Marker): void {\n const hash: { [id: string]: MarkerIndexItem } = this._hash;\n const index = this._index;\n const id: string = marker.id;\n\n if (!(id in hash)) {\n return;\n }\n\n index.remove(hash[id]);\n\n const item: MarkerIndexItem = {\n lat: marker.lngLat.lat,\n lng: marker.lngLat.lng,\n marker: marker,\n };\n\n hash[id] = item;\n index.insert(item);\n }\n}\n","\nexport default function quickselect(arr, k, left, right, compare) {\n quickselectStep(arr, k, left || 0, right || (arr.length - 1), compare || defaultCompare);\n}\n\nfunction quickselectStep(arr, k, left, right, compare) {\n\n while (right > left) {\n if (right - left > 600) {\n var n = right - left + 1;\n var m = k - left + 1;\n var z = Math.log(n);\n var s = 0.5 * Math.exp(2 * z / 3);\n var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);\n var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));\n var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));\n quickselectStep(arr, k, newLeft, newRight, compare);\n }\n\n var t = arr[k];\n var i = left;\n var j = right;\n\n swap(arr, left, k);\n if (compare(arr[right], t) > 0) swap(arr, left, right);\n\n while (i < j) {\n swap(arr, i, j);\n i++;\n j--;\n while (compare(arr[i], t) < 0) i++;\n while (compare(arr[j], t) > 0) j--;\n }\n\n if (compare(arr[left], t) === 0) swap(arr, left, j);\n else {\n j++;\n swap(arr, j, right);\n }\n\n if (j <= k) left = j + 1;\n if (k <= j) right = j - 1;\n }\n}\n\nfunction swap(arr, i, j) {\n var tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n}\n\nfunction defaultCompare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n","import quickselect from 'quickselect';\n\nexport default class RBush {\n constructor(maxEntries = 9) {\n // max entries in a node is 9 by default; min node fill is 40% for best performance\n this._maxEntries = Math.max(4, maxEntries);\n this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));\n this.clear();\n }\n\n all() {\n return this._all(this.data, []);\n }\n\n search(bbox) {\n let node = this.data;\n const result = [];\n\n if (!intersects(bbox, node)) return result;\n\n const toBBox = this.toBBox;\n const nodesToSearch = [];\n\n while (node) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n const childBBox = node.leaf ? toBBox(child) : child;\n\n if (intersects(bbox, childBBox)) {\n if (node.leaf) result.push(child);\n else if (contains(bbox, childBBox)) this._all(child, result);\n else nodesToSearch.push(child);\n }\n }\n node = nodesToSearch.pop();\n }\n\n return result;\n }\n\n collides(bbox) {\n let node = this.data;\n\n if (!intersects(bbox, node)) return false;\n\n const nodesToSearch = [];\n while (node) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n const childBBox = node.leaf ? this.toBBox(child) : child;\n\n if (intersects(bbox, childBBox)) {\n if (node.leaf || contains(bbox, childBBox)) return true;\n nodesToSearch.push(child);\n }\n }\n node = nodesToSearch.pop();\n }\n\n return false;\n }\n\n load(data) {\n if (!(data && data.length)) return this;\n\n if (data.length < this._minEntries) {\n for (let i = 0; i < data.length; i++) {\n this.insert(data[i]);\n }\n return this;\n }\n\n // recursively build the tree with the given data from scratch using OMT algorithm\n let node = this._build(data.slice(), 0, data.length - 1, 0);\n\n if (!this.data.children.length) {\n // save as is if tree is empty\n this.data = node;\n\n } else if (this.data.height === node.height) {\n // split root if trees have the same height\n this._splitRoot(this.data, node);\n\n } else {\n if (this.data.height < node.height) {\n // swap trees if inserted one is bigger\n const tmpNode = this.data;\n this.data = node;\n node = tmpNode;\n }\n\n // insert the small tree into the large tree at appropriate level\n this._insert(node, this.data.height - node.height - 1, true);\n }\n\n return this;\n }\n\n insert(item) {\n if (item) this._insert(item, this.data.height - 1);\n return this;\n }\n\n clear() {\n this.data = createNode([]);\n return this;\n }\n\n remove(item, equalsFn) {\n if (!item) return this;\n\n let node = this.data;\n const bbox = this.toBBox(item);\n const path = [];\n const indexes = [];\n let i, parent, goingUp;\n\n // depth-first iterative tree traversal\n while (node || path.length) {\n\n if (!node) { // go up\n node = path.pop();\n parent = path[path.length - 1];\n i = indexes.pop();\n goingUp = true;\n }\n\n if (node.leaf) { // check current node\n const index = findItem(item, node.children, equalsFn);\n\n if (index !== -1) {\n // item found, remove the item and condense tree upwards\n node.children.splice(index, 1);\n path.push(node);\n this._condense(path);\n return this;\n }\n }\n\n if (!goingUp && !node.leaf && contains(node, bbox)) { // go down\n path.push(node);\n indexes.push(i);\n i = 0;\n parent = node;\n node = node.children[0];\n\n } else if (parent) { // go right\n i++;\n node = parent.children[i];\n goingUp = false;\n\n } else node = null; // nothing found\n }\n\n return this;\n }\n\n toBBox(item) { return item; }\n\n compareMinX(a, b) { return a.minX - b.minX; }\n compareMinY(a, b) { return a.minY - b.minY; }\n\n toJSON() { return this.data; }\n\n fromJSON(data) {\n this.data = data;\n return this;\n }\n\n _all(node, result) {\n const nodesToSearch = [];\n while (node) {\n if (node.leaf) result.push(...node.children);\n else nodesToSearch.push(...node.children);\n\n node = nodesToSearch.pop();\n }\n return result;\n }\n\n _build(items, left, right, height) {\n\n const N = right - left + 1;\n let M = this._maxEntries;\n let node;\n\n if (N <= M) {\n // reached leaf level; return leaf\n node = createNode(items.slice(left, right + 1));\n calcBBox(node, this.toBBox);\n return node;\n }\n\n if (!height) {\n // target height of the bulk-loaded tree\n height = Math.ceil(Math.log(N) / Math.log(M));\n\n // target number of root entries to maximize storage utilization\n M = Math.ceil(N / Math.pow(M, height - 1));\n }\n\n node = createNode([]);\n node.leaf = false;\n node.height = height;\n\n // split the items into M mostly square tiles\n\n const N2 = Math.ceil(N / M);\n const N1 = N2 * Math.ceil(Math.sqrt(M));\n\n multiSelect(items, left, right, N1, this.compareMinX);\n\n for (let i = left; i <= right; i += N1) {\n\n const right2 = Math.min(i + N1 - 1, right);\n\n multiSelect(items, i, right2, N2, this.compareMinY);\n\n for (let j = i; j <= right2; j += N2) {\n\n const right3 = Math.min(j + N2 - 1, right2);\n\n // pack each entry recursively\n node.children.push(this._build(items, j, right3, height - 1));\n }\n }\n\n calcBBox(node, this.toBBox);\n\n return node;\n }\n\n _chooseSubtree(bbox, node, level, path) {\n while (true) {\n path.push(node);\n\n if (node.leaf || path.length - 1 === level) break;\n\n let minArea = Infinity;\n let minEnlargement = Infinity;\n let targetNode;\n\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n const area = bboxArea(child);\n const enlargement = enlargedArea(bbox, child) - area;\n\n // choose entry with the least area enlargement\n if (enlargement < minEnlargement) {\n minEnlargement = enlargement;\n minArea = area < minArea ? area : minArea;\n targetNode = child;\n\n } else if (enlargement === minEnlargement) {\n // otherwise choose one with the smallest area\n if (area < minArea) {\n minArea = area;\n targetNode = child;\n }\n }\n }\n\n node = targetNode || node.children[0];\n }\n\n return node;\n }\n\n _insert(item, level, isNode) {\n const bbox = isNode ? item : this.toBBox(item);\n const insertPath = [];\n\n // find the best node for accommodating the item, saving all nodes along the path too\n const node = this._chooseSubtree(bbox, this.data, level, insertPath);\n\n // put the item into the node\n node.children.push(item);\n extend(node, bbox);\n\n // split on node overflow; propagate upwards if necessary\n while (level >= 0) {\n if (insertPath[level].children.length > this._maxEntries) {\n this._split(insertPath, level);\n level--;\n } else break;\n }\n\n // adjust bboxes along the insertion path\n this._adjustParentBBoxes(bbox, insertPath, level);\n }\n\n // split overflowed node into two\n _split(insertPath, level) {\n const node = insertPath[level];\n const M = node.children.length;\n const m = this._minEntries;\n\n this._chooseSplitAxis(node, m, M);\n\n const splitIndex = this._chooseSplitIndex(node, m, M);\n\n const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));\n newNode.height = node.height;\n newNode.leaf = node.leaf;\n\n calcBBox(node, this.toBBox);\n calcBBox(newNode, this.toBBox);\n\n if (level) insertPath[level - 1].children.push(newNode);\n else this._splitRoot(node, newNode);\n }\n\n _splitRoot(node, newNode) {\n // split root node\n this.data = createNode([node, newNode]);\n this.data.height = node.height + 1;\n this.data.leaf = false;\n calcBBox(this.data, this.toBBox);\n }\n\n _chooseSplitIndex(node, m, M) {\n let index;\n let minOverlap = Infinity;\n let minArea = Infinity;\n\n for (let i = m; i <= M - m; i++) {\n const bbox1 = distBBox(node, 0, i, this.toBBox);\n const bbox2 = distBBox(node, i, M, this.toBBox);\n\n const overlap = intersectionArea(bbox1, bbox2);\n const area = bboxArea(bbox1) + bboxArea(bbox2);\n\n // choose distribution with minimum overlap\n if (overlap < minOverlap) {\n minOverlap = overlap;\n index = i;\n\n minArea = area < minArea ? area : minArea;\n\n } else if (overlap === minOverlap) {\n // otherwise choose distribution with minimum area\n if (area < minArea) {\n minArea = area;\n index = i;\n }\n }\n }\n\n return index || M - m;\n }\n\n // sorts node children by the best axis for split\n _chooseSplitAxis(node, m, M) {\n const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;\n const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;\n const xMargin = this._allDistMargin(node, m, M, compareMinX);\n const yMargin = this._allDistMargin(node, m, M, compareMinY);\n\n // if total distributions margin value is minimal for x, sort by minX,\n // otherwise it's already sorted by minY\n if (xMargin < yMargin) node.children.sort(compareMinX);\n }\n\n // total margin of all possible split distributions where each node is at least m full\n _allDistMargin(node, m, M, compare) {\n node.children.sort(compare);\n\n const toBBox = this.toBBox;\n const leftBBox = distBBox(node, 0, m, toBBox);\n const rightBBox = distBBox(node, M - m, M, toBBox);\n let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);\n\n for (let i = m; i < M - m; i++) {\n const child = node.children[i];\n extend(leftBBox, node.leaf ? toBBox(child) : child);\n margin += bboxMargin(leftBBox);\n }\n\n for (let i = M - m - 1; i >= m; i--) {\n const child = node.children[i];\n extend(rightBBox, node.leaf ? toBBox(child) : child);\n margin += bboxMargin(rightBBox);\n }\n\n return margin;\n }\n\n _adjustParentBBoxes(bbox, path, level) {\n // adjust bboxes along the given tree path\n for (let i = level; i >= 0; i--) {\n extend(path[i], bbox);\n }\n }\n\n _condense(path) {\n // go through the path, removing empty nodes and updating bboxes\n for (let i = path.length - 1, siblings; i >= 0; i--) {\n if (path[i].children.length === 0) {\n if (i > 0) {\n siblings = path[i - 1].children;\n siblings.splice(siblings.indexOf(path[i]), 1);\n\n } else this.clear();\n\n } else calcBBox(path[i], this.toBBox);\n }\n }\n}\n\nfunction findItem(item, items, equalsFn) {\n if (!equalsFn) return items.indexOf(item);\n\n for (let i = 0; i < items.length; i++) {\n if (equalsFn(item, items[i])) return i;\n }\n return -1;\n}\n\n// calculate node's bbox from bboxes of its children\nfunction calcBBox(node, toBBox) {\n distBBox(node, 0, node.children.length, toBBox, node);\n}\n\n// min bounding rectangle of node children from k to p-1\nfunction distBBox(node, k, p, toBBox, destNode) {\n if (!destNode) destNode = createNode(null);\n destNode.minX = Infinity;\n destNode.minY = Infinity;\n destNode.maxX = -Infinity;\n destNode.maxY = -Infinity;\n\n for (let i = k; i < p; i++) {\n const child = node.children[i];\n extend(destNode, node.leaf ? toBBox(child) : child);\n }\n\n return destNode;\n}\n\nfunction extend(a, b) {\n a.minX = Math.min(a.minX, b.minX);\n a.minY = Math.min(a.minY, b.minY);\n a.maxX = Math.max(a.maxX, b.maxX);\n a.maxY = Math.max(a.maxY, b.maxY);\n return a;\n}\n\nfunction compareNodeMinX(a, b) { return a.minX - b.minX; }\nfunction compareNodeMinY(a, b) { return a.minY - b.minY; }\n\nfunction bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); }\nfunction bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }\n\nfunction enlargedArea(a, b) {\n return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *\n (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));\n}\n\nfunction intersectionArea(a, b) {\n const minX = Math.max(a.minX, b.minX);\n const minY = Math.max(a.minY, b.minY);\n const maxX = Math.min(a.maxX, b.maxX);\n const maxY = Math.min(a.maxY, b.maxY);\n\n return Math.max(0, maxX - minX) *\n Math.max(0, maxY - minY);\n}\n\nfunction contains(a, b) {\n return a.minX <= b.minX &&\n a.minY <= b.minY &&\n b.maxX <= a.maxX &&\n b.maxY <= a.maxY;\n}\n\nfunction intersects(a, b) {\n return b.minX <= a.maxX &&\n b.minY <= a.maxY &&\n b.maxX >= a.minX &&\n b.maxY >= a.minY;\n}\n\nfunction createNode(children) {\n return {\n children,\n height: 1,\n leaf: true,\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity\n };\n}\n\n// sort an array so that items come in groups of n unsorted items, with groups sorted between each other;\n// combines selection algorithm with binary divide & conquer approach\n\nfunction multiSelect(arr, left, right, n, compare) {\n const stack = [left, right];\n\n while (stack.length) {\n right = stack.pop();\n left = stack.pop();\n\n if (right - left <= n) continue;\n\n const mid = left + Math.ceil((right - left) / n / 2) * n;\n quickselect(arr, mid, left, right, compare);\n\n stack.push(left, mid, mid, right);\n }\n}\n","import { BBox } from \"rbush\";\nimport RBush from \"rbush\";\n\nimport { LngLat } from \"../api/interfaces/LngLat\";\n\nexport class GeoRBush<T extends LngLat> extends RBush<T> {\n public compareMinX(a: T, b: T): number {\n return a.lng - b.lng;\n }\n\n public compareMinY(a: T, b: T): number {\n return a.lat - b.lat;\n }\n\n public toBBox(item: T): BBox {\n return {\n minX: item.lng,\n minY: item.lat,\n maxX: item.lng,\n maxY: item.lat,\n };\n }\n}\n","import { Component } from \"./Component\";\nimport { CoverComponent } from \"./cover/CoverComponent\";\nimport { ComponentConfiguration } from \"./interfaces/ComponentConfiguration\";\n\nimport { ArgumentMapillaryError } from \"../error/ArgumentMapillaryError\";\nimport { Container } from \"../viewer/Container\";\nimport { Navigator } from \"../viewer/Navigator\";\n\ninterface ActiveComponent {\n active: boolean;\n component: Component<ComponentConfiguration>;\n}\n\nexport class ComponentService {\n public static registeredCoverComponent: typeof CoverComponent;\n public static registeredComponents: { [key: string]: { new(...args: any[]): Component<ComponentConfiguration>; } } = {};\n\n private _coverActivated: boolean;\n private _coverComponent: CoverComponent;\n private _components: { [key: string]: ActiveComponent } = {};\n\n constructor(container: Container, navigator: Navigator) {\n for (const componentName in ComponentService.registeredComponents) {\n if (!ComponentService.registeredComponents.hasOwnProperty(componentName)) {\n continue;\n }\n\n const component: new (...args: any[]) => Component<ComponentConfiguration> =\n ComponentService.registeredComponents[componentName];\n\n this._components[componentName] = {\n active: false,\n component: new component(componentName, container, navigator),\n };\n }\n\n this._coverComponent = new ComponentService.registeredCoverComponent(\"cover\", container, navigator);\n this._coverComponent.activate();\n this._coverActivated = true;\n }\n\n public static register<T extends Component<ComponentConfiguration>>(\n component: { componentName: string, new(...args: any[]): T; }): void {\n if (ComponentService.registeredComponents[component.componentName] === undefined) {\n ComponentService.registeredComponents[component.componentName] = component;\n }\n }\n\n public static registerCover(coverComponent: typeof CoverComponent): void {\n ComponentService.registeredCoverComponent = coverComponent;\n }\n\n public get coverActivated(): boolean {\n return this._coverActivated;\n }\n\n public activateCover(): void {\n if (this._coverActivated) {\n return;\n }\n\n this._coverActivated = true;\n\n for (const componentName in this._components) {\n if (!this._components.hasOwnProperty(componentName)) {\n continue;\n }\n\n const component: ActiveComponent = this._components[componentName];\n\n if (component.active) {\n component.component.deactivate();\n }\n }\n }\n\n public deactivateCover(): void {\n if (!this._coverActivated) {\n return;\n }\n\n this._coverActivated = false;\n\n for (const componentName in this._components) {\n if (!this._components.hasOwnProperty(componentName)) {\n continue;\n }\n\n const component: ActiveComponent = this._components[componentName];\n\n if (component.active) {\n component.component.activate();\n }\n }\n }\n\n public activate(name: string): void {\n this._checkName(name);\n this._components[name].active = true;\n\n if (!this._coverActivated) {\n this.get(name).activate();\n }\n }\n\n public configure<TConfiguration extends ComponentConfiguration>(name: string, conf: TConfiguration): void {\n this._checkName(name);\n this.get(name).configure(conf);\n }\n\n public deactivate(name: string): void {\n this._checkName(name);\n this._components[name].active = false;\n\n if (!this._coverActivated) {\n this.get(name).deactivate();\n }\n }\n\n public get<TComponent extends Component<ComponentConfiguration>>(name: string): TComponent {\n return <TComponent>this._components[name].component;\n }\n\n public getCover(): CoverComponent {\n return this._coverComponent;\n }\n\n public remove(): void {\n this._coverComponent.deactivate();\n\n for (const componentName in this._components) {\n if (!this._components.hasOwnProperty(componentName)) {\n continue;\n }\n\n this._components[componentName].component.deactivate();\n }\n }\n\n private _checkName(name: string): void {\n if (!(name in this._components)) {\n throw new ArgumentMapillaryError(`Component does not exist: ${name}`);\n }\n }\n}\n","var nativeIsArray = Array.isArray\nvar toString = Object.prototype.toString\n\nmodule.exports = nativeIsArray || isArray\n\nfunction isArray(obj) {\n return toString.call(obj) === \"[object Array]\"\n}\n","var version = require(\"./version\")\n\nVirtualPatch.NONE = 0\nVirtualPatch.VTEXT = 1\nVirtualPatch.VNODE = 2\nVirtualPatch.WIDGET = 3\nVirtualPatch.PROPS = 4\nVirtualPatch.ORDER = 5\nVirtualPatch.INSERT = 6\nVirtualPatch.REMOVE = 7\nVirtualPatch.THUNK = 8\n\nmodule.exports = VirtualPatch\n\nfunction VirtualPatch(type, vNode, patch) {\n this.type = Number(type)\n this.vNode = vNode\n this.patch = patch\n}\n\nVirtualPatch.prototype.version = version\nVirtualPatch.prototype.type = \"VirtualPatch\"\n","var version = require(\"./version\")\n\nmodule.exports = isVirtualNode\n\nfunction isVirtualNode(x) {\n return x && x.type === \"VirtualNode\" && x.version === version\n}\n","var version = require(\"./version\")\n\nmodule.exports = isVirtualText\n\nfunction isVirtualText(x) {\n return x && x.type === \"VirtualText\" && x.version === version\n}\n","module.exports = isWidget\n\nfunction isWidget(w) {\n return w && w.type === \"Widget\"\n}\n","module.exports = isThunk\r\n\r\nfunction isThunk(t) {\r\n return t && t.type === \"Thunk\"\r\n}\r\n","var isVNode = require(\"./is-vnode\")\nvar isVText = require(\"./is-vtext\")\nvar isWidget = require(\"./is-widget\")\nvar isThunk = require(\"./is-thunk\")\n\nmodule.exports = handleThunk\n\nfunction handleThunk(a, b) {\n var renderedA = a\n var renderedB = b\n\n if (isThunk(b)) {\n renderedB = renderThunk(b, a)\n }\n\n if (isThunk(a)) {\n renderedA = renderThunk(a, null)\n }\n\n return {\n a: renderedA,\n b: renderedB\n }\n}\n\nfunction renderThunk(thunk, previous) {\n var renderedThunk = thunk.vnode\n\n if (!renderedThunk) {\n renderedThunk = thunk.vnode = thunk.render(previous)\n }\n\n if (!(isVNode(renderedThunk) ||\n isVText(renderedThunk) ||\n isWidget(renderedThunk))) {\n throw new Error(\"thunk did not return a valid node\");\n }\n\n return renderedThunk\n}\n","'use strict';\n\nmodule.exports = function isObject(x) {\n\treturn typeof x === 'object' && x !== null;\n};\n","module.exports = isHook\n\nfunction isHook(hook) {\n return hook &&\n (typeof hook.hook === \"function\" && !hook.hasOwnProperty(\"hook\") ||\n typeof hook.unhook === \"function\" && !hook.hasOwnProperty(\"unhook\"))\n}\n","var isObject = require(\"is-object\")\nvar isHook = require(\"../vnode/is-vhook\")\n\nmodule.exports = diffProps\n\nfunction diffProps(a, b) {\n var diff\n\n for (var aKey in a) {\n if (!(aKey in b)) {\n diff = diff || {}\n diff[aKey] = undefined\n }\n\n var aValue = a[aKey]\n var bValue = b[aKey]\n\n if (aValue === bValue) {\n continue\n } else if (isObject(aValue) && isObject(bValue)) {\n if (getPrototype(bValue) !== getPrototype(aValue)) {\n diff = diff || {}\n diff[aKey] = bValue\n } else if (isHook(bValue)) {\n diff = diff || {}\n diff[aKey] = bValue\n } else {\n var objectDiff = diffProps(aValue, bValue)\n if (objectDiff) {\n diff = diff || {}\n diff[aKey] = objectDiff\n }\n }\n } else {\n diff = diff || {}\n diff[aKey] = bValue\n }\n }\n\n for (var bKey in b) {\n if (!(bKey in a)) {\n diff = diff || {}\n diff[bKey] = b[bKey]\n }\n }\n\n return diff\n}\n\nfunction getPrototype(value) {\n if (Object.getPrototypeOf) {\n return Object.getPrototypeOf(value)\n } else if (value.__proto__) {\n return value.__proto__\n } else if (value.constructor) {\n return value.constructor.prototype\n }\n}\n","var isArray = require(\"x-is-array\")\n\nvar VPatch = require(\"../vnode/vpatch\")\nvar isVNode = require(\"../vnode/is-vnode\")\nvar isVText = require(\"../vnode/is-vtext\")\nvar isWidget = require(\"../vnode/is-widget\")\nvar isThunk = require(\"../vnode/is-thunk\")\nvar handleThunk = require(\"../vnode/handle-thunk\")\n\nvar diffProps = require(\"./diff-props\")\n\nmodule.exports = diff\n\nfunction diff(a, b) {\n var patch = { a: a }\n walk(a, b, patch, 0)\n return patch\n}\n\nfunction walk(a, b, patch, index) {\n if (a === b) {\n return\n }\n\n var apply = patch[index]\n var applyClear = false\n\n if (isThunk(a) || isThunk(b)) {\n thunks(a, b, patch, index)\n } else if (b == null) {\n\n // If a is a widget we will add a remove patch for it\n // Otherwise any child widgets/hooks must be destroyed.\n // This prevents adding two remove patches for a widget.\n if (!isWidget(a)) {\n clearState(a, patch, index)\n apply = patch[index]\n }\n\n apply = appendPatch(apply, new VPatch(VPatch.REMOVE, a, b))\n } else if (isVNode(b)) {\n if (isVNode(a)) {\n if (a.tagName === b.tagName &&\n a.namespace === b.namespace &&\n a.key === b.key) {\n var propsPatch = diffProps(a.properties, b.properties)\n if (propsPatch) {\n apply = appendPatch(apply,\n new VPatch(VPatch.PROPS, a, propsPatch))\n }\n apply = diffChildren(a, b, patch, apply, index)\n } else {\n apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))\n applyClear = true\n }\n } else {\n apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))\n applyClear = true\n }\n } else if (isVText(b)) {\n if (!isVText(a)) {\n apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))\n applyClear = true\n } else if (a.text !== b.text) {\n apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))\n }\n } else if (isWidget(b)) {\n if (!isWidget(a)) {\n applyClear = true\n }\n\n apply = appendPatch(apply, new VPatch(VPatch.WIDGET, a, b))\n }\n\n if (apply) {\n patch[index] = apply\n }\n\n if (applyClear) {\n clearState(a, patch, index)\n }\n}\n\nfunction diffChildren(a, b, patch, apply, index) {\n var aChildren = a.children\n var orderedSet = reorder(aChildren, b.children)\n var bChildren = orderedSet.children\n\n var aLen = aChildren.length\n var bLen = bChildren.length\n var len = aLen > bLen ? aLen : bLen\n\n for (var i = 0; i < len; i++) {\n var leftNode = aChildren[i]\n var rightNode = bChildren[i]\n index += 1\n\n if (!leftNode) {\n if (rightNode) {\n // Excess nodes in b need to be added\n apply = appendPatch(apply,\n new VPatch(VPatch.INSERT, null, rightNode))\n }\n } else {\n walk(leftNode, rightNode, patch, index)\n }\n\n if (isVNode(leftNode) && leftNode.count) {\n index += leftNode.count\n }\n }\n\n if (orderedSet.moves) {\n // Reorder nodes last\n apply = appendPatch(apply, new VPatch(\n VPatch.ORDER,\n a,\n orderedSet.moves\n ))\n }\n\n return apply\n}\n\nfunction clearState(vNode, patch, index) {\n // TODO: Make this a single walk, not two\n unhook(vNode, patch, index)\n destroyWidgets(vNode, patch, index)\n}\n\n// Patch records for all destroyed widgets must be added because we need\n// a DOM node reference for the destroy function\nfunction destroyWidgets(vNode, patch, index) {\n if (isWidget(vNode)) {\n if (typeof vNode.destroy === \"function\") {\n patch[index] = appendPatch(\n patch[index],\n new VPatch(VPatch.REMOVE, vNode, null)\n )\n }\n } else if (isVNode(vNode) && (vNode.hasWidgets || vNode.hasThunks)) {\n var children = vNode.children\n var len = children.length\n for (var i = 0; i < len; i++) {\n var child = children[i]\n index += 1\n\n destroyWidgets(child, patch, index)\n\n if (isVNode(child) && child.count) {\n index += child.count\n }\n }\n } else if (isThunk(vNode)) {\n thunks(vNode, null, patch, index)\n }\n}\n\n// Create a sub-patch for thunks\nfunction thunks(a, b, patch, index) {\n var nodes = handleThunk(a, b)\n var thunkPatch = diff(nodes.a, nodes.b)\n if (hasPatches(thunkPatch)) {\n patch[index] = new VPatch(VPatch.THUNK, null, thunkPatch)\n }\n}\n\nfunction hasPatches(patch) {\n for (var index in patch) {\n if (index !== \"a\") {\n return true\n }\n }\n\n return false\n}\n\n// Execute hooks when two nodes are identical\nfunction unhook(vNode, patch, index) {\n if (isVNode(vNode)) {\n if (vNode.hooks) {\n patch[index] = appendPatch(\n patch[index],\n new VPatch(\n VPatch.PROPS,\n vNode,\n undefinedKeys(vNode.hooks)\n )\n )\n }\n\n if (vNode.descendantHooks || vNode.hasThunks) {\n var children = vNode.children\n var len = children.length\n for (var i = 0; i < len; i++) {\n var child = children[i]\n index += 1\n\n unhook(child, patch, index)\n\n if (isVNode(child) && child.count) {\n index += child.count\n }\n }\n }\n } else if (isThunk(vNode)) {\n thunks(vNode, null, patch, index)\n }\n}\n\nfunction undefinedKeys(obj) {\n var result = {}\n\n for (var key in obj) {\n result[key] = undefined\n }\n\n return result\n}\n\n// List diff, naive left to right reordering\nfunction reorder(aChildren, bChildren) {\n // O(M) time, O(M) memory\n var bChildIndex = keyIndex(bChildren)\n var bKeys = bChildIndex.keys\n var bFree = bChildIndex.free\n\n if (bFree.length === bChildren.length) {\n return {\n children: bChildren,\n moves: null\n }\n }\n\n // O(N) time, O(N) memory\n var aChildIndex = keyIndex(aChildren)\n var aKeys = aChildIndex.keys\n var aFree = aChildIndex.free\n\n if (aFree.length === aChildren.length) {\n return {\n children: bChildren,\n moves: null\n }\n }\n\n // O(MAX(N, M)) memory\n var newChildren = []\n\n var freeIndex = 0\n var freeCount = bFree.length\n var deletedItems = 0\n\n // Iterate through a and match a node in b\n // O(N) time,\n for (var i = 0 ; i < aChildren.length; i++) {\n var aItem = aChildren[i]\n var itemIndex\n\n if (aItem.key) {\n if (bKeys.hasOwnProperty(aItem.key)) {\n // Match up the old keys\n itemIndex = bKeys[aItem.key]\n newChildren.push(bChildren[itemIndex])\n\n } else {\n // Remove old keyed items\n itemIndex = i - deletedItems++\n newChildren.push(null)\n }\n } else {\n // Match the item in a with the next free item in b\n if (freeIndex < freeCount) {\n itemIndex = bFree[freeIndex++]\n newChildren.push(bChildren[itemIndex])\n } else {\n // There are no free items in b to match with\n // the free items in a, so the extra free nodes\n // are deleted.\n itemIndex = i - deletedItems++\n newChildren.push(null)\n }\n }\n }\n\n var lastFreeIndex = freeIndex >= bFree.length ?\n bChildren.length :\n bFree[freeIndex]\n\n // Iterate through b and append any new keys\n // O(M) time\n for (var j = 0; j < bChildren.length; j++) {\n var newItem = bChildren[j]\n\n if (newItem.key) {\n if (!aKeys.hasOwnProperty(newItem.key)) {\n // Add any new keyed items\n // We are adding new items to the end and then sorting them\n // in place. In future we should insert new items in place.\n newChildren.push(newItem)\n }\n } else if (j >= lastFreeIndex) {\n // Add any leftover non-keyed items\n newChildren.push(newItem)\n }\n }\n\n var simulate = newChildren.slice()\n var simulateIndex = 0\n var removes = []\n var inserts = []\n var simulateItem\n\n for (var k = 0; k < bChildren.length;) {\n var wantedItem = bChildren[k]\n simulateItem = simulate[simulateIndex]\n\n // remove items\n while (simulateItem === null && simulate.length) {\n removes.push(remove(simulate, simulateIndex, null))\n simulateItem = simulate[simulateIndex]\n }\n\n if (!simulateItem || simulateItem.key !== wantedItem.key) {\n // if we need a key in this position...\n if (wantedItem.key) {\n if (simulateItem && simulateItem.key) {\n // if an insert doesn't put this key in place, it needs to move\n if (bKeys[simulateItem.key] !== k + 1) {\n removes.push(remove(simulate, simulateIndex, simulateItem.key))\n simulateItem = simulate[simulateIndex]\n // if the remove didn't put the wanted item in place, we need to insert it\n if (!simulateItem || simulateItem.key !== wantedItem.key) {\n inserts.push({key: wantedItem.key, to: k})\n }\n // items are matching, so skip ahead\n else {\n simulateIndex++\n }\n }\n else {\n inserts.push({key: wantedItem.key, to: k})\n }\n }\n else {\n inserts.push({key: wantedItem.key, to: k})\n }\n k++\n }\n // a key in simulate has no matching wanted key, remove it\n else if (simulateItem && simulateItem.key) {\n removes.push(remove(simulate, simulateIndex, simulateItem.key))\n }\n }\n else {\n simulateIndex++\n k++\n }\n }\n\n // remove all the remaining nodes from simulate\n while(simulateIndex < simulate.length) {\n simulateItem = simulate[simulateIndex]\n removes.push(remove(simulate, simulateIndex, simulateItem && simulateItem.key))\n }\n\n // If the only moves we have are deletes then we can just\n // let the delete patch remove these items.\n if (removes.length === deletedItems && !inserts.length) {\n return {\n children: newChildren,\n moves: null\n }\n }\n\n return {\n children: newChildren,\n moves: {\n removes: removes,\n inserts: inserts\n }\n }\n}\n\nfunction remove(arr, index, key) {\n arr.splice(index, 1)\n\n return {\n from: index,\n key: key\n }\n}\n\nfunction keyIndex(children) {\n var keys = {}\n var free = []\n var length = children.length\n\n for (var i = 0; i < length; i++) {\n var child = children[i]\n\n if (child.key) {\n keys[child.key] = i\n } else {\n free.push(i)\n }\n }\n\n return {\n keys: keys, // A hash of key name to index\n free: free // An array of unkeyed item indices\n }\n}\n\nfunction appendPatch(apply, patch) {\n if (apply) {\n if (isArray(apply)) {\n apply.push(patch)\n } else {\n apply = [apply, patch]\n }\n\n return apply\n } else {\n return patch\n }\n}\n","var diff = require(\"./vtree/diff.js\")\n\nmodule.exports = diff\n","var slice = Array.prototype.slice\n\nmodule.exports = iterativelyWalk\n\nfunction iterativelyWalk(nodes, cb) {\n if (!('length' in nodes)) {\n nodes = [nodes]\n }\n \n nodes = slice.call(nodes)\n\n while(nodes.length) {\n var node = nodes.shift(),\n ret = cb(node)\n\n if (ret) {\n return ret\n }\n\n if (node.childNodes && node.childNodes.length) {\n nodes = slice.call(node.childNodes).concat(nodes)\n }\n }\n}\n","module.exports = Comment\n\nfunction Comment(data, owner) {\n if (!(this instanceof Comment)) {\n return new Comment(data, owner)\n }\n\n this.data = data\n this.nodeValue = data\n this.length = data.length\n this.ownerDocument = owner || null\n}\n\nComment.prototype.nodeType = 8\nComment.prototype.nodeName = \"#comment\"\n\nComment.prototype.toString = function _Comment_toString() {\n return \"[object Comment]\"\n}\n","module.exports = DOMText\n\nfunction DOMText(value, owner) {\n if (!(this instanceof DOMText)) {\n return new DOMText(value)\n }\n\n this.data = value || \"\"\n this.length = this.data.length\n this.ownerDocument = owner || null\n}\n\nDOMText.prototype.type = \"DOMTextNode\"\nDOMText.prototype.nodeType = 3\nDOMText.prototype.nodeName = \"#text\"\n\nDOMText.prototype.toString = function _Text_toString() {\n return this.data\n}\n\nDOMText.prototype.replaceData = function replaceData(index, length, value) {\n var current = this.data\n var left = current.substring(0, index)\n var right = current.substring(index + length, current.length)\n this.data = left + value + right\n this.length = this.data.length\n}\n","module.exports = dispatchEvent\n\nfunction dispatchEvent(ev) {\n var elem = this\n var type = ev.type\n\n if (!ev.target) {\n ev.target = elem\n }\n\n if (!elem.listeners) {\n elem.listeners = {}\n }\n\n var listeners = elem.listeners[type]\n\n if (listeners) {\n return listeners.forEach(function (listener) {\n ev.currentTarget = elem\n if (typeof listener === 'function') {\n listener(ev)\n } else {\n listener.handleEvent(ev)\n }\n })\n }\n\n if (elem.parentNode) {\n elem.parentNode.dispatchEvent(ev)\n }\n}\n","module.exports = addEventListener\n\nfunction addEventListener(type, listener) {\n var elem = this\n\n if (!elem.listeners) {\n elem.listeners = {}\n }\n\n if (!elem.listeners[type]) {\n elem.listeners[type] = []\n }\n\n if (elem.listeners[type].indexOf(listener) === -1) {\n elem.listeners[type].push(listener)\n }\n}\n","module.exports = removeEventListener\n\nfunction removeEventListener(type, listener) {\n var elem = this\n\n if (!elem.listeners) {\n return\n }\n\n if (!elem.listeners[type]) {\n return\n }\n\n var list = elem.listeners[type]\n var index = list.indexOf(listener)\n if (index !== -1) {\n list.splice(index, 1)\n }\n}\n","module.exports = serializeNode\n\nvar voidElements = [\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"menuitem\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"];\n\nfunction serializeNode(node) {\n switch (node.nodeType) {\n case 3:\n return escapeText(node.data)\n case 8:\n return \"<!--\" + node.data + \"-->\"\n default:\n return serializeElement(node)\n }\n}\n\nfunction serializeElement(elem) {\n var strings = []\n\n var tagname = elem.tagName\n\n if (elem.namespaceURI === \"http://www.w3.org/1999/xhtml\") {\n tagname = tagname.toLowerCase()\n }\n\n strings.push(\"<\" + tagname + properties(elem) + datasetify(elem))\n\n if (voidElements.indexOf(tagname) > -1) {\n strings.push(\" />\")\n } else {\n strings.push(\">\")\n\n if (elem.childNodes.length) {\n strings.push.apply(strings, elem.childNodes.map(serializeNode))\n } else if (elem.textContent || elem.innerText) {\n strings.push(escapeText(elem.textContent || elem.innerText))\n } else if (elem.innerHTML) {\n strings.push(elem.innerHTML)\n }\n\n strings.push(\"</\" + tagname + \">\")\n }\n\n return strings.join(\"\")\n}\n\nfunction isProperty(elem, key) {\n var type = typeof elem[key]\n\n if (key === \"style\" && Object.keys(elem.style).length > 0) {\n return true\n }\n\n return elem.hasOwnProperty(key) &&\n (type === \"string\" || type === \"boolean\" || type === \"number\") &&\n key !== \"nodeName\" && key !== \"className\" && key !== \"tagName\" &&\n key !== \"textContent\" && key !== \"innerText\" && key !== \"namespaceURI\" && key !== \"innerHTML\"\n}\n\nfunction stylify(styles) {\n if (typeof styles === 'string') return styles\n var attr = \"\"\n Object.keys(styles).forEach(function (key) {\n var value = styles[key]\n key = key.replace(/[A-Z]/g, function(c) {\n return \"-\" + c.toLowerCase();\n })\n attr += key + \":\" + value + \";\"\n })\n return attr\n}\n\nfunction datasetify(elem) {\n var ds = elem.dataset\n var props = []\n\n for (var key in ds) {\n props.push({ name: \"data-\" + key, value: ds[key] })\n }\n\n return props.length ? stringify(props) : \"\"\n}\n\nfunction stringify(list) {\n var attributes = []\n list.forEach(function (tuple) {\n var name = tuple.name\n var value = tuple.value\n\n if (name === \"style\") {\n value = stylify(value)\n }\n\n attributes.push(name + \"=\" + \"\\\"\" + escapeAttributeValue(value) + \"\\\"\")\n })\n\n return attributes.length ? \" \" + attributes.join(\" \") : \"\"\n}\n\nfunction properties(elem) {\n var props = []\n for (var key in elem) {\n if (isProperty(elem, key)) {\n props.push({ name: key, value: elem[key] })\n }\n }\n\n for (var ns in elem._attributes) {\n for (var attribute in elem._attributes[ns]) {\n var prop = elem._attributes[ns][attribute]\n var name = (prop.prefix ? prop.prefix + \":\" : \"\") + attribute\n props.push({ name: name, value: prop.value })\n }\n }\n\n if (elem.className) {\n props.push({ name: \"class\", value: elem.className })\n }\n\n return props.length ? stringify(props) : \"\"\n}\n\nfunction escapeText(s) {\n var str = '';\n\n if (typeof(s) === 'string') { \n str = s; \n } else if (s) {\n str = s.toString();\n }\n\n return str\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n}\n\nfunction escapeAttributeValue(str) {\n return escapeText(str).replace(/\"/g, \""\")\n}\n","var domWalk = require(\"dom-walk\")\nvar dispatchEvent = require(\"./event/dispatch-event.js\")\nvar addEventListener = require(\"./event/add-event-listener.js\")\nvar removeEventListener = require(\"./event/remove-event-listener.js\")\nvar serializeNode = require(\"./serialize.js\")\n\nvar htmlns = \"http://www.w3.org/1999/xhtml\"\n\nmodule.exports = DOMElement\n\nfunction DOMElement(tagName, owner, namespace) {\n if (!(this instanceof DOMElement)) {\n return new DOMElement(tagName)\n }\n\n var ns = namespace === undefined ? htmlns : (namespace || null)\n\n this.tagName = ns === htmlns ? String(tagName).toUpperCase() : tagName\n this.nodeName = this.tagName\n this.className = \"\"\n this.dataset = {}\n this.childNodes = []\n this.parentNode = null\n this.style = {}\n this.ownerDocument = owner || null\n this.namespaceURI = ns\n this._attributes = {}\n\n if (this.tagName === 'INPUT') {\n this.type = 'text'\n }\n}\n\nDOMElement.prototype.type = \"DOMElement\"\nDOMElement.prototype.nodeType = 1\n\nDOMElement.prototype.appendChild = function _Element_appendChild(child) {\n if (child.parentNode) {\n child.parentNode.removeChild(child)\n }\n\n this.childNodes.push(child)\n child.parentNode = this\n\n return child\n}\n\nDOMElement.prototype.replaceChild =\n function _Element_replaceChild(elem, needle) {\n // TODO: Throw NotFoundError if needle.parentNode !== this\n\n if (elem.parentNode) {\n elem.parentNode.removeChild(elem)\n }\n\n var index = this.childNodes.indexOf(needle)\n\n needle.parentNode = null\n this.childNodes[index] = elem\n elem.parentNode = this\n\n return needle\n }\n\nDOMElement.prototype.removeChild = function _Element_removeChild(elem) {\n // TODO: Throw NotFoundError if elem.parentNode !== this\n\n var index = this.childNodes.indexOf(elem)\n this.childNodes.splice(index, 1)\n\n elem.parentNode = null\n return elem\n}\n\nDOMElement.prototype.insertBefore =\n function _Element_insertBefore(elem, needle) {\n // TODO: Throw NotFoundError if referenceElement is a dom node\n // and parentNode !== this\n\n if (elem.parentNode) {\n elem.parentNode.removeChild(elem)\n }\n\n var index = needle === null || needle === undefined ?\n -1 :\n this.childNodes.indexOf(needle)\n\n if (index > -1) {\n this.childNodes.splice(index, 0, elem)\n } else {\n this.childNodes.push(elem)\n }\n\n elem.parentNode = this\n return elem\n }\n\nDOMElement.prototype.setAttributeNS =\n function _Element_setAttributeNS(namespace, name, value) {\n var prefix = null\n var localName = name\n var colonPosition = name.indexOf(\":\")\n if (colonPosition > -1) {\n prefix = name.substr(0, colonPosition)\n localName = name.substr(colonPosition + 1)\n }\n if (this.tagName === 'INPUT' && name === 'type') {\n this.type = value;\n }\n else {\n var attributes = this._attributes[namespace] || (this._attributes[namespace] = {})\n attributes[localName] = {value: value, prefix: prefix}\n }\n }\n\nDOMElement.prototype.getAttributeNS =\n function _Element_getAttributeNS(namespace, name) {\n var attributes = this._attributes[namespace];\n var value = attributes && attributes[name] && attributes[name].value\n if (this.tagName === 'INPUT' && name === 'type') {\n return this.type;\n }\n if (typeof value !== \"string\") {\n return null\n }\n return value\n }\n\nDOMElement.prototype.removeAttributeNS =\n function _Element_removeAttributeNS(namespace, name) {\n var attributes = this._attributes[namespace];\n if (attributes) {\n delete attributes[name]\n }\n }\n\nDOMElement.prototype.hasAttributeNS =\n function _Element_hasAttributeNS(namespace, name) {\n var attributes = this._attributes[namespace]\n return !!attributes && name in attributes;\n }\n\nDOMElement.prototype.setAttribute = function _Element_setAttribute(name, value) {\n return this.setAttributeNS(null, name, value)\n}\n\nDOMElement.prototype.getAttribute = function _Element_getAttribute(name) {\n return this.getAttributeNS(null, name)\n}\n\nDOMElement.prototype.removeAttribute = function _Element_removeAttribute(name) {\n return this.removeAttributeNS(null, name)\n}\n\nDOMElement.prototype.hasAttribute = function _Element_hasAttribute(name) {\n return this.hasAttributeNS(null, name)\n}\n\nDOMElement.prototype.removeEventListener = removeEventListener\nDOMElement.prototype.addEventListener = addEventListener\nDOMElement.prototype.dispatchEvent = dispatchEvent\n\n// Un-implemented\nDOMElement.prototype.focus = function _Element_focus() {\n return void 0\n}\n\nDOMElement.prototype.toString = function _Element_toString() {\n return serializeNode(this)\n}\n\nDOMElement.prototype.getElementsByClassName = function _Element_getElementsByClassName(classNames) {\n var classes = classNames.split(\" \");\n var elems = []\n\n domWalk(this, function (node) {\n if (node.nodeType === 1) {\n var nodeClassName = node.className || \"\"\n var nodeClasses = nodeClassName.split(\" \")\n\n if (classes.every(function (item) {\n return nodeClasses.indexOf(item) !== -1\n })) {\n elems.push(node)\n }\n }\n })\n\n return elems\n}\n\nDOMElement.prototype.getElementsByTagName = function _Element_getElementsByTagName(tagName) {\n tagName = tagName.toLowerCase()\n var elems = []\n\n domWalk(this.childNodes, function (node) {\n if (node.nodeType === 1 && (tagName === '*' || node.tagName.toLowerCase() === tagName)) {\n elems.push(node)\n }\n })\n\n return elems\n}\n\nDOMElement.prototype.contains = function _Element_contains(element) {\n return domWalk(this, function (node) {\n return element === node\n }) || false\n}\n","var DOMElement = require(\"./dom-element.js\")\n\nmodule.exports = DocumentFragment\n\nfunction DocumentFragment(owner) {\n if (!(this instanceof DocumentFragment)) {\n return new DocumentFragment()\n }\n\n this.childNodes = []\n this.parentNode = null\n this.ownerDocument = owner || null\n}\n\nDocumentFragment.prototype.type = \"DocumentFragment\"\nDocumentFragment.prototype.nodeType = 11\nDocumentFragment.prototype.nodeName = \"#document-fragment\"\n\nDocumentFragment.prototype.appendChild = DOMElement.prototype.appendChild\nDocumentFragment.prototype.replaceChild = DOMElement.prototype.replaceChild\nDocumentFragment.prototype.removeChild = DOMElement.prototype.removeChild\n\nDocumentFragment.prototype.toString =\n function _DocumentFragment_toString() {\n return this.childNodes.map(function (node) {\n return String(node)\n }).join(\"\")\n }\n","module.exports = Event\n\nfunction Event(family) {}\n\nEvent.prototype.initEvent = function _Event_initEvent(type, bubbles, cancelable) {\n this.type = type\n this.bubbles = bubbles\n this.cancelable = cancelable\n}\n\nEvent.prototype.preventDefault = function _Event_preventDefault() {\n \n}\n","var domWalk = require(\"dom-walk\")\n\nvar Comment = require(\"./dom-comment.js\")\nvar DOMText = require(\"./dom-text.js\")\nvar DOMElement = require(\"./dom-element.js\")\nvar DocumentFragment = require(\"./dom-fragment.js\")\nvar Event = require(\"./event.js\")\nvar dispatchEvent = require(\"./event/dispatch-event.js\")\nvar addEventListener = require(\"./event/add-event-listener.js\")\nvar removeEventListener = require(\"./event/remove-event-listener.js\")\n\nmodule.exports = Document;\n\nfunction Document() {\n if (!(this instanceof Document)) {\n return new Document();\n }\n\n this.head = this.createElement(\"head\")\n this.body = this.createElement(\"body\")\n this.documentElement = this.createElement(\"html\")\n this.documentElement.appendChild(this.head)\n this.documentElement.appendChild(this.body)\n this.childNodes = [this.documentElement]\n this.nodeType = 9\n}\n\nvar proto = Document.prototype;\nproto.createTextNode = function createTextNode(value) {\n return new DOMText(value, this)\n}\n\nproto.createElementNS = function createElementNS(namespace, tagName) {\n var ns = namespace === null ? null : String(namespace)\n return new DOMElement(tagName, this, ns)\n}\n\nproto.createElement = function createElement(tagName) {\n return new DOMElement(tagName, this)\n}\n\nproto.createDocumentFragment = function createDocumentFragment() {\n return new DocumentFragment(this)\n}\n\nproto.createEvent = function createEvent(family) {\n return new Event(family)\n}\n\nproto.createComment = function createComment(data) {\n return new Comment(data, this)\n}\n\nproto.getElementById = function getElementById(id) {\n id = String(id)\n\n var result = domWalk(this.childNodes, function (node) {\n if (String(node.id) === id) {\n return node\n }\n })\n\n return result || null\n}\n\nproto.getElementsByClassName = DOMElement.prototype.getElementsByClassName\nproto.getElementsByTagName = DOMElement.prototype.getElementsByTagName\nproto.contains = DOMElement.prototype.contains\n\nproto.removeEventListener = removeEventListener\nproto.addEventListener = addEventListener\nproto.dispatchEvent = dispatchEvent\n","var Document = require('./document.js');\n\nmodule.exports = new Document();\n","var topLevel = typeof global !== 'undefined' ? global :\n typeof window !== 'undefined' ? window : {}\nvar minDoc = require('min-document');\n\nvar doccy;\n\nif (typeof document !== 'undefined') {\n doccy = document;\n} else {\n doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];\n\n if (!doccy) {\n doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;\n }\n}\n\nmodule.exports = doccy;\n","var isObject = require(\"is-object\")\nvar isHook = require(\"../vnode/is-vhook.js\")\n\nmodule.exports = applyProperties\n\nfunction applyProperties(node, props, previous) {\n for (var propName in props) {\n var propValue = props[propName]\n\n if (propValue === undefined) {\n removeProperty(node, propName, propValue, previous);\n } else if (isHook(propValue)) {\n removeProperty(node, propName, propValue, previous)\n if (propValue.hook) {\n propValue.hook(node,\n propName,\n previous ? previous[propName] : undefined)\n }\n } else {\n if (isObject(propValue)) {\n patchObject(node, props, previous, propName, propValue);\n } else {\n node[propName] = propValue\n }\n }\n }\n}\n\nfunction removeProperty(node, propName, propValue, previous) {\n if (previous) {\n var previousValue = previous[propName]\n\n if (!isHook(previousValue)) {\n if (propName === \"attributes\") {\n for (var attrName in previousValue) {\n node.removeAttribute(attrName)\n }\n } else if (propName === \"style\") {\n for (var i in previousValue) {\n node.style[i] = \"\"\n }\n } else if (typeof previousValue === \"string\") {\n node[propName] = \"\"\n } else {\n node[propName] = null\n }\n } else if (previousValue.unhook) {\n previousValue.unhook(node, propName, propValue)\n }\n }\n}\n\nfunction patchObject(node, props, previous, propName, propValue) {\n var previousValue = previous ? previous[propName] : undefined\n\n // Set attributes\n if (propName === \"attributes\") {\n for (var attrName in propValue) {\n var attrValue = propValue[attrName]\n\n if (attrValue === undefined) {\n node.removeAttribute(attrName)\n } else {\n node.setAttribute(attrName, attrValue)\n }\n }\n\n return\n }\n\n if(previousValue && isObject(previousValue) &&\n getPrototype(previousValue) !== getPrototype(propValue)) {\n node[propName] = propValue\n return\n }\n\n if (!isObject(node[propName])) {\n node[propName] = {}\n }\n\n var replacer = propName === \"style\" ? \"\" : undefined\n\n for (var k in propValue) {\n var value = propValue[k]\n node[propName][k] = (value === undefined) ? replacer : value\n }\n}\n\nfunction getPrototype(value) {\n if (Object.getPrototypeOf) {\n return Object.getPrototypeOf(value)\n } else if (value.__proto__) {\n return value.__proto__\n } else if (value.constructor) {\n return value.constructor.prototype\n }\n}\n","var document = require(\"global/document\")\n\nvar applyProperties = require(\"./apply-properties\")\n\nvar isVNode = require(\"../vnode/is-vnode.js\")\nvar isVText = require(\"../vnode/is-vtext.js\")\nvar isWidget = require(\"../vnode/is-widget.js\")\nvar handleThunk = require(\"../vnode/handle-thunk.js\")\n\nmodule.exports = createElement\n\nfunction createElement(vnode, opts) {\n var doc = opts ? opts.document || document : document\n var warn = opts ? opts.warn : null\n\n vnode = handleThunk(vnode).a\n\n if (isWidget(vnode)) {\n return vnode.init()\n } else if (isVText(vnode)) {\n return doc.createTextNode(vnode.text)\n } else if (!isVNode(vnode)) {\n if (warn) {\n warn(\"Item is not a valid virtual dom node\", vnode)\n }\n return null\n }\n\n var node = (vnode.namespace === null) ?\n doc.createElement(vnode.tagName) :\n doc.createElementNS(vnode.namespace, vnode.tagName)\n\n var props = vnode.properties\n applyProperties(node, props)\n\n var children = vnode.children\n\n for (var i = 0; i < children.length; i++) {\n var childNode = createElement(children[i], opts)\n if (childNode) {\n node.appendChild(childNode)\n }\n }\n\n return node\n}\n","// Maps a virtual DOM tree onto a real DOM tree in an efficient manner.\n// We don't want to read all of the DOM nodes in the tree so we use\n// the in-order tree indexing to eliminate recursion down certain branches.\n// We only recurse into a DOM node if we know that it contains a child of\n// interest.\n\nvar noChild = {}\n\nmodule.exports = domIndex\n\nfunction domIndex(rootNode, tree, indices, nodes) {\n if (!indices || indices.length === 0) {\n return {}\n } else {\n indices.sort(ascending)\n return recurse(rootNode, tree, indices, nodes, 0)\n }\n}\n\nfunction recurse(rootNode, tree, indices, nodes, rootIndex) {\n nodes = nodes || {}\n\n\n if (rootNode) {\n if (indexInRange(indices, rootIndex, rootIndex)) {\n nodes[rootIndex] = rootNode\n }\n\n var vChildren = tree.children\n\n if (vChildren) {\n\n var childNodes = rootNode.childNodes\n\n for (var i = 0; i < tree.children.length; i++) {\n rootIndex += 1\n\n var vChild = vChildren[i] || noChild\n var nextIndex = rootIndex + (vChild.count || 0)\n\n // skip recursion down the tree if there are no nodes down here\n if (indexInRange(indices, rootIndex, nextIndex)) {\n recurse(childNodes[i], vChild, indices, nodes, rootIndex)\n }\n\n rootIndex = nextIndex\n }\n }\n }\n\n return nodes\n}\n\n// Binary search for an index in the interval [left, right]\nfunction indexInRange(indices, left, right) {\n if (indices.length === 0) {\n return false\n }\n\n var minIndex = 0\n var maxIndex = indices.length - 1\n var currentIndex\n var currentItem\n\n while (minIndex <= maxIndex) {\n currentIndex = ((maxIndex + minIndex) / 2) >> 0\n currentItem = indices[currentIndex]\n\n if (minIndex === maxIndex) {\n return currentItem >= left && currentItem <= right\n } else if (currentItem < left) {\n minIndex = currentIndex + 1\n } else if (currentItem > right) {\n maxIndex = currentIndex - 1\n } else {\n return true\n }\n }\n\n return false;\n}\n\nfunction ascending(a, b) {\n return a > b ? 1 : -1\n}\n","var isWidget = require(\"../vnode/is-widget.js\")\n\nmodule.exports = updateWidget\n\nfunction updateWidget(a, b) {\n if (isWidget(a) && isWidget(b)) {\n if (\"name\" in a && \"name\" in b) {\n return a.id === b.id\n } else {\n return a.init === b.init\n }\n }\n\n return false\n}\n","var applyProperties = require(\"./apply-properties\")\n\nvar isWidget = require(\"../vnode/is-widget.js\")\nvar VPatch = require(\"../vnode/vpatch.js\")\n\nvar updateWidget = require(\"./update-widget\")\n\nmodule.exports = applyPatch\n\nfunction applyPatch(vpatch, domNode, renderOptions) {\n var type = vpatch.type\n var vNode = vpatch.vNode\n var patch = vpatch.patch\n\n switch (type) {\n case VPatch.REMOVE:\n return removeNode(domNode, vNode)\n case VPatch.INSERT:\n return insertNode(domNode, patch, renderOptions)\n case VPatch.VTEXT:\n return stringPatch(domNode, vNode, patch, renderOptions)\n case VPatch.WIDGET:\n return widgetPatch(domNode, vNode, patch, renderOptions)\n case VPatch.VNODE:\n return vNodePatch(domNode, vNode, patch, renderOptions)\n case VPatch.ORDER:\n reorderChildren(domNode, patch)\n return domNode\n case VPatch.PROPS:\n applyProperties(domNode, patch, vNode.properties)\n return domNode\n case VPatch.THUNK:\n return replaceRoot(domNode,\n renderOptions.patch(domNode, patch, renderOptions))\n default:\n return domNode\n }\n}\n\nfunction removeNode(domNode, vNode) {\n var parentNode = domNode.parentNode\n\n if (parentNode) {\n parentNode.removeChild(domNode)\n }\n\n destroyWidget(domNode, vNode);\n\n return null\n}\n\nfunction insertNode(parentNode, vNode, renderOptions) {\n var newNode = renderOptions.render(vNode, renderOptions)\n\n if (parentNode) {\n parentNode.appendChild(newNode)\n }\n\n return parentNode\n}\n\nfunction stringPatch(domNode, leftVNode, vText, renderOptions) {\n var newNode\n\n if (domNode.nodeType === 3) {\n domNode.replaceData(0, domNode.length, vText.text)\n newNode = domNode\n } else {\n var parentNode = domNode.parentNode\n newNode = renderOptions.render(vText, renderOptions)\n\n if (parentNode && newNode !== domNode) {\n parentNode.replaceChild(newNode, domNode)\n }\n }\n\n return newNode\n}\n\nfunction widgetPatch(domNode, leftVNode, widget, renderOptions) {\n var updating = updateWidget(leftVNode, widget)\n var newNode\n\n if (updating) {\n newNode = widget.update(leftVNode, domNode) || domNode\n } else {\n newNode = renderOptions.render(widget, renderOptions)\n }\n\n var parentNode = domNode.parentNode\n\n if (parentNode && newNode !== domNode) {\n parentNode.replaceChild(newNode, domNode)\n }\n\n if (!updating) {\n destroyWidget(domNode, leftVNode)\n }\n\n return newNode\n}\n\nfunction vNodePatch(domNode, leftVNode, vNode, renderOptions) {\n var parentNode = domNode.parentNode\n var newNode = renderOptions.render(vNode, renderOptions)\n\n if (parentNode && newNode !== domNode) {\n parentNode.replaceChild(newNode, domNode)\n }\n\n return newNode\n}\n\nfunction destroyWidget(domNode, w) {\n if (typeof w.destroy === \"function\" && isWidget(w)) {\n w.destroy(domNode)\n }\n}\n\nfunction reorderChildren(domNode, moves) {\n var childNodes = domNode.childNodes\n var keyMap = {}\n var node\n var remove\n var insert\n\n for (var i = 0; i < moves.removes.length; i++) {\n remove = moves.removes[i]\n node = childNodes[remove.from]\n if (remove.key) {\n keyMap[remove.key] = node\n }\n domNode.removeChild(node)\n }\n\n var length = childNodes.length\n for (var j = 0; j < moves.inserts.length; j++) {\n insert = moves.inserts[j]\n node = keyMap[insert.key]\n // this is the weirdest bug i've ever seen in webkit\n domNode.insertBefore(node, insert.to >= length++ ? null : childNodes[insert.to])\n }\n}\n\nfunction replaceRoot(oldRoot, newRoot) {\n if (oldRoot && newRoot && oldRoot !== newRoot && oldRoot.parentNode) {\n oldRoot.parentNode.replaceChild(newRoot, oldRoot)\n }\n\n return newRoot;\n}\n","var document = require(\"global/document\")\nvar isArray = require(\"x-is-array\")\n\nvar render = require(\"./create-element\")\nvar domIndex = require(\"./dom-index\")\nvar patchOp = require(\"./patch-op\")\nmodule.exports = patch\n\nfunction patch(rootNode, patches, renderOptions) {\n renderOptions = renderOptions || {}\n renderOptions.patch = renderOptions.patch && renderOptions.patch !== patch\n ? renderOptions.patch\n : patchRecursive\n renderOptions.render = renderOptions.render || render\n\n return renderOptions.patch(rootNode, patches, renderOptions)\n}\n\nfunction patchRecursive(rootNode, patches, renderOptions) {\n var indices = patchIndices(patches)\n\n if (indices.length === 0) {\n return rootNode\n }\n\n var index = domIndex(rootNode, patches.a, indices)\n var ownerDocument = rootNode.ownerDocument\n\n if (!renderOptions.document && ownerDocument !== document) {\n renderOptions.document = ownerDocument\n }\n\n for (var i = 0; i < indices.length; i++) {\n var nodeIndex = indices[i]\n rootNode = applyPatch(rootNode,\n index[nodeIndex],\n patches[nodeIndex],\n renderOptions)\n }\n\n return rootNode\n}\n\nfunction applyPatch(rootNode, domNode, patchList, renderOptions) {\n if (!domNode) {\n return rootNode\n }\n\n var newNode\n\n if (isArray(patchList)) {\n for (var i = 0; i < patchList.length; i++) {\n newNode = patchOp(patchList[i], domNode, renderOptions)\n\n if (domNode === rootNode) {\n rootNode = newNode\n }\n }\n } else {\n newNode = patchOp(patchList, domNode, renderOptions)\n\n if (domNode === rootNode) {\n rootNode = newNode\n }\n }\n\n return rootNode\n}\n\nfunction patchIndices(patches) {\n var indices = []\n\n for (var key in patches) {\n if (key !== \"a\") {\n indices.push(Number(key))\n }\n }\n\n return indices\n}\n","var patch = require(\"./vdom/patch.js\")\n\nmodule.exports = patch\n","var version = require(\"./version\")\nvar isVNode = require(\"./is-vnode\")\nvar isWidget = require(\"./is-widget\")\nvar isThunk = require(\"./is-thunk\")\nvar isVHook = require(\"./is-vhook\")\n\nmodule.exports = VirtualNode\n\nvar noProperties = {}\nvar noChildren = []\n\nfunction VirtualNode(tagName, properties, children, key, namespace) {\n this.tagName = tagName\n this.properties = properties || noProperties\n this.children = children || noChildren\n this.key = key != null ? String(key) : undefined\n this.namespace = (typeof namespace === \"string\") ? namespace : null\n\n var count = (children && children.length) || 0\n var descendants = 0\n var hasWidgets = false\n var hasThunks = false\n var descendantHooks = false\n var hooks\n\n for (var propName in properties) {\n if (properties.hasOwnProperty(propName)) {\n var property = properties[propName]\n if (isVHook(property) && property.unhook) {\n if (!hooks) {\n hooks = {}\n }\n\n hooks[propName] = property\n }\n }\n }\n\n for (var i = 0; i < count; i++) {\n var child = children[i]\n if (isVNode(child)) {\n descendants += child.count || 0\n\n if (!hasWidgets && child.hasWidgets) {\n hasWidgets = true\n }\n\n if (!hasThunks && child.hasThunks) {\n hasThunks = true\n }\n\n if (!descendantHooks && (child.hooks || child.descendantHooks)) {\n descendantHooks = true\n }\n } else if (!hasWidgets && isWidget(child)) {\n if (typeof child.destroy === \"function\") {\n hasWidgets = true\n }\n } else if (!hasThunks && isThunk(child)) {\n hasThunks = true;\n }\n }\n\n this.count = count + descendants\n this.hasWidgets = hasWidgets\n this.hasThunks = hasThunks\n this.hooks = hooks\n this.descendantHooks = descendantHooks\n}\n\nVirtualNode.prototype.version = version\nVirtualNode.prototype.type = \"VirtualNode\"\n","var version = require(\"./version\")\n\nmodule.exports = VirtualText\n\nfunction VirtualText(text) {\n this.text = String(text)\n}\n\nVirtualText.prototype.version = version\nVirtualText.prototype.type = \"VirtualText\"\n","/*!\n * Cross-Browser Split 1.1.1\n * Copyright 2007-2012 Steven Levithan <stevenlevithan.com>\n * Available under the MIT License\n * ECMAScript compliant, uniform cross-browser split method\n */\n\n/**\n * Splits a string into an array of strings using a regex or string separator. Matches of the\n * separator are not included in the result array. However, if `separator` is a regex that contains\n * capturing groups, backreferences are spliced into the result each time `separator` is matched.\n * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably\n * cross-browser.\n * @param {String} str String to split.\n * @param {RegExp|String} separator Regex or string to use for separating the string.\n * @param {Number} [limit] Maximum number of items to include in the result array.\n * @returns {Array} Array of substrings.\n * @example\n *\n * // Basic use\n * split('a b c d', ' ');\n * // -> ['a', 'b', 'c', 'd']\n *\n * // With limit\n * split('a b c d', ' ', 2);\n * // -> ['a', 'b']\n *\n * // Backreferences in result array\n * split('..word1 word2..', /([a-z]+)(\\d+)/i);\n * // -> ['..', 'word', '1', ' ', 'word', '2', '..']\n */\nmodule.exports = (function split(undef) {\n\n var nativeSplit = String.prototype.split,\n compliantExecNpcg = /()??/.exec(\"\")[1] === undef,\n // NPCG: nonparticipating capturing group\n self;\n\n self = function(str, separator, limit) {\n // If `separator` is not a regex, use `nativeSplit`\n if (Object.prototype.toString.call(separator) !== \"[object RegExp]\") {\n return nativeSplit.call(str, separator, limit);\n }\n var output = [],\n flags = (separator.ignoreCase ? \"i\" : \"\") + (separator.multiline ? \"m\" : \"\") + (separator.extended ? \"x\" : \"\") + // Proposed for ES6\n (separator.sticky ? \"y\" : \"\"),\n // Firefox 3+\n lastLastIndex = 0,\n // Make `global` and avoid `lastIndex` issues by working with a copy\n separator = new RegExp(separator.source, flags + \"g\"),\n separator2, match, lastIndex, lastLength;\n str += \"\"; // Type-convert\n if (!compliantExecNpcg) {\n // Doesn't need flags gy, but they don't hurt\n separator2 = new RegExp(\"^\" + separator.source + \"$(?!\\\\s)\", flags);\n }\n /* Values for `limit`, per the spec:\n * If undefined: 4294967295 // Math.pow(2, 32) - 1\n * If 0, Infinity, or NaN: 0\n * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;\n * If negative number: 4294967296 - Math.floor(Math.abs(limit))\n * If other: Type-convert, then use the above rules\n */\n limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1\n limit >>> 0; // ToUint32(limit)\n while (match = separator.exec(str)) {\n // `separator.lastIndex` is not reliable cross-browser\n lastIndex = match.index + match[0].length;\n if (lastIndex > lastLastIndex) {\n output.push(str.slice(lastLastIndex, match.index));\n // Fix browsers whose `exec` methods don't consistently return `undefined` for\n // nonparticipating capturing groups\n if (!compliantExecNpcg && match.length > 1) {\n match[0].replace(separator2, function() {\n for (var i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undef) {\n match[i] = undef;\n }\n }\n });\n }\n if (match.length > 1 && match.index < str.length) {\n Array.prototype.push.apply(output, match.slice(1));\n }\n lastLength = match[0].length;\n lastLastIndex = lastIndex;\n if (output.length >= limit) {\n break;\n }\n }\n if (separator.lastIndex === match.index) {\n separator.lastIndex++; // Avoid an infinite loop\n }\n }\n if (lastLastIndex === str.length) {\n if (lastLength || !separator.test(\"\")) {\n output.push(\"\");\n }\n } else {\n output.push(str.slice(lastLastIndex));\n }\n return output.length > limit ? output.slice(0, limit) : output;\n };\n\n return self;\n})();\n","'use strict';\n\nvar split = require('browser-split');\n\nvar classIdSplit = /([\\.#]?[a-zA-Z0-9\\u007F-\\uFFFF_:-]+)/;\nvar notClassId = /^\\.|#/;\n\nmodule.exports = parseTag;\n\nfunction parseTag(tag, props) {\n if (!tag) {\n return 'DIV';\n }\n\n var noId = !(props.hasOwnProperty('id'));\n\n var tagParts = split(tag, classIdSplit);\n var tagName = null;\n\n if (notClassId.test(tagParts[1])) {\n tagName = 'DIV';\n }\n\n var classes, part, type, i;\n\n for (i = 0; i < tagParts.length; i++) {\n part = tagParts[i];\n\n if (!part) {\n continue;\n }\n\n type = part.charAt(0);\n\n if (!tagName) {\n tagName = part;\n } else if (type === '.') {\n classes = classes || [];\n classes.push(part.substring(1, part.length));\n } else if (type === '#' && noId) {\n props.id = part.substring(1, part.length);\n }\n }\n\n if (classes) {\n if (props.className) {\n classes.push(props.className);\n }\n\n props.className = classes.join(' ');\n }\n\n return props.namespace ? tagName : tagName.toUpperCase();\n}\n","'use strict';\n\nmodule.exports = SoftSetHook;\n\nfunction SoftSetHook(value) {\n if (!(this instanceof SoftSetHook)) {\n return new SoftSetHook(value);\n }\n\n this.value = value;\n}\n\nSoftSetHook.prototype.hook = function (node, propertyName) {\n if (node[propertyName] !== this.value) {\n node[propertyName] = this.value;\n }\n};\n","'use strict';\n\n/*global window, global*/\n\nvar root = typeof window !== 'undefined' ?\n window : typeof global !== 'undefined' ?\n global : {};\n\nmodule.exports = Individual;\n\nfunction Individual(key, value) {\n if (key in root) {\n return root[key];\n }\n\n root[key] = value;\n\n return value;\n}\n","'use strict';\n\nvar Individual = require('./index.js');\n\nmodule.exports = OneVersion;\n\nfunction OneVersion(moduleName, version, defaultValue) {\n var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName;\n var enforceKey = key + '_ENFORCE_SINGLETON';\n\n var versionValue = Individual(enforceKey, version);\n\n if (versionValue !== version) {\n throw new Error('Can only have one copy of ' +\n moduleName + '.\\n' +\n 'You already have version ' + versionValue +\n ' installed.\\n' +\n 'This means you cannot install version ' + version);\n }\n\n return Individual(key, defaultValue);\n}\n","'use strict';\n\nvar OneVersionConstraint = require('individual/one-version');\n\nvar MY_VERSION = '7';\nOneVersionConstraint('ev-store', MY_VERSION);\n\nvar hashKey = '__EV_STORE_KEY@' + MY_VERSION;\n\nmodule.exports = EvStore;\n\nfunction EvStore(elem) {\n var hash = elem[hashKey];\n\n if (!hash) {\n hash = elem[hashKey] = {};\n }\n\n return hash;\n}\n","'use strict';\n\nvar EvStore = require('ev-store');\n\nmodule.exports = EvHook;\n\nfunction EvHook(value) {\n if (!(this instanceof EvHook)) {\n return new EvHook(value);\n }\n\n this.value = value;\n}\n\nEvHook.prototype.hook = function (node, propertyName) {\n var es = EvStore(node);\n var propName = propertyName.substr(3);\n\n es[propName] = this.value;\n};\n\nEvHook.prototype.unhook = function(node, propertyName) {\n var es = EvStore(node);\n var propName = propertyName.substr(3);\n\n es[propName] = undefined;\n};\n","'use strict';\n\nvar isArray = require('x-is-array');\n\nvar VNode = require('../vnode/vnode.js');\nvar VText = require('../vnode/vtext.js');\nvar isVNode = require('../vnode/is-vnode');\nvar isVText = require('../vnode/is-vtext');\nvar isWidget = require('../vnode/is-widget');\nvar isHook = require('../vnode/is-vhook');\nvar isVThunk = require('../vnode/is-thunk');\n\nvar parseTag = require('./parse-tag.js');\nvar softSetHook = require('./hooks/soft-set-hook.js');\nvar evHook = require('./hooks/ev-hook.js');\n\nmodule.exports = h;\n\nfunction h(tagName, properties, children) {\n var childNodes = [];\n var tag, props, key, namespace;\n\n if (!children && isChildren(properties)) {\n children = properties;\n props = {};\n }\n\n props = props || properties || {};\n tag = parseTag(tagName, props);\n\n // support keys\n if (props.hasOwnProperty('key')) {\n key = props.key;\n props.key = undefined;\n }\n\n // support namespace\n if (props.hasOwnProperty('namespace')) {\n namespace = props.namespace;\n props.namespace = undefined;\n }\n\n // fix cursor bug\n if (tag === 'INPUT' &&\n !namespace &&\n props.hasOwnProperty('value') &&\n props.value !== undefined &&\n !isHook(props.value)\n ) {\n props.value = softSetHook(props.value);\n }\n\n transformProperties(props);\n\n if (children !== undefined && children !== null) {\n addChild(children, childNodes, tag, props);\n }\n\n\n return new VNode(tag, props, childNodes, key, namespace);\n}\n\nfunction addChild(c, childNodes, tag, props) {\n if (typeof c === 'string') {\n childNodes.push(new VText(c));\n } else if (typeof c === 'number') {\n childNodes.push(new VText(String(c)));\n } else if (isChild(c)) {\n childNodes.push(c);\n } else if (isArray(c)) {\n for (var i = 0; i < c.length; i++) {\n addChild(c[i], childNodes, tag, props);\n }\n } else if (c === null || c === undefined) {\n return;\n } else {\n throw UnexpectedVirtualElement({\n foreignObject: c,\n parentVnode: {\n tagName: tag,\n properties: props\n }\n });\n }\n}\n\nfunction transformProperties(props) {\n for (var propName in props) {\n if (props.hasOwnProperty(propName)) {\n var value = props[propName];\n\n if (isHook(value)) {\n continue;\n }\n\n if (propName.substr(0, 3) === 'ev-') {\n // add ev-foo support\n props[propName] = evHook(value);\n }\n }\n }\n}\n\nfunction isChild(x) {\n return isVNode(x) || isVText(x) || isWidget(x) || isVThunk(x);\n}\n\nfunction isChildren(x) {\n return typeof x === 'string' || isArray(x) || isChild(x);\n}\n\nfunction UnexpectedVirtualElement(data) {\n var err = new Error();\n\n err.type = 'virtual-hyperscript.unexpected.virtual-element';\n err.message = 'Unexpected virtual child passed to h().\\n' +\n 'Expected a VNode / Vthunk / VWidget / string but:\\n' +\n 'got:\\n' +\n errorString(data.foreignObject) +\n '.\\n' +\n 'The parent vnode is:\\n' +\n errorString(data.parentVnode)\n '\\n' +\n 'Suggested fix: change your `h(..., [ ... ])` callsite.';\n err.foreignObject = data.foreignObject;\n err.parentVnode = data.parentVnode;\n\n return err;\n}\n\nfunction errorString(obj) {\n try {\n return JSON.stringify(obj, null, ' ');\n } catch (e) {\n return String(obj);\n }\n}\n","var h = require(\"./virtual-hyperscript/index.js\")\n\nmodule.exports = h\n","export enum CoverState {\n Hidden,\n Loading,\n Visible,\n}\n","/**\n * Enumeration for component size.\n * @enum {number}\n * @readonly\n * @description May be used by a component to allow for resizing\n * of the UI elements rendered by the component.\n */\nexport enum ComponentSize {\n /**\n * Automatic size. The size of the elements will automatically\n * change at a predefined threshold.\n */\n Automatic,\n\n /**\n * Large size. The size of the elements will be fixed until another\n * component size is configured.\n */\n Large,\n\n /**\n * Small size. The size of the elements will be fixed until another\n * component size is configured.\n */\n Small,\n}\n","var diff = require(\"./diff.js\")\r\nvar patch = require(\"./patch.js\")\r\nvar h = require(\"./h.js\")\r\nvar create = require(\"./create-element.js\")\r\nvar VNode = require('./vnode/vnode.js')\r\nvar VText = require('./vnode/vtext.js')\r\n\r\nmodule.exports = {\r\n diff: diff,\r\n patch: patch,\r\n h: h,\r\n create: create,\r\n VNode: VNode,\r\n VText: VText\r\n}\r\n","var createElement = require(\"./vdom/create-element.js\")\n\nmodule.exports = createElement\n","import { IEventEmitter } from \"./interfaces/IEventEmitter\";\n\nexport class EventEmitter implements IEventEmitter {\n private _events: { [type: string]: ((event: any) => void)[]; };\n\n constructor() { this._events = {}; }\n\n /**\n * @ignore\n */\n public fire<T>(\n type: string,\n event: T): void {\n if (!this._listens(type)) { return; }\n for (const handler of this._events[type]) {\n handler(event);\n }\n }\n\n /**\n * Unsubscribe from an event by its name.\n * @param {string} type - The name of the event\n * to unsubscribe from.\n * @param {(event: T) => void} handler - The\n * handler to remove.\n */\n public off<T>(\n type: string,\n handler: (event: T) => void): void {\n if (!type) { this._events = {}; return; }\n\n if (this._listens(type)) {\n const index = this._events[type].indexOf(handler);\n if (index >= 0) {\n this._events[type].splice(index, 1);\n }\n if (!this._events[type].length) {\n delete this._events[type];\n }\n }\n }\n\n /**\n * Subscribe to an event by its name.\n * @param {string} type - The name of the event\n * to subscribe to.\n * @param {(event: T) => void} handler - The\n * handler called when the event occurs.\n */\n public on<T>(\n type: string,\n handler: (event: T) => void): void {\n this._events[type] = this._events[type] || [];\n this._events[type].push(handler);\n }\n\n private _listens(eventType: string): boolean {\n return eventType in this._events;\n }\n}\n","import { Subscription } from \"rxjs\";\n\nexport class SubscriptionHolder {\n private _subscriptions: Subscription[] = [];\n\n public push(subscription: Subscription): void {\n this._subscriptions.push(subscription);\n }\n\n public unsubscribe(): void {\n for (const sub of this._subscriptions) {\n sub.unsubscribe();\n }\n\n this._subscriptions = [];\n }\n}\n","import {\n publishReplay,\n refCount,\n scan,\n startWith,\n} from \"rxjs/operators\";\n\nimport {\n BehaviorSubject,\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport { ComponentConfiguration } from \"./interfaces/ComponentConfiguration\";\n\nimport { Container } from \"../viewer/Container\";\nimport { Navigator } from \"../viewer/Navigator\";\nimport { EventEmitter } from \"../util/EventEmitter\";\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\nimport { IComponent } from \"./interfaces/IComponent\";\nimport { ComponentEventType } from \"./events/ComponentEventType\";\nimport { ComponentName } from \"./ComponentName\";\nimport { FallbackComponentName } from \"./fallback/FallbackComponentName\";\n\nexport abstract class Component\n <TConfiguration extends ComponentConfiguration>\n extends EventEmitter\n implements IComponent {\n\n public static componentName: ComponentName | FallbackComponentName;\n\n protected _activated: boolean;\n protected _container: Container;\n protected _name: string;\n protected _navigator: Navigator;\n protected readonly _subscriptions: SubscriptionHolder;\n\n protected _activated$: BehaviorSubject<boolean> =\n new BehaviorSubject<boolean>(false);\n protected _configuration$: Observable<TConfiguration>;\n protected _configurationSubject$: Subject<TConfiguration> =\n new Subject<TConfiguration>();\n\n constructor(name: string, container: Container, navigator: Navigator) {\n super();\n\n this._activated = false;\n this._container = container;\n this._name = name;\n this._navigator = navigator;\n this._subscriptions = new SubscriptionHolder();\n\n this._configuration$ =\n this._configurationSubject$.pipe(\n startWith(this.defaultConfiguration),\n scan(\n (conf: TConfiguration, newConf: TConfiguration): TConfiguration => {\n for (let key in newConf) {\n if (newConf.hasOwnProperty(key)) {\n conf[key] = <any>newConf[key];\n }\n }\n\n return conf;\n }),\n publishReplay(1),\n refCount());\n\n this._configuration$.subscribe(() => { /*noop*/ });\n }\n\n /**\n * Get activated.\n *\n * @returns {boolean} Value indicating if the component is\n * currently active.\n */\n public get activated(): boolean {\n return this._activated;\n }\n\n /** @ignore */\n public get activated$(): Observable<boolean> {\n return this._activated$;\n }\n\n /**\n * Get default configuration.\n *\n * @returns {TConfiguration} Default configuration for component.\n */\n public get defaultConfiguration(): TConfiguration {\n return this._getDefaultConfiguration();\n }\n\n /** @ignore */\n public get configuration$(): Observable<TConfiguration> {\n return this._configuration$;\n }\n\n /**\n * Get name.\n *\n * @description The name of the component. Used when interacting with the\n * component through the Viewer's API.\n */\n public get name(): string {\n return this._name;\n }\n\n /** @ignore */\n public activate(conf?: TConfiguration): void {\n if (this._activated) {\n return;\n }\n\n if (conf !== undefined) {\n this._configurationSubject$.next(conf);\n }\n\n this._activated = true;\n this._activate();\n this._activated$.next(true);\n }\n\n /**\n * Configure the component.\n *\n * @param configuration Component configuration.\n */\n public configure(configuration: TConfiguration): void {\n this._configurationSubject$.next(configuration);\n }\n\n /** @ignore */\n public deactivate(): void {\n if (!this._activated) {\n return;\n }\n\n this._activated = false;\n this._deactivate();\n this._container.domRenderer.clear(this._name);\n this._container.glRenderer.clear(this._name);\n this._activated$.next(false);\n }\n\n /** @inheritdoc */\n public fire<T>(\n type: ComponentEventType,\n event: T): void {\n super.fire(type, event);\n }\n\n /** @inheritdoc */\n public off<T>(\n type: ComponentEventType,\n handler: (event: T) => void): void {\n super.off(type, handler);\n }\n\n /** @inheritdoc */\n public on<T>(\n type: ComponentEventType,\n handler: (event: T) => void): void {\n super.on(type, handler);\n }\n\n /**\n * Detect the viewer's new width and height and resize the component's\n * rendered elements accordingly if applicable.\n *\n * @ignore\n */\n public resize(): void { return; }\n\n protected abstract _activate(): void;\n\n protected abstract _deactivate(): void;\n\n protected abstract _getDefaultConfiguration(): TConfiguration;\n}\n","import * as vd from \"virtual-dom\";\n\nimport {\n combineLatest as observableCombineLatest,\n empty as observableEmpty,\n of as observableOf,\n Observable,\n Subscriber,\n} from \"rxjs\";\n\nimport {\n catchError,\n distinctUntilChanged,\n filter,\n first,\n map,\n publishReplay,\n refCount,\n switchMap,\n} from \"rxjs/operators\";\n\nimport { Component } from \"../Component\";\nimport { CoverConfiguration } from \"../interfaces/CoverConfiguration\";\n\nimport { MapillaryError } from \"../../error/MapillaryError\";\nimport { Image as MImage } from \"../../graph/Image\";\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { VirtualNodeHash } from \"../../render/interfaces/VirtualNodeHash\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { ImagesContract } from \"../../api/contracts/ImagesContract\";\nimport { CoverState } from \"./CoverState\";\nimport { ComponentName } from \"../ComponentName\";\n\nexport class CoverComponent extends Component<CoverConfiguration> {\n public static componentName: ComponentName = \"cover\";\n\n constructor(name: string, container: Container, navigator: Navigator) {\n super(name, container, navigator);\n }\n\n protected _activate(): void {\n const originalSrc$ = this.configuration$.pipe(\n first(\n (c: CoverConfiguration): boolean => {\n return !!c.id;\n }),\n filter(\n (c: CoverConfiguration): boolean => {\n return !c.src;\n }),\n switchMap(\n (c: CoverConfiguration): Observable<string> => {\n return this._getImageSrc$(c.id).pipe(\n catchError(\n (error: Error): Observable<string> => {\n console.error(error);\n\n return observableEmpty();\n }));\n }),\n publishReplay(1),\n refCount());\n\n const subs = this._subscriptions;\n\n subs.push(originalSrc$.pipe(\n map(\n (src: string): CoverConfiguration => {\n return { src: src };\n }))\n .subscribe(\n (c: CoverConfiguration): void => {\n this._configurationSubject$.next(c);\n }));\n\n subs.push(observableCombineLatest(\n this.configuration$,\n originalSrc$).pipe(\n filter(\n ([c, src]: [CoverConfiguration, string]): boolean => {\n return !!c.src && c.src !== src;\n }),\n first())\n .subscribe(\n ([, src]: [CoverConfiguration, string]): void => {\n window.URL.revokeObjectURL(src);\n }));\n\n subs.push(this._configuration$.pipe(\n distinctUntilChanged(\n undefined,\n (configuration: CoverConfiguration): CoverState => {\n return configuration.state;\n }),\n switchMap(\n (configuration: CoverConfiguration): Observable<[CoverState, MImage]> => {\n return observableCombineLatest(\n observableOf(configuration.state),\n this._navigator.stateService.currentImage$);\n }),\n switchMap(\n ([state, image]: [CoverState, MImage]): Observable<[string, string]> => {\n const keySrc$: Observable<[string, string]> = observableCombineLatest(\n observableOf(image.id),\n image.image$.pipe(\n filter(\n (imageElement: HTMLImageElement): boolean => {\n return !!imageElement;\n }),\n map(\n (imageElement: HTMLImageElement): string => {\n return imageElement.src;\n })));\n\n return state === CoverState.Visible ? keySrc$.pipe(first()) : keySrc$;\n }),\n distinctUntilChanged(\n ([k1, s1]: [string, string], [k2, s2]: [string, string]): boolean => {\n return k1 === k2 && s1 === s2;\n }),\n map(\n ([key, src]: [string, string]): CoverConfiguration => {\n return { id: key, src: src };\n }))\n .subscribe(this._configurationSubject$));\n\n subs.push(observableCombineLatest(\n this._configuration$,\n this._container.configurationService.exploreUrl$,\n this._container.renderService.size$).pipe(\n map(\n ([configuration, exploreUrl, size]:\n [CoverConfiguration, string, ViewportSize]): VirtualNodeHash => {\n if (!configuration.src) {\n return { name: this._name, vNode: vd.h(\"div\", []) };\n }\n\n const compactClass: string = size.width <= 640 || size.height <= 480 ? \".mapillary-cover-compact\" : \"\";\n\n if (configuration.state === CoverState.Hidden) {\n const doneContainer: vd.VNode = vd.h(\n \"div.mapillary-cover-container.mapillary-cover-done\" + compactClass,\n [this._getCoverBackgroundVNode(configuration)]);\n\n return { name: this._name, vNode: doneContainer };\n }\n\n const container: vd.VNode = vd.h(\n \"div.mapillary-cover-container\" + compactClass,\n [this._getCoverButtonVNode(configuration, exploreUrl)]);\n\n return { name: this._name, vNode: container };\n }))\n .subscribe(this._container.domRenderer.render$));\n }\n\n protected _deactivate(): void {\n this._subscriptions.unsubscribe();\n }\n\n protected _getDefaultConfiguration(): CoverConfiguration {\n return { state: CoverState.Visible };\n }\n\n private _getCoverButtonVNode(\n configuration: CoverConfiguration,\n exploreUrl: string): vd.VNode {\n\n const cover: string = configuration.state === CoverState.Loading ? \"div.mapillary-cover.mapillary-cover-loading\" : \"div.mapillary-cover\";\n const coverButton: vd.VNode = vd.h(\n \"div.mapillary-cover-button\",\n [vd.h(\"div.mapillary-cover-button-icon\", [])]);\n\n const coverLogo: vd.VNode = vd.h(\n \"a.mapillary-cover-logo\",\n { href: exploreUrl, target: \"_blank\" },\n []);\n const coverIndicator: vd.VNode = vd.h(\n \"div.mapillary-cover-indicator\",\n { onclick: (): void => { this.configure({ state: CoverState.Loading }); } },\n []);\n\n return vd.h(\n cover,\n [\n this._getCoverBackgroundVNode(configuration),\n coverIndicator,\n coverButton,\n coverLogo,\n ]);\n }\n\n private _getCoverBackgroundVNode(conf: CoverConfiguration): vd.VNode {\n const properties: vd.createProperties = {\n style: { backgroundImage: `url(${conf.src})` },\n };\n\n const children: vd.VNode[] = [];\n if (conf.state === CoverState.Loading) {\n children.push(vd.h(\"div.mapillary-cover-spinner\", {}, []));\n }\n\n return vd.h(\"div.mapillary-cover-background\", properties, children);\n }\n\n private _getImageSrc$(id: string): Observable<string> {\n return Observable.create(\n (subscriber: Subscriber<string>): void => {\n this._navigator.api.getImages$([id])\n .subscribe(\n (items: ImagesContract): void => {\n for (const item of items) {\n const imageId = typeof id === \"number\" ?\n (<number>id).toString() : id;\n if (item.node_id !== imageId) {\n continue;\n }\n\n this._navigator.api.data\n .getImageBuffer(item.node.thumb.url)\n .then(\n (buffer: ArrayBuffer): void => {\n const image = new Image();\n image.crossOrigin = \"Anonymous\";\n\n image.onload = () => {\n subscriber.next(image.src);\n subscriber.complete();\n };\n\n image.onerror = () => {\n subscriber.error(new Error(\n `Failed to load cover ` +\n `image (${id})`));\n };\n\n const blob = new Blob([buffer]);\n image.src = window.URL\n .createObjectURL(blob);\n },\n (error: Error): void => {\n subscriber.error(error);\n });\n return;\n }\n\n subscriber.error(\n new MapillaryError(\n `Non existent cover key: ${id}`));\n },\n (error: Error): void => {\n subscriber.error(error);\n });\n });\n }\n}\n","import * as vd from \"virtual-dom\";\n\nimport { combineLatest as observableCombineLatest } from \"rxjs\";\nimport { map } from \"rxjs/operators\";\n\nimport { Image } from \"../../graph/Image\";\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { VirtualNodeHash } from \"../../render/interfaces/VirtualNodeHash\";\n\nimport { Component } from \"../Component\";\nimport { ComponentConfiguration } from \"../interfaces/ComponentConfiguration\";\nimport { ComponentName } from \"../ComponentName\";\n\nexport class AttributionComponent extends Component<ComponentConfiguration> {\n public static componentName: ComponentName = \"attribution\";\n\n protected _activate(): void {\n this._subscriptions.push(\n observableCombineLatest(\n this._container.configurationService.exploreUrl$,\n this._navigator.stateService.currentImage$,\n this._container.renderService.size$).pipe(\n map(\n ([exploreUrl, image, size]: [string, Image, ViewportSize]): VirtualNodeHash => {\n const attribution =\n this._makeAttribution(\n image.creatorUsername,\n exploreUrl,\n image.id,\n image.capturedAt,\n size.width);\n return {\n name: this._name,\n vNode: attribution,\n };\n }))\n .subscribe(this._container.domRenderer.render$));\n }\n\n protected _deactivate(): void {\n this._subscriptions.unsubscribe();\n }\n\n protected _getDefaultConfiguration(): ComponentConfiguration {\n return {};\n }\n\n private makeImageUrl(exploreUrl: string, id: string): string {\n return `${exploreUrl}/app/?pKey=${id}&focus=photo`;\n }\n\n private _makeAttribution(\n creatorUsername: string,\n exploreUrl: string,\n imageId: string,\n capturedAt: number,\n viewportWidth: number)\n : vd.VNode {\n const compact = viewportWidth <= 640;\n\n const date = this._makeDate(capturedAt, compact);\n const by = this._makeBy(creatorUsername, exploreUrl, imageId, compact);\n\n const compactClass = compact ?\n \".mapillary-attribution-compact\" : \"\";\n\n return vd.h(\n \"div.mapillary-attribution-container\" + compactClass,\n {},\n [...by, date]);\n }\n\n private _makeBy(\n creatorUsername: string,\n exploreUrl: string,\n imageId: string,\n compact: boolean): vd.VNode[] {\n\n const icon = vd.h(\n \"div.mapillary-attribution-logo\",\n []);\n return creatorUsername ?\n this._makeCreatorBy(icon, creatorUsername, exploreUrl, imageId, compact) :\n this._makeGeneralBy(icon, exploreUrl, imageId, compact);\n }\n\n private _makeCreatorBy(\n icon: vd.VNode,\n creatorUsername: string,\n exploreUrl: string,\n imageId: string,\n compact: boolean): vd.VNode[] {\n const mapillary = vd.h(\n \"a.mapillary-attribution-icon-container\",\n { href: exploreUrl, rel: \"noreferrer\", target: \"_blank\" },\n [icon]);\n\n const content = compact ?\n `${creatorUsername}` : `image by ${creatorUsername}`;\n const imageBy = vd.h(\n \"div.mapillary-attribution-username\",\n { textContent: content },\n []);\n\n const image = vd.h(\n \"a.mapillary-attribution-image-container\",\n {\n href: this.makeImageUrl(exploreUrl, imageId),\n rel: \"noreferrer\",\n target: \"_blank\",\n },\n [imageBy]);\n\n return [mapillary, image];\n }\n\n private _makeGeneralBy(\n icon: vd.VNode,\n exploreUrl: string,\n imageId: string,\n compact: boolean): vd.VNode[] {\n\n const imagesBy = vd.h(\n \"div.mapillary-attribution-username\",\n { textContent: 'images by' },\n []);\n\n const mapillary = vd.h(\n \"div.mapillary-attribution-icon-container\",\n {},\n [icon]);\n\n const contributors = vd.h(\n \"div.mapillary-attribution-username\",\n { textContent: 'contributors' },\n []);\n\n const children = [mapillary, contributors];\n if (!compact) {\n children.unshift(imagesBy);\n }\n\n const image = vd.h(\n \"a.mapillary-attribution-image-container\",\n {\n href: this.makeImageUrl(exploreUrl, imageId),\n rel: \"noreferrer\",\n target: \"_blank\",\n },\n children);\n\n return [image];\n }\n\n private _makeDate(capturedAt: number, compact: boolean): vd.VNode {\n const date = new Date(capturedAt)\n .toDateString()\n .split(\" \");\n\n const formatted = (date.length > 3 ?\n compact ?\n [date[3]] :\n [date[1], date[2] + \",\", date[3]] :\n date).join(\" \");\n\n return vd.h(\n \"div.mapillary-attribution-date\",\n { textContent: formatted },\n []);\n }\n}\n","import * as THREE from \"three\";\n\nimport { Transform } from \"./Transform\";\n\n/**\n * @class ViewportCoords\n *\n * @classdesc Provides methods for calculating 2D coordinate conversions\n * as well as 3D projection and unprojection.\n *\n * Basic coordinates are 2D coordinates on the [0, 1] interval and\n * have the origin point, (0, 0), at the top left corner and the\n * maximum value, (1, 1), at the bottom right corner of the original\n * image.\n *\n * Viewport coordinates are 2D coordinates on the [-1, 1] interval and\n * have the origin point in the center. The bottom left corner point is\n * (-1, -1) and the top right corner point is (1, 1).\n *\n * Canvas coordiantes are 2D pixel coordinates on the [0, canvasWidth] and\n * [0, canvasHeight] intervals. The origin point (0, 0) is in the top left\n * corner and the maximum value is (canvasWidth, canvasHeight) is in the\n * bottom right corner.\n *\n * 3D coordinates are in the topocentric world reference frame.\n */\nexport class ViewportCoords {\n private _unprojectDepth: number = 200;\n\n /**\n * Convert basic coordinates to canvas coordinates.\n *\n * @description Transform origin and camera position needs to be the\n * equal for reliable return value.\n *\n * @param {number} basicX - Basic X coordinate.\n * @param {number} basicY - Basic Y coordinate.\n * @param {HTMLElement} container - The viewer container.\n * @param {Transform} transform - Transform of the image to unproject from.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} 2D canvas coordinates.\n */\n public basicToCanvas(\n basicX: number,\n basicY: number,\n container: { offsetHeight: number, offsetWidth: number },\n transform: Transform,\n camera: THREE.Camera):\n number[] {\n\n const point3d: number[] = transform.unprojectBasic([basicX, basicY], this._unprojectDepth);\n const canvas: number[] = this.projectToCanvas(point3d, container, camera);\n\n return canvas;\n }\n\n /**\n * Convert basic coordinates to canvas coordinates safely. If 3D point is\n * behind camera null will be returned.\n *\n * @description Transform origin and camera position needs to be the\n * equal for reliable return value.\n *\n * @param {number} basicX - Basic X coordinate.\n * @param {number} basicY - Basic Y coordinate.\n * @param {HTMLElement} container - The viewer container.\n * @param {Transform} transform - Transform of the image to unproject from.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} 2D canvas coordinates if the basic point represents a 3D point\n * in front of the camera, otherwise null.\n */\n public basicToCanvasSafe(\n basicX: number,\n basicY: number,\n container: { offsetHeight: number, offsetWidth: number },\n transform: Transform,\n camera: THREE.Camera):\n number[] {\n\n const viewport: number[] = this.basicToViewportSafe(basicX, basicY, transform, camera);\n\n if (viewport === null) {\n return null;\n }\n\n const canvas: number[] = this.viewportToCanvas(viewport[0], viewport[1], container);\n\n return canvas;\n }\n\n /**\n * Convert basic coordinates to viewport coordinates.\n *\n * @description Transform origin and camera position needs to be the\n * equal for reliable return value.\n *\n * @param {number} basicX - Basic X coordinate.\n * @param {number} basicY - Basic Y coordinate.\n * @param {Transform} transform - Transform of the image to unproject from.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} 2D viewport coordinates.\n */\n public basicToViewport(\n basicX: number,\n basicY: number,\n transform: Transform,\n camera: THREE.Camera):\n number[] {\n\n const point3d: number[] = transform.unprojectBasic([basicX, basicY], this._unprojectDepth);\n const viewport: number[] = this.projectToViewport(point3d, camera);\n\n return viewport;\n }\n\n /**\n * Convert basic coordinates to viewport coordinates safely. If 3D point is\n * behind camera null will be returned.\n *\n * @description Transform origin and camera position needs to be the\n * equal for reliable return value.\n *\n * @param {number} basicX - Basic X coordinate.\n * @param {number} basicY - Basic Y coordinate.\n * @param {Transform} transform - Transform of the image to unproject from.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} 2D viewport coordinates.\n */\n public basicToViewportSafe(\n basicX: number,\n basicY: number,\n transform: Transform,\n camera: THREE.Camera):\n number[] {\n\n const point3d: number[] = transform.unprojectBasic([basicX, basicY], this._unprojectDepth);\n const pointCamera: number[] = this.worldToCamera(point3d, camera);\n\n if (pointCamera[2] > 0) {\n return null;\n }\n\n const viewport: number[] = this.projectToViewport(point3d, camera);\n\n return viewport;\n }\n\n /**\n * Convert camera 3D coordinates to viewport coordinates.\n *\n * @param {number} pointCamera - 3D point in camera coordinate system.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} 2D viewport coordinates.\n */\n public cameraToViewport(\n pointCamera: number[],\n camera: THREE.Camera):\n number[] {\n\n const viewport: THREE.Vector3 =\n new THREE.Vector3().fromArray(pointCamera)\n .applyMatrix4(camera.projectionMatrix);\n\n return [viewport.x, viewport.y];\n }\n\n /**\n * Get canvas pixel position from event.\n *\n * @param {Event} event - Event containing clientX and clientY properties.\n * @param {HTMLElement} element - HTML element.\n * @returns {Array<number>} 2D canvas coordinates.\n */\n public canvasPosition(event: { clientX: number, clientY: number }, element: HTMLElement): number[] {\n const clientRect: ClientRect = element.getBoundingClientRect();\n\n const canvasX: number = event.clientX - clientRect.left - element.clientLeft;\n const canvasY: number = event.clientY - clientRect.top - element.clientTop;\n\n return [canvasX, canvasY];\n }\n\n /**\n * Convert canvas coordinates to basic coordinates.\n *\n * @description Transform origin and camera position needs to be the\n * equal for reliable return value.\n *\n * @param {number} canvasX - Canvas X coordinate.\n * @param {number} canvasY - Canvas Y coordinate.\n * @param {HTMLElement} container - The viewer container.\n * @param {Transform} transform - Transform of the image to unproject from.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} 2D basic coordinates.\n */\n public canvasToBasic(\n canvasX: number,\n canvasY: number,\n container: { offsetHeight: number, offsetWidth: number },\n transform: Transform,\n camera: THREE.Camera):\n number[] {\n\n const point3d: number[] =\n this.unprojectFromCanvas(canvasX, canvasY, container, camera)\n .toArray();\n\n const basic: number[] = transform.projectBasic(point3d);\n\n return basic;\n }\n\n /**\n * Convert canvas coordinates to viewport coordinates.\n *\n * @param {number} canvasX - Canvas X coordinate.\n * @param {number} canvasY - Canvas Y coordinate.\n * @param {HTMLElement} container - The viewer container.\n * @returns {Array<number>} 2D viewport coordinates.\n */\n public canvasToViewport(\n canvasX: number,\n canvasY: number,\n container: { offsetHeight: number, offsetWidth: number }):\n number[] {\n\n const [canvasWidth, canvasHeight]: number[] = this.containerToCanvas(container);\n const viewportX: number = 2 * canvasX / canvasWidth - 1;\n const viewportY: number = 1 - 2 * canvasY / canvasHeight;\n\n return [viewportX, viewportY];\n }\n\n /**\n * Determines the width and height of the container in canvas coordinates.\n *\n * @param {HTMLElement} container - The viewer container.\n * @returns {Array<number>} 2D canvas coordinates.\n */\n public containerToCanvas(container: { offsetHeight: number, offsetWidth: number }): number[] {\n return [container.offsetWidth, container.offsetHeight];\n }\n\n /**\n * Determine basic distances from image to canvas corners.\n *\n * @description Transform origin and camera position needs to be the\n * equal for reliable return value.\n *\n * Determines the smallest basic distance for every side of the canvas.\n *\n * @param {Transform} transform - Transform of the image to unproject from.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} Array of basic distances as [top, right, bottom, left].\n */\n public getBasicDistances(\n transform: Transform,\n camera: THREE.Camera):\n number[] {\n\n const topLeftBasic: number[] = this.viewportToBasic(-1, 1, transform, camera);\n const topRightBasic: number[] = this.viewportToBasic(1, 1, transform, camera);\n const bottomRightBasic: number[] = this.viewportToBasic(1, -1, transform, camera);\n const bottomLeftBasic: number[] = this.viewportToBasic(-1, -1, transform, camera);\n\n let topBasicDistance: number = 0;\n let rightBasicDistance: number = 0;\n let bottomBasicDistance: number = 0;\n let leftBasicDistance: number = 0;\n\n if (topLeftBasic[1] < 0 && topRightBasic[1] < 0) {\n topBasicDistance = topLeftBasic[1] > topRightBasic[1] ?\n -topLeftBasic[1] :\n -topRightBasic[1];\n }\n\n if (topRightBasic[0] > 1 && bottomRightBasic[0] > 1) {\n rightBasicDistance = topRightBasic[0] < bottomRightBasic[0] ?\n topRightBasic[0] - 1 :\n bottomRightBasic[0] - 1;\n }\n\n if (bottomRightBasic[1] > 1 && bottomLeftBasic[1] > 1) {\n bottomBasicDistance = bottomRightBasic[1] < bottomLeftBasic[1] ?\n bottomRightBasic[1] - 1 :\n bottomLeftBasic[1] - 1;\n }\n\n if (bottomLeftBasic[0] < 0 && topLeftBasic[0] < 0) {\n leftBasicDistance = bottomLeftBasic[0] > topLeftBasic[0] ?\n -bottomLeftBasic[0] :\n -topLeftBasic[0];\n }\n\n return [topBasicDistance, rightBasicDistance, bottomBasicDistance, leftBasicDistance];\n }\n\n /**\n * Determine pixel distances from image to canvas corners.\n *\n * @description Transform origin and camera position needs to be the\n * equal for reliable return value.\n *\n * Determines the smallest pixel distance for every side of the canvas.\n *\n * @param {HTMLElement} container - The viewer container.\n * @param {Transform} transform - Transform of the image to unproject from.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} Array of pixel distances as [top, right, bottom, left].\n */\n public getPixelDistances(\n container: { offsetHeight: number, offsetWidth: number },\n transform: Transform,\n camera: THREE.Camera):\n number[] {\n\n const topLeftBasic: number[] = this.viewportToBasic(-1, 1, transform, camera);\n const topRightBasic: number[] = this.viewportToBasic(1, 1, transform, camera);\n const bottomRightBasic: number[] = this.viewportToBasic(1, -1, transform, camera);\n const bottomLeftBasic: number[] = this.viewportToBasic(-1, -1, transform, camera);\n\n let topPixelDistance: number = 0;\n let rightPixelDistance: number = 0;\n let bottomPixelDistance: number = 0;\n let leftPixelDistance: number = 0;\n\n const [canvasWidth, canvasHeight]: number[] = this.containerToCanvas(container);\n\n if (topLeftBasic[1] < 0 && topRightBasic[1] < 0) {\n const basicX: number = topLeftBasic[1] > topRightBasic[1] ?\n topLeftBasic[0] :\n topRightBasic[0];\n\n const canvas: number[] = this.basicToCanvas(basicX, 0, container, transform, camera);\n\n topPixelDistance = canvas[1] > 0 ? canvas[1] : 0;\n }\n\n if (topRightBasic[0] > 1 && bottomRightBasic[0] > 1) {\n const basicY: number = topRightBasic[0] < bottomRightBasic[0] ?\n topRightBasic[1] :\n bottomRightBasic[1];\n\n const canvas: number[] = this.basicToCanvas(1, basicY, container, transform, camera);\n\n rightPixelDistance = canvas[0] < canvasWidth ? canvasWidth - canvas[0] : 0;\n }\n\n if (bottomRightBasic[1] > 1 && bottomLeftBasic[1] > 1) {\n const basicX: number = bottomRightBasic[1] < bottomLeftBasic[1] ?\n bottomRightBasic[0] :\n bottomLeftBasic[0];\n\n const canvas: number[] = this.basicToCanvas(basicX, 1, container, transform, camera);\n\n bottomPixelDistance = canvas[1] < canvasHeight ? canvasHeight - canvas[1] : 0;\n }\n\n if (bottomLeftBasic[0] < 0 && topLeftBasic[0] < 0) {\n const basicY: number = bottomLeftBasic[0] > topLeftBasic[0] ?\n bottomLeftBasic[1] :\n topLeftBasic[1];\n\n const canvas: number[] = this.basicToCanvas(0, basicY, container, transform, camera);\n\n leftPixelDistance = canvas[0] > 0 ? canvas[0] : 0;\n }\n\n return [topPixelDistance, rightPixelDistance, bottomPixelDistance, leftPixelDistance];\n }\n\n /**\n * Determine if an event occured inside an element.\n *\n * @param {Event} event - Event containing clientX and clientY properties.\n * @param {HTMLElement} element - HTML element.\n * @returns {boolean} Value indicating if the event occured inside the element or not.\n */\n public insideElement(event: { clientX: number, clientY: number }, element: HTMLElement): boolean {\n const clientRect: ClientRect = element.getBoundingClientRect();\n\n const minX: number = clientRect.left + element.clientLeft;\n const maxX: number = minX + element.clientWidth;\n const minY: number = clientRect.top + element.clientTop;\n const maxY: number = minY + element.clientHeight;\n\n return event.clientX > minX &&\n event.clientX < maxX &&\n event.clientY > minY &&\n event.clientY < maxY;\n }\n\n /**\n * Project 3D world coordinates to canvas coordinates.\n *\n * @param {Array<number>} point3D - 3D world coordinates.\n * @param {HTMLElement} container - The viewer container.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} 2D canvas coordinates.\n */\n public projectToCanvas(\n point3d: number[],\n container: { offsetHeight: number, offsetWidth: number },\n camera: THREE.Camera):\n number[] {\n\n const viewport: number[] = this.projectToViewport(point3d, camera);\n const canvas: number[] =\n this.viewportToCanvas(viewport[0], viewport[1], container);\n\n return canvas;\n }\n\n /**\n * Project 3D world coordinates to canvas coordinates safely. If 3D\n * point is behind camera null will be returned.\n *\n * @param {Array<number>} point3D - 3D world coordinates.\n * @param {HTMLElement} container - The viewer container.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} 2D canvas coordinates.\n */\n public projectToCanvasSafe(\n point3d: number[],\n container: { offsetHeight: number, offsetWidth: number },\n camera: THREE.Camera):\n number[] {\n\n const pointCamera: number[] = this.worldToCamera(point3d, camera);\n\n if (pointCamera[2] > 0) {\n return null;\n }\n\n const viewport: number[] = this.projectToViewport(point3d, camera);\n const canvas: number[] =\n this.viewportToCanvas(viewport[0], viewport[1], container);\n\n return canvas;\n }\n\n /**\n * Project 3D world coordinates to viewport coordinates.\n *\n * @param {Array<number>} point3D - 3D world coordinates.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} 2D viewport coordinates.\n */\n public projectToViewport(\n point3d: number[],\n camera: THREE.Camera):\n number[] {\n\n const viewport: THREE.Vector3 =\n new THREE.Vector3(point3d[0], point3d[1], point3d[2])\n .project(camera);\n\n return [viewport.x, viewport.y];\n }\n\n /**\n * Uproject canvas coordinates to 3D world coordinates.\n *\n * @param {number} canvasX - Canvas X coordinate.\n * @param {number} canvasY - Canvas Y coordinate.\n * @param {HTMLElement} container - The viewer container.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} 3D world coordinates.\n */\n public unprojectFromCanvas(\n canvasX: number,\n canvasY: number,\n container: { offsetHeight: number, offsetWidth: number },\n camera: THREE.Camera):\n THREE.Vector3 {\n\n const viewport: number[] =\n this.canvasToViewport(canvasX, canvasY, container);\n\n const point3d: THREE.Vector3 =\n this.unprojectFromViewport(viewport[0], viewport[1], camera);\n\n return point3d;\n }\n\n /**\n * Unproject viewport coordinates to 3D world coordinates.\n *\n * @param {number} viewportX - Viewport X coordinate.\n * @param {number} viewportY - Viewport Y coordinate.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} 3D world coordinates.\n */\n public unprojectFromViewport(\n viewportX: number,\n viewportY: number,\n camera: THREE.Camera):\n THREE.Vector3 {\n\n const point3d: THREE.Vector3 =\n new THREE.Vector3(viewportX, viewportY, 1)\n .unproject(camera);\n\n return point3d;\n }\n\n /**\n * Convert viewport coordinates to basic coordinates.\n *\n * @description Transform origin and camera position needs to be the\n * equal for reliable return value.\n *\n * @param {number} viewportX - Viewport X coordinate.\n * @param {number} viewportY - Viewport Y coordinate.\n * @param {Transform} transform - Transform of the image to unproject from.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} 2D basic coordinates.\n */\n public viewportToBasic(\n viewportX: number,\n viewportY: number,\n transform: Transform,\n camera: THREE.Camera):\n number[] {\n\n const point3d: number[] =\n new THREE.Vector3(viewportX, viewportY, 1)\n .unproject(camera)\n .toArray();\n\n const basic: number[] = transform.projectBasic(point3d);\n\n return basic;\n }\n\n /**\n * Convert viewport coordinates to canvas coordinates.\n *\n * @param {number} viewportX - Viewport X coordinate.\n * @param {number} viewportY - Viewport Y coordinate.\n * @param {HTMLElement} container - The viewer container.\n * @returns {Array<number>} 2D canvas coordinates.\n */\n public viewportToCanvas(\n viewportX: number,\n viewportY: number,\n container: { offsetHeight: number, offsetWidth: number }):\n number[] {\n\n const [canvasWidth, canvasHeight]: number[] = this.containerToCanvas(container);\n const canvasX: number = canvasWidth * (viewportX + 1) / 2;\n const canvasY: number = -canvasHeight * (viewportY - 1) / 2;\n\n return [canvasX, canvasY];\n }\n\n /**\n * Convert 3D world coordinates to 3D camera coordinates.\n *\n * @param {number} point3D - 3D point in world coordinate system.\n * @param {THREE.Camera} camera - Camera used in rendering.\n * @returns {Array<number>} 3D camera coordinates.\n */\n public worldToCamera(\n point3d: number[],\n camera: THREE.Camera): number[] {\n\n const pointCamera: THREE.Vector3 =\n new THREE.Vector3(point3d[0], point3d[1], point3d[2])\n .applyMatrix4(camera.matrixWorldInverse);\n\n return pointCamera.toArray();\n }\n}\n","import * as vd from \"virtual-dom\";\nimport { MathUtils } from \"three\";\n\nimport {\n combineLatest as observableCombineLatest,\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport {\n distinctUntilChanged,\n map,\n scan,\n skip,\n switchMap,\n takeWhile,\n} from \"rxjs/operators\";\n\nimport * as Geo from \"../../geo/Geo\";\n\nimport { Component } from \"../Component\";\nimport { BearingConfiguration } from \"../interfaces/BearingConfiguration\";\n\nimport { Spatial } from \"../../geo/Spatial\";\nimport { Transform } from \"../../geo/Transform\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { Image } from \"../../graph/Image\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { VirtualNodeHash } from \"../../render/interfaces/VirtualNodeHash\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { ComponentSize } from \"../util/ComponentSize\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { isSpherical } from \"../../geo/Geo\";\nimport { ComponentName } from \"../ComponentName\";\n\ntype ImageFov = [number, number];\n\ntype ImageBearingFov = [number, number, number];\n\ntype ImageFovState = {\n alpha: number,\n curr: ImageFov,\n prev: ImageFov,\n};\n\ninterface ImageFovOperation {\n (state: ImageFovState): ImageFovState;\n}\n\n/**\n * @class BearingComponent\n *\n * @classdesc Component for indicating bearing and field of view.\n *\n * @example\n * ```js\n * var viewer = new Viewer({ ... });\n * var bearingComponent = viewer.getComponent(\"bearing\");\n * bearingComponent.configure({ size: ComponentSize.Small });\n * ```\n */\nexport class BearingComponent extends Component<BearingConfiguration> {\n public static componentName: ComponentName = \"bearing\";\n\n private _spatial: Spatial;\n private _viewportCoords: ViewportCoords;\n\n private _svgNamespace: string;\n private _distinctThreshold: number;\n\n private _animationSpeed: number;\n\n /** @ignore */\n constructor(name: string, container: Container, navigator: Navigator) {\n super(name, container, navigator);\n\n this._spatial = new Spatial();\n this._viewportCoords = new ViewportCoords();\n\n this._svgNamespace = \"http://www.w3.org/2000/svg\";\n this._distinctThreshold = Math.PI / 360;\n\n this._animationSpeed = 0.075;\n }\n\n protected _activate(): void {\n const subs = this._subscriptions;\n\n const cameraBearingFov$ =\n this._container.renderService.renderCamera$.pipe(\n map(\n (rc: RenderCamera): [number, number] => {\n let vFov: number = this._spatial.degToRad(rc.perspective.fov);\n let hFov: number = rc.perspective.aspect === Number.POSITIVE_INFINITY ?\n Math.PI :\n Math.atan(rc.perspective.aspect * Math.tan(0.5 * vFov)) * 2;\n\n return [this._spatial.azimuthalToBearing(rc.rotation.phi), hFov];\n }),\n distinctUntilChanged(\n (a1: [number, number], a2: [number, number]): boolean => {\n return Math.abs(a2[0] - a1[0]) < this._distinctThreshold &&\n Math.abs(a2[1] - a1[1]) < this._distinctThreshold;\n }));\n\n const imageFov$ = observableCombineLatest(\n this._navigator.stateService.currentState$.pipe(\n distinctUntilChanged(\n undefined,\n (frame: AnimationFrame): string => {\n return frame.state.currentImage.id;\n })),\n this._navigator.panService.panImages$).pipe(\n map(\n ([frame, panImages]:\n [\n AnimationFrame,\n [\n Image,\n Transform,\n number][],\n ])\n : ImageFov => {\n const image: Image = frame.state.currentImage;\n const transform: Transform = frame.state.currentTransform;\n\n if (isSpherical(image.cameraType)) {\n return [Math.PI, Math.PI];\n }\n\n const currentProjectedPoints =\n this._computeProjectedPoints(transform);\n const hFov = this._spatial\n .degToRad(\n this._computeHorizontalFov(\n currentProjectedPoints));\n\n let hFovLeft: number = hFov / 2;\n let hFovRight: number = hFov / 2;\n\n for (const [n, , f] of panImages) {\n const diff: number = this._spatial.wrap(n.compassAngle - image.compassAngle, -180, 180);\n if (diff < 0) {\n hFovLeft = this._spatial.degToRad(Math.abs(diff)) + f / 2;\n } else {\n hFovRight = this._spatial.degToRad(Math.abs(diff)) + f / 2;\n }\n }\n\n return [hFovLeft, hFovRight];\n }),\n distinctUntilChanged(\n (\n [hFovLeft1, hFovRight1]: ImageFov,\n [hFovLeft2, hFovRight2]: ImageFov): boolean => {\n\n return Math.abs(hFovLeft2 - hFovLeft1) < this._distinctThreshold &&\n Math.abs(hFovRight2 - hFovRight1) < this._distinctThreshold;\n }));\n\n const offset$ = observableCombineLatest(\n this._navigator.stateService.currentState$.pipe(\n distinctUntilChanged(\n undefined,\n (frame: AnimationFrame): string => {\n return frame.state.currentImage.id;\n })),\n this._container.renderService.bearing$).pipe(\n map(\n ([frame, bearing]: [AnimationFrame, number]): number => {\n const offset: number = this._spatial.degToRad(frame.state.currentImage.compassAngle - bearing);\n\n return offset;\n }));\n\n const imageFovOperation$ = new Subject<ImageFovOperation>();\n\n const smoothImageFov$ = imageFovOperation$.pipe(\n scan(\n (state: ImageFovState, operation: ImageFovOperation): ImageFovState => {\n return operation(state);\n },\n { alpha: 0, curr: [0, 0, 0], prev: [0, 0, 0] }),\n map(\n (state: ImageFovState): ImageFov => {\n const alpha = MathUtils.smootherstep(state.alpha, 0, 1);\n const curr = state.curr;\n const prev = state.prev;\n\n return [\n this._interpolate(prev[0], curr[0], alpha),\n this._interpolate(prev[1], curr[1], alpha),\n ];\n }));\n\n subs.push(imageFov$.pipe(\n map(\n (nbf: ImageFov): ImageFovOperation => {\n return (state: ImageFovState): ImageFovState => {\n const a = MathUtils.smootherstep(state.alpha, 0, 1);\n const c = state.curr;\n const p = state.prev;\n\n const prev: ImageFov = [\n this._interpolate(p[0], c[0], a),\n this._interpolate(p[1], c[1], a),\n ];\n\n const curr: ImageFov = <ImageFov>nbf.slice();\n\n return {\n alpha: 0,\n curr: curr,\n prev: prev,\n };\n };\n }))\n .subscribe(imageFovOperation$));\n\n subs.push(imageFov$.pipe(\n switchMap(\n (): Observable<number> => {\n return this._container.renderService.renderCameraFrame$.pipe(\n skip(1),\n scan<RenderCamera, number>(\n (alpha: number): number => {\n return alpha + this._animationSpeed;\n },\n 0),\n takeWhile(\n (alpha: number): boolean => {\n return alpha <= 1 + this._animationSpeed;\n }),\n map(\n (alpha: number): number => {\n return Math.min(alpha, 1);\n }));\n }),\n map(\n (alpha: number): ImageFovOperation => {\n return (nbfState: ImageFovState): ImageFovState => {\n return {\n alpha: alpha,\n curr: <ImageFov>nbfState.curr.slice(),\n prev: <ImageFov>nbfState.prev.slice(),\n };\n };\n }))\n .subscribe(imageFovOperation$));\n\n const imageBearingFov$ = observableCombineLatest(\n offset$,\n smoothImageFov$).pipe(\n map(\n ([offset, fov]: [number, ImageFov]): ImageBearingFov => {\n return [offset, fov[0], fov[1]];\n }));\n\n subs.push(observableCombineLatest(\n cameraBearingFov$,\n imageBearingFov$,\n this._configuration$,\n this._container.renderService.size$).pipe(\n map(\n ([[cb, cf], [no, nfl, nfr], configuration, size]:\n [[number, number], [number, number, number], BearingConfiguration, ViewportSize]): VirtualNodeHash => {\n\n const background: vd.VNode = this._createBackground(cb);\n const fovIndicator: vd.VNode = this._createFovIndicator(nfl, nfr, no);\n const north: vd.VNode = this._createNorth(cb);\n const cameraSector: vd.VNode = this._createCircleSectorCompass(\n this._createCircleSector(Math.max(Math.PI / 20, cf), \"#FFF\"));\n\n const compact: string = configuration.size === ComponentSize.Small ||\n configuration.size === ComponentSize.Automatic && size.width < 640 ?\n \".mapillary-bearing-compact\" : \"\";\n\n return {\n name: this._name,\n vNode: vd.h(\n \"div.mapillary-bearing-indicator-container\" + compact,\n { oncontextmenu: (event: MouseEvent): void => { event.preventDefault(); } },\n [\n background,\n fovIndicator,\n north,\n cameraSector,\n ]),\n };\n }))\n .subscribe(this._container.domRenderer.render$));\n }\n\n protected _deactivate(): void {\n this._subscriptions.unsubscribe();\n }\n\n protected _getDefaultConfiguration(): BearingConfiguration {\n return { size: ComponentSize.Automatic };\n }\n\n private _createFovIndicator(fovLeft: number, fovRigth: number, offset: number): vd.VNode {\n const arc: vd.VNode = this._createFovArc(fovLeft, fovRigth);\n\n const group: vd.VNode =\n vd.h(\n \"g\",\n {\n attributes: { transform: \"translate(18,18)\" },\n namespace: this._svgNamespace,\n },\n [arc]);\n\n const svg: vd.VNode =\n vd.h(\n \"svg\",\n {\n attributes: { viewBox: \"0 0 36 36\" },\n namespace: this._svgNamespace,\n style: {\n height: \"36px\",\n left: \"2px\",\n position: \"absolute\",\n top: \"2px\",\n transform: `rotateZ(${this._spatial.radToDeg(offset)}deg)`,\n width: \"36px\",\n },\n },\n [group]);\n\n return svg;\n }\n\n private _createFovArc(fovLeft: number, fovRigth: number): vd.VNode {\n const radius: number = 16.75;\n const strokeWidth: number = 2.5;\n const fov: number = fovLeft + fovRigth;\n\n if (fov > 2 * Math.PI - Math.PI / 90) {\n return vd.h(\n \"circle\",\n {\n attributes: {\n cx: \"0\",\n cy: \"0\",\n \"fill-opacity\": \"0\",\n r: `${radius}`,\n stroke: \"#FFF\",\n \"stroke-width\":\n `${strokeWidth}`,\n },\n namespace: this._svgNamespace,\n },\n []);\n }\n\n let arcStart: number = -Math.PI / 2 - fovLeft;\n let arcEnd: number = arcStart + fov;\n\n let startX: number = radius * Math.cos(arcStart);\n let startY: number = radius * Math.sin(arcStart);\n\n let endX: number = radius * Math.cos(arcEnd);\n let endY: number = radius * Math.sin(arcEnd);\n\n let largeArc: number = fov >= Math.PI ? 1 : 0;\n\n let description: string = `M ${startX} ${startY} A ${radius} ${radius} 0 ${largeArc} 1 ${endX} ${endY}`;\n\n return vd.h(\n \"path\",\n {\n attributes: {\n d: description,\n \"fill-opacity\": \"0\",\n stroke: \"#FFF\",\n \"stroke-width\": `${strokeWidth}`,\n },\n namespace: this._svgNamespace,\n },\n []);\n }\n\n private _createCircleSectorCompass(cameraSector: vd.VNode): vd.VNode {\n let group: vd.VNode =\n vd.h(\n \"g\",\n {\n attributes: { transform: \"translate(1,1)\" },\n namespace: this._svgNamespace,\n },\n [cameraSector]);\n\n let svg: vd.VNode =\n vd.h(\n \"svg\",\n {\n attributes: { viewBox: \"0 0 2 2\" },\n namespace: this._svgNamespace,\n style: {\n height: \"26px\",\n left: \"7px\",\n position: \"absolute\",\n top: \"7px\",\n width: \"26px\",\n },\n },\n [group]);\n\n return svg;\n }\n\n private _createCircleSector(fov: number, fill: string): vd.VNode {\n if (fov > 2 * Math.PI - Math.PI / 90) {\n return vd.h(\n \"circle\",\n {\n attributes: { cx: \"0\", cy: \"0\", fill: fill, r: \"1\" },\n namespace: this._svgNamespace,\n },\n []);\n }\n\n let arcStart: number = -Math.PI / 2 - fov / 2;\n let arcEnd: number = arcStart + fov;\n\n let startX: number = Math.cos(arcStart);\n let startY: number = Math.sin(arcStart);\n\n let endX: number = Math.cos(arcEnd);\n let endY: number = Math.sin(arcEnd);\n\n let largeArc: number = fov >= Math.PI ? 1 : 0;\n\n let description: string = `M 0 0 ${startX} ${startY} A 1 1 0 ${largeArc} 1 ${endX} ${endY}`;\n\n return vd.h(\n \"path\",\n {\n attributes: { d: description, fill: fill },\n namespace: this._svgNamespace,\n },\n []);\n }\n\n private _createNorth(bearing: number): vd.VNode {\n const north: vd.VNode = vd.h(\"div.mapillary-bearing-north\", []);\n const container: vd.VNode = vd.h(\n \"div.mapillary-bearing-north-container\",\n { style: { transform: `rotateZ(${this._spatial.radToDeg(-bearing)}deg)` } },\n [north]);\n\n return container;\n }\n\n private _createBackground(bearing: number): vd.VNode {\n return vd.h(\n \"div.mapillary-bearing-indicator-background\",\n { style: { transform: `rotateZ(${this._spatial.radToDeg(-bearing)}deg)` } },\n [\n vd.h(\"div.mapillary-bearing-indicator-background-circle\", []),\n vd.h(\n \"div.mapillary-bearing-indicator-background-arrow-container\",\n [\n vd.h(\"div.mapillary-bearing-indicator-background-arrow\", []),\n ]),\n ]);\n }\n\n private _computeProjectedPoints(transform: Transform): number[][] {\n const vertices: number[][] = [[1, 0]];\n const directions: number[][] = [[0, 0.5]];\n const pointsPerLine: number = 12;\n\n return Geo.computeProjectedPoints(transform, vertices, directions, pointsPerLine, this._viewportCoords);\n }\n\n private _computeHorizontalFov(projectedPoints: number[][]): number {\n const fovs: number[] = projectedPoints\n .map(\n (projectedPoint: number[]): number => {\n return this._coordToFov(projectedPoint[0]);\n });\n\n const fov: number = Math.min(...fovs);\n\n return fov;\n }\n\n private _coordToFov(x: number): number {\n return this._spatial.radToDeg(2 * Math.atan(x));\n }\n\n private _interpolate(x1: number, x2: number, alpha: number): number {\n return (1 - alpha) * x1 + alpha * x2;\n }\n}\n","import {\n combineLatest as observableCombineLatest,\n empty as observableEmpty,\n from as observableFrom,\n merge as observableMerge,\n of as observableOf,\n zip as observableZip,\n Observable,\n} from \"rxjs\";\n\nimport {\n catchError,\n expand,\n filter,\n first,\n map,\n mergeAll,\n mergeMap,\n skip,\n switchMap,\n} from \"rxjs/operators\";\n\nimport { Component } from \"../Component\";\nimport {\n CacheConfiguration,\n CacheDepthConfiguration,\n} from \"../interfaces/CacheConfiguration\";\n\nimport { Image } from \"../../graph/Image\";\nimport { NavigationEdge } from \"../../graph/edge/interfaces/NavigationEdge\";\nimport { NavigationEdgeStatus }\n from \"../../graph/interfaces/NavigationEdgeStatus\";\nimport { NavigationDirection } from \"../../graph/edge/NavigationDirection\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { isSpherical } from \"../../geo/Geo\";\nimport { ComponentName } from \"../ComponentName\";\n\ntype EdgesDepth = [NavigationEdge[], number];\n\nexport class CacheComponent extends Component<CacheConfiguration> {\n public static componentName: ComponentName = \"cache\";\n\n /** @ignore */\n constructor(name: string, container: Container, navigator: Navigator) {\n super(name, container, navigator);\n }\n\n protected _activate(): void {\n const subs = this._subscriptions;\n\n subs.push(observableCombineLatest(\n this._navigator.stateService.currentImage$.pipe(\n switchMap(\n (image: Image): Observable<NavigationEdgeStatus> => {\n return image.sequenceEdges$;\n }),\n filter(\n (status: NavigationEdgeStatus): boolean => {\n return status.cached;\n })),\n this._configuration$).pipe(\n switchMap(\n (nc: [NavigationEdgeStatus, CacheConfiguration]): Observable<EdgesDepth> => {\n let status: NavigationEdgeStatus = nc[0];\n let configuration: CacheConfiguration = nc[1];\n\n let sequenceDepth = Math.max(0, Math.min(4, configuration.depth.sequence));\n\n let next$ = this._cache$(status.edges, NavigationDirection.Next, sequenceDepth);\n let prev$ = this._cache$(status.edges, NavigationDirection.Prev, sequenceDepth);\n\n return observableMerge(\n next$,\n prev$).pipe(\n catchError(\n (error: Error): Observable<EdgesDepth> => {\n console.error(\"Failed to cache sequence edges.\", error);\n\n return observableEmpty();\n }));\n }))\n .subscribe(() => { /*noop*/ }));\n\n subs.push(observableCombineLatest(\n this._navigator.stateService.currentImage$.pipe(\n switchMap(\n (image: Image): Observable<[Image, NavigationEdgeStatus]> => {\n return observableCombineLatest(\n observableOf<Image>(image),\n image.spatialEdges$.pipe(\n filter(\n (status: NavigationEdgeStatus): boolean => {\n return status.cached;\n })));\n })),\n this._configuration$).pipe(\n switchMap(\n ([[image, edgeStatus], configuration]: [[Image, NavigationEdgeStatus], CacheConfiguration]): Observable<EdgesDepth> => {\n let edges: NavigationEdge[] = edgeStatus.edges;\n let depth: CacheDepthConfiguration = configuration.depth;\n\n let sphericalDepth =\n Math.max(0, Math.min(2, depth.spherical));\n let stepDepth = isSpherical(image.cameraType) ?\n 0 : Math.max(0, Math.min(3, depth.step));\n let turnDepth = isSpherical(image.cameraType) ?\n 0 : Math.max(0, Math.min(1, depth.turn));\n\n let spherical$ = this._cache$(edges, NavigationDirection.Spherical, sphericalDepth);\n\n let forward$ = this._cache$(edges, NavigationDirection.StepForward, stepDepth);\n let backward$ = this._cache$(edges, NavigationDirection.StepBackward, stepDepth);\n let left$ = this._cache$(edges, NavigationDirection.StepLeft, stepDepth);\n let right$ = this._cache$(edges, NavigationDirection.StepRight, stepDepth);\n\n let turnLeft$ = this._cache$(edges, NavigationDirection.TurnLeft, turnDepth);\n let turnRight$ = this._cache$(edges, NavigationDirection.TurnRight, turnDepth);\n let turnU$ = this._cache$(edges, NavigationDirection.TurnU, turnDepth);\n\n return observableMerge(\n forward$,\n backward$,\n left$,\n right$,\n spherical$,\n turnLeft$,\n turnRight$,\n turnU$).pipe(\n catchError(\n (error: Error): Observable<EdgesDepth> => {\n console.error(\"Failed to cache spatial edges.\", error);\n\n return observableEmpty();\n }));\n }))\n .subscribe(() => { /*noop*/ }));\n }\n\n protected _deactivate(): void {\n this._subscriptions.unsubscribe();\n }\n\n protected _getDefaultConfiguration(): CacheConfiguration {\n return { depth: { spherical: 1, sequence: 2, step: 1, turn: 0 } };\n }\n\n private _cache$(\n edges: NavigationEdge[],\n direction: NavigationDirection,\n depth: number)\n : Observable<EdgesDepth> {\n return observableZip(\n observableOf<NavigationEdge[]>(edges),\n observableOf<number>(depth)).pipe(\n expand(\n (ed: EdgesDepth): Observable<EdgesDepth> => {\n let es: NavigationEdge[] = ed[0];\n let d = ed[1];\n\n let edgesDepths$: Observable<EdgesDepth>[] = [];\n\n if (d > 0) {\n for (let edge of es) {\n if (edge.data.direction === direction) {\n edgesDepths$.push(\n observableZip(\n this._navigator.graphService.cacheImage$(edge.target).pipe(\n mergeMap(\n (n: Image): Observable<NavigationEdge[]> => {\n return this._imageToEdges$(n, direction);\n })),\n observableOf<number>(d - 1)));\n }\n }\n }\n\n return observableFrom(edgesDepths$).pipe(\n mergeAll());\n }),\n skip(1));\n }\n\n private _imageToEdges$(image: Image, direction: NavigationDirection): Observable<NavigationEdge[]> {\n return ([NavigationDirection.Next, NavigationDirection.Prev].indexOf(direction) > -1 ?\n image.sequenceEdges$ :\n image.spatialEdges$).pipe(\n first(\n (status: NavigationEdgeStatus): boolean => {\n return status.cached;\n }),\n map(\n (status: NavigationEdgeStatus): NavigationEdge[] => {\n return status.edges;\n }));\n }\n}\n","import { MapillaryError } from \"./MapillaryError\";\n\n/**\n * @class CancelMapillaryError\n *\n * @classdesc Error thrown when a move to request has been\n * cancelled before completing because of a subsequent request.\n */\nexport class CancelMapillaryError extends MapillaryError {\n constructor(message?: string) {\n super(message != null ? message : \"The request was cancelled.\");\n\n Object.setPrototypeOf(this, CancelMapillaryError.prototype);\n\n this.name = \"CancelMapillaryError\";\n }\n}\n","import { Spatial } from \"../../geo/Spatial\";\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { DirectionConfiguration } from \"../interfaces/DirectionConfiguration\";\n\n/**\n * @class DirectionDOMCalculator\n * @classdesc Helper class for calculating DOM CSS properties.\n */\nexport class DirectionDOMCalculator {\n private _spatial: Spatial;\n\n private _elementWidth: number;\n private _elementHeight: number;\n\n private _minWidth: number;\n private _maxWidth: number;\n\n private _minThresholdWidth: number;\n private _maxThresholdWidth: number;\n private _minThresholdHeight: number;\n private _maxThresholdHeight: number;\n\n private _containerWidth: number;\n private _containerWidthCss: string;\n private _containerMarginCss: string;\n private _containerLeftCss: string;\n private _containerHeight: number;\n private _containerHeightCss: string;\n private _containerBottomCss: string;\n\n private _stepCircleSize: number;\n private _stepCircleSizeCss: string;\n private _stepCircleMarginCss: string;\n\n private _turnCircleSize: number;\n private _turnCircleSizeCss: string;\n\n private _outerRadius: number;\n private _innerRadius: number;\n\n private _shadowOffset: number;\n\n constructor(configuration: DirectionConfiguration, size: ViewportSize) {\n this._spatial = new Spatial();\n\n this._minThresholdWidth = 320;\n this._maxThresholdWidth = 1480;\n this._minThresholdHeight = 240;\n this._maxThresholdHeight = 820;\n\n this._configure(configuration);\n this._resize(size);\n this._reset();\n }\n\n public get minWidth(): number {\n return this._minWidth;\n }\n\n public get maxWidth(): number {\n return this._maxWidth;\n }\n\n public get containerWidth(): number {\n return this._containerWidth;\n }\n\n public get containerWidthCss(): string {\n return this._containerWidthCss;\n }\n\n public get containerMarginCss(): string {\n return this._containerMarginCss;\n }\n\n public get containerLeftCss(): string {\n return this._containerLeftCss;\n }\n\n public get containerHeight(): number {\n return this._containerHeight;\n }\n\n public get containerHeightCss(): string {\n return this._containerHeightCss;\n }\n\n public get containerBottomCss(): string {\n return this._containerBottomCss;\n }\n\n public get stepCircleSize(): number {\n return this._stepCircleSize;\n }\n\n public get stepCircleSizeCss(): string {\n return this._stepCircleSizeCss;\n }\n\n public get stepCircleMarginCss(): string {\n return this._stepCircleMarginCss;\n }\n\n public get turnCircleSize(): number {\n return this._turnCircleSize;\n }\n\n public get turnCircleSizeCss(): string {\n return this._turnCircleSizeCss;\n }\n\n public get outerRadius(): number {\n return this._outerRadius;\n }\n\n public get innerRadius(): number {\n return this._innerRadius;\n }\n\n public get shadowOffset(): number {\n return this._shadowOffset;\n }\n\n /**\n * Configures the min and max width values.\n *\n * @param {DirectionConfiguration} configuration Configuration\n * with min and max width values.\n */\n public configure(configuration: DirectionConfiguration): void {\n this._configure(configuration);\n this._reset();\n }\n\n /**\n * Resizes all properties according to the width and height\n * of the size object.\n *\n * @param {ViewportSize} size The size of the container element.\n */\n public resize(size: ViewportSize): void {\n this._resize(size);\n this._reset();\n }\n\n /**\n * Calculates the coordinates on the unit circle for an angle.\n *\n * @param {number} angle Angle in radians.\n * @returns {Array<number>} The x and y coordinates on the unit circle.\n */\n public angleToCoordinates(angle: number): number[] {\n return [Math.cos(angle), Math.sin(angle)];\n }\n\n /**\n * Calculates the coordinates on the unit circle for the\n * relative angle between the first and second angle.\n *\n * @param {number} first Angle in radians.\n * @param {number} second Angle in radians.\n * @returns {Array<number>} The x and y coordinates on the unit circle\n * for the relative angle between the first and second angle.\n */\n public relativeAngleToCoordiantes(first: number, second: number): number[] {\n let relativeAngle: number = this._spatial.wrapAngle(first - second);\n\n return this.angleToCoordinates(relativeAngle);\n }\n\n private _configure(configuration: DirectionConfiguration): void {\n this._minWidth = configuration.minWidth;\n this._maxWidth = this._getMaxWidth(configuration.minWidth, configuration.maxWidth);\n }\n\n private _resize(size: ViewportSize): void {\n this._elementWidth = size.width;\n this._elementHeight = size.height;\n }\n\n private _reset(): void {\n this._containerWidth = this._getContainerWidth(this._elementWidth, this._elementHeight);\n this._containerHeight = this._getContainerHeight(this.containerWidth);\n this._stepCircleSize = this._getStepCircleDiameter(this._containerHeight);\n this._turnCircleSize = this._getTurnCircleDiameter(this.containerHeight);\n this._outerRadius = this._getOuterRadius(this._containerHeight);\n this._innerRadius = this._getInnerRadius(this._containerHeight);\n\n this._shadowOffset = 3;\n\n this._containerWidthCss = this._numberToCssPixels(this._containerWidth);\n this._containerMarginCss = this._numberToCssPixels(-0.5 * this._containerWidth);\n this._containerLeftCss = this._numberToCssPixels(Math.floor(0.5 * this._elementWidth));\n this._containerHeightCss = this._numberToCssPixels(this._containerHeight);\n this._containerBottomCss = this._numberToCssPixels(Math.floor(-0.08 * this._containerHeight));\n this._stepCircleSizeCss = this._numberToCssPixels(this._stepCircleSize);\n this._stepCircleMarginCss = this._numberToCssPixels(-0.5 * this._stepCircleSize);\n this._turnCircleSizeCss = this._numberToCssPixels(this._turnCircleSize);\n }\n\n private _getContainerWidth(elementWidth: number, elementHeight: number): number {\n let relativeWidth: number =\n (elementWidth - this._minThresholdWidth) / (this._maxThresholdWidth - this._minThresholdWidth);\n let relativeHeight: number =\n (elementHeight - this._minThresholdHeight) / (this._maxThresholdHeight - this._minThresholdHeight);\n\n let coeff: number = Math.max(0, Math.min(1, Math.min(relativeWidth, relativeHeight)));\n\n coeff = 0.04 * Math.round(25 * coeff);\n\n return this._minWidth + coeff * (this._maxWidth - this._minWidth);\n }\n\n private _getContainerHeight(containerWidth: number): number {\n return 0.77 * containerWidth;\n }\n\n private _getStepCircleDiameter(containerHeight: number): number {\n return 0.34 * containerHeight;\n }\n\n private _getTurnCircleDiameter(containerHeight: number): number {\n return 0.3 * containerHeight;\n }\n\n private _getOuterRadius(containerHeight: number): number {\n return 0.31 * containerHeight;\n }\n\n private _getInnerRadius(containerHeight: number): number {\n return 0.125 * containerHeight;\n }\n\n private _numberToCssPixels(value: number): string {\n return value + \"px\";\n }\n\n private _getMaxWidth(value: number, minWidth: number): number {\n return value > minWidth ? value : minWidth;\n }\n}\n","import * as vd from \"virtual-dom\";\nimport { CancelMapillaryError } from \"../../error/CancelMapillaryError\";\n\nimport { Spatial } from \"../../geo/Spatial\";\nimport { Image } from \"../../graph/Image\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { NavigationDirection } from \"../../graph/edge/NavigationDirection\";\nimport { NavigationEdge } from \"../../graph/edge/interfaces/NavigationEdge\";\nimport { NavigationEdgeStatus } from \"../../graph/interfaces/NavigationEdgeStatus\";\nimport { Sequence } from \"../../graph/Sequence\";\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { EulerRotation } from \"../../state/interfaces/EulerRotation\";\nimport { DirectionConfiguration } from \"../interfaces/DirectionConfiguration\";\nimport { DirectionDOMCalculator } from \"./DirectionDOMCalculator\";\nimport { isSpherical } from \"../../geo/Geo\";\n\n/**\n * @class DirectionDOMRenderer\n * @classdesc DOM renderer for direction arrows.\n */\nexport class DirectionDOMRenderer {\n private _spatial: Spatial;\n private _calculator: DirectionDOMCalculator;\n\n private _image: Image;\n\n private _rotation: EulerRotation;\n private _epsilon: number;\n\n private _highlightKey: string;\n private _distinguishSequence: boolean;\n\n private _needsRender: boolean;\n\n private _stepEdges: NavigationEdge[];\n private _turnEdges: NavigationEdge[];\n private _sphericalEdges: NavigationEdge[];\n private _sequenceEdgeKeys: string[];\n\n private _stepDirections: NavigationDirection[];\n private _turnDirections: NavigationDirection[];\n private _turnNames: { [dir: number]: string };\n\n private _isEdge: boolean = false;\n\n constructor(configuration: DirectionConfiguration, size: ViewportSize) {\n this._spatial = new Spatial();\n this._calculator = new DirectionDOMCalculator(configuration, size);\n\n this._image = null;\n\n this._rotation = { phi: 0, theta: 0 };\n this._epsilon = 0.5 * Math.PI / 180;\n\n this._highlightKey = null;\n this._distinguishSequence = false;\n\n this._needsRender = false;\n\n this._stepEdges = [];\n this._turnEdges = [];\n this._sphericalEdges = [];\n this._sequenceEdgeKeys = [];\n\n this._stepDirections = [\n NavigationDirection.StepForward,\n NavigationDirection.StepBackward,\n NavigationDirection.StepLeft,\n NavigationDirection.StepRight,\n ];\n\n this._turnDirections = [\n NavigationDirection.TurnLeft,\n NavigationDirection.TurnRight,\n NavigationDirection.TurnU,\n ];\n\n this._turnNames = {};\n this._turnNames[NavigationDirection.TurnLeft] = \"mapillary-direction-turn-left\";\n this._turnNames[NavigationDirection.TurnRight] = \"mapillary-direction-turn-right\";\n this._turnNames[NavigationDirection.TurnU] = \"mapillary-direction-turn-around\";\n\n // detects IE 8-11, then Edge 20+.\n let isIE: boolean = !!(<any>document).documentMode;\n this._isEdge = !isIE && !!(<any>window).StyleMedia;\n }\n\n /**\n * Get needs render.\n *\n * @returns {boolean} Value indicating whether render should be called.\n */\n public get needsRender(): boolean {\n return this._needsRender;\n }\n\n /**\n * Renders virtual DOM elements.\n *\n * @description Calling render resets the needs render property.\n */\n public render(navigator: Navigator): vd.VNode {\n this._needsRender = false;\n\n let rotation: EulerRotation = this._rotation;\n\n let steps: vd.VNode[] = [];\n let turns: vd.VNode[] = [];\n\n if (isSpherical(this._image.cameraType)) {\n steps = steps.concat(this._createSphericalArrows(navigator, rotation));\n } else {\n steps = steps.concat(\n this._createPerspectiveToSphericalArrows(navigator, rotation));\n steps = steps.concat(this._createStepArrows(navigator, rotation));\n turns = turns.concat(this._createTurnArrows(navigator));\n }\n\n return this._getContainer(steps, turns, rotation);\n }\n\n public setEdges(edgeStatus: NavigationEdgeStatus, sequence: Sequence): void {\n this._setEdges(edgeStatus, sequence);\n\n this._setNeedsRender();\n }\n\n /**\n * Set image for which to show edges.\n *\n * @param {Image} image\n */\n public setImage(image: Image): void {\n this._image = image;\n this._clearEdges();\n\n this._setNeedsRender();\n }\n\n /**\n * Set the render camera to use for calculating rotations.\n *\n * @param {RenderCamera} renderCamera\n */\n public setRenderCamera(renderCamera: RenderCamera): void {\n let rotation: EulerRotation = renderCamera.rotation;\n\n if (Math.abs(rotation.phi - this._rotation.phi) < this._epsilon) {\n return;\n }\n\n this._rotation = rotation;\n\n this._setNeedsRender();\n }\n\n /**\n * Set configuration values.\n *\n * @param {DirectionConfiguration} configuration\n */\n public setConfiguration(configuration: DirectionConfiguration): void {\n let needsRender: boolean = false;\n if (this._highlightKey !== configuration.highlightId ||\n this._distinguishSequence !== configuration.distinguishSequence) {\n this._highlightKey = configuration.highlightId;\n this._distinguishSequence = configuration.distinguishSequence;\n\n needsRender = true;\n }\n\n if (this._calculator.minWidth !== configuration.minWidth ||\n this._calculator.maxWidth !== configuration.maxWidth) {\n this._calculator.configure(configuration);\n needsRender = true;\n }\n\n if (needsRender) {\n this._setNeedsRender();\n }\n }\n\n /**\n * Detect the element's width and height and resize\n * elements accordingly.\n *\n * @param {ViewportSize} size Size of vßiewer container element.\n */\n public resize(size: ViewportSize): void {\n this._calculator.resize(size);\n\n this._setNeedsRender();\n }\n\n private _setNeedsRender(): void {\n if (this._image != null) {\n this._needsRender = true;\n }\n }\n\n private _clearEdges(): void {\n this._stepEdges = [];\n this._turnEdges = [];\n this._sphericalEdges = [];\n this._sequenceEdgeKeys = [];\n }\n\n private _setEdges(edgeStatus: NavigationEdgeStatus, sequence: Sequence): void {\n this._stepEdges = [];\n this._turnEdges = [];\n this._sphericalEdges = [];\n this._sequenceEdgeKeys = [];\n\n for (let edge of edgeStatus.edges) {\n let direction: NavigationDirection = edge.data.direction;\n\n if (this._stepDirections.indexOf(direction) > -1) {\n this._stepEdges.push(edge);\n continue;\n }\n\n if (this._turnDirections.indexOf(direction) > -1) {\n this._turnEdges.push(edge);\n continue;\n }\n\n if (edge.data.direction === NavigationDirection.Spherical) {\n this._sphericalEdges.push(edge);\n }\n }\n\n if (this._distinguishSequence && sequence != null) {\n let edges: NavigationEdge[] = this._sphericalEdges\n .concat(this._stepEdges)\n .concat(this._turnEdges);\n\n for (let edge of edges) {\n let edgeKey: string = edge.target;\n\n for (let sequenceKey of sequence.imageIds) {\n if (sequenceKey === edgeKey) {\n this._sequenceEdgeKeys.push(edgeKey);\n break;\n }\n }\n }\n }\n }\n\n private _createSphericalArrows(navigator: Navigator, rotation: EulerRotation): vd.VNode[] {\n let arrows: vd.VNode[] = [];\n\n for (let sphericalEdge of this._sphericalEdges) {\n arrows.push(\n this._createVNodeByKey(\n navigator,\n sphericalEdge.target,\n sphericalEdge.data.worldMotionAzimuth,\n rotation,\n this._calculator.outerRadius,\n \"mapillary-direction-arrow-spherical\"));\n }\n\n for (let stepEdge of this._stepEdges) {\n arrows.push(\n this._createSphericalToPerspectiveArrow(\n navigator,\n stepEdge.target,\n stepEdge.data.worldMotionAzimuth,\n rotation,\n stepEdge.data.direction));\n }\n\n return arrows;\n }\n\n private _createSphericalToPerspectiveArrow(\n navigator: Navigator,\n key: string,\n azimuth: number,\n rotation: EulerRotation,\n direction: NavigationDirection): vd.VNode {\n\n let threshold: number = Math.PI / 8;\n\n let relativePhi: number = rotation.phi;\n\n switch (direction) {\n case NavigationDirection.StepBackward:\n relativePhi = rotation.phi - Math.PI;\n break;\n case NavigationDirection.StepLeft:\n relativePhi = rotation.phi + Math.PI / 2;\n break;\n case NavigationDirection.StepRight:\n relativePhi = rotation.phi - Math.PI / 2;\n break;\n default:\n break;\n }\n\n if (Math.abs(this._spatial.wrapAngle(azimuth - relativePhi)) < threshold) {\n return this._createVNodeByKey(\n navigator,\n key,\n azimuth,\n rotation,\n this._calculator.outerRadius,\n \"mapillary-direction-arrow-step\");\n }\n\n return this._createVNodeInactive(key, azimuth, rotation);\n }\n\n private _createPerspectiveToSphericalArrows(navigator: Navigator, rotation: EulerRotation): vd.VNode[] {\n let arrows: vd.VNode[] = [];\n\n for (let sphericalEdge of this._sphericalEdges) {\n arrows.push(\n this._createVNodeByKey(\n navigator,\n sphericalEdge.target,\n sphericalEdge.data.worldMotionAzimuth,\n rotation,\n this._calculator.innerRadius,\n \"mapillary-direction-arrow-spherical\",\n true));\n }\n\n return arrows;\n }\n\n private _createStepArrows(navigator: Navigator, rotation: EulerRotation): vd.VNode[] {\n let arrows: vd.VNode[] = [];\n\n for (let stepEdge of this._stepEdges) {\n arrows.push(\n this._createVNodeByDirection(\n navigator,\n stepEdge.target,\n stepEdge.data.worldMotionAzimuth,\n rotation,\n stepEdge.data.direction));\n }\n\n return arrows;\n }\n\n private _createTurnArrows(navigator: Navigator): vd.VNode[] {\n let turns: vd.VNode[] = [];\n\n for (let turnEdge of this._turnEdges) {\n let direction: NavigationDirection = turnEdge.data.direction;\n let name: string = this._turnNames[direction];\n\n turns.push(\n this._createVNodeByTurn(\n navigator,\n turnEdge.target,\n name,\n direction));\n }\n\n return turns;\n }\n\n private _createVNodeByKey(\n navigator: Navigator,\n key: string,\n azimuth: number,\n rotation: EulerRotation,\n offset: number,\n className: string,\n shiftVertically?: boolean): vd.VNode {\n\n let onClick: (e: Event) => void =\n (e: Event): void => {\n navigator.moveTo$(key)\n .subscribe(\n undefined,\n (error: Error): void => {\n if (!(error instanceof CancelMapillaryError)) {\n console.error(error);\n }\n });\n };\n\n return this._createVNode(\n key,\n azimuth,\n rotation,\n offset,\n className,\n \"mapillary-direction-circle\",\n onClick,\n shiftVertically);\n }\n\n private _createVNodeByDirection(\n navigator: Navigator,\n key: string,\n azimuth: number,\n rotation: EulerRotation,\n direction: NavigationDirection): vd.VNode {\n\n let onClick: (e: Event) => void =\n (e: Event): void => {\n navigator.moveDir$(direction)\n .subscribe(\n undefined,\n (error: Error): void => {\n if (!(error instanceof CancelMapillaryError)) {\n console.error(error);\n }\n });\n };\n\n return this._createVNode(\n key,\n azimuth,\n rotation,\n this._calculator.outerRadius,\n \"mapillary-direction-arrow-step\",\n \"mapillary-direction-circle\",\n onClick);\n }\n\n private _createVNodeByTurn(\n navigator: Navigator,\n key: string,\n className: string,\n direction: NavigationDirection): vd.VNode {\n\n let onClick: (e: Event) => void =\n (e: Event): void => {\n navigator.moveDir$(direction)\n .subscribe(\n undefined,\n (error: Error): void => {\n if (!(error instanceof CancelMapillaryError)) {\n console.error(error);\n }\n });\n };\n\n let style: any = {\n height: this._calculator.turnCircleSizeCss,\n transform: \"rotate(0)\", // apply transform to preserve 3D\n width: this._calculator.turnCircleSizeCss,\n };\n\n switch (direction) {\n case NavigationDirection.TurnLeft:\n style.left = \"5px\";\n style.top = \"5px\";\n break;\n case NavigationDirection.TurnRight:\n style.right = \"5px\";\n style.top = \"5px\";\n break;\n case NavigationDirection.TurnU:\n style.left = \"5px\";\n style.bottom = \"5px\";\n break;\n default:\n break;\n }\n\n let circleProperties: vd.createProperties = {\n attributes: {\n \"data-id\": key,\n },\n onclick: onClick,\n style: style,\n };\n\n let circleClassName: string = \"mapillary-direction-turn-circle\";\n\n if (this._sequenceEdgeKeys.indexOf(key) > -1) {\n circleClassName += \"-sequence\";\n }\n\n if (this._highlightKey === key) {\n circleClassName += \"-highlight\";\n }\n\n let turn: vd.VNode = vd.h(`div.${className}`, {}, []);\n\n return vd.h(\"div.\" + circleClassName, circleProperties, [turn]);\n }\n\n private _createVNodeInactive(key: string, azimuth: number, rotation: EulerRotation): vd.VNode {\n return this._createVNode(\n key,\n azimuth,\n rotation,\n this._calculator.outerRadius,\n \"mapillary-direction-arrow-inactive\",\n \"mapillary-direction-circle-inactive\");\n }\n\n private _createVNode(\n key: string,\n azimuth: number,\n rotation: EulerRotation,\n radius: number,\n className: string,\n circleClassName: string,\n onClick?: (e: Event) => void,\n shiftVertically?: boolean): vd.VNode {\n\n let translation: number[] = this._calculator.angleToCoordinates(azimuth - rotation.phi);\n\n // rotate 90 degrees clockwise and flip over X-axis\n let translationX: number = Math.round(-radius * translation[1] + 0.5 * this._calculator.containerWidth);\n let translationY: number = Math.round(-radius * translation[0] + 0.5 * this._calculator.containerHeight);\n\n let shadowTranslation: number[] = this._calculator.relativeAngleToCoordiantes(azimuth, rotation.phi);\n let shadowOffset: number = this._calculator.shadowOffset;\n let shadowTranslationX: number = -shadowOffset * shadowTranslation[1];\n let shadowTranslationY: number = shadowOffset * shadowTranslation[0];\n\n let filter: string = `drop-shadow(${shadowTranslationX}px ${shadowTranslationY}px 1px rgba(0,0,0,0.8))`;\n\n let properties: vd.createProperties = {\n style: {\n \"-webkit-filter\": filter,\n filter: filter,\n },\n };\n\n let chevron: vd.VNode = vd.h(\"div.\" + className, properties, []);\n\n let azimuthDeg: number = -this._spatial.radToDeg(azimuth - rotation.phi);\n let circleTransform: string = shiftVertically ?\n `translate(${translationX}px, ${translationY}px) rotate(${azimuthDeg}deg) translateZ(-0.01px)` :\n `translate(${translationX}px, ${translationY}px) rotate(${azimuthDeg}deg)`;\n\n let circleProperties: vd.createProperties = {\n attributes: { \"data-id\": key },\n onclick: onClick,\n style: {\n height: this._calculator.stepCircleSizeCss,\n marginLeft: this._calculator.stepCircleMarginCss,\n marginTop: this._calculator.stepCircleMarginCss,\n transform: circleTransform,\n width: this._calculator.stepCircleSizeCss,\n },\n };\n\n if (this._sequenceEdgeKeys.indexOf(key) > -1) {\n circleClassName += \"-sequence\";\n }\n\n if (this._highlightKey === key) {\n circleClassName += \"-highlight\";\n }\n\n return vd.h(\"div.\" + circleClassName, circleProperties, [chevron]);\n }\n\n private _getContainer(\n steps: vd.VNode[],\n turns: vd.VNode[],\n rotation: EulerRotation): vd.VNode {\n\n // edge does not handle hover on perspective transforms.\n let transform: string = this._isEdge ?\n \"rotateX(60deg)\" :\n `perspective(${this._calculator.containerWidthCss}) rotateX(60deg)`;\n\n let properties: vd.createProperties = {\n oncontextmenu: (event: MouseEvent): void => { event.preventDefault(); },\n style: {\n bottom: this._calculator.containerBottomCss,\n height: this._calculator.containerHeightCss,\n left: this._calculator.containerLeftCss,\n marginLeft: this._calculator.containerMarginCss,\n transform: transform,\n width: this._calculator.containerWidthCss,\n },\n };\n\n return vd.h(\"div.mapillary-direction-perspective\", properties, turns.concat(steps));\n }\n}\n","import * as vd from \"virtual-dom\";\nimport {\n combineLatest as observableCombineLatest,\n of as observableOf,\n Observable,\n Subject,\n} from \"rxjs\";\nimport {\n catchError,\n distinctUntilChanged,\n filter,\n map,\n share,\n startWith,\n switchMap,\n tap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Image } from \"../../graph/Image\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { NavigationEdgeStatus }\n from \"../../graph/interfaces/NavigationEdgeStatus\";\nimport { Sequence } from \"../../graph/Sequence\";\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { VirtualNodeHash } from \"../../render/interfaces/VirtualNodeHash\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { Component } from \"../Component\";\nimport { DirectionConfiguration } from \"../interfaces/DirectionConfiguration\";\nimport { DirectionDOMRenderer } from \"./DirectionDOMRenderer\";\nimport { ComponentEventType } from \"../events/ComponentEventType\";\nimport { ComponentHoverEvent } from \"../events/ComponentHoverEvent\";\nimport { ComponentStateEvent } from \"../events/ComponentStateEvent\";\nimport { ComponentName } from \"../ComponentName\";\n\n/**\n * @class DirectionComponent\n * @classdesc Component showing navigation arrows for steps and turns.\n */\nexport class DirectionComponent extends Component<DirectionConfiguration> {\n /** @inheritdoc */\n public static componentName: ComponentName = \"direction\";\n\n private _renderer: DirectionDOMRenderer;\n\n private _hoveredIdSubject$: Subject<string>;\n private _hoveredId$: Observable<string>;\n\n /** @ignore */\n constructor(\n name: string,\n container: Container,\n navigator: Navigator,\n directionDOMRenderer?: DirectionDOMRenderer) {\n\n super(name, container, navigator);\n\n this._renderer = !!directionDOMRenderer ?\n directionDOMRenderer :\n new DirectionDOMRenderer(\n this.defaultConfiguration,\n { height: container.container.offsetHeight, width: container.container.offsetWidth });\n\n this._hoveredIdSubject$ = new Subject<string>();\n\n this._hoveredId$ = this._hoveredIdSubject$.pipe(share());\n }\n\n public fire(\n type: \"hover\",\n event: ComponentHoverEvent)\n : void;\n /** @ignore */\n public fire(\n type: ComponentEventType,\n event: ComponentStateEvent)\n : void;\n public fire<T>(\n type: ComponentEventType,\n event: T): void {\n super.fire(type, event);\n }\n\n public off(\n type: \"hover\",\n handler: (event: ComponentHoverEvent) => void)\n : void;\n /** @ignore */\n public off(\n type: ComponentEventType,\n handler: (event: ComponentStateEvent) => void)\n : void;\n public off<T>(\n type: ComponentEventType,\n handler: (event: T) => void): void {\n super.off(type, handler);\n }\n\n /**\n * Fired when the hovered element of a component changes.\n *\n * @event hover\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * var component = viewer.getComponent('<component-name>');\n * // Set an event listener\n * component.on('hover', function() {\n * console.log(\"A hover event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"hover\",\n handler: (event: ComponentHoverEvent) => void)\n : void;\n /** @ignore */\n public on(\n type: ComponentEventType,\n handler: (event: ComponentStateEvent) => void)\n : void;\n public on<T>(\n type: ComponentEventType,\n handler: (event: T) => void): void {\n super.on(type, handler);\n }\n\n protected _activate(): void {\n const subs = this._subscriptions;\n\n subs.push(this._configuration$\n .subscribe(\n (configuration: DirectionConfiguration): void => {\n this._renderer.setConfiguration(configuration);\n }));\n\n subs.push(this._container.renderService.size$\n .subscribe(\n (size: ViewportSize): void => {\n this._renderer.resize(size);\n }));\n\n subs.push(this._navigator.stateService.currentImage$.pipe(\n tap(\n (image: Image): void => {\n this._container.domRenderer.render$.next({ name: this._name, vNode: vd.h(\"div\", {}, []) });\n this._renderer.setImage(image);\n }),\n withLatestFrom(this._configuration$),\n switchMap(\n ([image, configuration]: [Image, DirectionConfiguration]): Observable<[NavigationEdgeStatus, Sequence]> => {\n return observableCombineLatest(\n image.spatialEdges$,\n configuration.distinguishSequence ?\n this._navigator.graphService\n .cacheSequence$(image.sequenceId).pipe(\n catchError(\n (error: Error): Observable<Sequence> => {\n console.error(`Failed to cache sequence (${image.sequenceId})`, error);\n\n return observableOf<Sequence>(null);\n })) :\n observableOf<Sequence>(null));\n }))\n .subscribe(\n ([edgeStatus, sequence]: [NavigationEdgeStatus, Sequence]): void => {\n this._renderer.setEdges(edgeStatus, sequence);\n }));\n\n subs.push(this._container.renderService.renderCameraFrame$.pipe(\n tap(\n (renderCamera: RenderCamera): void => {\n this._renderer.setRenderCamera(renderCamera);\n }),\n map(\n (): DirectionDOMRenderer => {\n return this._renderer;\n }),\n filter(\n (renderer: DirectionDOMRenderer): boolean => {\n return renderer.needsRender;\n }),\n map(\n (renderer: DirectionDOMRenderer): VirtualNodeHash => {\n return { name: this._name, vNode: renderer.render(this._navigator) };\n }))\n .subscribe(this._container.domRenderer.render$));\n\n subs.push(observableCombineLatest(\n this._container.domRenderer.element$,\n this._container.renderService.renderCamera$,\n this._container.mouseService.mouseMove$.pipe(startWith(null)),\n this._container.mouseService.mouseUp$.pipe(startWith(null))).pipe(\n map(\n ([element]: [Element, RenderCamera, MouseEvent, MouseEvent]): string => {\n let elements: HTMLCollectionOf<Element> =\n <HTMLCollectionOf<Element>>element.getElementsByClassName(\"mapillary-direction-perspective\");\n\n for (let i: number = 0; i < elements.length; i++) {\n let hovered: Element = elements.item(i).querySelector(\":hover\");\n\n if (hovered != null && hovered.hasAttribute(\"data-id\")) {\n return hovered.getAttribute(\"data-id\");\n }\n }\n\n return null;\n }),\n distinctUntilChanged())\n .subscribe(this._hoveredIdSubject$));\n\n subs.push(this._hoveredId$\n .subscribe(\n (id: string): void => {\n const type: ComponentEventType = \"hover\";\n const event: ComponentHoverEvent = {\n id,\n target: this,\n type,\n };\n this.fire(type, event);\n }));\n }\n\n protected _deactivate(): void {\n this._subscriptions.unsubscribe();\n }\n\n protected _getDefaultConfiguration(): DirectionConfiguration {\n return {\n distinguishSequence: false,\n maxWidth: 460,\n minWidth: 260,\n };\n }\n}\n","import { Shader } from \"../interfaces/Shader\";\n\nimport { sphericalFrag } from \"./spherical.fragment.glsl\";\nimport { sphericalVert } from \"./spherical.vertex.glsl\";\nimport { sphericalCurtainFrag } from \"./spherical_curtain.fragment.glsl\";\nimport { sphericalCurtainVert } from \"./spherical_curtain.vertex.glsl\";\nimport { fisheyeFrag } from \"./fisheye.fragment.glsl\";\nimport { fisheyeVert } from \"./fisheye.vertex.glsl\";\nimport { fisheyeCurtainFrag } from \"./fisheye_curtain.fragment.glsl\";\nimport { fisheyeCurtainVert } from \"./fisheye_curtain.vertex.glsl\";\nimport { perspectiveFrag } from \"./perspective.fragment.glsl\";\nimport { perspectiveVert } from \"./perspective.vertex.glsl\";\nimport { perspectiveCurtainFrag } from \"./perspective_curtain.fragment.glsl\";\nimport { perspectiveCurtainVert } from \"./perspective_curtain.vertex.glsl\";\nimport { perspectiveDistortedFrag } from \"./perspective_distorted.fragment.glsl\";\nimport { perspectiveDistortedVert } from \"./perspective_distorted.vertex.glsl\";\nimport { perspectiveDistortedCurtainFrag } from \"./perspective_distorted_curtain.fragment.glsl\";\nimport { perspectiveDistortedCurtainVert } from \"./perspective_distorted_curtain.vertex.glsl\";\n\n\nexport class Shaders {\n public static fisheye: Shader = {\n fragment: fisheyeFrag,\n vertex: fisheyeVert,\n };\n\n public static fisheyeCurtain: Shader = {\n fragment: fisheyeCurtainFrag,\n vertex: fisheyeCurtainVert,\n };\n\n public static perspective: Shader = {\n fragment: perspectiveFrag,\n vertex: perspectiveVert,\n };\n\n public static perspectiveCurtain: Shader = {\n fragment: perspectiveCurtainFrag,\n vertex: perspectiveCurtainVert,\n };\n\n public static perspectiveDistorted: Shader = {\n fragment: perspectiveDistortedFrag,\n vertex: perspectiveDistortedVert,\n };\n\n public static perspectiveDistortedCurtain: Shader = {\n fragment: perspectiveDistortedCurtainFrag,\n vertex: perspectiveDistortedCurtainVert,\n };\n\n public static spherical: Shader = {\n fragment: sphericalFrag,\n vertex: sphericalVert,\n };\n\n public static sphericalCurtain: Shader = {\n fragment: sphericalCurtainFrag,\n vertex: sphericalCurtainVert,\n };\n}\n","export const fisheyeFrag = `\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float focal;\nuniform float k1;\nuniform float k2;\nuniform float scale_x;\nuniform float scale_y;\nuniform float radial_peak;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n float x = vRstq.x;\n float y = vRstq.y;\n float z = vRstq.z;\n\n float r = sqrt(x * x + y * y);\n float theta = atan(r, z);\n\n if (radial_peak > 0. && theta > radial_peak) {\n theta = radial_peak;\n }\n\n float theta2 = theta * theta;\n float theta_d = theta * (1.0 + theta2 * (k1 + theta2 * k2));\n float s = focal * theta_d / r;\n\n float u = scale_x * s * x + 0.5;\n float v = -scale_y * s * y + 0.5;\n\n vec4 baseColor;\n if (u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n baseColor = texture2D(projectorTex, vec2(u, v));\n baseColor.a = opacity;\n } else {\n baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n\n gl_FragColor = baseColor;\n}\n`\n","export const fisheyeVert = `\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n`\n","export const fisheyeCurtainFrag = `\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float focal;\nuniform float k1;\nuniform float k2;\nuniform float scale_x;\nuniform float scale_y;\nuniform float radial_peak;\nuniform float curtain;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n float x = vRstq.x;\n float y = vRstq.y;\n float z = vRstq.z;\n\n float r2 = sqrt(x * x + y * y);\n float theta = atan(r2, z);\n\n if (radial_peak > 0. && theta > radial_peak) {\n theta = radial_peak;\n }\n\n float theta2 = theta * theta;\n float theta_d = theta * (1.0 + theta2 * (k1 + theta2 * k2));\n float s = focal * theta_d / r2;\n\n float u = scale_x * s * x + 0.5;\n float v = -scale_y * s * y + 0.5;\n\n vec4 baseColor;\n if ((u < curtain || curtain >= 1.0) && u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n baseColor = texture2D(projectorTex, vec2(u, v));\n baseColor.a = opacity;\n } else {\n baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n\n gl_FragColor = baseColor;\n}\n`\n","export const fisheyeCurtainVert = `\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n`\n","export const perspectiveFrag = `\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float focal;\nuniform float k1;\nuniform float k2;\nuniform float scale_x;\nuniform float scale_y;\nuniform float radial_peak;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n float x = vRstq.x / vRstq.z;\n float y = vRstq.y / vRstq.z;\n float r2 = x * x + y * y;\n\n if (radial_peak > 0. && r2 > radial_peak * sqrt(r2)) {\n r2 = radial_peak * radial_peak;\n }\n\n float d = 1.0 + k1 * r2 + k2 * r2 * r2;\n float u = scale_x * focal * d * x + 0.5;\n float v = - scale_y * focal * d * y + 0.5;\n\n vec4 baseColor;\n if (u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n baseColor = texture2D(projectorTex, vec2(u, v));\n baseColor.a = opacity;\n } else {\n baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n\n gl_FragColor = baseColor;\n}\n`\n","export const perspectiveVert = `\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n`\n","export const perspectiveCurtainFrag = `\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float focal;\nuniform float k1;\nuniform float k2;\nuniform float scale_x;\nuniform float scale_y;\nuniform float radial_peak;\nuniform float curtain;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n float x = vRstq.x / vRstq.z;\n float y = vRstq.y / vRstq.z;\n float r2 = x * x + y * y;\n\n if (radial_peak > 0. && r2 > radial_peak * sqrt(r2)) {\n r2 = radial_peak * radial_peak;\n }\n\n float d = 1.0 + k1 * r2 + k2 * r2 * r2;\n float u = scale_x * focal * d * x + 0.5;\n float v = - scale_y * focal * d * y + 0.5;\n\n vec4 baseColor;\n if ((u < curtain || curtain >= 1.0) && u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n baseColor = texture2D(projectorTex, vec2(u, v));\n baseColor.a = opacity;\n } else {\n baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n\n gl_FragColor = baseColor;\n}\n`\n","export const perspectiveCurtainVert = `\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n`\n","export const perspectiveDistortedFrag = `\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n float u = vRstq.x / vRstq.w;\n float v = vRstq.y / vRstq.w;\n\n vec4 baseColor;\n if (u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n baseColor = texture2D(projectorTex, vec2(u, v));\n baseColor.a = opacity;\n } else {\n baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n\n gl_FragColor = baseColor;\n}\n`\n","export const perspectiveDistortedVert = `\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n`\n","export const perspectiveDistortedCurtainFrag = `\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D projectorTex;\nuniform float opacity;\nuniform float curtain;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n float u = vRstq.x / vRstq.w;\n float v = vRstq.y / vRstq.w;\n\n vec4 baseColor;\n if ((u < curtain || curtain >= 1.0) && u >= 0. && u <= 1. && v >= 0. && v <= 1.) {\n baseColor = texture2D(projectorTex, vec2(u, v));\n baseColor.a = opacity;\n } else {\n baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n\n gl_FragColor = baseColor;\n}\n`\n","export const perspectiveDistortedCurtainVert = `\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n`\n","export const sphericalFrag = `\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\n#define tau 6.28318530718\n\nuniform sampler2D projectorTex;\nuniform float opacity;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vec3 b = normalize(vRstq.xyz);\n float lat = -asin(b.y);\n float lng = atan(b.x, b.z);\n float x = lng / tau + 0.5;\n float y = lat / tau * 2.0 + 0.5;\n vec4 baseColor = texture2D(projectorTex, vec2(x, y));\n baseColor.a = opacity;\n gl_FragColor = baseColor;\n}\n`\n","export const sphericalVert = `\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n`\n","export const sphericalCurtainFrag = `\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\n#define tau 6.28318530718\n\nuniform sampler2D projectorTex;\nuniform float curtain;\nuniform float opacity;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vec3 b = normalize(vRstq.xyz);\n float lat = -asin(b.y);\n float lng = atan(b.x, b.z);\n float x = lng / tau + 0.5;\n float y = lat / tau * 2.0 + 0.5;\n\n bool inverted = curtain < 0.5;\n\n float curtainMin = inverted ? curtain + 0.5 : curtain - 0.5;\n float curtainMax = curtain;\n\n bool insideCurtain = inverted ?\n x > curtainMin || x < curtainMax :\n x > curtainMin && x < curtainMax;\n\n vec4 baseColor;\n if (insideCurtain) {\n baseColor = texture2D(projectorTex, vec2(x, y));\n baseColor.a = opacity;\n } else {\n baseColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n\n gl_FragColor = baseColor;\n}\n`\n","export const sphericalCurtainVert = `\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 projectorMat;\n\nvarying vec4 vRstq;\n\nvoid main()\n{\n vRstq = projectorMat * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n`\n","import * as THREE from \"three\";\n\nimport { Shaders } from \"../shaders/Shaders\";\n\nimport { Transform } from \"../../geo/Transform\";\nimport { Image } from \"../../graph/Image\";\nimport { isFisheye, isSpherical } from \"../../geo/Geo\";\n\nexport class MeshFactory {\n private _imagePlaneDepth: number;\n private _imageSphereRadius: number;\n\n constructor(imagePlaneDepth?: number, imageSphereRadius?: number) {\n this._imagePlaneDepth = imagePlaneDepth != null ? imagePlaneDepth : 200;\n this._imageSphereRadius = imageSphereRadius != null ? imageSphereRadius : 200;\n }\n\n public createMesh(image: Image, transform: Transform): THREE.Mesh {\n if (isSpherical(transform.cameraType)) {\n return this._createImageSphere(image, transform);\n } else if (isFisheye(transform.cameraType)) {\n return this._createImagePlaneFisheye(image, transform);\n } else {\n return this._createImagePlane(image, transform);\n }\n }\n\n public createFlatMesh(\n image: Image,\n transform: Transform,\n basicX0: number,\n basicX1: number,\n basicY0: number,\n basicY1: number): THREE.Mesh {\n\n let texture: THREE.Texture = this._createTexture(image.image);\n let materialParameters: THREE.ShaderMaterialParameters =\n this._createDistortedPlaneMaterialParameters(transform, texture);\n let material: THREE.ShaderMaterial = new THREE.ShaderMaterial(materialParameters);\n\n let geometry: THREE.BufferGeometry = this._getFlatImagePlaneGeoFromBasic(transform, basicX0, basicX1, basicY0, basicY1);\n\n return new THREE.Mesh(geometry, material);\n }\n\n public createCurtainMesh(image: Image, transform: Transform): THREE.Mesh {\n if (isSpherical(transform.cameraType)) {\n return this._createSphereCurtainMesh(image, transform);\n } else if (isFisheye(transform.cameraType)) {\n return this._createCurtainMeshFisheye(image, transform);\n } else {\n return this._createCurtainMesh(image, transform);\n }\n }\n\n public createDistortedCurtainMesh(image: Image, transform: Transform): THREE.Mesh {\n return this._createDistortedCurtainMesh(image, transform);\n }\n\n private _createCurtainMesh(image: Image, transform: Transform): THREE.Mesh {\n let texture: THREE.Texture = this._createTexture(image.image);\n let materialParameters: THREE.ShaderMaterialParameters =\n this._createCurtainPlaneMaterialParameters(transform, texture);\n let material: THREE.ShaderMaterial = new THREE.ShaderMaterial(materialParameters);\n\n let geometry: THREE.BufferGeometry = this._useMesh(transform, image) ?\n this._getImagePlaneGeo(transform, image) :\n this._getRegularFlatImagePlaneGeo(transform);\n\n return new THREE.Mesh(geometry, material);\n }\n\n private _createCurtainMeshFisheye(image: Image, transform: Transform): THREE.Mesh {\n let texture: THREE.Texture = this._createTexture(image.image);\n let materialParameters: THREE.ShaderMaterialParameters =\n this._createCurtainPlaneMaterialParametersFisheye(transform, texture);\n let material: THREE.ShaderMaterial = new THREE.ShaderMaterial(materialParameters);\n\n let geometry: THREE.BufferGeometry = this._useMesh(transform, image) ?\n this._getImagePlaneGeoFisheye(transform, image) :\n this._getRegularFlatImagePlaneGeo(transform);\n\n return new THREE.Mesh(geometry, material);\n }\n\n private _createDistortedCurtainMesh(image: Image, transform: Transform): THREE.Mesh {\n let texture: THREE.Texture = this._createTexture(image.image);\n let materialParameters: THREE.ShaderMaterialParameters =\n this._createDistortedCurtainPlaneMaterialParameters(transform, texture);\n let material: THREE.ShaderMaterial = new THREE.ShaderMaterial(materialParameters);\n\n let geometry: THREE.BufferGeometry = this._getRegularFlatImagePlaneGeo(transform);\n\n return new THREE.Mesh(geometry, material);\n }\n\n private _createSphereCurtainMesh(image: Image, transform: Transform): THREE.Mesh {\n let texture: THREE.Texture = this._createTexture(image.image);\n let materialParameters: THREE.ShaderMaterialParameters =\n this._createCurtainSphereMaterialParameters(transform, texture);\n let material: THREE.ShaderMaterial = new THREE.ShaderMaterial(materialParameters);\n\n return this._useMesh(transform, image) ?\n new THREE.Mesh(this._getImageSphereGeo(transform, image), material) :\n new THREE.Mesh(this._getFlatImageSphereGeo(transform), material);\n }\n\n private _createImageSphere(image: Image, transform: Transform): THREE.Mesh {\n let texture: THREE.Texture = this._createTexture(image.image);\n let materialParameters: THREE.ShaderMaterialParameters = this._createSphereMaterialParameters(transform, texture);\n let material: THREE.ShaderMaterial = new THREE.ShaderMaterial(materialParameters);\n\n let mesh: THREE.Mesh = this._useMesh(transform, image) ?\n new THREE.Mesh(this._getImageSphereGeo(transform, image), material) :\n new THREE.Mesh(this._getFlatImageSphereGeo(transform), material);\n\n return mesh;\n }\n\n private _createImagePlane(image: Image, transform: Transform): THREE.Mesh {\n let texture: THREE.Texture = this._createTexture(image.image);\n let materialParameters: THREE.ShaderMaterialParameters = this._createPlaneMaterialParameters(transform, texture);\n let material: THREE.ShaderMaterial = new THREE.ShaderMaterial(materialParameters);\n\n let geometry: THREE.BufferGeometry = this._useMesh(transform, image) ?\n this._getImagePlaneGeo(transform, image) :\n this._getRegularFlatImagePlaneGeo(transform);\n\n return new THREE.Mesh(geometry, material);\n }\n\n private _createImagePlaneFisheye(image: Image, transform: Transform): THREE.Mesh {\n let texture: THREE.Texture = this._createTexture(image.image);\n let materialParameters: THREE.ShaderMaterialParameters = this._createPlaneMaterialParametersFisheye(transform, texture);\n let material: THREE.ShaderMaterial = new THREE.ShaderMaterial(materialParameters);\n\n let geometry: THREE.BufferGeometry = this._useMesh(transform, image) ?\n this._getImagePlaneGeoFisheye(transform, image) :\n this._getRegularFlatImagePlaneGeoFisheye(transform);\n\n return new THREE.Mesh(geometry, material);\n }\n\n private _createSphereMaterialParameters(transform: Transform, texture: THREE.Texture): THREE.ShaderMaterialParameters {\n let materialParameters: THREE.ShaderMaterialParameters = {\n depthWrite: false,\n fragmentShader: Shaders.spherical.fragment,\n side: THREE.DoubleSide,\n transparent: true,\n uniforms: {\n opacity: { value: 1.0 },\n projectorMat: { value: transform.rt },\n projectorTex: { value: texture },\n },\n vertexShader: Shaders.spherical.vertex,\n };\n\n return materialParameters;\n }\n\n private _createCurtainSphereMaterialParameters(transform: Transform, texture: THREE.Texture): THREE.ShaderMaterialParameters {\n let materialParameters: THREE.ShaderMaterialParameters = {\n depthWrite: false,\n fragmentShader: Shaders.sphericalCurtain.fragment,\n side: THREE.DoubleSide,\n transparent: true,\n uniforms: {\n curtain: { value: 1.0 },\n opacity: { value: 1.0 },\n projectorMat: { value: transform.rt },\n projectorTex: { value: texture },\n },\n vertexShader: Shaders.sphericalCurtain.vertex,\n };\n\n return materialParameters;\n }\n\n private _createPlaneMaterialParameters(transform: Transform, texture: THREE.Texture): THREE.ShaderMaterialParameters {\n let materialParameters: THREE.ShaderMaterialParameters = {\n depthWrite: false,\n fragmentShader: Shaders.perspective.fragment,\n side: THREE.DoubleSide,\n transparent: true,\n uniforms: {\n focal: { value: transform.focal },\n k1: { value: transform.ck1 },\n k2: { value: transform.ck2 },\n opacity: { value: 1.0 },\n projectorMat: { value: transform.basicRt },\n projectorTex: { value: texture },\n radial_peak: { value: !!transform.radialPeak ? transform.radialPeak : 0.0 },\n scale_x: { value: Math.max(transform.basicHeight, transform.basicWidth) / transform.basicWidth },\n scale_y: { value: Math.max(transform.basicWidth, transform.basicHeight) / transform.basicHeight },\n },\n vertexShader: Shaders.perspective.vertex,\n };\n\n return materialParameters;\n }\n\n private _createPlaneMaterialParametersFisheye(transform: Transform, texture: THREE.Texture): THREE.ShaderMaterialParameters {\n let materialParameters: THREE.ShaderMaterialParameters = {\n depthWrite: false,\n fragmentShader: Shaders.fisheye.fragment,\n side: THREE.DoubleSide,\n transparent: true,\n uniforms: {\n focal: { value: transform.focal },\n k1: { value: transform.ck1 },\n k2: { value: transform.ck2 },\n opacity: { value: 1.0 },\n projectorMat: { value: transform.basicRt },\n projectorTex: { value: texture },\n radial_peak: { value: !!transform.radialPeak ? transform.radialPeak : 0.0 },\n scale_x: { value: Math.max(transform.basicHeight, transform.basicWidth) / transform.basicWidth },\n scale_y: { value: Math.max(transform.basicWidth, transform.basicHeight) / transform.basicHeight },\n },\n vertexShader: Shaders.fisheye.vertex,\n };\n\n return materialParameters;\n }\n\n private _createCurtainPlaneMaterialParametersFisheye(transform: Transform, texture: THREE.Texture): THREE.ShaderMaterialParameters {\n let materialParameters: THREE.ShaderMaterialParameters = {\n depthWrite: false,\n fragmentShader: Shaders.fisheyeCurtain.fragment,\n side: THREE.DoubleSide,\n transparent: true,\n uniforms: {\n curtain: { value: 1.0 },\n focal: { value: transform.focal },\n k1: { value: transform.ck1 },\n k2: { value: transform.ck2 },\n opacity: { value: 1.0 },\n projectorMat: { value: transform.basicRt },\n projectorTex: { value: texture },\n radial_peak: { value: !!transform.radialPeak ? transform.radialPeak : 0.0 },\n scale_x: { value: Math.max(transform.basicHeight, transform.basicWidth) / transform.basicWidth },\n scale_y: { value: Math.max(transform.basicWidth, transform.basicHeight) / transform.basicHeight },\n },\n vertexShader: Shaders.fisheyeCurtain.vertex,\n };\n\n return materialParameters;\n }\n\n private _createCurtainPlaneMaterialParameters(transform: Transform, texture: THREE.Texture): THREE.ShaderMaterialParameters {\n let materialParameters: THREE.ShaderMaterialParameters = {\n depthWrite: false,\n fragmentShader: Shaders.perspectiveCurtain.fragment,\n side: THREE.DoubleSide,\n transparent: true,\n uniforms: {\n curtain: { value: 1.0 },\n focal: { value: transform.focal },\n k1: { value: transform.ck1 },\n k2: { value: transform.ck2 },\n opacity: { value: 1.0 },\n projectorMat: { value: transform.basicRt },\n projectorTex: { value: texture },\n radial_peak: { value: !!transform.radialPeak ? transform.radialPeak : 0.0 },\n scale_x: { value: Math.max(transform.basicHeight, transform.basicWidth) / transform.basicWidth },\n scale_y: { value: Math.max(transform.basicWidth, transform.basicHeight) / transform.basicHeight },\n },\n vertexShader: Shaders.perspectiveCurtain.vertex,\n };\n\n return materialParameters;\n }\n\n private _createDistortedCurtainPlaneMaterialParameters(transform: Transform, texture: THREE.Texture): THREE.ShaderMaterialParameters {\n let materialParameters: THREE.ShaderMaterialParameters = {\n depthWrite: false,\n fragmentShader: Shaders.perspectiveDistortedCurtain.fragment,\n side: THREE.DoubleSide,\n transparent: true,\n uniforms: {\n curtain: { value: 1.0 },\n opacity: { value: 1.0 },\n projectorMat: { value: transform.projectorMatrix() },\n projectorTex: { value: texture },\n },\n vertexShader: Shaders.perspectiveDistortedCurtain.vertex,\n };\n\n return materialParameters;\n }\n\n private _createDistortedPlaneMaterialParameters(transform: Transform, texture: THREE.Texture): THREE.ShaderMaterialParameters {\n let materialParameters: THREE.ShaderMaterialParameters = {\n depthWrite: false,\n fragmentShader: Shaders.perspectiveDistorted.fragment,\n side: THREE.DoubleSide,\n transparent: true,\n uniforms: {\n opacity: { value: 1.0 },\n projectorMat: { value: transform.projectorMatrix() },\n projectorTex: { value: texture },\n },\n vertexShader: Shaders.perspectiveDistorted.vertex,\n };\n\n return materialParameters;\n }\n\n private _createTexture(image: HTMLImageElement): THREE.Texture {\n let texture: THREE.Texture = new THREE.Texture(image);\n texture.minFilter = THREE.LinearFilter;\n texture.needsUpdate = true;\n\n return texture;\n }\n\n private _useMesh(transform: Transform, image: Image): boolean {\n return image.mesh.vertices.length && transform.hasValidScale;\n }\n\n private _getImageSphereGeo(transform: Transform, image: Image): THREE.BufferGeometry {\n const t = transform.srtInverse;\n\n // push everything at least 5 meters in front of the camera\n let minZ: number = 5.0 * transform.scale;\n let maxZ: number = this._imageSphereRadius * transform.scale;\n\n let vertices: number[] = image.mesh.vertices;\n let numVertices: number = vertices.length / 3;\n let positions: Float32Array = new Float32Array(vertices.length);\n for (let i: number = 0; i < numVertices; ++i) {\n let index: number = 3 * i;\n let x: number = vertices[index + 0];\n let y: number = vertices[index + 1];\n let z: number = vertices[index + 2];\n\n let l: number = Math.sqrt(x * x + y * y + z * z);\n let boundedL: number = Math.max(minZ, Math.min(l, maxZ));\n let factor: number = boundedL / l;\n let p: THREE.Vector3 = new THREE.Vector3(x * factor, y * factor, z * factor);\n\n p.applyMatrix4(t);\n\n positions[index + 0] = p.x;\n positions[index + 1] = p.y;\n positions[index + 2] = p.z;\n }\n\n let faces: number[] = image.mesh.faces;\n let indices: Uint16Array = new Uint16Array(faces.length);\n for (let i: number = 0; i < faces.length; ++i) {\n indices[i] = faces[i];\n }\n\n let geometry: THREE.BufferGeometry = new THREE.BufferGeometry();\n\n geometry.setAttribute(\"position\", new THREE.BufferAttribute(positions, 3));\n geometry.setIndex(new THREE.BufferAttribute(indices, 1));\n\n return geometry;\n }\n\n private _getImagePlaneGeo(transform: Transform, image: Image): THREE.BufferGeometry {\n const undistortionMarginFactor: number = 3;\n const t = transform.srtInverse;\n\n // push everything at least 5 meters in front of the camera\n let minZ: number = 5.0 * transform.scale;\n let maxZ: number = this._imagePlaneDepth * transform.scale;\n\n let vertices: number[] = image.mesh.vertices;\n let numVertices: number = vertices.length / 3;\n let positions: Float32Array = new Float32Array(vertices.length);\n for (let i: number = 0; i < numVertices; ++i) {\n let index: number = 3 * i;\n let x: number = vertices[index + 0];\n let y: number = vertices[index + 1];\n let z: number = vertices[index + 2];\n\n if (i < 4) {\n x *= undistortionMarginFactor;\n y *= undistortionMarginFactor;\n }\n\n let boundedZ: number = Math.max(minZ, Math.min(z, maxZ));\n let factor: number = boundedZ / z;\n let p: THREE.Vector3 = new THREE.Vector3(x * factor, y * factor, boundedZ);\n\n p.applyMatrix4(t);\n\n positions[index + 0] = p.x;\n positions[index + 1] = p.y;\n positions[index + 2] = p.z;\n }\n\n let faces: number[] = image.mesh.faces;\n let indices: Uint16Array = new Uint16Array(faces.length);\n for (let i: number = 0; i < faces.length; ++i) {\n indices[i] = faces[i];\n }\n\n let geometry: THREE.BufferGeometry = new THREE.BufferGeometry();\n\n geometry.setAttribute(\"position\", new THREE.BufferAttribute(positions, 3));\n geometry.setIndex(new THREE.BufferAttribute(indices, 1));\n\n return geometry;\n }\n\n private _getImagePlaneGeoFisheye(transform: Transform, image: Image): THREE.BufferGeometry {\n const t = transform.srtInverse;\n\n // push everything at least 5 meters in front of the camera\n let minZ: number = 5.0 * transform.scale;\n let maxZ: number = this._imagePlaneDepth * transform.scale;\n\n let vertices: number[] = image.mesh.vertices;\n let numVertices: number = vertices.length / 3;\n let positions: Float32Array = new Float32Array(vertices.length);\n for (let i: number = 0; i < numVertices; ++i) {\n let index: number = 3 * i;\n let x: number = vertices[index + 0];\n let y: number = vertices[index + 1];\n let z: number = vertices[index + 2];\n\n let l: number = Math.sqrt(x * x + y * y + z * z);\n let boundedL: number = Math.max(minZ, Math.min(l, maxZ));\n let factor: number = boundedL / l;\n let p: THREE.Vector3 = new THREE.Vector3(x * factor, y * factor, z * factor);\n\n p.applyMatrix4(t);\n\n positions[index + 0] = p.x;\n positions[index + 1] = p.y;\n positions[index + 2] = p.z;\n }\n\n let faces: number[] = image.mesh.faces;\n let indices: Uint16Array = new Uint16Array(faces.length);\n for (let i: number = 0; i < faces.length; ++i) {\n indices[i] = faces[i];\n }\n\n let geometry: THREE.BufferGeometry = new THREE.BufferGeometry();\n\n geometry.setAttribute(\"position\", new THREE.BufferAttribute(positions, 3));\n geometry.setIndex(new THREE.BufferAttribute(indices, 1));\n\n return geometry;\n }\n\n private _getFlatImageSphereGeo(transform: Transform): THREE.BufferGeometry {\n const geometry =\n new THREE.SphereGeometry(this._imageSphereRadius, 20, 40);\n const t = transform.rt\n .clone()\n .invert();\n geometry.applyMatrix4(t);\n return geometry;\n }\n\n private _getRegularFlatImagePlaneGeo(transform: Transform): THREE.BufferGeometry {\n let width: number = transform.width;\n let height: number = transform.height;\n let size: number = Math.max(width, height);\n let dx: number = width / 2.0 / size;\n let dy: number = height / 2.0 / size;\n\n return this._getFlatImagePlaneGeo(transform, dx, dy);\n }\n\n private _getFlatImagePlaneGeo(transform: Transform, dx: number, dy: number): THREE.BufferGeometry {\n let vertices: number[][] = [];\n vertices.push(transform.unprojectSfM([-dx, -dy], this._imagePlaneDepth));\n vertices.push(transform.unprojectSfM([dx, -dy], this._imagePlaneDepth));\n vertices.push(transform.unprojectSfM([dx, dy], this._imagePlaneDepth));\n vertices.push(transform.unprojectSfM([-dx, dy], this._imagePlaneDepth));\n\n return this._createFlatGeometry(vertices);\n }\n\n private _getRegularFlatImagePlaneGeoFisheye(transform: Transform): THREE.BufferGeometry {\n let width: number = transform.width;\n let height: number = transform.height;\n let size: number = Math.max(width, height);\n let dx: number = width / 2.0 / size;\n let dy: number = height / 2.0 / size;\n\n return this._getFlatImagePlaneGeoFisheye(transform, dx, dy);\n }\n\n private _getFlatImagePlaneGeoFisheye(transform: Transform, dx: number, dy: number): THREE.BufferGeometry {\n let vertices: number[][] = [];\n vertices.push(transform.unprojectSfM([-dx, -dy], this._imagePlaneDepth));\n vertices.push(transform.unprojectSfM([dx, -dy], this._imagePlaneDepth));\n vertices.push(transform.unprojectSfM([dx, dy], this._imagePlaneDepth));\n vertices.push(transform.unprojectSfM([-dx, dy], this._imagePlaneDepth));\n\n return this._createFlatGeometry(vertices);\n }\n\n private _getFlatImagePlaneGeoFromBasic(\n transform: Transform,\n basicX0: number,\n basicX1: number,\n basicY0: number,\n basicY1: number): THREE.BufferGeometry {\n\n let vertices: number[][] = [];\n\n vertices.push(transform.unprojectBasic([basicX0, basicY0], this._imagePlaneDepth));\n vertices.push(transform.unprojectBasic([basicX1, basicY0], this._imagePlaneDepth));\n vertices.push(transform.unprojectBasic([basicX1, basicY1], this._imagePlaneDepth));\n vertices.push(transform.unprojectBasic([basicX0, basicY1], this._imagePlaneDepth));\n\n return this._createFlatGeometry(vertices);\n }\n\n private _createFlatGeometry(vertices: number[][]): THREE.BufferGeometry {\n let positions: Float32Array = new Float32Array(12);\n for (let i: number = 0; i < vertices.length; i++) {\n let index: number = 3 * i;\n positions[index + 0] = vertices[i][0];\n positions[index + 1] = vertices[i][1];\n positions[index + 2] = vertices[i][2];\n }\n\n let indices: Uint16Array = new Uint16Array(6);\n indices[0] = 0;\n indices[1] = 1;\n indices[2] = 3;\n indices[3] = 1;\n indices[4] = 2;\n indices[5] = 3;\n\n let geometry: THREE.BufferGeometry = new THREE.BufferGeometry();\n\n geometry.setAttribute(\"position\", new THREE.BufferAttribute(positions, 3));\n geometry.setIndex(new THREE.BufferAttribute(indices, 1));\n\n return geometry;\n }\n}\n","import * as THREE from \"three\";\n\nimport { ProjectorShaderMaterial } from \"../image/interfaces/ProjectorShaderMaterial\";\n\nexport class MeshScene {\n private _planes: { [key: string]: THREE.Mesh };\n private _planesOld: { [key: string]: THREE.Mesh };\n private _planesPeriphery: { [key: string]: THREE.Mesh };\n\n private _scene: THREE.Scene;\n private _sceneOld: THREE.Scene;\n private _scenePeriphery: THREE.Scene;\n\n constructor() {\n this._planes = {};\n this._planesOld = {};\n this._planesPeriphery = {};\n\n this._scene = new THREE.Scene();\n this._sceneOld = new THREE.Scene();\n this._scenePeriphery = new THREE.Scene();\n }\n\n public get planes(): { [key: string]: THREE.Mesh } {\n return this._planes;\n }\n\n public get planesOld(): { [key: string]: THREE.Mesh } {\n return this._planesOld;\n }\n\n public get planesPeriphery(): { [key: string]: THREE.Mesh } {\n return this._planesPeriphery;\n }\n\n public get scene(): THREE.Scene {\n return this._scene;\n }\n\n public get sceneOld(): THREE.Scene {\n return this._sceneOld;\n }\n\n public get scenePeriphery(): THREE.Scene {\n return this._scenePeriphery;\n }\n\n public updateImagePlanes(planes: { [key: string]: THREE.Mesh }): void {\n this._dispose(this._planesOld, this.sceneOld);\n\n for (const key in this._planes) {\n if (!this._planes.hasOwnProperty(key)) {\n continue;\n\n }\n\n const plane: THREE.Mesh = this._planes[key];\n this._scene.remove(plane);\n this._sceneOld.add(plane);\n }\n\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n this._scene.add(planes[key]);\n }\n\n this._planesOld = this._planes;\n this._planes = planes;\n }\n\n public addImagePlanes(planes: { [key: string]: THREE.Mesh }): void {\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planes[key];\n this._scene.add(plane);\n this._planes[key] = plane;\n }\n }\n\n public addImagePlanesOld(planes: { [key: string]: THREE.Mesh }): void {\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planes[key];\n this._sceneOld.add(plane);\n this._planesOld[key] = plane;\n }\n }\n\n public setImagePlanes(planes: { [key: string]: THREE.Mesh }): void {\n this._clear();\n this.addImagePlanes(planes);\n }\n\n public addPeripheryPlanes(planes: { [key: string]: THREE.Mesh }): void {\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planes[key];\n this._scenePeriphery.add(plane);\n this._planesPeriphery[key] = plane;\n }\n }\n\n public setPeripheryPlanes(planes: { [key: string]: THREE.Mesh }): void {\n this._clearPeriphery();\n this.addPeripheryPlanes(planes);\n }\n\n public setImagePlanesOld(planes: { [key: string]: THREE.Mesh }): void {\n this._clearOld();\n this.addImagePlanesOld(planes);\n }\n\n public clear(): void {\n this._clear();\n this._clearOld();\n }\n\n private _clear(): void {\n this._dispose(this._planes, this._scene);\n this._planes = {};\n }\n\n private _clearOld(): void {\n this._dispose(this._planesOld, this._sceneOld);\n this._planesOld = {};\n }\n\n private _clearPeriphery(): void {\n this._dispose(this._planesPeriphery, this._scenePeriphery);\n this._planesPeriphery = {};\n }\n\n private _dispose(planes: { [key: string]: THREE.Mesh }, scene: THREE.Scene): void {\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planes[key];\n scene.remove(plane);\n plane.geometry.dispose();\n (<THREE.Material>plane.material).dispose();\n let texture: THREE.Texture = (<ProjectorShaderMaterial>plane.material).uniforms.projectorTex.value;\n if (texture != null) {\n texture.dispose();\n }\n }\n }\n}\n","import * as THREE from \"three\";\nimport { Subscription } from \"rxjs\";\n\nimport { IAnimationState } from \"../../state/interfaces/IAnimationState\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { Image } from \"../../graph/Image\";\nimport { Transform } from \"../../geo/Transform\";\nimport { TextureProvider } from \"../../tile/TextureProvider\";\nimport { MeshFactory } from \"../util/MeshFactory\";\nimport { MeshScene } from \"../util/MeshScene\";\nimport { ProjectorShaderMaterial } from \"./interfaces/ProjectorShaderMaterial\";\n\nexport class ImageGLRenderer {\n private _factory: MeshFactory;\n private _scene: MeshScene;\n\n private _alpha: number;\n private _alphaOld: number;\n private _fadeOutSpeed: number;\n\n private _currentKey: string;\n private _previousKey: string;\n private _providerDisposers: { [key: string]: () => void };\n\n private _frameId: number;\n private _needsRender: boolean;\n\n constructor() {\n this._factory = new MeshFactory();\n this._scene = new MeshScene();\n\n this._alpha = 0;\n this._alphaOld = 0;\n this._fadeOutSpeed = 0.05;\n\n this._currentKey = null;\n this._previousKey = null;\n this._providerDisposers = {};\n\n this._frameId = 0;\n this._needsRender = false;\n }\n\n public get frameId(): number {\n return this._frameId;\n }\n\n public get needsRender(): boolean {\n return this._needsRender;\n }\n\n public indicateNeedsRender(): void {\n this._needsRender = true;\n }\n\n public addPeripheryPlane(image: Image, transform: Transform): void {\n const mesh: THREE.Mesh = this._factory.createMesh(image, transform);\n const planes: { [key: string]: THREE.Mesh } = {};\n planes[image.id] = mesh;\n this._scene.addPeripheryPlanes(planes);\n\n this._needsRender = true;\n }\n\n public clearPeripheryPlanes(): void {\n this._scene.setPeripheryPlanes({});\n\n this._needsRender = true;\n }\n\n public updateFrame(frame: AnimationFrame): void {\n this._updateFrameId(frame.id);\n this._needsRender = this._updateAlpha(frame.state.alpha) || this._needsRender;\n this._needsRender = this._updateAlphaOld(frame.state.alpha) || this._needsRender;\n this._needsRender = this._updateImagePlanes(frame.state) || this._needsRender;\n }\n\n public setTextureProvider(key: string, provider: TextureProvider): void {\n if (key !== this._currentKey) {\n return;\n }\n\n let createdSubscription: Subscription = provider.textureCreated$\n .subscribe(\n (texture: THREE.Texture): void => {\n this._updateTexture(texture);\n });\n\n let updatedSubscription: Subscription = provider.textureUpdated$\n .subscribe(\n (updated: boolean): void => {\n this._needsRender = true;\n });\n\n let dispose: () => void = (): void => {\n createdSubscription.unsubscribe();\n updatedSubscription.unsubscribe();\n provider.dispose();\n };\n\n if (key in this._providerDisposers) {\n let disposeProvider: () => void = this._providerDisposers[key];\n disposeProvider();\n\n delete this._providerDisposers[key];\n }\n\n this._providerDisposers[key] = dispose;\n }\n\n public updateTextureImage(\n imageElement: HTMLImageElement,\n image: Image)\n : void {\n this._needsRender = true;\n\n const planes: { [key: string]: THREE.Mesh } =\n this._extend({}, this._scene.planes, this._scene.planesOld, this._scene.planesPeriphery);\n\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n if (key !== image.id) {\n continue;\n }\n\n const plane: THREE.Mesh = planes[key];\n\n let material: ProjectorShaderMaterial = <ProjectorShaderMaterial>plane.material;\n let texture: THREE.Texture = <THREE.Texture>material.uniforms.projectorTex.value;\n\n texture.image = imageElement;\n texture.needsUpdate = true;\n }\n }\n\n public render(\n perspectiveCamera: THREE.PerspectiveCamera,\n renderer: THREE.WebGLRenderer): void {\n\n const planes: { [key: string]: THREE.Mesh } = this._scene.planes;\n const planesOld: { [key: string]: THREE.Mesh } = this._scene.planesOld;\n const planesPeriphery: { [key: string]: THREE.Mesh } = this._scene.planesPeriphery;\n\n const planeAlpha: number = Object.keys(planesOld).length ? 1 : this._alpha;\n const peripheryAlpha: number = Object.keys(planesOld).length ? 1 : Math.floor(this._alpha);\n\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planes[key];\n (<ProjectorShaderMaterial>plane.material).uniforms.opacity.value = planeAlpha;\n }\n\n for (const key in planesOld) {\n if (!planesOld.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planesOld[key];\n (<ProjectorShaderMaterial>plane.material).uniforms.opacity.value = this._alphaOld;\n }\n\n for (const key in planesPeriphery) {\n if (!planesPeriphery.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planesPeriphery[key];\n (<ProjectorShaderMaterial>plane.material).uniforms.opacity.value = peripheryAlpha;\n }\n\n renderer.render(this._scene.scenePeriphery, perspectiveCamera);\n renderer.render(this._scene.scene, perspectiveCamera);\n renderer.render(this._scene.sceneOld, perspectiveCamera);\n\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planes[key];\n (<ProjectorShaderMaterial>plane.material).uniforms.opacity.value = this._alpha;\n }\n\n renderer.render(this._scene.scene, perspectiveCamera);\n }\n\n public clearNeedsRender(): void {\n this._needsRender = false;\n }\n\n public dispose(): void {\n this._scene.clear();\n }\n\n private _updateFrameId(frameId: number): void {\n this._frameId = frameId;\n }\n\n private _updateAlpha(alpha: number): boolean {\n if (alpha === this._alpha) {\n return false;\n }\n\n this._alpha = alpha;\n\n return true;\n }\n\n private _updateAlphaOld(alpha: number): boolean {\n if (alpha < 1 || this._alphaOld === 0) {\n return false;\n }\n\n this._alphaOld = Math.max(0, this._alphaOld - this._fadeOutSpeed);\n\n return true;\n }\n\n private _updateImagePlanes(state: IAnimationState): boolean {\n if (state.currentImage == null ||\n state.currentImage.id === this._currentKey) {\n return false;\n }\n\n let previousKey: string = state.previousImage != null ? state.previousImage.id : null;\n let currentKey: string = state.currentImage.id;\n\n if (this._previousKey !== previousKey &&\n this._previousKey !== currentKey &&\n this._previousKey in this._providerDisposers) {\n\n let disposeProvider: () => void = this._providerDisposers[this._previousKey];\n disposeProvider();\n\n delete this._providerDisposers[this._previousKey];\n }\n\n if (previousKey != null) {\n if (previousKey !== this._currentKey && previousKey !== this._previousKey) {\n let previousMesh: THREE.Mesh =\n this._factory.createMesh(state.previousImage, state.previousTransform);\n\n const previousPlanes: { [key: string]: THREE.Mesh } = {};\n previousPlanes[previousKey] = previousMesh;\n this._scene.updateImagePlanes(previousPlanes);\n }\n\n this._previousKey = previousKey;\n }\n\n this._currentKey = currentKey;\n let currentMesh =\n this._factory.createMesh(\n state.currentImage,\n state.currentTransform);\n\n const planes: { [key: string]: THREE.Mesh } = {};\n planes[currentKey] = currentMesh;\n this._scene.updateImagePlanes(planes);\n\n this._alphaOld = 1;\n\n return true;\n }\n\n private _updateTexture(texture: THREE.Texture): void {\n this._needsRender = true;\n\n const planes: { [key: string]: THREE.Mesh } = this._scene.planes;\n\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planes[key];\n let material: ProjectorShaderMaterial = <ProjectorShaderMaterial>plane.material;\n\n let oldTexture: THREE.Texture = <THREE.Texture>material.uniforms.projectorTex.value;\n material.uniforms.projectorTex.value = null;\n oldTexture.dispose();\n\n material.uniforms.projectorTex.value = texture;\n }\n }\n\n private _extend<T>(dest: T, ...sources: T[]): T {\n for (const src of sources) {\n for (const k in src) {\n if (!src.hasOwnProperty(k)) {\n continue;\n }\n\n dest[k] = src[k];\n }\n }\n return dest;\n }\n}\n","export enum RenderPass {\n Background,\n Opaque,\n}\n","import {\n Observable,\n Subscriber,\n} from \"rxjs\";\nimport {\n finalize,\n map,\n publish,\n refCount,\n} from \"rxjs/operators\";\nimport { APIWrapper } from \"../api/APIWrapper\";\nimport { ImageTileEnt } from \"../api/ents/ImageTileEnt\";\n\n/**\n * @class ImageTileLoader\n *\n * @classdesc Represents a loader of image tiles.\n */\nexport class TileLoader {\n private _urls$: Map<string, Observable<ImageTileEnt[]>>;\n\n /**\n * Create a new image image tile loader instance.\n *\n * @param {APIWrapper} _api - API wrapper.\n */\n constructor(private readonly _api: APIWrapper) {\n this._urls$ = new Map();\n }\n\n /**\n * Retrieve an image tile.\n *\n * @param {string} url - URL to the image tile resource\n */\n public getImage$(\n url: string)\n : [Observable<HTMLImageElement>, Function] {\n let aborter: Function;\n const abort: Promise<void> = new Promise(\n (_, reject): void => {\n aborter = reject;\n });\n\n return [Observable.create(\n (subscriber: Subscriber<HTMLImageElement>): void => {\n this._api.data\n .getImageBuffer(url, abort)\n .then(\n (buffer: ArrayBuffer): void => {\n aborter = null;\n\n const image: HTMLImageElement = new Image();\n image.crossOrigin = \"Anonymous\";\n\n image.onload = () => {\n window.URL.revokeObjectURL(image.src);\n subscriber.next(image);\n subscriber.complete();\n };\n\n image.onerror = () => {\n aborter = null;\n window.URL.revokeObjectURL(image.src);\n subscriber.error(\n new Error(\n `Failed to load image tile`));\n };\n\n const blob: Blob = new Blob([buffer]);\n image.src = window.URL.createObjectURL(blob);\n },\n (error: Error): void => {\n aborter = null;\n subscriber.error(error);\n })\n }),\n (): void => {\n if (!!aborter) {\n aborter();\n }\n }];\n }\n\n public getURLs$(\n imageId: string,\n level: number)\n : Observable<ImageTileEnt[]> {\n\n const uniqueId = this._inventId(imageId, level);\n if (this._urls$.has(uniqueId)) {\n return this._urls$.get(uniqueId);\n }\n\n const request = { imageId, z: level };\n const urls$ = this._api\n .getImageTiles$(request)\n .pipe(\n map(contract => contract.node),\n finalize(\n () => {\n this._urls$.delete(uniqueId);\n }),\n publish(),\n refCount());\n\n this._urls$.set(uniqueId, urls$);\n\n return urls$;\n }\n\n private _inventId(imageId: string, level: number): string {\n return `${imageId}-${level}`;\n }\n}\n","import { ImageTileEnt } from \"../api/ents/ImageTileEnt\";\n\n/**\n * @class ImageTileStore\n *\n * @classdesc Represents a store for image tiles.\n */\nexport class TileStore {\n private readonly _tiles: Map<string, HTMLImageElement>;\n private readonly _urlLevels: Set<number>;\n private readonly _urls: Map<string, string>;\n\n /**\n * Create a new image image tile store instance.\n */\n constructor() {\n this._tiles = new Map();\n this._urlLevels = new Set();\n this._urls = new Map();\n }\n\n /**\n * Add an image tile to the store.\n *\n * @param {string} id - The identifier for the image tile.\n * @param {HTMLImageElement} image - The image tile.\n */\n public add(id: string, image: HTMLImageElement): void {\n if (this._tiles.has(id)) {\n throw new Error(`Image tile already stored (${id})`);\n }\n this._tiles.set(id, image);\n }\n\n public addURLs(level: number, ents: ImageTileEnt[]): void {\n const urls = this._urls;\n for (const ent of ents) {\n const id = this.inventId(ent);\n if (this._urls.has(id)) {\n throw new Error(`URL already stored (${id})`);\n }\n urls.set(id, ent.url);\n }\n this._urlLevels.add(level);\n }\n\n /**\n * Dispose the store.\n *\n * @description Disposes all cached assets.\n */\n public dispose(): void {\n this._tiles\n .forEach(\n image => window.URL.revokeObjectURL(image.src));\n this._tiles.clear();\n this._urls.clear();\n this._urlLevels.clear();\n }\n\n /**\n * Get an image tile from the store.\n *\n * @param {string} id - The identifier for the tile.\n * @param {number} level - The level of the tile.\n */\n public get(id: string): HTMLImageElement {\n return this._tiles.get(id);\n }\n\n public getURL(id: string): string {\n return this._urls.get(id);\n }\n\n /**\n * Check if an image tile exist in the store.\n *\n * @param {string} id - The identifier for the tile.\n * @param {number} level - The level of the tile.\n */\n public has(id: string): boolean {\n return this._tiles.has(id);\n }\n\n public hasURL(id: string): boolean {\n return this._urls.has(id);\n }\n\n public hasURLLevel(level: number): boolean {\n return this._urlLevels.has(level);\n }\n\n /**\n * Create a unique tile id from a tile.\n *\n * @description Tile ids are used as a hash for\n * storing the tile in a dictionary.\n *\n * @param {ImageTileEnt} tile - The tile.\n * @returns {string} Unique id.\n */\n public inventId(tile: ImageTileEnt): string {\n return `${tile.z}-${tile.x}-${tile.y}`;\n }\n}\n","import { TileBoundingBox } from \"./interfaces/TileBoundingBox\";\nimport { TileRegionOfInterest } from \"./interfaces/TileRegionOfInterest\";\n\nimport { Transform } from \"../geo/Transform\";\nimport { ViewportCoords } from \"../geo/ViewportCoords\";\nimport { RenderCamera } from \"../render/RenderCamera\";\nimport { ViewportSize } from \"../render/interfaces/ViewportSize\";\nimport { isSpherical } from \"../geo/Geo\";\n\n/**\n * @class RegionOfInterestCalculator\n *\n * @classdesc Represents a calculator for regions of interest.\n */\nexport class RegionOfInterestCalculator {\n private _viewportCoords: ViewportCoords = new ViewportCoords();\n\n /**\n * Compute a region of interest based on the current render camera\n * and the viewport size.\n *\n * @param {RenderCamera} renderCamera - Render camera used for unprojections.\n * @param {ViewportSize} size - Viewport size in pixels.\n * @param {Transform} transform - Transform used for projections.\n *\n * @returns {TileRegionOfInterest} A region of interest.\n */\n public computeRegionOfInterest(\n renderCamera: RenderCamera,\n size: ViewportSize,\n transform: Transform): TileRegionOfInterest {\n\n const viewportBoundaryPoints = this._viewportBoundaryPoints(4);\n const bbox = this._viewportPointsBoundingBox(\n viewportBoundaryPoints,\n renderCamera,\n transform);\n\n this._clipBoundingBox(bbox);\n\n const viewportPixelWidth = 2 / size.width;\n const viewportPixelHeight = 2 / size.height;\n const centralViewportPixel = [\n [-0.5 * viewportPixelWidth, 0.5 * viewportPixelHeight],\n [0.5 * viewportPixelWidth, 0.5 * viewportPixelHeight],\n [0.5 * viewportPixelWidth, -0.5 * viewportPixelHeight],\n [-0.5 * viewportPixelWidth, -0.5 * viewportPixelHeight],\n ];\n const cpbox =\n this._viewportPointsBoundingBox(\n centralViewportPixel,\n renderCamera,\n transform);\n const inverted = cpbox.minX < cpbox.maxX;\n\n return {\n bbox: bbox,\n pixelHeight: cpbox.maxY - cpbox.minY,\n pixelWidth: cpbox.maxX - cpbox.minX + (inverted ? 0 : 1),\n };\n }\n\n private _viewportBoundaryPoints(pointsPerSide: number): number[][] {\n const points: number[][] = [];\n const os = [[-1, 1], [1, 1], [1, -1], [-1, -1]];\n const ds = [[2, 0], [0, -2], [-2, 0], [0, 2]];\n for (let side = 0; side < 4; ++side) {\n const o = os[side];\n const d = ds[side];\n for (let i = 0; i < pointsPerSide; ++i) {\n points.push([o[0] + d[0] * i / pointsPerSide,\n o[1] + d[1] * i / pointsPerSide]);\n }\n }\n return points;\n }\n\n private _viewportPointsBoundingBox(\n viewportPoints: number[][],\n renderCamera: RenderCamera,\n transform: Transform): TileBoundingBox {\n\n const basicPoints = viewportPoints\n .map(\n (point: number[]): number[] => {\n return this._viewportCoords\n .viewportToBasic(\n point[0],\n point[1],\n transform,\n renderCamera.perspective);\n });\n\n if (isSpherical(transform.cameraType)) {\n return this._boundingBoxSpherical(basicPoints);\n } else {\n return this._boundingBox(basicPoints);\n }\n }\n\n private _boundingBox(points: number[][]): TileBoundingBox {\n const bbox: TileBoundingBox = {\n maxX: Number.NEGATIVE_INFINITY,\n maxY: Number.NEGATIVE_INFINITY,\n minX: Number.POSITIVE_INFINITY,\n minY: Number.POSITIVE_INFINITY,\n };\n\n for (let i = 0; i < points.length; ++i) {\n bbox.minX = Math.min(bbox.minX, points[i][0]);\n bbox.maxX = Math.max(bbox.maxX, points[i][0]);\n bbox.minY = Math.min(bbox.minY, points[i][1]);\n bbox.maxY = Math.max(bbox.maxY, points[i][1]);\n }\n\n return bbox;\n }\n\n private _boundingBoxSpherical(points: number[][]): TileBoundingBox {\n const xs: number[] = [];\n const ys: number[] = [];\n for (let i = 0; i < points.length; ++i) {\n xs.push(points[i][0]);\n ys.push(points[i][1]);\n }\n xs.sort((a, b) => { return this._sign(a - b); });\n ys.sort((a, b) => { return this._sign(a - b); });\n\n const intervalX = this._intervalSpherical(xs);\n\n return {\n maxX: intervalX[1],\n maxY: ys[ys.length - 1],\n minX: intervalX[0],\n minY: ys[0],\n };\n }\n\n /**\n * Find the max interval between consecutive numbers.\n * Assumes numbers are between 0 and 1, sorted and that\n * x is equivalent to x + 1.\n */\n private _intervalSpherical(xs: number[]): number[] {\n let maxdx = 0;\n let maxi = -1;\n for (let i = 0; i < xs.length - 1; ++i) {\n const dx = xs[i + 1] - xs[i];\n if (dx > maxdx) {\n maxdx = dx;\n maxi = i;\n }\n }\n const loopdx = xs[0] + 1 - xs[xs.length - 1];\n if (loopdx > maxdx) {\n return [xs[0], xs[xs.length - 1]];\n } else {\n return [xs[maxi + 1], xs[maxi]];\n }\n }\n\n private _clipBoundingBox(bbox: TileBoundingBox): void {\n bbox.minX = Math.max(0, Math.min(1, bbox.minX));\n bbox.maxX = Math.max(0, Math.min(1, bbox.maxX));\n bbox.minY = Math.max(0, Math.min(1, bbox.minY));\n bbox.maxY = Math.max(0, Math.min(1, bbox.maxY));\n }\n\n private _sign(n: number): number {\n return n > 0 ? 1 : n < 0 ? -1 : 0;\n }\n}\n","import {\n TileImageSize,\n TileCoords3D,\n TilePixelCoords2D,\n TileCoords2D,\n TileLevelColumnRows,\n TileLevel,\n TILE_MIN_REQUEST_LEVEL,\n TILE_SIZE,\n} from \"./interfaces/TileTypes\";\n\nfunction clamp(\n value: number,\n min: number,\n max: number)\n : number {\n return Math.max(min, Math.min(max, value));\n}\n\nexport function tileMinRequestLevel(): number {\n return TILE_MIN_REQUEST_LEVEL;\n}\n\nexport function tileSize(): number {\n return TILE_SIZE;\n}\n\nexport function levelTilePixelSize(level: TileLevel): number {\n return TILE_SIZE / levelScale(level);\n}\n\nexport function levelScale(level: TileLevel): number {\n return Math.pow(2, level.z - level.max);\n}\n\nexport function rawImageLevel(size: TileImageSize): number {\n const s = Math.max(size.w, size.h);\n return Math.log(s) / Math.log(2);\n}\n\nexport function baseImageLevel(size: TileImageSize): number {\n return Math.ceil(rawImageLevel(size));\n}\n\nexport function clampedImageLevel(\n size: TileImageSize,\n min: number,\n max: number)\n : number {\n return Math.max(min, Math.min(max, baseImageLevel(size)));\n}\n\nexport function sizeToLevelColumnsRows(\n size: TileImageSize,\n level: TileLevel): TileLevelColumnRows {\n const scale = levelScale(level);\n const rows = Math.ceil(scale * size.h / TILE_SIZE);\n const columns = Math.ceil(scale * size.w / TILE_SIZE);\n return { columns, rows };\n}\n\nexport function basicToTileCoords2D(\n basic: number[],\n size: TileImageSize,\n level: TileLevel): TileCoords2D {\n\n const tilePixelSize = levelTilePixelSize(level);\n const w = size.w;\n const h = size.h;\n const maxX = Math.ceil(w / tilePixelSize) - 1;\n const maxY = Math.ceil(h / tilePixelSize) - 1;\n const x = clamp(\n Math.floor(w * basic[0] / tilePixelSize),\n 0,\n maxX);\n const y = clamp(\n Math.floor(h * basic[1] / tilePixelSize),\n 0,\n maxY);\n\n return { x, y };\n}\n\nexport function tileToPixelCoords2D(\n tile: TileCoords2D,\n size: TileImageSize,\n level: TileLevel)\n : TilePixelCoords2D {\n const scale = 1 / levelScale(level);\n const scaledTS = scale * TILE_SIZE;\n const x = scaledTS * tile.x;\n const y = scaledTS * tile.y;\n const w = Math.min(scaledTS, size.w - x);\n const h = Math.min(scaledTS, size.h - y);\n return { h, x, y, w };\n}\n\nfunction hasOverlap1D(\n low: number,\n base: number,\n scale: number)\n : boolean {\n return (\n scale * low <= base &&\n base < scale * (low + 1)\n );\n}\n\nexport function hasOverlap2D(\n tile1: TileCoords3D,\n tile2: TileCoords3D)\n : boolean {\n if (tile1.z === tile2.z) {\n return tile1.x === tile2.x && tile1.y === tile2.y;\n }\n\n const low = tile1.z < tile2.z ? tile1 : tile2;\n const base = tile1.z < tile2.z ? tile2 : tile1;\n const scale = 1 / levelScale({ max: base.z, z: low.z });\n const overlapX = hasOverlap1D(low.x, base.x, scale);\n const overlapY = hasOverlap1D(low.y, base.y, scale);\n\n return overlapX && overlapY;\n}\n\nexport function cornersToTilesCoords2D(\n topLeft: TileCoords2D,\n bottomRight: TileCoords2D,\n size: TileImageSize,\n level: TileLevel)\n : TileCoords2D[] {\n\n const xs: number[] = [];\n if (topLeft.x > bottomRight.x) {\n const tilePixelSize = levelTilePixelSize(level);\n\n const maxX = Math.ceil(size.w / tilePixelSize) - 1;\n for (let x = topLeft.x; x <= maxX; x++) {\n xs.push(x);\n }\n for (let x = 0; x <= bottomRight.x; x++) {\n xs.push(x);\n }\n } else {\n for (let x = topLeft.x; x <= bottomRight.x; x++) {\n xs.push(x);\n }\n }\n\n const tiles: TileCoords2D[] = [];\n for (const x of xs) {\n for (let y = topLeft.y; y <= bottomRight.y; y++) {\n tiles.push({ x, y });\n }\n }\n return tiles;\n}\n\n\nexport function verifySize(size: TileImageSize): boolean {\n return size.w > 0 && size.h > 0;\n}\n","export const TILE_MIN_REQUEST_LEVEL = 11;\nexport const TILE_SIZE = 1024;\n\nexport interface TileImageSize {\n h: number;\n w: number;\n}\n\nexport interface TileCoords2D {\n x: number;\n y: number;\n}\n\nexport interface TileCoords3D extends TileCoords2D {\n z: number;\n}\n\nexport interface TilePixelCoords2D extends\n TileImageSize,\n TileCoords2D { }\n\nexport interface TileLevelColumnRows {\n columns: number;\n rows: number;\n}\n\nexport interface TileLevel {\n z: number;\n max: number;\n}\n","import * as THREE from \"three\";\nimport {\n publishReplay,\n refCount,\n startWith,\n tap,\n} from \"rxjs/operators\";\nimport {\n Observable,\n of as observableOf,\n Subject,\n Subscription,\n} from \"rxjs\";\n\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\nimport { ImageTileEnt } from \"../api/ents/ImageTileEnt\";\nimport { TileRegionOfInterest } from \"./interfaces/TileRegionOfInterest\";\nimport {\n TileImageSize,\n TileCoords3D,\n TilePixelCoords2D,\n TileCoords2D,\n TileLevel,\n TILE_MIN_REQUEST_LEVEL,\n} from \"./interfaces/TileTypes\";\nimport {\n basicToTileCoords2D,\n cornersToTilesCoords2D,\n hasOverlap2D,\n clampedImageLevel,\n tileToPixelCoords2D,\n verifySize,\n baseImageLevel,\n} from \"./TileMath\";\nimport { TileLoader } from \"./TileLoader\";\nimport { TileStore } from \"./TileStore\";\n\n/**\n * @class TextureProvider\n *\n * @classdesc Represents a provider of textures.\n */\nexport class TextureProvider {\n private readonly _loader: TileLoader;\n private readonly _store: TileStore;\n private readonly _subscriptions: Map<string, Subscription>;\n private readonly _urlSubscriptions: Map<number, Subscription>;\n private readonly _renderedLevel: Set<string>;\n private readonly _rendered: Map<string, TileCoords3D>;\n\n private readonly _created$: Observable<THREE.Texture>;\n private readonly _createdSubject$: Subject<THREE.Texture>;\n private readonly _hasSubject$: Subject<boolean>;\n private readonly _has$: Observable<boolean>;\n private readonly _updated$: Subject<boolean>;\n private readonly _holder: SubscriptionHolder;\n\n private readonly _size: TileImageSize;\n private readonly _imageId: string;\n private readonly _level: TileLevel;\n\n private _renderer: THREE.WebGLRenderer;\n private _render: {\n camera: THREE.OrthographicCamera;\n target: THREE.WebGLRenderTarget;\n };\n\n private _background: HTMLImageElement;\n private _aborts: Function[];\n\n private _disposed: boolean;\n\n /**\n * Create a new image texture provider instance.\n *\n * @param {string} imageId - The identifier of the image for which to request tiles.\n * @param {number} width - The full width of the original image.\n * @param {number} height - The full height of the original image.\n * @param {HTMLImageElement} background - Image to use as background.\n * @param {TileLoader} loader - Loader for retrieving tiles.\n * @param {TileStore} store - Store for saving tiles.\n * @param {THREE.WebGLRenderer} renderer - Renderer used for rendering tiles to texture.\n */\n constructor(\n imageId: string,\n width: number,\n height: number,\n background: HTMLImageElement,\n loader: TileLoader,\n store: TileStore,\n renderer: THREE.WebGLRenderer) {\n\n const size = { h: height, w: width };\n if (!verifySize(size)) {\n console.warn(\n `Original image size (${width}, ${height}) ` +\n `is invalid (${imageId}). Tiles will not be loaded.`);\n }\n\n this._imageId = imageId;\n this._size = size;\n this._level = {\n max: baseImageLevel(this._size),\n z: -1,\n };\n\n this._holder = new SubscriptionHolder();\n this._updated$ = new Subject<boolean>();\n this._createdSubject$ = new Subject<THREE.Texture>();\n this._created$ = this._createdSubject$\n .pipe(\n publishReplay(1),\n refCount());\n this._holder.push(this._created$.subscribe(() => { /*noop*/ }));\n\n this._hasSubject$ = new Subject<boolean>();\n this._has$ = this._hasSubject$\n .pipe(\n startWith(false),\n publishReplay(1),\n refCount());\n this._holder.push(this._has$.subscribe(() => { /*noop*/ }));\n\n this._renderedLevel = new Set();\n this._rendered = new Map();\n this._subscriptions = new Map();\n this._urlSubscriptions = new Map();\n this._loader = loader;\n this._store = store;\n\n this._background = background;\n this._renderer = renderer;\n this._aborts = [];\n this._render = null;\n this._disposed = false;\n }\n\n /**\n * Get disposed.\n *\n * @returns {boolean} Value indicating whether provider has\n * been disposed.\n */\n public get disposed(): boolean {\n return this._disposed;\n }\n\n /**\n * Get hasTexture$.\n *\n * @returns {Observable<boolean>} Observable emitting\n * values indicating when the existance of a texture\n * changes.\n */\n public get hasTexture$(): Observable<boolean> {\n return this._has$;\n }\n\n /**\n * Get id.\n *\n * @returns {boolean} The identifier of the image for\n * which to render textures.\n */\n public get id(): string {\n return this._imageId;\n }\n\n /**\n * Get textureUpdated$.\n *\n * @returns {Observable<boolean>} Observable emitting\n * values when an existing texture has been updated.\n */\n public get textureUpdated$(): Observable<boolean> {\n return this._updated$;\n }\n\n /**\n * Get textureCreated$.\n *\n * @returns {Observable<boolean>} Observable emitting\n * values when a new texture has been created.\n */\n public get textureCreated$(): Observable<THREE.Texture> {\n return this._created$;\n }\n\n /**\n * Abort all outstanding image tile requests.\n */\n public abort(): void {\n this._subscriptions.forEach(sub => sub.unsubscribe());\n this._subscriptions.clear();\n\n for (const abort of this._aborts) { abort(); }\n this._aborts = [];\n }\n\n /**\n * Dispose the provider.\n *\n * @description Disposes all cached assets and\n * aborts all outstanding image tile requests.\n */\n public dispose(): void {\n if (this._disposed) {\n console.warn(`Texture already disposed (${this._imageId})`);\n return;\n }\n\n this._urlSubscriptions.forEach(sub => sub.unsubscribe());\n this._urlSubscriptions.clear();\n\n this.abort();\n\n if (this._render != null) {\n this._render.target.dispose();\n this._render.target = null;\n this._render.camera = null;\n this._render = null;\n }\n\n this._store.dispose();\n this._holder.unsubscribe();\n this._renderedLevel.clear();\n\n this._background = null;\n this._renderer = null;\n\n this._disposed = true;\n }\n\n /**\n * Set the region of interest.\n *\n * @description When the region of interest is set the\n * the tile level is determined and tiles for the region\n * are fetched from the store or the loader and renderedLevel\n * to the texture.\n *\n * @param {TileRegionOfInterest} roi - Spatial edges to cache.\n */\n public setRegionOfInterest(roi: TileRegionOfInterest): void {\n if (!verifySize(this._size)) { return; }\n\n const virtualWidth = 1 / roi.pixelWidth;\n const virtualHeight = 1 / roi.pixelHeight;\n const level = clampedImageLevel(\n { h: virtualHeight, w: virtualWidth },\n TILE_MIN_REQUEST_LEVEL,\n this._level.max);\n\n if (level !== this._level.z) {\n this.abort();\n this._level.z = level;\n this._renderedLevel.clear();\n this._rendered\n .forEach((tile, id) => {\n if (tile.z !== level) { return; }\n this._renderedLevel.add(id);\n });\n }\n\n if (this._render == null) { this._initRender(); }\n\n const topLeft = basicToTileCoords2D(\n [roi.bbox.minX, roi.bbox.minY],\n this._size,\n this._level);\n\n const bottomRight = basicToTileCoords2D(\n [roi.bbox.maxX, roi.bbox.maxY],\n this._size,\n this._level);\n\n const tiles = cornersToTilesCoords2D(\n topLeft,\n bottomRight,\n this._size,\n this._level);\n\n this._fetchTiles(level, tiles);\n }\n\n /**\n * Retrieve an image tile.\n *\n * @description Retrieve an image tile and render it to the\n * texture. Add the tile to the store and emit to the updated\n * observable.\n *\n * @param {ImageTileEnt} tile - The tile ent.\n */\n private _fetchTile(tile: ImageTileEnt): void {\n const getTile = this._loader.getImage$(tile.url);\n const tile$ = getTile[0];\n const abort = getTile[1];\n this._aborts.push(abort);\n const tileId = this._store.inventId(tile);\n\n const subscription = tile$.subscribe(\n (image: HTMLImageElement): void => {\n const pixels = tileToPixelCoords2D(\n tile,\n this._size,\n this._level);\n this._renderToTarget(pixels, image);\n this._subscriptions.delete(tileId);\n this._removeFromArray(abort, this._aborts);\n this._markRendered(tile);\n this._store.add(tileId, image);\n this._updated$.next(true);\n },\n (error: Error): void => {\n this._subscriptions.delete(tileId);\n this._removeFromArray(abort, this._aborts);\n console.error(error);\n });\n\n if (!subscription.closed) {\n this._subscriptions.set(tileId, subscription);\n }\n }\n\n /**\n * Fetch image tiles.\n *\n * @description Retrieve a image tiles and render them to the\n * texture. Retrieve from store if it exists, otherwise retrieve\n * from loader.\n *\n * @param {Array<TileCoords2D>} tiles - Array of tile coordinates to\n * retrieve.\n */\n private _fetchTiles(level: number, tiles: TileCoords2D[]): void {\n const urls$ = this._store.hasURLLevel(level) ?\n observableOf(undefined) :\n this._loader\n .getURLs$(this._imageId, level)\n .pipe(\n tap(ents => {\n if (!this._store.hasURLLevel(level)) {\n this._store.addURLs(level, ents);\n }\n }));\n\n const subscription = urls$.subscribe(\n (): void => {\n if (level !== this._level.z) { return; }\n for (const tile of tiles) {\n const ent: ImageTileEnt = {\n x: tile.x,\n y: tile.y,\n z: level,\n url: null,\n };\n const id = this._store.inventId(ent);\n if (this._renderedLevel.has(id) ||\n this._subscriptions.has(id)) {\n continue;\n }\n\n if (this._store.has(id)) {\n const pixels = tileToPixelCoords2D(\n tile,\n this._size,\n this._level);\n\n this._renderToTarget(\n pixels,\n this._store.get(id));\n\n this._markRendered(ent);\n this._updated$.next(true);\n continue;\n }\n\n ent.url = this._store.getURL(id);\n this._fetchTile(ent);\n }\n this._urlSubscriptions.delete(level);\n },\n (error: Error): void => {\n this._urlSubscriptions.delete(level);\n console.error(error);\n });\n\n if (!subscription.closed) {\n this._urlSubscriptions.set(level, subscription);\n }\n }\n\n private _initRender(): void {\n const dx = this._size.w / 2;\n const dy = this._size.h / 2;\n const near = -1;\n const far = 1;\n const camera =\n new THREE.OrthographicCamera(-dx, dx, dy, -dy, near, far);\n camera.position.z = 1;\n const gl = this._renderer.getContext();\n const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n const backgroundSize = Math.max(this._size.w, this._size.h);\n const scale = maxTextureSize > backgroundSize ?\n 1 : maxTextureSize / backgroundSize;\n\n const targetWidth = Math.floor(scale * this._size.w);\n const targetHeight = Math.floor(scale * this._size.h);\n\n const target = new THREE.WebGLRenderTarget(\n targetWidth,\n targetHeight,\n {\n depthBuffer: false,\n format: THREE.RGBFormat,\n magFilter: THREE.LinearFilter,\n minFilter: THREE.LinearFilter,\n stencilBuffer: false,\n });\n\n this._render = { camera, target };\n\n const pixels = tileToPixelCoords2D(\n { x: 0, y: 0 },\n this._size,\n { max: this._level.max, z: 0 });\n this._renderToTarget(pixels, this._background);\n\n this._createdSubject$.next(target.texture);\n this._hasSubject$.next(true);\n }\n\n /**\n * Mark a tile as rendered.\n *\n * @description Clears tiles marked as rendered in other\n * levels of the tile pyramid if they overlap the\n * newly rendered tile.\n *\n * @param {Arrary<number>} tile - The tile ent.\n */\n private _markRendered(tile: ImageTileEnt): void {\n const others =\n Array.from(this._rendered.entries())\n .filter(\n ([_, t]: [string, TileCoords3D]): boolean => {\n return t.z !== tile.z;\n });\n\n for (const [otherId, other] of others) {\n if (hasOverlap2D(tile, other)) {\n this._rendered.delete(otherId);\n }\n }\n\n const id = this._store.inventId(tile);\n this._rendered.set(id, tile);\n this._renderedLevel.add(id);\n }\n\n /**\n * Remove an item from an array if it exists in array.\n *\n * @param {T} item - Item to remove.\n * @param {Array<T>} array - Array from which item should be removed.\n */\n private _removeFromArray<T>(item: T, array: T[]): void {\n const index = array.indexOf(item);\n if (index !== -1) {\n array.splice(index, 1);\n }\n }\n\n /**\n * Render an image tile to the target texture.\n *\n * @param {ImageTileEnt} tile - Tile ent.\n * @param {HTMLImageElement} image - The image tile to render.\n */\n private _renderToTarget(\n pixel: TilePixelCoords2D,\n image: HTMLImageElement): void {\n const texture = new THREE.Texture(image);\n texture.minFilter = THREE.LinearFilter;\n texture.needsUpdate = true;\n\n const geometry = new THREE.PlaneGeometry(pixel.w, pixel.h);\n const material = new THREE.MeshBasicMaterial({\n map: texture,\n side: THREE.FrontSide,\n });\n\n const mesh = new THREE.Mesh(geometry, material);\n mesh.position.x = -this._size.w / 2 + pixel.x + pixel.w / 2;\n mesh.position.y = this._size.h / 2 - pixel.y - pixel.h / 2;\n\n const scene = new THREE.Scene();\n scene.add(mesh);\n\n const target = this._renderer.getRenderTarget();\n\n this._renderer.resetState();\n this._renderer.setRenderTarget(this._render.target)\n this._renderer.render(scene, this._render.camera);\n this._renderer.setRenderTarget(target);\n\n scene.remove(mesh);\n\n geometry.dispose();\n material.dispose();\n texture.dispose();\n }\n}\n","export enum State {\n Custom,\n Earth,\n Traversing,\n Waiting,\n WaitingInteractively,\n}\n","/**\n * Enumeration for graph modes.\n * @enum {number}\n * @readonly\n * @description Modes for the retrieval and caching performed\n * by the graph service on the graph.\n */\nexport enum GraphMode {\n /**\n * Caching is performed on sequences only and sequence edges are\n * calculated. Spatial tiles\n * are not retrieved and spatial edges are not calculated when\n * caching nodes. Complete sequences are being cached for requested\n * nodes within the graph.\n */\n Sequence,\n\n /**\n * Caching is performed with emphasis on spatial data. Sequence edges\n * as well as spatial edges are cached. Sequence data\n * is still requested but complete sequences are not being cached\n * for requested nodes.\n *\n * This is the initial mode of the graph service.\n */\n Spatial,\n}\n","export enum SequenceMode {\n Default,\n Playback,\n Timeline,\n}\n","import { ComponentConfiguration } from \"./ComponentConfiguration\";\n\n/**\n * Enumeration for slider mode.\n *\n * @enum {number}\n * @readonly\n *\n * @description Modes for specifying how transitions\n * between images are performed in slider mode. Only\n * applicable when the slider component determines\n * that transitions with motion is possilble. When it\n * is not, the stationary mode will be applied.\n */\nexport enum SliderConfigurationMode {\n /**\n * Transitions with motion.\n *\n * @description The slider component moves the\n * camera between the image origins.\n *\n * In this mode it is not possible to zoom or pan.\n *\n * The slider component falls back to stationary\n * mode when it determines that the pair of images\n * does not have a strong enough relation.\n */\n Motion,\n\n /**\n * Stationary transitions.\n *\n * @description The camera is stationary.\n *\n * In this mode it is possible to zoom and pan.\n */\n Stationary,\n}\n\n/**\n * Interface for configuration of slider ids.\n *\n * @interface\n */\nexport interface SliderConfigurationIds {\n /**\n * Id for the image plane in the background.\n */\n background: string;\n\n /**\n * Id for the image plane in the foreground.\n */\n foreground: string;\n}\n\n/**\n * Interface for configuration of slider component.\n *\n * @interface\n * ```js\n * var viewer = new Viewer({\n * ...\n * component: {\n * slider: {\n * initialPosition: 0.5,\n * ids: {\n * background: '<background-id>',\n * foreground: '<foreground-id>',\n * },\n * sliderVisible: true,\n * },\n * },\n * ...\n * });\n * ```\n */\nexport interface SliderConfiguration extends ComponentConfiguration {\n /**\n * Initial position of the slider on the interval [0, 1].\n *\n * @description Configures the initial position of the slider.\n * The inital position value will be used when the component\n * is activated.\n *\n * @default 1\n */\n initialPosition?: number;\n\n /**\n * Slider image ids.\n *\n * @description Configures the component to show the image\n * planes for the supplied image ids in the foreground\n * and the background.\n */\n ids?: SliderConfigurationIds;\n\n /**\n * Value indicating whether the slider should be visible.\n *\n * @description Set the value controlling if the\n * slider is visible.\n *\n * @default true\n */\n sliderVisible?: boolean;\n\n /**\n * Mode used for image pair transitions.\n *\n * @description Configures the mode for transitions between\n * image pairs.\n */\n mode?: SliderConfigurationMode;\n}\n","import * as THREE from \"three\";\n\nimport {\n combineLatest as observableCombineLatest,\n empty as observableEmpty,\n from as observableFrom,\n of as observableOf,\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport {\n catchError,\n distinctUntilChanged,\n filter,\n map,\n mergeMap,\n pairwise,\n publishReplay,\n refCount,\n scan,\n share,\n startWith,\n switchMap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Component } from \"../Component\";\nimport { Image as ImageNode } from \"../../graph/Image\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { ImageGLRenderer } from \"./ImageGLRenderer\";\nimport { Spatial } from \"../../geo/Spatial\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { RenderPass } from \"../../render/RenderPass\";\nimport { GLRenderHash } from \"../../render/interfaces/IGLRenderHash\";\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { TileLoader } from \"../../tile/TileLoader\";\nimport { TileStore } from \"../../tile/TileStore\";\nimport { TileRegionOfInterest }\n from \"../../tile/interfaces/TileRegionOfInterest\";\nimport { RegionOfInterestCalculator }\n from \"../../tile/RegionOfInterestCalculator\";\nimport { TextureProvider } from \"../../tile/TextureProvider\";\nimport { ComponentConfiguration } from \"../interfaces/ComponentConfiguration\";\nimport { Transform } from \"../../geo/Transform\";\nimport { ComponentName } from \"../ComponentName\";\nimport { State } from \"../../state/State\";\n\ninterface ImageGLRendererOperation {\n (renderer: ImageGLRenderer): ImageGLRenderer;\n}\n\ntype PositionLookat = {\n camera: RenderCamera,\n height: number,\n lookat: THREE.Vector3,\n width: number,\n zoom: number,\n};\ntype TextureProviderInput = [AnimationFrame, THREE.WebGLRenderer];\ntype RoiTrigger = [StalledCamera, ViewportSize, Transform];\ntype StalledCamera = {\n camera: RenderCamera,\n stalled: boolean,\n};\n\nexport class ImageComponent extends Component<ComponentConfiguration> {\n public static componentName: ComponentName = \"image\";\n\n private _rendererOperation$: Subject<ImageGLRendererOperation>;\n private _renderer$: Observable<ImageGLRenderer>;\n private _rendererCreator$: Subject<void>;\n private _rendererDisposer$: Subject<void>;\n\n private _imageTileLoader: TileLoader;\n private _roiCalculator: RegionOfInterestCalculator;\n\n constructor(\n name: string,\n container: Container,\n navigator: Navigator) {\n\n super(name, container, navigator);\n\n this._imageTileLoader = new TileLoader(navigator.api);\n this._roiCalculator = new RegionOfInterestCalculator();\n\n this._rendererOperation$ = new Subject<ImageGLRendererOperation>();\n this._rendererCreator$ = new Subject<void>();\n this._rendererDisposer$ = new Subject<void>();\n\n this._renderer$ = this._rendererOperation$.pipe(\n scan(\n (renderer: ImageGLRenderer, operation: ImageGLRendererOperation): ImageGLRenderer => {\n return operation(renderer);\n },\n null),\n filter(\n (renderer: ImageGLRenderer): boolean => {\n return renderer != null;\n }),\n distinctUntilChanged(\n undefined,\n (renderer: ImageGLRenderer): number => {\n return renderer.frameId;\n }));\n\n this._rendererCreator$.pipe(\n map(\n (): ImageGLRendererOperation => {\n return (renderer: ImageGLRenderer): ImageGLRenderer => {\n if (renderer != null) {\n throw new Error(\"Multiple image plane states can not be created at the same time\");\n }\n\n return new ImageGLRenderer();\n };\n }))\n .subscribe(this._rendererOperation$);\n\n this._rendererDisposer$.pipe(\n map(\n (): ImageGLRendererOperation => {\n return (renderer: ImageGLRenderer): ImageGLRenderer => {\n renderer.dispose();\n\n return null;\n };\n }))\n .subscribe(this._rendererOperation$);\n }\n\n protected _activate(): void {\n const subs = this._subscriptions;\n\n subs.push(this._renderer$.pipe(\n map(\n (renderer: ImageGLRenderer): GLRenderHash => {\n const renderHash: GLRenderHash = {\n name: this._name,\n renderer: {\n frameId: renderer.frameId,\n needsRender: renderer.needsRender,\n render: renderer.render.bind(renderer),\n pass: RenderPass.Background,\n },\n };\n\n renderer.clearNeedsRender();\n\n return renderHash;\n }))\n .subscribe(this._container.glRenderer.render$));\n\n this._rendererCreator$.next(null);\n\n subs.push(this._navigator.stateService.currentState$.pipe(\n map(\n (frame: AnimationFrame): ImageGLRendererOperation => {\n return (renderer: ImageGLRenderer): ImageGLRenderer => {\n renderer.updateFrame(frame);\n\n return renderer;\n };\n }))\n .subscribe(this._rendererOperation$));\n\n const textureProvider$ =\n this._container.configurationService.imageTiling$.pipe(\n switchMap(\n (active): Observable<AnimationFrame> => {\n return active ?\n this._navigator.stateService.currentState$ :\n new Subject();\n }),\n distinctUntilChanged(\n undefined,\n (frame: AnimationFrame): string => {\n return frame.state.currentImage.id;\n }),\n withLatestFrom(\n this._container.glRenderer.webGLRenderer$),\n map(\n ([frame, renderer]: TextureProviderInput)\n : TextureProvider => {\n const state = frame.state;\n const currentNode = state.currentImage;\n const currentTransform = state.currentTransform;\n\n return new TextureProvider(\n currentNode.id,\n currentTransform.basicWidth,\n currentTransform.basicHeight,\n currentNode.image,\n this._imageTileLoader,\n new TileStore(),\n renderer);\n }),\n publishReplay(1),\n refCount());\n\n subs.push(textureProvider$.subscribe(() => { /*noop*/ }));\n\n subs.push(textureProvider$.pipe(\n map(\n (provider: TextureProvider): ImageGLRendererOperation => {\n return (renderer: ImageGLRenderer): ImageGLRenderer => {\n renderer.setTextureProvider(provider.id, provider);\n\n return renderer;\n };\n }))\n .subscribe(this._rendererOperation$));\n\n subs.push(textureProvider$.pipe(\n pairwise())\n .subscribe(\n (pair: [TextureProvider, TextureProvider]): void => {\n const previous = pair[0];\n previous.abort();\n }));\n\n const roiTrigger$ =\n this._container.configurationService.imageTiling$.pipe(\n switchMap(\n (active): Observable<[State, boolean]> => {\n return active ?\n observableCombineLatest(\n this._navigator.stateService.state$,\n this._navigator.stateService.inTranslation$) :\n new Subject();\n }),\n switchMap(\n ([state, inTranslation]: [State, boolean]) => {\n const streetState =\n state === State.Traversing ||\n state === State.Waiting ||\n state === State.WaitingInteractively;\n const active = streetState && !inTranslation;\n return active ?\n this._container.renderService.renderCameraFrame$ :\n observableEmpty();\n }),\n map(\n (camera: RenderCamera): PositionLookat => {\n return {\n camera,\n height: camera.size.height.valueOf(),\n lookat: camera.camera.lookat.clone(),\n width: camera.size.width.valueOf(),\n zoom: camera.zoom.valueOf(),\n };\n }),\n pairwise(),\n map(\n ([pl0, pl1]: [PositionLookat, PositionLookat])\n : StalledCamera => {\n const stalled =\n pl0.width === pl1.width &&\n pl0.height === pl1.height &&\n pl0.zoom === pl1.zoom &&\n pl0.lookat.equals(pl1.lookat);\n\n return { camera: pl1.camera, stalled };\n }),\n distinctUntilChanged(\n (x, y): boolean => {\n return x.stalled === y.stalled;\n }),\n filter(\n (camera: StalledCamera): boolean => {\n return camera.stalled;\n }),\n withLatestFrom(\n this._container.renderService.size$,\n this._navigator.stateService.currentTransform$));\n\n subs.push(textureProvider$.pipe(\n switchMap(\n (provider: TextureProvider):\n Observable<[TileRegionOfInterest, TextureProvider]> => {\n return roiTrigger$.pipe(\n map(\n ([stalled, size, transform]: RoiTrigger)\n : [TileRegionOfInterest, TextureProvider] => {\n\n const camera = stalled.camera;\n const basic = new ViewportCoords()\n .viewportToBasic(\n 0,\n 0,\n transform,\n camera.perspective);\n\n if (basic[0] < 0 ||\n basic[1] < 0 ||\n basic[0] > 1 ||\n basic[1] > 1) {\n return undefined;\n }\n\n return [\n this._roiCalculator\n .computeRegionOfInterest(\n camera,\n size,\n transform),\n provider,\n ];\n }),\n filter(\n (args: [TileRegionOfInterest, TextureProvider]): boolean => {\n return !!args;\n }));\n }),\n filter(\n (args: [TileRegionOfInterest, TextureProvider]): boolean => {\n return !args[1].disposed;\n }))\n .subscribe(\n ([roi, provider]: [TileRegionOfInterest, TextureProvider])\n : void => {\n provider.setRegionOfInterest(roi);\n }));\n\n const hasTexture$ = textureProvider$\n .pipe(\n switchMap(\n (provider: TextureProvider): Observable<boolean> => {\n return provider.hasTexture$;\n }),\n startWith(false),\n publishReplay(1),\n refCount());\n\n subs.push(hasTexture$.subscribe(() => { /*noop*/ }));\n\n subs.push(this._navigator.panService.panImages$.pipe(\n filter(\n (panNodes: []): boolean => {\n return panNodes.length === 0;\n }),\n map(\n (): ImageGLRendererOperation => {\n return (renderer: ImageGLRenderer): ImageGLRenderer => {\n renderer.clearPeripheryPlanes();\n\n return renderer;\n };\n }))\n .subscribe(this._rendererOperation$));\n\n const cachedPanNodes$ = this._navigator.panService.panImages$.pipe(\n switchMap(\n (nts: [ImageNode, Transform, number][]): Observable<[ImageNode, Transform]> => {\n return observableFrom(nts).pipe(\n mergeMap(\n ([n, t]: [ImageNode, Transform, number]): Observable<[ImageNode, Transform]> => {\n return observableCombineLatest(\n this._navigator.graphService.cacheImage$(n.id).pipe(\n catchError(\n (error: Error): Observable<ImageNode> => {\n console.error(`Failed to cache periphery image (${n.id})`, error);\n\n return observableEmpty();\n })),\n observableOf(t));\n }));\n }),\n share());\n\n subs.push(cachedPanNodes$.pipe(\n map(\n ([n, t]: [ImageNode, Transform]): ImageGLRendererOperation => {\n return (renderer: ImageGLRenderer): ImageGLRenderer => {\n renderer.addPeripheryPlane(n, t);\n\n return renderer;\n };\n }))\n .subscribe(this._rendererOperation$));\n\n subs.push(cachedPanNodes$.pipe(\n mergeMap(\n ([n]: [ImageNode, Transform]): Observable<ImageNode> => {\n return n.cacheImage$().pipe(\n catchError(\n (): Observable<ImageNode> => {\n return observableEmpty();\n }));\n }),\n map(\n (n: ImageNode): ImageGLRendererOperation => {\n return (renderer: ImageGLRenderer): ImageGLRenderer => {\n renderer.updateTextureImage(n.image, n);\n\n return renderer;\n };\n }))\n .subscribe(this._rendererOperation$));\n\n const inTransition$ = this._navigator.stateService.currentState$.pipe(\n map(\n (frame: AnimationFrame): boolean => {\n return frame.state.alpha < 1;\n }),\n distinctUntilChanged());\n\n const panTrigger$ = observableCombineLatest(\n this._container.mouseService.active$,\n this._container.touchService.active$,\n this._navigator.stateService.inMotion$,\n inTransition$).pipe(\n map(\n ([mouseActive, touchActive, inMotion, inTransition]: [boolean, boolean, boolean, boolean]): boolean => {\n return !(mouseActive || touchActive || inMotion || inTransition);\n }),\n filter(\n (trigger: boolean): boolean => {\n return trigger;\n }));\n\n subs.push(this._navigator.stateService.state$\n .pipe(\n switchMap(\n state => {\n return state === State.Traversing ?\n this._navigator.panService.panImages$ :\n observableEmpty();\n\n }),\n switchMap(\n (nts: [ImageNode, Transform, number][]):\n Observable<[RenderCamera, ImageNode, Transform, [ImageNode, Transform, number][]]> => {\n\n return panTrigger$.pipe(\n withLatestFrom(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentImage$,\n this._navigator.stateService.currentTransform$),\n mergeMap(\n ([, renderCamera, currentNode, currentTransform]: [boolean, RenderCamera, ImageNode, Transform]):\n Observable<[RenderCamera, ImageNode, Transform, [ImageNode, Transform, number][]]> => {\n return observableOf(\n [\n renderCamera,\n currentNode,\n currentTransform,\n nts,\n ] as [RenderCamera, ImageNode, Transform, [ImageNode, Transform, number][]]);\n }));\n }),\n switchMap(\n ([camera, cn, ct, nts]:\n [\n RenderCamera,\n ImageNode,\n Transform,\n [ImageNode, Transform, number][],\n ]): Observable<ImageNode> => {\n\n const direction = camera.camera.lookat.clone().sub(camera.camera.position);\n\n const cd = new Spatial().viewingDirection(cn.rotation);\n const ca = cd.angleTo(direction);\n const closest: [number, string] = [ca, undefined];\n const basic = new ViewportCoords().viewportToBasic(0, 0, ct, camera.perspective);\n\n if (basic[0] >= 0 && basic[0] <= 1 && basic[1] >= 0 && basic[1] <= 1) {\n closest[0] = Number.NEGATIVE_INFINITY;\n }\n\n for (const [n] of nts) {\n const d = new Spatial().viewingDirection(n.rotation);\n const a = d.angleTo(direction);\n\n if (a < closest[0]) {\n closest[0] = a;\n closest[1] = n.id;\n }\n }\n\n if (!closest[1]) {\n return observableEmpty();\n }\n\n return this._navigator.moveTo$(closest[1]).pipe(\n catchError(\n (): Observable<ImageNode> => {\n return observableEmpty();\n }));\n }))\n .subscribe());\n }\n\n protected _deactivate(): void {\n this._rendererDisposer$.next(null);\n this._subscriptions.unsubscribe();\n }\n\n protected _getDefaultConfiguration(): ComponentConfiguration {\n return {};\n }\n}\n","import { Component } from \"../Component\";\nimport { ComponentConfiguration } from \"../interfaces/ComponentConfiguration\";\n\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\n\nexport abstract class HandlerBase<TConfiguration extends ComponentConfiguration> {\n protected _component: Component<TConfiguration>;\n protected _container: Container;\n protected _navigator: Navigator;\n\n protected _enabled: boolean;\n\n /** @ignore */\n constructor(\n component: Component<TConfiguration>,\n container: Container,\n navigator: Navigator) {\n this._component = component;\n this._container = container;\n this._navigator = navigator;\n\n this._enabled = false;\n }\n\n /**\n * Returns a Boolean indicating whether the interaction is enabled.\n *\n * @returns {boolean} `true` if the interaction is enabled.\n */\n public get isEnabled(): boolean {\n return this._enabled;\n }\n\n /**\n * Enables the interaction.\n *\n * @example\n * ```js\n * <component-name>.<handler-name>.enable();\n * ```\n */\n public enable(): void {\n if (this._enabled || !this._component.activated) { return; }\n\n this._enable();\n this._enabled = true;\n\n this._component.configure(this._getConfiguration(true));\n }\n\n /**\n * Disables the interaction.\n *\n * @example\n * ```js\n * <component-name>.<handler-name>.disable();\n * ```\n */\n public disable(): void {\n if (!this._enabled) { return; }\n\n this._disable();\n this._enabled = false;\n\n if (this._component.activated) {\n this._component.configure(this._getConfiguration(false));\n }\n }\n\n protected abstract _enable(): void;\n\n protected abstract _disable(): void;\n\n protected abstract _getConfiguration(enable: boolean): TConfiguration;\n}\n","import {\n Observable,\n Subscription,\n} from \"rxjs\";\nimport {\n switchMap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Image } from \"../../graph/Image\";\nimport { NavigationEdgeStatus } from \"../../graph/interfaces/NavigationEdgeStatus\";\nimport { KeyboardConfiguration } from \"../interfaces/KeyboardConfiguration\";\nimport { HandlerBase } from \"../util/HandlerBase\";\nimport { NavigationDirection } from \"../../graph/edge/NavigationDirection\";\nimport { CancelMapillaryError } from \"../../error/CancelMapillaryError\";\n\n/**\n * The `KeySequenceNavigationHandler` allows the user to navigate through a sequence using the\n * following key commands:\n *\n * `ALT` + `Up Arrow`: Navigate to next image in the sequence.\n * `ALT` + `Down Arrow`: Navigate to previous image in sequence.\n *\n * @example\n * ```js\n * var keyboardComponent = viewer.getComponent(\"keyboard\");\n *\n * keyboardComponent.keySequenceNavigation.disable();\n * keyboardComponent.keySequenceNavigation.enable();\n *\n * var isEnabled = keyboardComponent.keySequenceNavigation.isEnabled;\n * ```\n */\nexport class KeySequenceNavigationHandler extends HandlerBase<KeyboardConfiguration> {\n private _keyDownSubscription: Subscription;\n\n protected _enable(): void {\n const sequenceEdges$: Observable<NavigationEdgeStatus> = this._navigator.stateService.currentImage$.pipe(\n switchMap(\n (image: Image): Observable<NavigationEdgeStatus> => {\n return image.sequenceEdges$;\n }));\n\n this._keyDownSubscription = this._container.keyboardService.keyDown$.pipe(\n withLatestFrom(sequenceEdges$))\n .subscribe(\n ([event, edgeStatus]: [KeyboardEvent, NavigationEdgeStatus]): void => {\n let direction: NavigationDirection = null;\n switch (event.keyCode) {\n case 38: // up\n direction = NavigationDirection.Next;\n break;\n case 40: // down\n direction = NavigationDirection.Prev;\n break;\n default:\n return;\n }\n\n event.preventDefault();\n\n if (!event.altKey || event.shiftKey || !edgeStatus.cached) {\n return;\n }\n\n for (const edge of edgeStatus.edges) {\n if (edge.data.direction === direction) {\n this._navigator.moveTo$(edge.target)\n .subscribe(\n undefined,\n (error: Error): void => {\n if (!(error instanceof CancelMapillaryError)) {\n console.error(error);\n }\n });\n\n return;\n }\n }\n });\n }\n\n protected _disable(): void {\n this._keyDownSubscription.unsubscribe();\n }\n\n protected _getConfiguration(enable: boolean): KeyboardConfiguration {\n return { keySequenceNavigation: enable };\n }\n}\n","import * as THREE from \"three\";\n\nimport {\n Observable,\n Subscription,\n} from \"rxjs\";\n\nimport {\n withLatestFrom,\n switchMap,\n} from \"rxjs/operators\";\n\nimport { Image } from \"../../graph/Image\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { Component } from \"../Component\";\nimport { KeyboardConfiguration } from \"../interfaces/KeyboardConfiguration\";\nimport { HandlerBase } from \"../util/HandlerBase\";\nimport { Spatial } from \"../../geo/Spatial\";\nimport { NavigationEdge } from \"../../graph/edge/interfaces/NavigationEdge\";\nimport { NavigationEdgeStatus } from \"../../graph/interfaces/NavigationEdgeStatus\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { EulerRotation } from \"../../state/interfaces/EulerRotation\";\nimport { Camera } from \"../../geo/Camera\";\nimport { NavigationDirection } from \"../../graph/edge/NavigationDirection\";\nimport { CancelMapillaryError } from \"../../error/CancelMapillaryError\";\nimport { isSpherical } from \"../../geo/Geo\";\n\n\n/**\n * The `KeySpatialNavigationHandler` allows the user to navigate through a sequence using the\n * following key commands:\n *\n * `Up Arrow`: Step forward.\n * `Down Arrow`: Step backward.\n * `Left Arrow`: Step to the left.\n * `Rigth Arrow`: Step to the right.\n * `SHIFT` + `Down Arrow`: Turn around.\n * `SHIFT` + `Left Arrow`: Turn to the left.\n * `SHIFT` + `Rigth Arrow`: Turn to the right.\n *\n * @example\n * ```js\n * var keyboardComponent = viewer.getComponent(\"keyboard\");\n *\n * keyboardComponent.keySpatialNavigation.disable();\n * keyboardComponent.keySpatialNavigation.enable();\n *\n * var isEnabled = keyboardComponent.keySpatialNavigation.isEnabled;\n * ```\n */\nexport class KeySpatialNavigationHandler extends HandlerBase<KeyboardConfiguration> {\n private _spatial: Spatial;\n\n private _keyDownSubscription: Subscription;\n\n /** @ignore */\n constructor(\n component: Component<KeyboardConfiguration>,\n container: Container,\n navigator: Navigator,\n spatial: Spatial) {\n super(component, container, navigator);\n\n this._spatial = spatial;\n }\n\n protected _enable(): void {\n const spatialEdges$: Observable<NavigationEdgeStatus> = this._navigator.stateService.currentImage$.pipe(\n switchMap(\n (image: Image): Observable<NavigationEdgeStatus> => {\n return image.spatialEdges$;\n }));\n\n this._keyDownSubscription = this._container.keyboardService.keyDown$.pipe(\n withLatestFrom(\n spatialEdges$,\n this._navigator.stateService.currentState$))\n .subscribe(([event, edgeStatus, frame]: [KeyboardEvent, NavigationEdgeStatus, AnimationFrame]): void => {\n let spherical = isSpherical(frame.state.currentImage.cameraType);\n let direction: NavigationDirection = null;\n switch (event.keyCode) {\n case 37: // left\n direction = event.shiftKey && !spherical ? NavigationDirection.TurnLeft : NavigationDirection.StepLeft;\n break;\n case 38: // up\n direction = event.shiftKey && !spherical ? NavigationDirection.Spherical : NavigationDirection.StepForward;\n break;\n case 39: // right\n direction = event.shiftKey && !spherical ? NavigationDirection.TurnRight : NavigationDirection.StepRight;\n break;\n case 40: // down\n direction = event.shiftKey && !spherical ? NavigationDirection.TurnU : NavigationDirection.StepBackward;\n break;\n default:\n return;\n }\n\n event.preventDefault();\n\n if (event.altKey || !edgeStatus.cached ||\n (event.shiftKey && spherical)) {\n return;\n }\n\n if (!spherical) {\n this._moveDir(direction, edgeStatus);\n } else {\n const shifts: { [dir: number]: number } = {};\n\n shifts[NavigationDirection.StepBackward] = Math.PI;\n shifts[NavigationDirection.StepForward] = 0;\n shifts[NavigationDirection.StepLeft] = Math.PI / 2;\n shifts[NavigationDirection.StepRight] = -Math.PI / 2;\n\n const phi: number = this._rotationFromCamera(frame.state.camera).phi;\n const navigationAngle: number = this._spatial.wrapAngle(phi + shifts[direction]);\n const threshold: number = Math.PI / 4;\n const edges: NavigationEdge[] = edgeStatus.edges.filter(\n (e: NavigationEdge): boolean => {\n return e.data.direction === NavigationDirection.Spherical || e.data.direction === direction;\n });\n\n let smallestAngle: number = Number.MAX_VALUE;\n let toKey: string = null;\n for (const edge of edges) {\n const angle: number = Math.abs(this._spatial.wrapAngle(edge.data.worldMotionAzimuth - navigationAngle));\n\n if (angle < Math.min(smallestAngle, threshold)) {\n smallestAngle = angle;\n toKey = edge.target;\n }\n }\n\n if (toKey == null) {\n return;\n }\n\n this._moveTo(toKey);\n }\n });\n }\n\n protected _disable(): void {\n this._keyDownSubscription.unsubscribe();\n }\n\n protected _getConfiguration(enable: boolean): KeyboardConfiguration {\n return { keySpatialNavigation: enable };\n }\n\n private _moveDir(direction: NavigationDirection, edgeStatus: NavigationEdgeStatus): void {\n for (const edge of edgeStatus.edges) {\n if (edge.data.direction === direction) {\n this._moveTo(edge.target);\n return;\n }\n }\n }\n\n private _moveTo(id: string): void {\n this._navigator.moveTo$(id)\n .subscribe(\n undefined,\n (error: Error): void => {\n if (!(error instanceof CancelMapillaryError)) {\n console.error(error);\n }\n });\n }\n\n private _rotationFromCamera(camera: Camera): EulerRotation {\n let direction: THREE.Vector3 = camera.lookat.clone().sub(camera.position);\n\n let upProjection: number = direction.clone().dot(camera.up);\n let planeProjection: THREE.Vector3 = direction.clone().sub(camera.up.clone().multiplyScalar(upProjection));\n\n let phi: number = Math.atan2(planeProjection.y, planeProjection.x);\n let theta: number = Math.PI / 2 - this._spatial.angleToPlane(direction.toArray(), [0, 0, 1]);\n\n return { phi: phi, theta: theta };\n }\n}\n","import { withLatestFrom } from \"rxjs/operators\";\nimport { Subscription } from \"rxjs\";\n\nimport { Transform } from \"../../geo/Transform\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { Component } from \"../Component\";\nimport { KeyboardConfiguration } from \"../interfaces/KeyboardConfiguration\";\nimport { HandlerBase } from \"../util/HandlerBase\";\n\n/**\n * The `KeyZoomHandler` allows the user to zoom in and out using the\n * following key commands:\n *\n * `+`: Zoom in.\n * `-`: Zoom out.\n *\n * @example\n * ```js\n * var keyboardComponent = viewer.getComponent(\"keyboard\");\n *\n * keyboardComponent.keyZoom.disable();\n * keyboardComponent.keyZoom.enable();\n *\n * var isEnabled = keyboardComponent.keyZoom.isEnabled;\n * ```\n */\nexport class KeyZoomHandler extends HandlerBase<KeyboardConfiguration> {\n private _keyDownSubscription: Subscription;\n\n private _viewportCoords: ViewportCoords;\n\n /** @ignore */\n constructor(\n component: Component<KeyboardConfiguration>,\n container: Container,\n navigator: Navigator,\n viewportCoords: ViewportCoords) {\n super(component, container, navigator);\n\n this._viewportCoords = viewportCoords;\n }\n\n protected _enable(): void {\n this._keyDownSubscription = this._container.keyboardService.keyDown$.pipe(\n withLatestFrom(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentTransform$))\n .subscribe(\n ([event, render, transform]: [KeyboardEvent, RenderCamera, Transform]): void => {\n if (event.altKey || event.ctrlKey || event.metaKey) {\n return;\n }\n\n let delta: number = 0;\n switch (event.key) {\n case \"+\":\n delta = 1;\n break;\n case \"-\":\n delta = -1;\n break;\n default:\n return;\n }\n\n event.preventDefault();\n\n const unprojected: THREE.Vector3 = this._viewportCoords.unprojectFromViewport(0, 0, render.perspective);\n const reference: number[] = transform.projectBasic(unprojected.toArray());\n\n this._navigator.stateService.zoomIn(delta, reference);\n });\n }\n\n protected _disable(): void {\n this._keyDownSubscription.unsubscribe();\n }\n\n protected _getConfiguration(enable: boolean): KeyboardConfiguration {\n return { keyZoom: enable };\n }\n}\n","import {\n Observable,\n Subscription,\n} from \"rxjs\";\nimport {\n distinctUntilChanged,\n map,\n switchMap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { NavigationDirection } from \"../../graph/edge/NavigationDirection\";\nimport { NavigationEdgeStatus } from \"../../graph/interfaces/NavigationEdgeStatus\";\nimport { Image } from \"../../graph/Image\";\nimport { State } from \"../../state/State\";\nimport { KeyboardConfiguration } from \"../interfaces/KeyboardConfiguration\";\nimport { HandlerBase } from \"../util/HandlerBase\";\n\n/**\n * The `KeyPlayHandler` allows the user to control the play behavior\n * using the following key commands:\n *\n * `Spacebar`: Start or stop playing.\n * `SHIFT` + `D`: Switch direction.\n * `<`: Decrease speed.\n * `>`: Increase speed.\n *\n * @example\n * ```js\n * var keyboardComponent = viewer.getComponent(\"keyboard\");\n *\n * keyboardComponent.keyPlay.disable();\n * keyboardComponent.keyPlay.enable();\n *\n * var isEnabled = keyboardComponent.keyPlay.isEnabled;\n * ```\n */\nexport class KeyPlayHandler extends HandlerBase<KeyboardConfiguration> {\n private _keyDownSubscription: Subscription;\n\n protected _enable(): void {\n this._keyDownSubscription = this._container.keyboardService.keyDown$.pipe(\n withLatestFrom(\n this._navigator.playService.playing$,\n this._navigator.playService.direction$,\n this._navigator.playService.speed$,\n this._navigator.stateService.currentImage$.pipe(\n switchMap(\n (image: Image): Observable<NavigationEdgeStatus> => {\n return image.sequenceEdges$;\n })),\n this._navigator.stateService.state$.pipe(\n map(\n (state: State): boolean => {\n return state === State.Earth;\n }),\n distinctUntilChanged())))\n .subscribe(\n (\n [event, playing, direction, speed, status, earth]:\n [KeyboardEvent, boolean, NavigationDirection, number, NavigationEdgeStatus, boolean]): void => {\n\n if (event.altKey || event.ctrlKey || event.metaKey) {\n return;\n }\n\n switch (event.key) {\n case \"D\":\n if (!event.shiftKey) {\n return;\n }\n\n const newDirection: NavigationDirection = playing ?\n null : direction === NavigationDirection.Next ?\n NavigationDirection.Prev : direction === NavigationDirection.Prev ?\n NavigationDirection.Next : null;\n\n if (newDirection != null) {\n this._navigator.playService.setDirection(newDirection);\n }\n\n break;\n case \" \":\n if (event.shiftKey) {\n return;\n }\n\n if (!earth) {\n if (playing) {\n this._navigator.playService.stop();\n } else {\n for (let edge of status.edges) {\n if (edge.data.direction === direction) {\n this._navigator.playService.play();\n }\n }\n }\n }\n\n break;\n case \"<\":\n this._navigator.playService.setSpeed(speed - 0.05);\n break;\n case \">\":\n this._navigator.playService.setSpeed(speed + 0.05);\n break;\n default:\n return;\n }\n\n event.preventDefault();\n });\n }\n\n protected _disable(): void {\n this._keyDownSubscription.unsubscribe();\n }\n\n protected _getConfiguration(enable: boolean): KeyboardConfiguration {\n return { keyPlay: enable };\n }\n}\n","import { Component } from \"../Component\";\n\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { Spatial } from \"../../geo/Spatial\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { KeyboardConfiguration } from \"../interfaces/KeyboardConfiguration\";\nimport { KeySequenceNavigationHandler } from \"./KeySequenceNavigationHandler\";\nimport { KeySpatialNavigationHandler } from \"./KeySpatialNavigationHandler\";\nimport { KeyZoomHandler } from \"./KeyZoomHandler\";\nimport { KeyPlayHandler } from \"./KeyPlayHandler\";\nimport { ComponentName } from \"../ComponentName\";\n\n/**\n * @class KeyboardComponent\n *\n * @classdesc Component for keyboard event handling.\n *\n * To retrive and use the keyboard component\n *\n * @example\n * ```js\n * var viewer = new Viewer({ ... });\n *\n * var keyboardComponent = viewer.getComponent(\"keyboard\");\n * ```\n */\nexport class KeyboardComponent extends Component<KeyboardConfiguration> {\n public static componentName: ComponentName = \"keyboard\";\n\n private _keyPlayHandler: KeyPlayHandler;\n private _keySequenceNavigationHandler: KeySequenceNavigationHandler;\n private _keySpatialNavigationHandler: KeySpatialNavigationHandler;\n private _keyZoomHandler: KeyZoomHandler;\n\n /** @ignore */\n constructor(\n name: string,\n container: Container,\n navigator: Navigator) {\n\n super(name, container, navigator);\n\n this._keyPlayHandler =\n new KeyPlayHandler(\n this,\n container,\n navigator);\n\n this._keySequenceNavigationHandler =\n new KeySequenceNavigationHandler(\n this,\n container,\n navigator);\n\n this._keySpatialNavigationHandler =\n new KeySpatialNavigationHandler(\n this,\n container,\n navigator,\n new Spatial());\n\n this._keyZoomHandler =\n new KeyZoomHandler(\n this,\n container,\n navigator,\n new ViewportCoords());\n }\n\n /**\n * Get key play.\n *\n * @returns {KeyPlayHandler} The key play handler.\n */\n public get keyPlay(): KeyPlayHandler {\n return this._keyPlayHandler;\n }\n\n /**\n * Get key sequence navigation.\n *\n * @returns {KeySequenceNavigationHandler} The key sequence navigation handler.\n */\n public get keySequenceNavigation(): KeySequenceNavigationHandler {\n return this._keySequenceNavigationHandler;\n }\n\n /**\n * Get spatial.\n *\n * @returns {KeySpatialNavigationHandler} The spatial handler.\n */\n public get keySpatialNavigation(): KeySpatialNavigationHandler {\n return this._keySpatialNavigationHandler;\n }\n\n /**\n * Get key zoom.\n *\n * @returns {KeyZoomHandler} The key zoom handler.\n */\n public get keyZoom(): KeyZoomHandler {\n return this._keyZoomHandler;\n }\n\n protected _activate(): void {\n this._subscriptions.push(this._configuration$\n .subscribe(\n (configuration: KeyboardConfiguration): void => {\n if (configuration.keyPlay) {\n this._keyPlayHandler.enable();\n } else {\n this._keyPlayHandler.disable();\n }\n\n if (configuration.keySequenceNavigation) {\n this._keySequenceNavigationHandler.enable();\n } else {\n this._keySequenceNavigationHandler.disable();\n }\n\n if (configuration.keySpatialNavigation) {\n this._keySpatialNavigationHandler.enable();\n } else {\n this._keySpatialNavigationHandler.disable();\n }\n\n if (configuration.keyZoom) {\n this._keyZoomHandler.enable();\n } else {\n this._keyZoomHandler.disable();\n }\n }));\n }\n\n protected _deactivate(): void {\n this._subscriptions.unsubscribe();\n\n this._keyPlayHandler.disable();\n this._keySequenceNavigationHandler.disable();\n this._keySpatialNavigationHandler.disable();\n this._keyZoomHandler.disable();\n }\n\n protected _getDefaultConfiguration(): KeyboardConfiguration {\n return { keyPlay: true, keySequenceNavigation: true, keySpatialNavigation: true, keyZoom: true };\n }\n}\n","import * as THREE from \"three\";\nimport { LngLat } from \"../../api/interfaces/LngLat\";\nimport { Marker } from \"./marker/Marker\";\n\nexport class MarkerScene {\n private _needsRender: boolean;\n private _interactiveObjects: THREE.Object3D[];\n private _markers: { [key: string]: Marker };\n private _objectMarkers: { [id: string]: string };\n private _raycaster: THREE.Raycaster;\n private _scene: THREE.Scene;\n\n constructor(scene?: THREE.Scene, raycaster?: THREE.Raycaster) {\n this._needsRender = false;\n this._interactiveObjects = [];\n this._markers = {};\n this._objectMarkers = {};\n this._raycaster = !!raycaster ? raycaster : new THREE.Raycaster();\n this._scene = !!scene ? scene : new THREE.Scene();\n }\n\n public get markers(): { [key: string]: Marker } {\n return this._markers;\n }\n\n public get needsRender(): boolean {\n return this._needsRender;\n }\n\n public add(marker: Marker, position: number[]): void {\n if (marker.id in this._markers) {\n this._dispose(marker.id);\n }\n\n marker.createGeometry(position);\n this._scene.add(marker.geometry);\n this._markers[marker.id] = marker;\n for (let interactiveObject of marker.getInteractiveObjects()) {\n this._interactiveObjects.push(interactiveObject);\n this._objectMarkers[interactiveObject.uuid] = marker.id;\n }\n\n this._needsRender = true;\n }\n\n public clear(): void {\n for (const id in this._markers) {\n if (!this._markers.hasOwnProperty) {\n continue;\n }\n\n this._dispose(id);\n }\n\n this._needsRender = true;\n }\n\n public get(id: string): Marker {\n return this._markers[id];\n }\n\n public getAll(): Marker[] {\n return Object\n .keys(this._markers)\n .map((id: string): Marker => { return this._markers[id]; });\n }\n\n public has(id: string): boolean {\n return id in this._markers;\n }\n\n public intersectObjects([viewportX, viewportY]: number[], camera: THREE.Camera): string {\n this._raycaster.setFromCamera(new THREE.Vector2(viewportX, viewportY), camera);\n\n const intersects: THREE.Intersection[] = this._raycaster.intersectObjects(this._interactiveObjects);\n for (const intersect of intersects) {\n if (intersect.object.uuid in this._objectMarkers) {\n return this._objectMarkers[intersect.object.uuid];\n }\n }\n\n return null;\n }\n\n public lerpAltitude(id: string, alt: number, alpha: number): void {\n if (!(id in this._markers)) {\n return;\n }\n\n this._markers[id].lerpAltitude(alt, alpha);\n\n this._needsRender = true;\n }\n\n public remove(id: string): void {\n if (!(id in this._markers)) {\n return;\n }\n\n this._dispose(id);\n\n this._needsRender = true;\n }\n\n public render(\n perspectiveCamera: THREE.PerspectiveCamera,\n renderer: THREE.WebGLRenderer): void {\n\n renderer.render(this._scene, perspectiveCamera);\n\n this._needsRender = false;\n }\n\n public update(id: string, position: number[], lngLat?: LngLat): void {\n if (!(id in this._markers)) {\n return;\n }\n\n const marker: Marker = this._markers[id];\n marker.updatePosition(position, lngLat);\n\n this._needsRender = true;\n }\n\n private _dispose(id: string): void {\n const marker: Marker = this._markers[id];\n this._scene.remove(marker.geometry);\n for (let interactiveObject of marker.getInteractiveObjects()) {\n const index: number = this._interactiveObjects.indexOf(interactiveObject);\n if (index !== -1) {\n this._interactiveObjects.splice(index, 1);\n } else {\n console.warn(`Object does not exist (${interactiveObject.id}) for ${id}`);\n }\n\n delete this._objectMarkers[interactiveObject.uuid];\n }\n\n marker.disposeGeometry();\n\n delete this._markers[id];\n }\n}\n","import * as THREE from \"three\";\n\nimport {\n combineLatest as observableCombineLatest,\n concat as observableConcat,\n merge as observableMerge,\n of as observableOf,\n Observable,\n} from \"rxjs\";\n\nimport {\n distinctUntilChanged,\n first,\n map,\n pairwise,\n publishReplay,\n refCount,\n skip,\n startWith,\n switchMap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Component } from \"../Component\";\nimport { Image } from \"../../graph/Image\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { LngLat } from \"../../api/interfaces/LngLat\";\nimport { LngLatAlt } from \"../../api/interfaces/LngLatAlt\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { GraphCalculator } from \"../../graph/GraphCalculator\";\nimport { RenderPass } from \"../../render/RenderPass\";\nimport { GLRenderHash } from \"../../render/interfaces/IGLRenderHash\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { MarkerConfiguration } from \"../interfaces/MarkerConfiguration\";\nimport { Marker } from \"./marker/Marker\";\nimport { MarkerSet } from \"./MarkerSet\";\nimport { MarkerScene } from \"./MarkerScene\";\nimport { ComponentEventType } from \"../events/ComponentEventType\";\nimport {\n enuToGeodetic,\n geodeticToEnu,\n} from \"../../geo/GeoCoords\";\nimport { ComponentMarkerEvent } from \"../events/ComponentMarkerEvent\";\nimport { ComponentEvent } from \"../events/ComponentEvent\";\nimport { ComponentName } from \"../ComponentName\";\n\n/**\n * @class MarkerComponent\n *\n * @classdesc Component for showing and editing 3D marker objects.\n *\n * The `add` method is used for adding new markers or replacing\n * markers already in the set.\n *\n * If a marker already in the set has the same\n * id as one of the markers added, the old marker will be removed and\n * the added marker will take its place.\n *\n * It is not possible to update markers in the set by updating any properties\n * directly on the marker object. Markers need to be replaced by\n * re-adding them for updates to geographic position or configuration\n * to be reflected.\n *\n * Markers added to the marker component can be either interactive\n * or non-interactive. Different marker types define their behavior.\n * Markers with interaction support can be configured with options\n * to respond to dragging inside the viewer and be detected when\n * retrieving markers from pixel points with the `getMarkerIdAt` method.\n *\n * To retrive and use the marker component\n *\n * @example\n * ```js\n * var viewer = new Viewer({ component: { marker: true }, ... });\n *\n * var markerComponent = viewer.getComponent(\"marker\");\n * ```\n */\nexport class MarkerComponent extends Component<MarkerConfiguration> {\n public static componentName: ComponentName = \"marker\";\n\n private _graphCalculator: GraphCalculator;\n private _markerScene: MarkerScene;\n private _markerSet: MarkerSet;\n private _viewportCoords: ViewportCoords;\n\n private _relativeGroundAltitude: number;\n\n /** @ignore */\n constructor(\n name: string,\n container: Container,\n navigator: Navigator) {\n\n super(name, container, navigator);\n\n this._graphCalculator = new GraphCalculator();\n this._markerScene = new MarkerScene();\n this._markerSet = new MarkerSet();\n this._viewportCoords = new ViewportCoords();\n\n this._relativeGroundAltitude = -2;\n }\n\n /**\n * Add markers to the marker set or replace markers in the marker set.\n *\n * @description If a marker already in the set has the same\n * id as one of the markers added, the old marker will be removed\n * the added marker will take its place.\n *\n * Any marker inside the visible bounding bbox\n * will be initialized and placed in the viewer.\n *\n * @param {Array<Marker>} markers - Markers to add.\n *\n * @example\n * ```js\n * markerComponent.add([marker1, marker2]);\n * ```\n */\n public add(markers: Marker[]): void {\n this._markerSet.add(markers);\n }\n\n public fire(\n type:\n | \"markerdragend\"\n | \"markerdragstart\"\n | \"markerposition\",\n event: ComponentMarkerEvent)\n : void;\n /** @ignore */\n public fire(\n type: ComponentEventType,\n event: ComponentEvent)\n : void;\n public fire<T>(\n type: ComponentEventType,\n event: T)\n : void {\n super.fire(type, event);\n }\n\n /**\n * Returns the marker in the marker set with the specified id, or\n * undefined if the id matches no marker.\n *\n * @param {string} markerId - Id of the marker.\n *\n * @example\n * ```js\n * var marker = markerComponent.get(\"markerId\");\n * ```\n *\n */\n public get(markerId: string): Marker {\n return this._markerSet.get(markerId);\n }\n\n /**\n * Returns an array of all markers.\n *\n * @example\n * ```js\n * var markers = markerComponent.getAll();\n * ```\n */\n public getAll(): Marker[] {\n return this._markerSet.getAll();\n }\n\n /**\n * Returns the id of the interactive marker closest to the current camera\n * position at the specified point.\n *\n * @description Notice that the pixelPoint argument requires x, y\n * coordinates from pixel space.\n *\n * With this function, you can use the coordinates provided by mouse\n * events to get information out of the marker component.\n *\n * If no interactive geometry of an interactive marker exist at the pixel\n * point, `null` will be returned.\n *\n * @param {Array<number>} pixelPoint - Pixel coordinates on the viewer element.\n * @returns {string} Id of the interactive marker closest to the camera. If no\n * interactive marker exist at the pixel point, `null` will be returned.\n *\n * @example\n * ```js\n * markerComponent.getMarkerIdAt([100, 100])\n * .then((markerId) => { console.log(markerId); });\n * ```\n */\n public getMarkerIdAt(pixelPoint: number[]): Promise<string> {\n return new Promise<string>((resolve: (value: string) => void, reject: (reason: Error) => void): void => {\n this._container.renderService.renderCamera$.pipe(\n first(),\n map(\n (render: RenderCamera): string => {\n const viewport = this._viewportCoords\n .canvasToViewport(\n pixelPoint[0],\n pixelPoint[1],\n this._container.container);\n\n const id: string = this._markerScene.intersectObjects(viewport, render.perspective);\n\n return id;\n }))\n .subscribe(\n (id: string): void => {\n resolve(id);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Check if a marker exist in the marker set.\n *\n * @param {string} markerId - Id of the marker.\n *\n * @example\n * ```js\n * var markerExists = markerComponent.has(\"markerId\");\n * ```\n */\n public has(markerId: string): boolean {\n return this._markerSet.has(markerId);\n }\n\n public off(\n type:\n | \"markerdragend\"\n | \"markerdragstart\"\n | \"markerposition\",\n handler: (event: ComponentMarkerEvent) => void)\n : void;\n /** @ignore */\n public off(\n type: ComponentEventType,\n handler: (event: ComponentEvent) => void)\n : void;\n public off<T>(\n type: ComponentEventType,\n handler: (event: T) => void)\n : void {\n super.off(type, handler);\n }\n\n /**\n * Fired when a marker drag interaction ends.\n *\n * @event markerdragend\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * var component = viewer.getComponent('<component-name>');\n * // Set an event listener\n * component.on('markerdragend', function() {\n * console.log(\"A markerdragend event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"markerdragend\",\n handler: (event: ComponentMarkerEvent) => void)\n : void;\n /**\n * Fired when a marker drag interaction starts.\n *\n * @event markerdragstart\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * var component = viewer.getComponent('<component-name>');\n * // Set an event listener\n * component.on('markerdragstart', function() {\n * console.log(\"A markerdragstart event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"markerdragstart\",\n handler: (event: ComponentMarkerEvent) => void)\n : void;\n /**\n * Fired when the position of a marker is changed.\n *\n * @event markerposition\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * var component = viewer.getComponent('<component-name>');\n * // Set an event listener\n * component.on('markerposition', function() {\n * console.log(\"A markerposition event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"markerposition\",\n handler: (event: ComponentMarkerEvent) => void)\n : void;\n public on<T>(\n type: ComponentEventType,\n handler: (event: T) => void)\n : void {\n super.on(type, handler);\n }\n\n /**\n * Remove markers with the specified ids from the marker set.\n *\n * @param {Array<string>} markerIds - Ids for markers to remove.\n *\n * @example\n * ```js\n * markerComponent.remove([\"id-1\", \"id-2\"]);\n * ```\n */\n public remove(markerIds: string[]): void {\n this._markerSet.remove(markerIds);\n }\n\n /**\n * Remove all markers from the marker set.\n *\n * @example\n * ```js\n * markerComponent.removeAll();\n * ```\n */\n public removeAll(): void {\n this._markerSet.removeAll();\n }\n\n protected _activate(): void {\n const groundAltitude$ = this._navigator.stateService.currentState$.pipe(\n map(\n (frame: AnimationFrame): number => {\n return frame.state.camera.position.z + this._relativeGroundAltitude;\n }),\n distinctUntilChanged(\n (a1: number, a2: number): boolean => {\n return Math.abs(a1 - a2) < 0.01;\n }),\n publishReplay(1),\n refCount());\n\n const geoInitiated$ = observableCombineLatest(\n groundAltitude$,\n this._navigator.stateService.reference$).pipe(\n first(),\n map((): void => { /* noop */ }),\n publishReplay(1),\n refCount());\n\n const clampedConfiguration$ = this._configuration$.pipe(\n map(\n (configuration: MarkerConfiguration): MarkerConfiguration => {\n return { visibleBBoxSize: Math.max(1, Math.min(200, configuration.visibleBBoxSize)) };\n }));\n\n const currentLngLat$ = this._navigator.stateService.currentImage$.pipe(\n map((image: Image): LngLat => { return image.lngLat; }),\n publishReplay(1),\n refCount());\n\n const visibleBBox$ = observableCombineLatest(\n clampedConfiguration$,\n currentLngLat$).pipe(\n map(\n ([configuration, lngLat]: [MarkerConfiguration, LngLat]): [LngLat, LngLat] => {\n return this._graphCalculator\n .boundingBoxCorners(lngLat, configuration.visibleBBoxSize / 2);\n }),\n publishReplay(1),\n refCount());\n\n const visibleMarkers$ = observableCombineLatest(\n observableConcat(\n observableOf<MarkerSet>(this._markerSet),\n this._markerSet.changed$),\n visibleBBox$).pipe(\n map(\n ([set, bbox]: [MarkerSet, [LngLat, LngLat]]): Marker[] => {\n return set.search(bbox);\n }));\n\n const subs = this._subscriptions;\n\n subs.push(geoInitiated$.pipe(\n switchMap(\n (): Observable<[Marker[], LngLatAlt, number]> => {\n return visibleMarkers$.pipe(\n withLatestFrom(\n this._navigator.stateService.reference$,\n groundAltitude$));\n }))\n .subscribe(\n (\n [markers, reference, alt]\n : [Marker[], LngLatAlt, number])\n : void => {\n const markerScene: MarkerScene = this._markerScene;\n const sceneMarkers: { [id: string]: Marker } =\n markerScene.markers;\n const markersToRemove: { [id: string]: Marker } =\n Object.assign({}, sceneMarkers);\n\n for (const marker of markers) {\n if (marker.id in sceneMarkers) {\n delete markersToRemove[marker.id];\n } else {\n const point3d =\n geodeticToEnu(\n marker.lngLat.lng,\n marker.lngLat.lat,\n reference.alt + alt,\n reference.lng,\n reference.lat,\n reference.alt);\n\n markerScene.add(marker, point3d);\n }\n }\n\n for (const id in markersToRemove) {\n if (!markersToRemove.hasOwnProperty(id)) {\n continue;\n }\n\n markerScene.remove(id);\n }\n }));\n\n subs.push(geoInitiated$.pipe(\n switchMap(\n (): Observable<[Marker[], [LngLat, LngLat], LngLatAlt, number]> => {\n return this._markerSet.updated$.pipe(\n withLatestFrom(\n visibleBBox$,\n this._navigator.stateService.reference$,\n groundAltitude$));\n }))\n .subscribe(\n (\n [markers, [sw, ne], reference, alt]\n : [Marker[], [LngLat, LngLat], LngLatAlt, number])\n : void => {\n const markerScene: MarkerScene = this._markerScene;\n\n for (const marker of markers) {\n const exists = markerScene.has(marker.id);\n const visible = marker.lngLat.lat > sw.lat &&\n marker.lngLat.lat < ne.lat &&\n marker.lngLat.lng > sw.lng &&\n marker.lngLat.lng < ne.lng;\n\n if (visible) {\n const point3d =\n geodeticToEnu(\n marker.lngLat.lng,\n marker.lngLat.lat,\n reference.alt + alt,\n reference.lng,\n reference.lat,\n reference.alt);\n\n markerScene.add(marker, point3d);\n } else if (!visible && exists) {\n markerScene.remove(marker.id);\n }\n }\n }));\n\n subs.push(this._navigator.stateService.reference$.pipe(\n skip(1),\n withLatestFrom(groundAltitude$))\n .subscribe(\n ([reference, alt]: [LngLatAlt, number]): void => {\n const markerScene: MarkerScene = this._markerScene;\n\n for (const marker of markerScene.getAll()) {\n const point3d =\n geodeticToEnu(\n marker.lngLat.lng,\n marker.lngLat.lat,\n reference.alt + alt,\n reference.lng,\n reference.lat,\n reference.alt);\n\n markerScene.update(marker.id, point3d);\n }\n }));\n\n subs.push(groundAltitude$.pipe(\n skip(1),\n withLatestFrom(\n this._navigator.stateService.reference$,\n currentLngLat$))\n .subscribe(\n (\n [alt, reference, lngLat]\n : [number, LngLatAlt, LngLat])\n : void => {\n const markerScene = this._markerScene;\n\n const position =\n geodeticToEnu(\n lngLat.lng,\n lngLat.lat,\n reference.alt + alt,\n reference.lng,\n reference.lat,\n reference.alt);\n\n for (const marker of markerScene.getAll()) {\n const point3d =\n geodeticToEnu(\n marker.lngLat.lng,\n marker.lngLat.lat,\n reference.alt + alt,\n reference.lng,\n reference.lat,\n reference.alt);\n\n const distanceX = point3d[0] - position[0];\n const distanceY = point3d[1] - position[1];\n\n const groundDistance = Math\n .sqrt(distanceX * distanceX + distanceY * distanceY);\n if (groundDistance > 50) {\n continue;\n }\n\n markerScene.lerpAltitude(marker.id, alt, Math.min(1, Math.max(0, 1.2 - 1.2 * groundDistance / 50)));\n }\n }));\n\n subs.push(this._navigator.stateService.currentState$\n .pipe(\n map(\n (frame: AnimationFrame): GLRenderHash => {\n const scene = this._markerScene;\n\n return {\n name: this._name,\n renderer: {\n frameId: frame.id,\n needsRender: scene.needsRender,\n render: scene.render.bind(scene),\n pass: RenderPass.Opaque,\n },\n };\n }))\n .subscribe(this._container.glRenderer.render$));\n\n const hoveredMarkerId$: Observable<string> =\n observableCombineLatest(\n this._container.renderService.renderCamera$,\n this._container.mouseService.mouseMove$)\n .pipe(\n map(\n ([render, event]: [RenderCamera, MouseEvent]): string => {\n const element = this._container.container;\n const [canvasX, canvasY] = this._viewportCoords.canvasPosition(event, element);\n const viewport = this._viewportCoords\n .canvasToViewport(\n canvasX,\n canvasY,\n element);\n\n const markerId: string = this._markerScene.intersectObjects(viewport, render.perspective);\n\n return markerId;\n }),\n publishReplay(1),\n refCount());\n\n const draggingStarted$: Observable<boolean> =\n this._container.mouseService\n .filtered$(this._name, this._container.mouseService.mouseDragStart$).pipe(\n map(\n (): boolean => {\n return true;\n }));\n\n const draggingStopped$: Observable<boolean> =\n this._container.mouseService\n .filtered$(this._name, this._container.mouseService.mouseDragEnd$).pipe(\n map(\n (): boolean => {\n return false;\n }));\n\n const filteredDragging$: Observable<boolean> =\n observableMerge(\n draggingStarted$,\n draggingStopped$)\n .pipe(\n startWith(false));\n\n subs.push(observableMerge(\n draggingStarted$.pipe(\n withLatestFrom(hoveredMarkerId$)),\n observableCombineLatest(\n draggingStopped$,\n observableOf<string>(null))).pipe(\n startWith<[boolean, string]>([false, null]),\n pairwise())\n .subscribe(\n ([previous, current]: [boolean, string][]): void => {\n const dragging = current[0];\n const type: ComponentEventType =\n dragging ?\n \"markerdragstart\" :\n \"markerdragend\";\n const id = dragging ? current[1] : previous[1];\n const marker = this._markerScene.get(id);\n const event: ComponentMarkerEvent = {\n marker,\n target: this,\n type,\n };\n this.fire(type, event);\n }));\n\n const mouseDown$: Observable<boolean> = observableMerge(\n this._container.mouseService.mouseDown$.pipe(\n map((): boolean => { return true; })),\n this._container.mouseService.documentMouseUp$.pipe(\n map((): boolean => { return false; }))).pipe(\n startWith(false));\n\n subs.push(\n observableCombineLatest(\n this._container.mouseService.active$,\n hoveredMarkerId$.pipe(distinctUntilChanged()),\n mouseDown$,\n filteredDragging$)\n .pipe(\n map(\n (\n [active, markerId, mouseDown, filteredDragging]\n : [boolean, string, boolean, boolean])\n : boolean => {\n return (!active && markerId != null && mouseDown) ||\n filteredDragging;\n }),\n distinctUntilChanged())\n .subscribe(\n (claim: boolean): void => {\n if (claim) {\n this._container.mouseService.claimMouse(this._name, 1);\n this._container.mouseService.claimWheel(this._name, 1);\n } else {\n this._container.mouseService.unclaimMouse(this._name);\n this._container.mouseService.unclaimWheel(this._name);\n }\n }));\n\n const offset$: Observable<[Marker, number[], RenderCamera]> = this._container.mouseService\n .filtered$(this._name, this._container.mouseService.mouseDragStart$).pipe(\n withLatestFrom(\n hoveredMarkerId$,\n this._container.renderService.renderCamera$),\n map(\n (\n [e, id, r]:\n [MouseEvent, string, RenderCamera])\n : [Marker, number[], RenderCamera] => {\n const marker: Marker = this._markerScene.get(id);\n const element = this._container.container;\n\n const [groundCanvasX, groundCanvasY]: number[] =\n this._viewportCoords\n .projectToCanvas(\n marker.geometry.position\n .toArray(),\n element,\n r.perspective);\n\n const [canvasX, canvasY] = this._viewportCoords\n .canvasPosition(e, element);\n\n const offset = [canvasX - groundCanvasX, canvasY - groundCanvasY];\n\n return [marker, offset, r];\n }),\n publishReplay(1),\n refCount());\n\n subs.push(this._container.mouseService\n .filtered$(\n this._name,\n this._container.mouseService.mouseDrag$)\n .pipe(\n withLatestFrom(\n offset$,\n this._navigator.stateService.reference$,\n clampedConfiguration$))\n .subscribe(\n ([event, [marker, offset, render], reference, configuration]:\n [MouseEvent, [Marker, number[], RenderCamera], LngLatAlt, MarkerConfiguration]): void => {\n if (!this._markerScene.has(marker.id)) {\n return;\n }\n\n const element = this._container.container;\n const [canvasX, canvasY] = this._viewportCoords\n\n .canvasPosition(event, element);\n\n const groundX = canvasX - offset[0];\n const groundY = canvasY - offset[1];\n\n const [viewportX, viewportY] = this._viewportCoords\n .canvasToViewport(\n groundX,\n groundY,\n element);\n\n const direction =\n new THREE.Vector3(viewportX, viewportY, 1)\n .unproject(render.perspective)\n .sub(render.perspective.position)\n .normalize();\n\n const distance = Math.min(\n this._relativeGroundAltitude / direction.z,\n configuration.visibleBBoxSize / 2 - 0.1);\n\n if (distance < 0) {\n return;\n }\n\n const intersection = direction\n .clone()\n .multiplyScalar(distance)\n .add(render.perspective.position);\n\n intersection.z =\n render.perspective.position.z\n + this._relativeGroundAltitude;\n\n const [lng, lat] =\n enuToGeodetic(\n intersection.x,\n intersection.y,\n intersection.z,\n reference.lng,\n reference.lat,\n reference.alt);\n\n this._markerScene\n .update(\n marker.id,\n intersection.toArray(),\n { lat, lng });\n\n this._markerSet.update(marker);\n\n const type: ComponentEventType = \"markerposition\";\n const markerEvent: ComponentMarkerEvent = {\n marker,\n target: this,\n type,\n };\n this.fire(type, markerEvent);\n }));\n }\n\n protected _deactivate(): void {\n this._subscriptions.unsubscribe();\n this._markerScene.clear();\n }\n\n protected _getDefaultConfiguration(): MarkerConfiguration {\n return { visibleBBoxSize: 100 };\n }\n}\n","export type Point = { x: number, y: number };\n\nexport type Segment = { p1: Point, p2: Point };\n\nfunction sign(n: number): number {\n return n > 0 ? 1 : n < 0 ? -1 : 0;\n}\n\nfunction colinearPointOnSegment(p: Point, s: Segment): boolean {\n return p.x <= Math.max(s.p1.x, s.p2.x) &&\n p.x >= Math.min(s.p1.x, s.p2.x) &&\n p.y >= Math.max(s.p1.y, s.p2.y) &&\n p.y >= Math.min(s.p1.y, s.p2.y);\n}\n\nfunction parallel(s1: Segment, s2: Segment): boolean {\n const ux: number = s1.p2.x - s1.p1.x;\n const uy: number = s1.p2.y - s1.p1.y;\n const vx: number = s2.p2.x - s2.p1.x;\n const vy: number = s2.p2.y - s2.p1.y;\n\n const cross: number = ux * vy - uy * vx;\n const u2: number = ux * ux + uy * uy;\n const v2: number = vx * vx + vy * vy;\n\n const epsilon2: number = 1e-10;\n\n return cross * cross < epsilon2 * u2 * v2;\n}\n\nfunction tripletOrientation(p1: Point, p2: Point, p3: Point): number {\n const orientation: number =\n (p2.y - p1.y) * (p3.x - p2.x) -\n (p3.y - p2.y) * (p2.x - p1.x);\n\n return sign(orientation);\n}\n\nexport function segmentsIntersect(s1: Segment, s2: Segment): boolean {\n if (parallel(s1, s2)) {\n return false;\n }\n\n const o1: number = tripletOrientation(s1.p1, s1.p2, s2.p1);\n const o2: number = tripletOrientation(s1.p1, s1.p2, s2.p2);\n const o3: number = tripletOrientation(s2.p1, s2.p2, s1.p1);\n const o4: number = tripletOrientation(s2.p1, s2.p2, s1.p2);\n\n if (o1 !== o2 && o3 !== o4) {\n return true;\n }\n\n if (o1 === 0 && colinearPointOnSegment(s2.p1, s1)) {\n return true;\n }\n\n if (o2 === 0 && colinearPointOnSegment(s2.p2, s1)) {\n return true;\n }\n\n if (o3 === 0 && colinearPointOnSegment(s1.p1, s2)) {\n return true;\n }\n\n if (o4 === 0 && colinearPointOnSegment(s1.p2, s2)) {\n return true;\n }\n\n return false;\n}\n\nexport function segmentIntersection(s1: Segment, s2: Segment): Point {\n if (parallel(s1, s2)) {\n return undefined;\n }\n\n const x1: number = s1.p1.x;\n const x2: number = s1.p2.x;\n const y1: number = s1.p1.y;\n const y2: number = s1.p2.y;\n\n const x3: number = s2.p1.x;\n const x4: number = s2.p2.x;\n const y3: number = s2.p1.y;\n const y4: number = s2.p2.y;\n\n const den: number = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);\n const xNum: number = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4);\n const yNum: number = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4);\n\n return { x: xNum / den, y: yNum / den };\n}\n","import * as THREE from \"three\";\n\nimport * as Lines from \"../../geo/Lines\";\nimport { Transform } from \"../../geo/Transform\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\n\nfunction basicBoundaryPoints(pointsPerSide: number): number[][] {\n let points: number[][] = [];\n let os: number[][] = [[0, 0], [1, 0], [1, 1], [0, 1]];\n let ds: number[][] = [[1, 0], [0, 1], [-1, 0], [0, -1]];\n\n for (let side: number = 0; side < 4; ++side) {\n let o: number[] = os[side];\n let d: number[] = ds[side];\n\n for (let i: number = 0; i < pointsPerSide; ++i) {\n points.push([o[0] + d[0] * i / pointsPerSide,\n o[1] + d[1] * i / pointsPerSide]);\n }\n }\n\n return points;\n}\n\nfunction insideViewport(x: number, y: number): boolean {\n return x >= -1 && x <= 1 && y >= -1 && y <= 1;\n}\n\nfunction insideBasic(x: number, y: number): boolean {\n return x >= 0 && x <= 1 && y >= 0 && y <= 1;\n}\n\nexport function viewportDistances(transform: Transform, perspective: THREE.PerspectiveCamera, viewportCoords: ViewportCoords): number[] {\n const boundaryPointsBasic: number[][] = basicBoundaryPoints(100);\n const boundaryPointsViewport: number[][] = boundaryPointsBasic\n .map(\n (basic: number[]) => {\n return viewportCoords.basicToViewportSafe(basic[0], basic[1], transform, perspective);\n });\n\n const visibleBoundaryPoints: number[][] = [];\n const viewportSides: Lines.Point[] = [\n { x: -1, y: 1 },\n { x: 1, y: 1 },\n { x: 1, y: -1 },\n { x: -1, y: -1 }];\n\n const intersections: boolean[] = [false, false, false, false];\n\n for (let i: number = 0; i < boundaryPointsViewport.length; i++) {\n const p1: number[] = boundaryPointsViewport[i];\n const p2: number[] = boundaryPointsViewport[(i + 1) % boundaryPointsViewport.length];\n\n if (p1 === null) {\n continue;\n }\n\n if (p2 === null) {\n if (insideViewport(p1[0], p1[1])) {\n visibleBoundaryPoints.push(p1);\n }\n\n continue;\n }\n\n const [x1, y1]: number[] = p1;\n const [x2, y2]: number[] = p2;\n\n if (insideViewport(x1, y1)) {\n if (insideViewport(x2, y2)) {\n visibleBoundaryPoints.push(p1);\n } else {\n for (let side: number = 0; side < 4; side++) {\n const s1: Lines.Segment = { p1: { x: x1, y: y1 }, p2: { x: x2, y: y2 } };\n const s2: Lines.Segment = { p1: viewportSides[side], p2: viewportSides[(side + 1) % 4] };\n\n const intersecting: boolean = Lines.segmentsIntersect(s1, s2);\n\n if (intersecting) {\n const intersection: Lines.Point = Lines.segmentIntersection(s1, s2);\n\n visibleBoundaryPoints.push(p1, [intersection.x, intersection.y]);\n intersections[side] = true;\n }\n }\n }\n }\n }\n\n const [topLeftBasicX, topLeftBasicY]: number[] =\n viewportCoords.viewportToBasic(-1, 1, transform, perspective);\n\n const [topRightBasicX, topRightBasicY]: number[] =\n viewportCoords.viewportToBasic(1, 1, transform, perspective);\n\n const [bottomRightBasicX, bottomRightBasicY]: number[] =\n viewportCoords.viewportToBasic(1, -1, transform, perspective);\n\n const [bottomLeftBasicX, bottomLeftBasicY]: number[] =\n viewportCoords.viewportToBasic(-1, -1, transform, perspective);\n\n if (insideBasic(topLeftBasicX, topLeftBasicY)) {\n intersections[3] = intersections[0] = true;\n }\n\n if (insideBasic(topRightBasicX, topRightBasicY)) {\n intersections[0] = intersections[1] = true;\n }\n\n if (insideBasic(bottomRightBasicX, bottomRightBasicY)) {\n intersections[1] = intersections[2] = true;\n }\n\n if (insideBasic(bottomLeftBasicX, bottomLeftBasicY)) {\n intersections[2] = intersections[3] = true;\n }\n\n const maximums: number[] = [-1, -1, 1, 1];\n\n for (let visibleBoundaryPoint of visibleBoundaryPoints) {\n const x: number = visibleBoundaryPoint[0];\n const y: number = visibleBoundaryPoint[1];\n\n if (x > maximums[1]) {\n maximums[1] = x;\n }\n\n if (x < maximums[3]) {\n maximums[3] = x;\n }\n\n if (y > maximums[0]) {\n maximums[0] = y;\n }\n\n if (y < maximums[2]) {\n maximums[2] = y;\n }\n }\n\n const boundary: number[] = [1, 1, -1, -1];\n const distances: number[] = [];\n\n for (let side: number = 0; side < 4; side++) {\n if (intersections[side]) {\n distances.push(0);\n continue;\n }\n\n distances.push(Math.abs(boundary[side] - maximums[side]));\n }\n\n return distances;\n}\n","import * as THREE from \"three\";\n\nimport {\n empty as observableEmpty,\n combineLatest as observableCombineLatest,\n Observable,\n Subscription,\n} from \"rxjs\";\n\nimport {\n first,\n map,\n distinctUntilChanged,\n switchMap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Transform } from \"../../geo/Transform\";\nimport { Image } from \"../../graph/Image\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { Component } from \"../Component\";\nimport { PointerConfiguration } from \"../interfaces/PointerConfiguration\";\nimport { HandlerBase } from \"../util/HandlerBase\";\nimport { Spatial } from \"../../geo/Spatial\";\nimport * as ImageBoundary from \"./ImageBoundary\";\n\n/**\n * The `BounceHandler` ensures that the viewer bounces back to the image\n * when drag panning outside of the image edge.\n */\nexport class BounceHandler extends HandlerBase<PointerConfiguration> {\n private _spatial: Spatial;\n private _viewportCoords: ViewportCoords;\n\n private _bounceSubscription: Subscription;\n\n constructor(\n component: Component<PointerConfiguration>,\n container: Container,\n navigator: Navigator,\n viewportCoords: ViewportCoords,\n spatial: Spatial) {\n super(component, container, navigator);\n\n this._spatial = spatial;\n this._viewportCoords = viewportCoords;\n }\n\n protected _enable(): void {\n const inTransition$: Observable<boolean> = this._navigator.stateService.currentState$.pipe(\n map(\n (frame: AnimationFrame): boolean => {\n return frame.state.alpha < 1;\n }),\n distinctUntilChanged());\n\n this._bounceSubscription = observableCombineLatest(\n inTransition$,\n this._navigator.stateService.inTranslation$,\n this._container.mouseService.active$,\n this._container.touchService.active$).pipe(\n map(\n (noForce: boolean[]): boolean => {\n return noForce[0] || noForce[1] || noForce[2] || noForce[3];\n }),\n distinctUntilChanged(),\n switchMap(\n (noForce: boolean): Observable<[RenderCamera, Transform]> => {\n return noForce ?\n observableEmpty() :\n observableCombineLatest(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentTransform$.pipe(first()));\n }),\n withLatestFrom(this._navigator.panService.panImages$))\n .subscribe(\n ([[render, transform], nts]: [[RenderCamera, Transform], [Image, Transform, number][]]): void => {\n if (!transform.hasValidScale && render.camera.focal < 0.1) {\n return;\n }\n\n if (render.perspective.aspect === 0 || render.perspective.aspect === Number.POSITIVE_INFINITY) {\n return;\n }\n\n const distances: number[] = ImageBoundary.viewportDistances(transform, render.perspective, this._viewportCoords);\n\n const basic: number[] = this._viewportCoords.viewportToBasic(0, 0, transform, render.perspective);\n\n if ((basic[0] < 0 || basic[0] > 1) && nts.length > 0) {\n distances[0] = distances[2] = 0;\n }\n\n for (const [, t] of nts) {\n const d: number[] = ImageBoundary.viewportDistances(t, render.perspective, this._viewportCoords);\n\n for (let i: number = 1; i < distances.length; i += 2) {\n if (d[i] < distances[i]) {\n distances[i] = d[i];\n }\n }\n }\n\n if (Math.max(...distances) < 0.01) {\n return;\n }\n\n const horizontalDistance: number = distances[1] - distances[3];\n const verticalDistance: number = distances[0] - distances[2];\n\n const currentDirection: THREE.Vector3 = this._viewportCoords\n .unprojectFromViewport(0, 0, render.perspective)\n .sub(render.perspective.position);\n\n const directionPhi: THREE.Vector3 = this._viewportCoords\n .unprojectFromViewport(horizontalDistance, 0, render.perspective)\n .sub(render.perspective.position);\n\n const directionTheta: THREE.Vector3 = this._viewportCoords\n .unprojectFromViewport(0, verticalDistance, render.perspective)\n .sub(render.perspective.position);\n\n let phi: number = (horizontalDistance > 0 ? 1 : -1) * directionPhi.angleTo(currentDirection);\n let theta: number = (verticalDistance > 0 ? 1 : -1) * directionTheta.angleTo(currentDirection);\n\n const threshold: number = Math.PI / 60;\n const coeff: number = 1e-1;\n\n phi = this._spatial.clamp(coeff * phi, -threshold, threshold);\n theta = this._spatial.clamp(coeff * theta, -threshold, threshold);\n\n this._navigator.stateService.rotateUnbounded({ phi: phi, theta: theta });\n });\n }\n\n protected _disable(): void {\n this._bounceSubscription.unsubscribe();\n }\n\n protected _getConfiguration(): PointerConfiguration {\n return {};\n }\n}\n","import {\n concat as observableConcat,\n merge as observableMerge,\n of as observableOf,\n Observable,\n} from \"rxjs\";\n\nimport {\n map,\n filter,\n pairwise,\n startWith,\n switchMap,\n takeWhile,\n} from \"rxjs/operators\";\n\nimport { MouseService } from \"../../viewer/MouseService\";\n\nexport class MouseOperator {\n public static filteredPairwiseMouseDrag$(\n name: string,\n mouseService: MouseService): Observable<[MouseEvent, MouseEvent]> {\n return this._filteredPairwiseMouseDrag$(\n name,\n mouseService,\n mouseService.mouseDragStart$,\n mouseService.mouseDrag$,\n mouseService.mouseDragEnd$);\n }\n\n public static filteredPairwiseMouseRightDrag$(\n name: string,\n mouseService: MouseService): Observable<[MouseEvent, MouseEvent]> {\n return this._filteredPairwiseMouseDrag$(\n name,\n mouseService,\n mouseService.mouseRightDragStart$,\n mouseService.mouseRightDrag$,\n mouseService.mouseRightDragEnd$);\n }\n\n private static _filteredPairwiseMouseDrag$(\n name: string,\n mouseService: MouseService,\n mouseDragStart$: Observable<MouseEvent>,\n mouseDrag$: Observable<MouseEvent>,\n mouseDragEnd$: Observable<MouseEvent | FocusEvent>):\n Observable<[MouseEvent, MouseEvent]> {\n return mouseService\n .filtered$(name, mouseDragStart$).pipe(\n switchMap(\n (mouseDragStart: MouseEvent): Observable<MouseEvent> => {\n const dragging$: Observable<MouseEvent> = observableConcat(\n observableOf(mouseDragStart),\n mouseService\n .filtered$(name, mouseDrag$));\n\n const dragEnd$: Observable<MouseEvent> = mouseService\n .filtered$(name, mouseDragEnd$).pipe(\n map(\n (): MouseEvent => {\n return null;\n }));\n\n return observableMerge(dragging$, dragEnd$).pipe(\n takeWhile(\n (e: MouseEvent): boolean => {\n return !!e;\n }),\n startWith(null));\n }),\n pairwise(),\n filter(\n (pair: [MouseEvent, MouseEvent]): boolean => {\n return pair[0] != null && pair[1] != null;\n }));\n }\n}\n","import * as THREE from \"three\";\n\nimport {\n empty as observableEmpty,\n merge as observableMerge,\n Observable,\n Subscription,\n} from \"rxjs\";\n\nimport {\n distinctUntilChanged,\n filter,\n map,\n pairwise,\n sample,\n scan,\n share,\n switchMap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Transform } from \"../../geo/Transform\";\nimport { Image } from \"../../graph/Image\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { Component } from \"../Component\";\nimport { PointerConfiguration } from \"../interfaces/PointerConfiguration\";\nimport { HandlerBase } from \"../util/HandlerBase\";\nimport { Spatial } from \"../../geo/Spatial\";\nimport { EulerRotation } from \"../../state/interfaces/EulerRotation\";\nimport { MouseTouchPair } from \"./HandlerTypes\";\nimport { MouseOperator } from \"../util/MouseOperator\";\nimport * as ImageBoundary from \"./ImageBoundary\";\nimport { isSpherical } from \"../../geo/Geo\";\n\n/**\n * The `DragPanHandler` allows the user to pan the viewer image by clicking and dragging the cursor.\n *\n * @example\n * ```js\n * var pointerComponent = viewer.getComponent(\"pointer\");\n *\n * pointerComponent.dragPan.disable();\n * pointerComponent.dragPan.enable();\n *\n * var isEnabled = pointerComponent.dragPan.isEnabled;\n * ```\n */\nexport class DragPanHandler extends HandlerBase<PointerConfiguration> {\n private _spatial: Spatial;\n private _viewportCoords: ViewportCoords;\n\n private _activeMouseSubscription: Subscription;\n private _activeTouchSubscription: Subscription;\n private _preventDefaultSubscription: Subscription;\n private _rotateSubscription: Subscription;\n private _rotateWithoutInertiaSubscription: Subscription;\n\n /** @ignore */\n constructor(\n component: Component<PointerConfiguration>,\n container: Container,\n navigator: Navigator,\n viewportCoords: ViewportCoords,\n spatial: Spatial) {\n super(component, container, navigator);\n\n this._spatial = spatial;\n this._viewportCoords = viewportCoords;\n }\n\n protected _enable(): void {\n let draggingStarted$: Observable<boolean> =\n this._container.mouseService\n .filtered$(this._component.name, this._container.mouseService.mouseDragStart$).pipe(\n map(\n (): boolean => {\n return true;\n }),\n share());\n\n let draggingStopped$: Observable<boolean> =\n this._container.mouseService\n .filtered$(this._component.name, this._container.mouseService.mouseDragEnd$).pipe(\n map(\n (): boolean => {\n return false;\n }),\n share());\n\n this._activeMouseSubscription = observableMerge(\n draggingStarted$,\n draggingStopped$)\n .subscribe(this._container.mouseService.activate$);\n\n const documentMouseMove$: Observable<MouseEvent> = observableMerge(\n draggingStarted$,\n draggingStopped$).pipe(\n switchMap(\n (dragging: boolean): Observable<MouseEvent> => {\n return dragging ?\n this._container.mouseService.documentMouseMove$ :\n observableEmpty();\n }));\n\n this._preventDefaultSubscription = observableMerge(\n documentMouseMove$,\n this._container.touchService.touchMove$)\n .subscribe(\n (event: MouseEvent | TouchEvent): void => {\n event.preventDefault(); // prevent selection of content outside the viewer\n });\n\n let touchMovingStarted$: Observable<boolean> =\n this._container.touchService.singleTouchDragStart$.pipe(\n map(\n (): boolean => {\n return true;\n }));\n\n let touchMovingStopped$: Observable<boolean> =\n this._container.touchService.singleTouchDragEnd$.pipe(\n map(\n (): boolean => {\n return false;\n }));\n\n this._activeTouchSubscription = observableMerge(\n touchMovingStarted$,\n touchMovingStopped$)\n .subscribe(this._container.touchService.activate$);\n\n const rotation$: Observable<EulerRotation> = this._navigator.stateService.currentState$.pipe(\n map(\n (frame: AnimationFrame): boolean => {\n return isSpherical(frame.state.currentImage.cameraType) ||\n frame.state.imagesAhead < 1;\n }),\n distinctUntilChanged(),\n switchMap(\n (enable: boolean): Observable<MouseTouchPair> => {\n if (!enable) {\n return observableEmpty();\n }\n\n const mouseDrag$: Observable<[MouseEvent, MouseEvent]> =\n MouseOperator.filteredPairwiseMouseDrag$(this._component.name, this._container.mouseService);\n\n const singleTouchDrag$: Observable<[Touch, Touch]> = observableMerge(\n this._container.touchService.singleTouchDragStart$,\n this._container.touchService.singleTouchDrag$,\n this._container.touchService.singleTouchDragEnd$.pipe(\n map((): TouchEvent => { return null; }))).pipe(\n map(\n (event: TouchEvent): Touch => {\n return event != null && event.touches.length > 0 ?\n event.touches[0] : null;\n }),\n pairwise(),\n filter(\n (pair: [Touch, Touch]): boolean => {\n return pair[0] != null && pair[1] != null;\n }));\n\n return observableMerge(\n mouseDrag$,\n singleTouchDrag$);\n }),\n withLatestFrom(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentTransform$,\n this._navigator.panService.panImages$),\n map(\n ([events, render, transform, nts]:\n [\n MouseTouchPair,\n RenderCamera,\n Transform,\n [Image, Transform, number][],\n ]): EulerRotation => {\n let previousEvent: MouseEvent | Touch = events[0];\n let event: MouseEvent | Touch = events[1];\n\n let movementX: number = event.clientX - previousEvent.clientX;\n let movementY: number = event.clientY - previousEvent.clientY;\n\n let element: HTMLElement = this._container.container;\n\n let [canvasX, canvasY]: number[] = this._viewportCoords.canvasPosition(event, element);\n\n let currentDirection: THREE.Vector3 =\n this._viewportCoords.unprojectFromCanvas(\n canvasX,\n canvasY,\n element,\n render.perspective)\n .sub(render.perspective.position);\n\n let directionX: THREE.Vector3 =\n this._viewportCoords.unprojectFromCanvas(\n canvasX - movementX,\n canvasY,\n element,\n render.perspective)\n .sub(render.perspective.position);\n\n let directionY: THREE.Vector3 =\n this._viewportCoords.unprojectFromCanvas(\n canvasX,\n canvasY - movementY,\n element,\n render.perspective)\n .sub(render.perspective.position);\n\n let phi: number = (movementX > 0 ? 1 : -1) * directionX.angleTo(currentDirection);\n let theta: number = (movementY > 0 ? -1 : 1) * directionY.angleTo(currentDirection);\n\n const distances: number[] = ImageBoundary.viewportDistances(transform, render.perspective, this._viewportCoords);\n\n for (const [, t] of nts) {\n const d: number[] = ImageBoundary.viewportDistances(t, render.perspective, this._viewportCoords);\n\n for (let i: number = 0; i < distances.length; i++) {\n if (d[i] < distances[i]) {\n distances[i] = d[i];\n }\n }\n }\n\n if (distances[0] > 0 && theta < 0) {\n theta /= Math.max(1, 2e2 * distances[0]);\n }\n\n if (distances[2] > 0 && theta > 0) {\n theta /= Math.max(1, 2e2 * distances[2]);\n }\n\n if (distances[1] > 0 && phi < 0) {\n phi /= Math.max(1, 2e2 * distances[1]);\n }\n\n if (distances[3] > 0 && phi > 0) {\n phi /= Math.max(1, 2e2 * distances[3]);\n }\n\n return { phi: phi, theta: theta };\n }),\n share());\n\n this._rotateWithoutInertiaSubscription = rotation$\n .subscribe(\n (rotation: EulerRotation): void => {\n this._navigator.stateService.rotateWithoutInertia(rotation);\n });\n\n this._rotateSubscription = rotation$.pipe(\n scan(\n (rotationBuffer: [number, EulerRotation][], rotation: EulerRotation): [number, EulerRotation][] => {\n this._drainBuffer(rotationBuffer);\n\n rotationBuffer.push([Date.now(), rotation]);\n\n return rotationBuffer;\n },\n []),\n sample(\n observableMerge(\n this._container.mouseService.filtered$(\n this._component.name,\n this._container.mouseService.mouseDragEnd$),\n this._container.touchService.singleTouchDragEnd$)),\n map(\n (rotationBuffer: [number, EulerRotation][]): EulerRotation => {\n const drainedBuffer: [number, EulerRotation][] = this._drainBuffer(rotationBuffer.slice());\n const rotation: EulerRotation = { phi: 0, theta: 0 };\n\n for (const bufferedRotation of drainedBuffer) {\n rotation.phi += bufferedRotation[1].phi;\n rotation.theta += bufferedRotation[1].theta;\n }\n\n const count: number = drainedBuffer.length;\n if (count > 0) {\n rotation.phi /= count;\n rotation.theta /= count;\n }\n\n const threshold: number = Math.PI / 18;\n\n rotation.phi = this._spatial.clamp(rotation.phi, -threshold, threshold);\n rotation.theta = this._spatial.clamp(rotation.theta, -threshold, threshold);\n\n return rotation;\n }))\n .subscribe(\n (rotation: EulerRotation): void => {\n this._navigator.stateService.rotate(rotation);\n });\n }\n\n protected _disable(): void {\n this._activeMouseSubscription.unsubscribe();\n this._activeTouchSubscription.unsubscribe();\n this._preventDefaultSubscription.unsubscribe();\n this._rotateSubscription.unsubscribe();\n this._rotateWithoutInertiaSubscription.unsubscribe();\n\n this._activeMouseSubscription = null;\n this._activeTouchSubscription = null;\n this._preventDefaultSubscription = null;\n this._rotateSubscription = null;\n }\n\n protected _getConfiguration(enable: boolean): PointerConfiguration {\n return { dragPan: enable };\n }\n\n private _drainBuffer<T>(buffer: [number, T][]): [number, T][] {\n const cutoff: number = 50;\n const now: number = Date.now();\n\n while (buffer.length > 0 && now - buffer[0][0] > cutoff) {\n buffer.shift();\n }\n\n return buffer;\n }\n}\n","import { Observable } from '../Observable';\nimport { MonoTypeOperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { noop } from '../util/noop';\nimport { OperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * Emits the most recently emitted value from the source Observable whenever\n * another Observable, the `notifier`, emits.\n *\n * <span class=\"informal\">It's like {@link sampleTime}, but samples whenever\n * the `notifier` Observable emits something.</span>\n *\n * ![](sample.png)\n *\n * Whenever the `notifier` Observable emits a value, `sample`\n * looks at the source Observable and emits whichever value it has most recently\n * emitted since the previous sampling, unless the source has not emitted\n * anything since the previous sampling. The `notifier` is subscribed to as soon\n * as the output Observable is subscribed.\n *\n * ## Example\n * On every click, sample the most recent \"seconds\" timer\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { sample } from 'rxjs/operators';\n *\n * const seconds = interval(1000);\n * const clicks = fromEvent(document, 'click');\n * const result = seconds.pipe(sample(clicks));\n * result.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link audit}\n * @see {@link debounce}\n * @see {@link sampleTime}\n * @see {@link throttle}\n *\n * @param notifier The Observable to use for sampling the\n * source Observable.\n * @return A function that returns an Observable that emits the results of\n * sampling the values emitted by the source Observable whenever the notifier\n * Observable emits value or completes.\n */\nexport function sample<T>(notifier: Observable<any>): MonoTypeOperatorFunction<T> {\n return operate((source, subscriber) => {\n let hasValue = false;\n let lastValue: T | null = null;\n source.subscribe(\n new OperatorSubscriber(subscriber, (value) => {\n hasValue = true;\n lastValue = value;\n })\n );\n const emit = () => {\n if (hasValue) {\n hasValue = false;\n const value = lastValue!;\n lastValue = null;\n subscriber.next(value);\n }\n };\n notifier.subscribe(new OperatorSubscriber(subscriber, emit, noop));\n });\n}\n","import * as THREE from \"three\";\n\nimport {\n empty as observableEmpty,\n Observable,\n} from \"rxjs\";\n\nimport {\n map,\n filter,\n withLatestFrom,\n switchMap,\n publishReplay,\n refCount,\n} from \"rxjs/operators\";\n\nimport { Transform } from \"../../geo/Transform\";\nimport { Spatial } from \"../../geo/Spatial\";\nimport { EulerRotation } from \"../../state/interfaces/EulerRotation\";\nimport { State } from \"../../state/State\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { Component } from \"../Component\";\nimport { PointerConfiguration } from \"../interfaces/PointerConfiguration\";\nimport { HandlerBase } from \"../util/HandlerBase\";\nimport { MouseOperator } from \"../util/MouseOperator\";\nimport { SubscriptionHolder } from \"../../util/SubscriptionHolder\";\n\n\nexport class EarthControlHandler extends HandlerBase<PointerConfiguration> {\n private _viewportCoords: ViewportCoords;\n private _spatial: Spatial;\n private _subscriptions: SubscriptionHolder;\n\n /** @ignore */\n constructor(\n component: Component<PointerConfiguration>,\n container: Container,\n navigator: Navigator,\n viewportCoords: ViewportCoords,\n spatial: Spatial) {\n super(component, container, navigator);\n\n this._spatial = spatial;\n this._viewportCoords = viewportCoords;\n this._subscriptions = new SubscriptionHolder();\n }\n\n protected _enable(): void {\n const earth$ = this._navigator.stateService.state$.pipe(\n map(\n (state: State): boolean => {\n return state === State.Earth;\n }),\n publishReplay(1),\n refCount());\n\n const subs = this._subscriptions;\n\n subs.push(earth$.pipe(\n switchMap(\n (earth: boolean): Observable<MouseEvent> => {\n return earth ?\n this._container.mouseService.mouseWheel$ :\n observableEmpty();\n }))\n .subscribe(\n (event: WheelEvent): void => {\n event.preventDefault();\n }));\n\n subs.push(earth$.pipe(\n switchMap(\n (earth: boolean): Observable<[MouseEvent, MouseEvent]> => {\n if (!earth) {\n return observableEmpty();\n }\n\n return MouseOperator.filteredPairwiseMouseDrag$(this._component.name, this._container.mouseService).pipe(\n filter(\n ([e1, e2]: [MouseEvent, MouseEvent]): boolean => {\n return !(e1.ctrlKey && e2.ctrlKey);\n }));\n }),\n withLatestFrom(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentTransform$),\n map(\n ([[previous, current], render, transform]: [[MouseEvent, MouseEvent], RenderCamera, Transform]): number[] => {\n const planeNormal = [0, 0, 1];\n const planePoint = [0, 0, -2];\n\n const currentIntersection = this._planeIntersection(\n current,\n planeNormal,\n planePoint,\n render.perspective,\n this._container.container);\n\n const previousIntersection = this._planeIntersection(\n previous,\n planeNormal,\n planePoint,\n render.perspective,\n this._container.container);\n\n if (!currentIntersection || !previousIntersection) {\n return null;\n }\n\n const direction = new THREE.Vector3()\n .subVectors(currentIntersection, previousIntersection)\n .multiplyScalar(-1)\n .toArray();\n\n return direction;\n }),\n filter(\n (direction: number[]): boolean => {\n return !!direction;\n }))\n .subscribe(\n (direction: number[]): void => {\n this._navigator.stateService.truck(direction);\n }));\n\n subs.push(earth$.pipe(\n switchMap(\n (earth: boolean): Observable<[MouseEvent, MouseEvent]> => {\n if (!earth) {\n return observableEmpty();\n }\n\n return MouseOperator.filteredPairwiseMouseDrag$(this._component.name, this._container.mouseService).pipe(\n filter(\n ([e1, e2]: [MouseEvent, MouseEvent]): boolean => {\n return e1.ctrlKey && e2.ctrlKey;\n }));\n }),\n map(\n ([previous, current]: [MouseEvent, MouseEvent]): EulerRotation => {\n return this._mousePairToRotation(previous, current);\n }))\n .subscribe(\n (rotation: EulerRotation): void => {\n this._navigator.stateService.orbit(rotation);\n }));\n\n subs.push(earth$.pipe(\n switchMap(\n (earth: boolean): Observable<[MouseEvent, MouseEvent]> => {\n if (!earth) {\n return observableEmpty();\n }\n\n return MouseOperator.filteredPairwiseMouseRightDrag$(this._component.name, this._container.mouseService).pipe(\n filter(\n ([e1, e2]: [MouseEvent, MouseEvent]): boolean => {\n return !e1.ctrlKey && !e2.ctrlKey;\n }));\n }),\n map(\n ([previous, current]: [MouseEvent, MouseEvent]): EulerRotation => {\n return this._mousePairToRotation(previous, current);\n }))\n .subscribe(\n (rotation: EulerRotation): void => {\n this._navigator.stateService.orbit(rotation);\n }));\n\n subs.push(earth$.pipe(\n switchMap(\n (earth: boolean): Observable<WheelEvent> => {\n if (!earth) {\n return observableEmpty();\n }\n\n return this._container.mouseService\n .filteredWheel$(this._component.name, this._container.mouseService.mouseWheel$);\n }),\n map(\n (event: WheelEvent): number => {\n let delta = event.deltaY;\n\n if (event.deltaMode === 1) {\n delta = 40 * delta;\n } else if (event.deltaMode === 2) {\n delta = 800 * delta;\n }\n\n const canvasSize = this._viewportCoords.containerToCanvas(this._container.container);\n\n return -delta / canvasSize[1];\n }))\n .subscribe(\n (delta: number): void => {\n this._navigator.stateService.dolly(delta);\n }));\n }\n\n protected _disable(): void {\n this._subscriptions.unsubscribe();\n }\n\n protected _getConfiguration(): PointerConfiguration {\n return {};\n }\n\n private _eventToViewport(event: MouseEvent, element: HTMLElement): number[] {\n const previousCanvas = this._viewportCoords.canvasPosition(event, element);\n\n return this._viewportCoords.canvasToViewport(previousCanvas[0], previousCanvas[1], element);\n }\n\n private _mousePairToRotation(\n previous: MouseEvent, current: MouseEvent): EulerRotation {\n const [currentX, currentY] =\n this._eventToViewport(current, this._container.container);\n const [previousX, previousY]: number[] =\n this._eventToViewport(previous, this._container.container);\n\n const phi = (previousX - currentX) * Math.PI;\n const theta = (currentY - previousY) * Math.PI / 2;\n\n return { phi: phi, theta: theta };\n }\n\n private _planeIntersection(\n event: MouseEvent,\n planeNormal: number[],\n planePoint: number[],\n camera: THREE.Camera,\n element: HTMLElement): THREE.Vector3 {\n\n const [canvasX, canvasY] = this._viewportCoords.canvasPosition(event, element);\n const direction: THREE.Vector3 =\n this._viewportCoords\n .unprojectFromCanvas(\n canvasX,\n canvasY,\n element,\n camera)\n .sub(camera.position)\n .normalize();\n\n if (Math.abs(this._spatial.angleToPlane(direction.toArray(), planeNormal)) < Math.PI / 90) {\n return null;\n }\n\n const l0 = camera.position.clone();\n const n = new THREE.Vector3().fromArray(planeNormal);\n const p0 = new THREE.Vector3().fromArray(planePoint);\n\n const d = new THREE.Vector3().subVectors(p0, l0).dot(n) / direction.clone().dot(n);\n\n const intersection = new THREE.Vector3().addVectors(l0, direction.multiplyScalar(d));\n\n if (this._viewportCoords.worldToCamera(intersection.toArray(), camera)[2] > 0) {\n return null;\n }\n\n return intersection;\n }\n}\n","import {\n map,\n filter,\n withLatestFrom,\n} from \"rxjs/operators\";\nimport { Subscription } from \"rxjs\";\n\nimport { Transform } from \"../../geo/Transform\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { IAnimationState } from \"../../state/interfaces/IAnimationState\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { Component } from \"../Component\";\nimport { PointerConfiguration } from \"../interfaces/PointerConfiguration\";\nimport { HandlerBase } from \"../util/HandlerBase\";\nimport { isSpherical } from \"../../geo/Geo\";\n\n/**\n * The `ScrollZoomHandler` allows the user to zoom the viewer image by scrolling.\n *\n * @example\n * ```js\n * var pointerComponent = viewer.getComponent(\"pointer\");\n *\n * pointerComponent.scrollZoom.disable();\n * pointerComponent.scrollZoom.enable();\n *\n * var isEnabled = pointerComponent.scrollZoom.isEnabled;\n * ```\n */\nexport class ScrollZoomHandler extends HandlerBase<PointerConfiguration> {\n private _viewportCoords: ViewportCoords;\n\n private _preventDefaultSubscription: Subscription;\n private _zoomSubscription: Subscription;\n\n /** @ignore */\n constructor(\n component: Component<PointerConfiguration>,\n container: Container,\n navigator: Navigator,\n viewportCoords: ViewportCoords) {\n super(component, container, navigator);\n\n this._viewportCoords = viewportCoords;\n }\n\n protected _enable(): void {\n this._container.mouseService.claimWheel(this._component.name, 0);\n\n this._preventDefaultSubscription = this._container.mouseService.mouseWheel$\n .subscribe(\n (event: WheelEvent): void => {\n event.preventDefault();\n });\n\n this._zoomSubscription = this._container.mouseService\n .filteredWheel$(this._component.name, this._container.mouseService.mouseWheel$).pipe(\n withLatestFrom(\n this._navigator.stateService.currentState$,\n (w: WheelEvent, f: AnimationFrame): [WheelEvent, AnimationFrame] => {\n return [w, f];\n }),\n filter(\n (args: [WheelEvent, AnimationFrame]): boolean => {\n let state: IAnimationState = args[1].state;\n return isSpherical(state.currentImage.cameraType) ||\n state.imagesAhead < 1;\n }),\n map(\n (args: [WheelEvent, AnimationFrame]): WheelEvent => {\n return args[0];\n }),\n withLatestFrom(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentTransform$,\n (w: WheelEvent, r: RenderCamera, t: Transform): [WheelEvent, RenderCamera, Transform] => {\n return [w, r, t];\n }))\n .subscribe(\n (args: [WheelEvent, RenderCamera, Transform]): void => {\n let event: WheelEvent = args[0];\n let render: RenderCamera = args[1];\n let transform: Transform = args[2];\n\n let element: HTMLElement = this._container.container;\n\n let [canvasX, canvasY]: number[] = this._viewportCoords.canvasPosition(event, element);\n\n let unprojected: THREE.Vector3 =\n this._viewportCoords.unprojectFromCanvas(\n canvasX,\n canvasY,\n element,\n render.perspective);\n\n let reference: number[] = transform.projectBasic(unprojected.toArray());\n\n let deltaY: number = event.deltaY;\n if (event.deltaMode === 1) {\n deltaY = 40 * deltaY;\n } else if (event.deltaMode === 2) {\n deltaY = 800 * deltaY;\n }\n\n const canvasSize: number[] = this._viewportCoords.containerToCanvas(element);\n\n let zoom: number = -3 * deltaY / canvasSize[1];\n\n this._navigator.stateService.zoomIn(zoom, reference);\n });\n }\n\n protected _disable(): void {\n this._container.mouseService.unclaimWheel(this._component.name);\n\n this._preventDefaultSubscription.unsubscribe();\n this._zoomSubscription.unsubscribe();\n\n this._preventDefaultSubscription = null;\n this._zoomSubscription = null;\n }\n\n protected _getConfiguration(enable: boolean): PointerConfiguration {\n return { scrollZoom: enable };\n }\n}\n","import * as THREE from \"three\";\n\nimport {\n merge as observableMerge,\n Observable,\n Subscription,\n} from \"rxjs\";\n\nimport {\n filter,\n map,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Transform } from \"../../geo/Transform\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { IAnimationState } from \"../../state/interfaces/IAnimationState\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { TouchPinch } from \"../../viewer/interfaces/TouchPinch\";\nimport { Component } from \"../Component\";\nimport { PointerConfiguration } from \"../interfaces/PointerConfiguration\";\nimport { HandlerBase } from \"../util/HandlerBase\";\nimport { isSpherical } from \"../../geo/Geo\";\n\n/**\n * The `TouchZoomHandler` allows the user to zoom the viewer image by pinching on a touchscreen.\n *\n * @example\n * ```js\n * var pointerComponent = viewer.getComponent(\"pointer\");\n *\n * pointerComponent.touchZoom.disable();\n * pointerComponent.touchZoom.enable();\n *\n * var isEnabled = pointerComponent.touchZoom.isEnabled;\n * ```\n */\nexport class TouchZoomHandler extends HandlerBase<PointerConfiguration> {\n private _viewportCoords: ViewportCoords;\n\n private _activeSubscription: Subscription;\n private _preventDefaultSubscription: Subscription;\n private _zoomSubscription: Subscription;\n\n /** @ignore */\n constructor(\n component: Component<PointerConfiguration>,\n container: Container,\n navigator: Navigator,\n viewportCoords: ViewportCoords) {\n super(component, container, navigator);\n\n this._viewportCoords = viewportCoords;\n }\n\n protected _enable(): void {\n this._preventDefaultSubscription = this._container.touchService.pinch$\n .subscribe(\n (pinch: TouchPinch): void => {\n pinch.originalEvent.preventDefault();\n });\n\n let pinchStarted$: Observable<boolean> =\n this._container.touchService.pinchStart$.pipe(\n map(\n (event: TouchEvent): boolean => {\n return true;\n }));\n\n let pinchStopped$: Observable<boolean> =\n this._container.touchService.pinchEnd$.pipe(\n map(\n (event: TouchEvent): boolean => {\n return false;\n }));\n\n this._activeSubscription = observableMerge(\n pinchStarted$,\n pinchStopped$)\n .subscribe(this._container.touchService.activate$);\n\n this._zoomSubscription = this._container.touchService.pinch$.pipe(\n withLatestFrom(this._navigator.stateService.currentState$),\n filter(\n (args: [TouchPinch, AnimationFrame]): boolean => {\n let state: IAnimationState = args[1].state;\n return isSpherical(state.currentImage.cameraType) ||\n state.imagesAhead < 1;\n }),\n map(\n (args: [TouchPinch, AnimationFrame]): TouchPinch => {\n return args[0];\n }),\n withLatestFrom(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentTransform$))\n .subscribe(\n ([pinch, render, transform]: [TouchPinch, RenderCamera, Transform]): void => {\n let element: HTMLElement = this._container.container;\n\n let [canvasX, canvasY]: number[] = this._viewportCoords.canvasPosition(pinch, element);\n\n let unprojected: THREE.Vector3 =\n this._viewportCoords.unprojectFromCanvas(\n canvasX,\n canvasY,\n element,\n render.perspective);\n\n let reference: number[] = transform.projectBasic(unprojected.toArray());\n\n const [canvasWidth, canvasHeight]: number[] = this._viewportCoords.containerToCanvas(element);\n let zoom: number = 3 * pinch.distanceChange / Math.min(canvasWidth, canvasHeight);\n\n this._navigator.stateService.zoomIn(zoom, reference);\n });\n }\n\n protected _disable(): void {\n this._activeSubscription.unsubscribe();\n this._preventDefaultSubscription.unsubscribe();\n this._zoomSubscription.unsubscribe();\n\n this._preventDefaultSubscription = null;\n this._zoomSubscription = null;\n }\n\n protected _getConfiguration(enable: boolean): PointerConfiguration {\n return { touchZoom: enable };\n }\n}\n","import { Component } from \"../Component\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { Spatial } from \"../../geo/Spatial\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { PointerConfiguration } from \"../interfaces/PointerConfiguration\";\nimport { BounceHandler } from \"./BounceHandler\";\nimport { DragPanHandler } from \"./DragPanHandler\";\nimport { EarthControlHandler } from \"./EarthControlHandler\";\nimport { ScrollZoomHandler } from \"./ScrollZoomHandler\";\nimport { TouchZoomHandler } from \"./TouchZoomHandler\";\nimport { ComponentName } from \"../ComponentName\";\n\n/**\n * @class PointerComponent\n *\n * @classdesc Component handling mouse, pen, and touch events for camera movement.\n *\n * To retrive and use the mouse component\n *\n * @example\n * ```js\n * var viewer = new Viewer({ ... });\n *\n * var pointerComponent = viewer.getComponent(\"pointer\");\n * ```\n */\nexport class PointerComponent extends Component<PointerConfiguration> {\n /** @inheritdoc */\n public static componentName: ComponentName = \"pointer\";\n\n private _bounceHandler: BounceHandler;\n private _dragPanHandler: DragPanHandler;\n private _earthControlHandler: EarthControlHandler;\n private _scrollZoomHandler: ScrollZoomHandler;\n private _touchZoomHandler: TouchZoomHandler;\n\n /** @ignore */\n constructor(\n name: string,\n container: Container,\n navigator: Navigator) {\n\n super(name, container, navigator);\n\n const spatial = new Spatial();\n const viewportCoords = new ViewportCoords();\n\n this._bounceHandler =\n new BounceHandler(\n this,\n container,\n navigator,\n viewportCoords,\n spatial);\n\n this._dragPanHandler =\n new DragPanHandler(\n this,\n container,\n navigator,\n viewportCoords,\n spatial);\n\n this._earthControlHandler =\n new EarthControlHandler(\n this,\n container,\n navigator,\n viewportCoords,\n spatial);\n\n this._scrollZoomHandler =\n new ScrollZoomHandler(\n this,\n container,\n navigator,\n viewportCoords);\n\n this._touchZoomHandler =\n new TouchZoomHandler(\n this,\n container,\n navigator,\n viewportCoords);\n }\n\n /**\n * Get drag pan.\n *\n * @returns {DragPanHandler} The drag pan handler.\n */\n public get dragPan(): DragPanHandler {\n return this._dragPanHandler;\n }\n\n /**\n * Get earth control.\n *\n * @returns {EarthControlHandler} The earth control handler.\n */\n public get earthControl(): EarthControlHandler {\n return this._earthControlHandler;\n }\n\n /**\n * Get scroll zoom.\n *\n * @returns {ScrollZoomHandler} The scroll zoom handler.\n */\n public get scrollZoom(): ScrollZoomHandler {\n return this._scrollZoomHandler;\n }\n\n /**\n * Get touch zoom.\n *\n * @returns {TouchZoomHandler} The touch zoom handler.\n */\n public get touchZoom(): TouchZoomHandler {\n return this._touchZoomHandler;\n }\n\n protected _activate(): void {\n this._bounceHandler.enable();\n\n this._subscriptions.push(this._configuration$\n .subscribe(\n (configuration: PointerConfiguration): void => {\n if (configuration.dragPan) {\n this._dragPanHandler.enable();\n } else {\n this._dragPanHandler.disable();\n }\n\n if (configuration.earthControl) {\n this._earthControlHandler.enable();\n } else {\n this._earthControlHandler.disable();\n }\n\n if (configuration.scrollZoom) {\n this._scrollZoomHandler.enable();\n } else {\n this._scrollZoomHandler.disable();\n }\n\n if (configuration.touchZoom) {\n this._touchZoomHandler.enable();\n } else {\n this._touchZoomHandler.disable();\n }\n }));\n\n this._container.mouseService.claimMouse(this._name, 0);\n }\n\n protected _deactivate(): void {\n this._container.mouseService.unclaimMouse(this._name);\n\n this._subscriptions.unsubscribe();\n\n this._bounceHandler.disable();\n this._dragPanHandler.disable();\n this._earthControlHandler.disable();\n this._scrollZoomHandler.disable();\n this._touchZoomHandler.disable();\n }\n\n protected _getDefaultConfiguration(): PointerConfiguration {\n return {\n dragPan: true,\n earthControl: true,\n scrollZoom: true,\n touchZoom: true,\n };\n }\n}\n","export class DOM {\n private _document: HTMLDocument;\n\n constructor(doc?: Node) {\n this._document = !!doc ? <HTMLDocument>doc : document;\n }\n\n public get document(): HTMLDocument {\n return this._document;\n }\n\n public createElement<K extends keyof HTMLElementTagNameMap>(\n tagName: K, className?: string, container?: HTMLElement): HTMLElementTagNameMap[K] {\n const element: HTMLElementTagNameMap[K] = this._document.createElement(tagName);\n\n if (!!className) {\n element.className = className;\n }\n\n if (!!container) {\n container.appendChild(element);\n }\n\n return element;\n }\n}\n","import {\n combineLatest as observableCombineLatest,\n from as observableFrom,\n merge as observableMerge,\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport {\n map,\n mergeMap,\n startWith,\n switchMap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Transform } from \"../../geo/Transform\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { DOM } from \"../../util/DOM\";\nimport { ComponentConfiguration } from \"../interfaces/ComponentConfiguration\";\nimport { Component } from \"../Component\";\nimport { Popup } from \"./popup/Popup\";\nimport { ComponentName } from \"../ComponentName\";\n\n/**\n * @class PopupComponent\n *\n * @classdesc Component for showing HTML popup objects.\n *\n * The `add` method is used for adding new popups. Popups are removed by reference.\n *\n * It is not possible to update popups in the set by updating any properties\n * directly on the popup object. Popups need to be replaced by\n * removing them and creating new ones with relevant changed properties and\n * adding those instead.\n *\n * Popups are only relevant to a single image because they are based on\n * 2D basic image coordinates. Popups related to a certain image should\n * be removed when the viewer is moved to another image.\n *\n * To retrive and use the popup component\n *\n * @example\n * ```js\n * var viewer = new Viewer({ component: { popup: true }, ... });\n *\n * var popupComponent = viewer.getComponent(\"popup\");\n * ```\n */\nexport class PopupComponent extends Component<ComponentConfiguration> {\n public static componentName: ComponentName = \"popup\";\n\n private _dom: DOM;\n\n private _popupContainer: HTMLDivElement;\n private _popups: Popup[];\n\n private _added$: Subject<Popup[]>;\n private _popups$: Subject<Popup[]>;\n\n /** @ignore */\n constructor(\n name: string,\n container: Container,\n navigator: Navigator,\n dom?: DOM) {\n\n super(name, container, navigator);\n\n this._dom = !!dom ? dom : new DOM();\n this._popups = [];\n\n this._added$ = new Subject<Popup[]>();\n this._popups$ = new Subject<Popup[]>();\n }\n\n /**\n * Add popups to the popups set.\n *\n * @description Adding a new popup never replaces an old one\n * because they are stored by reference. Adding an already\n * existing popup has no effect.\n *\n * @param {Array<Popup>} popups - Popups to add.\n *\n * @example\n * ```js\n * popupComponent.add([popup1, popup2]);\n * ```\n */\n public add(popups: Popup[]): void {\n for (const popup of popups) {\n if (this._popups.indexOf(popup) !== -1) {\n continue;\n }\n\n this._popups.push(popup);\n\n if (this._activated) {\n popup.setParentContainer(this._popupContainer);\n }\n }\n\n this._added$.next(popups);\n this._popups$.next(this._popups);\n }\n\n /**\n * Returns an array of all popups.\n *\n * @example\n * ```js\n * var popups = popupComponent.getAll();\n * ```\n */\n public getAll(): Popup[] {\n return this._popups.slice();\n }\n\n /**\n * Remove popups based on reference from the popup set.\n *\n * @param {Array<Popup>} popups - Popups to remove.\n *\n * @example\n * ```js\n * popupComponent.remove([popup1, popup2]);\n * ```\n */\n public remove(popups: Popup[]): void {\n for (const popup of popups) {\n this._remove(popup);\n }\n\n this._popups$.next(this._popups);\n }\n\n /**\n * Remove all popups from the popup set.\n *\n * @example\n * ```js\n * popupComponent.removeAll();\n * ```\n */\n public removeAll(): void {\n for (const popup of this._popups.slice()) {\n this._remove(popup);\n }\n\n this._popups$.next(this._popups);\n }\n\n protected _activate(): void {\n this._popupContainer = this._dom.createElement(\"div\", \"mapillary-popup-container\", this._container.container);\n\n for (const popup of this._popups) {\n popup.setParentContainer(this._popupContainer);\n }\n\n const subs = this._subscriptions;\n\n subs.push(observableCombineLatest(\n this._container.renderService.renderCamera$,\n this._container.renderService.size$,\n this._navigator.stateService.currentTransform$)\n .subscribe(\n ([renderCamera, size, transform]: [RenderCamera, ViewportSize, Transform]): void => {\n for (const popup of this._popups) {\n popup.update(renderCamera, size, transform);\n }\n }));\n\n const changed$ = this._popups$.pipe(\n startWith(this._popups),\n switchMap(\n (popups: Popup[]): Observable<Popup> => {\n return observableFrom(popups).pipe(\n mergeMap(\n (popup: Popup): Observable<Popup> => {\n return popup.changed$;\n }));\n }),\n map(\n (popup: Popup): Popup[] => {\n return [popup];\n }));\n\n subs.push(observableMerge(this._added$, changed$).pipe(\n withLatestFrom(\n this._container.renderService.renderCamera$,\n this._container.renderService.size$,\n this._navigator.stateService.currentTransform$))\n .subscribe(\n ([popups, renderCamera, size, transform]: [Popup[], RenderCamera, ViewportSize, Transform]): void => {\n for (const popup of popups) {\n popup.update(renderCamera, size, transform);\n }\n }));\n }\n\n protected _deactivate(): void {\n this._subscriptions.unsubscribe();\n\n for (const popup of this._popups) {\n popup.remove();\n }\n\n this._container.container.removeChild(this._popupContainer);\n delete this._popupContainer;\n }\n\n protected _getDefaultConfiguration(): ComponentConfiguration {\n return {};\n }\n\n private _remove(popup: Popup): void {\n const index: number = this._popups.indexOf(popup);\n if (index === -1) {\n return;\n }\n\n const removed: Popup = this._popups.splice(index, 1)[0];\n if (this._activated) {\n removed.remove();\n }\n }\n}\n","import * as vd from \"virtual-dom\";\n\nimport {\n merge as observableMerge,\n Observable,\n Subject,\n Subscription,\n} from \"rxjs\";\nimport { filter } from \"rxjs/operators\";\n\nimport { CancelMapillaryError } from \"../../error/CancelMapillaryError\";\nimport { NavigationDirection } from \"../../graph/edge/NavigationDirection\";\nimport { NavigationEdgeStatus } from \"../../graph/interfaces/NavigationEdgeStatus\";\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { SequenceConfiguration } from \"../interfaces/SequenceConfiguration\";\nimport { SequenceMode } from \"./SequenceMode\";\nimport { SequenceComponent } from \"./SequenceComponent\";\n\nexport class SequenceDOMRenderer {\n private _container: Container;\n\n private _minThresholdWidth: number;\n private _maxThresholdWidth: number;\n private _minThresholdHeight: number;\n private _maxThresholdHeight: number;\n private _stepperDefaultWidth: number;\n private _controlsDefaultWidth: number;\n private _defaultHeight: number;\n private _expandControls: boolean;\n private _mode: SequenceMode;\n private _speed: number;\n private _changingSpeed: boolean;\n private _index: number;\n private _changingPosition: boolean;\n\n private _mouseEnterDirection$: Subject<NavigationDirection>;\n private _mouseLeaveDirection$: Subject<NavigationDirection>;\n private _notifyChanged$: Subject<SequenceDOMRenderer>;\n private _notifyChangingPositionChanged$: Subject<boolean>;\n private _notifySpeedChanged$: Subject<number>;\n private _notifyIndexChanged$: Subject<number>;\n\n private _changingSubscription: Subscription;\n\n constructor(container: Container) {\n this._container = container;\n\n this._minThresholdWidth = 320;\n this._maxThresholdWidth = 1480;\n this._minThresholdHeight = 240;\n this._maxThresholdHeight = 820;\n this._stepperDefaultWidth = 108;\n this._controlsDefaultWidth = 88;\n\n this._defaultHeight = 30;\n this._expandControls = false;\n this._mode = SequenceMode.Default;\n this._speed = 0.5;\n this._changingSpeed = false;\n this._index = null;\n this._changingPosition = false;\n\n this._mouseEnterDirection$ = new Subject<NavigationDirection>();\n this._mouseLeaveDirection$ = new Subject<NavigationDirection>();\n this._notifyChanged$ = new Subject<SequenceDOMRenderer>();\n this._notifyChangingPositionChanged$ = new Subject<boolean>();\n this._notifySpeedChanged$ = new Subject<number>();\n this._notifyIndexChanged$ = new Subject<number>();\n }\n\n public get changed$(): Observable<SequenceDOMRenderer> {\n return this._notifyChanged$;\n }\n\n public get changingPositionChanged$(): Observable<boolean> {\n return this._notifyChangingPositionChanged$;\n }\n\n public get speed$(): Observable<number> {\n return this._notifySpeedChanged$;\n }\n\n public get index$(): Observable<number> {\n return this._notifyIndexChanged$;\n }\n\n public get mouseEnterDirection$(): Observable<NavigationDirection> {\n return this._mouseEnterDirection$;\n }\n\n public get mouseLeaveDirection$(): Observable<NavigationDirection> {\n return this._mouseLeaveDirection$;\n }\n\n public activate(): void {\n if (!!this._changingSubscription) {\n return;\n }\n\n this._changingSubscription = observableMerge(\n this._container.mouseService.documentMouseUp$,\n this._container.touchService.touchEnd$.pipe(\n filter(\n (touchEvent: TouchEvent): boolean => {\n return touchEvent.touches.length === 0;\n })))\n .subscribe(\n (): void => {\n if (this._changingSpeed) {\n this._changingSpeed = false;\n }\n\n if (this._changingPosition) {\n this._setChangingPosition(false);\n }\n });\n }\n\n public deactivate(): void {\n if (!this._changingSubscription) {\n return;\n }\n\n this._changingSpeed = false;\n this._changingPosition = false;\n this._expandControls = false;\n this._mode = SequenceMode.Default;\n\n this._changingSubscription.unsubscribe();\n this._changingSubscription = null;\n }\n\n public render(\n edgeStatus: NavigationEdgeStatus,\n configuration: SequenceConfiguration,\n containerWidth: number,\n speed: number,\n index: number,\n max: number,\n playEnabled: boolean,\n component: SequenceComponent,\n navigator: Navigator): vd.VNode {\n\n if (configuration.visible === false) {\n return vd.h(\"div.mapillary-sequence-container\", {}, []);\n }\n\n const stepper: vd.VNode =\n this._createStepper(\n edgeStatus,\n configuration,\n playEnabled,\n containerWidth,\n component,\n navigator);\n const controls: vd.VNode = this._createSequenceControls(containerWidth);\n const playback: vd.VNode = this._createPlaybackControls(containerWidth, speed, component, configuration);\n const timeline: vd.VNode = this._createTimelineControls(containerWidth, index, max);\n\n return vd.h(\"div.mapillary-sequence-container\", [stepper, controls, playback, timeline]);\n }\n\n public getContainerWidth(size: ViewportSize, configuration: SequenceConfiguration): number {\n let minWidth: number = configuration.minWidth;\n let maxWidth: number = configuration.maxWidth;\n if (maxWidth < minWidth) {\n maxWidth = minWidth;\n }\n\n let relativeWidth: number =\n (size.width - this._minThresholdWidth) / (this._maxThresholdWidth - this._minThresholdWidth);\n let relativeHeight: number =\n (size.height - this._minThresholdHeight) / (this._maxThresholdHeight - this._minThresholdHeight);\n\n let coeff: number = Math.max(0, Math.min(1, Math.min(relativeWidth, relativeHeight)));\n\n return minWidth + coeff * (maxWidth - minWidth);\n }\n\n private _createPositionInput(index: number, max: number): vd.VNode {\n this._index = index;\n\n const onPosition: (e: Event) => void = (e: Event): void => {\n this._index = Number((<HTMLInputElement>e.target).value);\n this._notifyIndexChanged$.next(this._index);\n };\n\n const boundingRect: ClientRect = this._container.domContainer.getBoundingClientRect();\n const width: number = Math.max(276, Math.min(410, 5 + 0.8 * boundingRect.width)) - 65;\n\n const onStart: (e: Event) => void = (e: Event): void => {\n e.stopPropagation();\n this._setChangingPosition(true);\n };\n\n const onMove: (e: Event) => void = (e: Event): void => {\n if (this._changingPosition === true) {\n e.stopPropagation();\n }\n };\n\n const onKeyDown: (e: KeyboardEvent) => void = (e: KeyboardEvent): void => {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowLeft\" ||\n e.key === \"ArrowRight\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n }\n };\n\n const positionInputProperties: vd.createProperties = {\n max: max != null ? max : 1,\n min: 0,\n onchange: onPosition,\n oninput: onPosition,\n onkeydown: onKeyDown,\n onpointerdown: onStart,\n onpointermove: onMove,\n ontouchmove: onMove,\n ontouchstart: onStart,\n style: {\n width: `${width}px`,\n },\n type: \"range\",\n value: index != null ? index : 0,\n };\n\n const disabled: boolean = index == null || max == null || max <= 1;\n\n if (disabled) {\n positionInputProperties.disabled = \"true\";\n }\n\n const positionInput: vd.VNode = vd.h(\"input.mapillary-sequence-position\", positionInputProperties, []);\n\n const positionContainerClass: string = disabled ? \".mapillary-sequence-position-container-inactive\" : \".mapillary-sequence-position-container\";\n\n return vd.h(\"div\" + positionContainerClass, [positionInput]);\n }\n\n private _createSpeedInput(speed: number): vd.VNode {\n this._speed = speed;\n\n const onSpeed: (e: Event) => void = (e: Event): void => {\n this._speed = Number((<HTMLInputElement>e.target).value) / 1000;\n this._notifySpeedChanged$.next(this._speed);\n };\n\n const boundingRect: ClientRect = this._container.domContainer.getBoundingClientRect();\n const width: number = Math.max(276, Math.min(410, 5 + 0.8 * boundingRect.width)) - 160;\n\n const onStart: (e: Event) => void = (e: Event): void => {\n this._changingSpeed = true;\n e.stopPropagation();\n };\n\n const onMove: (e: Event) => void = (e: Event): void => {\n if (this._changingSpeed === true) {\n e.stopPropagation();\n }\n };\n\n const onKeyDown: (e: KeyboardEvent) => void = (e: KeyboardEvent): void => {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowLeft\" ||\n e.key === \"ArrowRight\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n }\n };\n\n const speedInput: vd.VNode = vd.h(\n \"input.mapillary-sequence-speed\",\n {\n max: 1000,\n min: 0,\n onchange: onSpeed,\n oninput: onSpeed,\n onkeydown: onKeyDown,\n onpointerdown: onStart,\n onpointermove: onMove,\n ontouchmove: onMove,\n ontouchstart: onStart,\n style: {\n width: `${width}px`,\n },\n type: \"range\",\n value: 1000 * speed,\n },\n []);\n\n return vd.h(\"div.mapillary-sequence-speed-container\", [speedInput]);\n }\n\n private _createPlaybackControls(\n containerWidth: number,\n speed: number,\n component: SequenceComponent,\n configuration: SequenceConfiguration): vd.VNode {\n\n if (this._mode !== SequenceMode.Playback) {\n return vd.h(\"div.mapillary-sequence-playback\", []);\n }\n\n const switchIcon: vd.VNode = vd.h(\"div.mapillary-sequence-switch-icon.mapillary-sequence-icon-visible\", []);\n const direction: NavigationDirection = configuration.direction === NavigationDirection.Next ?\n NavigationDirection.Prev : NavigationDirection.Next;\n\n const playing: boolean = configuration.playing;\n const switchButtonProperties: vd.createProperties = {\n onclick: (): void => {\n if (!playing) {\n component.configure({ direction });\n }\n },\n };\n const switchButtonClassName: string = configuration.playing ? \".mapillary-sequence-switch-button-inactive\" : \".mapillary-sequence-switch-button\";\n const switchButton: vd.VNode = vd.h(\"div\" + switchButtonClassName, switchButtonProperties, [switchIcon]);\n const slowIcon: vd.VNode = vd.h(\"div.mapillary-sequence-slow-icon.mapillary-sequence-icon-visible\", []);\n const slowContainer: vd.VNode = vd.h(\"div.mapillary-sequence-slow-container\", [slowIcon]);\n const fastIcon: vd.VNode = vd.h(\"div.mapillary-sequence-fast-icon.mapillary-sequence-icon-visible\", []);\n const fastContainer: vd.VNode = vd.h(\"div.mapillary-sequence-fast-container\", [fastIcon]);\n const closeIcon: vd.VNode = vd.h(\"div.mapillary-sequence-close-icon.mapillary-sequence-icon-visible\", []);\n const closeButtonProperties: vd.createProperties = {\n onclick: (): void => {\n this._mode = SequenceMode.Default;\n this._notifyChanged$.next(this);\n },\n };\n const closeButton: vd.VNode = vd.h(\"div.mapillary-sequence-close-button\", closeButtonProperties, [closeIcon]);\n const speedInput: vd.VNode = this._createSpeedInput(speed);\n\n const playbackChildren: vd.VNode[] = [switchButton, slowContainer, speedInput, fastContainer, closeButton];\n\n const top: number = Math.round(containerWidth / this._stepperDefaultWidth * this._defaultHeight + 10);\n const playbackProperties: vd.createProperties = { style: { top: `${top}px` } };\n\n return vd.h(\"div.mapillary-sequence-playback\", playbackProperties, playbackChildren);\n }\n\n private _createPlayingButton(\n nextId: string,\n prevId: string,\n playEnabled: boolean,\n configuration: SequenceConfiguration,\n component: SequenceComponent): vd.VNode {\n\n let canPlay: boolean =\n (configuration.direction === NavigationDirection.Next && nextId != null) ||\n (configuration.direction === NavigationDirection.Prev && prevId != null);\n canPlay = canPlay && playEnabled;\n\n let onclick: (e: Event) => void = configuration.playing ?\n (): void => { component.stop(); } :\n canPlay ? (): void => { component.play(); } : null;\n\n let buttonProperties: vd.createProperties = { onclick: onclick };\n\n let iconProperties: vd.createProperties = {};\n if (configuration.direction === NavigationDirection.Prev) {\n iconProperties.style = {\n transform: \"rotate(180deg) translate(50%, 50%)\",\n };\n }\n\n let icon = vd.h(\"div.mapillary-sequence-icon\", iconProperties, []);\n\n let buttonClass = configuration.playing ?\n \"mapillary-sequence-stop\" :\n canPlay ?\n \"mapillary-sequence-play\" :\n \"mapillary-sequence-play-inactive\";\n\n return vd.h(\"div.\" + buttonClass, buttonProperties, [icon]);\n }\n\n private _createSequenceControls(containerWidth: number): vd.VNode {\n const borderRadius: number = Math.round(8 / this._stepperDefaultWidth * containerWidth);\n const expanderProperties: vd.createProperties = {\n onclick: (): void => {\n this._expandControls = !this._expandControls;\n this._mode = SequenceMode.Default;\n this._notifyChanged$.next(this);\n },\n style: {\n \"border-bottom-right-radius\": `${borderRadius}px`,\n \"border-top-right-radius\": `${borderRadius}px`,\n },\n };\n const expanderBar: vd.VNode = vd.h(\"div.mapillary-sequence-expander-bar\", []);\n const expander: vd.VNode = vd.h(\"div.mapillary-sequence-expander-button\", expanderProperties, [expanderBar]);\n\n const fastIconClassName: string = this._mode === SequenceMode.Playback ?\n \".mapillary-sequence-fast-icon-gray.mapillary-sequence-icon-visible\" : \".mapillary-sequence-fast-icon\";\n const fastIcon: vd.VNode = vd.h(\"div\" + fastIconClassName, []);\n const playbackProperties: vd.createProperties = {\n onclick: (): void => {\n this._mode = this._mode === SequenceMode.Playback ?\n SequenceMode.Default :\n SequenceMode.Playback;\n this._notifyChanged$.next(this);\n },\n };\n\n const playback: vd.VNode = vd.h(\"div.mapillary-sequence-playback-button\", playbackProperties, [fastIcon]);\n\n const timelineIconClassName: string = this._mode === SequenceMode.Timeline ?\n \".mapillary-sequence-timeline-icon-gray.mapillary-sequence-icon-visible\" : \".mapillary-sequence-timeline-icon\";\n const timelineIcon: vd.VNode = vd.h(\"div\" + timelineIconClassName, []);\n const timelineProperties: vd.createProperties = {\n onclick: (): void => {\n this._mode = this._mode === SequenceMode.Timeline ?\n SequenceMode.Default :\n SequenceMode.Timeline;\n this._notifyChanged$.next(this);\n },\n };\n\n const timeline: vd.VNode = vd.h(\"div.mapillary-sequence-timeline-button\", timelineProperties, [timelineIcon]);\n\n const properties: vd.createProperties = {\n style: {\n height: (this._defaultHeight / this._stepperDefaultWidth * containerWidth) + \"px\",\n transform: `translate(${containerWidth / 2 + 2}px, 0)`,\n width: (this._controlsDefaultWidth / this._stepperDefaultWidth * containerWidth) + \"px\",\n },\n };\n\n const className: string = \".mapillary-sequence-controls\" +\n (this._expandControls ? \".mapillary-sequence-controls-expanded\" : \"\");\n\n return vd.h(\"div\" + className, properties, [playback, timeline, expander]);\n }\n\n private _createSequenceArrows(\n nextId: string,\n prevId: string,\n containerWidth: number,\n configuration: SequenceConfiguration,\n navigator: Navigator): vd.VNode[] {\n\n let nextProperties: vd.createProperties = {\n onclick: nextId != null ?\n (): void => {\n navigator.moveDir$(NavigationDirection.Next)\n .subscribe(\n undefined,\n (error: Error): void => {\n if (!(error instanceof CancelMapillaryError)) {\n console.error(error);\n }\n });\n } :\n null,\n onpointerenter: (): void => { this._mouseEnterDirection$.next(NavigationDirection.Next); },\n onpointerleave: (): void => { this._mouseLeaveDirection$.next(NavigationDirection.Next); },\n };\n\n const borderRadius: number = Math.round(8 / this._stepperDefaultWidth * containerWidth);\n let prevProperties: vd.createProperties = {\n onclick: prevId != null ?\n (): void => {\n navigator.moveDir$(NavigationDirection.Prev)\n .subscribe(\n undefined,\n (error: Error): void => {\n if (!(error instanceof CancelMapillaryError)) {\n console.error(error);\n }\n });\n } :\n null,\n onpointerenter: (): void => { this._mouseEnterDirection$.next(NavigationDirection.Prev); },\n onpointerleave: (): void => { this._mouseLeaveDirection$.next(NavigationDirection.Prev); },\n style: {\n \"border-bottom-left-radius\": `${borderRadius}px`,\n \"border-top-left-radius\": `${borderRadius}px`,\n },\n };\n\n let nextClass: string = this._getStepClassName(NavigationDirection.Next, nextId, configuration.highlightId);\n let prevClass: string = this._getStepClassName(NavigationDirection.Prev, prevId, configuration.highlightId);\n\n let nextIcon: vd.VNode = vd.h(\"div.mapillary-sequence-icon\", []);\n let prevIcon: vd.VNode = vd.h(\"div.mapillary-sequence-icon\", []);\n\n return [\n vd.h(\"div.\" + prevClass, prevProperties, [prevIcon]),\n vd.h(\"div.\" + nextClass, nextProperties, [nextIcon]),\n ];\n }\n\n private _createStepper(\n edgeStatus: NavigationEdgeStatus,\n configuration: SequenceConfiguration,\n playEnabled: boolean,\n containerWidth: number,\n component: SequenceComponent,\n navigator: Navigator,\n ): vd.VNode {\n\n let nextId: string = null;\n let prevId: string = null;\n\n for (let edge of edgeStatus.edges) {\n if (edge.data.direction === NavigationDirection.Next) {\n nextId = edge.target;\n }\n\n if (edge.data.direction === NavigationDirection.Prev) {\n prevId = edge.target;\n }\n }\n\n const playingButton: vd.VNode = this._createPlayingButton(\n nextId, prevId, playEnabled, configuration, component);\n const buttons: vd.VNode[] = this._createSequenceArrows(nextId, prevId, containerWidth, configuration, navigator);\n buttons.splice(1, 0, playingButton);\n\n const containerProperties: vd.createProperties = {\n oncontextmenu: (event: MouseEvent): void => { event.preventDefault(); },\n style: {\n height: (this._defaultHeight / this._stepperDefaultWidth * containerWidth) + \"px\",\n width: containerWidth + \"px\",\n },\n };\n\n return vd.h(\"div.mapillary-sequence-stepper\", containerProperties, buttons);\n }\n\n private _createTimelineControls(containerWidth: number, index: number, max: number): vd.VNode {\n if (this._mode !== SequenceMode.Timeline) {\n return vd.h(\"div.mapillary-sequence-timeline\", []);\n }\n\n const positionInput: vd.VNode = this._createPositionInput(index, max);\n\n const closeIcon: vd.VNode = vd.h(\"div.mapillary-sequence-close-icon.mapillary-sequence-icon-visible\", []);\n const closeButtonProperties: vd.createProperties = {\n onclick: (): void => {\n this._mode = SequenceMode.Default;\n this._notifyChanged$.next(this);\n },\n };\n\n const closeButton: vd.VNode = vd.h(\"div.mapillary-sequence-close-button\", closeButtonProperties, [closeIcon]);\n\n const top: number = Math.round(containerWidth / this._stepperDefaultWidth * this._defaultHeight + 10);\n const playbackProperties: vd.createProperties = { style: { top: `${top}px` } };\n\n return vd.h(\"div.mapillary-sequence-timeline\", playbackProperties, [positionInput, closeButton]);\n }\n\n private _getStepClassName(direction: NavigationDirection, imageId: string, highlightId: string): string {\n let className: string = direction === NavigationDirection.Next ?\n \"mapillary-sequence-step-next\" :\n \"mapillary-sequence-step-prev\";\n\n if (imageId == null) {\n className += \"-inactive\";\n } else {\n if (highlightId === imageId) {\n className += \"-highlight\";\n }\n }\n\n return className;\n }\n\n private _setChangingPosition(value: boolean): void {\n this._changingPosition = value;\n this._notifyChangingPositionChanged$.next(value);\n }\n}\n","import * as vd from \"virtual-dom\";\n\nimport {\n combineLatest as observableCombineLatest,\n concat as observableConcat,\n merge as observableMerge,\n empty as observableEmpty,\n of as observableOf,\n Observable,\n Scheduler,\n Subject,\n} from \"rxjs\";\n\nimport {\n auditTime,\n catchError,\n debounceTime,\n distinctUntilChanged,\n filter,\n map,\n publish,\n publishReplay,\n refCount,\n retry,\n share,\n skip,\n startWith,\n switchMap,\n take,\n takeUntil,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Image } from \"../../graph/Image\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { GraphMode } from \"../../graph/GraphMode\";\nimport { NavigationEdgeStatus } from \"../../graph/interfaces/NavigationEdgeStatus\";\nimport { Sequence } from \"../../graph/Sequence\";\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { VirtualNodeHash } from \"../../render/interfaces/VirtualNodeHash\";\nimport { State } from \"../../state/State\";\nimport { SequenceConfiguration } from \"../interfaces/SequenceConfiguration\";\nimport { SequenceDOMRenderer } from \"./SequenceDOMRenderer\";\nimport { NavigationDirection } from \"../../graph/edge/NavigationDirection\";\nimport { Component } from \"../Component\";\nimport { ComponentEventType } from \"../events/ComponentEventType\";\nimport { ComponentPlayEvent } from \"../events/ComponentPlayEvent\";\nimport { ComponentHoverEvent } from \"../events/ComponentHoverEvent\";\nimport { ComponentName } from \"../ComponentName\";\n\n/**\n * @class SequenceComponent\n * @classdesc Component showing navigation arrows for sequence directions\n * as well as playing button. Exposes an API to start and stop play.\n */\nexport class SequenceComponent extends Component<SequenceConfiguration> {\n /** @inheritdoc */\n public static componentName: ComponentName = \"sequence\";\n\n private _sequenceDOMRenderer: SequenceDOMRenderer;\n private _scheduler: Scheduler;\n\n private _hoveredIdSubject$: Subject<string>;\n private _hoveredId$: Observable<string>;\n private _containerWidth$: Subject<number>;\n\n constructor(\n name: string,\n container: Container,\n navigator: Navigator,\n renderer?: SequenceDOMRenderer,\n scheduler?: Scheduler) {\n\n super(name, container, navigator);\n\n this._sequenceDOMRenderer = !!renderer ? renderer : new SequenceDOMRenderer(container);\n this._scheduler = scheduler;\n\n this._containerWidth$ = new Subject<number>();\n this._hoveredIdSubject$ = new Subject<string>();\n\n this._hoveredId$ = this._hoveredIdSubject$.pipe(share());\n\n this._navigator.playService.playing$.pipe(\n skip(1),\n withLatestFrom(this._configuration$))\n .subscribe(\n ([playing, configuration]: [boolean, SequenceConfiguration]): void => {\n const type: ComponentEventType = \"playing\";\n const event: ComponentPlayEvent = {\n playing,\n target: this,\n type,\n };\n this.fire(type, event);\n\n if (playing === configuration.playing) {\n return;\n }\n\n if (playing) {\n this.play();\n } else {\n this.stop();\n }\n });\n\n this._navigator.playService.direction$.pipe(\n skip(1),\n withLatestFrom(this._configuration$))\n .subscribe(\n ([direction, configuration]: [NavigationDirection, SequenceConfiguration]): void => {\n if (direction !== configuration.direction) {\n this.configure({ direction });\n }\n });\n }\n\n public fire(\n type: \"hover\",\n event: ComponentHoverEvent)\n : void;\n public fire(\n type: \"playing\",\n event: ComponentPlayEvent)\n : void;\n public fire<T>(\n type: ComponentEventType,\n event: T)\n : void {\n super.fire(type, event);\n }\n\n public off(\n type: \"hover\",\n handler: (event: ComponentHoverEvent) => void)\n : void;\n public off(\n type: \"playing\",\n handler: (event: ComponentPlayEvent) => void)\n : void;\n public off<T>(\n type: ComponentEventType,\n handler: (event: T) => void)\n : void {\n super.off(type, handler);\n }\n\n /**\n * Fired when the hovered element of a component changes.\n *\n * @event hover\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * var component = viewer.getComponent('<component-name>');\n * // Set an event listener\n * component.on('hover', function() {\n * console.log(\"A hover event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"hover\",\n handler: (event: ComponentHoverEvent) => void)\n : void;\n /**\n * Event fired when playing starts or stops.\n *\n * @event playing\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * var component = viewer.getComponent('<component-name>');\n * // Set an event listener\n * component.on('playing', function() {\n * console.log(\"A playing event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"playing\",\n handler: (event: ComponentPlayEvent) => void)\n : void;\n public on<T>(\n type: ComponentEventType,\n handler: (event: T) => void)\n : void {\n super.on(type, handler);\n }\n\n /**\n * Start playing.\n *\n * @fires playing\n */\n public play(): void { this.configure({ playing: true }); }\n\n /**\n * Stop playing.\n *\n * @fires playing\n */\n public stop(): void { this.configure({ playing: false }); }\n\n protected _activate(): void {\n this._sequenceDOMRenderer.activate();\n\n const edgeStatus$ = this._navigator.stateService.currentImage$.pipe(\n switchMap(\n (image: Image): Observable<NavigationEdgeStatus> => {\n return image.sequenceEdges$;\n }),\n publishReplay(1),\n refCount());\n\n const sequence$ = this._navigator.stateService.currentImage$.pipe(\n distinctUntilChanged(\n undefined,\n (image: Image): string => {\n return image.sequenceId;\n }),\n switchMap(\n (image: Image): Observable<Sequence> => {\n return observableConcat(\n observableOf(null),\n this._navigator.graphService.cacheSequence$(image.sequenceId).pipe(\n retry(3),\n catchError(\n (e: Error): Observable<Sequence> => {\n console.error(\"Failed to cache sequence\", e);\n\n return observableOf(null);\n })));\n }),\n startWith(null),\n publishReplay(1),\n refCount());\n\n const subs = this._subscriptions;\n\n subs.push(sequence$.subscribe());\n\n const rendererId$ = this._sequenceDOMRenderer.index$.pipe(\n withLatestFrom(sequence$),\n map(\n ([index, sequence]: [number, Sequence]): string => {\n return sequence != null ? sequence.imageIds[index] : null;\n }),\n filter(\n (id: string): boolean => {\n return !!id;\n }),\n distinctUntilChanged(),\n publish(),\n refCount());\n\n subs.push(observableMerge(\n rendererId$.pipe(debounceTime(100, this._scheduler)),\n rendererId$.pipe(auditTime(400, this._scheduler))).pipe(\n distinctUntilChanged(),\n switchMap(\n (id: string): Observable<Image> => {\n return this._navigator.moveTo$(id).pipe(\n catchError(\n (): Observable<Image> => {\n return observableEmpty();\n }));\n }))\n .subscribe());\n\n subs.push(this._sequenceDOMRenderer.changingPositionChanged$.pipe(\n filter(\n (changing: boolean): boolean => {\n return changing;\n }))\n .subscribe(\n (): void => {\n this._navigator.graphService.setGraphMode(GraphMode.Sequence);\n }));\n\n subs.push(this._sequenceDOMRenderer.changingPositionChanged$.pipe(\n filter(\n (changing: boolean): boolean => {\n return !changing;\n }))\n .subscribe(\n (): void => {\n this._navigator.graphService.setGraphMode(GraphMode.Spatial);\n }));\n\n this._navigator.graphService.graphMode$.pipe(\n switchMap(\n (mode: GraphMode): Observable<Image> => {\n return mode === GraphMode.Spatial ?\n this._navigator.stateService.currentImage$.pipe(\n take(2)) :\n observableEmpty();\n }),\n filter(\n (image: Image): boolean => {\n return !image.spatialEdges.cached;\n }),\n switchMap(\n (image: Image): Observable<Image> => {\n return this._navigator.graphService.cacheImage$(image.id).pipe(\n catchError(\n (): Observable<Image> => {\n return observableEmpty();\n }));\n }))\n .subscribe();\n\n subs.push(this._sequenceDOMRenderer.changingPositionChanged$.pipe(\n filter(\n (changing: boolean): boolean => {\n return changing;\n }))\n .subscribe(\n (): void => {\n this._navigator.playService.stop();\n }));\n\n subs.push(observableCombineLatest(\n this._navigator.graphService.graphMode$,\n this._sequenceDOMRenderer.changingPositionChanged$.pipe(\n startWith(false),\n distinctUntilChanged())).pipe(\n withLatestFrom(this._navigator.stateService.currentImage$),\n switchMap(\n ([[mode, changing], image]: [[GraphMode, boolean], Image]): Observable<Sequence> => {\n return changing && mode === GraphMode.Sequence ?\n this._navigator.graphService.cacheSequenceImages$(image.sequenceId, image.id).pipe(\n retry(3),\n catchError(\n (error: Error): Observable<Sequence> => {\n console.error(\"Failed to cache sequence images.\", error);\n\n return observableEmpty();\n })) :\n observableEmpty();\n }))\n .subscribe());\n\n const position$: Observable<{ index: number, max: number }> = sequence$.pipe(\n switchMap(\n (sequence: Sequence): Observable<{ index: number, max: number }> => {\n if (!sequence) {\n return observableOf({ index: null, max: null });\n }\n\n let firstCurrentId: boolean = true;\n\n return this._sequenceDOMRenderer.changingPositionChanged$.pipe(\n startWith(false),\n distinctUntilChanged(),\n switchMap(\n (changingPosition: boolean): Observable<string> => {\n const skipCount: number =\n !changingPosition &&\n firstCurrentId ?\n 0 : 1;\n firstCurrentId = false;\n\n return changingPosition ?\n rendererId$ :\n this._navigator.stateService.currentImage$.pipe(\n map(\n (image: Image): string => {\n return image.id;\n }),\n distinctUntilChanged(),\n skip(skipCount));\n }),\n map(\n (imageId: string): { index: number, max: number } => {\n const index: number = sequence.imageIds.indexOf(imageId);\n\n if (index === -1) {\n return { index: null, max: null };\n }\n\n return { index: index, max: sequence.imageIds.length - 1 };\n }));\n }));\n\n const earth$ = this._navigator.stateService.state$.pipe(\n map(\n (state: State): boolean => {\n return state === State.Earth;\n }),\n distinctUntilChanged());\n\n subs.push(observableCombineLatest(\n edgeStatus$,\n this._configuration$,\n this._containerWidth$,\n this._sequenceDOMRenderer.changed$.pipe(startWith(this._sequenceDOMRenderer)),\n this._navigator.playService.speed$,\n position$,\n earth$).pipe(\n map(\n (\n [edgeStatus, configuration, containerWidth, , speed, position, earth]:\n [\n NavigationEdgeStatus,\n SequenceConfiguration,\n number,\n SequenceDOMRenderer,\n number,\n { index: number, max: number },\n boolean,\n ]): VirtualNodeHash => {\n\n const vNode: vd.VNode = this._sequenceDOMRenderer\n .render(\n edgeStatus,\n configuration,\n containerWidth,\n speed,\n position.index,\n position.max,\n !earth,\n this,\n this._navigator);\n\n return { name: this._name, vNode: vNode };\n }))\n .subscribe(this._container.domRenderer.render$));\n\n subs.push(this._sequenceDOMRenderer.speed$\n .subscribe(\n (speed: number): void => {\n this._navigator.playService.setSpeed(speed);\n }));\n\n subs.push(this._configuration$.pipe(\n map(\n (configuration: SequenceConfiguration): NavigationDirection => {\n return configuration.direction;\n }),\n distinctUntilChanged())\n .subscribe(\n (direction: NavigationDirection): void => {\n this._navigator.playService.setDirection(direction);\n }));\n\n subs.push(observableCombineLatest(\n this._container.renderService.size$,\n this._configuration$.pipe(\n distinctUntilChanged(\n (value1: [number, number], value2: [number, number]): boolean => {\n return value1[0] === value2[0] && value1[1] === value2[1];\n },\n (configuration: SequenceConfiguration) => {\n return [configuration.minWidth, configuration.maxWidth];\n }))).pipe(\n map(\n ([size, configuration]: [ViewportSize, SequenceConfiguration]): number => {\n return this._sequenceDOMRenderer.getContainerWidth(\n size,\n configuration);\n }))\n .subscribe(this._containerWidth$));\n\n subs.push(this._configuration$.pipe(\n map(\n (configuration: SequenceConfiguration): boolean => {\n return configuration.playing;\n }),\n distinctUntilChanged())\n .subscribe(\n (playing: boolean) => {\n if (playing) {\n this._navigator.playService.play();\n } else {\n this._navigator.playService.stop();\n }\n }));\n\n subs.push(this._sequenceDOMRenderer.mouseEnterDirection$.pipe(\n switchMap(\n (direction: NavigationDirection): Observable<string> => {\n const edgeTo$: Observable<string> = edgeStatus$.pipe(\n map(\n (edgeStatus: NavigationEdgeStatus): string => {\n for (let edge of edgeStatus.edges) {\n if (edge.data.direction === direction) {\n return edge.target;\n }\n }\n\n return null;\n }),\n takeUntil(this._sequenceDOMRenderer.mouseLeaveDirection$));\n\n return observableConcat(edgeTo$, observableOf<string>(null));\n }),\n distinctUntilChanged())\n .subscribe(this._hoveredIdSubject$));\n\n subs.push(this._hoveredId$\n .subscribe(\n (id: string): void => {\n const type: ComponentEventType = \"hover\";\n const event: ComponentHoverEvent = {\n id,\n target: this,\n type,\n }\n this.fire(type, event);\n }));\n }\n\n protected _deactivate(): void {\n this._subscriptions.unsubscribe();\n this._sequenceDOMRenderer.deactivate();\n }\n\n protected _getDefaultConfiguration(): SequenceConfiguration {\n return {\n direction: NavigationDirection.Next,\n maxWidth: 108,\n minWidth: 70,\n playing: false,\n visible: true,\n };\n }\n}\n","import * as THREE from \"three\";\nimport { isFisheye, isSpherical } from \"./Geo\";\n\nimport { CameraType } from \"./interfaces/CameraType\";\n\nconst EPSILON = 1e-8;\n\n/**\n * @class Transform\n *\n * @classdesc Class used for calculating coordinate transformations\n * and projections.\n */\nexport class Transform {\n private _width: number;\n private _height: number;\n private _focal: number;\n private _orientation: number;\n private _scale: number;\n private _basicWidth: number;\n private _basicHeight: number;\n private _basicAspect: number;\n\n private _worldToCamera: THREE.Matrix4;\n private _worldToCameraInverse: THREE.Matrix4;\n private _scaledWorldToCamera: THREE.Matrix4;\n private _scaledWorldToCameraInverse: THREE.Matrix4;\n private _basicWorldToCamera: THREE.Matrix4;\n\n private _textureScale: number[];\n\n private _ck1: number;\n private _ck2: number;\n private _cameraType: CameraType;\n\n private _radialPeak: number;\n\n /**\n * Create a new transform instance.\n * @param {number} orientation - Image orientation.\n * @param {number} width - Image height.\n * @param {number} height - Image width.\n * @param {number} focal - Focal length.\n * @param {number} scale - Atomic scale.\n * @param {Array<number>} rotation - Rotation vector in three dimensions.\n * @param {Array<number>} translation - Translation vector in three dimensions.\n * @param {HTMLImageElement} image - Image for fallback size calculations.\n */\n constructor(\n orientation: number,\n width: number,\n height: number,\n scale: number,\n rotation: number[],\n translation: number[],\n image: HTMLImageElement,\n textureScale?: number[],\n cameraParameters?: number[],\n cameraType?: CameraType) {\n\n this._orientation = this._getValue(orientation, 1);\n\n let imageWidth = image != null ? image.width : 4;\n let imageHeight = image != null ? image.height : 3;\n let keepOrientation = this._orientation < 5;\n\n this._width = this._getValue(width, keepOrientation ? imageWidth : imageHeight);\n this._height = this._getValue(height, keepOrientation ? imageHeight : imageWidth);\n\n this._basicAspect = keepOrientation ?\n this._width / this._height :\n this._height / this._width;\n\n this._basicWidth = keepOrientation ? width : height;\n this._basicHeight = keepOrientation ? height : width;\n\n const parameters = this._getCameraParameters(\n cameraParameters,\n cameraType);\n const focal = parameters[0];\n const ck1 = parameters[1];\n const ck2 = parameters[2];\n\n this._focal = this._getValue(focal, 1);\n this._scale = this._getValue(scale, 0);\n\n this._worldToCamera = this.createWorldToCamera(rotation, translation);\n this._worldToCameraInverse = new THREE.Matrix4()\n .copy(this._worldToCamera)\n .invert()\n this._scaledWorldToCamera =\n this._createScaledWorldToCamera(this._worldToCamera, this._scale);\n this._scaledWorldToCameraInverse = new THREE.Matrix4()\n .copy(this._scaledWorldToCamera)\n .invert();\n\n this._basicWorldToCamera = this._createBasicWorldToCamera(\n this._worldToCamera,\n orientation);\n\n this._textureScale = !!textureScale ? textureScale : [1, 1];\n\n this._ck1 = !!ck1 ? ck1 : 0;\n this._ck2 = !!ck2 ? ck2 : 0;\n this._cameraType = !!cameraType ?\n cameraType :\n \"perspective\";\n\n this._radialPeak = this._getRadialPeak(this._ck1, this._ck2);\n }\n\n public get ck1(): number {\n return this._ck1;\n }\n\n public get ck2(): number {\n return this._ck2;\n }\n\n public get cameraType(): CameraType {\n return this._cameraType;\n }\n\n /**\n * Get basic aspect.\n * @returns {number} The orientation adjusted aspect ratio.\n */\n public get basicAspect(): number {\n return this._basicAspect;\n }\n\n /**\n * Get basic height.\n *\n * @description Does not fall back to image image height but\n * uses original value from API so can be faulty.\n *\n * @returns {number} The height of the basic version image\n * (adjusted for orientation).\n */\n public get basicHeight(): number {\n return this._basicHeight;\n }\n\n public get basicRt(): THREE.Matrix4 {\n return this._basicWorldToCamera;\n }\n\n /**\n * Get basic width.\n *\n * @description Does not fall back to image image width but\n * uses original value from API so can be faulty.\n *\n * @returns {number} The width of the basic version image\n * (adjusted for orientation).\n */\n public get basicWidth(): number {\n return this._basicWidth;\n }\n\n /**\n * Get focal.\n * @returns {number} The image focal length.\n */\n public get focal(): number {\n return this._focal;\n }\n\n /**\n * Get height.\n *\n * @description Falls back to the image image height if\n * the API data is faulty.\n *\n * @returns {number} The orientation adjusted image height.\n */\n public get height(): number {\n return this._height;\n }\n\n /**\n * Get orientation.\n * @returns {number} The image orientation.\n */\n public get orientation(): number {\n return this._orientation;\n }\n\n /**\n * Get rt.\n * @returns {THREE.Matrix4} The extrinsic camera matrix.\n */\n public get rt(): THREE.Matrix4 {\n return this._worldToCamera;\n }\n\n /**\n * Get srt.\n * @returns {THREE.Matrix4} The scaled extrinsic camera matrix.\n */\n public get srt(): THREE.Matrix4 {\n return this._scaledWorldToCamera;\n }\n\n /**\n * Get srtInverse.\n * @returns {THREE.Matrix4} The scaled extrinsic camera matrix.\n */\n public get srtInverse(): THREE.Matrix4 {\n return this._scaledWorldToCameraInverse;\n }\n\n /**\n * Get scale.\n * @returns {number} The image atomic reconstruction scale.\n */\n public get scale(): number {\n return this._scale;\n }\n\n /**\n * Get has valid scale.\n * @returns {boolean} Value indicating if the scale of the transform is valid.\n */\n public get hasValidScale(): boolean {\n return this._scale > 1e-2 && this._scale < 50;\n }\n\n /**\n * Get radial peak.\n * @returns {number} Value indicating the radius where the radial\n * undistortion function peaks.\n */\n public get radialPeak(): number {\n return this._radialPeak;\n }\n\n /**\n * Get width.\n *\n * @description Falls back to the image image width if\n * the API data is faulty.\n *\n * @returns {number} The orientation adjusted image width.\n */\n public get width(): number {\n return this._width;\n }\n\n /**\n * Calculate the up vector for the image transform.\n *\n * @returns {THREE.Vector3} Normalized and orientation adjusted up vector.\n */\n public upVector(): THREE.Vector3 {\n let rte: number[] = this._worldToCamera.elements;\n\n switch (this._orientation) {\n case 1:\n return new THREE.Vector3(-rte[1], -rte[5], -rte[9]);\n case 3:\n return new THREE.Vector3(rte[1], rte[5], rte[9]);\n case 6:\n return new THREE.Vector3(-rte[0], -rte[4], -rte[8]);\n case 8:\n return new THREE.Vector3(rte[0], rte[4], rte[8]);\n default:\n return new THREE.Vector3(-rte[1], -rte[5], -rte[9]);\n }\n }\n\n /**\n * Calculate projector matrix for projecting 3D points to texture map\n * coordinates (u and v).\n *\n * @returns {THREE.Matrix4} Projection matrix for 3D point to texture\n * map coordinate calculations.\n */\n public projectorMatrix(): THREE.Matrix4 {\n let projector: THREE.Matrix4 = this._normalizedToTextureMatrix();\n\n let f: number = this._focal;\n let projection: THREE.Matrix4 = new THREE.Matrix4().set(\n f, 0, 0, 0,\n 0, f, 0, 0,\n 0, 0, 0, 0,\n 0, 0, 1, 0);\n\n projector.multiply(projection);\n projector.multiply(this._worldToCamera);\n\n return projector;\n }\n\n /**\n * Project 3D world coordinates to basic coordinates.\n *\n * @param {Array<number>} point3d - 3D world coordinates.\n * @return {Array<number>} 2D basic coordinates.\n */\n public projectBasic(point3d: number[]): number[] {\n let sfm: number[] = this.projectSfM(point3d);\n return this._sfmToBasic(sfm);\n }\n\n /**\n * Unproject basic coordinates to 3D world coordinates.\n *\n * @param {Array<number>} basic - 2D basic coordinates.\n * @param {Array<number>} distance - Distance to unproject from camera center.\n * @param {boolean} [depth] - Treat the distance value as depth from camera center.\n * Only applicable for perspective images. Will be\n * ignored for spherical.\n * @returns {Array<number>} Unprojected 3D world coordinates.\n */\n public unprojectBasic(basic: number[], distance: number, depth?: boolean): number[] {\n let sfm: number[] = this._basicToSfm(basic);\n return this.unprojectSfM(sfm, distance, depth);\n }\n\n /**\n * Project 3D world coordinates to SfM coordinates.\n *\n * @param {Array<number>} point3d - 3D world coordinates.\n * @return {Array<number>} 2D SfM coordinates.\n */\n public projectSfM(point3d: number[]): number[] {\n let v: THREE.Vector4 = new THREE.Vector4(point3d[0], point3d[1], point3d[2], 1);\n v.applyMatrix4(this._worldToCamera);\n return this._bearingToSfm([v.x, v.y, v.z]);\n }\n\n /**\n * Unproject SfM coordinates to a 3D world coordinates.\n *\n * @param {Array<number>} sfm - 2D SfM coordinates.\n * @param {Array<number>} distance - Distance to unproject\n * from camera center.\n * @param {boolean} [depth] - Treat the distance value as\n * depth from camera center. Only applicable for perspective\n * images. Will be ignored for spherical.\n * @returns {Array<number>} Unprojected 3D world coordinates.\n */\n public unprojectSfM(\n sfm: number[],\n distance: number,\n depth?: boolean): number[] {\n const bearing = this._sfmToBearing(sfm);\n const unprojectedCamera = depth && !isSpherical(this._cameraType) ?\n new THREE.Vector4(\n distance * bearing[0] / bearing[2],\n distance * bearing[1] / bearing[2],\n distance,\n 1) :\n new THREE.Vector4(\n distance * bearing[0],\n distance * bearing[1],\n distance * bearing[2],\n 1);\n\n const unprojectedWorld = unprojectedCamera\n .applyMatrix4(this._worldToCameraInverse);\n return [\n unprojectedWorld.x / unprojectedWorld.w,\n unprojectedWorld.y / unprojectedWorld.w,\n unprojectedWorld.z / unprojectedWorld.w,\n ];\n }\n\n /**\n * Transform SfM coordinates to bearing vector (3D cartesian\n * coordinates on the unit sphere).\n *\n * @param {Array<number>} sfm - 2D SfM coordinates.\n * @returns {Array<number>} Bearing vector (3D cartesian coordinates\n * on the unit sphere).\n */\n private _sfmToBearing(sfm: number[]): number[] {\n if (isSpherical(this._cameraType)) {\n let lng: number = sfm[0] * 2 * Math.PI;\n let lat: number = -sfm[1] * 2 * Math.PI;\n let x: number = Math.cos(lat) * Math.sin(lng);\n let y: number = -Math.sin(lat);\n let z: number = Math.cos(lat) * Math.cos(lng);\n return [x, y, z];\n } else if (isFisheye(this._cameraType)) {\n let [dxn, dyn]: number[] = [sfm[0] / this._focal, sfm[1] / this._focal];\n const dTheta: number = Math.sqrt(dxn * dxn + dyn * dyn);\n let d: number = this._distortionFromDistortedRadius(dTheta, this._ck1, this._ck2, this._radialPeak);\n let theta: number = dTheta / d;\n let z: number = Math.cos(theta);\n let r: number = Math.sin(theta);\n const denomTheta = dTheta > EPSILON ? 1 / dTheta : 1;\n let x: number = r * dxn * denomTheta;\n let y: number = r * dyn * denomTheta;\n return [x, y, z];\n } else {\n let [dxn, dyn]: number[] = [sfm[0] / this._focal, sfm[1] / this._focal];\n const dr: number = Math.sqrt(dxn * dxn + dyn * dyn);\n let d: number = this._distortionFromDistortedRadius(dr, this._ck1, this._ck2, this._radialPeak);\n\n const xn: number = dxn / d;\n const yn: number = dyn / d;\n\n let v: THREE.Vector3 = new THREE.Vector3(xn, yn, 1);\n v.normalize();\n return [v.x, v.y, v.z];\n }\n }\n\n /** Compute distortion given the distorted radius.\n *\n * Solves for d in the equation\n * y = d(x, k1, k2) * x\n * given the distorted radius, y.\n */\n private _distortionFromDistortedRadius(distortedRadius: number, k1: number, k2: number, radialPeak: number): number {\n let d: number = 1.0;\n for (let i: number = 0; i < 10; i++) {\n let radius: number = distortedRadius / d;\n if (radius > radialPeak) {\n radius = radialPeak;\n }\n d = 1 + k1 * radius ** 2 + k2 * radius ** 4;\n }\n return d;\n }\n\n /**\n * Transform bearing vector (3D cartesian coordiantes on the unit sphere) to\n * SfM coordinates.\n *\n * @param {Array<number>} bearing - Bearing vector (3D cartesian coordinates on the\n * unit sphere).\n * @returns {Array<number>} 2D SfM coordinates.\n */\n private _bearingToSfm(bearing: number[]): number[] {\n if (isSpherical(this._cameraType)) {\n let x: number = bearing[0];\n let y: number = bearing[1];\n let z: number = bearing[2];\n let lng: number = Math.atan2(x, z);\n let lat: number = Math.atan2(-y, Math.sqrt(x * x + z * z));\n return [lng / (2 * Math.PI), -lat / (2 * Math.PI)];\n } else if (isFisheye(this._cameraType)) {\n if (bearing[2] > 0) {\n const [x, y, z]: number[] = bearing;\n const r: number = Math.sqrt(x * x + y * y);\n let theta: number = Math.atan2(r, z);\n\n if (theta > this._radialPeak) {\n theta = this._radialPeak;\n }\n\n const distortion: number = 1.0 + theta ** 2 * (this._ck1 + theta ** 2 * this._ck2);\n const s: number = this._focal * distortion * theta / r;\n\n return [s * x, s * y];\n } else {\n return [\n bearing[0] < 0 ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,\n bearing[1] < 0 ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,\n ];\n }\n } else {\n if (bearing[2] > 0) {\n let [xn, yn]: number[] = [bearing[0] / bearing[2], bearing[1] / bearing[2]];\n let r2: number = xn * xn + yn * yn;\n const rp2: number = this._radialPeak ** 2;\n\n if (r2 > rp2) {\n r2 = rp2;\n }\n\n const d: number = 1 + this._ck1 * r2 + this._ck2 * r2 ** 2;\n return [\n this._focal * d * xn,\n this._focal * d * yn,\n ];\n } else {\n return [\n bearing[0] < 0 ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,\n bearing[1] < 0 ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,\n ];\n }\n }\n }\n\n /**\n * Convert basic coordinates to SfM coordinates.\n *\n * @param {Array<number>} basic - 2D basic coordinates.\n * @returns {Array<number>} 2D SfM coordinates.\n */\n private _basicToSfm(basic: number[]): number[] {\n let rotatedX: number;\n let rotatedY: number;\n\n switch (this._orientation) {\n case 1:\n rotatedX = basic[0];\n rotatedY = basic[1];\n break;\n case 3:\n rotatedX = 1 - basic[0];\n rotatedY = 1 - basic[1];\n break;\n case 6:\n rotatedX = basic[1];\n rotatedY = 1 - basic[0];\n break;\n case 8:\n rotatedX = 1 - basic[1];\n rotatedY = basic[0];\n break;\n default:\n rotatedX = basic[0];\n rotatedY = basic[1];\n break;\n }\n\n let w: number = this._width;\n let h: number = this._height;\n let s: number = Math.max(w, h);\n let sfmX: number = rotatedX * w / s - w / s / 2;\n let sfmY: number = rotatedY * h / s - h / s / 2;\n\n return [sfmX, sfmY];\n }\n\n /**\n * Convert SfM coordinates to basic coordinates.\n *\n * @param {Array<number>} sfm - 2D SfM coordinates.\n * @returns {Array<number>} 2D basic coordinates.\n */\n private _sfmToBasic(sfm: number[]): number[] {\n let w: number = this._width;\n let h: number = this._height;\n let s: number = Math.max(w, h);\n let rotatedX: number = (sfm[0] + w / s / 2) / w * s;\n let rotatedY: number = (sfm[1] + h / s / 2) / h * s;\n\n let basicX: number;\n let basicY: number;\n\n switch (this._orientation) {\n case 1:\n basicX = rotatedX;\n basicY = rotatedY;\n break;\n case 3:\n basicX = 1 - rotatedX;\n basicY = 1 - rotatedY;\n break;\n case 6:\n basicX = 1 - rotatedY;\n basicY = rotatedX;\n break;\n case 8:\n basicX = rotatedY;\n basicY = 1 - rotatedX;\n break;\n default:\n basicX = rotatedX;\n basicY = rotatedY;\n break;\n }\n\n return [basicX, basicY];\n }\n\n /**\n * Checks a value and returns it if it exists and is larger than 0.\n * Fallbacks if it is null.\n *\n * @param {number} value - Value to check.\n * @param {number} fallback - Value to fall back to.\n * @returns {number} The value or its fallback value if it is not defined or negative.\n */\n private _getValue(value: number, fallback: number): number {\n return value != null && value > 0 ? value : fallback;\n }\n\n private _getCameraParameters(\n value: number[],\n cameraType: string): number[] {\n if (isSpherical(cameraType)) { return []; }\n if (!value || value.length === 0) { return [1, 0, 0]; }\n\n const padding = 3 - value.length;\n if (padding <= 0) { return value; }\n\n return value\n .concat(\n new Array(padding)\n .fill(0));\n }\n\n /**\n * Creates the extrinsic camera matrix [ R | t ].\n *\n * @param {Array<number>} rotation - Rotation vector in angle axis representation.\n * @param {Array<number>} translation - Translation vector.\n * @returns {THREE.Matrix4} Extrisic camera matrix.\n */\n private createWorldToCamera(\n rotation: number[],\n translation: number[]): THREE.Matrix4 {\n const axis = new THREE.Vector3(rotation[0], rotation[1], rotation[2]);\n const angle = axis.length();\n if (angle > 0) {\n axis.normalize();\n }\n\n const worldToCamera = new THREE.Matrix4();\n worldToCamera.makeRotationAxis(axis, angle);\n worldToCamera.setPosition(\n new THREE.Vector3(\n translation[0],\n translation[1],\n translation[2]));\n\n return worldToCamera;\n }\n\n /**\n * Calculates the scaled extrinsic camera matrix scale * [ R | t ].\n *\n * @param {THREE.Matrix4} worldToCamera - Extrisic camera matrix.\n * @param {number} scale - Scale factor.\n * @returns {THREE.Matrix4} Scaled extrisic camera matrix.\n */\n private _createScaledWorldToCamera(\n worldToCamera: THREE.Matrix4,\n scale: number): THREE.Matrix4 {\n const scaledWorldToCamera = worldToCamera.clone();\n const elements = scaledWorldToCamera.elements;\n elements[12] = scale * elements[12];\n elements[13] = scale * elements[13];\n elements[14] = scale * elements[14];\n scaledWorldToCamera.scale(new THREE.Vector3(scale, scale, scale));\n return scaledWorldToCamera;\n }\n\n private _createBasicWorldToCamera(rt: THREE.Matrix4, orientation: number): THREE.Matrix4 {\n const axis: THREE.Vector3 = new THREE.Vector3(0, 0, 1);\n let angle: number = 0;\n\n switch (orientation) {\n case 3:\n angle = Math.PI;\n break;\n case 6:\n angle = Math.PI / 2;\n break;\n case 8:\n angle = 3 * Math.PI / 2;\n break;\n default:\n break;\n }\n\n return new THREE.Matrix4()\n .makeRotationAxis(axis, angle)\n .multiply(rt);\n }\n\n private _getRadialPeak(k1: number, k2: number): number {\n const a: number = 5 * k2;\n const b: number = 3 * k1;\n const c: number = 1;\n const d: number = b ** 2 - 4 * a * c;\n\n if (d < 0) {\n return undefined;\n }\n\n const root1: number = (-b - Math.sqrt(d)) / 2 / a;\n const root2: number = (-b + Math.sqrt(d)) / 2 / a;\n\n const minRoot: number = Math.min(root1, root2);\n const maxRoot: number = Math.max(root1, root2);\n\n return minRoot > 0 ?\n Math.sqrt(minRoot) :\n maxRoot > 0 ?\n Math.sqrt(maxRoot) :\n undefined;\n }\n\n /**\n * Calculate a transformation matrix from normalized coordinates for\n * texture map coordinates.\n *\n * @returns {THREE.Matrix4} Normalized coordinates to texture map\n * coordinates transformation matrix.\n */\n private _normalizedToTextureMatrix(): THREE.Matrix4 {\n const size: number = Math.max(this._width, this._height);\n\n const scaleX: number = this._orientation < 5 ? this._textureScale[0] : this._textureScale[1];\n const scaleY: number = this._orientation < 5 ? this._textureScale[1] : this._textureScale[0];\n\n const w: number = size / this._width * scaleX;\n const h: number = size / this._height * scaleY;\n\n switch (this._orientation) {\n case 1:\n return new THREE.Matrix4().set(w, 0, 0, 0.5, 0, -h, 0, 0.5, 0, 0, 1, 0, 0, 0, 0, 1);\n case 3:\n return new THREE.Matrix4().set(-w, 0, 0, 0.5, 0, h, 0, 0.5, 0, 0, 1, 0, 0, 0, 0, 1);\n case 6:\n return new THREE.Matrix4().set(0, -h, 0, 0.5, -w, 0, 0, 0.5, 0, 0, 1, 0, 0, 0, 0, 1);\n case 8:\n return new THREE.Matrix4().set(0, h, 0, 0.5, w, 0, 0, 0.5, 0, 0, 1, 0, 0, 0, 0, 1);\n default:\n return new THREE.Matrix4().set(w, 0, 0, 0.5, 0, -h, 0, 0.5, 0, 0, 1, 0, 0, 0, 0, 1);\n }\n }\n}\n","import * as THREE from \"three\";\nimport { Subscription } from \"rxjs\";\n\nimport { Spatial } from \"../../geo/Spatial\";\nimport { Transform } from \"../../geo/Transform\";\nimport { Image } from \"../../graph/Image\";\nimport { IAnimationState } from \"../../state/interfaces/IAnimationState\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { TextureProvider } from \"../../tile/TextureProvider\";\nimport { BBoxProjectorShaderMaterial } from \"../image/interfaces/BBoxProjectorShaderMaterial\";\nimport { ProjectorShaderMaterial } from \"../image/interfaces/ProjectorShaderMaterial\";\nimport { SliderConfigurationMode } from \"../interfaces/SliderConfiguration\";\nimport { MeshFactory } from \"../util/MeshFactory\";\nimport { MeshScene } from \"../util/MeshScene\";\nimport { isSpherical } from \"../../geo/Geo\";\nimport { CameraType } from \"../../geo/interfaces/CameraType\";\n\nexport class SliderGLRenderer {\n private _factory: MeshFactory;\n private _scene: MeshScene;\n private _spatial: Spatial;\n\n private _currentKey: string;\n private _previousKey: string;\n\n private _disabled: boolean;\n private _curtain: number;\n private _frameId: number;\n private _needsRender: boolean;\n\n private _mode: SliderConfigurationMode;\n\n private _currentProviderDisposers: { [key: string]: () => void };\n private _previousProviderDisposers: { [key: string]: () => void };\n\n constructor() {\n this._factory = new MeshFactory();\n this._scene = new MeshScene();\n this._spatial = new Spatial();\n\n this._currentKey = null;\n this._previousKey = null;\n\n this._disabled = false;\n this._curtain = 1;\n this._frameId = 0;\n this._needsRender = false;\n\n this._mode = null;\n\n this._currentProviderDisposers = {};\n this._previousProviderDisposers = {};\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n public get frameId(): number {\n return this._frameId;\n }\n\n public get needsRender(): boolean {\n return this._needsRender;\n }\n\n public setTextureProvider(key: string, provider: TextureProvider): void {\n this._setTextureProvider(\n key,\n this._currentKey,\n provider,\n this._currentProviderDisposers,\n this._updateTexture.bind(this));\n }\n\n public setTextureProviderPrev(key: string, provider: TextureProvider): void {\n this._setTextureProvider(\n key,\n this._previousKey,\n provider,\n this._previousProviderDisposers,\n this._updateTexturePrev.bind(this));\n }\n\n public update(frame: AnimationFrame, mode: SliderConfigurationMode): void {\n this._updateFrameId(frame.id);\n this._updateImagePlanes(frame.state, mode);\n }\n\n public updateCurtain(curtain: number): void {\n if (this._curtain === curtain) {\n return;\n }\n\n this._curtain = curtain;\n this._updateCurtain();\n\n this._needsRender = true;\n }\n\n public updateTexture(\n imageElement: HTMLImageElement,\n image: Image)\n : void {\n const planes: { [key: string]: THREE.Mesh } =\n image.id === this._currentKey ?\n this._scene.planes :\n image.id === this._previousKey ?\n this._scene.planesOld :\n {};\n\n if (Object.keys(planes).length === 0) {\n return;\n }\n\n this._needsRender = true;\n\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planes[key];\n let material: ProjectorShaderMaterial = <ProjectorShaderMaterial>plane.material;\n let texture: THREE.Texture = <THREE.Texture>material.uniforms.projectorTex.value;\n\n texture.image = imageElement;\n texture.needsUpdate = true;\n }\n }\n\n public updateTextureImage(\n imageElement: HTMLImageElement,\n image?: Image)\n : void {\n if (this._currentKey !== image.id) {\n return;\n }\n\n this._needsRender = true;\n\n const planes: { [key: string]: THREE.Mesh } = this._scene.planes;\n\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planes[key];\n let material: ProjectorShaderMaterial = <ProjectorShaderMaterial>plane.material;\n let texture: THREE.Texture = <THREE.Texture>material.uniforms.projectorTex.value;\n\n texture.image = imageElement;\n texture.needsUpdate = true;\n }\n }\n\n public render(\n perspectiveCamera: THREE.PerspectiveCamera,\n renderer: THREE.WebGLRenderer): void {\n\n if (!this.disabled) {\n renderer.render(this._scene.sceneOld, perspectiveCamera);\n }\n\n renderer.render(this._scene.scene, perspectiveCamera);\n\n this._needsRender = false;\n }\n\n public dispose(): void {\n this._scene.clear();\n\n for (const key in this._currentProviderDisposers) {\n if (!this._currentProviderDisposers.hasOwnProperty(key)) {\n continue;\n }\n\n this._currentProviderDisposers[key]();\n }\n\n for (const key in this._previousProviderDisposers) {\n if (!this._previousProviderDisposers.hasOwnProperty(key)) {\n continue;\n }\n\n this._previousProviderDisposers[key]();\n }\n\n this._currentProviderDisposers = {};\n this._previousProviderDisposers = {};\n }\n\n private _getBasicCorners(currentAspect: number, previousAspect: number): number[][] {\n let offsetX: number;\n let offsetY: number;\n\n if (currentAspect > previousAspect) {\n offsetX = 0.5;\n offsetY = 0.5 * currentAspect / previousAspect;\n } else {\n offsetX = 0.5 * previousAspect / currentAspect;\n offsetY = 0.5;\n }\n\n return [[0.5 - offsetX, 0.5 - offsetY], [0.5 + offsetX, 0.5 + offsetY]];\n }\n\n private _setDisabled(state: IAnimationState): void {\n this._disabled = state.currentImage == null ||\n state.previousImage == null ||\n (isSpherical(state.currentImage.cameraType) &&\n !isSpherical(state.previousImage.cameraType));\n }\n\n private _setTextureProvider(\n key: string,\n originalKey: string,\n provider: TextureProvider,\n providerDisposers: { [key: string]: () => void },\n updateTexture: (texture: THREE.Texture) => void): void {\n\n if (key !== originalKey) {\n return;\n }\n\n let createdSubscription: Subscription = provider.textureCreated$\n .subscribe(updateTexture);\n\n let updatedSubscription: Subscription = provider.textureUpdated$\n .subscribe(\n (updated: boolean): void => {\n this._needsRender = true;\n });\n\n let dispose: () => void = (): void => {\n createdSubscription.unsubscribe();\n updatedSubscription.unsubscribe();\n provider.dispose();\n };\n\n if (key in providerDisposers) {\n let disposeProvider: () => void = providerDisposers[key];\n disposeProvider();\n\n delete providerDisposers[key];\n }\n\n providerDisposers[key] = dispose;\n }\n\n private _updateCurtain(): void {\n const planes: { [key: string]: THREE.Mesh } = this._scene.planes;\n\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planes[key];\n let shaderMaterial = <BBoxProjectorShaderMaterial>plane.material;\n\n if (!!shaderMaterial.uniforms.curtain) {\n shaderMaterial.uniforms.curtain.value = this._curtain;\n }\n }\n }\n\n private _updateFrameId(frameId: number): void {\n this._frameId = frameId;\n }\n\n private _updateImagePlanes(state: IAnimationState, mode: SliderConfigurationMode): void {\n const currentChanged: boolean = state.currentImage != null && this._currentKey !== state.currentImage.id;\n const previousChanged: boolean = state.previousImage != null && this._previousKey !== state.previousImage.id;\n const modeChanged: boolean = this._mode !== mode;\n\n if (!(currentChanged || previousChanged || modeChanged)) {\n return;\n }\n\n this._setDisabled(state);\n this._needsRender = true;\n this._mode = mode;\n\n const motionless =\n state.motionless ||\n mode === SliderConfigurationMode.Stationary ||\n isSpherical(state.currentImage.cameraType);\n\n if (this.disabled || previousChanged) {\n if (this._previousKey in this._previousProviderDisposers) {\n this._previousProviderDisposers[this._previousKey]();\n\n delete this._previousProviderDisposers[this._previousKey];\n }\n }\n\n if (this.disabled) {\n this._scene.setImagePlanesOld({});\n } else {\n if (previousChanged || modeChanged) {\n const previousNode: Image = state.previousImage;\n\n this._previousKey = previousNode.id;\n\n const elements: number[] = state.currentTransform.rt.elements;\n let translation: number[] = [elements[12], elements[13], elements[14]];\n\n const currentAspect: number = state.currentTransform.basicAspect;\n const previousAspect: number = state.previousTransform.basicAspect;\n\n const textureScale: number[] = currentAspect > previousAspect ?\n [1, previousAspect / currentAspect] :\n [currentAspect / previousAspect, 1];\n\n let rotation: number[] = state.currentImage.rotation;\n let width: number = state.currentImage.width;\n let height: number = state.currentImage.height;\n\n if (isSpherical(previousNode.cameraType)) {\n rotation = state.previousImage.rotation;\n translation = this._spatial\n .rotate(\n this._spatial\n .opticalCenter(\n state.currentImage.rotation,\n translation)\n .toArray(),\n rotation)\n .multiplyScalar(-1)\n .toArray();\n\n width = state.previousImage.width;\n height = state.previousImage.height;\n }\n\n const transform: Transform = new Transform(\n state.currentImage.exifOrientation,\n width,\n height,\n state.currentImage.scale,\n rotation,\n translation,\n previousNode.image,\n textureScale,\n state.currentImage.cameraParameters,\n <CameraType>state.currentImage.cameraType);\n\n let mesh: THREE.Mesh = undefined;\n\n if (isSpherical(previousNode.cameraType)) {\n mesh = this._factory.createMesh(\n previousNode,\n motionless ||\n isSpherical(state.currentImage.cameraType) ?\n transform : state.previousTransform);\n } else {\n if (motionless) {\n const [[basicX0, basicY0], [basicX1, basicY1]]: number[][] = this._getBasicCorners(currentAspect, previousAspect);\n\n mesh = this._factory.createFlatMesh(\n state.previousImage,\n transform,\n basicX0,\n basicX1,\n basicY0,\n basicY1);\n } else {\n mesh = this._factory.createMesh(state.previousImage, state.previousTransform);\n }\n }\n\n const previousPlanes: { [key: string]: THREE.Mesh } = {};\n previousPlanes[previousNode.id] = mesh;\n this._scene.setImagePlanesOld(previousPlanes);\n }\n }\n\n if (currentChanged || modeChanged) {\n if (this._currentKey in this._currentProviderDisposers) {\n this._currentProviderDisposers[this._currentKey]();\n\n delete this._currentProviderDisposers[this._currentKey];\n }\n\n this._currentKey = state.currentImage.id;\n\n const planes: { [key: string]: THREE.Mesh } = {};\n\n if (isSpherical(state.currentImage.cameraType)) {\n planes[state.currentImage.id] =\n this._factory.createCurtainMesh(\n state.currentImage,\n state.currentTransform);\n } else {\n if (motionless) {\n planes[state.currentImage.id] = this._factory.createDistortedCurtainMesh(state.currentImage, state.currentTransform);\n } else {\n planes[state.currentImage.id] = this._factory.createCurtainMesh(state.currentImage, state.currentTransform);\n }\n }\n\n this._scene.setImagePlanes(planes);\n\n this._updateCurtain();\n }\n }\n\n private _updateTexture(texture: THREE.Texture): void {\n this._needsRender = true;\n\n const planes: { [key: string]: THREE.Mesh } = this._scene.planes;\n\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planes[key];\n let material: ProjectorShaderMaterial = <ProjectorShaderMaterial>plane.material;\n\n let oldTexture: THREE.Texture = <THREE.Texture>material.uniforms.projectorTex.value;\n material.uniforms.projectorTex.value = null;\n oldTexture.dispose();\n\n material.uniforms.projectorTex.value = texture;\n }\n }\n\n private _updateTexturePrev(texture: THREE.Texture): void {\n this._needsRender = true;\n\n const planes: { [key: string]: THREE.Mesh } = this._scene.planesOld;\n\n for (const key in planes) {\n if (!planes.hasOwnProperty(key)) {\n continue;\n }\n\n const plane: THREE.Mesh = planes[key];\n let material: ProjectorShaderMaterial = <ProjectorShaderMaterial>plane.material;\n\n let oldTexture: THREE.Texture = <THREE.Texture>material.uniforms.projectorTex.value;\n material.uniforms.projectorTex.value = null;\n oldTexture.dispose();\n\n material.uniforms.projectorTex.value = texture;\n }\n }\n}\n","import { merge as observableMerge, Observable, Subject, Subscription } from \"rxjs\";\n\nimport { filter } from \"rxjs/operators\";\nimport * as vd from \"virtual-dom\";\n\nimport { Container } from \"../../viewer/Container\";\nimport { SliderConfigurationMode } from \"../interfaces/SliderConfiguration\";\n\nexport class SliderDOMRenderer {\n private _container: Container;\n\n private _interacting: boolean;\n private _notifyModeChanged$: Subject<SliderConfigurationMode>;\n private _notifyPositionChanged$: Subject<number>;\n private _stopInteractionSubscription: Subscription;\n\n constructor(container: Container) {\n this._container = container;\n\n this._interacting = false;\n this._notifyModeChanged$ = new Subject<SliderConfigurationMode>();\n this._notifyPositionChanged$ = new Subject<number>();\n this._stopInteractionSubscription = null;\n }\n\n public get mode$(): Observable<SliderConfigurationMode> {\n return this._notifyModeChanged$;\n }\n\n public get position$(): Observable<number> {\n return this._notifyPositionChanged$;\n }\n\n public activate(): void {\n if (!!this._stopInteractionSubscription) {\n return;\n }\n\n this._stopInteractionSubscription = observableMerge(\n this._container.mouseService.documentMouseUp$,\n this._container.touchService.touchEnd$.pipe(\n filter(\n (touchEvent: TouchEvent): boolean => {\n return touchEvent.touches.length === 0;\n })))\n .subscribe(\n (event: Event): void => {\n if (this._interacting) {\n this._interacting = false;\n }\n });\n }\n\n public deactivate(): void {\n if (!this._stopInteractionSubscription) {\n return;\n }\n\n this._interacting = false;\n\n this._stopInteractionSubscription.unsubscribe();\n this._stopInteractionSubscription = null;\n }\n\n public render(\n position: number,\n mode: SliderConfigurationMode,\n motionless: boolean,\n spherical: boolean,\n visible: boolean): vd.VNode {\n const children: vd.VNode[] = [];\n\n if (visible) {\n children.push(vd.h(\"div.mapillary-slider-border\", []));\n\n const modeVisible: boolean = !(motionless || spherical);\n if (modeVisible) {\n children.push(this._createModeButton(mode));\n children.push(this._createModeButton2d(mode));\n }\n\n children.push(this._createPositionInput(position, modeVisible));\n }\n\n const boundingRect: ClientRect = this._container.domContainer.getBoundingClientRect();\n const width: number = Math.max(215, Math.min(400, boundingRect.width - 100));\n\n return vd.h(\"div.mapillary-slider-container\", { style: { width: `${width}px` } }, children);\n }\n\n private _createModeButton(mode: SliderConfigurationMode): vd.VNode {\n const properties: vd.createProperties = {\n onclick: (): void => {\n if (mode === SliderConfigurationMode.Motion) {\n return;\n }\n\n this._notifyModeChanged$.next(SliderConfigurationMode.Motion);\n },\n };\n\n const className: string = mode === SliderConfigurationMode.Stationary ?\n \"mapillary-slider-mode-button-inactive\" :\n \"mapillary-slider-mode-button\";\n\n return vd.h(\"div.\" + className, properties, [vd.h(\"div.mapillary-slider-mode-icon\", [])]);\n }\n\n private _createModeButton2d(mode: SliderConfigurationMode): vd.VNode {\n const properties: vd.createProperties = {\n onclick: (): void => {\n if (mode === SliderConfigurationMode.Stationary) {\n return;\n }\n\n this._notifyModeChanged$.next(SliderConfigurationMode.Stationary);\n },\n };\n\n const className: string = mode === SliderConfigurationMode.Motion ?\n \"mapillary-slider-mode-button-2d-inactive\" :\n \"mapillary-slider-mode-button-2d\";\n\n return vd.h(\"div.\" + className, properties, [vd.h(\"div.mapillary-slider-mode-icon-2d\", [])]);\n }\n\n private _createPositionInput(position: number, modeVisible: boolean): vd.VNode {\n const onChange: (e: Event) => void = (e: Event): void => {\n this._notifyPositionChanged$.next(Number((<HTMLInputElement>e.target).value) / 1000);\n };\n\n const onStart: (e: Event) => void = (e: Event): void => {\n this._interacting = true;\n e.stopPropagation();\n };\n\n const onMove: (e: Event) => void = (e: Event): void => {\n if (this._interacting) {\n e.stopPropagation();\n }\n };\n\n const onKeyDown: (e: KeyboardEvent) => void = (e: KeyboardEvent): void => {\n if (e.key === \"ArrowDown\" || e.key === \"ArrowLeft\" ||\n e.key === \"ArrowRight\" || e.key === \"ArrowUp\") {\n e.preventDefault();\n }\n };\n\n const boundingRect: ClientRect = this._container.domContainer.getBoundingClientRect();\n const width: number = Math.max(215, Math.min(400, boundingRect.width - 105)) - 84 + (modeVisible ? 0 : 52);\n\n const positionInput: vd.VNode = vd.h(\n \"input.mapillary-slider-position\",\n {\n max: 1000,\n min: 0,\n onchange: onChange,\n oninput: onChange,\n onkeydown: onKeyDown,\n onpointerdown: onStart,\n onpointermove: onMove,\n ontouchmove: onMove,\n ontouchstart: onStart,\n style: {\n width: `${width}px`,\n },\n type: \"range\",\n value: 1000 * position,\n },\n []);\n\n return vd.h(\"div.mapillary-slider-position-container\", [positionInput]);\n }\n}\n","import * as THREE from \"three\";\n\nimport {\n combineLatest as observableCombineLatest,\n concat as observableConcat,\n empty as observableEmpty,\n zip as observableZip,\n Observable,\n Subscription,\n Subject,\n} from \"rxjs\";\n\nimport {\n catchError,\n debounceTime,\n distinctUntilChanged,\n filter,\n first,\n map,\n pairwise,\n publishReplay,\n refCount,\n scan,\n skipWhile,\n startWith,\n switchMap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport {\n SliderImages,\n SliderCombination,\n GLRendererOperation,\n PositionLookat,\n} from \"./interfaces/SliderInterfaces\";\n\nimport { Image } from \"../../graph/Image\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { Spatial } from \"../../geo/Spatial\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { RenderPass } from \"../../render/RenderPass\";\nimport { GLRenderHash } from \"../../render/interfaces/IGLRenderHash\";\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { VirtualNodeHash } from \"../../render/interfaces/VirtualNodeHash\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { IAnimationState } from \"../../state/interfaces/IAnimationState\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { State } from \"../../state/State\";\nimport { TileLoader } from \"../../tile/TileLoader\";\nimport { TileStore } from \"../../tile/TileStore\";\nimport { TileBoundingBox } from \"../../tile/interfaces/TileBoundingBox\";\nimport { TileRegionOfInterest }\n from \"../../tile/interfaces/TileRegionOfInterest\";\nimport { RegionOfInterestCalculator }\n from \"../../tile/RegionOfInterestCalculator\";\nimport { TextureProvider } from \"../../tile/TextureProvider\";\nimport { Component } from \"../Component\";\nimport {\n SliderConfiguration,\n SliderConfigurationMode,\n} from \"../interfaces/SliderConfiguration\";\nimport { SliderGLRenderer } from \"./SliderGLRenderer\";\nimport { Transform } from \"../../geo/Transform\";\nimport { SliderDOMRenderer } from \"./SliderDOMRenderer\";\nimport { isSpherical } from \"../../geo/Geo\";\nimport { ComponentName } from \"../ComponentName\";\n\n/**\n * @class SliderComponent\n *\n * @classdesc Component for comparing pairs of images. Renders\n * a slider for adjusting the curtain of the first image.\n *\n * Deactivate the sequence, direction and image plane\n * components when activating the slider component to avoid\n * interfering UI elements.\n *\n * To retrive and use the slider component\n *\n * @example\n * ```js\n * var viewer = new Viewer({ ... });\n *\n * viewer.deactivateComponent(\"image\");\n * viewer.deactivateComponent(\"direction\");\n * viewer.deactivateComponent(\"sequence\");\n *\n * viewer.activateComponent(\"slider\");\n *\n * var sliderComponent = viewer.getComponent(\"slider\");\n * ```\n */\nexport class SliderComponent extends Component<SliderConfiguration> {\n public static componentName: ComponentName = \"slider\";\n\n private _viewportCoords: ViewportCoords;\n private _domRenderer: SliderDOMRenderer;\n private _imageTileLoader: TileLoader;\n private _roiCalculator: RegionOfInterestCalculator;\n private _spatial: Spatial;\n\n private _glRendererOperation$: Subject<GLRendererOperation>;\n private _glRenderer$: Observable<SliderGLRenderer>;\n private _glRendererCreator$: Subject<void>;\n private _glRendererDisposer$: Subject<void>;\n\n private _waitSubscription: Subscription;\n\n /** @ignore */\n constructor(\n name: string,\n container: Container,\n navigator: Navigator,\n viewportCoords?: ViewportCoords) {\n super(name, container, navigator);\n\n this._viewportCoords = !!viewportCoords ? viewportCoords : new ViewportCoords();\n this._domRenderer = new SliderDOMRenderer(container);\n this._imageTileLoader = new TileLoader(navigator.api);\n this._roiCalculator = new RegionOfInterestCalculator();\n this._spatial = new Spatial();\n\n this._glRendererOperation$ = new Subject<GLRendererOperation>();\n this._glRendererCreator$ = new Subject<void>();\n this._glRendererDisposer$ = new Subject<void>();\n\n this._glRenderer$ = this._glRendererOperation$.pipe(\n scan(\n (glRenderer: SliderGLRenderer, operation: GLRendererOperation): SliderGLRenderer => {\n return operation(glRenderer);\n },\n null),\n filter(\n (glRenderer: SliderGLRenderer): boolean => {\n return glRenderer != null;\n }),\n distinctUntilChanged(\n undefined,\n (glRenderer: SliderGLRenderer): number => {\n return glRenderer.frameId;\n }));\n\n this._glRendererCreator$.pipe(\n map(\n (): GLRendererOperation => {\n return (glRenderer: SliderGLRenderer): SliderGLRenderer => {\n if (glRenderer != null) {\n throw new Error(\"Multiple slider states can not be created at the same time\");\n }\n\n return new SliderGLRenderer();\n };\n }))\n .subscribe(this._glRendererOperation$);\n\n this._glRendererDisposer$.pipe(\n map(\n (): GLRendererOperation => {\n return (glRenderer: SliderGLRenderer): SliderGLRenderer => {\n glRenderer.dispose();\n\n return null;\n };\n }))\n .subscribe(this._glRendererOperation$);\n }\n\n protected _activate(): void {\n const subs = this._subscriptions;\n subs.push(this._domRenderer.mode$\n .subscribe(\n (mode: SliderConfigurationMode): void => {\n this.configure({ mode });\n }));\n\n subs.push(this._glRenderer$.pipe(\n map(\n (glRenderer: SliderGLRenderer): GLRenderHash => {\n let renderHash: GLRenderHash = {\n name: this._name,\n renderer: {\n frameId: glRenderer.frameId,\n needsRender: glRenderer.needsRender,\n render: glRenderer.render.bind(glRenderer),\n pass: RenderPass.Background,\n },\n };\n\n return renderHash;\n }))\n .subscribe(this._container.glRenderer.render$));\n\n const position$ = observableConcat(\n this.configuration$.pipe(\n map(\n (configuration: SliderConfiguration): number => {\n return configuration.initialPosition != null ?\n configuration.initialPosition : 1;\n }),\n first()),\n this._domRenderer.position$);\n\n const mode$ = this.configuration$.pipe(\n map(\n (configuration: SliderConfiguration): SliderConfigurationMode => {\n return configuration.mode;\n }),\n distinctUntilChanged());\n\n const motionless$ = this._navigator.stateService.currentState$.pipe(\n map(\n (frame: AnimationFrame): boolean => {\n return frame.state.motionless;\n }),\n distinctUntilChanged());\n\n const spherical$ = this._navigator.stateService.currentState$.pipe(\n map(\n (frame: AnimationFrame): boolean => {\n return isSpherical(frame.state.currentImage.cameraType);\n }),\n distinctUntilChanged());\n\n const sliderVisible$ = observableCombineLatest(\n this._configuration$.pipe(\n map(\n (configuration: SliderConfiguration): boolean => {\n return configuration.sliderVisible;\n })),\n this._navigator.stateService.currentState$.pipe(\n map(\n (frame: AnimationFrame): boolean => {\n return !(frame.state.currentImage == null ||\n frame.state.previousImage == null ||\n (isSpherical(\n frame.state.currentImage.cameraType) &&\n !isSpherical(\n frame.state.previousImage.cameraType)));\n }),\n distinctUntilChanged())).pipe(\n map(\n ([sliderVisible, enabledState]: [boolean, boolean]): boolean => {\n return sliderVisible && enabledState;\n }),\n distinctUntilChanged());\n\n this._waitSubscription = observableCombineLatest(\n mode$,\n motionless$,\n spherical$,\n sliderVisible$).pipe(\n withLatestFrom(this._navigator.stateService.state$))\n .subscribe(\n ([[mode, motionless, spherical, sliderVisible], state]:\n [[SliderConfigurationMode, boolean, boolean, boolean], State]): void => {\n const interactive: boolean = sliderVisible &&\n (motionless ||\n mode === SliderConfigurationMode.Stationary ||\n spherical);\n\n if (interactive && state !== State.WaitingInteractively) {\n this._navigator.stateService.waitInteractively();\n } else if (!interactive && state !== State.Waiting) {\n this._navigator.stateService.wait();\n }\n });\n\n subs.push(observableCombineLatest(\n position$,\n mode$,\n motionless$,\n spherical$,\n sliderVisible$)\n .subscribe(\n ([position, mode, motionless, spherical]: [number, SliderConfigurationMode, boolean, boolean, boolean]): void => {\n if (motionless || mode === SliderConfigurationMode.Stationary || spherical) {\n this._navigator.stateService.moveTo(1);\n } else {\n this._navigator.stateService.moveTo(position);\n }\n }));\n\n subs.push(observableCombineLatest(\n position$,\n mode$,\n motionless$,\n spherical$,\n sliderVisible$,\n this._container.renderService.size$).pipe(\n map(\n ([position, mode, motionless, spherical, sliderVisible]:\n [number, SliderConfigurationMode, boolean, boolean, boolean, ViewportSize]): VirtualNodeHash => {\n return {\n name: this._name,\n vNode: this._domRenderer.render(position, mode, motionless, spherical, sliderVisible),\n };\n }))\n .subscribe(this._container.domRenderer.render$));\n\n this._glRendererCreator$.next(null);\n\n subs.push(observableCombineLatest(\n position$,\n spherical$,\n sliderVisible$,\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentTransform$).pipe(\n map(\n ([position, spherical, visible, render, transform]: [number, boolean, boolean, RenderCamera, Transform]): number => {\n if (!spherical) {\n return visible ? position : 1;\n }\n\n const basicMin: number[] = this._viewportCoords.viewportToBasic(-1.15, 0, transform, render.perspective);\n const basicMax: number[] = this._viewportCoords.viewportToBasic(1.15, 0, transform, render.perspective);\n\n const shiftedMax: number = basicMax[0] < basicMin[0] ? basicMax[0] + 1 : basicMax[0];\n const basicPosition: number = basicMin[0] + position * (shiftedMax - basicMin[0]);\n\n return basicPosition > 1 ? basicPosition - 1 : basicPosition;\n }),\n map(\n (position: number): GLRendererOperation => {\n return (glRenderer: SliderGLRenderer): SliderGLRenderer => {\n glRenderer.updateCurtain(position);\n\n return glRenderer;\n };\n }))\n .subscribe(this._glRendererOperation$));\n\n subs.push(observableCombineLatest(\n this._navigator.stateService.currentState$,\n mode$).pipe(\n map(\n ([frame, mode]: [AnimationFrame, SliderConfigurationMode]): GLRendererOperation => {\n return (glRenderer: SliderGLRenderer): SliderGLRenderer => {\n glRenderer.update(frame, mode);\n\n return glRenderer;\n };\n }))\n .subscribe(this._glRendererOperation$));\n\n subs.push(this._configuration$.pipe(\n filter(\n (configuration: SliderConfiguration): boolean => {\n return configuration.ids != null;\n }),\n switchMap(\n (configuration: SliderConfiguration): Observable<SliderCombination> => {\n return observableZip(\n observableZip(\n this._catchCacheImage$(\n configuration.ids.background),\n this._catchCacheImage$(\n configuration.ids.foreground)).pipe(\n map(\n (images: [Image, Image])\n : SliderImages => {\n return { background: images[0], foreground: images[1] };\n })),\n this._navigator.stateService.currentState$.pipe(first())).pipe(\n map(\n (nf: [SliderImages, AnimationFrame]): SliderCombination => {\n return { images: nf[0], state: nf[1].state };\n }));\n }))\n .subscribe(\n (co: SliderCombination): void => {\n if (co.state.currentImage != null &&\n co.state.previousImage != null &&\n co.state.currentImage.id === co.images.foreground.id &&\n co.state.previousImage.id === co.images.background.id) {\n return;\n }\n\n if (co.state.currentImage.id === co.images.background.id) {\n this._navigator.stateService.setImages([co.images.foreground]);\n return;\n }\n\n if (co.state.currentImage.id === co.images.foreground.id &&\n co.state.trajectory.length === 1) {\n this._navigator.stateService.prependImages([co.images.background]);\n return;\n }\n\n this._navigator.stateService.setImages([co.images.background]);\n this._navigator.stateService.setImages([co.images.foreground]);\n },\n (e: Error): void => {\n console.error(e);\n }));\n\n\n const textureProvider$ =\n this._container.configurationService.imageTiling$.pipe(\n switchMap(\n (active): Observable<AnimationFrame> => {\n return active ?\n this._navigator.stateService.currentState$ :\n new Subject();\n }),\n distinctUntilChanged(\n undefined,\n (frame: AnimationFrame): string => {\n return frame.state.currentImage.id;\n }),\n withLatestFrom(\n this._container.glRenderer.webGLRenderer$,\n this._container.renderService.size$),\n map(\n ([frame, renderer, size]: [AnimationFrame, THREE.WebGLRenderer, ViewportSize]): TextureProvider => {\n const state: IAnimationState = frame.state;\n const viewportSize: number = Math.max(size.width, size.height);\n\n const currentImage: Image = state.currentImage;\n const currentTransform: Transform = state.currentTransform;\n const tileSize: number = viewportSize > 2048 ? 2048 : viewportSize > 1024 ? 1024 : 512;\n\n return new TextureProvider(\n currentImage.id,\n currentTransform.basicWidth,\n currentTransform.basicHeight,\n currentImage.image,\n this._imageTileLoader,\n new TileStore(),\n renderer);\n }),\n publishReplay(1),\n refCount());\n\n subs.push(textureProvider$.subscribe(() => { /*noop*/ }));\n\n subs.push(textureProvider$.pipe(\n map(\n (provider: TextureProvider): GLRendererOperation => {\n return (renderer: SliderGLRenderer): SliderGLRenderer => {\n renderer.setTextureProvider(provider.id, provider);\n\n return renderer;\n };\n }))\n .subscribe(this._glRendererOperation$));\n\n subs.push(textureProvider$.pipe(\n pairwise())\n .subscribe(\n (pair: [TextureProvider, TextureProvider]): void => {\n let previous: TextureProvider = pair[0];\n previous.abort();\n }));\n\n const roiTrigger$ =\n this._container.configurationService.imageTiling$.pipe(\n switchMap(\n (active): Observable<[RenderCamera, ViewportSize]> => {\n return active ?\n observableCombineLatest(\n this._container.renderService.renderCameraFrame$,\n this._container.renderService.size$.pipe(debounceTime(250))) :\n new Subject();\n }),\n map(\n ([camera, size]: [RenderCamera, ViewportSize]): PositionLookat => {\n return [\n camera.camera.position.clone(),\n camera.camera.lookat.clone(),\n camera.zoom.valueOf(),\n size.height.valueOf(),\n size.width.valueOf()];\n }),\n pairwise(),\n skipWhile(\n (pls: [PositionLookat, PositionLookat]): boolean => {\n return pls[1][2] - pls[0][2] < 0 || pls[1][2] === 0;\n }),\n map(\n (pls: [PositionLookat, PositionLookat]): boolean => {\n let samePosition: boolean = pls[0][0].equals(pls[1][0]);\n let sameLookat: boolean = pls[0][1].equals(pls[1][1]);\n let sameZoom: boolean = pls[0][2] === pls[1][2];\n let sameHeight: boolean = pls[0][3] === pls[1][3];\n let sameWidth: boolean = pls[0][4] === pls[1][4];\n\n return samePosition && sameLookat && sameZoom && sameHeight && sameWidth;\n }),\n distinctUntilChanged(),\n filter(\n (stalled: boolean): boolean => {\n return stalled;\n }),\n switchMap(\n (): Observable<RenderCamera> => {\n return this._container.renderService.renderCameraFrame$.pipe(\n first());\n }),\n withLatestFrom(\n this._container.renderService.size$,\n this._navigator.stateService.currentTransform$));\n\n subs.push(textureProvider$.pipe(\n switchMap(\n (provider: TextureProvider): Observable<[TileRegionOfInterest, TextureProvider]> => {\n return roiTrigger$.pipe(\n map(\n ([camera, size, transform]: [RenderCamera, ViewportSize, Transform]):\n [TileRegionOfInterest, TextureProvider] => {\n return [\n this._roiCalculator.computeRegionOfInterest(camera, size, transform),\n provider,\n ];\n }));\n }),\n filter(\n (args: [TileRegionOfInterest, TextureProvider]): boolean => {\n return !args[1].disposed;\n }))\n .subscribe(\n (args: [TileRegionOfInterest, TextureProvider]): void => {\n let roi: TileRegionOfInterest = args[0];\n let provider: TextureProvider = args[1];\n\n provider.setRegionOfInterest(roi);\n }));\n\n const hasTexture$ = textureProvider$.pipe(\n switchMap(\n (provider: TextureProvider): Observable<boolean> => {\n return provider.hasTexture$;\n }),\n startWith(false),\n publishReplay(1),\n refCount());\n\n subs.push(hasTexture$.subscribe(() => { /*noop*/ }));\n\n const textureProviderPrev$ =\n this._container.configurationService.imageTiling$.pipe(\n switchMap(\n (active): Observable<AnimationFrame> => {\n return active ?\n this._navigator.stateService.currentState$ :\n new Subject();\n }),\n filter(\n (frame: AnimationFrame): boolean => {\n return !!frame.state.previousImage;\n }),\n distinctUntilChanged(\n undefined,\n (frame: AnimationFrame): string => {\n return frame.state.previousImage.id;\n }),\n withLatestFrom(\n this._container.glRenderer.webGLRenderer$,\n this._container.renderService.size$),\n map(\n ([frame, renderer, size]: [AnimationFrame, THREE.WebGLRenderer, ViewportSize]): TextureProvider => {\n const state = frame.state;\n const previousImage = state.previousImage;\n const previousTransform = state.previousTransform;\n\n return new TextureProvider(\n previousImage.id,\n previousTransform.basicWidth,\n previousTransform.basicHeight,\n previousImage.image,\n this._imageTileLoader,\n new TileStore(),\n renderer);\n }),\n publishReplay(1),\n refCount());\n\n subs.push(textureProviderPrev$.subscribe(() => { /*noop*/ }));\n\n subs.push(textureProviderPrev$.pipe(\n map(\n (provider: TextureProvider): GLRendererOperation => {\n return (renderer: SliderGLRenderer): SliderGLRenderer => {\n renderer.setTextureProviderPrev(provider.id, provider);\n\n return renderer;\n };\n }))\n .subscribe(this._glRendererOperation$));\n\n subs.push(textureProviderPrev$.pipe(\n pairwise())\n .subscribe(\n (pair: [TextureProvider, TextureProvider]): void => {\n let previous: TextureProvider = pair[0];\n previous.abort();\n }));\n\n const roiTriggerPrev$ =\n this._container.configurationService.imageTiling$.pipe(\n switchMap(\n (active): Observable<[RenderCamera, ViewportSize]> => {\n return active ?\n observableCombineLatest(\n this._container.renderService.renderCameraFrame$,\n this._container.renderService.size$.pipe(debounceTime(250))) :\n new Subject();\n }),\n map(\n ([camera, size]: [RenderCamera, ViewportSize]): PositionLookat => {\n return [\n camera.camera.position.clone(),\n camera.camera.lookat.clone(),\n camera.zoom.valueOf(),\n size.height.valueOf(),\n size.width.valueOf()];\n }),\n pairwise(),\n skipWhile(\n (pls: [PositionLookat, PositionLookat]): boolean => {\n return pls[1][2] - pls[0][2] < 0 || pls[1][2] === 0;\n }),\n map(\n (pls: [PositionLookat, PositionLookat]): boolean => {\n let samePosition: boolean = pls[0][0].equals(pls[1][0]);\n let sameLookat: boolean = pls[0][1].equals(pls[1][1]);\n let sameZoom: boolean = pls[0][2] === pls[1][2];\n let sameHeight: boolean = pls[0][3] === pls[1][3];\n let sameWidth: boolean = pls[0][4] === pls[1][4];\n\n return samePosition && sameLookat && sameZoom && sameHeight && sameWidth;\n }),\n distinctUntilChanged(),\n filter(\n (stalled: boolean): boolean => {\n return stalled;\n }),\n switchMap(\n (): Observable<RenderCamera> => {\n return this._container.renderService.renderCameraFrame$.pipe(\n first());\n }),\n withLatestFrom(\n this._container.renderService.size$,\n this._navigator.stateService.currentTransform$));\n\n subs.push(textureProviderPrev$.pipe(\n switchMap(\n (provider: TextureProvider): Observable<[TileRegionOfInterest, TextureProvider]> => {\n return roiTriggerPrev$.pipe(\n map(\n ([camera, size, transform]: [RenderCamera, ViewportSize, Transform]):\n [TileRegionOfInterest, TextureProvider] => {\n return [\n this._roiCalculator.computeRegionOfInterest(camera, size, transform),\n provider,\n ];\n }));\n }),\n filter(\n (args: [TileRegionOfInterest, TextureProvider]): boolean => {\n return !args[1].disposed;\n }),\n withLatestFrom(this._navigator.stateService.currentState$))\n .subscribe(\n ([[roi, provider], frame]: [[TileRegionOfInterest, TextureProvider], AnimationFrame]): void => {\n let shiftedRoi: TileRegionOfInterest = null;\n\n if (isSpherical(frame.state.previousImage.cameraType)) {\n if (isSpherical(frame.state.currentImage.cameraType)) {\n const currentViewingDirection: THREE.Vector3 =\n this._spatial.viewingDirection(frame.state.currentImage.rotation);\n const previousViewingDirection: THREE.Vector3 =\n this._spatial.viewingDirection(frame.state.previousImage.rotation);\n\n const directionDiff: number = this._spatial.angleBetweenVector2(\n currentViewingDirection.x,\n currentViewingDirection.y,\n previousViewingDirection.x,\n previousViewingDirection.y);\n\n const shift: number = directionDiff / (2 * Math.PI);\n\n const bbox: TileBoundingBox = {\n maxX: this._spatial.wrap(roi.bbox.maxX + shift, 0, 1),\n maxY: roi.bbox.maxY,\n minX: this._spatial.wrap(roi.bbox.minX + shift, 0, 1),\n minY: roi.bbox.minY,\n };\n\n shiftedRoi = {\n bbox: bbox,\n pixelHeight: roi.pixelHeight,\n pixelWidth: roi.pixelWidth,\n };\n } else {\n const currentViewingDirection: THREE.Vector3 =\n this._spatial.viewingDirection(frame.state.currentImage.rotation);\n const previousViewingDirection: THREE.Vector3 =\n this._spatial.viewingDirection(frame.state.previousImage.rotation);\n\n const directionDiff: number = this._spatial.angleBetweenVector2(\n currentViewingDirection.x,\n currentViewingDirection.y,\n previousViewingDirection.x,\n previousViewingDirection.y);\n\n const shiftX: number = directionDiff / (2 * Math.PI);\n\n const a1: number = this._spatial.angleToPlane(currentViewingDirection.toArray(), [0, 0, 1]);\n const a2: number = this._spatial.angleToPlane(previousViewingDirection.toArray(), [0, 0, 1]);\n\n const shiftY: number = (a2 - a1) / (2 * Math.PI);\n\n const currentTransform: Transform = frame.state.currentTransform;\n const size: number = Math.max(currentTransform.basicWidth, currentTransform.basicHeight);\n const hFov: number = size > 0 ?\n 2 * Math.atan(0.5 * currentTransform.basicWidth / (size * currentTransform.focal)) :\n Math.PI / 3;\n const vFov: number = size > 0 ?\n 2 * Math.atan(0.5 * currentTransform.basicHeight / (size * currentTransform.focal)) :\n Math.PI / 3;\n\n const spanningWidth: number = hFov / (2 * Math.PI);\n const spanningHeight: number = vFov / Math.PI;\n\n const basicWidth: number = (roi.bbox.maxX - roi.bbox.minX) * spanningWidth;\n const basicHeight: number = (roi.bbox.maxY - roi.bbox.minY) * spanningHeight;\n\n const pixelWidth: number = roi.pixelWidth * spanningWidth;\n const pixelHeight: number = roi.pixelHeight * spanningHeight;\n\n const zoomShiftX: number = (roi.bbox.minX + roi.bbox.maxX) / 2 - 0.5;\n const zoomShiftY: number = (roi.bbox.minY + roi.bbox.maxY) / 2 - 0.5;\n\n const minX: number = 0.5 + shiftX + spanningWidth * zoomShiftX - basicWidth / 2;\n const maxX: number = 0.5 + shiftX + spanningWidth * zoomShiftX + basicWidth / 2;\n const minY: number = 0.5 + shiftY + spanningHeight * zoomShiftY - basicHeight / 2;\n const maxY: number = 0.5 + shiftY + spanningHeight * zoomShiftY + basicHeight / 2;\n\n const bbox: TileBoundingBox = {\n maxX: this._spatial.wrap(maxX, 0, 1),\n maxY: maxY,\n minX: this._spatial.wrap(minX, 0, 1),\n minY: minY,\n };\n\n shiftedRoi = {\n bbox: bbox,\n pixelHeight: pixelHeight,\n pixelWidth: pixelWidth,\n };\n }\n } else {\n const currentBasicAspect: number = frame.state.currentTransform.basicAspect;\n const previousBasicAspect: number = frame.state.previousTransform.basicAspect;\n\n const [[cornerMinX, cornerMinY], [cornerMaxX, cornerMaxY]]: number[][] =\n this._getBasicCorners(currentBasicAspect, previousBasicAspect);\n\n const basicWidth: number = cornerMaxX - cornerMinX;\n const basicHeight: number = cornerMaxY - cornerMinY;\n\n const pixelWidth: number = roi.pixelWidth / basicWidth;\n const pixelHeight: number = roi.pixelHeight / basicHeight;\n\n const minX: number = (basicWidth - 1) / (2 * basicWidth) + roi.bbox.minX / basicWidth;\n const maxX: number = (basicWidth - 1) / (2 * basicWidth) + roi.bbox.maxX / basicWidth;\n const minY: number = (basicHeight - 1) / (2 * basicHeight) + roi.bbox.minY / basicHeight;\n const maxY: number = (basicHeight - 1) / (2 * basicHeight) + roi.bbox.maxY / basicHeight;\n\n const bbox: TileBoundingBox = {\n maxX: maxX,\n maxY: maxY,\n minX: minX,\n minY: minY,\n };\n\n this._clipBoundingBox(bbox);\n\n shiftedRoi = {\n bbox: bbox,\n pixelHeight: pixelHeight,\n pixelWidth: pixelWidth,\n };\n }\n\n provider.setRegionOfInterest(shiftedRoi);\n }));\n\n const hasTexturePrev$ = textureProviderPrev$.pipe(\n switchMap(\n (provider: TextureProvider): Observable<boolean> => {\n return provider.hasTexture$;\n }),\n startWith(false),\n publishReplay(1),\n refCount());\n\n subs.push(hasTexturePrev$.subscribe(() => { /*noop*/ }));\n }\n\n protected _deactivate(): void {\n this._waitSubscription.unsubscribe();\n this._navigator.stateService.state$.pipe(\n first())\n .subscribe(\n (state: State): void => {\n if (state !== State.Traversing) {\n this._navigator.stateService.traverse();\n }\n });\n\n this._glRendererDisposer$.next(null);\n this._domRenderer.deactivate();\n this._subscriptions.unsubscribe();\n\n this.configure({ ids: null });\n }\n\n protected _getDefaultConfiguration(): SliderConfiguration {\n return {\n initialPosition: 1,\n mode: SliderConfigurationMode.Motion,\n sliderVisible: true,\n };\n }\n\n private _catchCacheImage$(imageId: string): Observable<Image> {\n return this._navigator.graphService.cacheImage$(imageId).pipe(\n catchError(\n (error: Error): Observable<Image> => {\n console.error(`Failed to cache slider image (${imageId})`, error);\n\n return observableEmpty();\n }));\n }\n\n private _getBasicCorners(currentAspect: number, previousAspect: number): number[][] {\n let offsetX: number;\n let offsetY: number;\n\n if (currentAspect > previousAspect) {\n offsetX = 0.5;\n offsetY = 0.5 * currentAspect / previousAspect;\n } else {\n offsetX = 0.5 * previousAspect / currentAspect;\n offsetY = 0.5;\n }\n\n return [[0.5 - offsetX, 0.5 - offsetY], [0.5 + offsetX, 0.5 + offsetY]];\n }\n\n private _clipBoundingBox(bbox: TileBoundingBox): void {\n bbox.minX = Math.max(0, Math.min(1, bbox.minX));\n bbox.maxX = Math.max(0, Math.min(1, bbox.maxX));\n bbox.minY = Math.max(0, Math.min(1, bbox.minY));\n bbox.maxY = Math.max(0, Math.min(1, bbox.maxY));\n }\n}\n","import {\n combineLatest as observableCombineLatest,\n empty as observableEmpty,\n from as observableFrom,\n of as observableOf,\n zip as observableZip,\n Observable,\n Subject,\n Subscription,\n} from \"rxjs\";\n\nimport {\n bufferCount,\n catchError,\n distinctUntilChanged,\n filter,\n first,\n map,\n mergeMap,\n publishReplay,\n refCount,\n retry,\n scan,\n startWith,\n switchMap,\n timeout,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { GraphMode } from \"../graph/GraphMode\";\nimport { GraphService } from \"../graph/GraphService\";\nimport { Image } from '../graph/Image';\nimport { Sequence } from \"../graph/Sequence\";\nimport { NavigationDirection } from \"../graph/edge/NavigationDirection\";\nimport { NavigationEdgeStatus } from \"../graph/interfaces/NavigationEdgeStatus\";\nimport { State } from \"../state/State\";\nimport { StateService } from \"../state/StateService\";\nimport { IAnimationState } from \"../state/interfaces/IAnimationState\";\nimport { AnimationFrame } from \"../state/interfaces/AnimationFrame\";\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\n\nexport class PlayService {\n public static readonly sequenceSpeed: number = 0.54;\n\n private _graphService: GraphService;\n private _stateService: StateService;\n\n private _imagesAhead: number;\n private _playing: boolean;\n private _speed: number;\n\n private _direction$: Observable<NavigationDirection>;\n private _directionSubject$: Subject<NavigationDirection>;\n private _playing$: Observable<boolean>;\n private _playingSubject$: Subject<boolean>;\n private _speed$: Observable<number>;\n private _speedSubject$: Subject<number>;\n\n private _playingSubscription: Subscription;\n private _cacheSubscription: Subscription;\n private _clearSubscription: Subscription;\n private _earthSubscription: Subscription;\n private _graphModeSubscription: Subscription;\n private _stopSubscription: Subscription;\n private _subscriptions: SubscriptionHolder = new SubscriptionHolder();\n\n private _bridging$: Observable<Image>;\n\n constructor(graphService: GraphService, stateService: StateService) {\n this._graphService = graphService;\n this._stateService = stateService;\n\n const subs = this._subscriptions;\n\n this._directionSubject$ = new Subject<NavigationDirection>();\n this._direction$ = this._directionSubject$.pipe(\n startWith(NavigationDirection.Next),\n publishReplay(1),\n refCount());\n\n subs.push(this._direction$.subscribe());\n\n this._playing = false;\n this._playingSubject$ = new Subject<boolean>();\n this._playing$ = this._playingSubject$.pipe(\n startWith(this._playing),\n publishReplay(1),\n refCount());\n\n subs.push(this._playing$.subscribe());\n\n this._speed = 0.5;\n this._speedSubject$ = new Subject<number>();\n this._speed$ = this._speedSubject$.pipe(\n startWith(this._speed),\n publishReplay(1),\n refCount());\n\n subs.push(this._speed$.subscribe());\n\n this._imagesAhead = this._mapImagesAhead(this._mapSpeed(this._speed));\n\n this._bridging$ = null;\n }\n\n public get playing(): boolean {\n return this._playing;\n }\n\n public get direction$(): Observable<NavigationDirection> {\n return this._direction$;\n }\n\n public get playing$(): Observable<boolean> {\n return this._playing$;\n }\n\n public get speed$(): Observable<number> {\n return this._speed$;\n }\n\n public play(): void {\n if (this._playing) {\n return;\n }\n\n this._stateService.cutImages();\n const stateSpeed: number = this._setSpeed(this._speed);\n this._stateService.setSpeed(stateSpeed);\n\n this._graphModeSubscription = this._speed$.pipe(\n map(\n (speed: number): GraphMode => {\n return speed > PlayService.sequenceSpeed ? GraphMode.Sequence : GraphMode.Spatial;\n }),\n distinctUntilChanged())\n .subscribe(\n (mode: GraphMode): void => {\n this._graphService.setGraphMode(mode);\n });\n\n this._cacheSubscription = observableCombineLatest(\n this._stateService.currentImage$.pipe(\n map(\n (image: Image): [string, string] => {\n return [image.sequenceId, image.id];\n }),\n distinctUntilChanged(\n undefined,\n ([sequenceId]: [string, string]): string => {\n return sequenceId;\n })),\n this._graphService.graphMode$,\n this._direction$).pipe(\n switchMap(\n ([[sequenceId, imageId], mode, direction]: [[string, string], GraphMode, NavigationDirection]):\n Observable<[Sequence, NavigationDirection]> => {\n\n if (direction !== NavigationDirection.Next && direction !== NavigationDirection.Prev) {\n return observableOf<[Sequence, NavigationDirection]>([undefined, direction]);\n }\n\n const sequence$: Observable<Sequence> = (mode === GraphMode.Sequence ?\n this._graphService.cacheSequenceImages$(sequenceId, imageId) :\n this._graphService.cacheSequence$(sequenceId)).pipe(\n retry(3),\n catchError(\n (error: Error): Observable<Sequence> => {\n console.error(error);\n\n return observableOf(undefined);\n }));\n\n return observableCombineLatest(\n sequence$,\n observableOf(direction));\n }),\n switchMap(\n ([sequence, direction]: [Sequence, NavigationDirection]): Observable<string> => {\n if (sequence === undefined) {\n return observableEmpty();\n }\n\n const imageIds: string[] = sequence.imageIds.slice();\n if (direction === NavigationDirection.Prev) {\n imageIds.reverse();\n }\n\n return this._stateService.currentState$.pipe(\n map(\n (frame: AnimationFrame): [string, number] => {\n return [frame.state.trajectory[frame.state.trajectory.length - 1].id, frame.state.imagesAhead];\n }),\n scan(\n (\n [lastRequestKey, previousRequestKeys]: [string, string[]],\n [lastTrajectoryKey, imagesAhead]: [string, number]):\n [string, string[]] => {\n\n if (lastRequestKey === undefined) {\n lastRequestKey = lastTrajectoryKey;\n }\n\n const lastIndex: number = imageIds.length - 1;\n if (imagesAhead >= this._imagesAhead || imageIds[lastIndex] === lastRequestKey) {\n return [lastRequestKey, []];\n }\n\n const current: number = imageIds.indexOf(lastTrajectoryKey);\n const start: number = imageIds.indexOf(lastRequestKey) + 1;\n const end: number = Math.min(lastIndex, current + this._imagesAhead - imagesAhead) + 1;\n\n if (end <= start) {\n return [lastRequestKey, []];\n }\n\n return [imageIds[end - 1], imageIds.slice(start, end)];\n },\n [undefined, []]),\n mergeMap(\n ([lastRequestKey, newRequestKeys]: [string, string[]]): Observable<string> => {\n return observableFrom(newRequestKeys);\n }));\n }),\n mergeMap(\n (key: string): Observable<Image> => {\n return this._graphService.cacheImage$(key).pipe(\n catchError(\n (): Observable<Image> => {\n return observableEmpty();\n }));\n },\n 6))\n .subscribe();\n\n this._playingSubscription = this._stateService.currentState$.pipe(\n filter(\n (frame: AnimationFrame): boolean => {\n return frame.state.imagesAhead < this._imagesAhead;\n }),\n distinctUntilChanged(\n undefined,\n (frame: AnimationFrame): string => {\n return frame.state.lastImage.id;\n }),\n map(\n (frame: AnimationFrame): [Image, boolean] => {\n const lastImage: Image = frame.state.lastImage;\n const trajectory: Image[] = frame.state.trajectory;\n let increasingTime: boolean = undefined;\n\n for (let i: number = trajectory.length - 2; i >= 0; i--) {\n const image: Image = trajectory[i];\n if (image.sequenceId !== lastImage.sequenceId) {\n break;\n }\n\n if (image.capturedAt !== lastImage.capturedAt) {\n increasingTime = image.capturedAt < lastImage.capturedAt;\n break;\n }\n }\n\n return [frame.state.lastImage, increasingTime];\n }),\n withLatestFrom(this._direction$),\n switchMap(\n ([[image, increasingTime], direction]: [[Image, boolean], NavigationDirection]): Observable<Image> => {\n return observableZip(\n ([NavigationDirection.Next, NavigationDirection.Prev].indexOf(direction) > -1 ?\n image.sequenceEdges$ :\n image.spatialEdges$).pipe(\n first(\n (status: NavigationEdgeStatus): boolean => {\n return status.cached;\n }),\n timeout(15000)),\n observableOf<NavigationDirection>(direction)).pipe(\n map(\n ([s, d]: [NavigationEdgeStatus, NavigationDirection]): string => {\n for (let edge of s.edges) {\n if (edge.data.direction === d) {\n return edge.target;\n }\n }\n\n return null;\n }),\n switchMap(\n (key: string): Observable<Image> => {\n return key != null ?\n this._graphService.cacheImage$(key) :\n observableEmpty();\n }));\n }))\n .subscribe(\n (image: Image): void => {\n this._stateService.appendImagess([image]);\n },\n (error: Error): void => {\n console.error(error);\n this.stop();\n });\n\n this._clearSubscription = this._stateService.currentImage$.pipe(\n bufferCount(1, 10))\n .subscribe(\n (images: Image[]): void => {\n this._stateService.clearPriorImages();\n });\n\n this._setPlaying(true);\n\n const currentLastImages$: Observable<Image> = this._stateService.currentState$.pipe(\n map(\n (frame: AnimationFrame): IAnimationState => {\n return frame.state;\n }),\n distinctUntilChanged(\n ([kc1, kl1]: [string, string], [kc2, kl2]: [string, string]): boolean => {\n return kc1 === kc2 && kl1 === kl2;\n },\n (state: IAnimationState): [string, string] => {\n return [state.currentImage.id, state.lastImage.id];\n }),\n filter(\n (state: IAnimationState): boolean => {\n return state.currentImage.id === state.lastImage.id &&\n state.currentIndex === state.trajectory.length - 1;\n }),\n map(\n (state: IAnimationState): Image => {\n return state.currentImage;\n }));\n\n this._stopSubscription = observableCombineLatest(\n currentLastImages$,\n this._direction$).pipe(\n switchMap(\n ([image, direction]: [Image, NavigationDirection]): Observable<boolean> => {\n const edgeStatus$: Observable<NavigationEdgeStatus> = (\n [NavigationDirection.Next, NavigationDirection.Prev].indexOf(direction) > -1 ?\n image.sequenceEdges$ :\n image.spatialEdges$).pipe(\n first(\n (status: NavigationEdgeStatus): boolean => {\n return status.cached;\n }),\n timeout(15000),\n catchError(\n (error: Error): Observable<NavigationEdgeStatus> => {\n console.error(error);\n\n return observableOf<NavigationEdgeStatus>({ cached: false, edges: [] });\n }));\n\n return observableCombineLatest(\n observableOf(direction),\n edgeStatus$).pipe(\n map(\n ([d, es]: [NavigationDirection, NavigationEdgeStatus]): boolean => {\n for (const edge of es.edges) {\n if (edge.data.direction === d) {\n return true;\n }\n }\n\n return false;\n }));\n }),\n mergeMap(\n (hasEdge: boolean): Observable<boolean> => {\n if (hasEdge || !this._bridging$) {\n return observableOf(hasEdge);\n }\n\n return this._bridging$.pipe(\n map(\n (image: Image): boolean => {\n return image != null;\n }),\n catchError(\n (error: Error): Observable<boolean> => {\n console.error(error);\n\n return observableOf<boolean>(false);\n }));\n }),\n first(\n (hasEdge: boolean): boolean => {\n return !hasEdge;\n }))\n .subscribe(\n undefined,\n undefined,\n (): void => { this.stop(); });\n\n if (this._stopSubscription.closed) {\n this._stopSubscription = null;\n }\n\n this._earthSubscription = this._stateService.state$\n .pipe(\n map(\n (state: State): boolean => {\n return state === State.Earth;\n }),\n distinctUntilChanged(),\n first(\n (earth: boolean): boolean => {\n return earth;\n }))\n .subscribe(\n undefined,\n undefined,\n (): void => { this.stop(); });\n\n if (this._earthSubscription.closed) {\n this._earthSubscription = null;\n }\n }\n\n public dispose(): void {\n this.stop();\n this._subscriptions.unsubscribe();\n }\n\n public setDirection(direction: NavigationDirection): void {\n this._directionSubject$.next(direction);\n }\n\n public setSpeed(speed: number): void {\n speed = Math.max(0, Math.min(1, speed));\n if (speed === this._speed) {\n return;\n }\n\n const stateSpeed: number = this._setSpeed(speed);\n\n if (this._playing) {\n this._stateService.setSpeed(stateSpeed);\n }\n\n this._speedSubject$.next(this._speed);\n }\n\n public stop(): void {\n if (!this._playing) {\n return;\n }\n\n if (!!this._stopSubscription) {\n if (!this._stopSubscription.closed) {\n this._stopSubscription.unsubscribe();\n }\n\n this._stopSubscription = null;\n }\n\n if (!!this._earthSubscription) {\n if (!this._earthSubscription.closed) {\n this._earthSubscription.unsubscribe();\n }\n\n this._earthSubscription = null;\n }\n\n this._graphModeSubscription.unsubscribe();\n this._graphModeSubscription = null;\n\n this._cacheSubscription.unsubscribe();\n this._cacheSubscription = null;\n\n this._playingSubscription.unsubscribe();\n this._playingSubscription = null;\n\n this._clearSubscription.unsubscribe();\n this._clearSubscription = null;\n\n this._stateService.setSpeed(1);\n this._stateService.cutImages();\n this._graphService.setGraphMode(GraphMode.Spatial);\n\n this._setPlaying(false);\n }\n\n private _mapSpeed(speed: number): number {\n const x: number = 2 * speed - 1;\n\n return Math.pow(10, x) - 0.2 * x;\n }\n\n private _mapImagesAhead(stateSpeed: number): number {\n return Math.round(Math.max(10, Math.min(50, 8 + 6 * stateSpeed)));\n }\n\n private _setPlaying(playing: boolean): void {\n this._playing = playing;\n this._playingSubject$.next(playing);\n }\n\n private _setSpeed(speed: number): number {\n this._speed = speed;\n const stateSpeed: number = this._mapSpeed(this._speed);\n this._imagesAhead = this._mapImagesAhead(stateSpeed);\n\n return stateSpeed;\n }\n}\n","export enum CameraVisualizationMode {\n /**\n * Cameras are hidden.\n */\n Hidden,\n\n /**\n * Cameras are shown, all with the same color.\n */\n Homogeneous,\n\n /**\n * Cameras are shown with colors based on the\n * their clusters.\n */\n Cluster,\n\n /**\n * Cameras are shown with colors based on the\n * their connected components.\n */\n ConnectedComponent,\n\n /**\n * Cameras are shown, with colors based on the\n * their sequence.\n */\n Sequence,\n}\n","export enum OriginalPositionMode {\n /**\n * Original positions are hidden.\n */\n Hidden,\n\n /**\n * Visualize original positions with altitude change.\n */\n Altitude,\n\n /**\n * Visualize original positions without altitude change,\n * i.e. as flat lines from the camera origin.\n */\n Flat,\n}\n","import {\n BufferAttribute,\n Color,\n Points,\n PointsMaterial,\n} from \"three\";\nimport { ClusterContract } from \"../../../api/contracts/ClusterContract\";\n\nexport interface ClusterPointsParameters {\n cluster: ClusterContract;\n color: string;\n originalSize: number;\n scale: number;\n translation: number[];\n}\n\nexport class ClusterPoints extends Points {\n public readonly material: PointsMaterial;\n\n private readonly _originalSize: number;\n\n constructor(parameters: ClusterPointsParameters) {\n super();\n\n this._originalSize = parameters.originalSize;\n\n const { cluster, color, scale, translation } = parameters;\n\n this._makeAttributes(cluster);\n this.material.size = scale * this._originalSize;\n this.setColor(color);\n\n this.matrixAutoUpdate = false;\n this.position.fromArray(translation);\n this.updateMatrix();\n this.updateMatrixWorld(false);\n }\n\n public dispose(): void {\n this.geometry.dispose();\n this.material.dispose();\n }\n\n public setColor(color?: string): void {\n this.material.vertexColors = color == null;\n this.material.color = new Color(color);\n this.material.needsUpdate = true;\n }\n\n public resize(scale: number): void {\n this.material.size = scale * this._originalSize;\n this.material.needsUpdate = true;\n }\n\n private _makeAttributes(cluster: ClusterContract): void {\n const positions: number[] = [];\n const colors: number[] = [];\n\n const points = cluster.points;\n for (const pointId in points) {\n if (!points.hasOwnProperty(pointId)) {\n continue;\n }\n\n const point = points[pointId];\n positions.push(...point.coordinates);\n\n const color = point.color;\n colors.push(color[0]);\n colors.push(color[1]);\n colors.push(color[2]);\n }\n\n const geometry = this.geometry;\n geometry.setAttribute(\n \"position\",\n new BufferAttribute(new Float32Array(positions), 3));\n geometry.setAttribute(\n \"color\",\n new BufferAttribute(new Float32Array(colors), 3));\n }\n}\n","import {\n BufferAttribute,\n Line,\n LineBasicMaterial,\n} from \"three\";\n\nexport class CellLine extends Line {\n public readonly material: LineBasicMaterial;\n\n constructor(vertices: number[][]) {\n super();\n\n this._makeAttributes(vertices);\n\n this.matrixAutoUpdate = false;\n this.updateMatrix();\n this.updateMatrixWorld(false);\n }\n\n public dispose(): void {\n this.geometry.dispose();\n this.material.dispose();\n }\n\n private _makeAttributes(vertices: number[][]): void {\n const closedPolygon = vertices.slice()\n closedPolygon.push(vertices[0]);\n\n let index = 0;\n const positions = new Float32Array(3 * (vertices.length + 1));\n for (const vertex of closedPolygon) {\n positions[index++] = vertex[0];\n positions[index++] = vertex[1];\n positions[index++] = vertex[2];\n }\n\n this.geometry.setAttribute(\n \"position\",\n new BufferAttribute(positions, 3));\n }\n}\n","// Level 0: 1 x 1 x 1 meter cubes\nexport const OCTREE_ROOT_LEVEL = 14; // 16384 meters\nexport const OCTREE_LEAF_LEVEL = 6; // 64 meters\n\nexport function isLeafLevel(level: number, leafLevel: number): boolean {\n return level === leafLevel;\n}\n\nexport function levelToSize(level: number): number {\n return 2 ** level;\n}\n\nexport interface OctreeBoundingBox {\n min: number[];\n max: number[];\n}\n\nexport function levelToRootBoundingBox(level: number): OctreeBoundingBox {\n const size = levelToSize(level);\n const half = size / 2;\n const min = [-half, -half, -half];\n const max = [half, half, half];\n return { min, max };\n}\n","import { Box3, Object3D, Ray, Vector3 } from \"three\";\nimport { isLeafLevel } from \"./SpatialOctreeMath\";\n\nexport class SpatialOctreeNode {\n public readonly children: SpatialOctreeNode[];\n public readonly items: Object3D[];\n\n constructor(\n public readonly level: number,\n public readonly leafLevel: number,\n public readonly boundingBox: Box3,\n public parent?: SpatialOctreeNode) {\n this.children = [];\n this.items = [];\n if (parent) {\n parent.children.push(this);\n }\n }\n\n public get isEmpty(): boolean {\n return !(this.children.length || this.items.length);\n }\n\n public add(object: Object3D): SpatialOctreeNode {\n const self = this;\n if (!self.boundingBox.containsPoint(object.position)) {\n throw new Error(`Item not contained in node`);\n }\n if (isLeafLevel(self.level, self.leafLevel)) {\n self.items.push(object);\n return this;\n }\n for (const child of self.children) {\n if (child.boundingBox.containsPoint(object.position)) {\n return child.add(object);\n }\n }\n for (const boundingBox of self._generateBoundingBoxes()) {\n if (boundingBox.containsPoint(object.position)) {\n const child = new SpatialOctreeNode(\n self.level - 1,\n self.leafLevel,\n boundingBox,\n self);\n return child.add(object);\n }\n }\n throw new Error(`Item not contained in children`);\n }\n\n public intersect(\n ray: Ray,\n target: Vector3,\n nodes: SpatialOctreeNode[])\n : void {\n\n if (!ray.intersectBox(this.boundingBox, target)) {\n return;\n }\n if (isLeafLevel(this.level, this.leafLevel)) {\n nodes.push(this);\n return;\n }\n for (const child of this.children) {\n child.intersect(ray, target, nodes);\n }\n }\n\n public remove(object: Object3D): void {\n const index = this.items.indexOf(object);\n if (index < 0) {\n throw new Error(`Item does not exist ${object.uuid}`);\n }\n this.items.splice(index, 1);\n }\n\n public traverse(): void {\n const self = this;\n if (!self.isEmpty) {\n return;\n }\n const parent = self.parent;\n if (!parent) {\n return;\n }\n\n const index = parent.children.indexOf(self);\n if (index < 0) {\n throw new Error(`Corrupt octree`);\n }\n parent.children.splice(index, 1);\n this.parent = null;\n parent.traverse();\n }\n\n private _generateBoundingBoxes(): Box3[] {\n const self = this;\n const min = self.boundingBox.min;\n const max = self.boundingBox.max;\n const size = (max.x - min.x) / 2;\n const mins = [\n [min.x, min.y + size, min.z + size],\n [min.x + size, min.y + size, min.z + size],\n [min.x, min.y, min.z + size],\n [min.x + size, min.y, min.z + size],\n [min.x, min.y + size, min.z],\n [min.x + size, min.y + size, min.z],\n [min.x, min.y, min.z],\n [min.x + size, min.y, min.z],\n ];\n const boundingBoxes: Box3[] = []\n for (const [minX, minY, minZ] of mins) {\n boundingBoxes.push(\n new Box3(\n new Vector3(minX, minY, minZ),\n new Vector3(minX + size, minY + size, minZ + size)));\n }\n return boundingBoxes;\n }\n}\n","import { Box3, Object3D, Ray, Vector3 } from \"three\";\nimport { levelToRootBoundingBox } from \"./SpatialOctreeMath\";\nimport { SpatialOctreeNode } from \"./SpatialOctreeNode\";\n\nexport class SpatialOctree {\n private _index: Map<string, SpatialOctreeNode>;\n private _root: SpatialOctreeNode;\n\n constructor(\n public readonly rootLevel: number,\n public readonly leafLevel: number) {\n if (leafLevel > rootLevel) {\n throw new Error()\n }\n this._index = new Map();\n this._root = this._makeRoot();\n }\n\n public get root(): SpatialOctreeNode {\n return this._root;\n }\n\n public add(object: Object3D): void {\n if (!this.root.boundingBox.containsPoint(object.position)) {\n console.warn(`Object outside bounding box ${object.uuid}`);\n return;\n }\n const leaf = this._root.add(object);\n this._index.set(object.uuid, leaf);\n }\n\n public has(object: Object3D): boolean {\n return this._index.has(object.uuid);\n }\n\n public intersect(ray: Ray): Object3D[] {\n const leaves: SpatialOctreeNode[] = [];\n const target = new Vector3();\n this._root.intersect(ray, target, leaves);\n\n return leaves\n .map(leaf => leaf.items)\n .reduce(\n (acc, items): Object3D[] => {\n acc.push(...items);\n return acc;\n },\n []);\n }\n\n public reset(): void {\n this._root = this._makeRoot();\n this._index.clear();\n }\n\n public remove(object: Object3D): void {\n if (!this.has(object)) {\n throw new Error(`Frame does not exist ${object.uuid}`);\n }\n const leaf = this._index.get(object.uuid);\n leaf.remove(object);\n leaf.traverse();\n this._index.delete(object.uuid);\n }\n\n private _makeRoot(): SpatialOctreeNode {\n const level = this.rootLevel;\n const bbox = levelToRootBoundingBox(level);\n const box = new Box3(\n new Vector3().fromArray(bbox.min),\n new Vector3().fromArray(bbox.max));\n return new SpatialOctreeNode(level, this.leafLevel, box);\n }\n}\n","import {\n Camera,\n Object3D,\n Raycaster,\n Vector2,\n} from \"three\";\nimport { SpatialOctree } from \"./SpatialOctree\";\nimport { OCTREE_LEAF_LEVEL, OCTREE_ROOT_LEVEL } from \"./SpatialOctreeMath\";\n\nexport class SpatialIntersection {\n private readonly _interactiveLayer: number;\n private readonly _objects: Object3D[];\n private readonly _objectImageMap: Map<string, string>;\n private readonly _octree: SpatialOctree;\n private readonly _raycaster: Raycaster;\n\n private readonly _lineThreshold: number;\n private readonly _largeLineThreshold: number;\n\n constructor(\n octree?: SpatialOctree,\n raycaster?: Raycaster) {\n\n this._objects = [];\n this._objectImageMap = new Map();\n this._octree = octree ?? new SpatialOctree(\n OCTREE_ROOT_LEVEL,\n OCTREE_LEAF_LEVEL);\n this._raycaster = raycaster ?? new Raycaster();\n\n this._interactiveLayer = 1;\n this._raycaster = !!raycaster ?\n raycaster :\n new Raycaster(\n undefined,\n undefined,\n 1,\n 10000);\n\n this._lineThreshold = 0.2;\n this._largeLineThreshold = 0.4;\n\n this._raycaster.params.Line.threshold = this._lineThreshold;\n this._raycaster.layers.set(this._interactiveLayer);\n }\n\n get interactiveLayer(): number { return this._interactiveLayer; }\n get octree(): SpatialOctree { return this._octree; }\n get raycaster(): Raycaster { return this._raycaster; }\n\n public add(\n object: Object3D,\n imageId: string): void {\n const uuid = object.uuid;\n this._objectImageMap.set(uuid, imageId);\n this._objects.push(object);\n this._octree.add(object);\n }\n\n public intersectObjects(\n viewport: number[],\n camera: Camera)\n : string {\n\n this._raycaster.setFromCamera(\n new Vector2().fromArray(viewport),\n camera);\n const objects = this._octree.intersect(this.raycaster.ray);\n const intersects =\n this._raycaster.intersectObjects(objects);\n\n const onMap = this._objectImageMap;\n for (const intersect of intersects) {\n const uuid = intersect.object.uuid;\n if (!onMap.has(uuid)) { continue; }\n return onMap.get(uuid);\n }\n return null;\n }\n\n public remove(object: Object3D): void {\n const objects = this._objects;\n const index = objects.indexOf(object);\n if (index !== -1) {\n const deleted = objects.splice(index, 1);\n for (const d of deleted) {\n this._objectImageMap.delete(d.uuid);\n }\n this._octree.remove(object)\n } else {\n console.warn(`Object does not exist`);\n }\n }\n\n public resetIntersectionThreshold(useLarge: boolean): void {\n this._raycaster.params.Line.threshold = useLarge ?\n this._largeLineThreshold :\n this._lineThreshold;\n }\n}\n","import {\n BufferAttribute,\n BufferGeometry,\n Line,\n LineBasicMaterial,\n} from \"three\";\nimport { Transform } from \"../../../geo/Transform\";\nimport { OriginalPositionMode } from \"../enums/OriginalPositionMode\";\n\nexport interface PositionLineParameters {\n mode: OriginalPositionMode;\n originalOrigin: number[];\n transform: Transform;\n material?: LineBasicMaterial;\n geometry?: BufferGeometry;\n}\n\nexport class PositionLine extends Line {\n public geometry: BufferGeometry;\n public material: LineBasicMaterial;\n\n private _relativeAltitude: number;\n\n constructor(parameters: PositionLineParameters) {\n super(parameters.geometry, parameters.material);\n\n const mode = parameters.mode;\n const originalOrigin = parameters.originalOrigin;\n const transform = parameters.transform;\n\n const origin = transform.unprojectBasic([0, 0], 0);\n this._relativeAltitude = originalOrigin[2] - origin[2];\n\n this._makeAttributes(origin, originalOrigin, mode);\n\n this.matrixAutoUpdate = false;\n this.position.fromArray(origin);\n this.updateMatrix();\n this.updateMatrixWorld(false);\n }\n\n public dispose(): void {\n this.geometry.dispose();\n this.material.dispose();\n }\n\n public setMode(mode: OriginalPositionMode): void {\n const positionAttribute =\n <BufferAttribute>this.geometry.attributes.position;\n const positions = <Float32Array>positionAttribute.array;\n\n positions[5] = this._modeToAltitude(mode);\n\n positionAttribute.needsUpdate = true;\n this.geometry.computeBoundingSphere();\n }\n\n private _makeAttributes(\n origin: number[],\n originalOrigin: number[],\n mode: OriginalPositionMode)\n : void {\n const positions = new Float32Array(6);\n positions[0] = 0;\n positions[1] = 0;\n positions[2] = 0;\n positions[3] = originalOrigin[0] - origin[0];\n positions[4] = originalOrigin[1] - origin[1];\n positions[5] = this._modeToAltitude(mode);\n\n const attribute = new BufferAttribute(positions, 3);\n this.geometry.setAttribute(\"position\", attribute);\n attribute.needsUpdate = true;\n\n this.geometry.computeBoundingSphere();\n }\n\n private _modeToAltitude(mode: OriginalPositionMode): number {\n return mode === OriginalPositionMode.Altitude ?\n this._relativeAltitude : 0;\n }\n}\n","import {\n BufferAttribute,\n BufferGeometry,\n Color,\n LineSegments,\n Material,\n} from \"three\";\nimport { Transform } from \"../../../geo/Transform\";\n\nexport interface CameraFrameParameters {\n color: string;\n geometry?: BufferGeometry;\n material?: Material;\n scale: number;\n size: number;\n transform: Transform;\n}\n\nexport abstract class CameraFrameBase extends LineSegments {\n public readonly material: Material;\n\n constructor(parameters: CameraFrameParameters) {\n super(parameters.geometry, parameters.material);\n\n const color = parameters.color;\n const size = parameters.size;\n const scale = parameters.scale;\n const transform = parameters.transform;\n\n const origin = transform.unprojectBasic([0, 0], 0);\n const positions = this._makePositions(size, transform, origin);\n\n this._makeAttributes(positions, color);\n\n this.geometry.computeBoundingSphere();\n this.geometry.computeBoundingBox();\n\n this.matrixAutoUpdate = false;\n this.position.fromArray(origin);\n this.scale.set(scale, scale, scale);\n this.updateMatrix();\n this.updateMatrixWorld(false);\n }\n\n public dispose(): void {\n this.geometry.dispose();\n this.material.dispose();\n }\n\n public setColor(color: string): CameraFrameBase {\n this._updateColorAttribute(color);\n return this;\n }\n\n public resize(scale: number): CameraFrameBase {\n this.scale.set(scale, scale, scale);\n this.updateMatrix();\n this.updateMatrixWorld(false);\n return this;\n }\n\n protected abstract _makePositions(\n size: number,\n transform: Transform,\n origin: number[])\n : number[];\n\n protected _makeAttributes(positions: number[], color: string): void {\n const geometry = this.geometry;\n\n const positionAttribute =\n new BufferAttribute(\n new Float32Array(positions), 3);\n geometry.setAttribute(\"position\", positionAttribute);\n positionAttribute.needsUpdate = true;\n\n const colorAttribute =\n new BufferAttribute(\n new Float32Array(positions.length), 3);\n geometry.setAttribute(\"color\", colorAttribute);\n this._updateColorAttribute(color);\n }\n\n protected _updateColorAttribute(color: string): void {\n const [r, g, b] = new Color(color).toArray();\n const colorAttribute =\n <BufferAttribute>this.geometry.attributes.color;\n const colors = <Float32Array>colorAttribute.array;\n const length = colors.length;\n\n let index = 0;\n for (let i = 0; i < length; i++) {\n colors[index++] = r;\n colors[index++] = g;\n colors[index++] = b;\n }\n colorAttribute.needsUpdate = true;\n }\n}\n","import { Transform } from \"../../../geo/Transform\";\nimport { CameraFrameBase } from \"./CameraFrameBase\";\n\nexport class SphericalCameraFrame extends CameraFrameBase {\n protected _makePositions(\n size: number,\n transform: Transform,\n origin: number[]): number[] {\n\n const vs = 10;\n const positions: number[] = [];\n positions.push(...this._makeAxis(size, transform, origin));\n positions.push(...this._makeLat(0.5, vs, size, transform, origin));\n for (const lat of [0, 0.25, 0.5, 0.75]) {\n positions\n .push(...this._makeLng(lat, vs, size, transform, origin));\n }\n return positions;\n }\n\n private _makeAxis(\n size: number,\n transform: Transform,\n origin: number[])\n : number[] {\n const south = transform.unprojectBasic([0.5, 1], 0.8 * size);\n const north = transform.unprojectBasic([0.5, 0], 1.2 * size);\n return [\n south[0] - origin[0],\n south[1] - origin[1],\n south[2] - origin[2],\n north[0] - origin[0],\n north[1] - origin[1],\n north[2] - origin[2],\n ];\n }\n\n private _makeLat(\n basicY: number,\n numVertices: number,\n size: number,\n transform: Transform,\n origin: number[])\n : number[] {\n\n const dist = 0.8 * size;\n const [originX, originY, originZ] = origin;\n const positions: number[] = [];\n const first = transform.unprojectBasic([0, basicY], dist);\n first[0] -= originX;\n first[1] -= originY;\n first[2] -= originZ;\n positions.push(...first);\n\n for (let i = 1; i <= numVertices; i++) {\n const position =\n transform.unprojectBasic(\n [i / numVertices, basicY], dist);\n position[0] -= originX;\n position[1] -= originY;\n position[2] -= originZ;\n positions.push(\n ...position,\n ...position);\n }\n positions.push(...first);\n return positions;\n }\n\n private _makeLng(\n basicX: number,\n numVertices: number,\n size: number,\n transform: Transform,\n origin: number[])\n : number[] {\n\n const dist = 0.8 * size;\n const [originX, originY, originZ] = origin;\n const positions: number[] = [];\n const first = transform.unprojectBasic([basicX, 0], dist);\n first[0] -= originX;\n first[1] -= originY;\n first[2] -= originZ;\n positions.push(...first);\n\n for (let i = 0; i <= numVertices; i++) {\n const position =\n transform.unprojectBasic(\n [basicX, i / numVertices], dist);\n position[0] -= originX;\n position[1] -= originY;\n position[2] -= originZ;\n positions.push(\n ...position,\n ...position);\n }\n positions.push(...first);\n return positions;\n }\n}\n","import { Transform } from \"../../../geo/Transform\";\nimport { CameraFrameBase } from \"./CameraFrameBase\";\n\nexport class PerspectiveCameraFrame extends CameraFrameBase {\n protected _makePositions(\n size: number,\n transform: Transform,\n origin: number[]): number[] {\n const samples = 8;\n const positions: number[] = [];\n positions.push(...this._makeDiags(size, transform, origin));\n positions.push(...this._makeFrame(size, samples, transform, origin));\n return positions;\n }\n\n private _makeDiags(\n size: number,\n transform: Transform,\n origin: number[])\n : number[] {\n\n const [originX, originY, originZ] = origin;\n\n const cameraCenter = [0, 0, 0];\n const positions: number[] = [];\n for (const vertex2d of [[0, 0], [1, 0], [1, 1], [0, 1]]) {\n const corner = transform.unprojectBasic(vertex2d, size);\n corner[0] -= originX;\n corner[1] -= originY;\n corner[2] -= originZ;\n positions.push(\n ...cameraCenter,\n ...corner);\n }\n return positions;\n }\n\n private _makeFrame(\n size: number,\n samples: number,\n transform: Transform,\n origin: number[])\n : number[] {\n\n const vertices2d: number[][] = [];\n vertices2d.push(...this._subsample([0, 1], [0, 0], samples));\n vertices2d.push(...this._subsample([0, 0], [1, 0], samples));\n vertices2d.push(...this._subsample([1, 0], [1, 1], samples));\n\n const [originX, originY, originZ] = origin;\n const positions: number[] = [];\n for (const vertex2d of vertices2d) {\n const position =\n transform.unprojectBasic(\n vertex2d, size);\n position[0] -= originX;\n position[1] -= originY;\n position[2] -= originZ;\n positions.push(...position);\n }\n return positions;\n }\n\n private _interpolate(a: number, b: number, alpha: number): number {\n return a + alpha * (b - a);\n }\n\n private _subsample(\n p1: number[],\n p2: number[],\n subsamples: number)\n : number[][] {\n if (subsamples < 1) {\n return [p1, p2];\n }\n\n const samples: number[][] = [];\n samples.push(p1);\n for (let i = 0; i <= subsamples; i++) {\n const p: number[] = [];\n for (let j = 0; j < 3; j++) {\n p.push(this._interpolate(p1[j], p2[j], i / (subsamples + 1)));\n }\n samples.push(p);\n samples.push(p);\n }\n samples.push(p2);\n\n return samples;\n }\n}\n","import { LngLatAlt } from \"../../api/interfaces/LngLatAlt\";\nimport { enuToGeodetic, geodeticToEnu } from \"../../geo/GeoCoords\";\n\nexport function resetEnu(reference: LngLatAlt, prevEnu: number[], prevReference: LngLatAlt): number[] {\n const [prevX, prevY, prevZ] = prevEnu;\n const [lng, lat, alt] = enuToGeodetic(\n prevX,\n prevY,\n prevZ,\n prevReference.lng,\n prevReference.lat,\n prevReference.alt);\n\n return geodeticToEnu(\n lng,\n lat,\n alt,\n reference.lng,\n reference.lat,\n reference.alt);\n}\n","import {\n LineBasicMaterial,\n Object3D,\n Scene,\n} from \"three\";\nimport { CameraFrameBase, CameraFrameParameters } from \"./CameraFrameBase\";\nimport { PositionLine, PositionLineParameters } from \"./PositionLine\";\nimport { SpatialIntersection } from \"./SpatialIntersection\";\nimport { Image } from \"../../../graph/Image\";\nimport { Transform } from \"../../../geo/Transform\";\nimport { OriginalPositionMode } from \"../enums/OriginalPositionMode\";\nimport { FilterFunction } from \"../../../graph/FilterCreator\";\nimport { CameraVisualizationMode } from \"../enums/CameraVisualizationMode\";\nimport { isSpherical } from \"../../../geo/Geo\";\nimport { SphericalCameraFrame } from \"./SphericalCameraFrame\";\nimport { PerspectiveCameraFrame } from \"./PerspectiveCameraFrame\";\nimport { LngLatAlt } from \"../../../api/interfaces/LngLatAlt\";\nimport { resetEnu } from \"../SpatialCommon\";\n\ntype ColorIdCamerasMap = Map<string, CameraFrameBase[]>;\n\ntype ImageIdMap = {\n ccId: string;\n clusterId: string;\n sequenceId: string;\n};\n\ntype ImageProps = {\n image: Image;\n idMap: ImageIdMap;\n};\n\ntype ImageVisualizationProps = {\n id: string;\n color: string;\n transform: Transform;\n originalPosition: number[];\n scale: number;\n maxSize: number;\n visible: boolean;\n positionMode: OriginalPositionMode;\n};\n\nexport class SpatialCell {\n public readonly cameras: Object3D;\n public readonly keys: string[];\n public clusterVisibles: { [key: string]: boolean; };\n\n private readonly _positions: Object3D;\n private readonly _positionLines: { [key: string]: PositionLine; };\n private readonly _cameraFrames: { [key: string]: CameraFrameBase; };\n private readonly _clusters: ColorIdCamerasMap;\n private readonly _connectedComponents: ColorIdCamerasMap;\n private readonly _sequences: ColorIdCamerasMap;\n private readonly _props: {\n [id: string]: {\n image: Image,\n ids: ImageIdMap,\n };\n };\n\n private _frameMaterial: LineBasicMaterial;\n private _positionMaterial: LineBasicMaterial;\n\n constructor(\n public readonly id: string,\n private _scene: Scene,\n private _intersection: SpatialIntersection) {\n\n this.cameras = new Object3D();\n this.keys = [];\n this._positionLines = {};\n this._positions = new Object3D();\n\n this._cameraFrames = {};\n this._clusters = new Map();\n this._connectedComponents = new Map();\n this._sequences = new Map();\n this._props = {};\n this.clusterVisibles = {};\n\n this._frameMaterial = new LineBasicMaterial({\n fog: false,\n vertexColors: true,\n });\n this._positionMaterial = new LineBasicMaterial({\n fog: false,\n color: 0xff0000,\n });\n\n this._scene.add(\n this.cameras,\n this._positions);\n }\n\n public addImage(props: ImageProps): void {\n const image = props.image;\n const id = image.id;\n if (this.hasImage(id)) { throw new Error(`Image exists ${id}`); }\n const ccId = props.idMap.ccId;\n if (!(this._connectedComponents.has(ccId))) {\n this._connectedComponents.set(ccId, []);\n }\n const cId = props.idMap.clusterId;\n if (!this._clusters.has(cId)) { this._clusters.set(cId, []); }\n const sId = props.idMap.sequenceId;\n if (!this._sequences.has(sId)) { this._sequences.set(sId, []); }\n this._props[id] = {\n image: image,\n ids: { ccId, clusterId: cId, sequenceId: sId },\n };\n this.keys.push(id);\n }\n\n public applyCameraColor(imageId: string, color: string): void {\n this._cameraFrames[imageId].setColor(color);\n }\n\n public applyCameraSize(size: number): void {\n for (const camera of this.cameras.children) {\n (<CameraFrameBase>camera).resize(size);\n }\n }\n\n public applyFilter(filter: FilterFunction): void {\n const clusterVisibles = this.clusterVisibles;\n for (const clusterId in clusterVisibles) {\n if (!clusterVisibles.hasOwnProperty(clusterId)) { continue; }\n clusterVisibles[clusterId] = false;\n }\n\n const cameraFrames = this._cameraFrames;\n const positionLines = this._positionLines;\n const interactiveLayer = this._intersection.interactiveLayer;\n for (const props of Object.values(this._props)) {\n const image = props.image;\n const visible = filter(image);\n const key = image.id;\n positionLines[key].visible = visible;\n const camera = cameraFrames[key];\n this._setCameraVisibility(camera, visible, interactiveLayer);\n clusterVisibles[props.ids.clusterId] ||= visible;\n }\n }\n\n public applyPositionMode(mode: OriginalPositionMode): void {\n this._positions.visible =\n mode !== OriginalPositionMode.Hidden;\n\n for (const position of this._positions.children) {\n (<PositionLine>position).setMode(mode);\n }\n }\n\n public dispose(): void {\n this._disposeCameras();\n this._disposePositions();\n this._scene = null;\n this._intersection = null;\n }\n\n public getCamerasByMode(\n mode: CameraVisualizationMode): ColorIdCamerasMap {\n if (mode === CameraVisualizationMode.Cluster) {\n return this._clusters;\n } else if (mode === CameraVisualizationMode.ConnectedComponent) {\n return this._connectedComponents;\n } else if (mode === CameraVisualizationMode.Sequence) {\n return this._sequences;\n }\n const cvm = CameraVisualizationMode;\n const defaultId = cvm[cvm.Homogeneous];\n const cameras = <ColorIdCamerasMap>new Map();\n cameras.set(defaultId, <CameraFrameBase[]>this.cameras.children);\n return cameras;\n }\n\n public getColorId(imageId: string, mode: CameraVisualizationMode): string {\n const props = this._props[imageId];\n const cvm = CameraVisualizationMode;\n switch (mode) {\n case cvm.Cluster:\n return props.ids.clusterId;\n case cvm.ConnectedComponent:\n return props.ids.ccId;\n case cvm.Sequence:\n return props.ids.sequenceId;\n default:\n return cvm[cvm.Homogeneous];\n }\n }\n\n public hasImage(key: string): boolean {\n return this.keys.indexOf(key) !== -1;\n }\n\n public resetReference(\n reference: LngLatAlt,\n prevReference: LngLatAlt)\n : void {\n const frames = this._cameraFrames;\n for (const frameId in frames) {\n if (!frames.hasOwnProperty(frameId)) {\n continue;\n }\n const frame = frames[frameId];\n frame.position.fromArray(resetEnu(\n reference,\n frame.position.toArray(),\n prevReference));\n }\n\n const lines = this._positionLines;\n for (const lineId in lines) {\n if (!lines.hasOwnProperty(lineId)) {\n continue;\n }\n const line = lines[lineId];\n line.position.fromArray(resetEnu(\n reference,\n line.position.toArray(),\n prevReference));\n }\n }\n\n public visualize(props: ImageVisualizationProps): void {\n const id = props.id;\n const visible = props.visible;\n const transform = props.transform;\n const cameraParameters: CameraFrameParameters = {\n color: props.color,\n material: this._frameMaterial,\n scale: props.scale,\n size: props.maxSize,\n transform,\n };\n const camera = isSpherical(transform.cameraType) ?\n new SphericalCameraFrame(cameraParameters) :\n new PerspectiveCameraFrame(cameraParameters);\n\n const interactiveLayer = this._intersection.interactiveLayer;\n this._setCameraVisibility(camera, visible, interactiveLayer);\n this.cameras.add(camera);\n this._cameraFrames[id] = camera;\n const intersection = this._intersection;\n intersection.add(camera, id);\n\n const ids = this._props[id].ids;\n this.clusterVisibles[ids.clusterId] ||= visible;\n this._connectedComponents.get(ids.ccId).push(camera);\n this._clusters.get(ids.clusterId).push(camera);\n this._sequences.get(ids.sequenceId).push(camera);\n\n const positionParameters: PositionLineParameters = {\n material: this._positionMaterial,\n mode: props.positionMode,\n originalOrigin: props.originalPosition,\n transform,\n };\n const position = new PositionLine(positionParameters);\n position.visible = visible;\n this._positions.add(position);\n this._positionLines[id] = position;\n }\n\n private _disposeCameras(): void {\n const intersection = this._intersection;\n const cameras = this.cameras;\n for (const camera of cameras.children.slice()) {\n (<CameraFrameBase>camera).dispose();\n intersection.remove(camera);\n cameras.remove(camera);\n }\n this._scene.remove(this.cameras);\n }\n\n private _disposePositions(): void {\n const positions = this._positions;\n for (const position of positions.children.slice()) {\n (<PositionLine>position).dispose();\n positions.remove(position);\n }\n this._scene.remove(this._positions);\n }\n\n private _setCameraVisibility(\n camera: Object3D,\n visible: boolean,\n layer: number): void {\n\n camera.visible = visible;\n if (visible) {\n camera.layers.enable(layer);\n } else {\n camera.layers.disable(layer);\n }\n }\n};\n","import { CameraVisualizationMode } from \"../enums/CameraVisualizationMode\";\n\nexport class SpatialAssets {\n private readonly _colors: Map<string, string>;\n\n constructor() {\n this._colors = new Map();\n const cvm = CameraVisualizationMode;\n this._colors.set(cvm[cvm.Homogeneous], \"#FFFFFF\");\n }\n\n public getColor(id: string): string {\n const colors = this._colors;\n if (!colors.has(id)) { colors.set(id, this._randomColor()); }\n return colors.get(id);\n }\n\n private _randomColor(): string {\n return `hsl(${Math.floor(360 * Math.random())}, 100%, 50%)`;\n }\n}\n","import { State } from \"../../state/State\";\nimport { CameraVisualizationMode } from \"./enums/CameraVisualizationMode\";\n\nexport function isModeVisible(mode: CameraVisualizationMode): boolean {\n return mode !== CameraVisualizationMode.Hidden;\n}\n\nexport function isOverviewState(state: State): boolean {\n return state === State.Custom || state === State.Earth;\n}\n","export enum PointVisualizationMode {\n /**\n * Points are hidden.\n */\n Hidden,\n\n /**\n * Visualize points with original colors.\n */\n Original,\n\n /**\n * Paint all points belonging to a specific\n * cluster with the same random color.\n */\n Cluster,\n}\n","import {\n Object3D,\n PerspectiveCamera,\n Scene,\n WebGLRenderer,\n} from \"three\";\nimport { ClusterContract }\n from \"../../api/contracts/ClusterContract\";\nimport { MapillaryError } from \"../../error/MapillaryError\";\nimport { Transform } from \"../../geo/Transform\";\nimport { FilterFunction } from \"../../graph/FilterCreator\";\nimport { Image } from \"../../graph/Image\";\nimport { SpatialConfiguration }\n from \"../interfaces/SpatialConfiguration\";\nimport { CameraVisualizationMode } from \"./enums/CameraVisualizationMode\";\nimport { OriginalPositionMode } from \"./enums/OriginalPositionMode\";\nimport { ClusterPoints } from \"./scene/ClusterPoints\";\nimport { CellLine } from \"./scene/CellLine\";\nimport { SpatialIntersection } from \"./scene/SpatialIntersection\";\nimport { SpatialCell } from \"./scene/SpatialCell\";\nimport { SpatialAssets } from \"./scene/SpatialAssets\";\nimport { isModeVisible } from \"./Modes\";\nimport { PointVisualizationMode } from \"./enums/PointVisualizationMode\";\nimport { LngLatAlt } from \"../../api/interfaces/LngLatAlt\";\nimport { resetEnu } from \"./SpatialCommon\";\n\nconst NO_CLUSTER_ID = \"NO_CLUSTER_ID\";\nconst NO_MERGE_ID = \"NO_MERGE_ID\";\nconst NO_SEQUENCE_ID = \"NO_SEQUENCE_ID\";\n\ntype Clusters = {\n [id: string]: {\n cellIds: string[];\n points: Object3D;\n };\n};\n\nexport class SpatialScene {\n private _scene: Scene;\n private _intersection: SpatialIntersection;\n private _assets: SpatialAssets;\n\n private _needsRender: boolean;\n\n private _cellClusters: {\n [cellId: string]: { keys: string[]; };\n };\n private _clusters: Clusters;\n private _images: { [cellId: string]: SpatialCell; };\n private _cells: { [cellId: string]: Object3D; };\n\n private _cameraVisualizationMode: CameraVisualizationMode;\n private _cameraSize: number;\n private _pointSize: number;\n private _pointVisualizationMode: PointVisualizationMode;\n private _positionMode: OriginalPositionMode;\n private _cellsVisible: boolean;\n\n private readonly _rayNearScale: number;\n private readonly _originalPointSize: number;\n private readonly _originalCameraSize: number;\n\n private _hoveredId: string;\n private _selectedId: string;\n\n private _filter: FilterFunction;\n\n private _imageCellMap: Map<string, string>;\n\n private _colors: { hover: string, select: string; };\n\n constructor(\n configuration: SpatialConfiguration,\n scene?: Scene) {\n this._rayNearScale = 1.1;\n this._originalPointSize = 2;\n this._originalCameraSize = 2;\n\n this._imageCellMap = new Map();\n\n this._scene = !!scene ? scene : new Scene();\n this._scene.autoUpdate = false;\n this._intersection = new SpatialIntersection();\n this._assets = new SpatialAssets();\n\n this._needsRender = false;\n this._images = {};\n this._cells = {};\n this._cellClusters = {};\n this._clusters = {};\n\n this._cameraVisualizationMode =\n !!configuration.cameraVisualizationMode ?\n configuration.cameraVisualizationMode :\n CameraVisualizationMode.Homogeneous;\n this._cameraSize = configuration.cameraSize;\n this._pointSize = configuration.pointSize;\n this._pointVisualizationMode =\n !!configuration.pointVisualizationMode ?\n configuration.pointVisualizationMode :\n PointVisualizationMode.Original;\n this._positionMode = configuration.originalPositionMode;\n this._cellsVisible = configuration.cellsVisible;\n\n this._hoveredId = null;\n this._selectedId = null;\n this._colors = { hover: \"#FF0000\", select: \"#FF8000\" };\n\n this._filter = () => true;\n }\n\n public get needsRender(): boolean { return this._needsRender; }\n public get intersection(): SpatialIntersection {\n return this._intersection;\n }\n\n public addCluster(\n reconstruction: ClusterContract,\n translation: number[],\n cellId: string): void {\n\n if (this.hasCluster(reconstruction.id, cellId)) {\n return;\n }\n\n const clusterId = reconstruction.id;\n\n if (!(clusterId in this._clusters)) {\n this._clusters[clusterId] = {\n points: new Object3D(),\n cellIds: [],\n };\n\n const visible = this._getClusterVisible(clusterId);\n const cluster = this._clusters[clusterId];\n\n const color = this._pointVisualizationMode === PointVisualizationMode.Cluster ? this._assets.getColor(clusterId) : null;\n const points = new ClusterPoints({\n cluster: reconstruction,\n color,\n originalSize: this._originalPointSize,\n scale: this._pointSize,\n translation,\n });\n cluster.points.visible = visible;\n cluster.points.add(points);\n this._scene.add(cluster.points);\n }\n\n if (this._clusters[clusterId].cellIds.indexOf(cellId) === -1) {\n this._clusters[clusterId].cellIds.push(cellId);\n }\n if (!(cellId in this._cellClusters)) {\n this._cellClusters[cellId] = { keys: [] };\n }\n if (this._cellClusters[cellId].keys.indexOf(clusterId) === -1) {\n this._cellClusters[cellId].keys.push(clusterId);\n }\n\n this._needsRender = true;\n }\n\n public addImage(\n image: Image,\n transform: Transform,\n originalPosition: number[],\n cellId: string): void {\n\n const imageId = image.id;\n const idMap = {\n clusterId: image.clusterId ?? NO_CLUSTER_ID,\n sequenceId: image.sequenceId ?? NO_SEQUENCE_ID,\n ccId: image.mergeId ?? NO_MERGE_ID,\n };\n\n if (!(cellId in this._images)) {\n const created = new SpatialCell(\n cellId,\n this._scene,\n this._intersection);\n created.cameras.visible =\n isModeVisible(this._cameraVisualizationMode);\n created.applyPositionMode(this._positionMode);\n this._images[cellId] = created;\n }\n\n const cell = this._images[cellId];\n if (cell.hasImage(imageId)) { return; }\n cell.addImage({ idMap, image: image });\n\n const colorId = cell.getColorId(imageId, this._cameraVisualizationMode);\n const color = this._assets.getColor(colorId);\n const visible = this._filter(image);\n cell.visualize({\n id: imageId,\n color,\n positionMode: this._positionMode,\n scale: this._cameraSize,\n transform,\n visible,\n maxSize: this._originalCameraSize,\n originalPosition\n });\n\n this._imageCellMap.set(imageId, cellId);\n if (imageId === this._selectedId) {\n this._highlight(\n imageId,\n this._colors.select,\n this._cameraVisualizationMode);\n }\n if (idMap.clusterId in this._clusters) {\n const clusterVisible = this._getClusterVisible(idMap.clusterId);\n this._clusters[idMap.clusterId].points.visible = clusterVisible;\n }\n this._needsRender = true;\n }\n\n public addCell(vertices: number[][], cellId: string): void {\n if (this.hasCell(cellId)) {\n return;\n }\n\n const cell = new CellLine(vertices);\n this._cells[cellId] = new Object3D();\n this._cells[cellId].visible = this._cellsVisible;\n this._cells[cellId].add(cell);\n this._scene.add(this._cells[cellId]);\n\n this._needsRender = true;\n }\n\n public deactivate(): void {\n this._filter = () => true;\n this._selectedId = null;\n this._hoveredId = null;\n\n this.uncache();\n }\n\n public hasCluster(clusterId: string, cellId: string): boolean {\n return clusterId in this._clusters &&\n this._clusters[clusterId].cellIds.indexOf(cellId) !== -1;\n }\n\n public hasCell(cellId: string): boolean {\n return cellId in this._cells;\n }\n\n public hasImage(imageId: string, cellId: string): boolean {\n return cellId in this._images &&\n this._images[cellId].hasImage(imageId);\n }\n\n public render(\n camera: PerspectiveCamera,\n renderer: WebGLRenderer): void {\n renderer.render(this._scene, camera);\n this._needsRender = false;\n }\n\n public resetReference(\n reference: LngLatAlt,\n prevReference: LngLatAlt)\n : void {\n const clusters = this._clusters;\n for (const clusterId in clusters) {\n if (!clusters.hasOwnProperty(clusterId)) {\n continue;\n }\n const cluster = clusters[clusterId];\n cluster.points.position.fromArray(resetEnu(\n reference,\n cluster.points.position.toArray(),\n prevReference));\n }\n\n const cells = this._cells;\n for (const cellId in cells) {\n if (!cells.hasOwnProperty(cellId)) {\n continue;\n }\n const cell = cells[cellId];\n cell.position.fromArray(resetEnu(\n reference,\n cell.position.toArray(),\n prevReference));\n }\n\n const images = this._images;\n for (const cellId in images) {\n if (!images.hasOwnProperty(cellId)) {\n continue;\n }\n const spatialCell = images[cellId];\n spatialCell.resetReference(reference, prevReference);\n }\n }\n\n public setCameraSize(cameraSize: number): void {\n if (Math.abs(cameraSize - this._cameraSize) < 1e-3) { return; }\n\n const imageCells = this._images;\n for (const cellId of Object.keys(imageCells)) {\n imageCells[cellId].applyCameraSize(cameraSize);\n }\n\n this._intersection.raycaster.near = this._getNear(cameraSize);\n this._cameraSize = cameraSize;\n this._needsRender = true;\n }\n\n public setFilter(filter: FilterFunction): void {\n this._filter = filter;\n const clusterVisibles: { [key: string]: boolean; } = {};\n for (const imageCell of Object.values(this._images)) {\n imageCell.applyFilter(filter);\n const imageCV = imageCell.clusterVisibles;\n for (const clusterId in imageCV) {\n if (!imageCV.hasOwnProperty(clusterId)) {\n continue;\n }\n if (!(clusterId in clusterVisibles)) {\n clusterVisibles[clusterId] = false;\n }\n clusterVisibles[clusterId] ||= imageCV[clusterId];\n }\n }\n\n const pointsVisible =\n this._pointVisualizationMode !== PointVisualizationMode.Hidden;\n for (const clusterId in clusterVisibles) {\n if (!clusterVisibles.hasOwnProperty(clusterId)) { continue; }\n clusterVisibles[clusterId] &&= pointsVisible;\n const visible = clusterVisibles[clusterId];\n if (clusterId in this._clusters) {\n this._clusters[clusterId].points.visible = visible;\n }\n }\n\n this._needsRender = true;\n }\n\n public setHoveredImage(imageId: string | null): void {\n if (imageId != null && !this._imageCellMap.has(imageId)) {\n throw new MapillaryError(`Image does not exist: ${imageId}`);\n }\n\n if (this._hoveredId === imageId) { return; }\n this._needsRender = true;\n\n if (this._hoveredId != null) {\n if (this._hoveredId === this._selectedId) {\n this._highlight(\n this._hoveredId,\n this._colors.select,\n this._cameraVisualizationMode);\n } else {\n this._resetCameraColor(this._hoveredId);\n }\n }\n\n this._highlight(\n imageId,\n this._colors.hover,\n this._cameraVisualizationMode);\n\n this._hoveredId = imageId;\n }\n\n public setNavigationState(isOverview: boolean): void {\n this._intersection.resetIntersectionThreshold(isOverview);\n }\n\n public setPointSize(pointSize: number): void {\n if (Math.abs(pointSize - this._pointSize) < 1e-3) {\n return;\n }\n\n const clusters = this._clusters;\n for (const key in clusters) {\n if (!clusters.hasOwnProperty(key)) {\n continue;\n }\n\n for (const points of clusters[key].points.children) {\n (<ClusterPoints>points).resize(pointSize);\n }\n }\n\n this._pointSize = pointSize;\n this._needsRender = true;\n }\n\n public setPointVisualizationMode(mode: PointVisualizationMode): void {\n if (mode === this._pointVisualizationMode) {\n return;\n }\n\n this._pointVisualizationMode = mode;\n for (const clusterId in this._clusters) {\n if (!this._clusters.hasOwnProperty(clusterId)) {\n continue;\n }\n\n const cluster = this._clusters[clusterId];\n cluster.points.visible = this._getClusterVisible(clusterId);\n\n for (const points of cluster.points.children) {\n const color = mode === PointVisualizationMode.Cluster ?\n this._assets.getColor(clusterId) : null;\n (<ClusterPoints>points).setColor(color);\n }\n }\n\n this._needsRender = true;\n }\n\n public setPositionMode(mode: OriginalPositionMode): void {\n if (mode === this._positionMode) { return; }\n for (const cell of Object.values(this._images)) {\n cell.applyPositionMode(mode);\n }\n this._positionMode = mode;\n this._needsRender = true;\n }\n\n public setSelectedImage(id: string | null): void {\n if (this._selectedId === id) { return; }\n this._needsRender = true;\n\n if (this._selectedId != null) {\n this._resetCameraColor(this._selectedId);\n }\n\n this._highlight(\n id,\n this._colors.select,\n this._cameraVisualizationMode);\n\n this._selectedId = id;\n }\n\n public setCellVisibility(visible: boolean): void {\n if (visible === this._cellsVisible) {\n return;\n }\n\n for (const cellId in this._cells) {\n if (!this._cells.hasOwnProperty(cellId)) {\n continue;\n }\n\n this._cells[cellId].visible = visible;\n }\n\n this._cellsVisible = visible;\n this._needsRender = true;\n }\n\n public setCameraVisualizationMode(mode: CameraVisualizationMode): void {\n if (mode === this._cameraVisualizationMode) { return; }\n\n const visible = isModeVisible(mode);\n const assets = this._assets;\n for (const cell of Object.values(this._images)) {\n cell.cameras.visible = visible;\n const cameraMap = cell.getCamerasByMode(mode);\n cameraMap.forEach(\n (cameras, colorId) => {\n const color = assets.getColor(colorId);\n for (const camera of cameras) {\n camera.setColor(color);\n }\n });\n }\n\n this._highlight(this._hoveredId, this._colors.hover, mode);\n this._highlight(this._selectedId, this._colors.select, mode);\n\n this._cameraVisualizationMode = mode;\n this._needsRender = true;\n }\n\n public uncache(keepCellIds?: string[]): void {\n for (const cellId of Object.keys(this._cellClusters)) {\n if (!!keepCellIds && keepCellIds.indexOf(cellId) !== -1) {\n continue;\n }\n\n this._disposeReconstruction(cellId);\n }\n\n for (const cellId of Object.keys(this._images)) {\n if (!!keepCellIds && keepCellIds.indexOf(cellId) !== -1) {\n continue;\n }\n const nceMap = this._imageCellMap;\n const keys = this._images[cellId].keys;\n for (const key of keys) {\n nceMap.delete(key);\n }\n\n this._images[cellId].dispose();\n delete this._images[cellId];\n }\n\n for (const cellId of Object.keys(this._cells)) {\n if (!!keepCellIds && keepCellIds.indexOf(cellId) !== -1) {\n continue;\n }\n\n this._disposeCell(cellId);\n }\n\n this._needsRender = true;\n }\n\n private _getClusterVisible(clusterId: string): boolean {\n if (this._pointVisualizationMode === PointVisualizationMode.Hidden) {\n return false;\n }\n let visible = false;\n for (const imageCell of Object.values(this._images)) {\n const imageCV = imageCell.clusterVisibles;\n if (!(clusterId in imageCV)) { continue; }\n visible ||= imageCV[clusterId];\n }\n return visible;\n }\n\n private _disposePoints(cellId: string): void {\n for (const clusterId of this._cellClusters[cellId].keys) {\n if (!(clusterId in this._clusters)) {\n continue;\n }\n\n const index: number = this._clusters[clusterId].cellIds.indexOf(cellId);\n if (index === -1) {\n continue;\n }\n\n this._clusters[clusterId].cellIds.splice(index, 1);\n\n if (this._clusters[clusterId].cellIds.length > 0) {\n continue;\n }\n\n for (const points of this._clusters[clusterId].points.children.slice()) {\n (<ClusterPoints>points).dispose();\n }\n\n this._scene.remove(this._clusters[clusterId].points);\n\n delete this._clusters[clusterId];\n }\n }\n\n private _disposeReconstruction(cellId: string): void {\n this._disposePoints(cellId);\n\n delete this._cellClusters[cellId];\n }\n\n private _disposeCell(cellId: string): void {\n const cell = this._cells[cellId];\n\n for (const line of cell.children.slice()) {\n (<CellLine>line).dispose();\n cell.remove(line);\n }\n\n this._scene.remove(cell);\n\n delete this._cells[cellId];\n }\n\n private _getNear(cameraSize: number): number {\n const near = this._rayNearScale *\n this._originalCameraSize *\n cameraSize;\n\n return Math.max(1, near);\n }\n\n private _resetCameraColor(imageId: string): void {\n const nceMap = this._imageCellMap;\n if (imageId == null || !nceMap.has(imageId)) { return; }\n\n const cellId = nceMap.get(imageId);\n const cell = this._images[cellId];\n const colorId = cell.getColorId(imageId, this._cameraVisualizationMode);\n const color = this._assets.getColor(colorId);\n cell.applyCameraColor(imageId, color);\n }\n\n private _highlight(\n imageId: string,\n color: string,\n mode: CameraVisualizationMode): void {\n const nceMap = this._imageCellMap;\n if (imageId == null || !nceMap.has(imageId)) { return; }\n const cellId = nceMap.get(imageId);\n color = mode === CameraVisualizationMode.Homogeneous ?\n color : \"#FFFFFF\";\n this._images[cellId].applyCameraColor(imageId, color);\n }\n}\n","import {\n empty as observableEmpty,\n from as observableFrom,\n of as observableOf,\n Observable,\n Subscriber,\n} from \"rxjs\";\n\nimport {\n catchError,\n finalize,\n filter,\n mergeMap,\n publish,\n refCount,\n tap,\n} from \"rxjs/operators\";\n\nimport { ClusterContract } from \"../../api/contracts/ClusterContract\";\nimport { IDataProvider } from \"../../api/interfaces/IDataProvider\";\nimport { CancelMapillaryError } from \"../../error/CancelMapillaryError\";\nimport { GraphService } from \"../../graph/GraphService\";\nimport { Image } from \"../../graph/Image\";\n\ntype ClusterData = {\n key: string;\n url: string;\n};\n\nexport class SpatialCache {\n private _graphService: GraphService;\n private _data: IDataProvider;\n\n private _cacheRequests: { [cellId: string]: Function[]; };\n private _cells: { [cellId: string]: Image[]; };\n\n private _clusters: { [key: string]: ClusterContract; };\n private _clusterCells: { [key: string]: string[]; };\n private _cellClusters: { [cellId: string]: ClusterData[]; };\n\n private _cachingClusters$: { [cellId: string]: Observable<ClusterContract>; };\n private _cachingCells$: { [cellId: string]: Observable<Image[]>; };\n\n constructor(graphService: GraphService, provider: IDataProvider) {\n this._graphService = graphService;\n this._data = provider;\n\n this._cells = {};\n this._cacheRequests = {};\n\n this._clusters = {};\n this._clusterCells = {};\n this._cellClusters = {};\n\n this._cachingCells$ = {};\n this._cachingClusters$ = {};\n }\n\n public cacheClusters$(cellId: string): Observable<ClusterContract> {\n if (!this.hasCell(cellId)) {\n throw new Error(\"Cannot cache reconstructions of a non-existing cell.\");\n }\n\n if (this.hasClusters(cellId)) {\n throw new Error(\"Cannot cache reconstructions that already exists.\");\n }\n\n if (this.isCachingClusters(cellId)) {\n return this._cachingClusters$[cellId];\n }\n\n const duplicatedClusters: ClusterData[] = this.getCell(cellId)\n .filter(\n (n: Image): boolean => {\n return !!n.clusterId && !!n.clusterUrl;\n })\n .map(\n (n: Image): ClusterData => {\n return { key: n.clusterId, url: n.clusterUrl };\n });\n\n const clusters: ClusterData[] = Array\n .from<ClusterData>(\n new Map(\n duplicatedClusters.map(\n (cd: ClusterData): [string, ClusterData] => {\n return [cd.key, cd];\n }))\n .values());\n\n this._cellClusters[cellId] = clusters;\n this._cacheRequests[cellId] = [];\n\n let aborter: Function;\n const abort: Promise<void> = new Promise(\n (_, reject): void => {\n aborter = reject;\n });\n this._cacheRequests[cellId].push(aborter);\n\n this._cachingClusters$[cellId] =\n this._cacheClusters$(clusters, cellId, abort).pipe(\n finalize(\n (): void => {\n if (cellId in this._cachingClusters$) {\n delete this._cachingClusters$[cellId];\n }\n\n if (cellId in this._cacheRequests) {\n delete this._cacheRequests[cellId];\n }\n }),\n publish(),\n refCount());\n\n return this._cachingClusters$[cellId];\n }\n\n public cacheCell$(cellId: string): Observable<Image[]> {\n if (this.hasCell(cellId)) {\n throw new Error(\"Cannot cache cell that already exists.\");\n }\n\n if (this.isCachingCell(cellId)) {\n return this._cachingCells$[cellId];\n }\n\n this._cachingCells$[cellId] = this._graphService.cacheCell$(cellId).pipe(\n catchError(\n (error: Error): Observable<Image[]> => {\n console.error(error);\n\n return observableEmpty();\n }),\n filter(\n (): boolean => {\n return !(cellId in this._cells);\n }),\n tap(\n (images: Image[]): void => {\n this._cells[cellId] = [];\n this._cells[cellId].push(...images);\n\n delete this._cachingCells$[cellId];\n }),\n finalize(\n (): void => {\n if (cellId in this._cachingCells$) {\n delete this._cachingCells$[cellId];\n }\n }),\n publish(),\n refCount());\n\n return this._cachingCells$[cellId];\n }\n\n public isCachingClusters(cellId: string): boolean {\n return cellId in this._cachingClusters$;\n }\n\n public isCachingCell(cellId: string): boolean {\n return cellId in this._cachingCells$;\n }\n\n public hasClusters(cellId: string): boolean {\n if (cellId in this._cachingClusters$ ||\n !(cellId in this._cellClusters)) {\n return false;\n }\n\n for (const cd of this._cellClusters[cellId]) {\n if (!(cd.key in this._clusters)) {\n return false;\n }\n }\n\n return true;\n }\n\n public hasCell(cellId: string): boolean {\n return !(cellId in this._cachingCells$) && cellId in this._cells;\n }\n\n public getClusters(cellId: string): ClusterContract[] {\n return cellId in this._cellClusters ?\n this._cellClusters[cellId]\n .map(\n (cd: ClusterData): ClusterContract => {\n return this._clusters[cd.key];\n })\n .filter(\n (reconstruction: ClusterContract): boolean => {\n return !!reconstruction;\n }) :\n [];\n }\n\n public getCell(cellId: string): Image[] {\n return cellId in this._cells ? this._cells[cellId] : [];\n }\n\n public uncache(keepCellIds?: string[]): void {\n for (let cellId of Object.keys(this._cacheRequests)) {\n if (!!keepCellIds && keepCellIds.indexOf(cellId) !== -1) {\n continue;\n }\n\n for (const aborter of this._cacheRequests[cellId]) {\n aborter();\n }\n\n delete this._cacheRequests[cellId];\n }\n\n for (let cellId of Object.keys(this._cellClusters)) {\n if (!!keepCellIds && keepCellIds.indexOf(cellId) !== -1) {\n continue;\n }\n\n for (const cd of this._cellClusters[cellId]) {\n if (!(cd.key in this._clusterCells)) {\n continue;\n }\n\n const index: number = this._clusterCells[cd.key].indexOf(cellId);\n if (index === -1) {\n continue;\n }\n\n this._clusterCells[cd.key].splice(index, 1);\n\n if (this._clusterCells[cd.key].length > 0) {\n continue;\n }\n\n delete this._clusterCells[cd.key];\n delete this._clusters[cd.key];\n }\n\n delete this._cellClusters[cellId];\n }\n\n for (let cellId of Object.keys(this._cells)) {\n if (!!keepCellIds && keepCellIds.indexOf(cellId) !== -1) {\n continue;\n }\n\n delete this._cells[cellId];\n }\n }\n\n public updateCell$(cellId: string): Observable<Image[]> {\n if (!this.hasCell(cellId)) {\n throw new Error(\"Cannot update cell that does not exists.\");\n }\n\n return this._graphService.cacheCell$(cellId).pipe(\n catchError(\n (error: Error): Observable<Image[]> => {\n console.error(error);\n\n return observableEmpty();\n }),\n filter(\n (): boolean => {\n return cellId in this._cells;\n }),\n tap(\n (images: Image[]): void => {\n this._cells[cellId] = [];\n this._cells[cellId].push(...images);\n }),\n publish(),\n refCount());\n }\n\n public updateClusters$(cellId: string):\n Observable<ClusterContract> {\n if (!this.hasCell(cellId)) {\n throw new Error(\"Cannot update reconstructions of a non-existing cell.\");\n }\n\n if (!this.hasClusters(cellId)) {\n throw new Error(\"Cannot update reconstructions for cell that is not cached.\");\n }\n\n const duplicatedClusters: ClusterData[] = this.getCell(cellId)\n .filter(\n (n: Image): boolean => {\n return !!n.clusterId && !!n.clusterUrl;\n })\n .map(\n (n: Image): ClusterData => {\n return { key: n.clusterId, url: n.clusterUrl };\n });\n\n const clusters: ClusterData[] = Array\n .from<ClusterData>(\n new Map(\n duplicatedClusters.map(\n (cd: ClusterData): [string, ClusterData] => {\n return [cd.key, cd];\n }))\n .values())\n .filter(cd => {\n return !(cd.key in this._clusters);\n });\n\n this._cellClusters[cellId].push(...clusters);\n\n return this._cacheClusters$(clusters, cellId, null);\n }\n\n private _cacheClusters$(\n clusters: ClusterData[],\n cellId: string,\n cancellation: Promise<void>): Observable<ClusterContract> {\n return observableFrom(clusters).pipe(\n mergeMap(\n (cd: ClusterData): Observable<ClusterContract> => {\n if (this._hasCluster(cd.key)) {\n return observableOf(\n this._getCluster(cd.key));\n }\n\n return this._getCluster$(\n cd.url,\n cd.key,\n cancellation)\n .pipe(\n catchError(\n (error: Error): Observable<ClusterContract> => {\n if (error instanceof CancelMapillaryError) {\n return observableEmpty();\n }\n\n console.error(error);\n return observableEmpty();\n }));\n },\n 6),\n filter(\n (): boolean => {\n return cellId in this._cellClusters;\n }),\n tap(\n (reconstruction: ClusterContract): void => {\n if (!this._hasCluster(reconstruction.id)) {\n this._clusters[reconstruction.id] = reconstruction;\n }\n\n if (!(reconstruction.id in this._clusterCells)) {\n this._clusterCells[reconstruction.id] = [];\n }\n\n if (this._clusterCells[reconstruction.id].indexOf(cellId) === -1) {\n this._clusterCells[reconstruction.id].push(cellId);\n }\n }));\n }\n\n private _getCluster(id: string): ClusterContract {\n return this._clusters[id];\n }\n\n private _getCluster$(url: string, clusterId: string, abort: Promise<void>): Observable<ClusterContract> {\n return Observable.create(\n (subscriber: Subscriber<ClusterContract>): void => {\n this._data.getCluster(url, abort)\n .then(\n (reconstruction: ClusterContract): void => {\n reconstruction.id = clusterId;\n subscriber.next(reconstruction);\n subscriber.complete();\n },\n (error: Error): void => {\n subscriber.error(error);\n });\n });\n }\n\n private _hasCluster(id: string): boolean {\n return id in this._clusters;\n }\n}\n","import { IGeometryProvider } from \"./interfaces/IGeometryProvider\";\n\nexport function connectedComponent(\n cellId: string,\n depth: number,\n geometry: IGeometryProvider)\n : string[] {\n\n const cells = new Set<string>();\n cells.add(cellId);\n connectedComponentRecursive(cells, [cellId], 0, depth, geometry);\n return Array.from(cells);\n}\n\nfunction connectedComponentRecursive(\n cells: Set<string>,\n current: string[],\n currentDepth: number,\n maxDepth: number,\n geometry: IGeometryProvider)\n : void {\n\n if (currentDepth >= maxDepth) { return; }\n\n const adjacent: string[] = [];\n for (const cellId of current) {\n const aCells = geometry.getAdjacent(cellId);\n adjacent.push(...aCells);\n }\n\n const newCells: string[] = [];\n for (const a of adjacent) {\n if (cells.has(a)) { continue; }\n cells.add(a);\n newCells.push(a);\n }\n\n connectedComponentRecursive(\n cells,\n newCells,\n currentDepth + 1,\n maxDepth,\n geometry);\n}\n","import {\n combineLatest as observableCombineLatest,\n concat as observableConcat,\n empty as observableEmpty,\n from as observableFrom,\n merge as observableMerge,\n of as observableOf,\n Observable,\n} from \"rxjs\";\n\nimport {\n catchError,\n concatMap,\n distinctUntilChanged,\n first,\n last,\n map,\n mergeMap,\n publishReplay,\n publish,\n refCount,\n switchMap,\n take,\n withLatestFrom,\n filter,\n pairwise,\n} from \"rxjs/operators\";\n\nimport { Image } from \"../../graph/Image\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { ClusterContract }\n from \"../../api/contracts/ClusterContract\";\nimport { LngLatAlt } from \"../../api/interfaces/LngLatAlt\";\nimport { Spatial } from \"../../geo/Spatial\";\nimport { Transform } from \"../../geo/Transform\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { FilterFunction } from \"../../graph/FilterCreator\";\nimport * as Geo from \"../../geo/Geo\";\nimport { RenderPass } from \"../../render/RenderPass\";\nimport { GLRenderHash } from \"../../render/interfaces/IGLRenderHash\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { PlayService } from \"../../viewer/PlayService\";\nimport { Component } from \"../Component\";\nimport { SpatialConfiguration }\n from \"../interfaces/SpatialConfiguration\";\nimport { CameraVisualizationMode } from \"./enums/CameraVisualizationMode\";\nimport { OriginalPositionMode } from \"./enums/OriginalPositionMode\";\nimport { SpatialScene } from \"./SpatialScene\";\nimport { SpatialCache } from \"./SpatialCache\";\nimport { CameraType } from \"../../geo/interfaces/CameraType\";\nimport { geodeticToEnu } from \"../../geo/GeoCoords\";\nimport { LngLat } from \"../../api/interfaces/LngLat\";\nimport { ComponentName } from \"../ComponentName\";\nimport { isModeVisible, isOverviewState } from \"./Modes\";\nimport { State } from \"../../state/State\";\nimport { connectedComponent } from \"../../api/CellMath\";\nimport { PointVisualizationMode } from \"./enums/PointVisualizationMode\";\n\ntype IntersectEvent = MouseEvent | FocusEvent;\n\ntype Cell = {\n id: string;\n images: Image[];\n};\n\ntype AdjancentParams = [boolean, boolean, number, number, Image];\n\ninterface IntersectConfiguration {\n size: number;\n visible: boolean;\n state: State;\n}\n\nexport class SpatialComponent extends Component<SpatialConfiguration> {\n public static componentName: ComponentName = \"spatial\";\n\n private _cache: SpatialCache;\n private _scene: SpatialScene;\n private _viewportCoords: ViewportCoords;\n private _spatial: Spatial;\n\n /** @ignore */\n constructor(name: string, container: Container, navigator: Navigator) {\n super(name, container, navigator);\n\n this._cache = new SpatialCache(\n navigator.graphService,\n navigator.api.data);\n this._scene = new SpatialScene(this._getDefaultConfiguration());\n this._viewportCoords = new ViewportCoords();\n this._spatial = new Spatial();\n }\n\n /**\n * Returns the image id of the camera frame closest to the current\n * render camera position at the specified point.\n *\n * @description Notice that the pixelPoint argument requires x, y\n * coordinates from pixel space.\n *\n * With this function, you can use the coordinates provided by mouse\n * events to get information out of the spatial component.\n *\n * If no camera frame exist at the pixel\n * point, `null` will be returned.\n *\n * @param {Array<number>} pixelPoint - Pixel coordinates on\n * the viewer element.\n * @returns {string} Image id of the camera frame closest to\n * the camera. If no camera frame is intersected at the\n * pixel point, `null` will be returned.\n *\n * @example\n * ```js\n * spatialComponent.getFrameIdAt([100, 125])\n * .then((imageId) => { console.log(imageId); });\n * ```\n */\n public getFrameIdAt(pixelPoint: number[]): Promise<string> {\n return new Promise<string>((resolve: (value: string) => void, reject: (reason: Error) => void): void => {\n this._container.renderService.renderCamera$.pipe(\n first(),\n map(\n (render: RenderCamera): string => {\n const viewport = this._viewportCoords\n .canvasToViewport(\n pixelPoint[0],\n pixelPoint[1],\n this._container.container);\n\n const id = this._scene.intersection\n .intersectObjects(viewport, render.perspective);\n return id;\n }))\n .subscribe(\n (id: string): void => {\n resolve(id);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n protected _activate(): void {\n this._navigator.cacheService.configure({ cellDepth: 3 });\n\n const subs = this._subscriptions;\n\n subs.push(this._navigator.stateService.reference$\n .pipe(\n pairwise())\n .subscribe(\n ([prevReference, reference]: [LngLatAlt, LngLatAlt]): void => {\n this._scene.resetReference(reference, prevReference);\n }\n ));\n\n subs.push(this._navigator.graphService.filter$\n .subscribe(imageFilter => { this._scene.setFilter(imageFilter); }));\n\n const bearing$ = this._container.renderService.bearing$.pipe(\n map(\n (bearing: number): number => {\n const interval = 6;\n const discrete = interval * Math.floor(bearing / interval);\n return discrete;\n }),\n distinctUntilChanged(),\n publishReplay(1),\n refCount());\n\n const cellId$ = this._navigator.stateService.currentImage$\n .pipe(\n map(\n (image: Image): string => {\n return this._navigator.api.data.geometry\n .lngLatToCellId(image.originalLngLat);\n }),\n distinctUntilChanged(),\n publishReplay(1),\n refCount());\n\n const cellGridDepth$ = this._configuration$\n .pipe(\n map(\n (c: SpatialConfiguration): number => {\n return this._spatial.clamp(c.cellGridDepth, 1, 3);\n }),\n distinctUntilChanged(),\n publishReplay(1),\n refCount());\n\n const sequencePlay$ = observableCombineLatest(\n this._navigator.playService.playing$,\n this._navigator.playService.speed$).pipe(\n map(\n ([playing, speed]: [boolean, number]): boolean => {\n return playing && speed > PlayService.sequenceSpeed;\n }),\n distinctUntilChanged(),\n publishReplay(1),\n refCount());\n\n const isOverview$ = this._navigator.stateService.state$.pipe(\n map(\n (state: State): boolean => {\n return isOverviewState(state);\n }),\n distinctUntilChanged(),\n publishReplay(1),\n refCount());\n\n subs.push(isOverview$.subscribe(\n (isOverview: boolean): void => {\n this._scene.setNavigationState(isOverview);\n }));\n\n const cell$ = observableCombineLatest(\n isOverview$,\n sequencePlay$,\n bearing$,\n cellGridDepth$,\n this._navigator.stateService.currentImage$)\n .pipe(\n distinctUntilChanged((\n [o1, s1, b1, d1, i1]: AdjancentParams,\n [o2, s2, b2, d2, i2]: AdjancentParams)\n : boolean => {\n if (o1 !== o2) {\n return false;\n }\n const isd = i1.id === i2.id && s1 === s2 && d1 === d2;\n if (o1) {\n return isd;\n }\n return isd && b1 === b2;\n }),\n concatMap(\n ([isOverview, sequencePlay, bearing, depth, image]\n : AdjancentParams)\n : Observable<string[]> => {\n if (isOverview) {\n const geometry = this._navigator.api.data.geometry;\n const cellId = geometry\n .lngLatToCellId(image.originalLngLat);\n const cells = sequencePlay ?\n [cellId] :\n connectedComponent(cellId, depth, geometry);\n return observableOf(cells);\n }\n\n const fov = sequencePlay ? 30 : 90;\n return observableOf(\n this._cellsInFov(\n image,\n bearing,\n fov));\n }),\n switchMap(\n (cellIds: string[]): Observable<Cell> => {\n return observableFrom(cellIds).pipe(\n mergeMap(\n (cellId: string): Observable<Cell> => {\n const t$ = this._cache.hasCell(cellId) ?\n observableOf(\n this._cache.getCell(cellId)) :\n this._cache.cacheCell$(cellId);\n\n return t$.pipe(\n map((images: Image[]) => ({ id: cellId, images })));\n },\n 6));\n }));\n\n subs.push(cell$.pipe(\n withLatestFrom(this._navigator.stateService.reference$))\n .subscribe(\n ([cell, reference]: [Cell, LngLatAlt]): void => {\n if (this._scene.hasCell(cell.id)) {\n return;\n }\n\n this._scene.addCell(\n this._cellToTopocentric(cell.id, reference),\n cell.id);\n }));\n\n subs.push(cell$.pipe(\n withLatestFrom(this._navigator.stateService.reference$))\n .subscribe(\n ([cell, reference]: [Cell, LngLatAlt]): void => {\n this._addSceneImages(cell, reference);\n }));\n\n subs.push(cell$.pipe(\n concatMap(\n (cell: Cell): Observable<[string, ClusterContract]> => {\n const cellId = cell.id;\n let reconstructions$: Observable<ClusterContract>;\n if (this._cache.hasClusters(cellId)) {\n reconstructions$ = observableFrom(this._cache.getClusters(cellId));\n } else if (this._cache.isCachingClusters(cellId)) {\n reconstructions$ = this._cache.cacheClusters$(cellId).pipe(\n last(null, {}),\n switchMap(\n (): Observable<ClusterContract> => {\n return observableFrom(this._cache.getClusters(cellId));\n }));\n } else if (this._cache.hasCell(cellId)) {\n reconstructions$ = this._cache.cacheClusters$(cellId);\n } else {\n reconstructions$ = observableEmpty();\n }\n\n return observableCombineLatest(observableOf(cellId), reconstructions$);\n }),\n withLatestFrom(this._navigator.stateService.reference$))\n .subscribe(\n ([[cellId, reconstruction], reference]: [[string, ClusterContract], LngLatAlt]): void => {\n if (this._scene\n .hasCluster(\n reconstruction.id,\n cellId)) {\n return;\n }\n\n this._scene.addCluster(\n reconstruction,\n this._computeTranslation(\n reconstruction,\n reference),\n cellId);\n }));\n\n subs.push(this._configuration$.pipe(\n map(\n (c: SpatialConfiguration): SpatialConfiguration => {\n c.cameraSize = this._spatial.clamp(c.cameraSize, 0.01, 1);\n c.pointSize = this._spatial.clamp(c.pointSize, 0.01, 1);\n const pointVisualizationMode =\n c.pointsVisible ?\n c.pointVisualizationMode ?? PointVisualizationMode.Original :\n PointVisualizationMode.Hidden;\n return {\n cameraSize: c.cameraSize,\n cameraVisualizationMode: c.cameraVisualizationMode,\n cellsVisible: c.cellsVisible,\n originalPositionMode: c.originalPositionMode,\n pointSize: c.pointSize,\n pointVisualizationMode,\n };\n }),\n distinctUntilChanged(\n (c1: SpatialConfiguration, c2: SpatialConfiguration)\n : boolean => {\n return c1.cameraSize === c2.cameraSize &&\n c1.cameraVisualizationMode === c2.cameraVisualizationMode &&\n c1.cellsVisible === c2.cellsVisible &&\n c1.originalPositionMode === c2.originalPositionMode &&\n c1.pointSize === c2.pointSize &&\n c1.pointVisualizationMode === c2.pointVisualizationMode;\n }))\n .subscribe(\n (c: SpatialConfiguration): void => {\n this._scene.setCameraSize(c.cameraSize);\n const cvm = c.cameraVisualizationMode;\n this._scene.setCameraVisualizationMode(cvm);\n this._scene.setCellVisibility(c.cellsVisible);\n this._scene.setPointSize(c.pointSize);\n const pvm = c.pointVisualizationMode;\n this._scene.setPointVisualizationMode(pvm);\n const opm = c.originalPositionMode;\n this._scene.setPositionMode(opm);\n }));\n\n subs.push(observableCombineLatest(cellId$, cellGridDepth$)\n .subscribe(\n ([cellId, depth]: [string, number]): void => {\n const keepCells = connectedComponent(\n cellId,\n depth,\n this._navigator.api.data.geometry);\n this._scene.uncache(keepCells);\n this._cache.uncache(keepCells);\n }));\n\n subs.push(this._navigator.playService.playing$.pipe(\n switchMap(\n (playing: boolean): Observable<MouseEvent> => {\n return playing ?\n observableEmpty() :\n this._container.mouseService.dblClick$;\n }),\n withLatestFrom(this._container.renderService.renderCamera$),\n switchMap(\n ([event, render]: [MouseEvent, RenderCamera]): Observable<Image> => {\n const element = this._container.container;\n const [canvasX, canvasY] = this._viewportCoords\n .canvasPosition(event, element);\n const viewport = this._viewportCoords.canvasToViewport(\n canvasX,\n canvasY,\n element);\n\n const id = this._scene.intersection\n .intersectObjects(viewport, render.perspective);\n\n return !!id ?\n this._navigator.moveTo$(id).pipe(\n catchError(\n (): Observable<Image> => {\n return observableEmpty();\n })) :\n observableEmpty();\n }))\n .subscribe());\n\n const intersectChange$ = observableCombineLatest(\n this._configuration$,\n this._navigator.stateService.state$).pipe(\n map(\n ([c, state]: [SpatialConfiguration, State])\n : IntersectConfiguration => {\n c.cameraSize = this._spatial.clamp(\n c.cameraSize,\n 0.01,\n 1);\n return {\n size: c.cameraSize,\n visible: isModeVisible(c.cameraVisualizationMode),\n state,\n };\n }),\n distinctUntilChanged(\n (c1: IntersectConfiguration, c2: IntersectConfiguration): boolean => {\n return c1.size === c2.size &&\n c1.visible === c2.visible &&\n c1.state === c2.state;\n }));\n\n const mouseMove$ = this._container.mouseService.mouseMove$.pipe(\n publishReplay(1),\n refCount());\n\n subs.push(mouseMove$.subscribe());\n\n const mouseHover$ = observableMerge(\n this._container.mouseService.mouseEnter$,\n this._container.mouseService.mouseLeave$,\n this._container.mouseService.windowBlur$);\n\n subs.push(observableCombineLatest(\n this._navigator.playService.playing$,\n mouseHover$,\n isOverview$,\n this._navigator.graphService.filter$)\n .pipe(\n switchMap(\n ([playing, mouseHover]:\n [boolean, IntersectEvent, boolean, FilterFunction])\n : Observable<[IntersectEvent, RenderCamera, IntersectConfiguration]> => {\n return !playing && mouseHover.type === \"pointerenter\" ?\n observableCombineLatest(\n observableConcat(\n mouseMove$.pipe(take(1)),\n this._container.mouseService.mouseMove$),\n this._container.renderService.renderCamera$,\n intersectChange$) :\n observableCombineLatest(\n observableOf(mouseHover),\n observableOf(null),\n observableOf(null));\n }))\n .subscribe(\n ([event, render]\n : [IntersectEvent, RenderCamera, IntersectConfiguration]): void => {\n if (event.type !== \"pointermove\") {\n this._scene.setHoveredImage(null);\n return;\n }\n\n const element = this._container.container;\n const [canvasX, canvasY] = this._viewportCoords.canvasPosition(<MouseEvent>event, element);\n const viewport = this._viewportCoords.canvasToViewport(\n canvasX,\n canvasY,\n element);\n\n const key = this._scene.intersection\n .intersectObjects(viewport, render.perspective);\n\n this._scene.setHoveredImage(key);\n }));\n\n subs.push(this._navigator.stateService.currentId$\n .subscribe(\n (id: string): void => {\n this._scene.setSelectedImage(id);\n }));\n\n subs.push(this._navigator.stateService.currentState$\n .pipe(\n map((frame: AnimationFrame): GLRenderHash => {\n const scene = this._scene;\n\n return {\n name: this._name,\n renderer: {\n frameId: frame.id,\n needsRender: scene.needsRender,\n render: scene.render.bind(scene),\n pass: RenderPass.Opaque,\n },\n };\n }))\n .subscribe(this._container.glRenderer.render$));\n\n const updatedCell$ = this._navigator.graphService.dataAdded$\n .pipe(\n filter(\n (cellId: string) => {\n return this._cache.hasCell(cellId);\n }),\n mergeMap(\n (cellId: string): Observable<[Cell, LngLatAlt]> => {\n return this._cache.updateCell$(cellId).pipe(\n map((images: Image[]) => ({ id: cellId, images })),\n withLatestFrom(\n this._navigator.stateService.reference$\n )\n );\n }),\n publish<[Cell, LngLatAlt]>(),\n refCount());\n\n subs.push(updatedCell$\n .subscribe(\n ([cell, reference]: [Cell, LngLatAlt]): void => {\n this._addSceneImages(cell, reference);\n }));\n\n subs.push(updatedCell$\n .pipe(\n concatMap(\n ([cell]: [Cell, LngLatAlt]): Observable<[string, ClusterContract]> => {\n const cellId = cell.id;\n const cache = this._cache;\n let reconstructions$: Observable<ClusterContract>;\n if (cache.hasClusters(cellId)) {\n reconstructions$ =\n cache.updateClusters$(cellId);\n } else if (cache.isCachingClusters(cellId)) {\n reconstructions$ = this._cache.cacheClusters$(cellId).pipe(\n last(null, {}),\n switchMap(\n (): Observable<ClusterContract> => {\n return observableFrom(\n cache.updateClusters$(cellId));\n }));\n } else {\n reconstructions$ = observableEmpty();\n }\n\n return observableCombineLatest(\n observableOf(cellId),\n reconstructions$);\n }),\n withLatestFrom(this._navigator.stateService.reference$))\n .subscribe(\n ([[cellId, reconstruction], reference]: [[string, ClusterContract], LngLatAlt]): void => {\n if (this._scene.hasCluster(reconstruction.id, cellId)) {\n return;\n }\n\n this._scene.addCluster(\n reconstruction,\n this._computeTranslation(reconstruction, reference),\n cellId);\n }));\n }\n\n protected _deactivate(): void {\n this._subscriptions.unsubscribe();\n this._cache.uncache();\n this._scene.deactivate();\n this._navigator.cacheService.configure();\n }\n\n protected _getDefaultConfiguration(): SpatialConfiguration {\n return {\n cameraSize: 0.1,\n cameraVisualizationMode: CameraVisualizationMode.Homogeneous,\n cellGridDepth: 1,\n originalPositionMode: OriginalPositionMode.Hidden,\n pointSize: 0.1,\n pointsVisible: true,\n pointVisualizationMode: PointVisualizationMode.Original,\n cellsVisible: false,\n };\n }\n\n private _addSceneImages(cell: Cell, reference: LngLatAlt): void {\n const cellId = cell.id;\n const images = cell.images;\n for (const image of images) {\n if (this._scene.hasImage(image.id, cellId)) { continue; }\n\n this._scene.addImage(\n image,\n this._createTransform(image, reference),\n this._computeOriginalPosition(image, reference),\n cellId);\n }\n }\n\n private _cellsInFov(\n image: Image,\n bearing: number,\n fov: number)\n : string[] {\n const spatial = this._spatial;\n const geometry = this._navigator.api.data.geometry;\n const cell = geometry.lngLatToCellId(image.originalLngLat);\n const cells = [cell];\n const threshold = fov / 2;\n const adjacent = geometry.getAdjacent(cell);\n for (const a of adjacent) {\n const vertices = geometry.getVertices(a);\n for (const vertex of vertices) {\n const [x, y] =\n geodeticToEnu(\n vertex.lng,\n vertex.lat,\n 0,\n image.lngLat.lng,\n image.lngLat.lat,\n 0);\n const azimuthal = Math.atan2(y, x);\n const vertexBearing = spatial.radToDeg(\n spatial.azimuthalToBearing(azimuthal));\n\n if (Math.abs(vertexBearing - bearing) < threshold) {\n cells.push(a);\n }\n }\n }\n return cells;\n }\n\n private _computeOriginalPosition(image: Image, reference: LngLatAlt): number[] {\n return geodeticToEnu(\n image.originalLngLat.lng,\n image.originalLngLat.lat,\n image.originalAltitude != null ? image.originalAltitude : image.computedAltitude,\n reference.lng,\n reference.lat,\n reference.alt);\n }\n\n private _cellToTopocentric(\n cellId: string,\n reference: LngLatAlt): number[][] {\n\n const vertices =\n this._navigator.api.data.geometry\n .getVertices(cellId)\n .map(\n (vertex: LngLat): number[] => {\n return geodeticToEnu(\n vertex.lng,\n vertex.lat,\n -2,\n reference.lng,\n reference.lat,\n reference.alt);\n });\n\n return vertices;\n }\n\n private _computeTranslation(\n reconstruction: ClusterContract,\n reference: LngLatAlt)\n : number[] {\n return geodeticToEnu(\n reconstruction.reference.lng,\n reconstruction.reference.lat,\n reconstruction.reference.alt,\n reference.lng,\n reference.lat,\n reference.alt);\n }\n\n private _createTransform(image: Image, reference: LngLatAlt): Transform {\n const translation = Geo.computeTranslation(\n { alt: image.computedAltitude, lat: image.lngLat.lat, lng: image.lngLat.lng },\n image.rotation,\n reference);\n\n const transform = new Transform(\n image.exifOrientation,\n image.width,\n image.height,\n image.scale,\n image.rotation,\n translation,\n undefined,\n undefined,\n image.cameraParameters,\n <CameraType>image.cameraType);\n\n return transform;\n }\n}\n","import {\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport { Transform } from \"../../../geo/Transform\";\n\n/**\n * @class Geometry\n * @abstract\n * @classdesc Represents a geometry.\n */\nexport abstract class Geometry {\n protected _notifyChanged$: Subject<Geometry>;\n\n /**\n * Create a geometry.\n *\n * @constructor\n * @ignore\n */\n constructor() {\n this._notifyChanged$ = new Subject<Geometry>();\n }\n\n /**\n * Get changed observable.\n *\n * @description Emits the geometry itself every time the geometry\n * has changed.\n *\n * @returns {Observable<Geometry>} Observable emitting the geometry instance.\n * @ignore\n */\n public get changed$(): Observable<Geometry> {\n return this._notifyChanged$;\n }\n\n /**\n * Get the 2D basic coordinates for the centroid of the geometry.\n *\n * @returns {Array<number>} 2D basic coordinates representing the centroid.\n * @ignore\n */\n public abstract getCentroid2d(): number[];\n\n /**\n * Get the 3D world coordinates for the centroid of the geometry.\n *\n * @param {Transform} transform - The transform of the image related to the geometry.\n * @returns {Array<number>} 3D world coordinates representing the centroid.\n * @ignore\n */\n public abstract getCentroid3d(transform: Transform): number[];\n\n /**\n * Set the 2D centroid of the geometry.\n *\n * @param {Array<number>} value - The new value of the centroid in basic coordinates.\n * @param {Transform} transform - The transform of the image related to the geometry.\n * @ignore\n */\n public abstract setCentroid2d(value: number[], transform: Transform): void;\n}\n","import { MapillaryError } from \"../../../error/MapillaryError\";\n\nexport class GeometryTagError extends MapillaryError {\n constructor(message?: string) {\n super(message != null ? message : \"The provided geometry value is incorrect\");\n\n Object.setPrototypeOf(this, GeometryTagError.prototype);\n\n this.name = \"GeometryTagError\";\n }\n}\n","import { Geometry } from \"./Geometry\";\nimport { GeometryTagError } from \"../error/GeometryTagError\";\nimport { Transform } from \"../../../geo/Transform\";\nimport { isSpherical } from \"../../../geo/Geo\";\n\n/**\n * @class PointsGeometry\n *\n * @classdesc Represents a point set in the 2D basic image coordinate system.\n *\n * @example\n * ```js\n * var points = [[0.5, 0.3], [0.7, 0.3], [0.6, 0.5]];\n * var pointsGeometry = new PointsGeometry(points);\n * ```\n */\nexport class PointsGeometry extends Geometry {\n private _points: number[][];\n\n /**\n * Create a points geometry.\n *\n * @constructor\n * @param {Array<Array<number>>} points - Array of 2D points on the basic coordinate\n * system. The number of points must be greater than or equal to two.\n *\n * @throws {GeometryTagError} Point coordinates must be valid basic coordinates.\n */\n constructor(points: number[][]) {\n super();\n\n const pointsLength: number = points.length;\n\n if (pointsLength < 2) {\n throw new GeometryTagError(\"A points geometry must have two or more positions.\");\n }\n\n this._points = [];\n for (const point of points) {\n if (point[0] < 0 || point[0] > 1 ||\n point[1] < 0 || point[1] > 1) {\n throw new GeometryTagError(\"Basic coordinates of points must be on the interval [0, 1].\");\n }\n\n this._points.push(point.slice());\n }\n }\n\n /**\n * Get points property.\n * @returns {Array<Array<number>>} Array of 2d points.\n */\n public get points(): number[][] {\n return this._points;\n }\n\n /**\n * Add a point to the point set.\n *\n * @param {Array<number>} point - Point to add.\n * @ignore\n */\n public addPoint2d(point: number[]): void {\n const clamped: number[] = [\n Math.max(0, Math.min(1, point[0])),\n Math.max(0, Math.min(1, point[1])),\n ];\n\n this._points.push(clamped);\n\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get the coordinates of a point from the point set representation of the geometry.\n *\n * @param {number} index - Point index.\n * @returns {Array<number>} Array representing the 2D basic coordinates of the point.\n * @ignore\n */\n public getPoint2d(index: number): number[] {\n return this._points[index].slice();\n }\n\n /**\n * Remove a point from the point set.\n *\n * @param {number} index - The index of the point to remove.\n * @ignore\n */\n public removePoint2d(index: number): void {\n if (index < 0 ||\n index >= this._points.length ||\n this._points.length < 3) {\n throw new GeometryTagError(\"Index for removed point must be valid.\");\n }\n\n this._points.splice(index, 1);\n\n this._notifyChanged$.next(this);\n }\n\n /** @ignore */\n public setVertex2d(index: number, value: number[], transform: Transform): void {\n this.setPoint2d(index, value, transform);\n }\n\n /** @ignore */\n public setPoint2d(index: number, value: number[], transform: Transform): void {\n const changed: number[] = [\n Math.max(0, Math.min(1, value[0])),\n Math.max(0, Math.min(1, value[1])),\n ];\n\n this._points[index] = changed;\n\n this._notifyChanged$.next(this);\n }\n\n /** @ignore */\n public getPoints3d(transform: Transform): number[][] {\n return this._getPoints3d(this._points, transform);\n }\n\n /** @ignore */\n public getPoint3d(index: number, transform: Transform): number[] {\n return transform.unprojectBasic(this._points[index], 200);\n }\n\n /** @ignore */\n public getPoints2d(): number[][] {\n return this._points.slice();\n }\n\n /** @ignore */\n public getCentroid2d(transform?: Transform): number[] {\n if (!transform) {\n throw new GeometryTagError(\"Get centroid must be called with a transform for points geometries.\");\n }\n\n const [minX, minY, maxX, maxY]: number[] = this.getRect2d(transform);\n\n const centroidX: number = minX < maxX ?\n (minX + maxX) / 2 :\n ((minX + maxX + 1) / 2) % 1;\n\n const centroidY: number = (minY + maxY) / 2;\n\n return [centroidX, centroidY];\n }\n\n /** @ignore */\n public getCentroid3d(transform: Transform): number[] {\n let centroid2d: number[] = this.getCentroid2d();\n\n return transform.unprojectBasic(centroid2d, 200);\n }\n\n /** @ignore */\n public getRect2d(transform: Transform): number[] {\n let minX: number = 1;\n let maxX: number = 0;\n let minY: number = 1;\n let maxY: number = 0;\n\n const points: number[][] = this._points;\n\n for (const point of points) {\n if (point[0] < minX) {\n minX = point[0];\n }\n\n if (point[0] > maxX) {\n maxX = point[0];\n }\n\n if (point[1] < minY) {\n minY = point[1];\n }\n\n if (point[1] > maxY) {\n maxY = point[1];\n }\n }\n\n if (isSpherical(transform.cameraType)) {\n const indices: number[] = [];\n for (let i: number = 0; i < points.length; i++) {\n indices[i] = i;\n }\n\n indices.sort(\n (a, b): number => {\n return points[a][0] < points[b][0] ?\n -1 :\n points[a][0] > points[b][0] ?\n 1 :\n a < b ? -1 : 1;\n });\n\n let maxDistanceX: number = points[indices[0]][0] + 1 - points[indices[indices.length - 1]][0];\n let leftMostIndex: number = 0;\n\n for (let i: number = 0; i < indices.length - 1; i++) {\n const index1: number = indices[i];\n const index2: number = indices[i + 1];\n const distanceX: number = points[index2][0] - points[index1][0];\n\n if (distanceX > maxDistanceX) {\n maxDistanceX = distanceX;\n leftMostIndex = i + 1;\n }\n }\n\n if (leftMostIndex > 0) {\n minX = points[indices[leftMostIndex]][0];\n maxX = points[indices[leftMostIndex - 1]][0];\n }\n }\n\n return [minX, minY, maxX, maxY];\n }\n\n /** @ignore */\n public setCentroid2d(value: number[], transform: Transform): void {\n throw new Error(\"Not implemented\");\n }\n\n private _getPoints3d(points2d: number[][], transform: Transform): number[][] {\n return points2d\n .map(\n (point: number[]) => {\n return transform.unprojectBasic(point, 200);\n });\n }\n}\n","import * as THREE from \"three\";\nimport * as vd from \"virtual-dom\";\n\nimport {\n Observable,\n Subject,\n Subscription,\n} from \"rxjs\";\nimport { map } from \"rxjs/operators\";\n\nimport { Geometry } from \"../geometry/Geometry\";\n\nimport { Transform } from \"../../../geo/Transform\";\nimport { ViewportCoords } from \"../../../geo/ViewportCoords\";\nimport { ViewportSize } from \"../../../render/interfaces/ViewportSize\";\n\n\nexport abstract class CreateTag<T extends Geometry> {\n protected _geometry: T;\n\n protected _transform: Transform;\n protected _viewportCoords: ViewportCoords;\n\n protected _aborted$: Subject<CreateTag<T>>;\n protected _created$: Subject<CreateTag<T>>;\n\n protected _glObjects: THREE.Object3D[];\n protected _glObjectsChanged$: Subject<CreateTag<T>>;\n\n protected _geometryChangedSubscription: Subscription;\n\n constructor(geometry: T, transform: Transform, viewportCoords?: ViewportCoords) {\n\n this._geometry = geometry;\n this._transform = transform;\n this._viewportCoords = !!viewportCoords ? viewportCoords : new ViewportCoords();\n\n this._aborted$ = new Subject<CreateTag<T>>();\n this._created$ = new Subject<CreateTag<T>>();\n this._glObjectsChanged$ = new Subject<CreateTag<T>>();\n\n this._geometryChangedSubscription = this._geometry.changed$\n .subscribe(\n (): void => {\n this._onGeometryChanged();\n\n this._glObjectsChanged$.next(this);\n });\n }\n\n public get geometry(): T {\n return this._geometry;\n }\n\n public get glObjects(): THREE.Object3D[] {\n return this._glObjects;\n }\n\n public get aborted$(): Observable<CreateTag<T>> {\n return this._aborted$;\n }\n\n public get created$(): Observable<CreateTag<T>> {\n return this._created$;\n }\n\n public get glObjectsChanged$(): Observable<CreateTag<T>> {\n return this._glObjectsChanged$;\n }\n\n public get geometryChanged$(): Observable<CreateTag<T>> {\n return this._geometry.changed$.pipe(\n map(\n (): CreateTag<T> => {\n return this;\n }));\n }\n\n public abstract getDOMObjects(camera: THREE.Camera, size: ViewportSize): vd.VNode[];\n\n public abstract create(): void;\n\n public dispose(): void {\n this._geometryChangedSubscription.unsubscribe();\n }\n\n protected abstract _onGeometryChanged(): void;\n\n protected _canvasToTransform(canvas: number[]): string {\n const canvasX: number = Math.round(canvas[0]);\n const canvasY: number = Math.round(canvas[1]);\n const transform: string = `translate(-50%,-50%) translate(${canvasX}px,${canvasY}px)`;\n\n return transform;\n }\n\n protected _colorToBackground(color: number): string {\n return \"#\" + (\"000000\" + color.toString(16)).substr(-6);\n }\n\n protected _createOutine(polygon3d: number[][], color: number): THREE.Line {\n const positions: Float32Array = this._getLinePositions(polygon3d);\n\n const geometry: THREE.BufferGeometry = new THREE.BufferGeometry();\n geometry.setAttribute(\"position\", new THREE.BufferAttribute(positions, 3));\n\n const material: THREE.LineBasicMaterial =\n new THREE.LineBasicMaterial(\n {\n color: color,\n linewidth: 1,\n });\n\n return new THREE.Line(geometry, material);\n }\n\n protected _disposeLine(line: THREE.Line): void {\n if (line == null) {\n return;\n }\n\n line.geometry.dispose();\n (<THREE.Material>line.material).dispose();\n }\n\n private _getLinePositions(polygon3d: number[][]): Float32Array {\n const length: number = polygon3d.length;\n const positions: Float32Array = new Float32Array(length * 3);\n\n for (let i: number = 0; i < length; ++i) {\n const index: number = 3 * i;\n\n const position: number[] = polygon3d[i];\n\n positions[index] = position[0];\n positions[index + 1] = position[1];\n positions[index + 2] = position[2];\n }\n\n return positions;\n }\n}\n","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize),\n maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n outerNode = eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n var bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n\n var bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n var filteredBridge = filterPoints(bridge, bridge.next);\n filterPoints(bridgeReverse, bridgeReverse.next);\n\n // Check if input node was removed by the filtering\n return outerNode === bridge ? filteredBridge : outerNode;\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","\nexport default class TinyQueue {\n constructor(data = [], compare = defaultCompare) {\n this.data = data;\n this.length = this.data.length;\n this.compare = compare;\n\n if (this.length > 0) {\n for (let i = (this.length >> 1) - 1; i >= 0; i--) this._down(i);\n }\n }\n\n push(item) {\n this.data.push(item);\n this.length++;\n this._up(this.length - 1);\n }\n\n pop() {\n if (this.length === 0) return undefined;\n\n const top = this.data[0];\n const bottom = this.data.pop();\n this.length--;\n\n if (this.length > 0) {\n this.data[0] = bottom;\n this._down(0);\n }\n\n return top;\n }\n\n peek() {\n return this.data[0];\n }\n\n _up(pos) {\n const {data, compare} = this;\n const item = data[pos];\n\n while (pos > 0) {\n const parent = (pos - 1) >> 1;\n const current = data[parent];\n if (compare(item, current) >= 0) break;\n data[pos] = current;\n pos = parent;\n }\n\n data[pos] = item;\n }\n\n _down(pos) {\n const {data, compare} = this;\n const halfLength = this.length >> 1;\n const item = data[pos];\n\n while (pos < halfLength) {\n let left = (pos << 1) + 1;\n let best = data[left];\n const right = left + 1;\n\n if (right < this.length && compare(data[right], best) < 0) {\n left = right;\n best = data[right];\n }\n if (compare(best, item) >= 0) break;\n\n data[pos] = best;\n pos = left;\n }\n\n data[pos] = item;\n }\n}\n\nfunction defaultCompare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n","'use strict';\n\nvar Queue = require('tinyqueue');\n\nif (Queue.default) Queue = Queue.default; // temporary webpack fix\n\nmodule.exports = polylabel;\nmodule.exports.default = polylabel;\n\nfunction polylabel(polygon, precision, debug) {\n precision = precision || 1.0;\n\n // find the bounding box of the outer ring\n var minX, minY, maxX, maxY;\n for (var i = 0; i < polygon[0].length; i++) {\n var p = polygon[0][i];\n if (!i || p[0] < minX) minX = p[0];\n if (!i || p[1] < minY) minY = p[1];\n if (!i || p[0] > maxX) maxX = p[0];\n if (!i || p[1] > maxY) maxY = p[1];\n }\n\n var width = maxX - minX;\n var height = maxY - minY;\n var cellSize = Math.min(width, height);\n var h = cellSize / 2;\n\n if (cellSize === 0) {\n var degeneratePoleOfInaccessibility = [minX, minY];\n degeneratePoleOfInaccessibility.distance = 0;\n return degeneratePoleOfInaccessibility;\n }\n\n // a priority queue of cells in order of their \"potential\" (max distance to polygon)\n var cellQueue = new Queue(undefined, compareMax);\n\n // cover polygon with initial cells\n for (var x = minX; x < maxX; x += cellSize) {\n for (var y = minY; y < maxY; y += cellSize) {\n cellQueue.push(new Cell(x + h, y + h, h, polygon));\n }\n }\n\n // take centroid as the first best guess\n var bestCell = getCentroidCell(polygon);\n\n // special case for rectangular polygons\n var bboxCell = new Cell(minX + width / 2, minY + height / 2, 0, polygon);\n if (bboxCell.d > bestCell.d) bestCell = bboxCell;\n\n var numProbes = cellQueue.length;\n\n while (cellQueue.length) {\n // pick the most promising cell from the queue\n var cell = cellQueue.pop();\n\n // update the best cell if we found a better one\n if (cell.d > bestCell.d) {\n bestCell = cell;\n if (debug) console.log('found best %d after %d probes', Math.round(1e4 * cell.d) / 1e4, numProbes);\n }\n\n // do not drill down further if there's no chance of a better solution\n if (cell.max - bestCell.d <= precision) continue;\n\n // split the cell into four cells\n h = cell.h / 2;\n cellQueue.push(new Cell(cell.x - h, cell.y - h, h, polygon));\n cellQueue.push(new Cell(cell.x + h, cell.y - h, h, polygon));\n cellQueue.push(new Cell(cell.x - h, cell.y + h, h, polygon));\n cellQueue.push(new Cell(cell.x + h, cell.y + h, h, polygon));\n numProbes += 4;\n }\n\n if (debug) {\n console.log('num probes: ' + numProbes);\n console.log('best distance: ' + bestCell.d);\n }\n\n var poleOfInaccessibility = [bestCell.x, bestCell.y];\n poleOfInaccessibility.distance = bestCell.d;\n return poleOfInaccessibility;\n}\n\nfunction compareMax(a, b) {\n return b.max - a.max;\n}\n\nfunction Cell(x, y, h, polygon) {\n this.x = x; // cell center x\n this.y = y; // cell center y\n this.h = h; // half the cell size\n this.d = pointToPolygonDist(x, y, polygon); // distance from cell center to polygon\n this.max = this.d + this.h * Math.SQRT2; // max distance to polygon within a cell\n}\n\n// signed distance from point to polygon outline (negative if point is outside)\nfunction pointToPolygonDist(x, y, polygon) {\n var inside = false;\n var minDistSq = Infinity;\n\n for (var k = 0; k < polygon.length; k++) {\n var ring = polygon[k];\n\n for (var i = 0, len = ring.length, j = len - 1; i < len; j = i++) {\n var a = ring[i];\n var b = ring[j];\n\n if ((a[1] > y !== b[1] > y) &&\n (x < (b[0] - a[0]) * (y - a[1]) / (b[1] - a[1]) + a[0])) inside = !inside;\n\n minDistSq = Math.min(minDistSq, getSegDistSq(x, y, a, b));\n }\n }\n\n return minDistSq === 0 ? 0 : (inside ? 1 : -1) * Math.sqrt(minDistSq);\n}\n\n// get polygon centroid\nfunction getCentroidCell(polygon) {\n var area = 0;\n var x = 0;\n var y = 0;\n var points = polygon[0];\n\n for (var i = 0, len = points.length, j = len - 1; i < len; j = i++) {\n var a = points[i];\n var b = points[j];\n var f = a[0] * b[1] - b[0] * a[1];\n x += (a[0] + b[0]) * f;\n y += (a[1] + b[1]) * f;\n area += f * 3;\n }\n if (area === 0) return new Cell(points[0][0], points[0][1], 0, polygon);\n return new Cell(x / area, y / area, 0, polygon);\n}\n\n// get squared distance from a point to a segment\nfunction getSegDistSq(px, py, a, b) {\n\n var x = a[0];\n var y = a[1];\n var dx = b[0] - x;\n var dy = b[1] - y;\n\n if (dx !== 0 || dy !== 0) {\n\n var t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy);\n\n if (t > 1) {\n x = b[0];\n y = b[1];\n\n } else if (t > 0) {\n x += dx * t;\n y += dy * t;\n }\n }\n\n dx = px - x;\n dy = py - y;\n\n return dx * dx + dy * dy;\n}\n","function DEFAULT_COMPARE (a, b) { return a > b ? 1 : a < b ? -1 : 0; }\n\nexport default class SplayTree {\n\n constructor(compare = DEFAULT_COMPARE, noDuplicates = false) {\n this._compare = compare;\n this._root = null;\n this._size = 0;\n this._noDuplicates = !!noDuplicates;\n }\n\n\n rotateLeft(x) {\n var y = x.right;\n if (y) {\n x.right = y.left;\n if (y.left) y.left.parent = x;\n y.parent = x.parent;\n }\n\n if (!x.parent) this._root = y;\n else if (x === x.parent.left) x.parent.left = y;\n else x.parent.right = y;\n if (y) y.left = x;\n x.parent = y;\n }\n\n\n rotateRight(x) {\n var y = x.left;\n if (y) {\n x.left = y.right;\n if (y.right) y.right.parent = x;\n y.parent = x.parent;\n }\n\n if (!x.parent) this._root = y;\n else if(x === x.parent.left) x.parent.left = y;\n else x.parent.right = y;\n if (y) y.right = x;\n x.parent = y;\n }\n\n\n _splay(x) {\n while (x.parent) {\n var p = x.parent;\n if (!p.parent) {\n if (p.left === x) this.rotateRight(p);\n else this.rotateLeft(p);\n } else if (p.left === x && p.parent.left === p) {\n this.rotateRight(p.parent);\n this.rotateRight(p);\n } else if (p.right === x && p.parent.right === p) {\n this.rotateLeft(p.parent);\n this.rotateLeft(p);\n } else if (p.left === x && p.parent.right === p) {\n this.rotateRight(p);\n this.rotateLeft(p);\n } else {\n this.rotateLeft(p);\n this.rotateRight(p);\n }\n }\n }\n\n\n splay(x) {\n var p, gp, ggp, l, r;\n\n while (x.parent) {\n p = x.parent;\n gp = p.parent;\n\n if (gp && gp.parent) {\n ggp = gp.parent;\n if (ggp.left === gp) ggp.left = x;\n else ggp.right = x;\n x.parent = ggp;\n } else {\n x.parent = null;\n this._root = x;\n }\n\n l = x.left; r = x.right;\n\n if (x === p.left) { // left\n if (gp) {\n if (gp.left === p) {\n /* zig-zig */\n if (p.right) {\n gp.left = p.right;\n gp.left.parent = gp;\n } else gp.left = null;\n\n p.right = gp;\n gp.parent = p;\n } else {\n /* zig-zag */\n if (l) {\n gp.right = l;\n l.parent = gp;\n } else gp.right = null;\n\n x.left = gp;\n gp.parent = x;\n }\n }\n if (r) {\n p.left = r;\n r.parent = p;\n } else p.left = null;\n\n x.right = p;\n p.parent = x;\n } else { // right\n if (gp) {\n if (gp.right === p) {\n /* zig-zig */\n if (p.left) {\n gp.right = p.left;\n gp.right.parent = gp;\n } else gp.right = null;\n\n p.left = gp;\n gp.parent = p;\n } else {\n /* zig-zag */\n if (r) {\n gp.left = r;\n r.parent = gp;\n } else gp.left = null;\n\n x.right = gp;\n gp.parent = x;\n }\n }\n if (l) {\n p.right = l;\n l.parent = p;\n } else p.right = null;\n\n x.left = p;\n p.parent = x;\n }\n }\n }\n\n\n replace(u, v) {\n if (!u.parent) this._root = v;\n else if (u === u.parent.left) u.parent.left = v;\n else u.parent.right = v;\n if (v) v.parent = u.parent;\n }\n\n\n minNode(u = this._root) {\n if (u) while (u.left) u = u.left;\n return u;\n }\n\n\n maxNode(u = this._root) {\n if (u) while (u.right) u = u.right;\n return u;\n }\n\n\n insert(key, data) {\n var z = this._root;\n var p = null;\n var comp = this._compare;\n var cmp;\n\n if (this._noDuplicates) {\n while (z) {\n p = z;\n cmp = comp(z.key, key);\n if (cmp === 0) return;\n else if (comp(z.key, key) < 0) z = z.right;\n else z = z.left;\n }\n } else {\n while (z) {\n p = z;\n if (comp(z.key, key) < 0) z = z.right;\n else z = z.left;\n }\n }\n\n z = { key, data, left: null, right: null, parent: p };\n\n if (!p) this._root = z;\n else if (comp(p.key, z.key) < 0) p.right = z;\n else p.left = z;\n\n this.splay(z);\n this._size++;\n return z;\n }\n\n\n find (key) {\n var z = this._root;\n var comp = this._compare;\n while (z) {\n var cmp = comp(z.key, key);\n if (cmp < 0) z = z.right;\n else if (cmp > 0) z = z.left;\n else return z;\n }\n return null;\n }\n\n /**\n * Whether the tree contains a node with the given key\n * @param {Key} key\n * @return {boolean} true/false\n */\n contains (key) {\n var node = this._root;\n var comparator = this._compare;\n while (node) {\n var cmp = comparator(key, node.key);\n if (cmp === 0) return true;\n else if (cmp < 0) node = node.left;\n else node = node.right;\n }\n\n return false;\n }\n\n\n remove (key) {\n var z = this.find(key);\n\n if (!z) return false;\n\n this.splay(z);\n\n if (!z.left) this.replace(z, z.right);\n else if (!z.right) this.replace(z, z.left);\n else {\n var y = this.minNode(z.right);\n if (y.parent !== z) {\n this.replace(y, y.right);\n y.right = z.right;\n y.right.parent = y;\n }\n this.replace(z, y);\n y.left = z.left;\n y.left.parent = y;\n }\n\n this._size--;\n return true;\n }\n\n\n removeNode(z) {\n if (!z) return false;\n\n this.splay(z);\n\n if (!z.left) this.replace(z, z.right);\n else if (!z.right) this.replace(z, z.left);\n else {\n var y = this.minNode(z.right);\n if (y.parent !== z) {\n this.replace(y, y.right);\n y.right = z.right;\n y.right.parent = y;\n }\n this.replace(z, y);\n y.left = z.left;\n y.left.parent = y;\n }\n\n this._size--;\n return true;\n }\n\n\n erase (key) {\n var z = this.find(key);\n if (!z) return;\n\n this.splay(z);\n\n var s = z.left;\n var t = z.right;\n\n var sMax = null;\n if (s) {\n s.parent = null;\n sMax = this.maxNode(s);\n this.splay(sMax);\n this._root = sMax;\n }\n if (t) {\n if (s) sMax.right = t;\n else this._root = t;\n t.parent = sMax;\n }\n\n this._size--;\n }\n\n /**\n * Removes and returns the node with smallest key\n * @return {?Node}\n */\n pop () {\n var node = this._root, returnValue = null;\n if (node) {\n while (node.left) node = node.left;\n returnValue = { key: node.key, data: node.data };\n this.remove(node.key);\n }\n return returnValue;\n }\n\n\n /* eslint-disable class-methods-use-this */\n\n /**\n * Successor node\n * @param {Node} node\n * @return {?Node}\n */\n next (node) {\n var successor = node;\n if (successor) {\n if (successor.right) {\n successor = successor.right;\n while (successor && successor.left) successor = successor.left;\n } else {\n successor = node.parent;\n while (successor && successor.right === node) {\n node = successor; successor = successor.parent;\n }\n }\n }\n return successor;\n }\n\n\n /**\n * Predecessor node\n * @param {Node} node\n * @return {?Node}\n */\n prev (node) {\n var predecessor = node;\n if (predecessor) {\n if (predecessor.left) {\n predecessor = predecessor.left;\n while (predecessor && predecessor.right) predecessor = predecessor.right;\n } else {\n predecessor = node.parent;\n while (predecessor && predecessor.left === node) {\n node = predecessor;\n predecessor = predecessor.parent;\n }\n }\n }\n return predecessor;\n }\n /* eslint-enable class-methods-use-this */\n\n\n /**\n * @param {forEachCallback} callback\n * @return {SplayTree}\n */\n forEach(callback) {\n var current = this._root;\n var s = [], done = false, i = 0;\n\n while (!done) {\n // Reach the left most Node of the current Node\n if (current) {\n // Place pointer to a tree node on the stack\n // before traversing the node's left subtree\n s.push(current);\n current = current.left;\n } else {\n // BackTrack from the empty subtree and visit the Node\n // at the top of the stack; however, if the stack is\n // empty you are done\n if (s.length > 0) {\n current = s.pop();\n callback(current, i++);\n\n // We have visited the node and its left\n // subtree. Now, it's right subtree's turn\n current = current.right;\n } else done = true;\n }\n }\n return this;\n }\n\n\n /**\n * Walk key range from `low` to `high`. Stops if `fn` returns a value.\n * @param {Key} low\n * @param {Key} high\n * @param {Function} fn\n * @param {*?} ctx\n * @return {SplayTree}\n */\n range(low, high, fn, ctx) {\n const Q = [];\n const compare = this._compare;\n let node = this._root, cmp;\n\n while (Q.length !== 0 || node) {\n if (node) {\n Q.push(node);\n node = node.left;\n } else {\n node = Q.pop();\n cmp = compare(node.key, high);\n if (cmp > 0) {\n break;\n } else if (compare(node.key, low) >= 0) {\n if (fn.call(ctx, node)) return this; // stop if smth is returned\n }\n node = node.right;\n }\n }\n return this;\n }\n\n /**\n * Returns all keys in order\n * @return {Array<Key>}\n */\n keys () {\n var current = this._root;\n var s = [], r = [], done = false;\n\n while (!done) {\n if (current) {\n s.push(current);\n current = current.left;\n } else {\n if (s.length > 0) {\n current = s.pop();\n r.push(current.key);\n current = current.right;\n } else done = true;\n }\n }\n return r;\n }\n\n\n /**\n * Returns `data` fields of all nodes in order.\n * @return {Array<Value>}\n */\n values () {\n var current = this._root;\n var s = [], r = [], done = false;\n\n while (!done) {\n if (current) {\n s.push(current);\n current = current.left;\n } else {\n if (s.length > 0) {\n current = s.pop();\n r.push(current.data);\n current = current.right;\n } else done = true;\n }\n }\n return r;\n }\n\n\n /**\n * Returns node at given index\n * @param {number} index\n * @return {?Node}\n */\n at (index) {\n // removed after a consideration, more misleading than useful\n // index = index % this.size;\n // if (index < 0) index = this.size - index;\n\n var current = this._root;\n var s = [], done = false, i = 0;\n\n while (!done) {\n if (current) {\n s.push(current);\n current = current.left;\n } else {\n if (s.length > 0) {\n current = s.pop();\n if (i === index) return current;\n i++;\n current = current.right;\n } else done = true;\n }\n }\n return null;\n }\n\n /**\n * Bulk-load items. Both array have to be same size\n * @param {Array<Key>} keys\n * @param {Array<Value>} [values]\n * @param {Boolean} [presort=false] Pre-sort keys and values, using\n * tree's comparator. Sorting is done\n * in-place\n * @return {AVLTree}\n */\n load(keys = [], values = [], presort = false) {\n if (this._size !== 0) throw new Error('bulk-load: tree is not empty');\n const size = keys.length;\n if (presort) sort(keys, values, 0, size - 1, this._compare);\n this._root = loadRecursive(null, keys, values, 0, size);\n this._size = size;\n return this;\n }\n\n\n min() {\n var node = this.minNode(this._root);\n if (node) return node.key;\n else return null;\n }\n\n\n max() {\n var node = this.maxNode(this._root);\n if (node) return node.key;\n else return null;\n }\n\n isEmpty() { return this._root === null; }\n get size() { return this._size; }\n\n\n /**\n * Create a tree and load it with items\n * @param {Array<Key>} keys\n * @param {Array<Value>?} [values]\n\n * @param {Function?} [comparator]\n * @param {Boolean?} [presort=false] Pre-sort keys and values, using\n * tree's comparator. Sorting is done\n * in-place\n * @param {Boolean?} [noDuplicates=false] Allow duplicates\n * @return {SplayTree}\n */\n static createTree(keys, values, comparator, presort, noDuplicates) {\n return new SplayTree(comparator, noDuplicates).load(keys, values, presort);\n }\n}\n\n\nfunction loadRecursive (parent, keys, values, start, end) {\n const size = end - start;\n if (size > 0) {\n const middle = start + Math.floor(size / 2);\n const key = keys[middle];\n const data = values[middle];\n const node = { key, data, parent };\n node.left = loadRecursive(node, keys, values, start, middle);\n node.right = loadRecursive(node, keys, values, middle + 1, end);\n return node;\n }\n return null;\n}\n\n\nfunction sort(keys, values, left, right, compare) {\n if (left >= right) return;\n\n const pivot = keys[(left + right) >> 1];\n let i = left - 1;\n let j = right + 1;\n\n while (true) {\n do i++; while (compare(keys[i], pivot) < 0);\n do j--; while (compare(keys[j], pivot) > 0);\n if (i >= j) break;\n\n let tmp = keys[i];\n keys[i] = keys[j];\n keys[j] = tmp;\n\n tmp = values[i];\n values[i] = values[j];\n values[j] = tmp;\n }\n\n sort(keys, values, left, j, compare);\n sort(keys, values, j + 1, right, compare);\n}\n","import {\n NORMAL,\n SAME_TRANSITION,\n DIFFERENT_TRANSITION,\n NON_CONTRIBUTING\n} from './edge_type';\nimport {\n INTERSECTION,\n UNION,\n DIFFERENCE,\n XOR\n} from './operation';\n\n/**\n * @param {SweepEvent} event\n * @param {SweepEvent} prev\n * @param {Operation} operation\n */\nexport default function computeFields (event, prev, operation) {\n // compute inOut and otherInOut fields\n if (prev === null) {\n event.inOut = false;\n event.otherInOut = true;\n\n // previous line segment in sweepline belongs to the same polygon\n } else {\n if (event.isSubject === prev.isSubject) {\n event.inOut = !prev.inOut;\n event.otherInOut = prev.otherInOut;\n\n // previous line segment in sweepline belongs to the clipping polygon\n } else {\n event.inOut = !prev.otherInOut;\n event.otherInOut = prev.isVertical() ? !prev.inOut : prev.inOut;\n }\n\n // compute prevInResult field\n if (prev) {\n event.prevInResult = (!inResult(prev, operation) || prev.isVertical())\n ? prev.prevInResult : prev;\n }\n }\n\n // check if the line segment belongs to the Boolean operation\n let isInResult = inResult(event, operation);\n if (isInResult) {\n event.resultTransition = determineResultTransition(event, operation);\n } else {\n event.resultTransition = 0;\n }\n}\n\n\n/* eslint-disable indent */\nfunction inResult(event, operation) {\n switch (event.type) {\n case NORMAL:\n switch (operation) {\n case INTERSECTION:\n return !event.otherInOut;\n case UNION:\n return event.otherInOut;\n case DIFFERENCE:\n // return (event.isSubject && !event.otherInOut) ||\n // (!event.isSubject && event.otherInOut);\n return (event.isSubject && event.otherInOut) ||\n (!event.isSubject && !event.otherInOut);\n case XOR:\n return true;\n }\n break;\n case SAME_TRANSITION:\n return operation === INTERSECTION || operation === UNION;\n case DIFFERENT_TRANSITION:\n return operation === DIFFERENCE;\n case NON_CONTRIBUTING:\n return false;\n }\n return false;\n}\n/* eslint-enable indent */\n\n\nfunction determineResultTransition(event, operation) {\n let thisIn = !event.inOut;\n let thatIn = !event.otherInOut;\n\n let isIn;\n switch (operation) {\n case INTERSECTION:\n isIn = thisIn && thatIn; break;\n case UNION:\n isIn = thisIn || thatIn; break;\n case XOR:\n isIn = thisIn ^ thatIn; break;\n case DIFFERENCE:\n if (event.isSubject) {\n isIn = thisIn && !thatIn;\n } else {\n isIn = thatIn && !thisIn;\n }\n break;\n }\n return isIn ? +1 : -1;\n}\n","export const INTERSECTION = 0;\nexport const UNION = 1;\nexport const DIFFERENCE = 2;\nexport const XOR = 3;\n","export const NORMAL = 0;\nexport const NON_CONTRIBUTING = 1;\nexport const SAME_TRANSITION = 2;\nexport const DIFFERENT_TRANSITION = 3;\n","import { NORMAL } from './edge_type';\n\n\nexport default class SweepEvent {\n\n\n /**\n * Sweepline event\n *\n * @class {SweepEvent}\n * @param {Array.<Number>} point\n * @param {Boolean} left\n * @param {SweepEvent=} otherEvent\n * @param {Boolean} isSubject\n * @param {Number} edgeType\n */\n constructor (point, left, otherEvent, isSubject, edgeType) {\n\n /**\n * Is left endpoint?\n * @type {Boolean}\n */\n this.left = left;\n\n /**\n * @type {Array.<Number>}\n */\n this.point = point;\n\n /**\n * Other edge reference\n * @type {SweepEvent}\n */\n this.otherEvent = otherEvent;\n\n /**\n * Belongs to source or clipping polygon\n * @type {Boolean}\n */\n this.isSubject = isSubject;\n\n /**\n * Edge contribution type\n * @type {Number}\n */\n this.type = edgeType || NORMAL;\n\n\n /**\n * In-out transition for the sweepline crossing polygon\n * @type {Boolean}\n */\n this.inOut = false;\n\n\n /**\n * @type {Boolean}\n */\n this.otherInOut = false;\n\n /**\n * Previous event in result?\n * @type {SweepEvent}\n */\n this.prevInResult = null;\n\n /**\n * Type of result transition (0 = not in result, +1 = out-in, -1, in-out)\n * @type {Number}\n */\n this.resultTransition = 0;\n\n // connection step\n\n /**\n * @type {Number}\n */\n this.otherPos = -1;\n\n /**\n * @type {Number}\n */\n this.outputContourId = -1;\n\n this.isExteriorRing = true; // TODO: Looks unused, remove?\n }\n\n\n /**\n * @param {Array.<Number>} p\n * @return {Boolean}\n */\n isBelow (p) {\n const p0 = this.point, p1 = this.otherEvent.point;\n return this.left\n ? (p0[0] - p[0]) * (p1[1] - p[1]) - (p1[0] - p[0]) * (p0[1] - p[1]) > 0\n // signedArea(this.point, this.otherEvent.point, p) > 0 :\n : (p1[0] - p[0]) * (p0[1] - p[1]) - (p0[0] - p[0]) * (p1[1] - p[1]) > 0;\n //signedArea(this.otherEvent.point, this.point, p) > 0;\n }\n\n\n /**\n * @param {Array.<Number>} p\n * @return {Boolean}\n */\n isAbove (p) {\n return !this.isBelow(p);\n }\n\n\n /**\n * @return {Boolean}\n */\n isVertical () {\n return this.point[0] === this.otherEvent.point[0];\n }\n\n\n /**\n * Does event belong to result?\n * @return {Boolean}\n */\n get inResult() {\n return this.resultTransition !== 0;\n }\n\n\n clone () {\n const copy = new SweepEvent(\n this.point, this.left, this.otherEvent, this.isSubject, this.type);\n\n copy.contourId = this.contourId;\n copy.resultTransition = this.resultTransition;\n copy.prevInResult = this.prevInResult;\n copy.isExteriorRing = this.isExteriorRing;\n copy.inOut = this.inOut;\n copy.otherInOut = this.otherInOut;\n\n return copy;\n }\n}\n","export default function equals(p1, p2) {\n if (p1[0] === p2[0]) {\n if (p1[1] === p2[1]) {\n return true;\n } else {\n return false;\n }\n }\n return false;\n}\n\n// const EPSILON = 1e-9;\n// const abs = Math.abs;\n// TODO https://github.com/w8r/martinez/issues/6#issuecomment-262847164\n// Precision problem.\n//\n// module.exports = function equals(p1, p2) {\n// return abs(p1[0] - p2[0]) <= EPSILON && abs(p1[1] - p2[1]) <= EPSILON;\n// };\n","export const epsilon = 1.1102230246251565e-16;\nexport const splitter = 134217729;\nexport const resulterrbound = (3 + 8 * epsilon) * epsilon;\n\n// fast_expansion_sum_zeroelim routine from oritinal code\nexport function sum(elen, e, flen, f, h) {\n let Q, Qnew, hh, bvirt;\n let enow = e[0];\n let fnow = f[0];\n let eindex = 0;\n let findex = 0;\n if ((fnow > enow) === (fnow > -enow)) {\n Q = enow;\n enow = e[++eindex];\n } else {\n Q = fnow;\n fnow = f[++findex];\n }\n let hindex = 0;\n if (eindex < elen && findex < flen) {\n if ((fnow > enow) === (fnow > -enow)) {\n Qnew = enow + Q;\n hh = Q - (Qnew - enow);\n enow = e[++eindex];\n } else {\n Qnew = fnow + Q;\n hh = Q - (Qnew - fnow);\n fnow = f[++findex];\n }\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n while (eindex < elen && findex < flen) {\n if ((fnow > enow) === (fnow > -enow)) {\n Qnew = Q + enow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (enow - bvirt);\n enow = e[++eindex];\n } else {\n Qnew = Q + fnow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (fnow - bvirt);\n fnow = f[++findex];\n }\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n }\n while (eindex < elen) {\n Qnew = Q + enow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (enow - bvirt);\n enow = e[++eindex];\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n while (findex < flen) {\n Qnew = Q + fnow;\n bvirt = Qnew - Q;\n hh = Q - (Qnew - bvirt) + (fnow - bvirt);\n fnow = f[++findex];\n Q = Qnew;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n if (Q !== 0 || hindex === 0) {\n h[hindex++] = Q;\n }\n return hindex;\n}\n\nexport function sum_three(alen, a, blen, b, clen, c, tmp, out) {\n return sum(sum(alen, a, blen, b, tmp), tmp, clen, c, out);\n}\n\n// scale_expansion_zeroelim routine from oritinal code\nexport function scale(elen, e, b, h) {\n let Q, sum, hh, product1, product0;\n let bvirt, c, ahi, alo, bhi, blo;\n\n c = splitter * b;\n bhi = c - (c - b);\n blo = b - bhi;\n let enow = e[0];\n Q = enow * b;\n c = splitter * enow;\n ahi = c - (c - enow);\n alo = enow - ahi;\n hh = alo * blo - (Q - ahi * bhi - alo * bhi - ahi * blo);\n let hindex = 0;\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n for (let i = 1; i < elen; i++) {\n enow = e[i];\n product1 = enow * b;\n c = splitter * enow;\n ahi = c - (c - enow);\n alo = enow - ahi;\n product0 = alo * blo - (product1 - ahi * bhi - alo * bhi - ahi * blo);\n sum = Q + product0;\n bvirt = sum - Q;\n hh = Q - (sum - bvirt) + (product0 - bvirt);\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n Q = product1 + sum;\n hh = sum - (Q - product1);\n if (hh !== 0) {\n h[hindex++] = hh;\n }\n }\n if (Q !== 0 || hindex === 0) {\n h[hindex++] = Q;\n }\n return hindex;\n}\n\nexport function negate(elen, e) {\n for (let i = 0; i < elen; i++) e[i] = -e[i];\n return elen;\n}\n\nexport function estimate(elen, e) {\n let Q = e[0];\n for (let i = 1; i < elen; i++) Q += e[i];\n return Q;\n}\n\nexport function vec(n) {\n return new Float64Array(n);\n}\n","import {epsilon, splitter, resulterrbound, estimate, vec, sum} from './util.js';\n\nconst ccwerrboundA = (3 + 16 * epsilon) * epsilon;\nconst ccwerrboundB = (2 + 12 * epsilon) * epsilon;\nconst ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon;\n\nconst B = vec(4);\nconst C1 = vec(8);\nconst C2 = vec(12);\nconst D = vec(16);\nconst u = vec(4);\n\nfunction orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {\n let acxtail, acytail, bcxtail, bcytail;\n let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;\n\n const acx = ax - cx;\n const bcx = bx - cx;\n const acy = ay - cy;\n const bcy = by - cy;\n\n s1 = acx * bcy;\n c = splitter * acx;\n ahi = c - (c - acx);\n alo = acx - ahi;\n c = splitter * bcy;\n bhi = c - (c - bcy);\n blo = bcy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acy * bcx;\n c = splitter * acy;\n ahi = c - (c - acy);\n alo = acy - ahi;\n c = splitter * bcx;\n bhi = c - (c - bcx);\n blo = bcx - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n B[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n B[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n B[2] = _j - (u3 - bvirt) + (_i - bvirt);\n B[3] = u3;\n\n let det = estimate(4, B);\n let errbound = ccwerrboundB * detsum;\n if (det >= errbound || -det >= errbound) {\n return det;\n }\n\n bvirt = ax - acx;\n acxtail = ax - (acx + bvirt) + (bvirt - cx);\n bvirt = bx - bcx;\n bcxtail = bx - (bcx + bvirt) + (bvirt - cx);\n bvirt = ay - acy;\n acytail = ay - (acy + bvirt) + (bvirt - cy);\n bvirt = by - bcy;\n bcytail = by - (bcy + bvirt) + (bvirt - cy);\n\n if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {\n return det;\n }\n\n errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);\n det += (acx * bcytail + bcy * acxtail) - (acy * bcxtail + bcx * acytail);\n if (det >= errbound || -det >= errbound) return det;\n\n s1 = acxtail * bcy;\n c = splitter * acxtail;\n ahi = c - (c - acxtail);\n alo = acxtail - ahi;\n c = splitter * bcy;\n bhi = c - (c - bcy);\n blo = bcy - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acytail * bcx;\n c = splitter * acytail;\n ahi = c - (c - acytail);\n alo = acytail - ahi;\n c = splitter * bcx;\n bhi = c - (c - bcx);\n blo = bcx - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n const C1len = sum(4, B, 4, u, C1);\n\n s1 = acx * bcytail;\n c = splitter * acx;\n ahi = c - (c - acx);\n alo = acx - ahi;\n c = splitter * bcytail;\n bhi = c - (c - bcytail);\n blo = bcytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acy * bcxtail;\n c = splitter * acy;\n ahi = c - (c - acy);\n alo = acy - ahi;\n c = splitter * bcxtail;\n bhi = c - (c - bcxtail);\n blo = bcxtail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n const C2len = sum(C1len, C1, 4, u, C2);\n\n s1 = acxtail * bcytail;\n c = splitter * acxtail;\n ahi = c - (c - acxtail);\n alo = acxtail - ahi;\n c = splitter * bcytail;\n bhi = c - (c - bcytail);\n blo = bcytail - bhi;\n s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);\n t1 = acytail * bcxtail;\n c = splitter * acytail;\n ahi = c - (c - acytail);\n alo = acytail - ahi;\n c = splitter * bcxtail;\n bhi = c - (c - bcxtail);\n blo = bcxtail - bhi;\n t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);\n _i = s0 - t0;\n bvirt = s0 - _i;\n u[0] = s0 - (_i + bvirt) + (bvirt - t0);\n _j = s1 + _i;\n bvirt = _j - s1;\n _0 = s1 - (_j - bvirt) + (_i - bvirt);\n _i = _0 - t1;\n bvirt = _0 - _i;\n u[1] = _0 - (_i + bvirt) + (bvirt - t1);\n u3 = _j + _i;\n bvirt = u3 - _j;\n u[2] = _j - (u3 - bvirt) + (_i - bvirt);\n u[3] = u3;\n const Dlen = sum(C2len, C2, 4, u, D);\n\n return D[Dlen - 1];\n}\n\nexport function orient2d(ax, ay, bx, by, cx, cy) {\n const detleft = (ay - cy) * (bx - cx);\n const detright = (ax - cx) * (by - cy);\n const det = detleft - detright;\n\n if (detleft === 0 || detright === 0 || (detleft > 0) !== (detright > 0)) return det;\n\n const detsum = Math.abs(detleft + detright);\n if (Math.abs(det) >= ccwerrboundA * detsum) return det;\n\n return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);\n}\n\nexport function orient2dfast(ax, ay, bx, by, cx, cy) {\n return (ay - cy) * (bx - cx) - (ax - cx) * (by - cy);\n}\n","import {orient2d} from 'robust-predicates';\n\n/**\n * Signed area of the triangle (p0, p1, p2)\n * @param {Array.<Number>} p0\n * @param {Array.<Number>} p1\n * @param {Array.<Number>} p2\n * @return {Number}\n */\nexport default function signedArea(p0, p1, p2) {\n const res = orient2d(p0[0], p0[1], p1[0], p1[1], p2[0], p2[1]);\n if (res > 0) return -1;\n if (res < 0) return 1;\n return 0;\n}\n","import signedArea from './signed_area';\n\n/**\n * @param {SweepEvent} e1\n * @param {SweepEvent} e2\n * @return {Number}\n */\nexport default function compareEvents(e1, e2) {\n const p1 = e1.point;\n const p2 = e2.point;\n\n // Different x-coordinate\n if (p1[0] > p2[0]) return 1;\n if (p1[0] < p2[0]) return -1;\n\n // Different points, but same x-coordinate\n // Event with lower y-coordinate is processed first\n if (p1[1] !== p2[1]) return p1[1] > p2[1] ? 1 : -1;\n\n return specialCases(e1, e2, p1, p2);\n}\n\n\n/* eslint-disable no-unused-vars */\nfunction specialCases(e1, e2, p1, p2) {\n // Same coordinates, but one is a left endpoint and the other is\n // a right endpoint. The right endpoint is processed first\n if (e1.left !== e2.left)\n return e1.left ? 1 : -1;\n\n // const p2 = e1.otherEvent.point, p3 = e2.otherEvent.point;\n // const sa = (p1[0] - p3[0]) * (p2[1] - p3[1]) - (p2[0] - p3[0]) * (p1[1] - p3[1])\n // Same coordinates, both events\n // are left endpoints or right endpoints.\n // not collinear\n if (signedArea(p1, e1.otherEvent.point, e2.otherEvent.point) !== 0) {\n // the event associate to the bottom segment is processed first\n return (!e1.isBelow(e2.otherEvent.point)) ? 1 : -1;\n }\n\n return (!e1.isSubject && e2.isSubject) ? 1 : -1;\n}\n/* eslint-enable no-unused-vars */\n","import SweepEvent from './sweep_event';\nimport equals from './equals';\nimport compareEvents from './compare_events';\n\n/**\n * @param {SweepEvent} se\n * @param {Array.<Number>} p\n * @param {Queue} queue\n * @return {Queue}\n */\nexport default function divideSegment(se, p, queue) {\n const r = new SweepEvent(p, false, se, se.isSubject);\n const l = new SweepEvent(p, true, se.otherEvent, se.isSubject);\n\n /* eslint-disable no-console */\n if (equals(se.point, se.otherEvent.point)) {\n console.warn('what is that, a collapsed segment?', se);\n }\n /* eslint-enable no-console */\n\n r.contourId = l.contourId = se.contourId;\n\n // avoid a rounding error. The left event would be processed after the right event\n if (compareEvents(l, se.otherEvent) > 0) {\n se.otherEvent.left = true;\n l.left = false;\n }\n\n // avoid a rounding error. The left event would be processed after the right event\n // if (compareEvents(se, r) > 0) {}\n\n se.otherEvent.otherEvent = l;\n se.otherEvent = r;\n\n queue.push(l);\n queue.push(r);\n\n return queue;\n}\n","//const EPS = 1e-9;\n\n/**\n * Finds the magnitude of the cross product of two vectors (if we pretend\n * they're in three dimensions)\n *\n * @param {Object} a First vector\n * @param {Object} b Second vector\n * @private\n * @returns {Number} The magnitude of the cross product\n */\nfunction crossProduct(a, b) {\n return (a[0] * b[1]) - (a[1] * b[0]);\n}\n\n/**\n * Finds the dot product of two vectors.\n *\n * @param {Object} a First vector\n * @param {Object} b Second vector\n * @private\n * @returns {Number} The dot product\n */\nfunction dotProduct(a, b) {\n return (a[0] * b[0]) + (a[1] * b[1]);\n}\n\n/**\n * Finds the intersection (if any) between two line segments a and b, given the\n * line segments' end points a1, a2 and b1, b2.\n *\n * This algorithm is based on Schneider and Eberly.\n * http://www.cimec.org.ar/~ncalvo/Schneider_Eberly.pdf\n * Page 244.\n *\n * @param {Array.<Number>} a1 point of first line\n * @param {Array.<Number>} a2 point of first line\n * @param {Array.<Number>} b1 point of second line\n * @param {Array.<Number>} b2 point of second line\n * @param {Boolean=} noEndpointTouch whether to skip single touchpoints\n * (meaning connected segments) as\n * intersections\n * @returns {Array.<Array.<Number>>|Null} If the lines intersect, the point of\n * intersection. If they overlap, the two end points of the overlapping segment.\n * Otherwise, null.\n */\nexport default function (a1, a2, b1, b2, noEndpointTouch) {\n // The algorithm expects our lines in the form P + sd, where P is a point,\n // s is on the interval [0, 1], and d is a vector.\n // We are passed two points. P can be the first point of each pair. The\n // vector, then, could be thought of as the distance (in x and y components)\n // from the first point to the second point.\n // So first, let's make our vectors:\n const va = [a2[0] - a1[0], a2[1] - a1[1]];\n const vb = [b2[0] - b1[0], b2[1] - b1[1]];\n // We also define a function to convert back to regular point form:\n\n /* eslint-disable arrow-body-style */\n\n function toPoint(p, s, d) {\n return [\n p[0] + s * d[0],\n p[1] + s * d[1]\n ];\n }\n\n /* eslint-enable arrow-body-style */\n\n // The rest is pretty much a straight port of the algorithm.\n const e = [b1[0] - a1[0], b1[1] - a1[1]];\n let kross = crossProduct(va, vb);\n let sqrKross = kross * kross;\n const sqrLenA = dotProduct(va, va);\n //const sqrLenB = dotProduct(vb, vb);\n\n // Check for line intersection. This works because of the properties of the\n // cross product -- specifically, two vectors are parallel if and only if the\n // cross product is the 0 vector. The full calculation involves relative error\n // to account for possible very small line segments. See Schneider & Eberly\n // for details.\n if (sqrKross > 0/* EPS * sqrLenB * sqLenA */) {\n // If they're not parallel, then (because these are line segments) they\n // still might not actually intersect. This code checks that the\n // intersection point of the lines is actually on both line segments.\n const s = crossProduct(e, vb) / kross;\n if (s < 0 || s > 1) {\n // not on line segment a\n return null;\n }\n const t = crossProduct(e, va) / kross;\n if (t < 0 || t > 1) {\n // not on line segment b\n return null;\n }\n if (s === 0 || s === 1) {\n // on an endpoint of line segment a\n return noEndpointTouch ? null : [toPoint(a1, s, va)];\n }\n if (t === 0 || t === 1) {\n // on an endpoint of line segment b\n return noEndpointTouch ? null : [toPoint(b1, t, vb)];\n }\n return [toPoint(a1, s, va)];\n }\n\n // If we've reached this point, then the lines are either parallel or the\n // same, but the segments could overlap partially or fully, or not at all.\n // So we need to find the overlap, if any. To do that, we can use e, which is\n // the (vector) difference between the two initial points. If this is parallel\n // with the line itself, then the two lines are the same line, and there will\n // be overlap.\n //const sqrLenE = dotProduct(e, e);\n kross = crossProduct(e, va);\n sqrKross = kross * kross;\n\n if (sqrKross > 0 /* EPS * sqLenB * sqLenE */) {\n // Lines are just parallel, not the same. No overlap.\n return null;\n }\n\n const sa = dotProduct(va, e) / sqrLenA;\n const sb = sa + dotProduct(va, vb) / sqrLenA;\n const smin = Math.min(sa, sb);\n const smax = Math.max(sa, sb);\n\n // this is, essentially, the FindIntersection acting on floats from\n // Schneider & Eberly, just inlined into this function.\n if (smin <= 1 && smax >= 0) {\n\n // overlap on an end point\n if (smin === 1) {\n return noEndpointTouch ? null : [toPoint(a1, smin > 0 ? smin : 0, va)];\n }\n\n if (smax === 0) {\n return noEndpointTouch ? null : [toPoint(a1, smax < 1 ? smax : 1, va)];\n }\n\n if (noEndpointTouch && smin === 0 && smax === 1) return null;\n\n // There's overlap on a segment -- two points of intersection. Return both.\n return [\n toPoint(a1, smin > 0 ? smin : 0, va),\n toPoint(a1, smax < 1 ? smax : 1, va)\n ];\n }\n\n return null;\n}\n","import divideSegment from './divide_segment';\nimport intersection from './segment_intersection';\nimport equals from './equals';\nimport compareEvents from './compare_events';\nimport {\n NON_CONTRIBUTING,\n SAME_TRANSITION,\n DIFFERENT_TRANSITION\n} from './edge_type';\n\n/**\n * @param {SweepEvent} se1\n * @param {SweepEvent} se2\n * @param {Queue} queue\n * @return {Number}\n */\nexport default function possibleIntersection (se1, se2, queue) {\n // that disallows self-intersecting polygons,\n // did cost us half a day, so I'll leave it\n // out of respect\n // if (se1.isSubject === se2.isSubject) return;\n const inter = intersection(\n se1.point, se1.otherEvent.point,\n se2.point, se2.otherEvent.point\n );\n\n const nintersections = inter ? inter.length : 0;\n if (nintersections === 0) return 0; // no intersection\n\n // the line segments intersect at an endpoint of both line segments\n if ((nintersections === 1) &&\n (equals(se1.point, se2.point) ||\n equals(se1.otherEvent.point, se2.otherEvent.point))) {\n return 0;\n }\n\n if (nintersections === 2 && se1.isSubject === se2.isSubject) {\n // if(se1.contourId === se2.contourId){\n // console.warn('Edges of the same polygon overlap',\n // se1.point, se1.otherEvent.point, se2.point, se2.otherEvent.point);\n // }\n //throw new Error('Edges of the same polygon overlap');\n return 0;\n }\n\n // The line segments associated to se1 and se2 intersect\n if (nintersections === 1) {\n\n // if the intersection point is not an endpoint of se1\n if (!equals(se1.point, inter[0]) && !equals(se1.otherEvent.point, inter[0])) {\n divideSegment(se1, inter[0], queue);\n }\n\n // if the intersection point is not an endpoint of se2\n if (!equals(se2.point, inter[0]) && !equals(se2.otherEvent.point, inter[0])) {\n divideSegment(se2, inter[0], queue);\n }\n return 1;\n }\n\n // The line segments associated to se1 and se2 overlap\n const events = [];\n let leftCoincide = false;\n let rightCoincide = false;\n\n if (equals(se1.point, se2.point)) {\n leftCoincide = true; // linked\n } else if (compareEvents(se1, se2) === 1) {\n events.push(se2, se1);\n } else {\n events.push(se1, se2);\n }\n\n if (equals(se1.otherEvent.point, se2.otherEvent.point)) {\n rightCoincide = true;\n } else if (compareEvents(se1.otherEvent, se2.otherEvent) === 1) {\n events.push(se2.otherEvent, se1.otherEvent);\n } else {\n events.push(se1.otherEvent, se2.otherEvent);\n }\n\n if ((leftCoincide && rightCoincide) || leftCoincide) {\n // both line segments are equal or share the left endpoint\n se2.type = NON_CONTRIBUTING;\n se1.type = (se2.inOut === se1.inOut)\n ? SAME_TRANSITION : DIFFERENT_TRANSITION;\n\n if (leftCoincide && !rightCoincide) {\n // honestly no idea, but changing events selection from [2, 1]\n // to [0, 1] fixes the overlapping self-intersecting polygons issue\n divideSegment(events[1].otherEvent, events[0].point, queue);\n }\n return 2;\n }\n\n // the line segments share the right endpoint\n if (rightCoincide) {\n divideSegment(events[0], events[1].point, queue);\n return 3;\n }\n\n // no line segment includes totally the other one\n if (events[0] !== events[3].otherEvent) {\n divideSegment(events[0], events[1].point, queue);\n divideSegment(events[1], events[2].point, queue);\n return 3;\n }\n\n // one line segment includes the other one\n divideSegment(events[0], events[1].point, queue);\n divideSegment(events[3].otherEvent, events[2].point, queue);\n\n return 3;\n}\n","import signedArea from './signed_area';\nimport compareEvents from './compare_events';\nimport equals from './equals';\n\n\n/**\n * @param {SweepEvent} le1\n * @param {SweepEvent} le2\n * @return {Number}\n */\nexport default function compareSegments(le1, le2) {\n if (le1 === le2) return 0;\n\n // Segments are not collinear\n if (signedArea(le1.point, le1.otherEvent.point, le2.point) !== 0 ||\n signedArea(le1.point, le1.otherEvent.point, le2.otherEvent.point) !== 0) {\n\n // If they share their left endpoint use the right endpoint to sort\n if (equals(le1.point, le2.point)) return le1.isBelow(le2.otherEvent.point) ? -1 : 1;\n\n // Different left endpoint: use the left endpoint to sort\n if (le1.point[0] === le2.point[0]) return le1.point[1] < le2.point[1] ? -1 : 1;\n\n // has the line segment associated to e1 been inserted\n // into S after the line segment associated to e2 ?\n if (compareEvents(le1, le2) === 1) return le2.isAbove(le1.point) ? -1 : 1;\n\n // The line segment associated to e2 has been inserted\n // into S after the line segment associated to e1\n return le1.isBelow(le2.point) ? -1 : 1;\n }\n\n if (le1.isSubject === le2.isSubject) { // same polygon\n let p1 = le1.point, p2 = le2.point;\n if (p1[0] === p2[0] && p1[1] === p2[1]/*equals(le1.point, le2.point)*/) {\n p1 = le1.otherEvent.point; p2 = le2.otherEvent.point;\n if (p1[0] === p2[0] && p1[1] === p2[1]) return 0;\n else return le1.contourId > le2.contourId ? 1 : -1;\n }\n } else { // Segments are collinear, but belong to separate polygons\n return le1.isSubject ? -1 : 1;\n }\n\n return compareEvents(le1, le2) === 1 ? 1 : -1;\n}\n","export default class Contour {\n\n /**\n * Contour\n *\n * @class {Contour}\n */\n constructor() {\n this.points = [];\n this.holeIds = [];\n this.holeOf = null;\n this.depth = null;\n }\n\n isExterior() {\n return this.holeOf == null;\n }\n\n}\n","import compareEvents from './compare_events';\nimport Contour from './contour';\n\n/**\n * @param {Array.<SweepEvent>} sortedEvents\n * @return {Array.<SweepEvent>}\n */\nfunction orderEvents(sortedEvents) {\n let event, i, len, tmp;\n const resultEvents = [];\n for (i = 0, len = sortedEvents.length; i < len; i++) {\n event = sortedEvents[i];\n if ((event.left && event.inResult) ||\n (!event.left && event.otherEvent.inResult)) {\n resultEvents.push(event);\n }\n }\n // Due to overlapping edges the resultEvents array can be not wholly sorted\n let sorted = false;\n while (!sorted) {\n sorted = true;\n for (i = 0, len = resultEvents.length; i < len; i++) {\n if ((i + 1) < len &&\n compareEvents(resultEvents[i], resultEvents[i + 1]) === 1) {\n tmp = resultEvents[i];\n resultEvents[i] = resultEvents[i + 1];\n resultEvents[i + 1] = tmp;\n sorted = false;\n }\n }\n }\n\n\n for (i = 0, len = resultEvents.length; i < len; i++) {\n event = resultEvents[i];\n event.otherPos = i;\n }\n\n // imagine, the right event is found in the beginning of the queue,\n // when his left counterpart is not marked yet\n for (i = 0, len = resultEvents.length; i < len; i++) {\n event = resultEvents[i];\n if (!event.left) {\n tmp = event.otherPos;\n event.otherPos = event.otherEvent.otherPos;\n event.otherEvent.otherPos = tmp;\n }\n }\n\n return resultEvents;\n}\n\n\n/**\n * @param {Number} pos\n * @param {Array.<SweepEvent>} resultEvents\n * @param {Object>} processed\n * @return {Number}\n */\nfunction nextPos(pos, resultEvents, processed, origPos) {\n let newPos = pos + 1,\n p = resultEvents[pos].point,\n p1;\n const length = resultEvents.length;\n\n if (newPos < length)\n p1 = resultEvents[newPos].point;\n\n while (newPos < length && p1[0] === p[0] && p1[1] === p[1]) {\n if (!processed[newPos]) {\n return newPos;\n } else {\n newPos++;\n }\n p1 = resultEvents[newPos].point;\n }\n\n newPos = pos - 1;\n\n while (processed[newPos] && newPos > origPos) {\n newPos--;\n }\n\n return newPos;\n}\n\n\nfunction initializeContourFromContext(event, contours, contourId) {\n const contour = new Contour();\n if (event.prevInResult != null) {\n const prevInResult = event.prevInResult;\n // Note that it is valid to query the \"previous in result\" for its output contour id,\n // because we must have already processed it (i.e., assigned an output contour id)\n // in an earlier iteration, otherwise it wouldn't be possible that it is \"previous in\n // result\".\n const lowerContourId = prevInResult.outputContourId;\n const lowerResultTransition = prevInResult.resultTransition;\n if (lowerResultTransition > 0) {\n // We are inside. Now we have to check if the thing below us is another hole or\n // an exterior contour.\n const lowerContour = contours[lowerContourId];\n if (lowerContour.holeOf != null) {\n // The lower contour is a hole => Connect the new contour as a hole to its parent,\n // and use same depth.\n const parentContourId = lowerContour.holeOf;\n contours[parentContourId].holeIds.push(contourId);\n contour.holeOf = parentContourId;\n contour.depth = contours[lowerContourId].depth;\n } else {\n // The lower contour is an exterior contour => Connect the new contour as a hole,\n // and increment depth.\n contours[lowerContourId].holeIds.push(contourId);\n contour.holeOf = lowerContourId;\n contour.depth = contours[lowerContourId].depth + 1;\n }\n } else {\n // We are outside => this contour is an exterior contour of same depth.\n contour.holeOf = null;\n contour.depth = contours[lowerContourId].depth;\n }\n } else {\n // There is no lower/previous contour => this contour is an exterior contour of depth 0.\n contour.holeOf = null;\n contour.depth = 0;\n }\n return contour;\n}\n\n/**\n * @param {Array.<SweepEvent>} sortedEvents\n * @return {Array.<*>} polygons\n */\nexport default function connectEdges(sortedEvents) {\n let i, len;\n const resultEvents = orderEvents(sortedEvents);\n\n // \"false\"-filled array\n const processed = {};\n const contours = [];\n\n for (i = 0, len = resultEvents.length; i < len; i++) {\n\n if (processed[i]) {\n continue;\n }\n\n const contourId = contours.length;\n const contour = initializeContourFromContext(resultEvents[i], contours, contourId);\n\n // Helper function that combines marking an event as processed with assigning its output contour ID\n const markAsProcessed = (pos) => {\n processed[pos] = true;\n resultEvents[pos].outputContourId = contourId;\n };\n\n let pos = i;\n let origPos = i;\n\n const initial = resultEvents[i].point;\n contour.points.push(initial);\n\n /* eslint no-constant-condition: \"off\" */\n while (true) {\n markAsProcessed(pos);\n\n pos = resultEvents[pos].otherPos;\n\n markAsProcessed(pos);\n contour.points.push(resultEvents[pos].point);\n\n pos = nextPos(pos, resultEvents, processed, origPos);\n\n if (pos == origPos) {\n break;\n }\n }\n\n contours.push(contour);\n }\n\n return contours;\n}\n","'use strict';\n\nmodule.exports = TinyQueue;\nmodule.exports.default = TinyQueue;\n\nfunction TinyQueue(data, compare) {\n if (!(this instanceof TinyQueue)) return new TinyQueue(data, compare);\n\n this.data = data || [];\n this.length = this.data.length;\n this.compare = compare || defaultCompare;\n\n if (this.length > 0) {\n for (var i = (this.length >> 1) - 1; i >= 0; i--) this._down(i);\n }\n}\n\nfunction defaultCompare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\nTinyQueue.prototype = {\n\n push: function (item) {\n this.data.push(item);\n this.length++;\n this._up(this.length - 1);\n },\n\n pop: function () {\n if (this.length === 0) return undefined;\n\n var top = this.data[0];\n this.length--;\n\n if (this.length > 0) {\n this.data[0] = this.data[this.length];\n this._down(0);\n }\n this.data.pop();\n\n return top;\n },\n\n peek: function () {\n return this.data[0];\n },\n\n _up: function (pos) {\n var data = this.data;\n var compare = this.compare;\n var item = data[pos];\n\n while (pos > 0) {\n var parent = (pos - 1) >> 1;\n var current = data[parent];\n if (compare(item, current) >= 0) break;\n data[pos] = current;\n pos = parent;\n }\n\n data[pos] = item;\n },\n\n _down: function (pos) {\n var data = this.data;\n var compare = this.compare;\n var halfLength = this.length >> 1;\n var item = data[pos];\n\n while (pos < halfLength) {\n var left = (pos << 1) + 1;\n var right = left + 1;\n var best = data[left];\n\n if (right < this.length && compare(data[right], best) < 0) {\n left = right;\n best = data[right];\n }\n if (compare(best, item) >= 0) break;\n\n data[pos] = best;\n pos = left;\n }\n\n data[pos] = item;\n }\n};\n","import Queue from 'tinyqueue';\nimport SweepEvent from './sweep_event';\nimport compareEvents from './compare_events';\nimport { DIFFERENCE } from './operation';\n\nconst max = Math.max;\nconst min = Math.min;\n\nlet contourId = 0;\n\n\nfunction processPolygon(contourOrHole, isSubject, depth, Q, bbox, isExteriorRing) {\n let i, len, s1, s2, e1, e2;\n for (i = 0, len = contourOrHole.length - 1; i < len; i++) {\n s1 = contourOrHole[i];\n s2 = contourOrHole[i + 1];\n e1 = new SweepEvent(s1, false, undefined, isSubject);\n e2 = new SweepEvent(s2, false, e1, isSubject);\n e1.otherEvent = e2;\n\n if (s1[0] === s2[0] && s1[1] === s2[1]) {\n continue; // skip collapsed edges, or it breaks\n }\n\n e1.contourId = e2.contourId = depth;\n if (!isExteriorRing) {\n e1.isExteriorRing = false;\n e2.isExteriorRing = false;\n }\n if (compareEvents(e1, e2) > 0) {\n e2.left = true;\n } else {\n e1.left = true;\n }\n\n const x = s1[0], y = s1[1];\n bbox[0] = min(bbox[0], x);\n bbox[1] = min(bbox[1], y);\n bbox[2] = max(bbox[2], x);\n bbox[3] = max(bbox[3], y);\n\n // Pushing it so the queue is sorted from left to right,\n // with object on the left having the highest priority.\n Q.push(e1);\n Q.push(e2);\n }\n}\n\n\nexport default function fillQueue(subject, clipping, sbbox, cbbox, operation) {\n const eventQueue = new Queue(null, compareEvents);\n let polygonSet, isExteriorRing, i, ii, j, jj; //, k, kk;\n\n for (i = 0, ii = subject.length; i < ii; i++) {\n polygonSet = subject[i];\n for (j = 0, jj = polygonSet.length; j < jj; j++) {\n isExteriorRing = j === 0;\n if (isExteriorRing) contourId++;\n processPolygon(polygonSet[j], true, contourId, eventQueue, sbbox, isExteriorRing);\n }\n }\n\n for (i = 0, ii = clipping.length; i < ii; i++) {\n polygonSet = clipping[i];\n for (j = 0, jj = polygonSet.length; j < jj; j++) {\n isExteriorRing = j === 0;\n if (operation === DIFFERENCE) isExteriorRing = false;\n if (isExteriorRing) contourId++;\n processPolygon(polygonSet[j], false, contourId, eventQueue, cbbox, isExteriorRing);\n }\n }\n\n return eventQueue;\n}\n","import subdivideSegments from './subdivide_segments';\nimport connectEdges from './connect_edges';\nimport fillQueue from './fill_queue';\nimport {\n INTERSECTION,\n DIFFERENCE,\n UNION,\n XOR\n} from './operation';\n\nconst EMPTY = [];\n\n\nfunction trivialOperation(subject, clipping, operation) {\n let result = null;\n if (subject.length * clipping.length === 0) {\n if (operation === INTERSECTION) {\n result = EMPTY;\n } else if (operation === DIFFERENCE) {\n result = subject;\n } else if (operation === UNION ||\n operation === XOR) {\n result = (subject.length === 0) ? clipping : subject;\n }\n }\n return result;\n}\n\n\nfunction compareBBoxes(subject, clipping, sbbox, cbbox, operation) {\n let result = null;\n if (sbbox[0] > cbbox[2] ||\n cbbox[0] > sbbox[2] ||\n sbbox[1] > cbbox[3] ||\n cbbox[1] > sbbox[3]) {\n if (operation === INTERSECTION) {\n result = EMPTY;\n } else if (operation === DIFFERENCE) {\n result = subject;\n } else if (operation === UNION ||\n operation === XOR) {\n result = subject.concat(clipping);\n }\n }\n return result;\n}\n\n\nexport default function boolean(subject, clipping, operation) {\n if (typeof subject[0][0][0] === 'number') {\n subject = [subject];\n }\n if (typeof clipping[0][0][0] === 'number') {\n clipping = [clipping];\n }\n let trivial = trivialOperation(subject, clipping, operation);\n if (trivial) {\n return trivial === EMPTY ? null : trivial;\n }\n const sbbox = [Infinity, Infinity, -Infinity, -Infinity];\n const cbbox = [Infinity, Infinity, -Infinity, -Infinity];\n\n // console.time('fill queue');\n const eventQueue = fillQueue(subject, clipping, sbbox, cbbox, operation);\n //console.timeEnd('fill queue');\n\n trivial = compareBBoxes(subject, clipping, sbbox, cbbox, operation);\n if (trivial) {\n return trivial === EMPTY ? null : trivial;\n }\n // console.time('subdivide edges');\n const sortedEvents = subdivideSegments(eventQueue, subject, clipping, sbbox, cbbox, operation);\n //console.timeEnd('subdivide edges');\n\n // console.time('connect vertices');\n const contours = connectEdges(sortedEvents, operation);\n //console.timeEnd('connect vertices');\n\n // Convert contours to polygons\n const polygons = [];\n for (let i = 0; i < contours.length; i++) {\n let contour = contours[i];\n if (contour.isExterior()) {\n // The exterior ring goes first\n let rings = [contour.points];\n // Followed by holes if any\n for (let j = 0; j < contour.holeIds.length; j++) {\n let holeId = contour.holeIds[j];\n rings.push(contours[holeId].points);\n }\n polygons.push(rings);\n }\n }\n\n return polygons;\n}\n","import Tree from 'splaytree';\nimport computeFields from './compute_fields';\nimport possibleIntersection from './possible_intersection';\nimport compareSegments from './compare_segments';\nimport {\n INTERSECTION,\n DIFFERENCE\n} from './operation';\n\n\nexport default function subdivide(eventQueue, subject, clipping, sbbox, cbbox, operation) {\n const sweepLine = new Tree(compareSegments);\n const sortedEvents = [];\n\n const rightbound = Math.min(sbbox[2], cbbox[2]);\n\n let prev, next, begin;\n\n while (eventQueue.length !== 0) {\n let event = eventQueue.pop();\n sortedEvents.push(event);\n\n // optimization by bboxes for intersection and difference goes here\n if ((operation === INTERSECTION && event.point[0] > rightbound) ||\n (operation === DIFFERENCE && event.point[0] > sbbox[2])) {\n break;\n }\n\n if (event.left) {\n next = prev = sweepLine.insert(event);\n begin = sweepLine.minNode();\n\n if (prev !== begin) prev = sweepLine.prev(prev);\n else prev = null;\n\n next = sweepLine.next(next);\n\n const prevEvent = prev ? prev.key : null;\n let prevprevEvent;\n computeFields(event, prevEvent, operation);\n if (next) {\n if (possibleIntersection(event, next.key, eventQueue) === 2) {\n computeFields(event, prevEvent, operation);\n computeFields(event, next.key, operation);\n }\n }\n\n if (prev) {\n if (possibleIntersection(prev.key, event, eventQueue) === 2) {\n let prevprev = prev;\n if (prevprev !== begin) prevprev = sweepLine.prev(prevprev);\n else prevprev = null;\n\n prevprevEvent = prevprev ? prevprev.key : null;\n computeFields(prevEvent, prevprevEvent, operation);\n computeFields(event, prevEvent, operation);\n }\n }\n } else {\n event = event.otherEvent;\n next = prev = sweepLine.find(event);\n\n if (prev && next) {\n\n if (prev !== begin) prev = sweepLine.prev(prev);\n else prev = null;\n\n next = sweepLine.next(next);\n sweepLine.remove(event);\n\n if (next && prev) {\n possibleIntersection(prev.key, next.key, eventQueue);\n }\n }\n }\n }\n return sortedEvents;\n}\n","import earcut from \"earcut\";\nimport polylabel from \"polylabel\";\nimport * as martinez from \"martinez-polygon-clipping\";\nimport * as THREE from \"three\";\n\nimport { Geometry } from \"./Geometry\";\nimport { Transform } from \"../../../geo/Transform\";\n\n/**\n * @class VertexGeometry\n * @abstract\n * @classdesc Represents a vertex geometry.\n */\nexport abstract class VertexGeometry extends Geometry {\n\n private _subsampleThreshold: number;\n\n /**\n * Create a vertex geometry.\n *\n * @constructor\n * @ignore\n */\n constructor() {\n super();\n\n this._subsampleThreshold = 0.005;\n\n }\n\n /**\n * Get the 3D coordinates for the vertices of the geometry with possibly\n * subsampled points along the lines.\n *\n * @param {Transform} transform - The transform of the image related to\n * the geometry.\n * @returns {Array<Array<number>>} Polygon array of 3D world coordinates\n * representing the geometry.\n * @ignore\n */\n public abstract getPoints3d(transform: Transform): number[][];\n\n /**\n * Get the polygon pole of inaccessibility, the most\n * distant internal point from the polygon outline.\n *\n * @returns {Array<number>} 2D basic coordinates for the pole of inaccessibility.\n * @ignore\n */\n public abstract getPoleOfInaccessibility2d(): number[];\n\n /**\n * Get the polygon pole of inaccessibility, the most\n * distant internal point from the polygon outline.\n *\n * @param transform - The transform of the image related to\n * the geometry.\n * @returns {Array<number>} 3D world coordinates for the pole of inaccessibility.\n * @ignore\n */\n public abstract getPoleOfInaccessibility3d(transform: Transform): number[];\n\n /**\n * Get the coordinates of a vertex from the polygon representation of the geometry.\n *\n * @param {number} index - Vertex index.\n * @returns {Array<number>} Array representing the 2D basic coordinates of the vertex.\n * @ignore\n */\n public abstract getVertex2d(index: number): number[];\n\n /**\n * Get a vertex from the polygon representation of the 3D coordinates for the\n * vertices of the geometry.\n *\n * @param {number} index - Vertex index.\n * @param {Transform} transform - The transform of the image related to the geometry.\n * @returns {Array<number>} Array representing the 3D world coordinates of the vertex.\n * @ignore\n */\n public abstract getVertex3d(index: number, transform: Transform): number[];\n\n /**\n * Get a polygon representation of the 2D basic coordinates for the vertices of the geometry.\n *\n * @returns {Array<Array<number>>} Polygon array of 2D basic coordinates representing\n * the vertices of the geometry.\n * @ignore\n */\n public abstract getVertices2d(): number[][];\n\n /**\n * Get a polygon representation of the 3D world coordinates for the vertices of the geometry.\n *\n * @param {Transform} transform - The transform of the image related to the geometry.\n * @returns {Array<Array<number>>} Polygon array of 3D world coordinates representing\n * the vertices of the geometry.\n * @ignore\n */\n public abstract getVertices3d(transform: Transform): number[][];\n\n /**\n * Get a flattend array of the 3D world coordinates for the\n * triangles filling the geometry.\n *\n * @param {Transform} transform - The transform of the image related to the geometry.\n * @returns {Array<number>} Flattened array of 3D world coordinates of the triangles.\n * @ignore\n */\n public abstract getTriangles3d(transform: Transform): number[];\n\n /**\n * Set the value of a vertex in the polygon representation of the geometry.\n *\n * @description The polygon is defined to have the first vertex at the\n * bottom-left corner with the rest of the vertices following in clockwise order.\n *\n * @param {number} index - The index of the vertex to be set.\n * @param {Array<number>} value - The new value of the vertex.\n * @param {Transform} transform - The transform of the image related to the geometry.\n * @ignore\n */\n public abstract setVertex2d(index: number, value: number[], transform: Transform): void;\n\n /**\n * Finds the polygon pole of inaccessibility, the most distant internal\n * point from the polygon outline.\n *\n * @param {Array<Array<number>>} points2d - 2d points of outline to triangulate.\n * @returns {Array<number>} Point of inaccessibility.\n * @ignore\n */\n protected _getPoleOfInaccessibility2d(points2d: number[][]): number[] {\n let pole2d: number[] = polylabel([points2d], 3e-2);\n\n return pole2d;\n }\n\n protected _project(points2d: number[][], transform: Transform): number[][] {\n const camera: THREE.Camera = this._createCamera(\n transform.upVector().toArray(),\n transform.unprojectSfM([0, 0], 0),\n transform.unprojectSfM([0, 0], 10));\n\n return this._deunproject(\n points2d,\n transform,\n camera);\n }\n\n protected _subsample(points2d: number[][], threshold: number = this._subsampleThreshold): number[][] {\n const subsampled: number[][] = [];\n const length: number = points2d.length;\n\n for (let index: number = 0; index < length; index++) {\n const p1: number[] = points2d[index];\n const p2: number[] = points2d[(index + 1) % length];\n\n subsampled.push(p1);\n\n const dist: number = Math.sqrt((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2);\n const subsamples: number = Math.floor(dist / threshold);\n const coeff: number = 1 / (subsamples + 1);\n\n for (let i: number = 1; i <= subsamples; i++) {\n const alpha: number = i * coeff;\n\n const subsample: number[] = [\n (1 - alpha) * p1[0] + alpha * p2[0],\n (1 - alpha) * p1[1] + alpha * p2[1],\n ];\n\n subsampled.push(subsample);\n }\n }\n\n return subsampled;\n }\n\n /**\n * Triangulates a 2d polygon and returns the triangle\n * representation as a flattened array of 3d points.\n *\n * @param {Array<Array<number>>} points2d - 2d points of outline to triangulate.\n * @param {Array<Array<number>>} points3d - 3d points of outline corresponding to the 2d points.\n * @param {Array<Array<Array<number>>>} [holes2d] - 2d points of holes to triangulate.\n * @param {Array<Array<Array<number>>>} [holes3d] - 3d points of holes corresponding to the 2d points.\n * @returns {Array<number>} Flattened array of 3d points ordered based on the triangles.\n * @ignore\n */\n protected _triangulate(\n points2d: number[][],\n points3d: number[][],\n holes2d?: number[][][],\n holes3d?: number[][][]): number[] {\n\n let data: number[][][] = [points2d.slice(0, -1)];\n for (let hole2d of holes2d != null ? holes2d : []) {\n data.push(hole2d.slice(0, -1));\n }\n\n let points: number[][] = points3d.slice(0, -1);\n for (let hole3d of holes3d != null ? holes3d : []) {\n points = points.concat(hole3d.slice(0, -1));\n }\n\n let flattened: { vertices: number[], holes: number[], dimensions: number } = earcut.flatten(data);\n let indices: number[] = earcut(flattened.vertices, flattened.holes, flattened.dimensions);\n let triangles: number[] = [];\n\n for (let i: number = 0; i < indices.length; ++i) {\n let point: number[] = points[indices[i]];\n\n triangles.push(point[0]);\n triangles.push(point[1]);\n triangles.push(point[2]);\n }\n\n return triangles;\n }\n\n protected _triangulateSpherical(\n points2d: number[][],\n holes2d: number[][][],\n transform: Transform): number[] {\n const triangles: number[] = [];\n\n const epsilon: number = 1e-9;\n const subareasX: number = 3;\n const subareasY: number = 3;\n\n for (let x: number = 0; x < subareasX; x++) {\n for (let y: number = 0; y < subareasY; y++) {\n const epsilonX0: number = x === 0 ? -epsilon : epsilon;\n const epsilonY0: number = y === 0 ? -epsilon : epsilon;\n\n const x0: number = x / subareasX + epsilonX0;\n const y0: number = y / subareasY + epsilonY0;\n const x1: number = (x + 1) / subareasX + epsilon;\n const y1: number = (y + 1) / subareasY + epsilon;\n\n const bbox2d: number[][] = [\n [x0, y0],\n [x0, y1],\n [x1, y1],\n [x1, y0],\n [x0, y0],\n ];\n\n const lookat2d: number[] = [\n (2 * x + 1) / (2 * subareasX),\n (2 * y + 1) / (2 * subareasY),\n ];\n\n triangles.push(...this._triangulateSubarea(points2d, holes2d, bbox2d, lookat2d, transform));\n }\n }\n\n return triangles;\n }\n\n protected _unproject(points2d: number[][], transform: Transform, distance: number = 200): number[][] {\n return points2d\n .map(\n (point: number[]) => {\n return transform.unprojectBasic(point, distance);\n });\n }\n\n private _createCamera(upVector: number[], position: number[], lookAt: number[]): THREE.Camera {\n const camera: THREE.Camera = new THREE.Camera();\n camera.up.copy(new THREE.Vector3().fromArray(upVector));\n camera.position.copy(new THREE.Vector3().fromArray(position));\n camera.lookAt(new THREE.Vector3().fromArray(lookAt));\n camera.updateMatrix();\n camera.updateMatrixWorld(true);\n\n return camera;\n }\n\n private _deunproject(points2d: number[][], transform: Transform, camera: THREE.Camera): number[][] {\n return points2d\n .map(\n (point2d: number[]): number[] => {\n const pointWorld: number[] = transform.unprojectBasic(point2d, 10000);\n const pointCamera: THREE.Vector3 =\n new THREE.Vector3(pointWorld[0], pointWorld[1], pointWorld[2])\n .applyMatrix4(camera.matrixWorldInverse);\n\n return [pointCamera.x / pointCamera.z, pointCamera.y / pointCamera.z];\n });\n }\n\n private _triangulateSubarea(\n points2d: number[][],\n holes2d: number[][][],\n bbox2d: number[][],\n lookat2d: number[],\n transform: Transform): number[] {\n\n const intersections: martinez.MultiPolygon = martinez.intersection([points2d, ...holes2d], [bbox2d]) as martinez.MultiPolygon;\n if (!intersections) {\n return [];\n }\n\n const triangles: number[] = [];\n const threshold: number = this._subsampleThreshold;\n const camera: THREE.Camera = this._createCamera(\n transform.upVector().toArray(),\n transform.unprojectSfM([0, 0], 0),\n transform.unprojectBasic(lookat2d, 10));\n\n for (const intersection of intersections) {\n const subsampledPolygon2d: number[][] = this._subsample(intersection[0], threshold);\n\n const polygon2d: number[][] = this._deunproject(subsampledPolygon2d, transform, camera);\n const polygon3d: number[][] = this._unproject(subsampledPolygon2d, transform);\n\n const polygonHoles2d: number[][][] = [];\n const polygonHoles3d: number[][][] = [];\n for (let i: number = 1; i < intersection.length; i++) {\n let subsampledHole2d: number[][] = this._subsample(intersection[i], threshold);\n\n const hole2d: number[][] = this._deunproject(subsampledHole2d, transform, camera);\n const hole3d: number[][] = this._unproject(subsampledHole2d, transform);\n\n polygonHoles2d.push(hole2d);\n polygonHoles3d.push(hole3d);\n }\n\n triangles.push(...this._triangulate(polygon2d, polygon3d, polygonHoles2d, polygonHoles3d));\n }\n\n return triangles;\n }\n}\n","import boolean from './src/';\nimport {\n INTERSECTION,\n DIFFERENCE,\n UNION,\n XOR\n} from './src/operation';\n\nexport function union (subject, clipping) {\n return boolean(subject, clipping, UNION);\n}\n\nexport function diff (subject, clipping) {\n return boolean(subject, clipping, DIFFERENCE);\n}\n\nexport function xor (subject, clipping) {\n return boolean(subject, clipping, XOR);\n}\n\nexport function intersection (subject, clipping) {\n return boolean(subject, clipping, INTERSECTION);\n}\n\n/**\n * @enum {Number}\n */\nexport const operations = { UNION, DIFFERENCE, INTERSECTION, XOR };\n","import { VertexGeometry } from \"./VertexGeometry\";\nimport { GeometryTagError } from \"../error/GeometryTagError\";\nimport { Transform } from \"../../../geo/Transform\";\nimport { isSpherical } from \"../../../geo/Geo\";\n\n/**\n * @class RectGeometry\n *\n * @classdesc Represents a rectangle geometry in the 2D basic image coordinate system.\n *\n * @example\n * ```js\n * var basicRect = [0.5, 0.3, 0.7, 0.4];\n * var rectGeometry = new RectGeometry(basicRect);\n * ```\n */\nexport class RectGeometry extends VertexGeometry {\n private _anchorIndex: number;\n private _inverted: boolean;\n private _rect: number[];\n\n /**\n * Create a rectangle geometry.\n *\n * @constructor\n * @param {Array<number>} rect - An array representing the top-left and bottom-right\n * corners of the rectangle in basic coordinates. Ordered according to [x0, y0, x1, y1].\n *\n * @throws {GeometryTagError} Rectangle coordinates must be valid basic coordinates.\n */\n constructor(rect: number[]) {\n super();\n\n if (rect.length !== 4) {\n throw new GeometryTagError(\"Rectangle needs to have four values.\");\n }\n\n if (rect[1] > rect[3]) {\n throw new GeometryTagError(\"Basic Y coordinates values can not be inverted.\");\n }\n\n for (let coord of rect) {\n if (coord < 0 || coord > 1) {\n throw new GeometryTagError(\"Basic coordinates must be on the interval [0, 1].\");\n }\n }\n\n this._anchorIndex = undefined;\n this._rect = rect.slice(0, 4);\n this._inverted = this._rect[0] > this._rect[2];\n }\n\n /**\n * Get anchor index property.\n *\n * @returns {number} Index representing the current anchor property if\n * achoring indexing has been initialized. If anchor indexing has not been\n * initialized or has been terminated undefined will be returned.\n * @ignore\n */\n public get anchorIndex(): number {\n return this._anchorIndex;\n }\n\n /**\n * Get inverted property.\n *\n * @returns {boolean} Boolean determining whether the rect geometry is\n * inverted. For spherical the rect geometrye may be inverted.\n * @ignore\n */\n public get inverted(): boolean {\n return this._inverted;\n }\n\n /**\n * Get rect property.\n *\n * @returns {Array<number>} Array representing the top-left and bottom-right\n * corners of the rectangle in basic coordinates.\n */\n public get rect(): number[] {\n return this._rect;\n }\n\n /**\n * Initialize anchor indexing to enable setting opposite vertex.\n *\n * @param {number} [index] - The index of the vertex to use as anchor.\n *\n * @throws {GeometryTagError} If anchor indexing has already been initialized.\n * @throws {GeometryTagError} If index is not valid (0 to 3).\n * @ignore\n */\n public initializeAnchorIndexing(index?: number): void {\n if (this._anchorIndex !== undefined) {\n throw new GeometryTagError(\"Anchor indexing is already initialized.\");\n }\n\n if (index < 0 || index > 3) {\n throw new GeometryTagError(`Invalid anchor index: ${index}.`);\n }\n\n this._anchorIndex = index === undefined ? 0 : index;\n }\n\n /**\n * Terminate anchor indexing to disable setting pposite vertex.\n * @ignore\n */\n public terminateAnchorIndexing(): void {\n this._anchorIndex = undefined;\n }\n\n /**\n * Set the value of the vertex opposite to the anchor in the polygon\n * representation of the rectangle.\n *\n * @description Setting the opposite vertex may change the anchor index.\n *\n * @param {Array<number>} opposite - The new value of the vertex opposite to the anchor.\n * @param {Transform} transform - The transform of the image related to the rectangle.\n *\n * @throws {GeometryTagError} When anchor indexing has not been initialized.\n * @ignore\n */\n public setOppositeVertex2d(opposite: number[], transform: Transform): void {\n if (this._anchorIndex === undefined) {\n throw new GeometryTagError(\"Anchor indexing needs to be initialized.\");\n }\n\n const changed: number[] = [\n Math.max(0, Math.min(1, opposite[0])),\n Math.max(0, Math.min(1, opposite[1])),\n ];\n\n const original: number[] = this._rect.slice();\n const anchor: number[] = this._anchorIndex === 0 ? [original[0], original[3]] :\n this._anchorIndex === 1 ? [original[0], original[1]] :\n this._anchorIndex === 2 ? [original[2], original[1]] :\n [original[2], original[3]];\n\n if (isSpherical(transform.cameraType)) {\n const deltaX: number = this._anchorIndex < 2 ?\n changed[0] - original[2] :\n changed[0] - original[0];\n\n if (!this._inverted && this._anchorIndex < 2 && changed[0] < 0.25 && original[2] > 0.75 && deltaX < -0.5) {\n // right side passes boundary rightward\n this._inverted = true;\n this._anchorIndex = anchor[1] > changed[1] ? 0 : 1;\n } else if (!this._inverted && this._anchorIndex >= 2 && changed[0] < 0.25 && original[2] > 0.75 && deltaX < -0.5) {\n // left side passes right side and boundary rightward\n this._inverted = true;\n this._anchorIndex = anchor[1] > changed[1] ? 0 : 1;\n } else if (this._inverted && this._anchorIndex >= 2 && changed[0] < 0.25 && original[0] > 0.75 && deltaX < -0.5) {\n this._inverted = false;\n if (anchor[0] > changed[0]) {\n // left side passes boundary rightward\n this._anchorIndex = anchor[1] > changed[1] ? 3 : 2;\n } else {\n // left side passes right side and boundary rightward\n this._anchorIndex = anchor[1] > changed[1] ? 0 : 1;\n }\n } else if (!this._inverted && this._anchorIndex >= 2 && changed[0] > 0.75 && original[0] < 0.25 && deltaX > 0.5) {\n // left side passes boundary leftward\n this._inverted = true;\n this._anchorIndex = anchor[1] > changed[1] ? 3 : 2;\n } else if (!this._inverted && this._anchorIndex < 2 && changed[0] > 0.75 && original[0] < 0.25 && deltaX > 0.5) {\n // right side passes left side and boundary leftward\n this._inverted = true;\n this._anchorIndex = anchor[1] > changed[1] ? 3 : 2;\n } else if (this._inverted && this._anchorIndex < 2 && changed[0] > 0.75 && original[2] < 0.25 && deltaX > 0.5) {\n this._inverted = false;\n if (anchor[0] > changed[0]) {\n // right side passes boundary leftward\n this._anchorIndex = anchor[1] > changed[1] ? 3 : 2;\n } else {\n // right side passes left side and boundary leftward\n this._anchorIndex = anchor[1] > changed[1] ? 0 : 1;\n }\n } else if (this._inverted && this._anchorIndex < 2 && changed[0] > original[0]) {\n // inverted and right side passes left side completing a loop\n this._inverted = false;\n this._anchorIndex = anchor[1] > changed[1] ? 0 : 1;\n } else if (this._inverted && this._anchorIndex >= 2 && changed[0] < original[2]) {\n // inverted and left side passes right side completing a loop\n this._inverted = false;\n this._anchorIndex = anchor[1] > changed[1] ? 3 : 2;\n } else if (this._inverted) {\n // if still inverted only top and bottom can switch\n if (this._anchorIndex < 2) {\n this._anchorIndex = anchor[1] > changed[1] ? 0 : 1;\n } else {\n this._anchorIndex = anchor[1] > changed[1] ? 3 : 2;\n }\n } else {\n // if still not inverted treat as non spherical\n if (anchor[0] <= changed[0] && anchor[1] > changed[1]) {\n this._anchorIndex = 0;\n } else if (anchor[0] <= changed[0] && anchor[1] <= changed[1]) {\n this._anchorIndex = 1;\n } else if (anchor[0] > changed[0] && anchor[1] <= changed[1]) {\n this._anchorIndex = 2;\n } else {\n this._anchorIndex = 3;\n }\n }\n\n const rect: number[] = [];\n if (this._anchorIndex === 0) {\n rect[0] = anchor[0];\n rect[1] = changed[1];\n rect[2] = changed[0];\n rect[3] = anchor[1];\n } else if (this._anchorIndex === 1) {\n rect[0] = anchor[0];\n rect[1] = anchor[1];\n rect[2] = changed[0];\n rect[3] = changed[1];\n } else if (this._anchorIndex === 2) {\n rect[0] = changed[0];\n rect[1] = anchor[1];\n rect[2] = anchor[0];\n rect[3] = changed[1];\n } else {\n rect[0] = changed[0];\n rect[1] = changed[1];\n rect[2] = anchor[0];\n rect[3] = anchor[1];\n }\n\n if (!this._inverted && rect[0] > rect[2] ||\n this._inverted && rect[0] < rect[2]) {\n rect[0] = original[0];\n rect[2] = original[2];\n }\n\n if (rect[1] > rect[3]) {\n rect[1] = original[1];\n rect[3] = original[3];\n }\n\n this._rect[0] = rect[0];\n this._rect[1] = rect[1];\n this._rect[2] = rect[2];\n this._rect[3] = rect[3];\n } else {\n if (anchor[0] <= changed[0] && anchor[1] > changed[1]) {\n this._anchorIndex = 0;\n } else if (anchor[0] <= changed[0] && anchor[1] <= changed[1]) {\n this._anchorIndex = 1;\n } else if (anchor[0] > changed[0] && anchor[1] <= changed[1]) {\n this._anchorIndex = 2;\n } else {\n this._anchorIndex = 3;\n }\n\n const rect: number[] = [];\n if (this._anchorIndex === 0) {\n rect[0] = anchor[0];\n rect[1] = changed[1];\n rect[2] = changed[0];\n rect[3] = anchor[1];\n } else if (this._anchorIndex === 1) {\n rect[0] = anchor[0];\n rect[1] = anchor[1];\n rect[2] = changed[0];\n rect[3] = changed[1];\n } else if (this._anchorIndex === 2) {\n rect[0] = changed[0];\n rect[1] = anchor[1];\n rect[2] = anchor[0];\n rect[3] = changed[1];\n } else {\n rect[0] = changed[0];\n rect[1] = changed[1];\n rect[2] = anchor[0];\n rect[3] = anchor[1];\n }\n\n if (rect[0] > rect[2]) {\n rect[0] = original[0];\n rect[2] = original[2];\n }\n\n if (rect[1] > rect[3]) {\n rect[1] = original[1];\n rect[3] = original[3];\n }\n\n this._rect[0] = rect[0];\n this._rect[1] = rect[1];\n this._rect[2] = rect[2];\n this._rect[3] = rect[3];\n }\n\n this._notifyChanged$.next(this);\n }\n\n /**\n * Set the value of a vertex in the polygon representation of the rectangle.\n *\n * @description The polygon is defined to have the first vertex at the\n * bottom-left corner with the rest of the vertices following in clockwise order.\n *\n * @param {number} index - The index of the vertex to be set.\n * @param {Array<number>} value - The new value of the vertex.\n * @param {Transform} transform - The transform of the image related to the rectangle.\n * @ignore\n */\n public setVertex2d(index: number, value: number[], transform: Transform): void {\n let original: number[] = this._rect.slice();\n\n let changed: number[] = [\n Math.max(0, Math.min(1, value[0])),\n Math.max(0, Math.min(1, value[1])),\n ];\n\n let rect: number[] = [];\n if (index === 0) {\n rect[0] = changed[0];\n rect[1] = original[1];\n rect[2] = original[2];\n rect[3] = changed[1];\n } else if (index === 1) {\n rect[0] = changed[0];\n rect[1] = changed[1];\n rect[2] = original[2];\n rect[3] = original[3];\n } else if (index === 2) {\n rect[0] = original[0];\n rect[1] = changed[1];\n rect[2] = changed[0];\n rect[3] = original[3];\n } else if (index === 3) {\n rect[0] = original[0];\n rect[1] = original[1];\n rect[2] = changed[0];\n rect[3] = changed[1];\n }\n\n if (isSpherical(transform.cameraType)) {\n let passingBoundaryLeftward: boolean =\n index < 2 && changed[0] > 0.75 && original[0] < 0.25 ||\n index >= 2 && this._inverted && changed[0] > 0.75 && original[2] < 0.25;\n\n let passingBoundaryRightward: boolean =\n index < 2 && this._inverted && changed[0] < 0.25 && original[0] > 0.75 ||\n index >= 2 && changed[0] < 0.25 && original[2] > 0.75;\n\n if (passingBoundaryLeftward || passingBoundaryRightward) {\n this._inverted = !this._inverted;\n } else {\n if (rect[0] - original[0] < -0.25) {\n rect[0] = original[0];\n }\n\n if (rect[2] - original[2] > 0.25) {\n rect[2] = original[2];\n }\n }\n\n if (!this._inverted && rect[0] > rect[2] ||\n this._inverted && rect[0] < rect[2]) {\n rect[0] = original[0];\n rect[2] = original[2];\n }\n } else {\n if (rect[0] > rect[2]) {\n rect[0] = original[0];\n rect[2] = original[2];\n }\n }\n\n if (rect[1] > rect[3]) {\n rect[1] = original[1];\n rect[3] = original[3];\n }\n\n this._rect[0] = rect[0];\n this._rect[1] = rect[1];\n this._rect[2] = rect[2];\n this._rect[3] = rect[3];\n\n this._notifyChanged$.next(this);\n }\n\n /** @ignore */\n public setCentroid2d(value: number[], transform: Transform): void {\n let original: number[] = this._rect.slice();\n\n let x0: number = original[0];\n let x1: number = this._inverted ? original[2] + 1 : original[2];\n\n let y0: number = original[1];\n let y1: number = original[3];\n\n let centerX: number = x0 + (x1 - x0) / 2;\n let centerY: number = y0 + (y1 - y0) / 2;\n\n let translationX: number = 0;\n\n if (isSpherical(transform.cameraType)) {\n translationX = this._inverted ? value[0] + 1 - centerX : value[0] - centerX;\n } else {\n let minTranslationX: number = -x0;\n let maxTranslationX: number = 1 - x1;\n\n translationX = Math.max(minTranslationX, Math.min(maxTranslationX, value[0] - centerX));\n }\n\n let minTranslationY: number = -y0;\n let maxTranslationY: number = 1 - y1;\n\n let translationY: number = Math.max(minTranslationY, Math.min(maxTranslationY, value[1] - centerY));\n\n this._rect[0] = original[0] + translationX;\n this._rect[1] = original[1] + translationY;\n this._rect[2] = original[2] + translationX;\n this._rect[3] = original[3] + translationY;\n\n if (this._rect[0] < 0) {\n this._rect[0] += 1;\n this._inverted = !this._inverted;\n } else if (this._rect[0] > 1) {\n this._rect[0] -= 1;\n this._inverted = !this._inverted;\n }\n\n if (this._rect[2] < 0) {\n this._rect[2] += 1;\n this._inverted = !this._inverted;\n } else if (this._rect[2] > 1) {\n this._rect[2] -= 1;\n this._inverted = !this._inverted;\n }\n\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get the 3D coordinates for the vertices of the rectangle with\n * interpolated points along the lines.\n *\n * @param {Transform} transform - The transform of the image related to\n * the rectangle.\n * @returns {Array<Array<number>>} Polygon array of 3D world coordinates\n * representing the rectangle.\n * @ignore\n */\n public getPoints3d(transform: Transform): number[][] {\n return this._getPoints2d()\n .map(\n (point: number[]) => {\n return transform.unprojectBasic(point, 200);\n });\n }\n\n /**\n * Get the coordinates of a vertex from the polygon representation of the geometry.\n *\n * @description The first vertex represents the bottom-left corner with the rest of\n * the vertices following in clockwise order. The method shifts the right side\n * coordinates of the rectangle by one unit to ensure that the vertices are ordered\n * clockwise.\n *\n * @param {number} index - Vertex index.\n * @returns {Array<number>} Array representing the 2D basic coordinates of the vertex.\n * @ignore\n */\n public getVertex2d(index: number): number[] {\n return this._rectToVertices2d(this._rect)[index];\n }\n\n /**\n * Get the coordinates of a vertex from the polygon representation of the geometry.\n *\n * @description The first vertex represents the bottom-left corner with the rest of\n * the vertices following in clockwise order. The coordinates will not be shifted\n * so they may not appear in clockwise order when layed out on the plane.\n *\n * @param {number} index - Vertex index.\n * @returns {Array<number>} Array representing the 2D basic coordinates of the vertex.\n * @ignore\n */\n public getNonAdjustedVertex2d(index: number): number[] {\n return this._rectToNonAdjustedVertices2d(this._rect)[index];\n }\n\n /**\n * Get a vertex from the polygon representation of the 3D coordinates for the\n * vertices of the geometry.\n *\n * @description The first vertex represents the bottom-left corner with the rest of\n * the vertices following in clockwise order.\n *\n * @param {number} index - Vertex index.\n * @param {Transform} transform - The transform of the image related to the geometry.\n * @returns {Array<Array<number>>} Polygon array of 3D world coordinates representing\n * the vertices of the geometry.\n * @ignore\n */\n public getVertex3d(index: number, transform: Transform): number[] {\n return transform.unprojectBasic(this._rectToVertices2d(this._rect)[index], 200);\n }\n\n /**\n * Get a polygon representation of the 2D basic coordinates for the vertices of the rectangle.\n *\n * @description The first vertex represents the bottom-left corner with the rest of\n * the vertices following in clockwise order.\n *\n * @returns {Array<Array<number>>} Polygon array of 2D basic coordinates representing\n * the rectangle vertices.\n * @ignore\n */\n public getVertices2d(): number[][] {\n return this._rectToVertices2d(this._rect);\n }\n\n /**\n * Get a polygon representation of the 3D coordinates for the vertices of the rectangle.\n *\n * @description The first vertex represents the bottom-left corner with the rest of\n * the vertices following in clockwise order.\n *\n * @param {Transform} transform - The transform of the image related to the rectangle.\n * @returns {Array<Array<number>>} Polygon array of 3D world coordinates representing\n * the rectangle vertices.\n * @ignore\n */\n public getVertices3d(transform: Transform): number[][] {\n return this._rectToVertices2d(this._rect)\n .map(\n (vertex: number[]) => {\n return transform.unprojectBasic(vertex, 200);\n });\n }\n\n /** @ignore */\n public getCentroid2d(): number[] {\n const rect: number[] = this._rect;\n\n const x0: number = rect[0];\n const x1: number = this._inverted ? rect[2] + 1 : rect[2];\n\n const y0: number = rect[1];\n const y1: number = rect[3];\n\n const centroidX: number = (x0 + x1) / 2;\n const centroidY: number = (y0 + y1) / 2;\n\n return [centroidX, centroidY];\n }\n\n /** @ignore */\n public getCentroid3d(transform: Transform): number[] {\n const centroid2d: number[] = this.getCentroid2d();\n\n return transform.unprojectBasic(centroid2d, 200);\n }\n\n /**\n * @ignore\n */\n public getPoleOfInaccessibility2d(): number[] {\n return this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect));\n }\n\n /** @ignore */\n public getPoleOfInaccessibility3d(transform: Transform): number[] {\n let pole2d: number[] = this._getPoleOfInaccessibility2d(this._rectToVertices2d(this._rect));\n\n return transform.unprojectBasic(pole2d, 200);\n }\n\n /** @ignore */\n public getTriangles3d(transform: Transform): number[] {\n return isSpherical(transform.cameraType) ?\n [] :\n this._triangulate(\n this._project(this._getPoints2d(), transform),\n this.getPoints3d(transform));\n }\n\n /**\n * Check if a particular bottom-right value is valid according to the current\n * rectangle coordinates.\n *\n * @param {Array<number>} bottomRight - The bottom-right coordinates to validate\n * @returns {boolean} Value indicating whether the provided bottom-right coordinates\n * are valid.\n * @ignore\n */\n public validate(bottomRight: number[]): boolean {\n let rect: number[] = this._rect;\n\n if (!this._inverted && bottomRight[0] < rect[0] ||\n bottomRight[0] - rect[2] > 0.25 ||\n bottomRight[1] < rect[1]) {\n return false;\n }\n\n return true;\n }\n\n /**\n * Get the 2D coordinates for the vertices of the rectangle with\n * interpolated points along the lines.\n *\n * @returns {Array<Array<number>>} Polygon array of 2D basic coordinates\n * representing the rectangle.\n */\n private _getPoints2d(): number[][] {\n let vertices2d: number[][] = this._rectToVertices2d(this._rect);\n\n let sides: number = vertices2d.length - 1;\n let sections: number = 10;\n\n let points2d: number[][] = [];\n\n for (let i: number = 0; i < sides; ++i) {\n let startX: number = vertices2d[i][0];\n let startY: number = vertices2d[i][1];\n\n let endX: number = vertices2d[i + 1][0];\n let endY: number = vertices2d[i + 1][1];\n\n let intervalX: number = (endX - startX) / (sections - 1);\n let intervalY: number = (endY - startY) / (sections - 1);\n\n for (let j: number = 0; j < sections; ++j) {\n let point: number[] = [\n startX + j * intervalX,\n startY + j * intervalY,\n ];\n\n points2d.push(point);\n }\n }\n\n return points2d;\n }\n\n /**\n * Convert the top-left, bottom-right representation of a rectangle to a polygon\n * representation of the vertices starting at the bottom-left corner going\n * clockwise.\n *\n * @description The method shifts the right side coordinates of the rectangle\n * by one unit to ensure that the vertices are ordered clockwise.\n *\n * @param {Array<number>} rect - Top-left, bottom-right representation of a\n * rectangle.\n * @returns {Array<Array<number>>} Polygon representation of the vertices of the\n * rectangle.\n */\n private _rectToVertices2d(rect: number[]): number[][] {\n return [\n [rect[0], rect[3]],\n [rect[0], rect[1]],\n [this._inverted ? rect[2] + 1 : rect[2], rect[1]],\n [this._inverted ? rect[2] + 1 : rect[2], rect[3]],\n [rect[0], rect[3]],\n ];\n }\n\n /**\n * Convert the top-left, bottom-right representation of a rectangle to a polygon\n * representation of the vertices starting at the bottom-left corner going\n * clockwise.\n *\n * @description The first vertex represents the bottom-left corner with the rest of\n * the vertices following in clockwise order. The coordinates will not be shifted\n * to ensure that the vertices are ordered clockwise when layed out on the plane.\n *\n * @param {Array<number>} rect - Top-left, bottom-right representation of a\n * rectangle.\n * @returns {Array<Array<number>>} Polygon representation of the vertices of the\n * rectangle.\n */\n private _rectToNonAdjustedVertices2d(rect: number[]): number[][] {\n return [\n [rect[0], rect[3]],\n [rect[0], rect[1]],\n [rect[2], rect[1]],\n [rect[2], rect[3]],\n [rect[0], rect[3]],\n ];\n }\n}\n","import * as vd from \"virtual-dom\";\nimport * as THREE from \"three\";\n\nimport { CreateTag } from \"./CreateTag\";\n\nimport { PointsGeometry } from \"../geometry/PointsGeometry\";\nimport { RectGeometry } from \"../geometry/RectGeometry\";\nimport { ExtremePointCreateTagOptions } from \"../interfaces/ExtremePointCreateTagOptions\";\n\nimport { Transform } from \"../../../geo/Transform\";\nimport { ViewportCoords } from \"../../../geo/ViewportCoords\";\nimport { ViewportSize } from \"../../../render/interfaces/ViewportSize\";\n\nexport class ExtremePointCreateTag extends CreateTag<PointsGeometry> {\n private _rectGeometry: RectGeometry;\n private _options: ExtremePointCreateTagOptions;\n private _outline: THREE.Line;\n\n constructor(\n geometry: PointsGeometry,\n options: ExtremePointCreateTagOptions,\n transform: Transform,\n viewportCoords?: ViewportCoords) {\n\n super(geometry, transform, viewportCoords);\n\n this._options = {\n color: options.color == null ? 0xFFFFFF : options.color,\n indicateCompleter: options.indicateCompleter == null ? true : options.indicateCompleter,\n };\n\n this._rectGeometry = new RectGeometry(this._geometry.getRect2d(transform));\n this._createGlObjects();\n }\n\n public create(): void {\n if (this._geometry.points.length < 3) {\n return;\n }\n\n this._geometry.removePoint2d(this._geometry.points.length - 1);\n this._created$.next(this);\n }\n\n public dispose(): void {\n super.dispose();\n this._disposeObjects();\n }\n\n public getDOMObjects(camera: THREE.Camera, size: ViewportSize): vd.VNode[] {\n const container: { offsetHeight: number, offsetWidth: number } = {\n offsetHeight: size.height, offsetWidth: size.width,\n };\n\n const vNodes: vd.VNode[] = [];\n\n const points2d: number[][] = this._geometry.getPoints2d();\n const length: number = points2d.length;\n\n for (let index: number = 0; index < length - 1; index++) {\n const nonModifiedIndex: number = index;\n const [pointX, pointY]: number[] = points2d[index];\n const pointCanvas: number[] =\n this._viewportCoords.basicToCanvasSafe(\n pointX,\n pointY,\n container,\n this._transform,\n camera);\n\n if (!pointCanvas) {\n continue;\n }\n\n const abort: (e: MouseEvent) => void = (e: MouseEvent): void => {\n e.stopPropagation();\n this._aborted$.next(this);\n };\n\n const remove: (e: MouseEvent) => void = (e: MouseEvent): void => {\n e.stopPropagation();\n this._geometry.removePoint2d(nonModifiedIndex);\n };\n\n const transform: string = this._canvasToTransform(pointCanvas);\n const completerProperties: vd.createProperties = {\n onclick: index === 0 && length < 3 ? abort : remove,\n style: { transform: transform },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-interactor\", completerProperties, []));\n\n const background: string = this._colorToBackground(this._options.color);\n const pointProperties: vd.createProperties = {\n style: {\n background: background,\n transform: transform,\n },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-vertex\", pointProperties, []));\n }\n\n if (length > 2 && this._options.indicateCompleter === true) {\n const [centroidX, centroidY]: number[] = this._geometry.getCentroid2d(this._transform);\n const centroidCanvas: number[] =\n this._viewportCoords.basicToCanvasSafe(\n centroidX,\n centroidY,\n container,\n this._transform,\n camera);\n\n if (!!centroidCanvas) {\n const complete: (e: MouseEvent) => void = (e: MouseEvent): void => {\n e.stopPropagation();\n this._geometry.removePoint2d(this._geometry.points.length - 1);\n this._created$.next(this);\n };\n\n const transform: string = this._canvasToTransform(centroidCanvas);\n const completerProperties: vd.createProperties = {\n onclick: complete,\n style: { transform: transform },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-completer.mapillary-tag-larger\", completerProperties, []));\n\n const pointProperties: vd.createProperties = {\n style: {\n background: this._colorToBackground(this._options.color),\n transform: transform,\n },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-vertex.mapillary-tag-larger\", pointProperties, []));\n\n const dotProperties: vd.createProperties = {\n style: {\n transform: transform,\n },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-dot\", dotProperties, []));\n }\n }\n\n return vNodes;\n }\n\n protected _onGeometryChanged(): void {\n this._disposeObjects();\n\n this._rectGeometry = new RectGeometry(this._geometry.getRect2d(this._transform));\n this._createGlObjects();\n }\n\n private _createGlObjects(): void {\n this._glObjects = [];\n\n const polygon3d: number[][] = this._rectGeometry.getPoints3d(this._transform);\n this._outline = this._createOutine(polygon3d, this._options.color);\n this._glObjects.push(this._outline);\n }\n\n private _disposeObjects(): void {\n this._disposeLine(this._outline);\n this._outline = null;\n this._glObjects = null;\n }\n}\n","import { VertexGeometry } from \"./VertexGeometry\";\nimport { GeometryTagError } from \"../error/GeometryTagError\";\nimport { Transform } from \"../../../geo/Transform\";\nimport { isSpherical } from \"../../../geo/Geo\";\n\n/**\n * @class PolygonGeometry\n *\n * @classdesc Represents a polygon geometry in the 2D basic image coordinate system.\n * All polygons and holes provided to the constructor needs to be closed.\n *\n * @example\n * ```js\n * var basicPolygon = [[0.5, 0.3], [0.7, 0.3], [0.6, 0.5], [0.5, 0.3]];\n * var polygonGeometry = new PolygonGeometry(basicPolygon);\n * ```\n */\nexport class PolygonGeometry extends VertexGeometry {\n private _polygon: number[][];\n private _holes: number[][][];\n\n /**\n * Create a polygon geometry.\n *\n * @constructor\n * @param {Array<Array<number>>} polygon - Array of polygon vertices. Must be closed.\n * @param {Array<Array<Array<number>>>} [holes] - Array of arrays of hole vertices.\n * Each array of holes vertices must be closed.\n *\n * @throws {GeometryTagError} Polygon coordinates must be valid basic coordinates.\n */\n constructor(polygon: number[][], holes?: number[][][]) {\n super();\n\n let polygonLength: number = polygon.length;\n\n if (polygonLength < 3) {\n throw new GeometryTagError(\"A polygon must have three or more positions.\");\n }\n\n if (polygon[0][0] !== polygon[polygonLength - 1][0] ||\n polygon[0][1] !== polygon[polygonLength - 1][1]) {\n throw new GeometryTagError(\"First and last positions must be equivalent.\");\n }\n\n this._polygon = [];\n for (let vertex of polygon) {\n if (vertex[0] < 0 || vertex[0] > 1 ||\n vertex[1] < 0 || vertex[1] > 1) {\n throw new GeometryTagError(\"Basic coordinates of polygon must be on the interval [0, 1].\");\n }\n\n this._polygon.push(vertex.slice());\n }\n\n this._holes = [];\n\n if (holes == null) {\n return;\n }\n\n for (let i: number = 0; i < holes.length; i++) {\n let hole: number[][] = holes[i];\n let holeLength: number = hole.length;\n\n if (holeLength < 3) {\n throw new GeometryTagError(\"A polygon hole must have three or more positions.\");\n }\n\n if (hole[0][0] !== hole[holeLength - 1][0] ||\n hole[0][1] !== hole[holeLength - 1][1]) {\n throw new GeometryTagError(\"First and last positions of hole must be equivalent.\");\n }\n\n this._holes.push([]);\n\n for (let vertex of hole) {\n if (vertex[0] < 0 || vertex[0] > 1 ||\n vertex[1] < 0 || vertex[1] > 1) {\n throw new GeometryTagError(\"Basic coordinates of hole must be on the interval [0, 1].\");\n }\n\n this._holes[i].push(vertex.slice());\n }\n }\n }\n\n /**\n * Get polygon property.\n * @returns {Array<Array<number>>} Closed 2d polygon.\n */\n public get polygon(): number[][] {\n return this._polygon;\n }\n\n /**\n * Get holes property.\n * @returns {Array<Array<Array<number>>>} Holes of 2d polygon.\n */\n public get holes(): number[][][] {\n return this._holes;\n }\n\n /**\n * Add a vertex to the polygon by appending it after the last vertex.\n *\n * @param {Array<number>} vertex - Vertex to add.\n * @ignore\n */\n public addVertex2d(vertex: number[]): void {\n let clamped: number[] = [\n Math.max(0, Math.min(1, vertex[0])),\n Math.max(0, Math.min(1, vertex[1])),\n ];\n\n this._polygon.splice(this._polygon.length - 1, 0, clamped);\n\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get the coordinates of a vertex from the polygon representation of the geometry.\n *\n * @param {number} index - Vertex index.\n * @returns {Array<number>} Array representing the 2D basic coordinates of the vertex.\n * @ignore\n */\n public getVertex2d(index: number): number[] {\n return this._polygon[index].slice();\n }\n\n /**\n * Remove a vertex from the polygon.\n *\n * @param {number} index - The index of the vertex to remove.\n * @ignore\n */\n public removeVertex2d(index: number): void {\n if (index < 0 ||\n index >= this._polygon.length ||\n this._polygon.length < 4) {\n throw new GeometryTagError(\"Index for removed vertex must be valid.\");\n }\n\n if (index > 0 && index < this._polygon.length - 1) {\n this._polygon.splice(index, 1);\n } else {\n this._polygon.splice(0, 1);\n this._polygon.pop();\n\n let closing: number[] = this._polygon[0].slice();\n this._polygon.push(closing);\n }\n\n this._notifyChanged$.next(this);\n }\n\n /** @ignore */\n public setVertex2d(index: number, value: number[], transform: Transform): void {\n let changed: number[] = [\n Math.max(0, Math.min(1, value[0])),\n Math.max(0, Math.min(1, value[1])),\n ];\n\n if (index === 0 || index === this._polygon.length - 1) {\n this._polygon[0] = changed.slice();\n this._polygon[this._polygon.length - 1] = changed.slice();\n } else {\n this._polygon[index] = changed.slice();\n }\n\n this._notifyChanged$.next(this);\n }\n\n /** @ignore */\n public setCentroid2d(value: number[], transform: Transform): void {\n let xs: number[] = this._polygon.map((point: number[]): number => { return point[0]; });\n let ys: number[] = this._polygon.map((point: number[]): number => { return point[1]; });\n\n let minX: number = Math.min.apply(Math, xs);\n let maxX: number = Math.max.apply(Math, xs);\n let minY: number = Math.min.apply(Math, ys);\n let maxY: number = Math.max.apply(Math, ys);\n\n let centroid: number[] = this.getCentroid2d();\n\n let minTranslationX: number = -minX;\n let maxTranslationX: number = 1 - maxX;\n let minTranslationY: number = -minY;\n let maxTranslationY: number = 1 - maxY;\n\n let translationX: number = Math.max(minTranslationX, Math.min(maxTranslationX, value[0] - centroid[0]));\n let translationY: number = Math.max(minTranslationY, Math.min(maxTranslationY, value[1] - centroid[1]));\n\n for (let point of this._polygon) {\n point[0] += translationX;\n point[1] += translationY;\n }\n\n this._notifyChanged$.next(this);\n }\n\n /** @ignore */\n public getPoints3d(transform: Transform): number[][] {\n return this._getPoints3d(\n this._subsample(this._polygon),\n transform);\n }\n\n /** @ignore */\n public getVertex3d(index: number, transform: Transform): number[] {\n return transform.unprojectBasic(this._polygon[index], 200);\n }\n\n /** @ignore */\n public getVertices2d(): number[][] {\n return this._polygon.slice();\n }\n\n /** @ignore */\n public getVertices3d(transform: Transform): number[][] {\n return this._getPoints3d(this._polygon, transform);\n }\n\n /**\n * Get a polygon representation of the 3D coordinates for the vertices of each hole\n * of the geometry. Line segments between vertices will possibly be subsampled\n * resulting in a larger number of points than the total number of vertices.\n *\n * @param {Transform} transform - The transform of the image related to the geometry.\n * @returns {Array<Array<Array<number>>>} Array of hole polygons in 3D world coordinates\n * representing the vertices of each hole of the geometry.\n * @ignore\n */\n public getHolePoints3d(transform: Transform): number[][][] {\n return this._holes\n .map(\n (hole2d: number[][]): number[][] => {\n return this._getPoints3d(\n this._subsample(hole2d),\n transform);\n });\n }\n\n /**\n * Get a polygon representation of the 3D coordinates for the vertices of each hole\n * of the geometry.\n *\n * @param {Transform} transform - The transform of the image related to the geometry.\n * @returns {Array<Array<Array<number>>>} Array of hole polygons in 3D world coordinates\n * representing the vertices of each hole of the geometry.\n * @ignore\n */\n public getHoleVertices3d(transform: Transform): number[][][] {\n return this._holes\n .map(\n (hole2d: number[][]): number[][] => {\n return this._getPoints3d(hole2d, transform);\n });\n }\n\n /** @ignore */\n public getCentroid2d(): number[] {\n let polygon: number[][] = this._polygon;\n\n let area: number = 0;\n let centroidX: number = 0;\n let centroidY: number = 0;\n\n for (let i: number = 0; i < polygon.length - 1; i++) {\n let xi: number = polygon[i][0];\n let yi: number = polygon[i][1];\n let xi1: number = polygon[i + 1][0];\n let yi1: number = polygon[i + 1][1];\n\n let a: number = xi * yi1 - xi1 * yi;\n\n area += a;\n centroidX += (xi + xi1) * a;\n centroidY += (yi + yi1) * a;\n }\n\n area /= 2;\n\n centroidX /= 6 * area;\n centroidY /= 6 * area;\n\n return [centroidX, centroidY];\n }\n\n /** @ignore */\n public getCentroid3d(transform: Transform): number[] {\n let centroid2d: number[] = this.getCentroid2d();\n\n return transform.unprojectBasic(centroid2d, 200);\n }\n\n /** @ignore */\n public get3dDomainTriangles3d(transform: Transform): number[] {\n return this._triangulate(\n this._project(this._polygon, transform),\n this.getVertices3d(transform),\n this._holes\n .map(\n (hole2d: number[][]): number[][] => {\n return this._project(hole2d, transform);\n }),\n this.getHoleVertices3d(transform));\n }\n\n /** @ignore */\n public getTriangles3d(transform: Transform): number[] {\n if (isSpherical(transform.cameraType)) {\n return this._triangulateSpherical(\n this._polygon.slice(),\n this.holes.slice(),\n transform);\n }\n\n const points2d: number[][] = this._project(this._subsample(this._polygon), transform);\n const points3d: number[][] = this.getPoints3d(transform);\n\n const holes2d: number[][][] = this._holes\n .map(\n (hole: number[][]): number[][] => {\n return this._project(this._subsample(hole), transform);\n });\n\n const holes3d: number[][][] = this.getHolePoints3d(transform);\n\n return this._triangulate(\n points2d,\n points3d,\n holes2d,\n holes3d);\n }\n\n /** @ignore */\n public getPoleOfInaccessibility2d(): number[] {\n return this._getPoleOfInaccessibility2d(this._polygon.slice());\n }\n\n /** @ignore */\n public getPoleOfInaccessibility3d(transform: Transform): number[] {\n let pole2d: number[] = this._getPoleOfInaccessibility2d(this._polygon.slice());\n\n return transform.unprojectBasic(pole2d, 200);\n }\n\n private _getPoints3d(points2d: number[][], transform: Transform): number[][] {\n return points2d\n .map(\n (point: number[]) => {\n return transform.unprojectBasic(point, 200);\n });\n }\n}\n","import * as THREE from \"three\";\nimport * as vd from \"virtual-dom\";\n\nimport { CreateTag } from \"./CreateTag\";\n\nimport { PolygonGeometry } from \"../geometry/PolygonGeometry\";\nimport { RectGeometry } from \"../geometry/RectGeometry\";\nimport { VertexGeometry } from \"../geometry/VertexGeometry\";\nimport { OutlineCreateTagOptions } from \"../interfaces/OutlineCreateTagOptions\";\n\nimport { Transform } from \"../../../geo/Transform\";\nimport { ViewportCoords } from \"../../../geo/ViewportCoords\";\nimport { ViewportSize } from \"../../../render/interfaces/ViewportSize\";\n\nexport class OutlineCreateTag extends CreateTag<VertexGeometry> {\n private _outline: THREE.Line;\n private _options: OutlineCreateTagOptions;\n\n constructor(\n geometry: VertexGeometry,\n options: OutlineCreateTagOptions,\n transform: Transform,\n viewportCoords?: ViewportCoords) {\n\n super(geometry, transform, viewportCoords);\n\n this._options = { color: options.color == null ? 0xFFFFFF : options.color };\n\n this._createGlObjects();\n }\n\n public create(): void {\n if (this._geometry instanceof RectGeometry) {\n this._created$.next(this);\n } else if (this._geometry instanceof PolygonGeometry) {\n const polygonGeometry: PolygonGeometry = <PolygonGeometry>this._geometry;\n polygonGeometry.removeVertex2d(polygonGeometry.polygon.length - 2);\n this._created$.next(this);\n }\n }\n\n public dispose(): void {\n super.dispose();\n this._disposeLine(this._outline);\n this._disposeObjects();\n }\n\n public getDOMObjects(camera: THREE.Camera, size: ViewportSize): vd.VNode[] {\n const vNodes: vd.VNode[] = [];\n const container: { offsetHeight: number, offsetWidth: number } = {\n offsetHeight: size.height, offsetWidth: size.width,\n };\n\n const abort: (e: MouseEvent) => void = (e: MouseEvent): void => {\n e.stopPropagation();\n this._aborted$.next(this);\n };\n\n if (this._geometry instanceof RectGeometry) {\n const anchorIndex: number = (<RectGeometry>this._geometry).anchorIndex;\n const vertexIndex: number = anchorIndex === undefined ? 1 : anchorIndex;\n const [basicX, basicY]: number[] = this._geometry.getVertex2d(vertexIndex);\n const canvasPoint: number[] =\n this._viewportCoords.basicToCanvasSafe(\n basicX,\n basicY,\n container,\n this._transform,\n camera);\n\n if (canvasPoint != null) {\n const background: string = this._colorToBackground(this._options.color);\n const transform: string = this._canvasToTransform(canvasPoint);\n const pointProperties: vd.createProperties = {\n style: { background: background, transform: transform },\n };\n\n const completerProperties: vd.createProperties = {\n onclick: abort,\n style: { transform: transform },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-interactor\", completerProperties, []));\n vNodes.push(vd.h(\"div.mapillary-tag-vertex\", pointProperties, []));\n }\n } else if (this._geometry instanceof PolygonGeometry) {\n const polygonGeometry: PolygonGeometry = <PolygonGeometry>this._geometry;\n\n const [firstVertexBasicX, firstVertexBasicY]: number[] = polygonGeometry.getVertex2d(0);\n const firstVertexCanvas: number[] =\n this._viewportCoords.basicToCanvasSafe(\n firstVertexBasicX,\n firstVertexBasicY,\n container,\n this._transform,\n camera);\n\n if (firstVertexCanvas != null) {\n const firstOnclick: (e: MouseEvent) => void = polygonGeometry.polygon.length > 4 ?\n (e: MouseEvent): void => {\n e.stopPropagation();\n polygonGeometry.removeVertex2d(polygonGeometry.polygon.length - 2);\n this._created$.next(this);\n } :\n abort;\n\n const transform: string = this._canvasToTransform(firstVertexCanvas);\n const completerProperties: vd.createProperties = {\n onclick: firstOnclick,\n style: { transform: transform },\n };\n\n const firstClass: string = polygonGeometry.polygon.length > 4 ?\n \"mapillary-tag-completer\" :\n \"mapillary-tag-interactor\";\n\n vNodes.push(vd.h(\"div.\" + firstClass, completerProperties, []));\n }\n\n if (polygonGeometry.polygon.length > 3) {\n const [lastVertexBasicX, lastVertexBasicY]: number[] = polygonGeometry.getVertex2d(polygonGeometry.polygon.length - 3);\n const lastVertexCanvas: number[] =\n this._viewportCoords.basicToCanvasSafe(\n lastVertexBasicX,\n lastVertexBasicY,\n container,\n this._transform,\n camera);\n\n if (lastVertexCanvas != null) {\n const remove: (e: MouseEvent) => void = (e: MouseEvent): void => {\n e.stopPropagation();\n polygonGeometry.removeVertex2d(polygonGeometry.polygon.length - 3);\n };\n\n const transform: string = this._canvasToTransform(lastVertexCanvas);\n const completerProperties: vd.createProperties = {\n onclick: remove,\n style: { transform: transform },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-interactor\", completerProperties, []));\n }\n }\n\n const verticesBasic: number[][] = polygonGeometry.polygon.slice();\n verticesBasic.splice(-2, 2);\n for (const vertexBasic of verticesBasic) {\n const vertexCanvas: number[] =\n this._viewportCoords.basicToCanvasSafe(\n vertexBasic[0],\n vertexBasic[1],\n container,\n this._transform,\n camera);\n\n if (vertexCanvas != null) {\n const background: string = this._colorToBackground(this._options.color);\n const transform: string = this._canvasToTransform(vertexCanvas);\n const pointProperties: vd.createProperties = {\n style: {\n background: background,\n transform: transform,\n },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-vertex\", pointProperties, []));\n }\n }\n }\n\n return vNodes;\n }\n\n public addPoint(point: number[]): void {\n if (this._geometry instanceof RectGeometry) {\n const rectGeometry: RectGeometry = <RectGeometry>this._geometry;\n\n if (!rectGeometry.validate(point)) {\n return;\n }\n\n this._created$.next(this);\n } else if (this._geometry instanceof PolygonGeometry) {\n const polygonGeometry: PolygonGeometry = <PolygonGeometry>this._geometry;\n\n polygonGeometry.addVertex2d(point);\n }\n }\n\n protected _onGeometryChanged(): void {\n this._disposeLine(this._outline);\n this._disposeObjects();\n\n this._createGlObjects();\n }\n\n private _disposeObjects(): void {\n this._outline = null;\n this._glObjects = [];\n }\n\n private _createGlObjects(): void {\n const polygon3d: number[][] = this._geometry instanceof RectGeometry ?\n this._geometry.getPoints3d(this._transform) :\n (<PolygonGeometry>this._geometry).getVertices3d(this._transform);\n\n this._outline = this._createOutine(polygon3d, this._options.color);\n this._glObjects = [this._outline];\n }\n}\n","import {\n map,\n publishReplay,\n refCount,\n scan,\n share,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport {\n Observable,\n Subject,\n} from \"rxjs\";\nimport { CreateTag } from \"./tag/CreateTag\";\nimport { Geometry } from \"./geometry/Geometry\";\nimport { Component } from \"../Component\";\nimport { TagConfiguration } from \"../interfaces/TagConfiguration\";\n\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { Transform } from \"../../geo/Transform\";\nimport { PointsGeometry } from \"./geometry/PointsGeometry\";\nimport { ExtremePointCreateTag } from \"./tag/ExtremePointCreateTag\";\nimport { RectGeometry } from \"./geometry/RectGeometry\";\nimport { OutlineCreateTag } from \"./tag/OutlineCreateTag\";\nimport { PolygonGeometry } from \"./geometry/PolygonGeometry\";\n\ninterface CreateTagOperation {\n (tag: CreateTag<Geometry>): CreateTag<Geometry>;\n}\n\nexport class TagCreator {\n private _component: Component<TagConfiguration>;\n private _navigator: Navigator;\n\n private _tagOperation$: Subject<CreateTagOperation>;\n private _tag$: Observable<CreateTag<Geometry>>;\n private _replayedTag$: Observable<CreateTag<Geometry>>;\n\n private _createPoints$: Subject<number[]>;\n private _createPolygon$: Subject<number[]>;\n private _createRect$: Subject<number[]>;\n private _delete$: Subject<void>;\n\n constructor(component: Component<TagConfiguration>, navigator: Navigator) {\n this._component = component;\n this._navigator = navigator;\n\n this._tagOperation$ = new Subject<CreateTagOperation>();\n this._createPoints$ = new Subject<number[]>();\n this._createPolygon$ = new Subject<number[]>();\n this._createRect$ = new Subject<number[]>();\n this._delete$ = new Subject<void>();\n\n this._tag$ = this._tagOperation$.pipe(\n scan(\n (tag: CreateTag<Geometry>, operation: CreateTagOperation): CreateTag<Geometry> => {\n return operation(tag);\n },\n null),\n share());\n\n this._replayedTag$ = this._tag$.pipe(\n publishReplay(1),\n refCount());\n\n this._replayedTag$.subscribe();\n\n this._createPoints$.pipe(\n withLatestFrom(\n this._component.configuration$,\n this._navigator.stateService.currentTransform$),\n map(\n ([coord, conf, transform]: [number[], TagConfiguration, Transform]): CreateTagOperation => {\n return (): CreateTag<Geometry> => {\n const geometry: PointsGeometry = new PointsGeometry([\n [coord[0], coord[1]],\n [coord[0], coord[1]],\n ]);\n\n return new ExtremePointCreateTag(\n geometry,\n {\n color: conf.createColor,\n indicateCompleter: conf.indicatePointsCompleter,\n },\n transform);\n };\n }))\n .subscribe(this._tagOperation$);\n\n this._createRect$.pipe(\n withLatestFrom(\n this._component.configuration$,\n this._navigator.stateService.currentTransform$),\n map(\n ([coord, conf, transform]: [number[], TagConfiguration, Transform]): CreateTagOperation => {\n return (): CreateTag<Geometry> => {\n const geometry: RectGeometry = new RectGeometry([\n coord[0],\n coord[1],\n coord[0],\n coord[1],\n ]);\n\n return new OutlineCreateTag(geometry, { color: conf.createColor }, transform);\n };\n }))\n .subscribe(this._tagOperation$);\n\n this._createPolygon$.pipe(\n withLatestFrom(\n this._component.configuration$,\n this._navigator.stateService.currentTransform$),\n map(\n ([coord, conf, transform]: [number[], TagConfiguration, Transform]): CreateTagOperation => {\n return (): CreateTag<Geometry> => {\n const geometry: PolygonGeometry = new PolygonGeometry([\n [coord[0], coord[1]],\n [coord[0], coord[1]],\n [coord[0], coord[1]],\n ]);\n\n return new OutlineCreateTag(geometry, { color: conf.createColor }, transform);\n };\n }))\n .subscribe(this._tagOperation$);\n\n this._delete$.pipe(\n map(\n (): CreateTagOperation => {\n return (): CreateTag<Geometry> => {\n return null;\n };\n }))\n .subscribe(this._tagOperation$);\n }\n\n public get createRect$(): Subject<number[]> {\n return this._createRect$;\n }\n\n public get createPolygon$(): Subject<number[]> {\n return this._createPolygon$;\n }\n\n public get createPoints$(): Subject<number[]> {\n return this._createPoints$;\n }\n\n public get delete$(): Subject<void> {\n return this._delete$;\n }\n\n public get tag$(): Observable<CreateTag<Geometry>> {\n return this._tag$;\n }\n\n public get replayedTag$(): Observable<CreateTag<Geometry>> {\n return this._replayedTag$;\n }\n}\n","import * as THREE from \"three\";\nimport * as vd from \"virtual-dom\";\n\nimport { Geometry } from \"./geometry/Geometry\";\nimport { CreateTag } from \"./tag/CreateTag\";\nimport { RenderTag } from \"./tag/RenderTag\";\nimport { Tag } from \"./tag/Tag\";\n\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { ISpriteAtlas } from \"../../viewer/interfaces/ISpriteAtlas\";\n\nexport class TagDOMRenderer {\n public render(\n tags: RenderTag<Tag>[],\n createTag: CreateTag<Geometry>,\n atlas: ISpriteAtlas,\n camera: THREE.PerspectiveCamera,\n size: ViewportSize): vd.VNode {\n\n let vNodes: vd.VNode[] = [];\n\n for (const tag of tags) {\n vNodes = vNodes.concat(tag.getDOMObjects(atlas, camera, size));\n }\n\n if (createTag != null) {\n vNodes = vNodes.concat(createTag.getDOMObjects(camera, size));\n }\n\n return vd.h(\"div.mapillary-tag-container\", {}, vNodes);\n }\n\n public clear(): vd.VNode {\n return vd.h(\"div\", {}, []);\n }\n}\n","import * as THREE from \"three\";\n\nimport { Geometry } from \"./geometry/Geometry\";\nimport { CreateTag } from \"./tag/CreateTag\";\nimport { RenderTag } from \"./tag/RenderTag\";\nimport { Tag } from \"./tag/Tag\";\n\ntype TagObjects = {\n tag: RenderTag<Tag>;\n objects: THREE.Object3D[];\n retrievableObjects: THREE.Object3D[];\n};\n\ntype CreateTagObjects = {\n tag: CreateTag<Geometry>;\n objects: THREE.Object3D[];\n};\n\nexport class TagScene {\n private _createTag: CreateTagObjects;\n private _needsRender: boolean;\n private _objectTags: { [uuid: string]: string };\n private _raycaster: THREE.Raycaster;\n private _retrievableObjects: THREE.Object3D[];\n private _scene: THREE.Scene;\n private _tags: { [id: string]: TagObjects };\n\n constructor(scene?: THREE.Scene, raycaster?: THREE.Raycaster) {\n this._createTag = null;\n this._needsRender = false;\n this._raycaster = !!raycaster ? raycaster : new THREE.Raycaster();\n this._scene = !!scene ? scene : new THREE.Scene();\n\n this._objectTags = {};\n this._retrievableObjects = [];\n this._tags = {};\n }\n\n public get needsRender(): boolean {\n return this._needsRender;\n }\n\n public add(tags: RenderTag<Tag>[]): void {\n for (let tag of tags) {\n if (tag.tag.id in this._tags) {\n this._remove(tag.tag.id);\n }\n\n this._add(tag);\n }\n\n this._needsRender = true;\n }\n\n public addCreateTag(tag: CreateTag<Geometry>): void {\n for (const object of tag.glObjects) {\n this._scene.add(object);\n }\n\n this._createTag = { tag: tag, objects: tag.glObjects };\n\n this._needsRender = true;\n }\n\n public clear(): void {\n for (const id of Object.keys(this._tags)) {\n this._remove(id);\n }\n\n this._needsRender = false;\n }\n\n public get(id: string): RenderTag<Tag> {\n return this.has(id) ? this._tags[id].tag : undefined;\n }\n\n public has(id: string): boolean {\n return id in this._tags;\n }\n\n public hasCreateTag(): boolean {\n return this._createTag != null;\n }\n\n public intersectObjects([viewportX, viewportY]: number[], camera: THREE.Camera): string[] {\n this._raycaster.setFromCamera(new THREE.Vector2(viewportX, viewportY), camera);\n\n const intersects: THREE.Intersection[] = this._raycaster.intersectObjects(this._retrievableObjects);\n const intersectedIds: string[] = [];\n for (const intersect of intersects) {\n if (intersect.object.uuid in this._objectTags) {\n intersectedIds.push(this._objectTags[intersect.object.uuid]);\n }\n }\n\n return intersectedIds;\n }\n\n public remove(ids: string[]): void {\n for (const id of ids) {\n this._remove(id);\n }\n\n this._needsRender = true;\n }\n\n public removeAll(): void {\n for (const id of Object.keys(this._tags)) {\n this._remove(id);\n }\n\n this._needsRender = true;\n }\n\n public removeCreateTag(): void {\n if (this._createTag == null) {\n return;\n }\n\n for (const object of this._createTag.objects) {\n this._scene.remove(object);\n }\n\n this._createTag.tag.dispose();\n this._createTag = null;\n\n this._needsRender = true;\n }\n\n public render(\n perspectiveCamera: THREE.PerspectiveCamera,\n renderer: THREE.Renderer): void {\n\n renderer.render(this._scene, perspectiveCamera);\n\n this._needsRender = false;\n }\n\n public update(): void {\n this._needsRender = true;\n }\n\n public updateCreateTagObjects(tag: CreateTag<Geometry>): void {\n if (this._createTag.tag !== tag) {\n throw new Error(\"Create tags do not have the same reference.\");\n }\n\n for (let object of this._createTag.objects) {\n this._scene.remove(object);\n }\n\n for (const object of tag.glObjects) {\n this._scene.add(object);\n }\n\n this._createTag.objects = tag.glObjects;\n\n this._needsRender = true;\n }\n\n public updateObjects(tag: RenderTag<Tag>): void {\n const id: string = tag.tag.id;\n\n if (this._tags[id].tag !== tag) {\n throw new Error(\"Tags do not have the same reference.\");\n }\n\n const tagObjects: TagObjects = this._tags[id];\n\n this._removeObjects(tagObjects);\n\n delete this._tags[id];\n\n this._add(tag);\n this._needsRender = true;\n }\n\n private _add(tag: RenderTag<Tag>): void {\n const id: string = tag.tag.id;\n const tagObjects: TagObjects = { tag: tag, objects: [], retrievableObjects: [] };\n\n this._tags[id] = tagObjects;\n\n for (const object of tag.getGLObjects()) {\n tagObjects.objects.push(object);\n this._scene.add(object);\n }\n\n for (const retrievableObject of tag.getRetrievableObjects()) {\n tagObjects.retrievableObjects.push(retrievableObject);\n this._retrievableObjects.push(retrievableObject);\n this._objectTags[retrievableObject.uuid] = tag.tag.id;\n }\n }\n\n private _remove(id: string): void {\n const tagObjects: TagObjects = this._tags[id];\n\n this._removeObjects(tagObjects);\n\n tagObjects.tag.dispose();\n\n delete this._tags[id];\n }\n\n private _removeObjects(tagObjects: TagObjects): void {\n for (const object of tagObjects.objects) {\n this._scene.remove(object);\n }\n\n for (const retrievableObject of tagObjects.retrievableObjects) {\n const index: number = this._retrievableObjects.indexOf(retrievableObject);\n if (index !== -1) {\n this._retrievableObjects.splice(index, 1);\n }\n }\n }\n}\n","/**\n * Enumeration for tag modes\n * @enum {number}\n * @readonly\n * @description Modes for the interaction in the tag component.\n */\nexport enum TagMode {\n /**\n * Disables creating tags.\n */\n Default,\n\n /**\n * Create a point geometry through a click.\n */\n CreatePoint,\n\n /**\n * Create a points geometry through clicks.\n */\n CreatePoints,\n\n /**\n * Create a polygon geometry through clicks.\n */\n CreatePolygon,\n\n /**\n * Create a rect geometry through clicks.\n */\n CreateRect,\n\n /**\n * Create a rect geometry through drag.\n *\n * @description Claims the mouse which results in mouse handlers like\n * drag pan and scroll zoom becoming inactive.\n */\n CreateRectDrag,\n}\n","export enum TagOperation {\n None,\n Centroid,\n Vertex,\n}\n","/**\n * Enumeration for tag domains.\n * @enum {number}\n * @readonly\n * @description Defines where lines between two vertices are treated\n * as straight.\n *\n * Only applicable for polygons. For rectangles lines between\n * vertices are always treated as straight in the distorted 2D\n * projection and bended in the undistorted 3D space.\n */\nexport enum TagDomain {\n /**\n * Treats lines between two vertices as straight in the\n * distorted 2D projection, i.e. on the image. If the image\n * is distorted this will result in bended lines when rendered\n * in the undistorted 3D space.\n */\n TwoDimensional,\n\n /**\n * Treats lines as straight in the undistorted 3D space. If the\n * image is distorted this will result in bended lines when rendered\n * on the distorted 2D projection of the image.\n */\n ThreeDimensional,\n}\n","/**\n * Enumeration for alignments\n * @enum {number}\n * @readonly\n */\nexport enum Alignment {\n /**\n * Align to bottom\n */\n Bottom,\n\n /**\n * Align to bottom left\n */\n BottomLeft,\n\n /**\n * Align to bottom right\n */\n BottomRight,\n\n /**\n * Align to center\n */\n Center,\n\n /**\n * Align to left\n */\n Left,\n\n /**\n * Align to right\n */\n Right,\n\n /**\n * Align to top\n */\n Top,\n\n /**\n * Align to top left\n */\n TopLeft,\n\n /**\n * Align to top right\n */\n TopRight,\n}\n","import * as THREE from \"three\";\nimport * as vd from \"virtual-dom\";\n\nimport {\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport { TagInteraction } from \"../interfaces/TagInteraction\";\n\nimport { Transform } from \"../../../geo/Transform\";\nimport { ViewportCoords } from \"../../../geo/ViewportCoords\";\nimport { ViewportSize } from \"../../../render/interfaces/ViewportSize\";\nimport { ISpriteAtlas } from \"../../../viewer/interfaces/ISpriteAtlas\";\n\nexport abstract class RenderTag<T> {\n protected _tag: T;\n protected _transform: Transform;\n protected _viewportCoords: ViewportCoords;\n\n protected _glObjectsChanged$: Subject<RenderTag<T>>;\n protected _interact$: Subject<TagInteraction>;\n\n constructor(tag: T, transform: Transform, viewportCoords?: ViewportCoords) {\n this._tag = tag;\n this._transform = transform;\n this._viewportCoords = !!viewportCoords ? viewportCoords : new ViewportCoords();\n\n this._glObjectsChanged$ = new Subject<RenderTag<T>>();\n this._interact$ = new Subject<TagInteraction>();\n }\n\n public get glObjectsChanged$(): Observable<RenderTag<T>> {\n return this._glObjectsChanged$;\n }\n\n public get interact$(): Observable<TagInteraction> {\n return this._interact$;\n }\n\n public get tag(): T {\n return this._tag;\n }\n\n public abstract dispose(): void;\n\n public abstract getDOMObjects(atlas: ISpriteAtlas, camera: THREE.Camera, size: ViewportSize): vd.VNode[];\n\n public abstract getGLObjects(): THREE.Object3D[];\n\n public abstract getRetrievableObjects(): THREE.Object3D[];\n}\n","import * as THREE from \"three\";\nimport * as vd from \"virtual-dom\";\n\nimport { Subscription } from \"rxjs\";\n\nimport { TagOperation } from \"../TagOperation\";\nimport { RenderTag } from \"./RenderTag\";\nimport { Tag } from \"./Tag\";\n\nimport { InteractionCursor } from \"../interfaces/TagInteraction\";\n\nimport { Transform } from \"../../../geo/Transform\";\nimport { ViewportSize } from \"../../../render/interfaces/ViewportSize\";\nimport { ISpriteAtlas } from \"../../../viewer/interfaces/ISpriteAtlas\";\n\nexport abstract class OutlineRenderTagBase<T extends Tag> extends RenderTag<T> {\n protected _fill: THREE.Mesh;\n protected _outline: THREE.Line;\n\n private _changedSubscription: Subscription;\n private _geometryChangedSubscription: Subscription;\n\n constructor(tag: T, transform: Transform) {\n super(tag, transform);\n\n this._geometryChangedSubscription = this._tag.geometry.changed$\n .subscribe(\n (): void => {\n this._onGeometryChanged();\n });\n\n this._changedSubscription = this._tag.changed$\n .subscribe(\n (): void => {\n const glObjectsChanged: boolean = this._onTagChanged();\n\n if (glObjectsChanged) {\n this._glObjectsChanged$.next(this);\n }\n });\n }\n\n public dispose(): void {\n this._changedSubscription.unsubscribe();\n this._geometryChangedSubscription.unsubscribe();\n }\n\n public abstract getDOMObjects(atlas: ISpriteAtlas, camera: THREE.Camera, size: ViewportSize): vd.VNode[];\n\n public abstract getGLObjects(): THREE.Object3D[];\n\n public abstract getRetrievableObjects(): THREE.Object3D[];\n\n protected abstract _getPoints3d(): number[][];\n\n protected abstract _getTriangles(): number[];\n\n protected abstract _onGeometryChanged(): void;\n\n protected abstract _onTagChanged(): boolean;\n\n protected abstract _updateLineBasicMaterial(material: THREE.LineBasicMaterial): void;\n\n protected abstract _updateFillMaterial(material: THREE.MeshBasicMaterial): void;\n\n protected _colorToCss(color: number): string {\n return \"#\" + (\"000000\" + color.toString(16)).substr(-6);\n }\n\n protected _createFill(): THREE.Mesh {\n let triangles: number[] = this._getTriangles();\n let positions: Float32Array = new Float32Array(triangles);\n\n let geometry: THREE.BufferGeometry = new THREE.BufferGeometry();\n geometry.setAttribute(\"position\", new THREE.BufferAttribute(positions, 3));\n geometry.computeBoundingSphere();\n\n let material: THREE.MeshBasicMaterial =\n new THREE.MeshBasicMaterial({ side: THREE.DoubleSide, transparent: true });\n\n this._updateFillMaterial(material);\n\n return new THREE.Mesh(geometry, material);\n }\n\n protected _createLine(points3d: number[][]): THREE.Line {\n let positions: Float32Array = this._getLinePositions(points3d);\n\n let geometry: THREE.BufferGeometry = new THREE.BufferGeometry();\n geometry.setAttribute(\"position\", new THREE.BufferAttribute(positions, 3));\n geometry.computeBoundingSphere();\n\n let material: THREE.LineBasicMaterial = new THREE.LineBasicMaterial();\n this._updateLineBasicMaterial(material);\n\n const line: THREE.Line = new THREE.Line(geometry, material);\n line.renderOrder = 1;\n\n return line;\n }\n\n protected _createOutline(): THREE.Line {\n return this._createLine(this._getPoints3d());\n }\n\n protected _disposeFill(): void {\n if (this._fill == null) {\n return;\n }\n\n this._fill.geometry.dispose();\n (<THREE.Material>this._fill.material).dispose();\n this._fill = null;\n }\n\n protected _disposeOutline(): void {\n if (this._outline == null) {\n return;\n }\n\n this._outline.geometry.dispose();\n (<THREE.Material>this._outline.material).dispose();\n this._outline = null;\n }\n\n protected _getLinePositions(points3d: number[][]): Float32Array {\n let length: number = points3d.length;\n let positions: Float32Array = new Float32Array(length * 3);\n\n for (let i: number = 0; i < length; ++i) {\n let index: number = 3 * i;\n let position: number[] = points3d[i];\n\n positions[index + 0] = position[0];\n positions[index + 1] = position[1];\n positions[index + 2] = position[2];\n }\n\n return positions;\n }\n\n protected _interact(operation: TagOperation, cursor?: InteractionCursor, vertexIndex?: number): (e: MouseEvent) => void {\n return (e: MouseEvent): void => {\n let offsetX: number = e.offsetX - (<HTMLElement>e.target).offsetWidth / 2;\n let offsetY: number = e.offsetY - (<HTMLElement>e.target).offsetHeight / 2;\n\n this._interact$.next({\n cursor: cursor,\n offsetX: offsetX,\n offsetY: offsetY,\n operation: operation,\n tag: this._tag,\n vertexIndex: vertexIndex,\n });\n };\n }\n\n protected _updateFillGeometry(): void {\n let triangles: number[] = this._getTriangles();\n let positions: Float32Array = new Float32Array(triangles);\n\n let geometry: THREE.BufferGeometry = <THREE.BufferGeometry>this._fill.geometry;\n let attribute: THREE.BufferAttribute = <THREE.BufferAttribute>geometry.getAttribute(\"position\");\n\n if (attribute.array.length === positions.length) {\n attribute.set(positions);\n attribute.needsUpdate = true;\n } else {\n geometry.deleteAttribute(\"position\");\n geometry.setAttribute(\"position\", new THREE.BufferAttribute(positions, 3));\n }\n\n geometry.computeBoundingSphere();\n }\n\n protected _updateLine(line: THREE.Line, points3d: number[][]): void {\n let positions: Float32Array = this._getLinePositions(points3d);\n\n let geometry: THREE.BufferGeometry = <THREE.BufferGeometry>line.geometry;\n let attribute: THREE.BufferAttribute = <THREE.BufferAttribute>geometry.getAttribute(\"position\");\n\n attribute.set(positions);\n attribute.needsUpdate = true;\n\n geometry.computeBoundingSphere();\n }\n\n protected _updateOulineGeometry(): void {\n this._updateLine(this._outline, this._getPoints3d());\n }\n}\n","import * as THREE from \"three\";\nimport * as vd from \"virtual-dom\";\n\nimport { TagOperation } from \"../TagOperation\";\nimport { ExtremePointTag } from \"./ExtremePointTag\";\nimport { OutlineRenderTagBase } from \"./OutlineRenderTagBase\";\n\nimport { RectGeometry } from \"../geometry/RectGeometry\";\nimport { InteractionCursor } from \"../interfaces/TagInteraction\";\n\nimport { Transform } from \"../../../geo/Transform\";\nimport { ViewportSize } from \"../../../render/interfaces/ViewportSize\";\nimport { ISpriteAtlas } from \"../../../viewer/interfaces/ISpriteAtlas\";\nimport { isSpherical } from \"../../../geo/Geo\";\n\n/**\n * @class OutlineRenderTag\n * @classdesc Tag visualizing the properties of an OutlineTag.\n */\nexport class ExtremePointRenderTag extends OutlineRenderTagBase<ExtremePointTag> {\n private _rectGeometry: RectGeometry;\n\n constructor(tag: ExtremePointTag, transform: Transform) {\n super(tag, transform);\n\n this._rectGeometry = new RectGeometry(this._tag.geometry.getRect2d(transform));\n\n this._fill = !isSpherical(transform.cameraType) ?\n this._createFill() : null;\n\n this._outline = this._tag.lineWidth >= 1 ?\n this._createOutline() :\n null;\n }\n\n public dispose(): void {\n super.dispose();\n\n this._disposeFill();\n this._disposeOutline();\n }\n\n public getDOMObjects(atlas: ISpriteAtlas, camera: THREE.Camera, size: ViewportSize): vd.VNode[] {\n const vNodes: vd.VNode[] = [];\n const container: { offsetHeight: number, offsetWidth: number } = {\n offsetHeight: size.height, offsetWidth: size.width,\n };\n\n if (!this._tag.editable) {\n return vNodes;\n }\n\n const lineColor: string = this._colorToCss(this._tag.lineColor);\n\n const points2d: number[][] = this._tag.geometry.getPoints2d();\n\n for (let i: number = 0; i < points2d.length; i++) {\n const [vertexBasicX, vertexBasicY]: number[] = points2d[i];\n const vertexCanvas: number[] =\n this._viewportCoords.basicToCanvasSafe(\n vertexBasicX,\n vertexBasicY,\n container,\n this._transform,\n camera);\n\n if (vertexCanvas == null) {\n continue;\n }\n\n const cursor: InteractionCursor = \"crosshair\";\n\n const interact: (e: MouseEvent) => void = this._interact(TagOperation.Vertex, cursor, i);\n const vertexCanvasX: number = Math.round(vertexCanvas[0]);\n const vertexCanvasY: number = Math.round(vertexCanvas[1]);\n const transform: string = `translate(-50%, -50%) translate(${vertexCanvasX}px,${vertexCanvasY}px)`;\n\n const properties: vd.createProperties = {\n onpointerdown: interact,\n style: { background: lineColor, transform: transform, cursor: cursor },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-resizer\", properties, []));\n\n if (!this._tag.indicateVertices) {\n continue;\n }\n\n const pointProperties: vd.createProperties = {\n style: { background: lineColor, transform: transform },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-vertex\", pointProperties, []));\n }\n\n return vNodes;\n }\n\n public getGLObjects(): THREE.Object3D[] {\n const glObjects: THREE.Object3D[] = [];\n\n if (this._fill != null) {\n glObjects.push(this._fill);\n }\n\n if (this._outline != null) {\n glObjects.push(this._outline);\n }\n\n return glObjects;\n }\n\n public getRetrievableObjects(): THREE.Object3D[] {\n return this._fill != null ? [this._fill] : [];\n }\n\n protected _onGeometryChanged(): void {\n this._rectGeometry = new RectGeometry(this._tag.geometry.getRect2d(this._transform));\n\n if (this._fill != null) {\n this._updateFillGeometry();\n }\n\n if (this._outline != null) {\n this._updateOulineGeometry();\n }\n }\n\n protected _onTagChanged(): boolean {\n let glObjectsChanged: boolean = false;\n\n if (this._fill != null) {\n this._updateFillMaterial(<THREE.MeshBasicMaterial>this._fill.material);\n }\n\n if (this._outline == null) {\n if (this._tag.lineWidth >= 1) {\n this._outline = this._createOutline();\n glObjectsChanged = true;\n }\n } else {\n this._updateOutlineMaterial();\n }\n\n return glObjectsChanged;\n }\n\n protected _getPoints3d(): number[][] {\n return this._rectGeometry.getPoints3d(this._transform);\n }\n\n protected _getTriangles(): number[] {\n return this._rectGeometry.getTriangles3d(this._transform);\n }\n\n protected _updateFillMaterial(material: THREE.MeshBasicMaterial): void {\n material.color = new THREE.Color(this._tag.fillColor);\n material.opacity = this._tag.fillOpacity;\n material.needsUpdate = true;\n }\n\n protected _updateLineBasicMaterial(material: THREE.LineBasicMaterial): void {\n material.color = new THREE.Color(this._tag.lineColor);\n material.linewidth = Math.max(this._tag.lineWidth, 1);\n material.visible = this._tag.lineWidth >= 1 && this._tag.lineOpacity > 0;\n material.opacity = this._tag.lineOpacity;\n material.transparent = this._tag.lineOpacity < 1;\n material.needsUpdate = true;\n }\n\n private _updateOutlineMaterial(): void {\n let material: THREE.LineBasicMaterial = <THREE.LineBasicMaterial>this._outline.material;\n\n this._updateLineBasicMaterial(material);\n }\n}\n","import {\n share,\n map,\n} from \"rxjs/operators\";\nimport {\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport { EventEmitter } from \"../../../util/EventEmitter\";\nimport { Geometry } from \"../geometry/Geometry\";\nimport { TagEventType } from \"./events/TagEventType\";\nimport { TagStateEvent } from \"./events/TagStateEvent\";\n\n/**\n * @class Tag\n * @abstract\n * @classdesc Abstract class representing the basic functionality of for a tag.\n */\nexport abstract class Tag extends EventEmitter {\n protected _id: string;\n protected _geometry: Geometry;\n\n protected _notifyChanged$: Subject<Tag>;\n\n /**\n * Create a tag.\n *\n * @constructor\n * @param {string} id\n * @param {Geometry} geometry\n */\n constructor(id: string, geometry: Geometry) {\n super();\n\n this._id = id;\n this._geometry = geometry;\n\n this._notifyChanged$ = new Subject<Tag>();\n\n this._notifyChanged$\n .subscribe(\n (t: Tag): void => {\n const type: TagEventType = \"tag\";\n const event: TagStateEvent = {\n target: this,\n type,\n };\n this.fire(type, event);\n });\n\n this._geometry.changed$\n .subscribe(\n (g: Geometry): void => {\n const type: TagEventType = \"geometry\";\n const event: TagStateEvent = {\n target: this,\n type,\n };\n this.fire(type, event);\n });\n }\n\n /**\n * Get id property.\n * @returns {string}\n */\n public get id(): string {\n return this._id;\n }\n\n /**\n * Get geometry property.\n * @returns {Geometry} The geometry of the tag.\n */\n public get geometry(): Geometry {\n return this._geometry;\n }\n\n /**\n * Get changed observable.\n * @returns {Observable<Tag>}\n * @ignore\n */\n public get changed$(): Observable<Tag> {\n return this._notifyChanged$;\n }\n\n /**\n * Get geometry changed observable.\n * @returns {Observable<Tag>}\n * @ignore\n */\n public get geometryChanged$(): Observable<Tag> {\n return this._geometry.changed$.pipe(\n map(\n (): Tag => {\n return this;\n }),\n share());\n }\n\n public fire(\n type: \"tag\" | \"geometry\",\n event: TagStateEvent)\n : void;\n /** @ignore */\n public fire(\n type: TagEventType,\n event: TagStateEvent): void;\n public fire<T>(\n type: TagEventType,\n event: T)\n : void {\n super.fire(type, event);\n }\n\n public off(\n type: \"tag\" | \"geometry\",\n handler: (event: TagStateEvent) => void)\n : void;\n /** @ignore */\n public off(\n type: TagEventType,\n handler: (event: TagStateEvent) => void)\n : void;\n public off<T>(\n type: TagEventType,\n handler: (event: T) => void)\n : void {\n super.off(type, handler);\n }\n\n /**\n * Event fired when the geometry of the tag has changed.\n *\n * @event geometry\n * @example\n * ```js\n * var tag = new OutlineTag({ // tag options });\n * // Set an event listener\n * tag.on('geometry', function() {\n * console.log(\"A geometry event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"geometry\",\n handler: (event: TagStateEvent) => void)\n : void;\n /**\n * Event fired when a tag has been updated.\n *\n * @event tag\n * @example\n * ```js\n * var tag = new OutlineTag({ // tag options });\n * // Set an event listener\n * tag.on('tag', function() {\n * console.log(\"A tag event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"tag\",\n handler: (event: TagStateEvent) => void)\n : void;\n /** @ignore */\n public on(\n type: TagEventType,\n handler: (event: TagStateEvent) => void)\n : void;\n public on<T>(\n type: TagEventType,\n handler: (event: T) => void)\n : void {\n super.on(type, handler);\n }\n}\n","import { Tag } from \"./Tag\";\nimport { PointsGeometry } from \"../geometry/PointsGeometry\";\nimport { ExtremePointTagOptions } from \"../interfaces/ExtremePointTagOptions\";\n\n/**\n * @class ExtremePointTag\n *\n * @classdesc Tag holding properties for visualizing a extreme points\n * and their outline.\n *\n * @example\n * ```js\n * var geometry = new PointsGeometry([[0.3, 0.3], [0.5, 0.4]]);\n * var tag = new ExtremePointTag(\n * \"id-1\",\n * geometry\n * { editable: true, lineColor: 0xff0000 });\n *\n * tagComponent.add([tag]);\n * ```\n */\nexport class ExtremePointTag extends Tag {\n protected _geometry: PointsGeometry;\n\n private _editable: boolean;\n private _indicateVertices: boolean;\n private _lineColor: number;\n private _lineOpacity: number;\n private _lineWidth: number;\n private _fillColor: number;\n private _fillOpacity: number;\n\n /**\n * Create an extreme point tag.\n *\n * @override\n * @constructor\n * @param {string} id - Unique identifier of the tag.\n * @param {PointsGeometry} geometry - Geometry defining points of tag.\n * @param {ExtremePointTagOptions} options - Options defining the visual appearance and\n * behavior of the extreme point tag.\n */\n constructor(id: string, geometry: PointsGeometry, options?: ExtremePointTagOptions) {\n super(id, geometry);\n\n options = !!options ? options : {};\n\n this._editable = options.editable == null ? false : options.editable;\n this._fillColor = options.fillColor == null ? 0xFFFFFF : options.fillColor;\n this._fillOpacity = options.fillOpacity == null ? 0.0 : options.fillOpacity;\n this._indicateVertices = options.indicateVertices == null ? true : options.indicateVertices;\n this._lineColor = options.lineColor == null ? 0xFFFFFF : options.lineColor;\n this._lineOpacity = options.lineOpacity == null ? 1 : options.lineOpacity;\n this._lineWidth = options.lineWidth == null ? 1 : options.lineWidth;\n }\n\n /**\n * Get editable property.\n * @returns {boolean} Value indicating if tag is editable.\n */\n public get editable(): boolean {\n return this._editable;\n }\n\n /**\n * Set editable property.\n * @param {boolean}\n *\n * @fires changed\n */\n public set editable(value: boolean) {\n this._editable = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get fill color property.\n * @returns {number}\n */\n public get fillColor(): number {\n return this._fillColor;\n }\n\n /**\n * Set fill color property.\n * @param {number}\n *\n * @fires changed\n */\n public set fillColor(value: number) {\n this._fillColor = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get fill opacity property.\n * @returns {number}\n */\n public get fillOpacity(): number {\n return this._fillOpacity;\n }\n\n /**\n * Set fill opacity property.\n * @param {number}\n *\n * @fires changed\n */\n public set fillOpacity(value: number) {\n this._fillOpacity = value;\n this._notifyChanged$.next(this);\n }\n\n /** @inheritdoc */\n public get geometry(): PointsGeometry {\n return this._geometry;\n }\n\n /**\n * Get indicate vertices property.\n * @returns {boolean} Value indicating if vertices should be indicated\n * when tag is editable.\n */\n public get indicateVertices(): boolean {\n return this._indicateVertices;\n }\n\n /**\n * Set indicate vertices property.\n * @param {boolean}\n *\n * @fires changed\n */\n public set indicateVertices(value: boolean) {\n this._indicateVertices = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get line color property.\n * @returns {number}\n */\n public get lineColor(): number {\n return this._lineColor;\n }\n\n /**\n * Set line color property.\n * @param {number}\n *\n * @fires changed\n */\n public set lineColor(value: number) {\n this._lineColor = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get line opacity property.\n * @returns {number}\n */\n public get lineOpacity(): number {\n return this._lineOpacity;\n }\n\n /**\n * Set line opacity property.\n * @param {number}\n *\n * @fires changed\n */\n public set lineOpacity(value: number) {\n this._lineOpacity = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get line width property.\n * @returns {number}\n */\n public get lineWidth(): number {\n return this._lineWidth;\n }\n\n /**\n * Set line width property.\n * @param {number}\n *\n * @fires changed\n */\n public set lineWidth(value: number) {\n this._lineWidth = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Set options for tag.\n *\n * @description Sets all the option properties provided and keeps\n * the rest of the values as is.\n *\n * @param {ExtremePointTagOptions} options - Extreme point tag options\n *\n * @fires changed\n */\n public setOptions(options: ExtremePointTagOptions): void {\n this._editable = options.editable == null ? this._editable : options.editable;\n this._indicateVertices = options.indicateVertices == null ? this._indicateVertices : options.indicateVertices;\n this._lineColor = options.lineColor == null ? this._lineColor : options.lineColor;\n this._lineWidth = options.lineWidth == null ? this._lineWidth : options.lineWidth;\n this._fillColor = options.fillColor == null ? this._fillColor : options.fillColor;\n this._fillOpacity = options.fillOpacity == null ? this._fillOpacity : options.fillOpacity;\n this._notifyChanged$.next(this);\n }\n}\n","import * as THREE from \"three\";\nimport * as vd from \"virtual-dom\";\n\nimport { OutlineRenderTagBase } from \"./OutlineRenderTagBase\";\nimport { OutlineTag } from \"./OutlineTag\";\nimport { TagDomain } from \"./TagDomain\";\nimport { TagOperation } from \"../TagOperation\";\n\nimport { PolygonGeometry } from \"../geometry/PolygonGeometry\";\nimport { RectGeometry } from \"../geometry/RectGeometry\";\nimport { InteractionCursor } from \"../interfaces/TagInteraction\";\n\nimport { Transform } from \"../../../geo/Transform\";\nimport { ViewportSize } from \"../../../render/interfaces/ViewportSize\";\nimport { ISpriteAtlas } from \"../../../viewer/interfaces/ISpriteAtlas\";\nimport { isSpherical } from \"../../../geo/Geo\";\n\n/**\n * @class OutlineRenderTag\n * @classdesc Tag visualizing the properties of an OutlineTag.\n */\nexport class OutlineRenderTag extends OutlineRenderTagBase<OutlineTag> {\n private _holes: THREE.Line[];\n\n constructor(tag: OutlineTag, transform: Transform) {\n super(tag, transform);\n\n this._fill = !isSpherical(transform.cameraType) ?\n this._createFill() :\n tag.domain === TagDomain.TwoDimensional &&\n tag.geometry instanceof PolygonGeometry ?\n this._createFill() :\n null;\n\n this._holes = this._tag.lineWidth >= 1 ?\n this._createHoles() :\n [];\n\n this._outline = this._tag.lineWidth >= 1 ?\n this._createOutline() :\n null;\n }\n\n public dispose(): void {\n super.dispose();\n\n this._disposeFill();\n this._disposeHoles();\n this._disposeOutline();\n }\n\n public getDOMObjects(atlas: ISpriteAtlas, camera: THREE.Camera, size: ViewportSize): vd.VNode[] {\n const vNodes: vd.VNode[] = [];\n const isRect: boolean = this._tag.geometry instanceof RectGeometry;\n const isPerspective: boolean = !isSpherical(this._transform.cameraType);\n const container: { offsetHeight: number, offsetWidth: number } = {\n offsetHeight: size.height, offsetWidth: size.width,\n };\n\n if (this._tag.icon != null && (isRect || isPerspective)) {\n const [iconBasicX, iconBasicY]: number[] = this._tag.geometry instanceof RectGeometry ?\n this._tag.geometry.getVertex2d(this._tag.iconIndex) :\n this._tag.geometry.getPoleOfInaccessibility2d();\n\n const iconCanvas: number[] =\n this._viewportCoords.basicToCanvasSafe(\n iconBasicX,\n iconBasicY,\n container,\n this._transform,\n camera);\n\n if (iconCanvas != null) {\n const interact: (e: MouseEvent) => void = (): void => {\n this._interact$.next({ offsetX: 0, offsetY: 0, operation: TagOperation.None, tag: this._tag });\n };\n\n if (atlas.loaded) {\n const sprite: vd.VNode = atlas.getDOMSprite(this._tag.icon, this._tag.iconFloat);\n const iconCanvasX: number = Math.round(iconCanvas[0]);\n const iconCanvasY: number = Math.round(iconCanvas[1]);\n const transform: string = `translate(${iconCanvasX}px,${iconCanvasY}px)`;\n\n const click: (e: MouseEvent) => void = (e: MouseEvent): void => {\n e.stopPropagation();\n this._tag.click$.next(this._tag);\n };\n\n const properties: vd.createProperties = {\n onclick: click,\n onpointerdown: interact,\n style: { transform: transform },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-symbol\", properties, [sprite]));\n }\n }\n } else if (this._tag.text != null && (isRect || isPerspective)) {\n const [textBasicX, textBasicY]: number[] = this._tag.geometry instanceof RectGeometry ?\n this._tag.geometry.getVertex2d(3) :\n this._tag.geometry.getPoleOfInaccessibility2d();\n\n const textCanvas: number[] =\n this._viewportCoords.basicToCanvasSafe(\n textBasicX,\n textBasicY,\n container,\n this._transform,\n camera);\n\n if (textCanvas != null) {\n const textCanvasX: number = Math.round(textCanvas[0]);\n const textCanvasY: number = Math.round(textCanvas[1]);\n const transform: string = this._tag.geometry instanceof RectGeometry ?\n `translate(${textCanvasX}px,${textCanvasY}px)` :\n `translate(-50%, -50%) translate(${textCanvasX}px,${textCanvasY}px)`;\n\n const interact: (e: MouseEvent) => void = (): void => {\n this._interact$.next({ offsetX: 0, offsetY: 0, operation: TagOperation.None, tag: this._tag });\n };\n\n const properties: vd.createProperties = {\n onpointerdown: interact,\n style: {\n color: this._colorToCss(this._tag.textColor),\n transform: transform,\n },\n textContent: this._tag.text,\n };\n\n vNodes.push(vd.h(\"span.mapillary-tag-symbol\", properties, []));\n }\n }\n\n if (!this._tag.editable) {\n return vNodes;\n }\n\n const lineColor: string = this._colorToCss(this._tag.lineColor);\n\n if (this._tag.geometry instanceof RectGeometry) {\n const [centroidBasicX, centroidBasicY]: number[] = this._tag.geometry.getCentroid2d();\n const centroidCanvas: number[] =\n this._viewportCoords.basicToCanvasSafe(\n centroidBasicX,\n centroidBasicY,\n container,\n this._transform,\n camera);\n\n if (centroidCanvas != null) {\n const interact: (e: MouseEvent) => void = this._interact(TagOperation.Centroid, \"move\");\n const centroidCanvasX: number = Math.round(centroidCanvas[0]);\n const centroidCanvasY: number = Math.round(centroidCanvas[1]);\n const transform: string = `translate(-50%, -50%) translate(${centroidCanvasX}px,${centroidCanvasY}px)`;\n\n const properties: vd.createProperties = {\n onpointerdown: interact,\n style: { background: lineColor, transform: transform },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-mover\", properties, []));\n }\n }\n\n const vertices2d: number[][] = this._tag.geometry.getVertices2d();\n\n for (let i: number = 0; i < vertices2d.length - 1; i++) {\n if (isRect &&\n ((this._tag.icon != null && i === this._tag.iconIndex) ||\n (this._tag.icon == null && this._tag.text != null && i === 3))) {\n continue;\n }\n\n const [vertexBasicX, vertexBasicY]: number[] = vertices2d[i];\n const vertexCanvas: number[] =\n this._viewportCoords.basicToCanvasSafe(\n vertexBasicX,\n vertexBasicY,\n container,\n this._transform,\n camera);\n\n if (vertexCanvas == null) {\n continue;\n }\n\n const cursor: InteractionCursor = isRect ?\n i % 2 === 0 ? \"nesw-resize\" : \"nwse-resize\" :\n \"crosshair\";\n\n const interact: (e: MouseEvent) => void = this._interact(TagOperation.Vertex, cursor, i);\n const vertexCanvasX: number = Math.round(vertexCanvas[0]);\n const vertexCanvasY: number = Math.round(vertexCanvas[1]);\n const transform: string = `translate(-50%, -50%) translate(${vertexCanvasX}px,${vertexCanvasY}px)`;\n\n const properties: vd.createProperties = {\n onpointerdown: interact,\n style: { background: lineColor, transform: transform, cursor: cursor },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-resizer\", properties, []));\n\n if (!this._tag.indicateVertices) {\n continue;\n }\n\n const pointProperties: vd.createProperties = {\n style: { background: lineColor, transform: transform },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-vertex\", pointProperties, []));\n }\n\n return vNodes;\n }\n\n public getGLObjects(): THREE.Object3D[] {\n const glObjects: THREE.Object3D[] = [];\n\n if (this._fill != null) {\n glObjects.push(this._fill);\n }\n\n for (const hole of this._holes) {\n glObjects.push(hole);\n }\n\n if (this._outline != null) {\n glObjects.push(this._outline);\n }\n\n return glObjects;\n }\n\n public getRetrievableObjects(): THREE.Object3D[] {\n return this._fill != null ? [this._fill] : [];\n }\n\n protected _onGeometryChanged(): void {\n if (this._fill != null) {\n this._updateFillGeometry();\n }\n\n if (this._holes.length > 0) {\n this._updateHoleGeometries();\n }\n\n if (this._outline != null) {\n this._updateOulineGeometry();\n }\n }\n\n protected _onTagChanged(): boolean {\n let glObjectsChanged: boolean = false;\n\n if (this._fill != null) {\n this._updateFillMaterial(<THREE.MeshBasicMaterial>this._fill.material);\n }\n\n if (this._outline == null) {\n if (this._tag.lineWidth >= 1) {\n this._holes = this._createHoles();\n this._outline = this._createOutline();\n glObjectsChanged = true;\n }\n } else {\n this._updateHoleMaterials();\n this._updateOutlineMaterial();\n }\n\n return glObjectsChanged;\n }\n\n protected _getPoints3d(): number[][] {\n return this._in3dDomain() ?\n (<PolygonGeometry>this._tag.geometry).getVertices3d(this._transform) :\n this._tag.geometry.getPoints3d(this._transform);\n }\n\n protected _getTriangles(): number[] {\n return this._in3dDomain() ?\n (<PolygonGeometry>this._tag.geometry).get3dDomainTriangles3d(this._transform) :\n this._tag.geometry.getTriangles3d(this._transform);\n }\n\n protected _updateFillMaterial(material: THREE.MeshBasicMaterial): void {\n material.color = new THREE.Color(this._tag.fillColor);\n material.opacity = this._tag.fillOpacity;\n material.needsUpdate = true;\n }\n\n protected _updateLineBasicMaterial(material: THREE.LineBasicMaterial): void {\n material.color = new THREE.Color(this._tag.lineColor);\n material.linewidth = Math.max(this._tag.lineWidth, 1);\n material.visible = this._tag.lineWidth >= 1 && this._tag.lineOpacity > 0;\n material.opacity = this._tag.lineOpacity;\n material.transparent = this._tag.lineOpacity < 1;\n material.needsUpdate = true;\n }\n\n private _createHoles(): THREE.Line[] {\n let holes: THREE.Line[] = [];\n\n if (this._tag.geometry instanceof PolygonGeometry) {\n let holes3d: number[][][] = this._getHoles3d();\n\n for (let holePoints3d of holes3d) {\n let hole: THREE.Line = this._createLine(holePoints3d);\n holes.push(hole);\n }\n }\n\n return holes;\n }\n\n private _disposeHoles(): void {\n for (let hole of this._holes) {\n hole.geometry.dispose();\n (<THREE.Material>hole.material).dispose();\n }\n\n this._holes = [];\n }\n\n private _getHoles3d(): number[][][] {\n const polygonGeometry: PolygonGeometry = <PolygonGeometry>this._tag.geometry;\n\n return this._in3dDomain() ?\n polygonGeometry.getHoleVertices3d(this._transform) :\n polygonGeometry.getHolePoints3d(this._transform);\n }\n\n private _in3dDomain(): boolean {\n return this._tag.geometry instanceof PolygonGeometry && this._tag.domain === TagDomain.ThreeDimensional;\n }\n\n private _updateHoleGeometries(): void {\n let holes3d: number[][][] = this._getHoles3d();\n\n if (holes3d.length !== this._holes.length) {\n throw new Error(\"Changing the number of holes is not supported.\");\n }\n\n for (let i: number = 0; i < this._holes.length; i++) {\n let holePoints3d: number[][] = holes3d[i];\n let hole: THREE.Line = this._holes[i];\n\n this._updateLine(hole, holePoints3d);\n }\n }\n\n private _updateHoleMaterials(): void {\n for (const hole of this._holes) {\n this._updateLineBasicMaterial(<THREE.LineBasicMaterial>hole.material);\n }\n }\n\n private _updateOutlineMaterial(): void {\n this._updateLineBasicMaterial(<THREE.LineBasicMaterial>this._outline.material);\n }\n}\n","import { Subject } from \"rxjs\";\nimport { Alignment } from \"../../../viewer/enums/Alignment\";\n\nimport { PolygonGeometry } from \"../geometry/PolygonGeometry\";\nimport { VertexGeometry } from \"../geometry/VertexGeometry\";\nimport { OutlineTagOptions } from \"../interfaces/OutlineTagOptions\";\n\nimport { Tag } from \"./Tag\";\nimport { TagDomain } from \"./TagDomain\";\nimport { TagEventType } from \"./events/TagEventType\";\nimport { TagStateEvent } from \"./events/TagStateEvent\";\n\n/**\n * @class OutlineTag\n *\n * @classdesc Tag holding properties for visualizing a geometry outline.\n *\n * @example\n * ```js\n * var geometry = new RectGeometry([0.3, 0.3, 0.5, 0.4]);\n * var tag = new OutlineTag(\n * \"id-1\",\n * geometry\n * { editable: true, lineColor: 0xff0000 });\n *\n * tagComponent.add([tag]);\n * ```\n */\nexport class OutlineTag extends Tag {\n protected _geometry: VertexGeometry;\n\n private _domain: TagDomain;\n private _editable: boolean;\n private _icon: string;\n private _iconFloat: Alignment;\n private _iconIndex: number;\n private _indicateVertices: boolean;\n private _lineColor: number;\n private _lineOpacity: number;\n private _lineWidth: number;\n private _fillColor: number;\n private _fillOpacity: number;\n private _text: string;\n private _textColor: number;\n\n private _click$: Subject<OutlineTag>;\n\n /**\n * Create an outline tag.\n *\n * @override\n * @constructor\n * @param {string} id - Unique identifier of the tag.\n * @param {VertexGeometry} geometry - Geometry defining vertices of tag.\n * @param {OutlineTagOptions} options - Options defining the visual appearance and\n * behavior of the outline tag.\n */\n constructor(id: string, geometry: VertexGeometry, options?: OutlineTagOptions) {\n super(id, geometry);\n\n options = !!options ? options : {};\n\n const domain: TagDomain = options.domain != null && geometry instanceof PolygonGeometry ?\n options.domain : TagDomain.TwoDimensional;\n\n const twoDimensionalPolygon: boolean = this._twoDimensionalPolygon(domain, geometry);\n\n this._domain = domain;\n this._editable = options.editable == null || twoDimensionalPolygon ? false : options.editable;\n this._fillColor = options.fillColor == null ? 0xFFFFFF : options.fillColor;\n this._fillOpacity = options.fillOpacity == null ? 0.0 : options.fillOpacity;\n this._icon = options.icon === undefined ? null : options.icon;\n this._iconFloat = options.iconFloat == null ? Alignment.Center : options.iconFloat;\n this._iconIndex = options.iconIndex == null ? 3 : options.iconIndex;\n this._indicateVertices = options.indicateVertices == null ? true : options.indicateVertices;\n this._lineColor = options.lineColor == null ? 0xFFFFFF : options.lineColor;\n this._lineOpacity = options.lineOpacity == null ? 1 : options.lineOpacity;\n this._lineWidth = options.lineWidth == null ? 1 : options.lineWidth;\n this._text = options.text === undefined ? null : options.text;\n this._textColor = options.textColor == null ? 0xFFFFFF : options.textColor;\n\n this._click$ = new Subject<OutlineTag>();\n\n this._click$\n .subscribe(\n (): void => {\n const type: TagEventType = \"click\";\n const event: TagStateEvent = {\n target: this,\n type,\n };\n this.fire(type, event);\n });\n }\n\n /**\n * Click observable.\n *\n * @description An observable emitting the tag when the icon of the\n * tag has been clicked.\n *\n * @returns {Observable<Tag>}\n */\n public get click$(): Subject<OutlineTag> {\n return this._click$;\n }\n\n /**\n * Get domain property.\n *\n * @description Readonly property that can only be set in constructor.\n *\n * @returns Value indicating the domain of the tag.\n */\n public get domain(): TagDomain {\n return this._domain;\n }\n\n /**\n * Get editable property.\n * @returns {boolean} Value indicating if tag is editable.\n */\n public get editable(): boolean {\n return this._editable;\n }\n\n /**\n * Set editable property.\n * @param {boolean}\n *\n * @fires changed\n */\n public set editable(value: boolean) {\n if (this._twoDimensionalPolygon(this._domain, this._geometry)) {\n return;\n }\n\n this._editable = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get fill color property.\n * @returns {number}\n */\n public get fillColor(): number {\n return this._fillColor;\n }\n\n /**\n * Set fill color property.\n * @param {number}\n *\n * @fires changed\n */\n public set fillColor(value: number) {\n this._fillColor = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get fill opacity property.\n * @returns {number}\n */\n public get fillOpacity(): number {\n return this._fillOpacity;\n }\n\n /**\n * Set fill opacity property.\n * @param {number}\n *\n * @fires changed\n */\n public set fillOpacity(value: number) {\n this._fillOpacity = value;\n this._notifyChanged$.next(this);\n }\n\n /** @inheritdoc */\n public get geometry(): VertexGeometry {\n return this._geometry;\n }\n\n /**\n * Get icon property.\n * @returns {string}\n */\n public get icon(): string {\n return this._icon;\n }\n\n /**\n * Set icon property.\n * @param {string}\n *\n * @fires changed\n */\n public set icon(value: string) {\n this._icon = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get icon float property.\n * @returns {Alignment}\n */\n public get iconFloat(): Alignment {\n return this._iconFloat;\n }\n\n /**\n * Set icon float property.\n * @param {Alignment}\n *\n * @fires changed\n */\n public set iconFloat(value: Alignment) {\n this._iconFloat = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get icon index property.\n * @returns {number}\n */\n public get iconIndex(): number {\n return this._iconIndex;\n }\n\n /**\n * Set icon index property.\n * @param {number}\n *\n * @fires changed\n */\n public set iconIndex(value: number) {\n this._iconIndex = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get indicate vertices property.\n * @returns {boolean} Value indicating if vertices should be indicated\n * when tag is editable.\n */\n public get indicateVertices(): boolean {\n return this._indicateVertices;\n }\n\n /**\n * Set indicate vertices property.\n * @param {boolean}\n *\n * @fires changed\n */\n public set indicateVertices(value: boolean) {\n this._indicateVertices = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get line color property.\n * @returns {number}\n */\n public get lineColor(): number {\n return this._lineColor;\n }\n\n /**\n * Set line color property.\n * @param {number}\n *\n * @fires changed\n */\n public set lineColor(value: number) {\n this._lineColor = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get line opacity property.\n * @returns {number}\n */\n public get lineOpacity(): number {\n return this._lineOpacity;\n }\n\n /**\n * Set line opacity property.\n * @param {number}\n *\n * @fires changed\n */\n public set lineOpacity(value: number) {\n this._lineOpacity = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get line width property.\n * @returns {number}\n */\n public get lineWidth(): number {\n return this._lineWidth;\n }\n\n /**\n * Set line width property.\n * @param {number}\n *\n * @fires changed\n */\n public set lineWidth(value: number) {\n this._lineWidth = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get text property.\n * @returns {string}\n */\n public get text(): string {\n return this._text;\n }\n\n /**\n * Set text property.\n * @param {string}\n *\n * @fires changed\n */\n public set text(value: string) {\n this._text = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get text color property.\n * @returns {number}\n */\n public get textColor(): number {\n return this._textColor;\n }\n\n /**\n * Set text color property.\n * @param {number}\n *\n * @fires changed\n */\n public set textColor(value: number) {\n this._textColor = value;\n this._notifyChanged$.next(this);\n }\n\n public fire(\n type: TagStateEvent[\"type\"],\n event: TagStateEvent)\n : void;\n /** @ignore */\n public fire(\n type: TagEventType,\n event: TagStateEvent)\n : void;\n public fire(\n type: TagEventType,\n event: TagStateEvent)\n : void {\n super.fire(type, event);\n }\n\n public off(\n type: TagStateEvent[\"type\"],\n handler: (event: TagStateEvent) => void)\n : void;\n /** @ignore */\n public off(\n type: TagEventType,\n handler: (event: TagStateEvent) => void)\n : void;\n public off(\n type: TagEventType,\n handler: (event: TagStateEvent) => void)\n : void {\n super.off(type, handler);\n }\n\n /**\n * Event fired when the icon of the outline tag is clicked.\n *\n * @event click\n * @example\n * ```js\n * var tag = new OutlineTag({ // tag options });\n * // Set an event listener\n * tag.on('click', function() {\n * console.log(\"A click event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"click\",\n handler: (event: TagStateEvent) => void)\n : void;\n /**\n * Event fired when the geometry of the tag has changed.\n *\n * @event geometry\n * @example\n * ```js\n * var tag = new OutlineTag({ // tag options });\n * // Set an event listener\n * tag.on('geometry', function() {\n * console.log(\"A geometry event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"geometry\",\n handler: (event: TagStateEvent) => void)\n : void;\n /**\n * Event fired when a tag has been updated.\n *\n * @event tag\n * @example\n * ```js\n * var tag = new OutlineTag({ // tag options });\n * // Set an event listener\n * tag.on('tag', function() {\n * console.log(\"A tag event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"tag\",\n handler: (event: TagStateEvent) => void)\n : void;\n public on(\n type: TagEventType,\n handler: (event: TagStateEvent) => void)\n : void {\n super.on(type, handler);\n }\n\n /**\n * Set options for tag.\n *\n * @description Sets all the option properties provided and keeps\n * the rest of the values as is.\n *\n * @param {OutlineTagOptions} options - Outline tag options\n *\n * @fires changed\n */\n public setOptions(options: OutlineTagOptions): void {\n const twoDimensionalPolygon: boolean = this._twoDimensionalPolygon(this._domain, this._geometry);\n\n this._editable = twoDimensionalPolygon || options.editable == null ? this._editable : options.editable;\n this._icon = options.icon === undefined ? this._icon : options.icon;\n this._iconFloat = options.iconFloat == null ? this._iconFloat : options.iconFloat;\n this._iconIndex = options.iconIndex == null ? this._iconIndex : options.iconIndex;\n this._indicateVertices = options.indicateVertices == null ? this._indicateVertices : options.indicateVertices;\n this._lineColor = options.lineColor == null ? this._lineColor : options.lineColor;\n this._lineWidth = options.lineWidth == null ? this._lineWidth : options.lineWidth;\n this._fillColor = options.fillColor == null ? this._fillColor : options.fillColor;\n this._fillOpacity = options.fillOpacity == null ? this._fillOpacity : options.fillOpacity;\n this._text = options.text === undefined ? this._text : options.text;\n this._textColor = options.textColor == null ? this._textColor : options.textColor;\n this._notifyChanged$.next(this);\n }\n\n private _twoDimensionalPolygon(domain: TagDomain, geometry: VertexGeometry): boolean {\n return domain !== TagDomain.ThreeDimensional && geometry instanceof PolygonGeometry;\n }\n}\n","import * as THREE from \"three\";\nimport * as vd from \"virtual-dom\";\n\nimport { TagOperation } from \"../TagOperation\";\nimport { RenderTag } from \"./RenderTag\";\nimport { SpotTag } from \"./SpotTag\";\nimport { Tag } from \"./Tag\";\n\nimport { InteractionCursor } from \"../interfaces/TagInteraction\";\n\nimport { ViewportSize } from \"../../../render/interfaces/ViewportSize\";\nimport { Alignment } from \"../../../viewer/enums/Alignment\";\nimport { ISpriteAtlas } from \"../../../viewer/interfaces/ISpriteAtlas\";\n\n/**\n * @class SpotRenderTag\n * @classdesc Tag visualizing the properties of a SpotTag.\n */\nexport class SpotRenderTag extends RenderTag<SpotTag> {\n public dispose(): void { /* noop */ }\n\n public getDOMObjects(atlas: ISpriteAtlas, camera: THREE.Camera, size: ViewportSize): vd.VNode[] {\n const tag: SpotTag = this._tag;\n const container: { offsetHeight: number, offsetWidth: number } = {\n offsetHeight: size.height, offsetWidth: size.width,\n };\n\n const vNodes: vd.VNode[] = [];\n const [centroidBasicX, centroidBasicY]: number[] = tag.geometry.getCentroid2d();\n const centroidCanvas: number[] =\n this._viewportCoords.basicToCanvasSafe(\n centroidBasicX,\n centroidBasicY,\n container,\n this._transform,\n camera);\n\n if (centroidCanvas != null) {\n const interactNone: (e: MouseEvent) => void = (e: MouseEvent): void => {\n this._interact$.next({ offsetX: 0, offsetY: 0, operation: TagOperation.None, tag: tag });\n };\n\n const canvasX: number = Math.round(centroidCanvas[0]);\n const canvasY: number = Math.round(centroidCanvas[1]);\n\n if (tag.icon != null) {\n if (atlas.loaded) {\n const sprite: vd.VNode = atlas.getDOMSprite(tag.icon, Alignment.Bottom);\n const iconTransform: string = `translate(${canvasX}px,${canvasY + 8}px)`;\n const properties: vd.createProperties = {\n onpointerdown: interactNone,\n style: {\n pointerEvents: \"all\",\n transform: iconTransform,\n },\n };\n\n vNodes.push(vd.h(\"div\", properties, [sprite]));\n }\n } else if (tag.text != null) {\n const textTransform: string = `translate(-50%,0%) translate(${canvasX}px,${canvasY + 8}px)`;\n const properties: vd.createProperties = {\n onpointerdown: interactNone,\n style: {\n color: this._colorToCss(tag.textColor),\n transform: textTransform,\n },\n textContent: tag.text,\n };\n\n vNodes.push(vd.h(\"span.mapillary-tag-symbol\", properties, []));\n }\n\n const interact: (e: MouseEvent) => void = this._interact(TagOperation.Centroid, tag, \"move\");\n const background: string = this._colorToCss(tag.color);\n const transform: string = `translate(-50%,-50%) translate(${canvasX}px,${canvasY}px)`;\n\n if (tag.editable) {\n let interactorProperties: vd.createProperties = {\n onpointerdown: interact,\n style: {\n background: background,\n transform: transform,\n },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-spot-interactor\", interactorProperties, []));\n }\n\n const pointProperties: vd.createProperties = {\n style: {\n background: background,\n transform: transform,\n },\n };\n\n vNodes.push(vd.h(\"div.mapillary-tag-vertex\", pointProperties, []));\n }\n\n return vNodes;\n }\n\n public getGLObjects(): THREE.Object3D[] { return []; }\n\n public getRetrievableObjects(): THREE.Object3D[] { return []; }\n\n private _colorToCss(color: number): string {\n return \"#\" + (\"000000\" + color.toString(16)).substr(-6);\n }\n\n private _interact(operation: TagOperation, tag: Tag, cursor: InteractionCursor, vertexIndex?: number): (e: MouseEvent) => void {\n return (e: MouseEvent): void => {\n const offsetX: number = e.offsetX - (<HTMLElement>e.target).offsetWidth / 2;\n const offsetY: number = e.offsetY - (<HTMLElement>e.target).offsetHeight / 2;\n\n this._interact$.next({\n cursor: cursor,\n offsetX: offsetX,\n offsetY: offsetY,\n operation: operation,\n tag: tag,\n vertexIndex: vertexIndex,\n });\n };\n }\n}\n","import { Tag } from \"./Tag\";\nimport { Geometry } from \"../geometry/Geometry\";\nimport { SpotTagOptions } from \"../interfaces/SpotTagOptions\";\n\n/**\n * @class SpotTag\n *\n * @classdesc Tag holding properties for visualizing the centroid of a geometry.\n *\n * @example\n * ```js\n * var geometry = new PointGeometry([0.3, 0.3]);\n * var tag = new SpotTag(\n * \"id-1\",\n * geometry\n * { editable: true, color: 0xff0000 });\n *\n * tagComponent.add([tag]);\n * ```\n */\nexport class SpotTag extends Tag {\n protected _geometry: Geometry;\n\n private _color: number;\n private _editable: boolean;\n private _icon: string;\n private _text: string;\n private _textColor: number;\n\n /**\n * Create a spot tag.\n *\n * @override\n * @constructor\n * @param {string} id\n * @param {Geometry} geometry\n * @param {IOutlineTagOptions} options - Options defining the visual appearance and\n * behavior of the spot tag.\n */\n constructor(id: string, geometry: Geometry, options?: SpotTagOptions) {\n super(id, geometry);\n\n options = !!options ? options : {};\n\n this._color = options.color == null ? 0xFFFFFF : options.color;\n this._editable = options.editable == null ? false : options.editable;\n this._icon = options.icon === undefined ? null : options.icon;\n this._text = options.text === undefined ? null : options.text;\n this._textColor = options.textColor == null ? 0xFFFFFF : options.textColor;\n }\n\n /**\n * Get color property.\n * @returns {number} The color of the spot as a hexagonal number;\n */\n public get color(): number {\n return this._color;\n }\n\n /**\n * Set color property.\n * @param {number}\n *\n * @fires changed\n */\n public set color(value: number) {\n this._color = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get editable property.\n * @returns {boolean} Value indicating if tag is editable.\n */\n public get editable(): boolean {\n return this._editable;\n }\n\n /**\n * Set editable property.\n * @param {boolean}\n *\n * @fires changed\n */\n public set editable(value: boolean) {\n this._editable = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get icon property.\n * @returns {string}\n */\n public get icon(): string {\n return this._icon;\n }\n\n /**\n * Set icon property.\n * @param {string}\n *\n * @fires changed\n */\n public set icon(value: string) {\n this._icon = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get text property.\n * @returns {string}\n */\n public get text(): string {\n return this._text;\n }\n\n /**\n * Set text property.\n * @param {string}\n *\n * @fires changed\n */\n public set text(value: string) {\n this._text = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Get text color property.\n * @returns {number}\n */\n public get textColor(): number {\n return this._textColor;\n }\n\n /**\n * Set text color property.\n * @param {number}\n *\n * @fires changed\n */\n public set textColor(value: number) {\n this._textColor = value;\n this._notifyChanged$.next(this);\n }\n\n /**\n * Set options for tag.\n *\n * @description Sets all the option properties provided and keps\n * the rest of the values as is.\n *\n * @param {SpotTagOptions} options - Spot tag options\n *\n * @fires changed\n */\n public setOptions(options: SpotTagOptions): void {\n this._color = options.color == null ? this._color : options.color;\n this._editable = options.editable == null ? this._editable : options.editable;\n this._icon = options.icon === undefined ? this._icon : options.icon;\n this._text = options.text === undefined ? this._text : options.text;\n this._textColor = options.textColor == null ? this._textColor : options.textColor;\n this._notifyChanged$.next(this);\n }\n}\n","import {\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport { ExtremePointRenderTag } from \"./tag/ExtremePointRenderTag\";\nimport { ExtremePointTag } from \"./tag/ExtremePointTag\";\nimport { OutlineRenderTag } from \"./tag/OutlineRenderTag\";\nimport { OutlineTag } from \"./tag/OutlineTag\";\nimport { RenderTag } from \"./tag/RenderTag\";\nimport { SpotRenderTag } from \"./tag/SpotRenderTag\";\nimport { SpotTag } from \"./tag/SpotTag\";\nimport { Tag } from \"./tag/Tag\";\n\nimport { Transform } from \"../../geo/Transform\";\n\nexport class TagSet {\n private _active: boolean;\n\n private _hash: { [id: string]: RenderTag<Tag> };\n private _hashDeactivated: { [id: string]: Tag };\n\n private _notifyChanged$: Subject<TagSet>;\n\n constructor() {\n this._active = false;\n this._hash = {};\n this._hashDeactivated = {};\n this._notifyChanged$ = new Subject<TagSet>();\n }\n\n public get active(): boolean {\n return this._active;\n }\n\n public get changed$(): Observable<TagSet> {\n return this._notifyChanged$;\n }\n\n public activate(transform: Transform): void {\n if (this._active) {\n return;\n }\n\n for (const id in this._hashDeactivated) {\n if (!this._hashDeactivated.hasOwnProperty(id)) {\n continue;\n }\n\n const tag: Tag = this._hashDeactivated[id];\n this._add(tag, transform);\n }\n\n this._hashDeactivated = {};\n this._active = true;\n\n this._notifyChanged$.next(this);\n }\n\n public deactivate(): void {\n if (!this._active) {\n return;\n }\n\n for (const id in this._hash) {\n if (!this._hash.hasOwnProperty(id)) {\n continue;\n }\n\n this._hashDeactivated[id] = this._hash[id].tag;\n }\n\n this._hash = {};\n this._active = false;\n }\n\n public add(tags: Tag[], transform: Transform): void {\n this._assertActivationState(true);\n\n for (const tag of tags) {\n this._add(tag, transform);\n }\n\n this._notifyChanged$.next(this);\n }\n\n public addDeactivated(tags: Tag[]): void {\n this._assertActivationState(false);\n\n for (const tag of tags) {\n if (!(\n tag instanceof OutlineTag ||\n tag instanceof SpotTag ||\n tag instanceof ExtremePointTag\n )) {\n throw new Error(\"Tag type not supported\");\n }\n\n this._hashDeactivated[tag.id] = tag;\n }\n }\n\n public get(id: string): RenderTag<Tag> {\n return this.has(id) ? this._hash[id] : undefined;\n }\n\n public getAll(): RenderTag<Tag>[] {\n const hash: { [id: string]: RenderTag<Tag> } = this._hash;\n\n return Object.keys(hash)\n .map(\n (id: string): RenderTag<Tag> => {\n return hash[id];\n });\n }\n\n public getAllDeactivated(): Tag[] {\n const hashDeactivated: { [id: string]: Tag } = this._hashDeactivated;\n\n return Object.keys(hashDeactivated)\n .map(\n (id: string): Tag => {\n return hashDeactivated[id];\n });\n }\n\n public getDeactivated(id: string): Tag {\n return this.hasDeactivated(id) ? this._hashDeactivated[id] : undefined;\n }\n\n public has(id: string): boolean {\n return id in this._hash;\n }\n\n public hasDeactivated(id: string): boolean {\n return id in this._hashDeactivated;\n }\n\n public remove(ids: string[]): void {\n this._assertActivationState(true);\n\n const hash: { [id: string]: RenderTag<Tag> } = this._hash;\n for (const id of ids) {\n if (!(id in hash)) {\n continue;\n }\n\n delete hash[id];\n }\n\n this._notifyChanged$.next(this);\n }\n\n public removeAll(): void {\n this._assertActivationState(true);\n\n this._hash = {};\n\n this._notifyChanged$.next(this);\n }\n\n public removeAllDeactivated(): void {\n this._assertActivationState(false);\n\n this._hashDeactivated = {};\n }\n\n public removeDeactivated(ids: string[]): void {\n this._assertActivationState(false);\n\n const hashDeactivated: { [id: string]: Tag } = this._hashDeactivated;\n for (const id of ids) {\n if (!(id in hashDeactivated)) {\n continue;\n }\n\n delete hashDeactivated[id];\n }\n }\n\n private _add(tag: Tag, transform: Transform): void {\n if (tag instanceof OutlineTag) {\n this._hash[tag.id] = new OutlineRenderTag(<OutlineTag>tag, transform);\n } else if (tag instanceof SpotTag) {\n this._hash[tag.id] = new SpotRenderTag(<SpotTag>tag, transform);\n } else if (tag instanceof ExtremePointTag) {\n this._hash[tag.id] = new ExtremePointRenderTag(<ExtremePointTag>tag, transform);\n } else {\n throw new Error(\"Tag type not supported\");\n }\n }\n\n private _assertActivationState(should: boolean): void {\n if (should !== this._active) {\n throw new Error(\"Tag set not in correct state for operation.\");\n }\n }\n}\n","import { Transform } from \"../../../geo/Transform\";\nimport { GeometryTagError } from \"../error/GeometryTagError\";\nimport { Geometry } from \"./Geometry\";\n/**\n * @class PointGeometry\n *\n * @classdesc Represents a point geometry in the 2D basic image coordinate system.\n *\n * @example\n * ```js\n * var basicPoint = [0.5, 0.7];\n * var pointGeometry = new PointGeometry(basicPoint);\n * ```\n */\nexport class PointGeometry extends Geometry {\n private _point: number[];\n\n /**\n * Create a point geometry.\n *\n * @constructor\n * @param {Array<number>} point - An array representing the basic coordinates of\n * the point.\n *\n * @throws {GeometryTagError} Point coordinates must be valid basic coordinates.\n */\n constructor(point: number[]) {\n super();\n\n let x: number = point[0];\n let y: number = point[1];\n\n if (x < 0 || x > 1 || y < 0 || y > 1) {\n throw new GeometryTagError(\"Basic coordinates must be on the interval [0, 1].\");\n }\n\n this._point = point.slice();\n }\n\n /**\n * Get point property.\n * @returns {Array<number>} Array representing the basic coordinates of the point.\n */\n public get point(): number[] {\n return this._point;\n }\n\n /**\n * Get the 2D basic coordinates for the centroid of the point, i.e. the 2D\n * basic coordinates of the point itself.\n *\n * @returns {Array<number>} 2D basic coordinates representing the centroid.\n * @ignore\n */\n public getCentroid2d(): number[] {\n return this._point.slice();\n }\n\n /**\n * Get the 3D world coordinates for the centroid of the point, i.e. the 3D\n * world coordinates of the point itself.\n *\n * @param {Transform} transform - The transform of the image related to the point.\n * @returns {Array<number>} 3D world coordinates representing the centroid.\n * @ignore\n */\n public getCentroid3d(transform: Transform): number[] {\n return transform.unprojectBasic(this._point, 200);\n }\n\n /**\n * Set the centroid of the point, i.e. the point coordinates.\n *\n * @param {Array<number>} value - The new value of the centroid.\n * @param {Transform} transform - The transform of the image related to the point.\n * @ignore\n */\n public setCentroid2d(value: number[], transform: Transform): void {\n let changed: number[] = [\n Math.max(0, Math.min(1, value[0])),\n Math.max(0, Math.min(1, value[1])),\n ];\n\n this._point[0] = changed[0];\n this._point[1] = changed[1];\n\n this._notifyChanged$.next(this);\n }\n}\n","import { Transform } from \"../../../geo/Transform\";\nimport { ViewportCoords } from \"../../../geo/ViewportCoords\";\nimport { RenderCamera } from \"../../../render/RenderCamera\";\nimport { Container } from \"../../../viewer/Container\";\nimport { Navigator } from \"../../../viewer/Navigator\";\nimport { Component } from \"../../Component\";\nimport { TagConfiguration } from \"../../interfaces/TagConfiguration\";\nimport { HandlerBase } from \"../../util/HandlerBase\";\n\nexport abstract class TagHandlerBase extends HandlerBase<TagConfiguration> {\n protected _name: string;\n\n protected _viewportCoords: ViewportCoords;\n\n constructor(\n component: Component<TagConfiguration>,\n container: Container,\n navigator: Navigator,\n viewportCoords: ViewportCoords) {\n super(component, container, navigator);\n\n this._name = `${this._component.name}-${this._getNameExtension()}`;\n\n this._viewportCoords = viewportCoords;\n }\n\n protected _getConfiguration(enable: boolean): TagConfiguration {\n return {};\n }\n\n protected abstract _getNameExtension(): string;\n\n protected _mouseEventToBasic(\n event: MouseEvent,\n element: HTMLElement,\n camera: RenderCamera,\n transform: Transform,\n offsetX?: number,\n offsetY?: number):\n number[] {\n\n offsetX = offsetX != null ? offsetX : 0;\n offsetY = offsetY != null ? offsetY : 0;\n\n const [canvasX, canvasY]: number[] = this._viewportCoords.canvasPosition(event, element);\n const basic: number[] =\n this._viewportCoords.canvasToBasic(\n canvasX - offsetX,\n canvasY - offsetY,\n element,\n transform,\n camera.perspective);\n\n return basic;\n }\n}\n","import {\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport {\n map,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Component } from \"../../Component\";\nimport { Transform } from \"../../../geo/Transform\";\nimport { ViewportCoords } from \"../../../geo/ViewportCoords\";\nimport { TagConfiguration } from \"../../interfaces/TagConfiguration\";\nimport { RenderCamera } from \"../../../render/RenderCamera\";\nimport { Container } from \"../../../viewer/Container\";\nimport { Navigator } from \"../../../viewer/Navigator\";\nimport { Geometry } from \"../geometry/Geometry\";\nimport { TagCreator } from \"../TagCreator\";\nimport { TagHandlerBase } from \"./TagHandlerBase\";\n\nexport abstract class CreateHandlerBase extends TagHandlerBase {\n protected _tagCreator: TagCreator;\n\n protected _geometryCreated$: Subject<Geometry>;\n\n constructor(\n component: Component<TagConfiguration>,\n container: Container,\n navigator: Navigator,\n viewportCoords: ViewportCoords,\n tagCreator: TagCreator) {\n super(component, container, navigator, viewportCoords);\n\n this._tagCreator = tagCreator;\n this._geometryCreated$ = new Subject<Geometry>();\n }\n\n public get geometryCreated$(): Observable<Geometry> {\n return this._geometryCreated$;\n }\n\n protected abstract _enableCreate(): void;\n\n protected abstract _disableCreate(): void;\n\n protected _enable(): void {\n this._enableCreate();\n this._container.container.classList.add(\"component-tag-create\");\n }\n\n protected _disable(): void {\n this._container.container.classList.remove(\"component-tag-create\");\n this._disableCreate();\n }\n\n protected _validateBasic(basic: number[]): boolean {\n const x: number = basic[0];\n const y: number = basic[1];\n\n return 0 <= x && x <= 1 && 0 <= y && y <= 1;\n }\n\n protected _mouseEventToBasic$(mouseEvent$: Observable<MouseEvent>): Observable<number[]> {\n return mouseEvent$.pipe(\n withLatestFrom(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentTransform$),\n map(\n ([event, camera, transform]: [MouseEvent, RenderCamera, Transform]): number[] => {\n return this._mouseEventToBasic(\n event,\n this._container.container,\n camera,\n transform);\n }));\n }\n}\n","import {\n map,\n filter,\n} from \"rxjs/operators\";\nimport { Subscription } from \"rxjs\";\nimport { PointGeometry } from \"../geometry/PointGeometry\";\nimport { CreateHandlerBase } from \"./CreateHandlerBase\";\n\nexport class CreatePointHandler extends CreateHandlerBase {\n private _geometryCreatedSubscription: Subscription;\n\n protected _enableCreate(): void {\n this._container.mouseService.deferPixels(this._name, 4);\n\n this._geometryCreatedSubscription = this._mouseEventToBasic$(this._container.mouseService.proximateClick$).pipe(\n filter(this._validateBasic),\n map(\n (basic: number[]): PointGeometry => {\n return new PointGeometry(basic);\n }))\n .subscribe(this._geometryCreated$);\n }\n\n protected _disableCreate(): void {\n this._container.mouseService.undeferPixels(this._name);\n\n this._geometryCreatedSubscription.unsubscribe();\n }\n\n protected _getNameExtension(): string {\n return \"create-point\";\n }\n}\n","import {\n combineLatest as observableCombineLatest,\n empty as observableEmpty,\n merge as observableMerge,\n of as observableOf,\n Observable,\n Subject,\n Subscription,\n} from \"rxjs\";\n\nimport {\n filter,\n map,\n publishReplay,\n refCount,\n switchMap,\n skip,\n share,\n take,\n} from \"rxjs/operators\";\n\nimport { Transform } from \"../../../geo/Transform\";\nimport { RenderCamera } from \"../../../render/RenderCamera\";\nimport { Geometry } from \"../geometry/Geometry\";\nimport { CreateTag } from \"../tag/CreateTag\";\nimport { CreateHandlerBase } from \"./CreateHandlerBase\";\n\nexport abstract class CreateVertexHandler extends CreateHandlerBase {\n private _addPointSubscription: Subscription;\n private _createSubscription: Subscription;\n private _deleteSubscription: Subscription;\n private _geometryCreateSubscription: Subscription;\n private _setVertexSubscription: Subscription;\n\n protected abstract get _create$(): Subject<number[]>;\n\n protected _enableCreate(): void {\n this._container.mouseService.deferPixels(this._name, 4);\n\n const transformChanged$: Observable<void> = this._navigator.stateService.currentTransform$.pipe(\n map((): void => { /*noop*/ }),\n publishReplay(1),\n refCount());\n\n this._deleteSubscription = transformChanged$.pipe(\n skip(1))\n .subscribe(this._tagCreator.delete$);\n\n const basicClick$: Observable<number[]> = this._mouseEventToBasic$(this._container.mouseService.proximateClick$).pipe(share());\n\n this._createSubscription = transformChanged$.pipe(\n switchMap(\n (): Observable<number[]> => {\n return basicClick$.pipe(\n filter(this._validateBasic),\n take(1));\n }))\n .subscribe(this._create$);\n\n this._setVertexSubscription = this._tagCreator.tag$.pipe(\n switchMap(\n (tag: CreateTag<Geometry>): Observable<[CreateTag<Geometry>, MouseEvent, RenderCamera, Transform]> => {\n return !!tag ?\n observableCombineLatest(\n observableOf(tag),\n observableMerge(\n this._container.mouseService.mouseMove$,\n this._container.mouseService.domMouseMove$),\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentTransform$) :\n observableEmpty();\n }))\n .subscribe(\n ([tag, event, camera, transform]: [CreateTag<Geometry>, MouseEvent, RenderCamera, Transform]): void => {\n const basicPoint: number[] = this._mouseEventToBasic(\n event,\n this._container.container,\n camera,\n transform);\n\n this._setVertex2d(tag, basicPoint, transform);\n });\n\n this._addPointSubscription = this._tagCreator.tag$.pipe(\n switchMap(\n (tag: CreateTag<Geometry>): Observable<[CreateTag<Geometry>, number[]]> => {\n return !!tag ?\n observableCombineLatest(\n observableOf(tag),\n basicClick$) :\n observableEmpty();\n }))\n .subscribe(\n ([tag, basicPoint]: [CreateTag<Geometry>, number[]]): void => {\n this._addPoint(tag, basicPoint);\n });\n\n this._geometryCreateSubscription = this._tagCreator.tag$.pipe(\n switchMap(\n (tag: CreateTag<Geometry>): Observable<Geometry> => {\n return !!tag ?\n tag.created$.pipe(\n map(\n (t: CreateTag<Geometry>): Geometry => {\n return t.geometry;\n })) :\n observableEmpty();\n }))\n .subscribe(this._geometryCreated$);\n }\n\n protected abstract _addPoint(tag: CreateTag<Geometry>, basicPoint: number[]): void;\n\n protected abstract _setVertex2d(tag: CreateTag<Geometry>, basicPoint: number[], transform: Transform): void;\n\n protected _disableCreate(): void {\n this._container.mouseService.undeferPixels(this._name);\n\n this._tagCreator.delete$.next(null);\n\n this._addPointSubscription.unsubscribe();\n this._createSubscription.unsubscribe();\n this._deleteSubscription.unsubscribe();\n this._geometryCreateSubscription.unsubscribe();\n this._setVertexSubscription.unsubscribe();\n }\n}\n","import { Subject } from \"rxjs\";\nimport { Transform } from \"../../../geo/Transform\";\nimport { ExtremePointCreateTag } from \"../tag/ExtremePointCreateTag\";\nimport { CreateVertexHandler } from \"./CreateVertexHandler\";\n\nexport class CreatePointsHandler extends CreateVertexHandler {\n protected get _create$(): Subject<number[]> {\n return this._tagCreator.createPoints$;\n }\n\n protected _addPoint(tag: ExtremePointCreateTag, basicPoint: number[]): void {\n tag.geometry.addPoint2d(basicPoint);\n }\n\n protected _getNameExtension(): string {\n return \"create-points\";\n }\n\n protected _setVertex2d(tag: ExtremePointCreateTag, basicPoint: number[], transform: Transform): void {\n tag.geometry.setPoint2d((tag.geometry).points.length - 1, basicPoint, transform);\n }\n}\n","import { Subject } from \"rxjs\";\nimport { Transform } from \"../../../geo/Transform\";\nimport { PolygonGeometry } from \"../geometry/PolygonGeometry\";\nimport { OutlineCreateTag } from \"../tag/OutlineCreateTag\";\nimport { CreateVertexHandler } from \"./CreateVertexHandler\";\n\nexport class CreatePolygonHandler extends CreateVertexHandler {\n protected get _create$(): Subject<number[]> {\n return this._tagCreator.createPolygon$;\n }\n\n protected _addPoint(tag: OutlineCreateTag, basicPoint: number[]): void {\n tag.addPoint(basicPoint);\n }\n\n protected _getNameExtension(): string {\n return \"create-polygon\";\n }\n\n protected _setVertex2d(tag: OutlineCreateTag, basicPoint: number[], transform: Transform): void {\n tag.geometry.setVertex2d((<PolygonGeometry>tag.geometry).polygon.length - 2, basicPoint, transform);\n }\n}\n","import {\n Subject,\n Subscription,\n} from \"rxjs\";\nimport { filter } from \"rxjs/operators\";\n\nimport { Transform } from \"../../../geo/Transform\";\nimport { RectGeometry } from \"../geometry/RectGeometry\";\nimport { OutlineCreateTag } from \"../tag/OutlineCreateTag\";\nimport { CreateVertexHandler } from \"./CreateVertexHandler\";\n\nexport class CreateRectHandler extends CreateVertexHandler {\n private _initializeAnchorIndexingSubscription: Subscription;\n\n protected get _create$(): Subject<number[]> {\n return this._tagCreator.createRect$;\n }\n\n protected _addPoint(tag: OutlineCreateTag, basicPoint: number[]): void {\n const rectGeometry: RectGeometry = <RectGeometry>tag.geometry;\n if (!rectGeometry.validate(basicPoint)) {\n basicPoint = rectGeometry.getNonAdjustedVertex2d(3);\n }\n\n tag.addPoint(basicPoint);\n }\n\n protected _enable(): void {\n super._enable();\n\n this._initializeAnchorIndexingSubscription = this._tagCreator.tag$.pipe(\n filter(\n (tag: OutlineCreateTag): boolean => {\n return !!tag;\n }))\n .subscribe(\n (tag: OutlineCreateTag): void => {\n (<RectGeometry>tag.geometry).initializeAnchorIndexing();\n });\n }\n\n protected _disable(): void {\n super._disable();\n\n this._initializeAnchorIndexingSubscription.unsubscribe();\n }\n\n protected _getNameExtension(): string {\n return \"create-rect\";\n }\n\n protected _setVertex2d(tag: OutlineCreateTag, basicPoint: number[], transform: Transform): void {\n (<RectGeometry>tag.geometry).setOppositeVertex2d(basicPoint, transform);\n }\n}\n","import {\n combineLatest as observableCombineLatest,\n empty as observableEmpty,\n merge as observableMerge,\n of as observableOf,\n Observable,\n Subscription,\n} from \"rxjs\";\n\nimport {\n filter,\n map,\n share,\n skip,\n switchMap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Transform } from \"../../../geo/Transform\";\nimport { RenderCamera } from \"../../../render/RenderCamera\";\nimport { Geometry } from \"../geometry/Geometry\";\nimport { RectGeometry } from \"../geometry/RectGeometry\";\nimport { OutlineCreateTag } from \"../tag/OutlineCreateTag\";\nimport { CreateHandlerBase } from \"./CreateHandlerBase\";\n\nexport class CreateRectDragHandler extends CreateHandlerBase {\n private _addPointSubscription: Subscription;\n private _createSubscription: Subscription;\n private _deleteSubscription: Subscription;\n private _geometryCreatedSubscription: Subscription;\n private _initializeAnchorIndexingSubscription: Subscription;\n private _setVertexSubscription: Subscription;\n\n protected _enableCreate(): void {\n this._container.mouseService.claimMouse(this._name, 2);\n\n this._deleteSubscription = this._navigator.stateService.currentTransform$.pipe(\n map((transform: Transform): void => { return null; }),\n skip(1))\n .subscribe(this._tagCreator.delete$);\n\n this._createSubscription = this._mouseEventToBasic$(\n this._container.mouseService.filtered$(this._name, this._container.mouseService.mouseDragStart$)).pipe(\n filter(this._validateBasic))\n .subscribe(this._tagCreator.createRect$);\n\n this._initializeAnchorIndexingSubscription = this._tagCreator.tag$.pipe(\n filter(\n (tag: OutlineCreateTag): boolean => {\n return !!tag;\n }))\n .subscribe(\n (tag: OutlineCreateTag): void => {\n (<RectGeometry>tag.geometry).initializeAnchorIndexing();\n });\n\n const basicMouse$: Observable<number[]> = observableCombineLatest(\n observableMerge(\n this._container.mouseService.filtered$(this._name, this._container.mouseService.mouseMove$),\n this._container.mouseService.filtered$(this._name, this._container.mouseService.domMouseMove$)),\n this._container.renderService.renderCamera$).pipe(\n withLatestFrom(this._navigator.stateService.currentTransform$),\n map(\n ([[event, camera], transform]: [[MouseEvent, RenderCamera], Transform]): number[] => {\n return this._mouseEventToBasic(\n event,\n this._container.container,\n camera,\n transform);\n }));\n\n this._setVertexSubscription = this._tagCreator.tag$.pipe(\n switchMap(\n (tag: OutlineCreateTag): Observable<[OutlineCreateTag, number[], Transform]> => {\n return !!tag ?\n observableCombineLatest(\n observableOf(tag),\n basicMouse$,\n this._navigator.stateService.currentTransform$) :\n observableEmpty();\n }))\n .subscribe(\n ([tag, basicPoint, transform]: [OutlineCreateTag, number[], Transform]): void => {\n (<RectGeometry>tag.geometry).setOppositeVertex2d(basicPoint, transform);\n });\n\n const basicMouseDragEnd$: Observable<number[]> = this._container.mouseService.mouseDragEnd$.pipe(\n withLatestFrom(\n this._mouseEventToBasic$(this._container.mouseService.filtered$(this._name, this._container.mouseService.mouseDrag$)).pipe(\n filter(this._validateBasic)),\n (event: Event, basicPoint: number[]): number[] => {\n return basicPoint;\n }),\n share());\n\n this._addPointSubscription = this._tagCreator.tag$.pipe(\n switchMap(\n (tag: OutlineCreateTag): Observable<[OutlineCreateTag, number[]]> => {\n return !!tag ?\n observableCombineLatest(\n observableOf(tag),\n basicMouseDragEnd$) :\n observableEmpty();\n }))\n .subscribe(\n ([tag, basicPoint]: [OutlineCreateTag, number[]]): void => {\n const rectGeometry: RectGeometry = <RectGeometry>tag.geometry;\n if (!rectGeometry.validate(basicPoint)) {\n basicPoint = rectGeometry.getNonAdjustedVertex2d(3);\n }\n\n tag.addPoint(basicPoint);\n });\n\n this._geometryCreatedSubscription = this._tagCreator.tag$.pipe(\n switchMap(\n (tag: OutlineCreateTag): Observable<Geometry> => {\n return !!tag ?\n tag.created$.pipe(\n map(\n (t: OutlineCreateTag): Geometry => {\n return t.geometry;\n })) :\n observableEmpty();\n }))\n .subscribe(this._geometryCreated$);\n }\n\n protected _disableCreate(): void {\n this._container.mouseService.unclaimMouse(this._name);\n\n this._tagCreator.delete$.next(null);\n\n this._addPointSubscription.unsubscribe();\n this._createSubscription.unsubscribe();\n this._deleteSubscription.unsubscribe();\n this._geometryCreatedSubscription.unsubscribe();\n this._initializeAnchorIndexingSubscription.unsubscribe();\n this._setVertexSubscription.unsubscribe();\n }\n\n protected _getNameExtension(): string {\n return \"create-rect-drag\";\n }\n}\n","import {\n combineLatest as observableCombineLatest,\n concat as observableConcat,\n empty as observableEmpty,\n from as observableFrom,\n merge as observableMerge,\n of as observableOf,\n Observable,\n Subscription,\n} from \"rxjs\";\n\nimport {\n distinctUntilChanged,\n filter,\n first,\n map,\n mergeMap,\n share,\n switchMap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Transform } from \"../../../geo/Transform\";\nimport { ViewportCoords } from \"../../../geo/ViewportCoords\";\nimport { RenderCamera } from \"../../../render/RenderCamera\";\nimport { Container } from \"../../../viewer/Container\";\nimport { Component } from \"../../Component\";\nimport { Navigator } from \"../../../viewer/Navigator\";\nimport { TagConfiguration } from \"../../interfaces/TagConfiguration\";\nimport { Geometry } from \"../geometry/Geometry\";\nimport { VertexGeometry } from \"../geometry/VertexGeometry\";\nimport { TagInteraction, InteractionCursor } from \"../interfaces/TagInteraction\";\nimport { RenderTag } from \"../tag/RenderTag\";\nimport { Tag } from \"../tag/Tag\";\nimport { TagOperation } from \"../TagOperation\";\nimport { TagSet } from \"../TagSet\";\nimport { TagHandlerBase } from \"./TagHandlerBase\";\n\nexport class EditVertexHandler extends TagHandlerBase {\n private _tagSet: TagSet;\n\n private _claimMouseSubscription: Subscription;\n private _cursorSubscription: Subscription;\n private _preventDefaultSubscription: Subscription;\n private _unclaimMouseSubscription: Subscription;\n private _updateGeometrySubscription: Subscription;\n\n constructor(\n component: Component<TagConfiguration>,\n container: Container,\n navigator: Navigator,\n viewportCoords: ViewportCoords,\n tagSet: TagSet) {\n super(component, container, navigator, viewportCoords);\n\n this._tagSet = tagSet;\n }\n\n protected _enable(): void {\n const interaction$: Observable<TagInteraction> = this._tagSet.changed$.pipe(\n map(\n (tagSet: TagSet): RenderTag<Tag>[] => {\n return tagSet.getAll();\n }),\n switchMap(\n (tags: RenderTag<Tag>[]): Observable<TagInteraction> => {\n return observableFrom(tags).pipe(\n mergeMap(\n (tag: RenderTag<Tag>): Observable<TagInteraction> => {\n return tag.interact$;\n }));\n }),\n switchMap(\n (interaction: TagInteraction): Observable<TagInteraction> => {\n return observableConcat(\n observableOf(interaction),\n this._container.mouseService.documentMouseUp$.pipe(\n map(\n (): TagInteraction => {\n return { offsetX: 0, offsetY: 0, operation: TagOperation.None, tag: null };\n }),\n first()));\n }),\n share());\n\n const mouseMove$: Observable<MouseEvent> = observableMerge(\n this._container.mouseService.mouseMove$,\n this._container.mouseService.domMouseMove$).pipe(\n share());\n\n this._claimMouseSubscription = interaction$.pipe(\n switchMap(\n (interaction: TagInteraction): Observable<MouseEvent> => {\n return !!interaction.tag ? this._container.mouseService.domMouseDragStart$ : observableEmpty();\n }))\n .subscribe(\n (): void => {\n this._container.mouseService.claimMouse(this._name, 3);\n });\n\n this._cursorSubscription = interaction$.pipe(\n map(\n (interaction: TagInteraction): string => {\n return interaction.cursor;\n }),\n distinctUntilChanged())\n .subscribe(\n (cursor: string): void => {\n const interactionCursors: InteractionCursor[] = [\"crosshair\", \"move\", \"nesw-resize\", \"nwse-resize\"];\n for (const interactionCursor of interactionCursors) {\n this._container.container.classList.remove(`component-tag-edit-${interactionCursor}`);\n }\n\n if (!!cursor) {\n this._container.container.classList.add(`component-tag-edit-${cursor}`);\n }\n });\n\n this._unclaimMouseSubscription = this._container.mouseService\n .filtered$(this._name, this._container.mouseService.domMouseDragEnd$)\n .subscribe(\n (e: MouseEvent): void => {\n this._container.mouseService.unclaimMouse(this._name);\n });\n\n this._preventDefaultSubscription = interaction$.pipe(\n switchMap(\n (interaction: TagInteraction): Observable<MouseEvent> => {\n return !!interaction.tag ?\n this._container.mouseService.documentMouseMove$ :\n observableEmpty();\n }))\n .subscribe(\n (event: MouseEvent): void => {\n event.preventDefault(); // prevent selection of content outside the viewer\n });\n\n this._updateGeometrySubscription = interaction$.pipe(\n switchMap(\n (interaction: TagInteraction): Observable<[MouseEvent, RenderCamera, TagInteraction, Transform]> => {\n if (interaction.operation === TagOperation.None || !interaction.tag) {\n return observableEmpty();\n }\n\n const mouseDrag$: Observable<MouseEvent> =\n this._container.mouseService\n .filtered$(\n this._name,\n this._container.mouseService.domMouseDrag$).pipe(\n filter(\n (event: MouseEvent): boolean => {\n return this._viewportCoords.insideElement(event, this._container.container);\n }));\n\n return observableCombineLatest(\n mouseDrag$,\n this._container.renderService.renderCamera$).pipe(\n withLatestFrom(\n observableOf(interaction),\n this._navigator.stateService.currentTransform$,\n (\n [event, render]: [MouseEvent, RenderCamera],\n i: TagInteraction,\n transform: Transform):\n [MouseEvent, RenderCamera, TagInteraction, Transform] => {\n return [event, render, i, transform];\n }));\n }))\n .subscribe(\n ([mouseEvent, renderCamera, interaction, transform]: [MouseEvent, RenderCamera, TagInteraction, Transform]): void => {\n const basic: number[] = this._mouseEventToBasic(\n mouseEvent,\n this._container.container,\n renderCamera,\n transform,\n interaction.offsetX,\n interaction.offsetY);\n\n const geometry: Geometry = interaction.tag.geometry;\n if (interaction.operation === TagOperation.Centroid) {\n geometry.setCentroid2d(basic, transform);\n } else if (interaction.operation === TagOperation.Vertex) {\n (<VertexGeometry>geometry).setVertex2d(interaction.vertexIndex, basic, transform);\n }\n });\n }\n\n protected _disable(): void {\n this._claimMouseSubscription.unsubscribe();\n this._cursorSubscription.unsubscribe();\n this._preventDefaultSubscription.unsubscribe();\n this._unclaimMouseSubscription.unsubscribe();\n this._updateGeometrySubscription.unsubscribe();\n }\n\n protected _getNameExtension(): string {\n return \"edit-vertex\";\n }\n}\n","import {\n combineLatest as observableCombineLatest,\n empty as observableEmpty,\n merge as observableMerge,\n from as observableFrom,\n Observable,\n} from \"rxjs\";\n\nimport {\n distinctUntilChanged,\n filter,\n first,\n map,\n mergeMap,\n publishReplay,\n refCount,\n share,\n skipWhile,\n startWith,\n switchMap,\n tap,\n} from \"rxjs/operators\";\n\nimport { TagCreator } from \"./TagCreator\";\nimport { TagDOMRenderer } from \"./TagDOMRenderer\";\nimport { TagScene } from \"./TagScene\";\nimport { TagMode } from \"./TagMode\";\nimport { TagSet } from \"./TagSet\";\nimport { Geometry } from \"./geometry/Geometry\";\nimport { PointsGeometry } from \"./geometry/PointsGeometry\";\nimport { CreateHandlerBase } from \"./handlers/CreateHandlerBase\";\nimport { CreatePointHandler } from \"./handlers/CreatePointHandler\";\nimport { CreatePointsHandler } from \"./handlers/CreatePointsHandler\";\nimport { CreatePolygonHandler } from \"./handlers/CreatePolygonHandler\";\nimport { CreateRectHandler } from \"./handlers/CreateRectHandler\";\nimport { CreateRectDragHandler } from \"./handlers/CreateRectDragHandler\";\nimport { EditVertexHandler } from \"./handlers/EditVertexHandler\";\nimport { Tag } from \"./tag/Tag\";\nimport { RenderTag } from \"./tag/RenderTag\";\nimport { CreateTag } from \"./tag/CreateTag\";\n\nimport { Component } from \"../Component\";\nimport { TagConfiguration } from \"../interfaces/TagConfiguration\";\n\nimport { Transform } from \"../../geo/Transform\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { RenderPass } from \"../../render/RenderPass\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { GLRenderHash } from \"../../render/interfaces/IGLRenderHash\";\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { VirtualNodeHash } from \"../../render/interfaces/VirtualNodeHash\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { Container } from \"../../viewer/Container\";\nimport { ISpriteAtlas } from \"../../viewer/interfaces/ISpriteAtlas\";\nimport { ComponentEventType } from \"../events/ComponentEventType\";\nimport { ComponentTagModeEvent } from \"../events/ComponentTagModeEvent\";\nimport { ComponentGeometryEvent } from \"../events/ComponentGeometryEvent\";\nimport { ComponentStateEvent } from \"../events/ComponentStateEvent\";\nimport { ComponentName } from \"../ComponentName\";\n\n/**\n * @class TagComponent\n *\n * @classdesc Component for showing and editing tags with different\n * geometries composed from 2D basic image coordinates (see the\n * {@link Viewer} class documentation for more information about coordinate\n * systems).\n *\n * The `add` method is used for adding new tags or replacing\n * tags already in the set. Tags are removed by id.\n *\n * If a tag already in the set has the same\n * id as one of the tags added, the old tag will be removed and\n * the added tag will take its place.\n *\n * The tag component mode can be set to either be non interactive or\n * to be in creating mode of a certain geometry type.\n *\n * The tag properties can be updated at any time and the change will\n * be visibile immediately.\n *\n * Tags are only relevant to a single image because they are based on\n * 2D basic image coordinates. Tags related to a certain image should\n * be removed when the viewer is moved to another image.\n *\n * To retrive and use the tag component\n *\n * @example\n * ```js\n * var viewer = new Viewer({ component: { tag: true } }, ...);\n *\n * var tagComponent = viewer.getComponent(\"tag\");\n * ```\n */\nexport class TagComponent extends Component<TagConfiguration> {\n /** @inheritdoc */\n public static componentName: ComponentName = \"tag\";\n\n private _tagDomRenderer: TagDOMRenderer;\n private _tagScene: TagScene;\n private _tagSet: TagSet;\n private _tagCreator: TagCreator;\n private _viewportCoords: ViewportCoords;\n\n private _renderTags$: Observable<RenderTag<Tag>[]>;\n private _tagChanged$: Observable<Tag>;\n private _renderTagGLChanged$: Observable<RenderTag<Tag>>;\n private _createGeometryChanged$: Observable<CreateTag<Geometry>>;\n private _createGLObjectsChanged$: Observable<CreateTag<Geometry>>;\n\n private _creatingConfiguration$: Observable<TagConfiguration>;\n\n private _createHandlers: {\n [K in keyof typeof TagMode]: CreateHandlerBase;\n };\n private _editVertexHandler: EditVertexHandler;\n\n /** @ignore */\n constructor(\n name: string,\n container: Container,\n navigator: Navigator) {\n super(name, container, navigator);\n\n this._tagDomRenderer = new TagDOMRenderer();\n this._tagScene = new TagScene();\n this._tagSet = new TagSet();\n this._tagCreator = new TagCreator(this, navigator);\n this._viewportCoords = new ViewportCoords();\n\n this._createHandlers = {\n \"CreatePoint\":\n new CreatePointHandler(\n this,\n container,\n navigator,\n this._viewportCoords,\n this._tagCreator),\n \"CreatePoints\":\n new CreatePointsHandler(\n this,\n container,\n navigator,\n this._viewportCoords,\n this._tagCreator),\n \"CreatePolygon\":\n new CreatePolygonHandler(\n this,\n container,\n navigator,\n this._viewportCoords,\n this._tagCreator),\n \"CreateRect\":\n new CreateRectHandler(\n this,\n container,\n navigator,\n this._viewportCoords,\n this._tagCreator),\n \"CreateRectDrag\":\n new CreateRectDragHandler(\n this,\n container,\n navigator,\n this._viewportCoords,\n this._tagCreator),\n \"Default\": undefined,\n };\n\n this._editVertexHandler =\n new EditVertexHandler(\n this,\n container,\n navigator,\n this._viewportCoords,\n this._tagSet);\n\n this._renderTags$ = this._tagSet.changed$.pipe(\n map(\n (tagSet: TagSet): RenderTag<Tag>[] => {\n const tags: RenderTag<Tag>[] = tagSet.getAll();\n\n // ensure that tags are always rendered in the same order\n // to avoid hover tracking problems on first resize.\n tags.sort(\n (t1: RenderTag<Tag>, t2: RenderTag<Tag>): number => {\n const id1: string = t1.tag.id;\n const id2: string = t2.tag.id;\n\n if (id1 < id2) {\n return -1;\n }\n\n if (id1 > id2) {\n return 1;\n }\n\n return 0;\n });\n\n return tags;\n }),\n share());\n\n this._tagChanged$ = this._renderTags$.pipe(\n switchMap(\n (tags: RenderTag<Tag>[]): Observable<Tag> => {\n return observableFrom(tags).pipe(\n mergeMap(\n (tag: RenderTag<Tag>): Observable<Tag> => {\n return observableMerge(\n tag.tag.changed$,\n tag.tag.geometryChanged$);\n }));\n }),\n share());\n\n this._renderTagGLChanged$ = this._renderTags$.pipe(\n switchMap(\n (tags: RenderTag<Tag>[]): Observable<RenderTag<Tag>> => {\n return observableFrom(tags).pipe(\n mergeMap(\n (tag: RenderTag<Tag>): Observable<RenderTag<Tag>> => {\n return tag.glObjectsChanged$;\n }));\n }),\n share());\n\n this._createGeometryChanged$ = this._tagCreator.tag$.pipe(\n switchMap(\n (tag: CreateTag<Geometry>): Observable<CreateTag<Geometry>> => {\n return tag != null ?\n tag.geometryChanged$ :\n observableEmpty();\n }),\n share());\n\n this._createGLObjectsChanged$ = this._tagCreator.tag$.pipe(\n switchMap(\n (tag: CreateTag<Geometry>): Observable<CreateTag<Geometry>> => {\n return tag != null ?\n tag.glObjectsChanged$ :\n observableEmpty();\n }),\n share());\n\n this._creatingConfiguration$ = this._configuration$.pipe(\n distinctUntilChanged(\n (c1: TagConfiguration, c2: TagConfiguration): boolean => {\n return c1.mode === c2.mode;\n },\n (configuration: TagConfiguration): TagConfiguration => {\n return {\n createColor: configuration.createColor,\n mode: configuration.mode,\n };\n }),\n publishReplay(1),\n refCount());\n\n this._creatingConfiguration$\n .subscribe(\n (configuration: TagConfiguration): void => {\n const type: ComponentEventType = \"tagmode\";\n const event: ComponentTagModeEvent = {\n mode: configuration.mode,\n target: this,\n type,\n };\n this.fire(type, event);\n });\n }\n\n /**\n * Add tags to the tag set or replace tags in the tag set.\n *\n * @description If a tag already in the set has the same\n * id as one of the tags added, the old tag will be removed\n * the added tag will take its place.\n *\n * @param {Array<Tag>} tags - Tags to add.\n *\n * @example\n * ```js\n * tagComponent.add([tag1, tag2]);\n * ```\n */\n public add(tags: Tag[]): void {\n if (this._activated) {\n this._navigator.stateService.currentTransform$.pipe(\n first())\n .subscribe(\n (transform: Transform): void => {\n this._tagSet.add(tags, transform);\n\n const renderTags: RenderTag<Tag>[] = tags\n .map(\n (tag: Tag): RenderTag<Tag> => {\n return this._tagSet.get(tag.id);\n });\n\n this._tagScene.add(renderTags);\n });\n } else {\n this._tagSet.addDeactivated(tags);\n }\n }\n\n /**\n * Calculate the smallest rectangle containing all the points\n * in the points geometry.\n *\n * @description The result may be different depending on if the\n * current image is an spherical or not. If the\n * current image is an spherical the rectangle may\n * wrap the horizontal border of the image.\n *\n * @returns {Promise<Array<number>>} Promise to the rectangle\n * on the format specified for the {@link RectGeometry} in basic\n * coordinates.\n */\n public calculateRect(geometry: PointsGeometry): Promise<number[]> {\n return new Promise<number[]>((resolve: (value: number[]) => void, reject: (reason: Error) => void): void => {\n this._navigator.stateService.currentTransform$.pipe(\n first(),\n map(\n (transform: Transform): number[] => {\n return geometry.getRect2d(transform);\n }))\n .subscribe(\n (rect: number[]): void => {\n resolve(rect);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Force the creation of a geometry programatically using its\n * current vertices.\n *\n * @description The method only has an effect when the tag\n * mode is either of the following modes:\n *\n * {@link TagMode.CreatePoints}\n * {@link TagMode.CreatePolygon}\n * {@link TagMode.CreateRect}\n * {@link TagMode.CreateRectDrag}\n *\n * In the case of points or polygon creation, only the created\n * vertices are used, i.e. the mouse position is disregarded.\n *\n * In the case of rectangle creation the position of the mouse\n * at the time of the method call is used as one of the vertices\n * defining the rectangle.\n *\n * @fires geometrycreate\n *\n * @example\n * ```js\n * tagComponent.on(\"geometrycreate\", function(geometry) {\n * console.log(geometry);\n * });\n *\n * tagComponent.create();\n * ```\n */\n public create(): void {\n this._tagCreator.replayedTag$.pipe(\n first(),\n filter(\n (tag: CreateTag<Geometry>): boolean => {\n return !!tag;\n }))\n .subscribe(\n (tag: CreateTag<Geometry>): void => {\n tag.create();\n });\n }\n\n /**\n * Change the current tag mode.\n *\n * @description Change the tag mode to one of the create modes for creating new geometries.\n *\n * @param {TagMode} mode - New tag mode.\n *\n * @fires tagmode\n *\n * @example\n * ```js\n * tagComponent.changeMode(TagMode.CreateRect);\n * ```\n */\n public changeMode(mode: TagMode): void {\n this.configure({ mode: mode });\n }\n\n public fire(\n type: \"geometrycreate\",\n event: ComponentGeometryEvent)\n : void;\n public fire(\n type: \"tagmode\",\n event: ComponentTagModeEvent)\n : void;\n /** @ignore */\n public fire(\n type:\n | \"tagcreateend\"\n | \"tagcreatestart\"\n | \"tags\",\n event: ComponentStateEvent)\n : void;\n public fire<T>(\n type: ComponentEventType,\n event: T)\n : void {\n super.fire(type, event);\n }\n\n /**\n * Returns the tag in the tag set with the specified id, or\n * undefined if the id matches no tag.\n *\n * @param {string} tagId - Id of the tag.\n *\n * @example\n * ```js\n * var tag = tagComponent.get(\"tagId\");\n * ```\n */\n public get(tagId: string): Tag {\n if (this._activated) {\n const renderTag: RenderTag<Tag> = this._tagSet.get(tagId);\n return renderTag !== undefined ? renderTag.tag : undefined;\n } else {\n return this._tagSet.getDeactivated(tagId);\n }\n }\n\n /**\n * Returns an array of all tags.\n *\n * @example\n * ```js\n * var tags = tagComponent.getAll();\n * ```\n */\n public getAll(): Tag[] {\n if (this.activated) {\n return this._tagSet\n .getAll()\n .map(\n (renderTag: RenderTag<Tag>): Tag => {\n return renderTag.tag;\n });\n } else {\n return this._tagSet.getAllDeactivated();\n }\n }\n\n /**\n * Returns an array of tag ids for tags that contain the specified point.\n *\n * @description The pixel point must lie inside the polygon or rectangle\n * of an added tag for the tag id to be returned. Tag ids for\n * tags that do not have a fill will also be returned if the point is inside\n * the geometry of the tag. Tags with point geometries can not be retrieved.\n *\n * No tag ids will be returned for polygons rendered in cropped spherical or\n * rectangles rendered in spherical.\n *\n * Notice that the pixelPoint argument requires x, y coordinates from pixel space.\n *\n * With this function, you can use the coordinates provided by mouse\n * events to get information out of the tag component.\n *\n * If no tag at exist the pixel point, an empty array will be returned.\n *\n * @param {Array<number>} pixelPoint - Pixel coordinates on the viewer element.\n * @returns {Promise<Array<string>>} Promise to the ids of the tags that\n * contain the specified pixel point.\n *\n * @example\n * ```js\n * tagComponent.getTagIdsAt([100, 100])\n * .then((tagIds) => { console.log(tagIds); });\n * ```\n */\n public getTagIdsAt(pixelPoint: number[]): Promise<string[]> {\n return new Promise<string[]>((resolve: (value: string[]) => void, reject: (reason: Error) => void): void => {\n this._container.renderService.renderCamera$.pipe(\n first(),\n map(\n (render: RenderCamera): string[] => {\n const viewport: number[] = this._viewportCoords\n .canvasToViewport(\n pixelPoint[0],\n pixelPoint[1],\n this._container.container);\n\n const ids: string[] = this._tagScene.intersectObjects(viewport, render.perspective);\n\n return ids;\n }))\n .subscribe(\n (ids: string[]): void => {\n resolve(ids);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Check if a tag exist in the tag set.\n *\n * @param {string} tagId - Id of the tag.\n *\n * @example\n * ```js\n * var tagExists = tagComponent.has(\"tagId\");\n * ```\n */\n public has(tagId: string): boolean {\n return this._activated ? this._tagSet.has(tagId) : this._tagSet.hasDeactivated(tagId);\n }\n\n public off(\n type: \"geometrycreate\",\n handler: (event: ComponentGeometryEvent) => void)\n : void;\n public off(\n type: \"tagmode\",\n handler: (event: ComponentTagModeEvent) => void)\n : void;\n public off(\n type:\n | \"tagcreateend\"\n | \"tagcreatestart\"\n | \"tags\",\n handler: (event: ComponentStateEvent) => void)\n : void;\n public off<T>(\n type: ComponentEventType,\n handler: (event: T) => void)\n : void {\n super.off(type, handler);\n }\n\n /**\n * Event fired when a geometry has been created.\n *\n * @event geometrycreated\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * var component = viewer.getComponent('<component-name>');\n * // Set an event listener\n * component.on('geometrycreated', function() {\n * console.log(\"A geometrycreated event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"geometrycreate\",\n handler: (event: ComponentGeometryEvent) => void)\n : void;\n /**\n * Event fired when an interaction to create a geometry ends.\n *\n * @description A create interaction can by a geometry being created\n * or by the creation being aborted.\n *\n * @event tagcreateend\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * var component = viewer.getComponent('<component-name>');\n * // Set an event listener\n * component.on('tagcreateend', function() {\n * console.log(\"A tagcreateend event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"tagcreateend\",\n handler: (event: ComponentStateEvent) => void)\n : void;\n /**\n * Event fired when an interaction to create a geometry starts.\n *\n * @description A create interaction starts when the first vertex\n * is created in the geometry.\n *\n * @event tagcreatestart\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * var component = viewer.getComponent('<component-name>');\n * // Set an event listener\n * component.on('tagcreatestart', function() {\n * console.log(\"A tagcreatestart event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"tagcreatestart\",\n handler: (event: ComponentStateEvent) => void)\n : void;\n /**\n * Event fired when the create mode is changed.\n *\n * @event tagmode\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * var component = viewer.getComponent('<component-name>');\n * // Set an event listener\n * component.on('tagmode', function() {\n * console.log(\"A tagmode event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"tagmode\",\n handler: (event: ComponentTagModeEvent) => void)\n : void;\n /**\n * Event fired when the tags collection has changed.\n *\n * @event tags\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * var component = viewer.getComponent('<component-name>');\n * // Set an event listener\n * component.on('tags', function() {\n * console.log(\"A tags event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"tags\",\n handler: (event: ComponentStateEvent) => void)\n : void;\n public on<T>(\n type: ComponentEventType,\n handler: (event: T) => void)\n : void {\n super.on(type, handler);\n }\n\n /**\n * Remove tags with the specified ids from the tag set.\n *\n * @param {Array<string>} tagIds - Ids for tags to remove.\n *\n * @example\n * ```js\n * tagComponent.remove([\"id-1\", \"id-2\"]);\n * ```\n */\n public remove(tagIds: string[]): void {\n if (this._activated) {\n this._tagSet.remove(tagIds);\n this._tagScene.remove(tagIds);\n } else {\n this._tagSet.removeDeactivated(tagIds);\n }\n }\n\n /**\n * Remove all tags from the tag set.\n *\n * @example\n * ```js\n * tagComponent.removeAll();\n * ```\n */\n public removeAll(): void {\n if (this._activated) {\n this._tagSet.removeAll();\n this._tagScene.removeAll();\n } else {\n this._tagSet.removeAllDeactivated();\n }\n }\n\n protected _activate(): void {\n this._editVertexHandler.enable();\n\n const handlerGeometryCreated$ =\n observableFrom(<(keyof typeof TagMode)[]>Object.keys(this._createHandlers)).pipe(\n map(\n (key: keyof typeof TagMode): CreateHandlerBase => {\n return this._createHandlers[key];\n }),\n filter(\n (handler: CreateHandlerBase): boolean => {\n return !!handler;\n }),\n mergeMap(\n (handler: CreateHandlerBase): Observable<Geometry> => {\n return handler.geometryCreated$;\n }),\n share());\n\n const subs = this._subscriptions;\n\n subs.push(handlerGeometryCreated$\n .subscribe(\n (geometry: Geometry): void => {\n const type: ComponentEventType = \"geometrycreate\";\n const event: ComponentGeometryEvent = {\n geometry,\n target: this,\n type,\n };\n this.fire(type, event);\n }));\n\n subs.push(this._tagCreator.tag$.pipe(\n skipWhile(\n (tag: CreateTag<Geometry>): boolean => {\n return tag == null;\n }),\n distinctUntilChanged())\n .subscribe(\n (tag: CreateTag<Geometry>): void => {\n const type: ComponentEventType = tag != null ?\n \"tagcreatestart\" :\n \"tagcreateend\";\n const event: ComponentStateEvent = {\n target: this,\n type,\n };\n this.fire(type, event);\n }));\n\n subs.push(handlerGeometryCreated$\n .subscribe(\n (): void => {\n this.changeMode(TagMode.Default);\n }));\n\n subs.push(this._creatingConfiguration$\n .subscribe(\n (configuration: TagConfiguration): void => {\n this._disableCreateHandlers();\n\n const mode: keyof typeof TagMode = <keyof typeof TagMode>TagMode[configuration.mode];\n const handler: CreateHandlerBase = this._createHandlers[mode];\n if (!!handler) {\n handler.enable();\n }\n }));\n\n subs.push(this._renderTags$\n .subscribe(\n (): void => {\n const type: ComponentEventType = \"tags\";\n const event: ComponentStateEvent = {\n target: this,\n type,\n };\n this.fire(type, event);\n }));\n\n subs.push(this._tagCreator.tag$.pipe(\n switchMap(\n (tag: CreateTag<Geometry>): Observable<void> => {\n return tag != null ?\n tag.aborted$.pipe(\n map((): void => { return null; })) :\n observableEmpty();\n }))\n .subscribe((): void => { this.changeMode(TagMode.Default); }));\n\n subs.push(this._tagCreator.tag$\n .subscribe(\n (tag: CreateTag<Geometry>): void => {\n if (this._tagScene.hasCreateTag()) {\n this._tagScene.removeCreateTag();\n }\n\n if (tag != null) {\n this._tagScene.addCreateTag(tag);\n }\n }));\n\n subs.push(this._createGLObjectsChanged$\n .subscribe(\n (tag: CreateTag<Geometry>): void => {\n this._tagScene.updateCreateTagObjects(tag);\n }));\n\n subs.push(this._renderTagGLChanged$\n .subscribe(\n (tag: RenderTag<Tag>): void => {\n this._tagScene.updateObjects(tag);\n }));\n\n subs.push(this._tagChanged$\n .subscribe(\n (): void => {\n this._tagScene.update();\n }));\n\n subs.push(observableCombineLatest(\n this._renderTags$.pipe(\n startWith([]),\n tap(\n (): void => {\n this._container.domRenderer.render$.next({\n name: this._name,\n vNode: this._tagDomRenderer.clear(),\n });\n })),\n this._container.renderService.renderCamera$,\n this._container.spriteService.spriteAtlas$,\n this._container.renderService.size$,\n this._tagChanged$.pipe(startWith(null)),\n observableMerge(\n this._tagCreator.tag$,\n this._createGeometryChanged$).pipe(startWith(null))).pipe(\n map(\n ([renderTags, rc, atlas, size, , ct]:\n [RenderTag<Tag>[], RenderCamera, ISpriteAtlas, ViewportSize, Tag, CreateTag<Geometry>]):\n VirtualNodeHash => {\n return {\n name: this._name,\n vNode: this._tagDomRenderer.render(renderTags, ct, atlas, rc.perspective, size),\n };\n }))\n .subscribe(this._container.domRenderer.render$));\n\n subs.push(this._navigator.stateService.currentState$.pipe(\n map(\n (frame: AnimationFrame): GLRenderHash => {\n const tagScene: TagScene = this._tagScene;\n\n return {\n name: this._name,\n renderer: {\n frameId: frame.id,\n needsRender: tagScene.needsRender,\n render: tagScene.render.bind(tagScene),\n pass: RenderPass.Opaque,\n },\n };\n }))\n .subscribe(this._container.glRenderer.render$));\n\n this._navigator.stateService.currentTransform$.pipe(\n first())\n .subscribe(\n (transform: Transform): void => {\n this._tagSet.activate(transform);\n this._tagScene.add(this._tagSet.getAll());\n });\n\n }\n\n protected _deactivate(): void {\n this._editVertexHandler.disable();\n this._disableCreateHandlers();\n\n this._tagScene.clear();\n this._tagSet.deactivate();\n\n this._tagCreator.delete$.next(null);\n\n this._subscriptions.unsubscribe();\n\n this._container.container.classList.remove(\"component-tag-create\");\n }\n\n protected _getDefaultConfiguration(): TagConfiguration {\n return {\n createColor: 0xFFFFFF,\n indicatePointsCompleter: true,\n mode: TagMode.Default,\n };\n }\n\n private _disableCreateHandlers(): void {\n const createHandlers: {\n [K in keyof typeof TagMode]:\n CreateHandlerBase\n } = this._createHandlers;\n\n for (const key in createHandlers) {\n if (!createHandlers.hasOwnProperty(key)) {\n continue;\n }\n const handler =\n createHandlers[<keyof typeof TagMode>key];\n if (!!handler) {\n handler.disable();\n }\n }\n }\n}\n","import * as vd from \"virtual-dom\";\n\nimport {\n combineLatest as observableCombineLatest,\n Subject,\n Subscription,\n} from \"rxjs\";\n\nimport {\n map,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Component } from \"../Component\";\nimport { ZoomConfiguration } from \"../interfaces/ZoomConfiguration\";\n\nimport { Transform } from \"../../geo/Transform\";\nimport { ViewportCoords } from \"../../geo/ViewportCoords\";\nimport { RenderCamera } from \"../../render/RenderCamera\";\nimport { ViewportSize } from \"../../render/interfaces/ViewportSize\";\nimport { VirtualNodeHash } from \"../../render/interfaces/VirtualNodeHash\";\nimport { State } from \"../../state/State\";\nimport { AnimationFrame } from \"../../state/interfaces/AnimationFrame\";\nimport { ComponentSize } from \"../util/ComponentSize\";\nimport { Container } from \"../../viewer/Container\";\nimport { Navigator } from \"../../viewer/Navigator\";\nimport { ComponentName } from \"../ComponentName\";\n\n/**\n * @class ZoomComponent\n *\n * @classdesc Component rendering UI elements used for zooming.\n *\n * @example\n * ```js\n * var viewer = new Viewer({ ... });\n *\n * var zoomComponent = viewer.getComponent(\"zoom\");\n * zoomComponent.configure({ size: ComponentSize.Small });\n * ```\n */\nexport class ZoomComponent extends Component<ZoomConfiguration> {\n public static componentName: ComponentName = \"zoom\";\n\n private _viewportCoords: ViewportCoords;\n\n private _zoomDelta$: Subject<number>;\n\n constructor(name: string, container: Container, navigator: Navigator) {\n super(name, container, navigator);\n\n this._viewportCoords = new ViewportCoords();\n\n this._zoomDelta$ = new Subject<number>();\n }\n\n protected _activate(): void {\n const subs = this._subscriptions;\n\n subs.push(observableCombineLatest(\n this._navigator.stateService.currentState$,\n this._navigator.stateService.state$,\n this._configuration$,\n this._container.renderService.size$).pipe(\n map(\n ([frame, state, configuration, size]: [AnimationFrame, State, ZoomConfiguration, ViewportSize]): VirtualNodeHash => {\n const zoom: number = frame.state.zoom;\n\n const zoomInIcon: vd.VNode = vd.h(\"div.mapillary-zoom-in-icon\", []);\n const zoomInButton: vd.VNode = zoom >= 3 || state === State.Waiting ?\n vd.h(\"div.mapillary-zoom-in-button-inactive\", [zoomInIcon]) :\n vd.h(\"div.mapillary-zoom-in-button\", { onclick: (): void => { this._zoomDelta$.next(1); } }, [zoomInIcon]);\n\n const zoomOutIcon: vd.VNode = vd.h(\"div.mapillary-zoom-out-icon\", []);\n const zoomOutButton: vd.VNode = zoom <= 0 || state === State.Waiting ?\n vd.h(\"div.mapillary-zoom-out-button-inactive\", [zoomOutIcon]) :\n vd.h(\"div.mapillary-zoom-out-button\", { onclick: (): void => { this._zoomDelta$.next(-1); } }, [zoomOutIcon]);\n\n const compact: string = configuration.size === ComponentSize.Small ||\n configuration.size === ComponentSize.Automatic && size.width < 640 ?\n \".mapillary-zoom-compact\" : \"\";\n\n return {\n name: this._name,\n vNode: vd.h(\n \"div.mapillary-zoom-container\" + compact,\n { oncontextmenu: (event: MouseEvent): void => { event.preventDefault(); } },\n [zoomInButton, zoomOutButton]),\n };\n }))\n .subscribe(this._container.domRenderer.render$));\n\n subs.push(this._zoomDelta$.pipe(\n withLatestFrom(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentTransform$))\n .subscribe(\n ([zoomDelta, render, transform]: [number, RenderCamera, Transform]): void => {\n const unprojected: THREE.Vector3 = this._viewportCoords.unprojectFromViewport(0, 0, render.perspective);\n const reference: number[] = transform.projectBasic(unprojected.toArray());\n\n this._navigator.stateService.zoomIn(zoomDelta, reference);\n }));\n }\n\n protected _deactivate(): void {\n this._subscriptions.unsubscribe();\n }\n\n protected _getDefaultConfiguration(): ZoomConfiguration {\n return { size: ComponentSize.Automatic };\n }\n}\n","import * as vd from \"virtual-dom\";\n\nimport {\n combineLatest as observableCombineLatest,\n Observable,\n} from \"rxjs\";\n\nimport {\n distinctUntilChanged,\n filter,\n map,\n} from \"rxjs/operators\";\n\nimport { Component } from \"../../Component\";\nimport { ComponentConfiguration } from \"../../interfaces/ComponentConfiguration\";\n\nimport { Image } from \"../../../graph/Image\";\nimport { Container } from \"../../../viewer/Container\";\nimport { Navigator } from \"../../../viewer/Navigator\";\nimport { ViewportSize } from \"../../../render/interfaces/ViewportSize\";\nimport { DOM } from \"../../../util/DOM\";\nimport { FallbackComponentName } from \"../FallbackComponentName\";\n\nexport class ImageFallbackComponent extends Component<ComponentConfiguration> {\n public static componentName: FallbackComponentName = \"imagefallback\";\n\n private _canvasId: string;\n private _dom: DOM;\n\n constructor(\n name: string,\n container: Container,\n navigator: Navigator,\n dom?: DOM) {\n\n super(name, container, navigator);\n\n this._canvasId = `${container.id}-${this._name}`;\n this._dom = !!dom ? dom : new DOM();\n }\n\n protected _activate(): void {\n const canvasSize$: Observable<[HTMLCanvasElement, ViewportSize]> = this._container.domRenderer.element$.pipe(\n map(\n (): HTMLCanvasElement => {\n return <HTMLCanvasElement>this._dom.document.getElementById(this._canvasId);\n }),\n filter(\n (canvas: HTMLCanvasElement): boolean => {\n return !!canvas;\n }),\n map(\n (canvas: HTMLCanvasElement): [HTMLCanvasElement, ViewportSize] => {\n const adaptableDomRenderer: HTMLElement = canvas.parentElement;\n const width: number = adaptableDomRenderer.offsetWidth;\n const height: number = adaptableDomRenderer.offsetHeight;\n\n return [canvas, { height: height, width: width }];\n }),\n distinctUntilChanged(\n (s1: ViewportSize, s2: ViewportSize): boolean => {\n return s1.height === s2.height && s1.width === s2.width;\n },\n ([, size]: [HTMLCanvasElement, ViewportSize]): ViewportSize => {\n return size;\n }));\n\n this._subscriptions.push(observableCombineLatest(\n canvasSize$,\n this._navigator.stateService.currentImage$)\n .subscribe(\n ([[canvas, size], image]: [[HTMLCanvasElement, ViewportSize], Image]): void => {\n canvas.width = size.width;\n canvas.height = size.height;\n canvas\n .getContext(\"2d\")\n .drawImage(image.image, 0, 0, size.width, size.height);\n }));\n\n this._container.domRenderer.renderAdaptive$.next({ name: this._name, vNode: vd.h(`canvas#${this._canvasId}`, []) });\n }\n\n protected _deactivate(): void {\n this._subscriptions.unsubscribe();\n }\n\n protected _getDefaultConfiguration(): ComponentConfiguration {\n return {};\n }\n}\n","import * as vd from \"virtual-dom\";\n\nimport {\n combineLatest as observableCombineLatest,\n of as observableOf,\n Observable,\n} from \"rxjs\";\n\nimport {\n map,\n switchMap,\n} from \"rxjs/operators\";\n\nimport { Component } from \"../../Component\";\nimport { NavigationFallbackConfiguration } from \"../../interfaces/NavigationFallbackConfiguration\";\n\nimport { CancelMapillaryError } from \"../../../error/CancelMapillaryError\";\nimport { Image } from \"../../../graph/Image\";\nimport { NavigationDirection } from \"../../../graph/edge/NavigationDirection\";\nimport { NavigationEdge } from \"../../../graph/edge/interfaces/NavigationEdge\";\nimport { NavigationEdgeStatus } from \"../../../graph/interfaces/NavigationEdgeStatus\";\nimport { VirtualNodeHash } from \"../../../render/interfaces/VirtualNodeHash\";\nimport { Container } from \"../../../viewer/Container\";\nimport { Navigator } from \"../../../viewer/Navigator\";\nimport { isSpherical } from \"../../../geo/Geo\";\nimport { FallbackComponentName } from \"../FallbackComponentName\";\n\n/**\n * @class NavigationFallbackComponent\n *\n * @classdesc Fallback navigation component for environments without WebGL support.\n *\n * Replaces the functionality in the Direction and Sequence components.\n */\nexport class NavigationFallbackComponent\n extends Component<NavigationFallbackConfiguration> {\n public static componentName: FallbackComponentName = \"navigationfallback\";\n\n private _seqNames: { [dir: string]: string };\n private _spaTopNames: { [dir: string]: string };\n private _spaBottomNames: { [dir: string]: string };\n\n /** @ignore */\n constructor(name: string, container: Container, navigator: Navigator) {\n super(name, container, navigator);\n\n this._seqNames = {};\n this._seqNames[NavigationDirection[NavigationDirection.Prev]] = \"-prev\";\n this._seqNames[NavigationDirection[NavigationDirection.Next]] = \"-next\";\n\n this._spaTopNames = {};\n this._spaTopNames[NavigationDirection[NavigationDirection.TurnLeft]] = \"-turn-left\";\n this._spaTopNames[NavigationDirection[NavigationDirection.StepLeft]] = \"-left\";\n this._spaTopNames[NavigationDirection[NavigationDirection.StepForward]] = \"-forward\";\n this._spaTopNames[NavigationDirection[NavigationDirection.StepRight]] = \"-right\";\n this._spaTopNames[NavigationDirection[NavigationDirection.TurnRight]] = \"-turn-right\";\n this._spaBottomNames = {};\n this._spaBottomNames[NavigationDirection[NavigationDirection.TurnU]] = \"-turn-around\";\n this._spaBottomNames[NavigationDirection[NavigationDirection.StepBackward]] = \"-backward\";\n }\n\n protected _activate(): void {\n this._subscriptions.push(observableCombineLatest(\n this._navigator.stateService.currentImage$,\n this._configuration$).pipe(\n switchMap(\n ([image, configuration]: [Image, NavigationFallbackConfiguration]): Observable<NavigationDirection[]> => {\n const sequenceEdges$: Observable<NavigationDirection[]> = configuration.sequence ?\n image.sequenceEdges$.pipe(\n map(\n (status: NavigationEdgeStatus): NavigationDirection[] => {\n return status.edges\n .map(\n (edge: NavigationEdge): NavigationDirection => {\n return edge.data.direction;\n });\n })) :\n observableOf<NavigationDirection[]>([]);\n\n const spatialEdges$: Observable<NavigationDirection[]> = !isSpherical(image.cameraType) &&\n configuration.spatial ?\n image.spatialEdges$.pipe(\n map(\n (status: NavigationEdgeStatus): NavigationDirection[] => {\n return status.edges\n .map(\n (edge: NavigationEdge): NavigationDirection => {\n return edge.data.direction;\n });\n })) :\n observableOf<NavigationDirection[]>([]);\n\n return observableCombineLatest(\n sequenceEdges$,\n spatialEdges$).pipe(\n map(\n ([seq, spa]: [NavigationDirection[], NavigationDirection[]]): NavigationDirection[] => {\n return seq.concat(spa);\n }));\n }),\n map(\n (edgeDirections: NavigationDirection[]): VirtualNodeHash => {\n const seqs: vd.VNode[] = this._createArrowRow(this._seqNames, edgeDirections);\n const spaTops: vd.VNode[] = this._createArrowRow(this._spaTopNames, edgeDirections);\n const spaBottoms: vd.VNode[] = this._createArrowRow(this._spaBottomNames, edgeDirections);\n\n const seqContainer: vd.VNode = vd.h(`div.mapillary-navigation-sequence`, seqs);\n const spaTopContainer: vd.VNode = vd.h(`div.NavigationSpatialTop`, spaTops);\n const spaBottomContainer: vd.VNode = vd.h(`div.mapillary-navigation-spatial-bottom`, spaBottoms);\n const spaContainer: vd.VNode = vd.h(`div.mapillary-navigation-spatial`, [spaTopContainer, spaBottomContainer]);\n\n return { name: this._name, vNode: vd.h(`div.NavigationContainer`, [seqContainer, spaContainer]) };\n }))\n .subscribe(this._container.domRenderer.render$));\n }\n\n protected _deactivate(): void {\n this._subscriptions.unsubscribe();\n }\n\n protected _getDefaultConfiguration(): NavigationFallbackConfiguration {\n return { sequence: true, spatial: true };\n }\n\n private _createArrowRow(arrowNames: { [dir: string]: string }, edgeDirections: NavigationDirection[]): vd.VNode[] {\n const arrows: vd.VNode[] = [];\n\n for (const arrowName in arrowNames) {\n if (!(arrowNames.hasOwnProperty(arrowName))) {\n continue;\n }\n\n const direction: NavigationDirection = NavigationDirection[<keyof typeof NavigationDirection>arrowName];\n if (edgeDirections.indexOf(direction) !== -1) {\n arrows.push(this._createVNode(direction, arrowNames[arrowName], \"visible\"));\n } else {\n arrows.push(this._createVNode(direction, arrowNames[arrowName], \"hidden\"));\n }\n }\n\n return arrows;\n }\n\n private _createVNode(direction: NavigationDirection, name: string, visibility: string): vd.VNode {\n return vd.h(\n `span.mapillary-navigation-button.mapillary-navigation${name}`,\n {\n onclick: (): void => {\n this._navigator.moveDir$(direction)\n .subscribe(\n undefined,\n (error: Error): void => {\n if (!(error instanceof CancelMapillaryError)) {\n console.error(error);\n }\n });\n },\n style: {\n visibility: visibility,\n },\n },\n []);\n }\n}\n","\n/*! pako 2.0.4 https://github.com/nodeca/pako @license (MIT AND Zlib) */\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//const Z_FILTERED = 1;\n//const Z_HUFFMAN_ONLY = 2;\n//const Z_RLE = 3;\nconst Z_FIXED$1 = 4;\n//const Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nconst Z_BINARY = 0;\nconst Z_TEXT = 1;\n//const Z_ASCII = 1; // = Z_TEXT\nconst Z_UNKNOWN$1 = 2;\n\n/*============================================================================*/\n\n\nfunction zero$1(buf) { let len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nconst STORED_BLOCK = 0;\nconst STATIC_TREES = 1;\nconst DYN_TREES = 2;\n/* The three kinds of block type */\n\nconst MIN_MATCH$1 = 3;\nconst MAX_MATCH$1 = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nconst LENGTH_CODES$1 = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nconst LITERALS$1 = 256;\n/* number of literal bytes 0..255 */\n\nconst L_CODES$1 = LITERALS$1 + 1 + LENGTH_CODES$1;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nconst D_CODES$1 = 30;\n/* number of distance codes */\n\nconst BL_CODES$1 = 19;\n/* number of codes used to transfer the bit lengths */\n\nconst HEAP_SIZE$1 = 2 * L_CODES$1 + 1;\n/* maximum heap size */\n\nconst MAX_BITS$1 = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nconst Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nconst MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nconst END_BLOCK = 256;\n/* end of block literal code */\n\nconst REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nconst REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nconst REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nconst extra_lbits = /* extra bits for each length code */\n 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]);\n\nconst extra_dbits = /* extra bits for each distance code */\n 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]);\n\nconst extra_blbits = /* extra bits for each bit length code */\n new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]);\n\nconst bl_order =\n new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nconst DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nconst static_ltree = new Array((L_CODES$1 + 2) * 2);\nzero$1(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nconst static_dtree = new Array(D_CODES$1 * 2);\nzero$1(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nconst _dist_code = new Array(DIST_CODE_LEN);\nzero$1(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nconst _length_code = new Array(MAX_MATCH$1 - MIN_MATCH$1 + 1);\nzero$1(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nconst base_length = new Array(LENGTH_CODES$1);\nzero$1(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nconst base_dist = new Array(D_CODES$1);\nzero$1(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nlet static_l_desc;\nlet static_d_desc;\nlet static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nconst d_code = (dist) => {\n\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n};\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nconst put_short = (s, w) => {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n};\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nconst send_bits = (s, value, length) => {\n\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n};\n\n\nconst send_code = (s, c, tree) => {\n\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n};\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nconst bi_reverse = (code, len) => {\n\n let res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n};\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nconst bi_flush = (s) => {\n\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n};\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nconst gen_bitlen = (s, desc) =>\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n const tree = desc.dyn_tree;\n const max_code = desc.max_code;\n const stree = desc.stat_desc.static_tree;\n const has_stree = desc.stat_desc.has_stree;\n const extra = desc.stat_desc.extra_bits;\n const base = desc.stat_desc.extra_base;\n const max_length = desc.stat_desc.max_length;\n let h; /* heap index */\n let n, m; /* iterate over the tree elements */\n let bits; /* bit length */\n let xbits; /* extra bits */\n let f; /* frequency */\n let overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS$1; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE$1; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n};\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nconst gen_codes = (tree, max_code, bl_count) =>\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n const next_code = new Array(MAX_BITS$1 + 1); /* next code value for each bit length */\n let code = 0; /* running code value */\n let bits; /* bit index */\n let n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS$1; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,\n // \"inconsistent bit counts\");\n //Tracev((stderr,\"\\ngen_codes: max_code %d \", max_code));\n\n for (n = 0; n <= max_code; n++) {\n let len = tree[n * 2 + 1]/*.Len*/;\n if (len === 0) { continue; }\n /* Now reverse the bits */\n tree[n * 2]/*.Code*/ = bi_reverse(next_code[len]++, len);\n\n //Tracecv(tree != static_ltree, (stderr,\"\\nn %3d %c l %2d c %4x (%x) \",\n // n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));\n }\n};\n\n\n/* ===========================================================================\n * Initialize the various 'constant' tables.\n */\nconst tr_static_init = () => {\n\n let n; /* iterates over tree elements */\n let bits; /* bit counter */\n let length; /* length value */\n let code; /* code value */\n let dist; /* distance index */\n const bl_count = new Array(MAX_BITS$1 + 1);\n /* number of codes at each bit length for an optimal tree */\n\n // do check in _tr_init()\n //if (static_init_done) return;\n\n /* For some embedded targets, global variables are not initialized: */\n/*#ifdef NO_INIT_GLOBAL_POINTERS\n static_l_desc.static_tree = static_ltree;\n static_l_desc.extra_bits = extra_lbits;\n static_d_desc.static_tree = static_dtree;\n static_d_desc.extra_bits = extra_dbits;\n static_bl_desc.extra_bits = extra_blbits;\n#endif*/\n\n /* Initialize the mapping length (0..255) -> length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES$1 - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES$1; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS$1; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES$1 + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES$1; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS$1 + 1, L_CODES$1, MAX_BITS$1);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES$1, MAX_BITS$1);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES$1, MAX_BL_BITS);\n\n //static_init_done = true;\n};\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nconst init_block = (s) => {\n\n let n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES$1; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES$1; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES$1; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n};\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nconst bi_windup = (s) =>\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n};\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nconst copy_block = (s, buf, len, header) =>\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n s.pending_buf.set(s.window.subarray(buf, buf + len), s.pending);\n s.pending += len;\n};\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nconst smaller = (tree, n, m, depth) => {\n\n const _n2 = n * 2;\n const _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n};\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nconst pqdownheap = (s, tree, k) =>\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n const v = s.heap[k];\n let j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n};\n\n\n// inlined manually\n// const SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nconst compress_block = (s, ltree, dtree) =>\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n let dist; /* distance of matched string */\n let lc; /* match length or unmatched char (if dist == 0) */\n let lx = 0; /* running index in l_buf */\n let code; /* the code to send */\n let extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS$1 + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n};\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nconst build_tree = (s, desc) =>\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n const tree = desc.dyn_tree;\n const stree = desc.stat_desc.static_tree;\n const has_stree = desc.stat_desc.has_stree;\n const elems = desc.stat_desc.elems;\n let n, m; /* iterate over heap elements */\n let max_code = -1; /* largest code with non zero frequency */\n let node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE$1;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n};\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nconst scan_tree = (s, tree, max_code) =>\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n let n; /* iterates over all tree elements */\n let prevlen = -1; /* last emitted length */\n let curlen; /* length of current code */\n\n let nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n let count = 0; /* repeat count of the current code */\n let max_count = 7; /* max repeat count */\n let min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n};\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nconst send_tree = (s, tree, max_code) =>\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n let n; /* iterates over all tree elements */\n let prevlen = -1; /* last emitted length */\n let curlen; /* length of current code */\n\n let nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n let count = 0; /* repeat count of the current code */\n let max_count = 7; /* max repeat count */\n let min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n};\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nconst build_bl_tree = (s) => {\n\n let max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES$1 - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n};\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nconst send_all_trees = (s, lcodes, dcodes, blcodes) =>\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n let rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n};\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nconst detect_data_type = (s) => {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n let black_mask = 0xf3ffc07f;\n let n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS$1; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n};\n\n\nlet static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nconst _tr_init$1 = (s) =>\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n};\n\n\n/* ===========================================================================\n * Send a stored block\n */\nconst _tr_stored_block$1 = (s, buf, stored_len, last) =>\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n};\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nconst _tr_align$1 = (s) => {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n};\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nconst _tr_flush_block$1 = (s, buf, stored_len, last) =>\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n let opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n let max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN$1) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block$1(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED$1 || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n};\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nconst _tr_tally$1 = (s, dist, lc) =>\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //let out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS$1 + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n};\n\nvar _tr_init_1 = _tr_init$1;\nvar _tr_stored_block_1 = _tr_stored_block$1;\nvar _tr_flush_block_1 = _tr_flush_block$1;\nvar _tr_tally_1 = _tr_tally$1;\nvar _tr_align_1 = _tr_align$1;\n\nvar trees = {\n\t_tr_init: _tr_init_1,\n\t_tr_stored_block: _tr_stored_block_1,\n\t_tr_flush_block: _tr_flush_block_1,\n\t_tr_tally: _tr_tally_1,\n\t_tr_align: _tr_align_1\n};\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst adler32 = (adler, buf, len, pos) => {\n let s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n};\n\n\nvar adler32_1 = adler32;\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nconst makeTable = () => {\n let c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n};\n\n// Create table on load. Just 255 signed longs. Not a problem.\nconst crcTable = new Uint32Array(makeTable());\n\n\nconst crc32 = (crc, buf, len, pos) => {\n const t = crcTable;\n const end = pos + len;\n\n crc ^= -1;\n\n for (let i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n};\n\n\nvar crc32_1 = crc32;\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar messages = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar constants$2 = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst { _tr_init, _tr_stored_block, _tr_flush_block, _tr_tally, _tr_align } = trees;\n\n\n\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_NO_FLUSH: Z_NO_FLUSH$2, Z_PARTIAL_FLUSH, Z_FULL_FLUSH: Z_FULL_FLUSH$1, Z_FINISH: Z_FINISH$3, Z_BLOCK: Z_BLOCK$1,\n Z_OK: Z_OK$3, Z_STREAM_END: Z_STREAM_END$3, Z_STREAM_ERROR: Z_STREAM_ERROR$2, Z_DATA_ERROR: Z_DATA_ERROR$2, Z_BUF_ERROR: Z_BUF_ERROR$1,\n Z_DEFAULT_COMPRESSION: Z_DEFAULT_COMPRESSION$1,\n Z_FILTERED, Z_HUFFMAN_ONLY, Z_RLE, Z_FIXED, Z_DEFAULT_STRATEGY: Z_DEFAULT_STRATEGY$1,\n Z_UNKNOWN,\n Z_DEFLATED: Z_DEFLATED$2\n} = constants$2;\n\n/*============================================================================*/\n\n\nconst MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nconst MAX_WBITS$1 = 15;\n/* 32K LZ77 window */\nconst DEF_MEM_LEVEL = 8;\n\n\nconst LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nconst LITERALS = 256;\n/* number of literal bytes 0..255 */\nconst L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nconst D_CODES = 30;\n/* number of distance codes */\nconst BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nconst HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nconst MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nconst MIN_MATCH = 3;\nconst MAX_MATCH = 258;\nconst MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nconst PRESET_DICT = 0x20;\n\nconst INIT_STATE = 42;\nconst EXTRA_STATE = 69;\nconst NAME_STATE = 73;\nconst COMMENT_STATE = 91;\nconst HCRC_STATE = 103;\nconst BUSY_STATE = 113;\nconst FINISH_STATE = 666;\n\nconst BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nconst BS_BLOCK_DONE = 2; /* block flush performed */\nconst BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nconst BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nconst OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nconst err = (strm, errorCode) => {\n strm.msg = messages[errorCode];\n return errorCode;\n};\n\nconst rank = (f) => {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n};\n\nconst zero = (buf) => {\n let len = buf.length; while (--len >= 0) { buf[len] = 0; }\n};\n\n\n/* eslint-disable new-cap */\nlet HASH_ZLIB = (s, prev, data) => ((prev << s.hash_shift) ^ data) & s.hash_mask;\n// This hash causes less collisions, https://github.com/nodeca/pako/issues/135\n// But breaks binary compatibility\n//let HASH_FAST = (s, prev, data) => ((prev << 8) + (prev >> 8) + (data << 4)) & s.hash_mask;\nlet HASH = HASH_ZLIB;\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nconst flush_pending = (strm) => {\n const s = strm.state;\n\n //_tr_flush_bits(s);\n let len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n strm.output.set(s.pending_buf.subarray(s.pending_out, s.pending_out + len), strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n};\n\n\nconst flush_block_only = (s, last) => {\n _tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n};\n\n\nconst put_byte = (s, b) => {\n s.pending_buf[s.pending++] = b;\n};\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nconst putShortMSB = (s, b) => {\n\n // put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n};\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nconst read_buf = (strm, buf, start, size) => {\n\n let len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n buf.set(strm.input.subarray(strm.next_in, strm.next_in + len), start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32_1(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32_1(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n};\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nconst longest_match = (s, cur_match) => {\n\n let chain_length = s.max_chain_length; /* max hash chain length */\n let scan = s.strstart; /* current string */\n let match; /* matched string */\n let len; /* length of current match */\n let best_len = s.prev_length; /* best match length so far */\n let nice_match = s.nice_match; /* stop if match long enough */\n const limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n const _win = s.window; // shortcut\n\n const wmask = s.w_mask;\n const prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n const strend = s.strstart + MAX_MATCH;\n let scan_end1 = _win[scan + best_len - 1];\n let scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n};\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nconst fill_window = (s) => {\n\n const _w_size = s.w_size;\n let p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n s.window.set(s.window.subarray(_w_size, _w_size + _w_size), 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[str + 1]);\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// const curr = s.strstart + s.lookahead;\n// let init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n};\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nconst deflate_stored = (s, flush) => {\n\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n let max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH$2) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n const max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH$3) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n};\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nconst deflate_fast = (s, flush) => {\n\n let hash_head; /* head of the hash chain */\n let bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH$2) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = _tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + 1]);\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH$3) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n};\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nconst deflate_slow = (s, flush) => {\n\n let hash_head; /* head of hash chain */\n let bflush; /* set if current block must be flushed */\n\n let max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH$2) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = _tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = HASH(s, s.ins_h, s.window[s.strstart + MIN_MATCH - 1]);\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH$3) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n};\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nconst deflate_rle = (s, flush) => {\n\n let bflush; /* set if current block must be flushed */\n let prev; /* byte at distance one to match */\n let scan, strend; /* scan goes up to strend for length of run */\n\n const _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH$2) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = _tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH$3) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n};\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nconst deflate_huff = (s, flush) => {\n\n let bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH$2) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = _tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH$3) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n};\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nconst configuration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nconst lm_init = (s) => {\n\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n};\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED$2; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new Uint16Array(HEAP_SIZE * 2);\n this.dyn_dtree = new Uint16Array((2 * D_CODES + 1) * 2);\n this.bl_tree = new Uint16Array((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new Uint16Array(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new Uint16Array(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new Uint16Array(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nconst deflateResetKeep = (strm) => {\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR$2);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n const s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH$2;\n _tr_init(s);\n return Z_OK$3;\n};\n\n\nconst deflateReset = (strm) => {\n\n const ret = deflateResetKeep(strm);\n if (ret === Z_OK$3) {\n lm_init(strm.state);\n }\n return ret;\n};\n\n\nconst deflateSetHeader = (strm, head) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR$2; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR$2; }\n strm.state.gzhead = head;\n return Z_OK$3;\n};\n\n\nconst deflateInit2 = (strm, level, method, windowBits, memLevel, strategy) => {\n\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR$2;\n }\n let wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION$1) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED$2 ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR$2);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n const s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new Uint8Array(s.w_size * 2);\n s.head = new Uint16Array(s.hash_size);\n s.prev = new Uint16Array(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new Uint8Array(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n};\n\nconst deflateInit = (strm, level) => {\n\n return deflateInit2(strm, level, Z_DEFLATED$2, MAX_WBITS$1, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY$1);\n};\n\n\nconst deflate$2 = (strm, flush) => {\n\n let beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK$1 || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR$2) : Z_STREAM_ERROR$2;\n }\n\n const s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH$3)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR$1 : Z_STREAM_ERROR$2);\n }\n\n s.strm = strm; /* just in case */\n const old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n let header = (Z_DEFLATED$2 + ((s.w_bits - 8) << 4)) << 8;\n let level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32_1(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK$3;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH$3) {\n return err(strm, Z_BUF_ERROR$1);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR$1);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH$2 && s.status !== FINISH_STATE)) {\n let bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK$3;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n _tr_align(s);\n }\n else if (flush !== Z_BLOCK$1) { /* FULL_FLUSH or SYNC_FLUSH */\n\n _tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH$1) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK$3;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH$3) { return Z_OK$3; }\n if (s.wrap <= 0) { return Z_STREAM_END$3; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK$3 : Z_STREAM_END$3;\n};\n\n\nconst deflateEnd = (strm) => {\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR$2;\n }\n\n const status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR$2);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR$2) : Z_OK$3;\n};\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nconst deflateSetDictionary = (strm, dictionary) => {\n\n let dictLength = dictionary.length;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR$2;\n }\n\n const s = strm.state;\n const wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR$2;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32_1(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n let tmpDict = new Uint8Array(s.w_size);\n tmpDict.set(dictionary.subarray(dictLength - s.w_size, dictLength), 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n const avail = strm.avail_in;\n const next = strm.next_in;\n const input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n let str = s.strstart;\n let n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = HASH(s, s.ins_h, s.window[str + MIN_MATCH - 1]);\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK$3;\n};\n\n\nvar deflateInit_1 = deflateInit;\nvar deflateInit2_1 = deflateInit2;\nvar deflateReset_1 = deflateReset;\nvar deflateResetKeep_1 = deflateResetKeep;\nvar deflateSetHeader_1 = deflateSetHeader;\nvar deflate_2$1 = deflate$2;\nvar deflateEnd_1 = deflateEnd;\nvar deflateSetDictionary_1 = deflateSetDictionary;\nvar deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nmodule.exports.deflateBound = deflateBound;\nmodule.exports.deflateCopy = deflateCopy;\nmodule.exports.deflateParams = deflateParams;\nmodule.exports.deflatePending = deflatePending;\nmodule.exports.deflatePrime = deflatePrime;\nmodule.exports.deflateTune = deflateTune;\n*/\n\nvar deflate_1$2 = {\n\tdeflateInit: deflateInit_1,\n\tdeflateInit2: deflateInit2_1,\n\tdeflateReset: deflateReset_1,\n\tdeflateResetKeep: deflateResetKeep_1,\n\tdeflateSetHeader: deflateSetHeader_1,\n\tdeflate: deflate_2$1,\n\tdeflateEnd: deflateEnd_1,\n\tdeflateSetDictionary: deflateSetDictionary_1,\n\tdeflateInfo: deflateInfo\n};\n\nconst _has = (obj, key) => {\n return Object.prototype.hasOwnProperty.call(obj, key);\n};\n\nvar assign = function (obj /*from1, from2, from3, ...*/) {\n const sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n const source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (const p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// Join array of chunks to single array.\nvar flattenChunks = (chunks) => {\n // calculate data length\n let len = 0;\n\n for (let i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n const result = new Uint8Array(len);\n\n for (let i = 0, pos = 0, l = chunks.length; i < l; i++) {\n let chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n};\n\nvar common = {\n\tassign: assign,\n\tflattenChunks: flattenChunks\n};\n\n// String encode/decode helpers\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nlet STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nconst _utf8len = new Uint8Array(256);\nfor (let q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nvar string2buf = (str) => {\n if (typeof TextEncoder === 'function' && TextEncoder.prototype.encode) {\n return new TextEncoder().encode(str);\n }\n\n let buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new Uint8Array(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper\nconst buf2binstring = (buf, len) => {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if (buf.subarray && STR_APPLY_UIA_OK) {\n return String.fromCharCode.apply(null, buf.length === len ? buf : buf.subarray(0, len));\n }\n }\n\n let result = '';\n for (let i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n};\n\n\n// convert array to string\nvar buf2string = (buf, max) => {\n const len = max || buf.length;\n\n if (typeof TextDecoder === 'function' && TextDecoder.prototype.decode) {\n return new TextDecoder().decode(buf.subarray(0, max));\n }\n\n let i, out;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n const utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n let c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n let c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nvar utf8border = (buf, max) => {\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n let pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n\nvar strings = {\n\tstring2buf: string2buf,\n\tbuf2string: buf2string,\n\tutf8border: utf8border\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nvar zstream = ZStream;\n\nconst toString$1 = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_NO_FLUSH: Z_NO_FLUSH$1, Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH: Z_FINISH$2,\n Z_OK: Z_OK$2, Z_STREAM_END: Z_STREAM_END$2,\n Z_DEFAULT_COMPRESSION,\n Z_DEFAULT_STRATEGY,\n Z_DEFLATED: Z_DEFLATED$1\n} = constants$2;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * , chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate$1(options) {\n this.options = common.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED$1,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY\n }, options || {});\n\n let opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new zstream();\n this.strm.avail_out = 0;\n\n let status = deflate_1$2.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK$2) {\n throw new Error(messages[status]);\n }\n\n if (opt.header) {\n deflate_1$2.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n let dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString$1.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = deflate_1$2.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK$2) {\n throw new Error(messages[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must\n * have `flush_mode` Z_FINISH (or `true`). That will flush internal pending\n * buffers and call [[Deflate#onEnd]].\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate$1.prototype.push = function (data, flush_mode) {\n const strm = this.strm;\n const chunkSize = this.options.chunkSize;\n let status, _flush_mode;\n\n if (this.ended) { return false; }\n\n if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n else _flush_mode = flush_mode === true ? Z_FINISH$2 : Z_NO_FLUSH$1;\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString$1.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n for (;;) {\n if (strm.avail_out === 0) {\n strm.output = new Uint8Array(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n // Make sure avail_out > 6 to avoid repeating markers\n if ((_flush_mode === Z_SYNC_FLUSH || _flush_mode === Z_FULL_FLUSH) && strm.avail_out <= 6) {\n this.onData(strm.output.subarray(0, strm.next_out));\n strm.avail_out = 0;\n continue;\n }\n\n status = deflate_1$2.deflate(strm, _flush_mode);\n\n // Ended => flush and finish\n if (status === Z_STREAM_END$2) {\n if (strm.next_out > 0) {\n this.onData(strm.output.subarray(0, strm.next_out));\n }\n status = deflate_1$2.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK$2;\n }\n\n // Flush if out buffer full\n if (strm.avail_out === 0) {\n this.onData(strm.output);\n continue;\n }\n\n // Flush if requested and has data\n if (_flush_mode > 0 && strm.next_out > 0) {\n this.onData(strm.output.subarray(0, strm.next_out));\n strm.avail_out = 0;\n continue;\n }\n\n if (strm.avail_in === 0) break;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array): output data.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate$1.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate$1.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK$2) {\n this.result = common.flattenChunks(this.chunks);\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array\n * - data (Uint8Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const data = new Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate$1(input, options) {\n const deflator = new Deflate$1(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || messages[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array\n * - data (Uint8Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw$1(input, options) {\n options = options || {};\n options.raw = true;\n return deflate$1(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array\n * - data (Uint8Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip$1(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate$1(input, options);\n}\n\n\nvar Deflate_1$1 = Deflate$1;\nvar deflate_2 = deflate$1;\nvar deflateRaw_1$1 = deflateRaw$1;\nvar gzip_1$1 = gzip$1;\nvar constants$1 = constants$2;\n\nvar deflate_1$1 = {\n\tDeflate: Deflate_1$1,\n\tdeflate: deflate_2,\n\tdeflateRaw: deflateRaw_1$1,\n\tgzip: gzip_1$1,\n\tconstants: constants$1\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nconst BAD$1 = 30; /* got a data error -- remain here until reset */\nconst TYPE$1 = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nvar inffast = function inflate_fast(strm, start) {\n let _in; /* local strm.input */\n let last; /* have enough input while in < last */\n let _out; /* local strm.output */\n let beg; /* inflate()'s initial strm.output */\n let end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n let dmax; /* maximum distance from zlib header */\n//#endif\n let wsize; /* window size or zero if not using window */\n let whave; /* valid bytes in the window */\n let wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n let s_window; /* allocated sliding window, if wsize != 0 */\n let hold; /* local strm.hold */\n let bits; /* local strm.bits */\n let lcode; /* local strm.lencode */\n let dcode; /* local strm.distcode */\n let lmask; /* mask for first level of length codes */\n let dmask; /* mask for first level of distance codes */\n let here; /* retrieved table entry */\n let op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n let len; /* match length, unused bytes */\n let dist; /* match distance */\n let from; /* where to copy match from */\n let from_source;\n\n\n let input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n const state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD$1;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE$1;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD$1;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nconst MAXBITS = 15;\nconst ENOUGH_LENS$1 = 852;\nconst ENOUGH_DISTS$1 = 592;\n//const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nconst CODES$1 = 0;\nconst LENS$1 = 1;\nconst DISTS$1 = 2;\n\nconst lbase = new Uint16Array([ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n]);\n\nconst lext = new Uint8Array([ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n]);\n\nconst dbase = new Uint16Array([ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n]);\n\nconst dext = new Uint8Array([ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n]);\n\nconst inflate_table = (type, lens, lens_index, codes, table, table_index, work, opts) =>\n{\n const bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n let len = 0; /* a code's length in bits */\n let sym = 0; /* index of code symbols */\n let min = 0, max = 0; /* minimum and maximum code lengths */\n let root = 0; /* number of index bits for root table */\n let curr = 0; /* number of index bits for current table */\n let drop = 0; /* code bits to drop for sub-table */\n let left = 0; /* number of prefix codes available */\n let used = 0; /* code entries in table used */\n let huff = 0; /* Huffman code */\n let incr; /* for incrementing code, index */\n let fill; /* index for replicating entries */\n let low; /* low bits for current root entry */\n let mask; /* mask for low root bits */\n let next; /* next available space in table */\n let base = null; /* base value table to use */\n let base_index = 0;\n// let shoextra; /* extra bits table to use */\n let end; /* use base and extra for symbol > end */\n const count = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n const offs = new Uint16Array(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n let extra = null;\n let extra_index = 0;\n\n let here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES$1 || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES$1) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS$1) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS$1 && used > ENOUGH_LENS$1) ||\n (type === DISTS$1 && used > ENOUGH_DISTS$1)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n\n\nvar inftrees = inflate_table;\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n\n\n\n\n\nconst CODES = 0;\nconst LENS = 1;\nconst DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_FINISH: Z_FINISH$1, Z_BLOCK, Z_TREES,\n Z_OK: Z_OK$1, Z_STREAM_END: Z_STREAM_END$1, Z_NEED_DICT: Z_NEED_DICT$1, Z_STREAM_ERROR: Z_STREAM_ERROR$1, Z_DATA_ERROR: Z_DATA_ERROR$1, Z_MEM_ERROR: Z_MEM_ERROR$1, Z_BUF_ERROR,\n Z_DEFLATED\n} = constants$2;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nconst HEAD = 1; /* i: waiting for magic header */\nconst FLAGS = 2; /* i: waiting for method and flags (gzip) */\nconst TIME = 3; /* i: waiting for modification time (gzip) */\nconst OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nconst EXLEN = 5; /* i: waiting for extra length (gzip) */\nconst EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nconst NAME = 7; /* i: waiting for end of file name (gzip) */\nconst COMMENT = 8; /* i: waiting for end of comment (gzip) */\nconst HCRC = 9; /* i: waiting for header crc (gzip) */\nconst DICTID = 10; /* i: waiting for dictionary check value */\nconst DICT = 11; /* waiting for inflateSetDictionary() call */\nconst TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nconst TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nconst STORED = 14; /* i: waiting for stored size (length and complement) */\nconst COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nconst COPY = 16; /* i/o: waiting for input or output to copy stored block */\nconst TABLE = 17; /* i: waiting for dynamic block table lengths */\nconst LENLENS = 18; /* i: waiting for code length code lengths */\nconst CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nconst LEN_ = 20; /* i: same as LEN below, but only first time in */\nconst LEN = 21; /* i: waiting for length/lit/eob code */\nconst LENEXT = 22; /* i: waiting for length extra bits */\nconst DIST = 23; /* i: waiting for distance code */\nconst DISTEXT = 24; /* i: waiting for distance extra bits */\nconst MATCH = 25; /* o: waiting for output space to copy string */\nconst LIT = 26; /* o: waiting for output space to write literal */\nconst CHECK = 27; /* i: waiting for 32-bit check value */\nconst LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nconst DONE = 29; /* finished check, done -- remain here until reset */\nconst BAD = 30; /* got a data error -- remain here until reset */\nconst MEM = 31; /* got an inflate() memory error -- remain here until reset */\nconst SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nconst ENOUGH_LENS = 852;\nconst ENOUGH_DISTS = 592;\n//const ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nconst MAX_WBITS = 15;\n/* 32K LZ77 window */\nconst DEF_WBITS = MAX_WBITS;\n\n\nconst zswap32 = (q) => {\n\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n};\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new Uint16Array(320); /* temporary storage for code lengths */\n this.work = new Uint16Array(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new Int32Array(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\n\nconst inflateResetKeep = (strm) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new Int32Array(ENOUGH_LENS);\n state.distcode = state.distdyn = new Int32Array(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK$1;\n};\n\n\nconst inflateReset = (strm) => {\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n};\n\n\nconst inflateReset2 = (strm, windowBits) => {\n let wrap;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR$1;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n};\n\n\nconst inflateInit2 = (strm, windowBits) => {\n\n if (!strm) { return Z_STREAM_ERROR$1; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n const state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n const ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK$1) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n};\n\n\nconst inflateInit = (strm) => {\n\n return inflateInit2(strm, DEF_WBITS);\n};\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nlet virgin = true;\n\nlet lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\n\nconst fixedtables = (state) => {\n\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n lenfix = new Int32Array(512);\n distfix = new Int32Array(32);\n\n /* literal/length table */\n let sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inftrees(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inftrees(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n};\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nconst updatewindow = (strm, src, end, copy) => {\n\n let dist;\n const state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new Uint8Array(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n state.window.set(src.subarray(end - state.wsize, end), 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n state.window.set(src.subarray(end - copy, end - copy + dist), state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n state.window.set(src.subarray(end - copy, end), 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n};\n\n\nconst inflate$2 = (strm, flush) => {\n\n let state;\n let input, output; // input/output buffers\n let next; /* next input INDEX */\n let put; /* next output INDEX */\n let have, left; /* available input and output */\n let hold; /* bit buffer */\n let bits; /* bits in bit buffer */\n let _in, _out; /* save starting available input and output */\n let copy; /* number of stored or match bytes to copy */\n let from; /* where to copy match bytes from */\n let from_source;\n let here = 0; /* current decoding table entry */\n let here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //let last; /* parent table entry */\n let last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n let len; /* length to copy for repeats, bits to drop */\n let ret; /* return code */\n const hbuf = new Uint8Array(4); /* buffer for gzip header crc calculation */\n let opts;\n\n let n; // temporary variable for NEED_BITS\n\n const order = /* permutation of code lengths */\n new Uint8Array([ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]);\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR$1;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK$1;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n\n // !!! pako patch. Force use `options.windowBits` if passed.\n // Required to always use max window size by default.\n state.dmax = 1 << state.wbits;\n //state.dmax = 1 << len;\n\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32_1(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32_1(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Uint8Array(state.head.extra_len);\n }\n state.head.extra.set(\n input.subarray(\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n next + copy\n ),\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32_1(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT$1;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n output.set(input.subarray(next, next + copy), put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inftrees(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inftrees(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inftrees(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inffast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, put - _out) : adler32_1(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END$1;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR$1;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR$1;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR$1;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH$1))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) ;\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32_1(state.check, output, _out, strm.next_out - _out) : adler32_1(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH$1) && ret === Z_OK$1) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n};\n\n\nconst inflateEnd = (strm) => {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR$1;\n }\n\n let state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK$1;\n};\n\n\nconst inflateGetHeader = (strm, head) => {\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR$1; }\n const state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR$1; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK$1;\n};\n\n\nconst inflateSetDictionary = (strm, dictionary) => {\n const dictLength = dictionary.length;\n\n let state;\n let dictid;\n let ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR$1; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR$1;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32_1(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR$1;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR$1;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK$1;\n};\n\n\nvar inflateReset_1 = inflateReset;\nvar inflateReset2_1 = inflateReset2;\nvar inflateResetKeep_1 = inflateResetKeep;\nvar inflateInit_1 = inflateInit;\nvar inflateInit2_1 = inflateInit2;\nvar inflate_2$1 = inflate$2;\nvar inflateEnd_1 = inflateEnd;\nvar inflateGetHeader_1 = inflateGetHeader;\nvar inflateSetDictionary_1 = inflateSetDictionary;\nvar inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nmodule.exports.inflateCopy = inflateCopy;\nmodule.exports.inflateGetDictionary = inflateGetDictionary;\nmodule.exports.inflateMark = inflateMark;\nmodule.exports.inflatePrime = inflatePrime;\nmodule.exports.inflateSync = inflateSync;\nmodule.exports.inflateSyncPoint = inflateSyncPoint;\nmodule.exports.inflateUndermine = inflateUndermine;\n*/\n\nvar inflate_1$2 = {\n\tinflateReset: inflateReset_1,\n\tinflateReset2: inflateReset2_1,\n\tinflateResetKeep: inflateResetKeep_1,\n\tinflateInit: inflateInit_1,\n\tinflateInit2: inflateInit2_1,\n\tinflate: inflate_2$1,\n\tinflateEnd: inflateEnd_1,\n\tinflateGetHeader: inflateGetHeader_1,\n\tinflateSetDictionary: inflateSetDictionary_1,\n\tinflateInfo: inflateInfo\n};\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nvar gzheader = GZheader;\n\nconst toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nconst {\n Z_NO_FLUSH, Z_FINISH,\n Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR\n} = constants$2;\n\n/* ===========================================================================*/\n\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako')\n * const chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])\n * const chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * const inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate$1(options) {\n this.options = common.assign({\n chunkSize: 1024 * 64,\n windowBits: 15,\n to: ''\n }, options || {});\n\n const opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new zstream();\n this.strm.avail_out = 0;\n\n let status = inflate_1$2.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n\n this.header = new gzheader();\n\n inflate_1$2.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = inflate_1$2.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== Z_OK) {\n throw new Error(messages[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, flush_mode]) -> Boolean\n * - data (Uint8Array|ArrayBuffer): input data\n * - flush_mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE\n * flush modes. See constants. Skipped or `false` means Z_NO_FLUSH,\n * `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. If end of stream detected,\n * [[Inflate#onEnd]] will be called.\n *\n * `flush_mode` is not needed for normal operation, because end of stream\n * detected automatically. You may try to use it for advanced things, but\n * this functionality was not tested.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate$1.prototype.push = function (data, flush_mode) {\n const strm = this.strm;\n const chunkSize = this.options.chunkSize;\n const dictionary = this.options.dictionary;\n let status, _flush_mode, last_avail_out;\n\n if (this.ended) return false;\n\n if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;\n else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;\n\n // Convert data if needed\n if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n for (;;) {\n if (strm.avail_out === 0) {\n strm.output = new Uint8Array(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = inflate_1$2.inflate(strm, _flush_mode);\n\n if (status === Z_NEED_DICT && dictionary) {\n status = inflate_1$2.inflateSetDictionary(strm, dictionary);\n\n if (status === Z_OK) {\n status = inflate_1$2.inflate(strm, _flush_mode);\n } else if (status === Z_DATA_ERROR) {\n // Replace code with more verbose\n status = Z_NEED_DICT;\n }\n }\n\n // Skip snyc markers if more data follows and not raw mode\n while (strm.avail_in > 0 &&\n status === Z_STREAM_END &&\n strm.state.wrap > 0 &&\n data[strm.next_in] !== 0)\n {\n inflate_1$2.inflateReset(strm);\n status = inflate_1$2.inflate(strm, _flush_mode);\n }\n\n switch (status) {\n case Z_STREAM_ERROR:\n case Z_DATA_ERROR:\n case Z_NEED_DICT:\n case Z_MEM_ERROR:\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n // Remember real `avail_out` value, because we may patch out buffer content\n // to align utf8 strings boundaries.\n last_avail_out = strm.avail_out;\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === Z_STREAM_END) {\n\n if (this.options.to === 'string') {\n\n let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n let tail = strm.next_out - next_out_utf8;\n let utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail & realign counters\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);\n\n this.onData(utf8str);\n\n } else {\n this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));\n }\n }\n }\n\n // Must repeat iteration if out buffer is full\n if (status === Z_OK && last_avail_out === 0) continue;\n\n // Finalize if end of stream reached.\n if (status === Z_STREAM_END) {\n status = inflate_1$2.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return true;\n }\n\n if (strm.avail_in === 0) break;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|String): output data. When string output requested,\n * each chunk will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate$1.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH). By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate$1.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = common.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * const pako = require('pako');\n * const input = pako.deflate(new Uint8Array([1,2,3,4,5,6,7,8,9]));\n * let output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err) {\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate$1(input, options) {\n const inflator = new Inflate$1(options);\n\n inflator.push(input);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) throw inflator.msg || messages[inflator.err];\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw$1(input, options) {\n options = options || {};\n options.raw = true;\n return inflate$1(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|String\n * - data (Uint8Array): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nvar Inflate_1$1 = Inflate$1;\nvar inflate_2 = inflate$1;\nvar inflateRaw_1$1 = inflateRaw$1;\nvar ungzip$1 = inflate$1;\nvar constants = constants$2;\n\nvar inflate_1$1 = {\n\tInflate: Inflate_1$1,\n\tinflate: inflate_2,\n\tinflateRaw: inflateRaw_1$1,\n\tungzip: ungzip$1,\n\tconstants: constants\n};\n\nconst { Deflate, deflate, deflateRaw, gzip } = deflate_1$1;\n\nconst { Inflate, inflate, inflateRaw, ungzip } = inflate_1$1;\n\n\n\nvar Deflate_1 = Deflate;\nvar deflate_1 = deflate;\nvar deflateRaw_1 = deflateRaw;\nvar gzip_1 = gzip;\nvar Inflate_1 = Inflate;\nvar inflate_1 = inflate;\nvar inflateRaw_1 = inflateRaw;\nvar ungzip_1 = ungzip;\nvar constants_1 = constants$2;\n\nvar pako = {\n\tDeflate: Deflate_1,\n\tdeflate: deflate_1,\n\tdeflateRaw: deflateRaw_1,\n\tgzip: gzip_1,\n\tInflate: Inflate_1,\n\tinflate: inflate_1,\n\tinflateRaw: inflateRaw_1,\n\tungzip: ungzip_1,\n\tconstants: constants_1\n};\n\nexport { Deflate_1 as Deflate, Inflate_1 as Inflate, constants_1 as constants, pako as default, deflate_1 as deflate, deflateRaw_1 as deflateRaw, gzip_1 as gzip, inflate_1 as inflate, inflateRaw_1 as inflateRaw, ungzip_1 as ungzip };\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","'use strict';\n\nmodule.exports = Pbf;\n\nvar ieee754 = require('ieee754');\n\nfunction Pbf(buf) {\n this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);\n this.pos = 0;\n this.type = 0;\n this.length = this.buf.length;\n}\n\nPbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum\nPbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64\nPbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields\nPbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32\n\nvar SHIFT_LEFT_32 = (1 << 16) * (1 << 16),\n SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;\n\n// Threshold chosen based on both benchmarking and knowledge about browser string\n// data structures (which currently switch structure types at 12 bytes or more)\nvar TEXT_DECODER_MIN_LENGTH = 12;\nvar utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');\n\nPbf.prototype = {\n\n destroy: function() {\n this.buf = null;\n },\n\n // === READING =================================================================\n\n readFields: function(readField, result, end) {\n end = end || this.length;\n\n while (this.pos < end) {\n var val = this.readVarint(),\n tag = val >> 3,\n startPos = this.pos;\n\n this.type = val & 0x7;\n readField(tag, result, this);\n\n if (this.pos === startPos) this.skip(val);\n }\n return result;\n },\n\n readMessage: function(readField, result) {\n return this.readFields(readField, result, this.readVarint() + this.pos);\n },\n\n readFixed32: function() {\n var val = readUInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n readSFixed32: function() {\n var val = readInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)\n\n readFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readSFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readFloat: function() {\n var val = ieee754.read(this.buf, this.pos, true, 23, 4);\n this.pos += 4;\n return val;\n },\n\n readDouble: function() {\n var val = ieee754.read(this.buf, this.pos, true, 52, 8);\n this.pos += 8;\n return val;\n },\n\n readVarint: function(isSigned) {\n var buf = this.buf,\n val, b;\n\n b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;\n b = buf[this.pos]; val |= (b & 0x0f) << 28;\n\n return readVarintRemainder(val, isSigned, this);\n },\n\n readVarint64: function() { // for compatibility with v2.0.1\n return this.readVarint(true);\n },\n\n readSVarint: function() {\n var num = this.readVarint();\n return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding\n },\n\n readBoolean: function() {\n return Boolean(this.readVarint());\n },\n\n readString: function() {\n var end = this.readVarint() + this.pos;\n var pos = this.pos;\n this.pos = end;\n\n if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {\n // longer strings are fast with the built-in browser TextDecoder API\n return readUtf8TextDecoder(this.buf, pos, end);\n }\n // short strings are fast with our custom implementation\n return readUtf8(this.buf, pos, end);\n },\n\n readBytes: function() {\n var end = this.readVarint() + this.pos,\n buffer = this.buf.subarray(this.pos, end);\n this.pos = end;\n return buffer;\n },\n\n // verbose for performance reasons; doesn't affect gzipped size\n\n readPackedVarint: function(arr, isSigned) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned));\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readVarint(isSigned));\n return arr;\n },\n readPackedSVarint: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSVarint());\n return arr;\n },\n readPackedBoolean: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readBoolean());\n return arr;\n },\n readPackedFloat: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFloat());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFloat());\n return arr;\n },\n readPackedDouble: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readDouble());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readDouble());\n return arr;\n },\n readPackedFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed32());\n return arr;\n },\n readPackedSFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed32());\n return arr;\n },\n readPackedFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed64());\n return arr;\n },\n readPackedSFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed64());\n return arr;\n },\n\n skip: function(val) {\n var type = val & 0x7;\n if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}\n else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;\n else if (type === Pbf.Fixed32) this.pos += 4;\n else if (type === Pbf.Fixed64) this.pos += 8;\n else throw new Error('Unimplemented type: ' + type);\n },\n\n // === WRITING =================================================================\n\n writeTag: function(tag, type) {\n this.writeVarint((tag << 3) | type);\n },\n\n realloc: function(min) {\n var length = this.length || 16;\n\n while (length < this.pos + min) length *= 2;\n\n if (length !== this.length) {\n var buf = new Uint8Array(length);\n buf.set(this.buf);\n this.buf = buf;\n this.length = length;\n }\n },\n\n finish: function() {\n this.length = this.pos;\n this.pos = 0;\n return this.buf.subarray(0, this.length);\n },\n\n writeFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeSFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeSFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeVarint: function(val) {\n val = +val || 0;\n\n if (val > 0xfffffff || val < 0) {\n writeBigVarint(val, this);\n return;\n }\n\n this.realloc(4);\n\n this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = (val >>> 7) & 0x7f;\n },\n\n writeSVarint: function(val) {\n this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);\n },\n\n writeBoolean: function(val) {\n this.writeVarint(Boolean(val));\n },\n\n writeString: function(str) {\n str = String(str);\n this.realloc(str.length * 4);\n\n this.pos++; // reserve 1 byte for short string length\n\n var startPos = this.pos;\n // write the string directly to the buffer and see how much was written\n this.pos = writeUtf8(this.buf, str, this.pos);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeFloat: function(val) {\n this.realloc(4);\n ieee754.write(this.buf, val, this.pos, true, 23, 4);\n this.pos += 4;\n },\n\n writeDouble: function(val) {\n this.realloc(8);\n ieee754.write(this.buf, val, this.pos, true, 52, 8);\n this.pos += 8;\n },\n\n writeBytes: function(buffer) {\n var len = buffer.length;\n this.writeVarint(len);\n this.realloc(len);\n for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];\n },\n\n writeRawMessage: function(fn, obj) {\n this.pos++; // reserve 1 byte for short message length\n\n // write the message directly to the buffer and see how much was written\n var startPos = this.pos;\n fn(obj, this);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeMessage: function(tag, fn, obj) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeRawMessage(fn, obj);\n },\n\n writePackedVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr); },\n writePackedSVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr); },\n writePackedBoolean: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr); },\n writePackedFloat: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr); },\n writePackedDouble: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr); },\n writePackedFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr); },\n writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); },\n writePackedFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr); },\n writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); },\n\n writeBytesField: function(tag, buffer) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeBytes(buffer);\n },\n writeFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFixed32(val);\n },\n writeSFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeSFixed32(val);\n },\n writeFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeFixed64(val);\n },\n writeSFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeSFixed64(val);\n },\n writeVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeVarint(val);\n },\n writeSVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeSVarint(val);\n },\n writeStringField: function(tag, str) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeString(str);\n },\n writeFloatField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFloat(val);\n },\n writeDoubleField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeDouble(val);\n },\n writeBooleanField: function(tag, val) {\n this.writeVarintField(tag, Boolean(val));\n }\n};\n\nfunction readVarintRemainder(l, s, p) {\n var buf = p.buf,\n h, b;\n\n b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);\n\n throw new Error('Expected varint not more than 10 bytes');\n}\n\nfunction readPackedEnd(pbf) {\n return pbf.type === Pbf.Bytes ?\n pbf.readVarint() + pbf.pos : pbf.pos + 1;\n}\n\nfunction toNum(low, high, isSigned) {\n if (isSigned) {\n return high * 0x100000000 + (low >>> 0);\n }\n\n return ((high >>> 0) * 0x100000000) + (low >>> 0);\n}\n\nfunction writeBigVarint(val, pbf) {\n var low, high;\n\n if (val >= 0) {\n low = (val % 0x100000000) | 0;\n high = (val / 0x100000000) | 0;\n } else {\n low = ~(-val % 0x100000000);\n high = ~(-val / 0x100000000);\n\n if (low ^ 0xffffffff) {\n low = (low + 1) | 0;\n } else {\n low = 0;\n high = (high + 1) | 0;\n }\n }\n\n if (val >= 0x10000000000000000 || val < -0x10000000000000000) {\n throw new Error('Given varint doesn\\'t fit into 10 bytes');\n }\n\n pbf.realloc(10);\n\n writeBigVarintLow(low, high, pbf);\n writeBigVarintHigh(high, pbf);\n}\n\nfunction writeBigVarintLow(low, high, pbf) {\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos] = low & 0x7f;\n}\n\nfunction writeBigVarintHigh(high, pbf) {\n var lsb = (high & 0x07) << 4;\n\n pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f;\n}\n\nfunction makeRoomForExtraLength(startPos, len, pbf) {\n var extraLen =\n len <= 0x3fff ? 1 :\n len <= 0x1fffff ? 2 :\n len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));\n\n // if 1 byte isn't enough for encoding message length, shift the data to the right\n pbf.realloc(extraLen);\n for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];\n}\n\nfunction writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); }\nfunction writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); }\nfunction writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); }\nfunction writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); }\nfunction writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); }\nfunction writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); }\nfunction writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }\nfunction writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); }\nfunction writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }\n\n// Buffer code below from https://github.com/feross/buffer, MIT-licensed\n\nfunction readUInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] * 0x1000000);\n}\n\nfunction writeInt32(buf, val, pos) {\n buf[pos] = val;\n buf[pos + 1] = (val >>> 8);\n buf[pos + 2] = (val >>> 16);\n buf[pos + 3] = (val >>> 24);\n}\n\nfunction readInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] << 24);\n}\n\nfunction readUtf8(buf, pos, end) {\n var str = '';\n var i = pos;\n\n while (i < end) {\n var b0 = buf[i];\n var c = null; // codepoint\n var bytesPerSequence =\n b0 > 0xEF ? 4 :\n b0 > 0xDF ? 3 :\n b0 > 0xBF ? 2 : 1;\n\n if (i + bytesPerSequence > end) break;\n\n var b1, b2, b3;\n\n if (bytesPerSequence === 1) {\n if (b0 < 0x80) {\n c = b0;\n }\n } else if (bytesPerSequence === 2) {\n b1 = buf[i + 1];\n if ((b1 & 0xC0) === 0x80) {\n c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);\n if (c <= 0x7F) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 3) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);\n if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 4) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n b3 = buf[i + 3];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);\n if (c <= 0xFFFF || c >= 0x110000) {\n c = null;\n }\n }\n }\n\n if (c === null) {\n c = 0xFFFD;\n bytesPerSequence = 1;\n\n } else if (c > 0xFFFF) {\n c -= 0x10000;\n str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);\n c = 0xDC00 | c & 0x3FF;\n }\n\n str += String.fromCharCode(c);\n i += bytesPerSequence;\n }\n\n return str;\n}\n\nfunction readUtf8TextDecoder(buf, pos, end) {\n return utf8TextDecoder.decode(buf.subarray(pos, end));\n}\n\nfunction writeUtf8(buf, str, pos) {\n for (var i = 0, c, lead; i < str.length; i++) {\n c = str.charCodeAt(i); // code point\n\n if (c > 0xD7FF && c < 0xE000) {\n if (lead) {\n if (c < 0xDC00) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = c;\n continue;\n } else {\n c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;\n lead = null;\n }\n } else {\n if (c > 0xDBFF || (i + 1 === str.length)) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n } else {\n lead = c;\n }\n continue;\n }\n } else if (lead) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = null;\n }\n\n if (c < 0x80) {\n buf[pos++] = c;\n } else {\n if (c < 0x800) {\n buf[pos++] = c >> 0x6 | 0xC0;\n } else {\n if (c < 0x10000) {\n buf[pos++] = c >> 0xC | 0xE0;\n } else {\n buf[pos++] = c >> 0x12 | 0xF0;\n buf[pos++] = c >> 0xC & 0x3F | 0x80;\n }\n buf[pos++] = c >> 0x6 & 0x3F | 0x80;\n }\n buf[pos++] = c & 0x3F | 0x80;\n }\n }\n return pos;\n}\n","import * as pako from \"pako\";\nimport Pbf from \"pbf\";\nimport { MapillaryError } from \"../error/MapillaryError\";\nimport { MeshContract } from \"./contracts/MeshContract\";\n\nexport interface XMLHttpRequestHeader {\n name: string,\n value: string,\n}\n\n/**\n * Decompress and parse an array buffer containing zipped\n * json data and return as a json object.\n *\n * @description Handles array buffers continaing zipped json\n * data.\n *\n * @param {ArrayBuffer} buffer - Array buffer to decompress.\n * @returns {Object} Parsed object.\n */\nexport function decompress<T>(buffer: ArrayBuffer): T {\n const inflated: string =\n pako.inflate(<pako.Data>buffer, { to: \"string\" });\n\n return <T>JSON.parse(inflated);\n}\n\n/**\n * Retrieves a resource as an array buffer and returns a promise\n * to the buffer.\n *\n * @description Rejects the promise on request failure.\n *\n * @param {string} url - URL for resource to retrieve.\n * @param {Promise} [abort] - Optional promise for aborting\n * the request through rejection.\n * @returns {Promise<ArrayBuffer>} Promise to the array buffer\n * resource.\n */\nexport function fetchArrayBuffer(\n url: string,\n abort?: Promise<void>): Promise<ArrayBuffer> {\n const method = \"GET\";\n const responseType = \"arraybuffer\";\n return xhrFetch(url, method, responseType, [], null, abort);\n}\n\nexport function xhrFetch(\n url: string,\n method: \"GET\",\n responseType: \"arraybuffer\",\n headers: XMLHttpRequestHeader[],\n body?: string,\n abort?: Promise<void>): Promise<ArrayBuffer>;\nexport function xhrFetch<TResult>(\n url: string,\n method: \"GET\" | \"POST\",\n responseType: \"json\",\n headers: XMLHttpRequestHeader[],\n body?: string,\n abort?: Promise<void>): Promise<TResult>;\nexport function xhrFetch<TResult>(\n url: string,\n method: \"GET\" | \"POST\",\n responseType: \"arraybuffer\" | \"json\",\n headers: XMLHttpRequestHeader[],\n body?: string,\n abort?: Promise<void>): Promise<TResult> {\n\n const xhr = new XMLHttpRequest();\n const promise = new Promise<TResult>(\n (resolve, reject) => {\n xhr.open(method, url, true);\n for (const header of headers) {\n xhr.setRequestHeader(header.name, header.value);\n }\n xhr.responseType = responseType;\n xhr.timeout = 15000;\n\n xhr.onload = () => {\n if (xhr.status !== 200) {\n const error = xhr.response ??\n new MapillaryError(`Response status error: ${url}`);\n reject(error);\n }\n\n if (!xhr.response) {\n reject(new MapillaryError(`Response empty: ${url}`));\n }\n\n resolve(xhr.response);\n };\n\n xhr.onerror = () => {\n reject(new MapillaryError(`Request error: ${url}`));\n };\n xhr.ontimeout = () => {\n reject(new MapillaryError(`Request timeout: ${url}`));\n };\n xhr.onabort = () => {\n reject(new MapillaryError(`Request aborted: ${url}`));\n };\n xhr.send(method === \"POST\" ? body : null);\n });\n\n if (!!abort) { abort.catch((): void => { xhr.abort(); }); }\n\n return promise;\n}\n\n/**\n * Read the fields of a protobuf array buffer into a mesh\n * object.\n *\n * @param {ArrayBuffer} buffer - Protobuf array buffer\n * to read from.\n * @returns {MeshContract} Mesh object.\n */\nexport function readMeshPbf(buffer: ArrayBuffer): MeshContract {\n const pbf = new Pbf(buffer);\n const mesh: MeshContract = { faces: [], vertices: [] };\n return pbf.readFields(readMeshPbfField, mesh);\n}\n\nfunction readMeshPbfField(tag: number, mesh: MeshContract, pbf: Pbf): void {\n if (tag === 1) { mesh.vertices.push(pbf.readFloat()); }\n else if (tag === 2) { mesh.faces.push(pbf.readVarint()); }\n else { console.warn(`Unsupported pbf tag (${tag})`); }\n}\n","import { MapillaryError } from \"../error/MapillaryError\";\nimport { EventEmitter } from \"../util/EventEmitter\";\nimport { ClusterContract }\n from \"./contracts/ClusterContract\";\nimport { MeshContract } from \"./contracts/MeshContract\";\nimport { CoreImagesContract } from \"./contracts/CoreImagesContract\";\nimport { SpatialImagesContract } from \"./contracts/SpatialImagesContract\";\nimport { ImagesContract } from \"./contracts/ImagesContract\";\nimport { SequenceContract } from \"./contracts/SequenceContract\";\nimport { ImageTilesContract } from \"./contracts/ImageTilesContract\";\nimport { ImageTilesRequestContract }\n from \"./contracts/ImageTilesRequestContract\";\nimport { ProviderEventType } from \"./events/ProviderEventType\";\nimport { ProviderEvent } from \"./events/ProviderEvent\";\nimport { ProviderCellEvent } from \"./events/ProviderCellEvent\";\nimport { IDataProvider } from \"./interfaces/IDataProvider\";\nimport { IGeometryProvider } from \"./interfaces/IGeometryProvider\";\n\n/**\n * @class DataProviderBase\n *\n * @classdesc Base class to extend if implementing a data provider\n * class.\n *\n * @fires datacreate\n *\n * @example\n * ```js\n * class MyDataProvider extends DataProviderBase {\n * constructor() {\n * super(new S2GeometryProvider());\n * }\n * ...\n * }\n * ```\n */\nexport abstract class DataProviderBase extends EventEmitter implements IDataProvider {\n /**\n * Create a new data provider base instance.\n *\n * @param {IGeometryProvider} geometry - Geometry\n * provider instance.\n */\n constructor(protected _geometry: IGeometryProvider) {\n super();\n }\n\n /**\n * Get geometry property.\n *\n * @returns {IGeometryProvider} Geometry provider instance.\n */\n public get geometry(): IGeometryProvider {\n return this._geometry;\n }\n\n /**\n * Fire when data has been created in the data provider\n * after initial load.\n *\n * @param type datacreate\n * @param event Provider cell event\n *\n * @example\n * ```js\n * // Initialize the data provider\n * class MyDataProvider extends DataProviderBase {\n * // Class implementation\n * }\n * var provider = new MyDataProvider();\n * // Create the event\n * var cellIds = [ // Determine updated cells ];\n * var target = provider;\n * var type = \"datacreate\";\n * var event = {\n * cellIds,\n * target,\n * type,\n * };\n * // Fire the event\n * provider.fire(type, event);\n * ```\n */\n public fire(\n type: \"datacreate\",\n event: ProviderCellEvent)\n : void;\n /** @ignore */\n public fire(\n type: ProviderEventType,\n event: ProviderEvent)\n : void;\n public fire<T>(\n type: ProviderEventType,\n event: T)\n : void {\n super.fire(type, event);\n }\n\n /**\n * Get core images in a geometry cell.\n *\n * @param {string} cellId - The id of the geometry cell.\n * @returns {Promise<CoreImagesContract>} Promise to\n * the core images of the requested geometry cell id.\n * @throws Rejects the promise on errors.\n */\n public getCoreImages(\n cellId: string): Promise<CoreImagesContract> {\n return Promise.reject(new MapillaryError(\"Not implemented\"));\n }\n\n /**\n * Get a cluster reconstruction.\n *\n * @param {string} url - URL for the cluster reconstruction\n * to retrieve.\n * @param {Promise} [abort] - Optional promise for aborting\n * the request through rejection.\n * @returns {Promise<ClusterContract>} Promise to the\n * cluster reconstruction.\n * @throws Rejects the promise on errors.\n */\n public getCluster(\n url: string,\n abort?: Promise<void>): Promise<ClusterContract> {\n return Promise.reject(new MapillaryError(\"Not implemented\"));\n }\n\n /**\n * Get spatial images.\n *\n * @param {Array<string>} imageIds - The ids for the\n * images to retrieve.\n * @returns {Promise<SpatialImagesContract>} Promise to\n * the spatial images of the requested image ids.\n * @throws Rejects the promise on errors.\n */\n public getSpatialImages(\n imageIds: string[]): Promise<SpatialImagesContract> {\n return Promise.reject(new MapillaryError(\"Not implemented\"));\n }\n\n /**\n * Get complete images.\n *\n * @param {Array<string>} imageIds - The ids for the\n * images to retrieve.\n * @returns {Promise<ImagesContract>} Promise to the images of the\n * requested image ids.\n * @throws Rejects the promise on errors.\n */\n public getImages(\n imageIds: string[]): Promise<ImagesContract> {\n return Promise.reject(new MapillaryError(\"Not implemented\"));\n }\n\n /**\n * Get an image as an array buffer.\n *\n * @param {string} url - URL for image to retrieve.\n * @param {Promise<void>} [abort] - Optional promise for aborting\n * the request through rejection.\n * @returns {Promise<ArrayBuffer>} Promise to the array\n * buffer containing the image.\n * @throws Rejects the promise on errors.\n */\n public getImageBuffer(\n url: string,\n abort?: Promise<void>): Promise<ArrayBuffer> {\n return Promise.reject(new MapillaryError(\"Not implemented\"));\n }\n\n /**\n * Get image tiles urls for a tile level.\n *\n * @param {ImageTilesRequestContract} tiles - Tiles to request\n * @returns {Promise<ImageTilesContract>} Promise to the\n * image tiles response contract\n *\n * @throws Rejects the promise on errors.\n *\n * @example\n * ```js\n * var tileRequest = { imageId: 'image-id', z: 12 };\n * provider.getImageTiles(tileRequest)\n * .then((response) => console.log(response));\n * ```\n */\n public getImageTiles(\n tiles: ImageTilesRequestContract): Promise<ImageTilesContract> {\n return Promise.reject(new MapillaryError(\"Not implemented\"));\n }\n\n /**\n * Get a mesh.\n *\n * @param {string} url - URL for mesh to retrieve.\n * @param {Promise<void>} [abort] - Optional promise for aborting\n * the request through rejection.\n * @returns {Promise<MeshContract>} Promise to the mesh.\n * @throws Rejects the promise on errors.\n */\n public getMesh(\n url: string,\n abort?: Promise<void>): Promise<MeshContract> {\n return Promise.reject(new MapillaryError(\"Not implemented\"));\n }\n\n /**\n * Get sequence.\n *\n * @param {Array<string>} sequenceId - The id for the\n * sequence to retrieve.\n * @returns {Promise} Promise to the sequences of the\n * requested image ids.\n * @throws Rejects the promise on errors.\n */\n public getSequence(\n sequenceId: string): Promise<SequenceContract> {\n return Promise.reject(new MapillaryError(\"Not implemented\"));\n }\n\n public off(\n type: ProviderCellEvent[\"type\"],\n handler: (event: ProviderCellEvent) => void)\n : void;\n /** @ignore */\n public off(\n type: ProviderEventType,\n handler: (event: ProviderEvent) => void)\n : void;\n public off<T>(\n type: ProviderEventType,\n handler: (event: T) => void)\n : void {\n super.off(type, handler);\n }\n\n /**\n * Fired when data has been created in the data provider\n * after initial load.\n *\n * @event datacreate\n * @example\n * ```js\n * // Initialize the data provider\n * class MyDataProvider extends DataProviderBase {\n * // implementation\n * }\n * var provider = new MyDataProvider();\n * // Set an event listener\n * provider.on(\"datacreate\", function() {\n * console.log(\"A datacreate event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"datacreate\",\n handler: (event: ProviderCellEvent) => void)\n : void;\n /** @ignore */\n public on(\n type: ProviderEventType,\n handler: (event: ProviderEvent) => void)\n : void;\n public on<T>(\n type: ProviderEventType,\n handler: (event: T) => void)\n : void {\n super.on(type, handler);\n }\n\n /**\n * Set an access token for authenticated API requests of\n * protected resources.\n *\n * @param {string} [accessToken] accessToken - User access\n * token or client access token.\n */\n public setAccessToken(accessToken?: string): void {\n throw new MapillaryError(\"Not implemented\");\n }\n}\n","import { MapillaryError } from \"../error/MapillaryError\";\nimport {\n enuToGeodetic,\n geodeticToEnu,\n} from \"../geo/GeoCoords\";\nimport { IGeometryProvider } from \"./interfaces/IGeometryProvider\";\nimport { LngLat } from \"./interfaces/LngLat\";\n\n/**\n * @class GeometryProviderBase\n *\n * @classdesc Base class to extend if implementing a geometry\n * provider class.\n *\n * @example\n * ```js\n * class MyGeometryProvider extends GeometryProviderBase {\n * ...\n * }\n * ```\n */\nexport abstract class GeometryProviderBase implements IGeometryProvider {\n /**\n * Create a new geometry provider base instance.\n */\n constructor() { /** noop */ }\n\n /**\n * Convert a geodetic bounding box to the the minimum set\n * of cell ids containing the bounding box.\n *\n * @description The bounding box needs\n * to be sufficiently small to be contained in an area with the size\n * of maximally four tiles. Up to nine adjacent tiles may be returned.\n *\n * @param {LngLat} sw - South west corner of bounding box.\n * @param {LngLat} ne - North east corner of bounding box.\n *\n * @returns {Array<string>} Array of cell ids.\n */\n public bboxToCellIds(sw: LngLat, ne: LngLat): string[] {\n throw new MapillaryError(\"Not implemented\");\n }\n\n /**\n * Get the cell ids of all adjacent cells.\n *\n * @description In the case of approximately rectangular cells\n * this is typically the eight orthogonally and diagonally adjacent\n * cells.\n *\n * @param {string} cellId - Id of cell.\n * @returns {Array<string>} Array of cell ids. No specific\n * order is guaranteed.\n */\n public getAdjacent(cellId: string): string[] {\n throw new MapillaryError(\"Not implemented\");\n }\n\n /**\n * Get the vertices of a cell.\n *\n * @description The vertices form an unclosed\n * clockwise polygon in the 2D longitude, latitude\n * space. No assumption on the position of the first\n * vertex relative to the others can be made.\n *\n * @param {string} cellId - Id of cell.\n * @returns {Array<LngLat>} Unclosed clockwise polygon.\n */\n public getVertices(cellId: string): LngLat[] {\n throw new MapillaryError(\"Not implemented\");\n }\n\n /**\n * Convert geodetic coordinates to a cell id.\n *\n * @param {LngLat} lngLat - Longitude, latitude to convert.\n * @returns {string} Cell id for the longitude, latitude.\n */\n public lngLatToCellId(lngLat: LngLat): string {\n throw new MapillaryError(\"Not implemented\");\n }\n\n /** @ignore */\n protected _approxBboxToCellIds(sw: LngLat, ne: LngLat): string[] {\n if (ne.lat <= sw.lat || ne.lng <= sw.lng) {\n throw new MapillaryError(\n \"North east needs to be top right of south west\");\n }\n\n const centerLat = (sw.lat + ne.lat) / 2;\n const centerLng = (sw.lng + ne.lng) / 2;\n\n const enu =\n geodeticToEnu(\n ne.lng,\n ne.lat,\n 0,\n centerLng,\n centerLat,\n 0);\n\n const threshold = Math.max(enu[0], enu[1]);\n\n return this._lngLatToCellIds(\n { lat: centerLat, lng: centerLng },\n threshold);\n }\n\n /** @ignore */\n private _enuToGeodetic(point: number[], reference: LngLat): LngLat {\n const [lng, lat] = enuToGeodetic(\n point[0],\n point[1],\n point[2],\n reference.lng,\n reference.lat,\n 0);\n\n return { lat, lng };\n }\n\n /** @ignore */\n private _getLngLatBoundingBoxCorners(\n lngLat: LngLat,\n threshold: number)\n : LngLat[] {\n\n return [\n [-threshold, threshold, 0],\n [threshold, threshold, 0],\n [threshold, -threshold, 0],\n [-threshold, -threshold, 0],\n ].map(\n (point: number[]): LngLat => {\n return this._enuToGeodetic(point, lngLat);\n });\n }\n\n\n /**\n * Convert a geodetic square to cell ids.\n *\n * The square is specified as a longitude, latitude\n * and a threshold from the position using Manhattan distance.\n *\n * @param {LngLat} lngLat - Longitude, latitude.\n * @param {number} threshold - Threshold of the conversion in meters.\n *\n * @returns {Array<string>} Array of cell ids reachable within\n * the threshold.\n *\n * @ignore\n */\n private _lngLatToCellIds(\n lngLat: LngLat,\n threshold: number)\n : string[] {\n const cellId = this.lngLatToCellId(lngLat);\n const bboxCorners =\n this._getLngLatBoundingBoxCorners(lngLat, threshold);\n for (const corner of bboxCorners) {\n const cid = this.lngLatToCellId(corner);\n if (cid !== cellId) {\n return [cellId, ...this.getAdjacent(cellId)];\n }\n }\n return [cellId];\n }\n}\n","/*\r\n Copyright 2013 Daniel Wirtz <dcode@dcode.io>\r\n Copyright 2009 The Closure Library Authors. All Rights Reserved.\r\n\r\n Licensed under the Apache License, Version 2.0 (the \"License\");\r\n you may not use this file except in compliance with the License.\r\n You may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n Unless required by applicable law or agreed to in writing, software\r\n distributed under the License is distributed on an \"AS-IS\" BASIS,\r\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n See the License for the specific language governing permissions and\r\n limitations under the License.\r\n */\r\n\r\n/**\r\n * @license long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>\r\n * Released under the Apache License, Version 2.0\r\n * see: https://github.com/dcodeIO/long.js for details\r\n */\r\n(function(global, factory) {\r\n\r\n /* AMD */ if (typeof define === 'function' && define[\"amd\"])\r\n define([], factory);\r\n /* CommonJS */ else if (typeof require === 'function' && typeof module === \"object\" && module && module[\"exports\"])\r\n module[\"exports\"] = factory();\r\n /* Global */ else\r\n (global[\"dcodeIO\"] = global[\"dcodeIO\"] || {})[\"Long\"] = factory();\r\n\r\n})(this, function() {\r\n \"use strict\";\r\n\r\n /**\r\n * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.\r\n * See the from* functions below for more convenient ways of constructing Longs.\r\n * @exports Long\r\n * @class A Long class for representing a 64 bit two's-complement integer value.\r\n * @param {number} low The low (signed) 32 bits of the long\r\n * @param {number} high The high (signed) 32 bits of the long\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed\r\n * @constructor\r\n */\r\n function Long(low, high, unsigned) {\r\n\r\n /**\r\n * The low 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.low = low | 0;\r\n\r\n /**\r\n * The high 32 bits as a signed value.\r\n * @type {number}\r\n */\r\n this.high = high | 0;\r\n\r\n /**\r\n * Whether unsigned or not.\r\n * @type {boolean}\r\n */\r\n this.unsigned = !!unsigned;\r\n }\r\n\r\n // The internal representation of a long is the two given signed, 32-bit values.\r\n // We use 32-bit pieces because these are the size of integers on which\r\n // Javascript performs bit-operations. For operations like addition and\r\n // multiplication, we split each number into 16 bit pieces, which can easily be\r\n // multiplied within Javascript's floating-point representation without overflow\r\n // or change in sign.\r\n //\r\n // In the algorithms below, we frequently reduce the negative case to the\r\n // positive case by negating the input(s) and then post-processing the result.\r\n // Note that we must ALWAYS check specially whether those values are MIN_VALUE\r\n // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\r\n // a positive number, it overflows back into a negative). Not handling this\r\n // case would often result in infinite recursion.\r\n //\r\n // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*\r\n // methods on which they depend.\r\n\r\n /**\r\n * An indicator used to reliably determine if an object is a Long or not.\r\n * @type {boolean}\r\n * @const\r\n * @private\r\n */\r\n Long.prototype.__isLong__;\r\n\r\n Object.defineProperty(Long.prototype, \"__isLong__\", {\r\n value: true,\r\n enumerable: false,\r\n configurable: false\r\n });\r\n\r\n /**\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n * @inner\r\n */\r\n function isLong(obj) {\r\n return (obj && obj[\"__isLong__\"]) === true;\r\n }\r\n\r\n /**\r\n * Tests if the specified object is a Long.\r\n * @function\r\n * @param {*} obj Object\r\n * @returns {boolean}\r\n */\r\n Long.isLong = isLong;\r\n\r\n /**\r\n * A cache of the Long representations of small integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\n var INT_CACHE = {};\r\n\r\n /**\r\n * A cache of the Long representations of small unsigned integer values.\r\n * @type {!Object}\r\n * @inner\r\n */\r\n var UINT_CACHE = {};\r\n\r\n /**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\n function fromInt(value, unsigned) {\r\n var obj, cachedObj, cache;\r\n if (unsigned) {\r\n value >>>= 0;\r\n if (cache = (0 <= value && value < 256)) {\r\n cachedObj = UINT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);\r\n if (cache)\r\n UINT_CACHE[value] = obj;\r\n return obj;\r\n } else {\r\n value |= 0;\r\n if (cache = (-128 <= value && value < 128)) {\r\n cachedObj = INT_CACHE[value];\r\n if (cachedObj)\r\n return cachedObj;\r\n }\r\n obj = fromBits(value, value < 0 ? -1 : 0, false);\r\n if (cache)\r\n INT_CACHE[value] = obj;\r\n return obj;\r\n }\r\n }\r\n\r\n /**\r\n * Returns a Long representing the given 32 bit integer value.\r\n * @function\r\n * @param {number} value The 32 bit integer in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\n Long.fromInt = fromInt;\r\n\r\n /**\r\n * @param {number} value\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\n function fromNumber(value, unsigned) {\r\n if (isNaN(value) || !isFinite(value))\r\n return unsigned ? UZERO : ZERO;\r\n if (unsigned) {\r\n if (value < 0)\r\n return UZERO;\r\n if (value >= TWO_PWR_64_DBL)\r\n return MAX_UNSIGNED_VALUE;\r\n } else {\r\n if (value <= -TWO_PWR_63_DBL)\r\n return MIN_VALUE;\r\n if (value + 1 >= TWO_PWR_63_DBL)\r\n return MAX_VALUE;\r\n }\r\n if (value < 0)\r\n return fromNumber(-value, unsigned).neg();\r\n return fromBits((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);\r\n }\r\n\r\n /**\r\n * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.\r\n * @function\r\n * @param {number} value The number in question\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\n Long.fromNumber = fromNumber;\r\n\r\n /**\r\n * @param {number} lowBits\r\n * @param {number} highBits\r\n * @param {boolean=} unsigned\r\n * @returns {!Long}\r\n * @inner\r\n */\r\n function fromBits(lowBits, highBits, unsigned) {\r\n return new Long(lowBits, highBits, unsigned);\r\n }\r\n\r\n /**\r\n * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is\r\n * assumed to use 32 bits.\r\n * @function\r\n * @param {number} lowBits The low 32 bits\r\n * @param {number} highBits The high 32 bits\r\n * @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed\r\n * @returns {!Long} The corresponding Long value\r\n */\r\n Long.fromBits = fromBits;\r\n\r\n /**\r\n * @function\r\n * @param {number} base\r\n * @param {number} exponent\r\n * @returns {number}\r\n * @inner\r\n */\r\n var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)\r\n\r\n /**\r\n * @param {string} str\r\n * @param {(boolean|number)=} unsigned\r\n * @param {number=} radix\r\n * @returns {!Long}\r\n * @inner\r\n */\r\n function fromString(str, unsigned, radix) {\r\n if (str.length === 0)\r\n throw Error('empty string');\r\n if (str === \"NaN\" || str === \"Infinity\" || str === \"+Infinity\" || str === \"-Infinity\")\r\n return ZERO;\r\n if (typeof unsigned === 'number') {\r\n // For goog.math.long compatibility\r\n radix = unsigned,\r\n unsigned = false;\r\n } else {\r\n unsigned = !! unsigned;\r\n }\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n\r\n var p;\r\n if ((p = str.indexOf('-')) > 0)\r\n throw Error('interior hyphen');\r\n else if (p === 0) {\r\n return fromString(str.substring(1), unsigned, radix).neg();\r\n }\r\n\r\n // Do several (8) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 8));\r\n\r\n var result = ZERO;\r\n for (var i = 0; i < str.length; i += 8) {\r\n var size = Math.min(8, str.length - i),\r\n value = parseInt(str.substring(i, i + size), radix);\r\n if (size < 8) {\r\n var power = fromNumber(pow_dbl(radix, size));\r\n result = result.mul(power).add(fromNumber(value));\r\n } else {\r\n result = result.mul(radixToPower);\r\n result = result.add(fromNumber(value));\r\n }\r\n }\r\n result.unsigned = unsigned;\r\n return result;\r\n }\r\n\r\n /**\r\n * Returns a Long representation of the given string, written using the specified radix.\r\n * @function\r\n * @param {string} str The textual representation of the Long\r\n * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed\r\n * @param {number=} radix The radix in which the text is written (2-36), defaults to 10\r\n * @returns {!Long} The corresponding Long value\r\n */\r\n Long.fromString = fromString;\r\n\r\n /**\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val\r\n * @returns {!Long}\r\n * @inner\r\n */\r\n function fromValue(val) {\r\n if (val /* is compatible */ instanceof Long)\r\n return val;\r\n if (typeof val === 'number')\r\n return fromNumber(val);\r\n if (typeof val === 'string')\r\n return fromString(val);\r\n // Throws for non-objects, converts non-instanceof Long:\r\n return fromBits(val.low, val.high, val.unsigned);\r\n }\r\n\r\n /**\r\n * Converts the specified value to a Long.\r\n * @function\r\n * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value\r\n * @returns {!Long}\r\n */\r\n Long.fromValue = fromValue;\r\n\r\n // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be\r\n // no runtime penalty for these.\r\n\r\n /**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\n var TWO_PWR_16_DBL = 1 << 16;\r\n\r\n /**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\n var TWO_PWR_24_DBL = 1 << 24;\r\n\r\n /**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\n var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;\r\n\r\n /**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\n var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;\r\n\r\n /**\r\n * @type {number}\r\n * @const\r\n * @inner\r\n */\r\n var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;\r\n\r\n /**\r\n * @type {!Long}\r\n * @const\r\n * @inner\r\n */\r\n var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);\r\n\r\n /**\r\n * @type {!Long}\r\n * @inner\r\n */\r\n var ZERO = fromInt(0);\r\n\r\n /**\r\n * Signed zero.\r\n * @type {!Long}\r\n */\r\n Long.ZERO = ZERO;\r\n\r\n /**\r\n * @type {!Long}\r\n * @inner\r\n */\r\n var UZERO = fromInt(0, true);\r\n\r\n /**\r\n * Unsigned zero.\r\n * @type {!Long}\r\n */\r\n Long.UZERO = UZERO;\r\n\r\n /**\r\n * @type {!Long}\r\n * @inner\r\n */\r\n var ONE = fromInt(1);\r\n\r\n /**\r\n * Signed one.\r\n * @type {!Long}\r\n */\r\n Long.ONE = ONE;\r\n\r\n /**\r\n * @type {!Long}\r\n * @inner\r\n */\r\n var UONE = fromInt(1, true);\r\n\r\n /**\r\n * Unsigned one.\r\n * @type {!Long}\r\n */\r\n Long.UONE = UONE;\r\n\r\n /**\r\n * @type {!Long}\r\n * @inner\r\n */\r\n var NEG_ONE = fromInt(-1);\r\n\r\n /**\r\n * Signed negative one.\r\n * @type {!Long}\r\n */\r\n Long.NEG_ONE = NEG_ONE;\r\n\r\n /**\r\n * @type {!Long}\r\n * @inner\r\n */\r\n var MAX_VALUE = fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);\r\n\r\n /**\r\n * Maximum signed value.\r\n * @type {!Long}\r\n */\r\n Long.MAX_VALUE = MAX_VALUE;\r\n\r\n /**\r\n * @type {!Long}\r\n * @inner\r\n */\r\n var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);\r\n\r\n /**\r\n * Maximum unsigned value.\r\n * @type {!Long}\r\n */\r\n Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;\r\n\r\n /**\r\n * @type {!Long}\r\n * @inner\r\n */\r\n var MIN_VALUE = fromBits(0, 0x80000000|0, false);\r\n\r\n /**\r\n * Minimum signed value.\r\n * @type {!Long}\r\n */\r\n Long.MIN_VALUE = MIN_VALUE;\r\n\r\n /**\r\n * @alias Long.prototype\r\n * @inner\r\n */\r\n var LongPrototype = Long.prototype;\r\n\r\n /**\r\n * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.\r\n * @returns {number}\r\n */\r\n LongPrototype.toInt = function toInt() {\r\n return this.unsigned ? this.low >>> 0 : this.low;\r\n };\r\n\r\n /**\r\n * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).\r\n * @returns {number}\r\n */\r\n LongPrototype.toNumber = function toNumber() {\r\n if (this.unsigned)\r\n return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);\r\n return this.high * TWO_PWR_32_DBL + (this.low >>> 0);\r\n };\r\n\r\n /**\r\n * Converts the Long to a string written in the specified radix.\r\n * @param {number=} radix Radix (2-36), defaults to 10\r\n * @returns {string}\r\n * @override\r\n * @throws {RangeError} If `radix` is out of range\r\n */\r\n LongPrototype.toString = function toString(radix) {\r\n radix = radix || 10;\r\n if (radix < 2 || 36 < radix)\r\n throw RangeError('radix');\r\n if (this.isZero())\r\n return '0';\r\n if (this.isNegative()) { // Unsigned Longs are never negative\r\n if (this.eq(MIN_VALUE)) {\r\n // We need to change the Long value before it can be negated, so we remove\r\n // the bottom-most digit in this base and then recurse to do the rest.\r\n var radixLong = fromNumber(radix),\r\n div = this.div(radixLong),\r\n rem1 = div.mul(radixLong).sub(this);\r\n return div.toString(radix) + rem1.toInt().toString(radix);\r\n } else\r\n return '-' + this.neg().toString(radix);\r\n }\r\n\r\n // Do several (6) digits each time through the loop, so as to\r\n // minimize the calls to the very expensive emulated div.\r\n var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),\r\n rem = this;\r\n var result = '';\r\n while (true) {\r\n var remDiv = rem.div(radixToPower),\r\n intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,\r\n digits = intval.toString(radix);\r\n rem = remDiv;\r\n if (rem.isZero())\r\n return digits + result;\r\n else {\r\n while (digits.length < 6)\r\n digits = '0' + digits;\r\n result = '' + digits + result;\r\n }\r\n }\r\n };\r\n\r\n /**\r\n * Gets the high 32 bits as a signed integer.\r\n * @returns {number} Signed high bits\r\n */\r\n LongPrototype.getHighBits = function getHighBits() {\r\n return this.high;\r\n };\r\n\r\n /**\r\n * Gets the high 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned high bits\r\n */\r\n LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {\r\n return this.high >>> 0;\r\n };\r\n\r\n /**\r\n * Gets the low 32 bits as a signed integer.\r\n * @returns {number} Signed low bits\r\n */\r\n LongPrototype.getLowBits = function getLowBits() {\r\n return this.low;\r\n };\r\n\r\n /**\r\n * Gets the low 32 bits as an unsigned integer.\r\n * @returns {number} Unsigned low bits\r\n */\r\n LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {\r\n return this.low >>> 0;\r\n };\r\n\r\n /**\r\n * Gets the number of bits needed to represent the absolute value of this Long.\r\n * @returns {number}\r\n */\r\n LongPrototype.getNumBitsAbs = function getNumBitsAbs() {\r\n if (this.isNegative()) // Unsigned Longs are never negative\r\n return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();\r\n var val = this.high != 0 ? this.high : this.low;\r\n for (var bit = 31; bit > 0; bit--)\r\n if ((val & (1 << bit)) != 0)\r\n break;\r\n return this.high != 0 ? bit + 33 : bit + 1;\r\n };\r\n\r\n /**\r\n * Tests if this Long's value equals zero.\r\n * @returns {boolean}\r\n */\r\n LongPrototype.isZero = function isZero() {\r\n return this.high === 0 && this.low === 0;\r\n };\r\n\r\n /**\r\n * Tests if this Long's value is negative.\r\n * @returns {boolean}\r\n */\r\n LongPrototype.isNegative = function isNegative() {\r\n return !this.unsigned && this.high < 0;\r\n };\r\n\r\n /**\r\n * Tests if this Long's value is positive.\r\n * @returns {boolean}\r\n */\r\n LongPrototype.isPositive = function isPositive() {\r\n return this.unsigned || this.high >= 0;\r\n };\r\n\r\n /**\r\n * Tests if this Long's value is odd.\r\n * @returns {boolean}\r\n */\r\n LongPrototype.isOdd = function isOdd() {\r\n return (this.low & 1) === 1;\r\n };\r\n\r\n /**\r\n * Tests if this Long's value is even.\r\n * @returns {boolean}\r\n */\r\n LongPrototype.isEven = function isEven() {\r\n return (this.low & 1) === 0;\r\n };\r\n\r\n /**\r\n * Tests if this Long's value equals the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\n LongPrototype.equals = function equals(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)\r\n return false;\r\n return this.high === other.high && this.low === other.low;\r\n };\r\n\r\n /**\r\n * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\n LongPrototype.eq = LongPrototype.equals;\r\n\r\n /**\r\n * Tests if this Long's value differs from the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\n LongPrototype.notEquals = function notEquals(other) {\r\n return !this.eq(/* validates */ other);\r\n };\r\n\r\n /**\r\n * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\n LongPrototype.neq = LongPrototype.notEquals;\r\n\r\n /**\r\n * Tests if this Long's value is less than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\n LongPrototype.lessThan = function lessThan(other) {\r\n return this.comp(/* validates */ other) < 0;\r\n };\r\n\r\n /**\r\n * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\n LongPrototype.lt = LongPrototype.lessThan;\r\n\r\n /**\r\n * Tests if this Long's value is less than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\n LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {\r\n return this.comp(/* validates */ other) <= 0;\r\n };\r\n\r\n /**\r\n * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\n LongPrototype.lte = LongPrototype.lessThanOrEqual;\r\n\r\n /**\r\n * Tests if this Long's value is greater than the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\n LongPrototype.greaterThan = function greaterThan(other) {\r\n return this.comp(/* validates */ other) > 0;\r\n };\r\n\r\n /**\r\n * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\n LongPrototype.gt = LongPrototype.greaterThan;\r\n\r\n /**\r\n * Tests if this Long's value is greater than or equal the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\n LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {\r\n return this.comp(/* validates */ other) >= 0;\r\n };\r\n\r\n /**\r\n * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {boolean}\r\n */\r\n LongPrototype.gte = LongPrototype.greaterThanOrEqual;\r\n\r\n /**\r\n * Compares this Long's value with the specified's.\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\n LongPrototype.compare = function compare(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n if (this.eq(other))\r\n return 0;\r\n var thisNeg = this.isNegative(),\r\n otherNeg = other.isNegative();\r\n if (thisNeg && !otherNeg)\r\n return -1;\r\n if (!thisNeg && otherNeg)\r\n return 1;\r\n // At this point the sign bits are the same\r\n if (!this.unsigned)\r\n return this.sub(other).isNegative() ? -1 : 1;\r\n // Both are positive if at least one is unsigned\r\n return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;\r\n };\r\n\r\n /**\r\n * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.\r\n * @function\r\n * @param {!Long|number|string} other Other value\r\n * @returns {number} 0 if they are the same, 1 if the this is greater and -1\r\n * if the given one is greater\r\n */\r\n LongPrototype.comp = LongPrototype.compare;\r\n\r\n /**\r\n * Negates this Long's value.\r\n * @returns {!Long} Negated Long\r\n */\r\n LongPrototype.negate = function negate() {\r\n if (!this.unsigned && this.eq(MIN_VALUE))\r\n return MIN_VALUE;\r\n return this.not().add(ONE);\r\n };\r\n\r\n /**\r\n * Negates this Long's value. This is an alias of {@link Long#negate}.\r\n * @function\r\n * @returns {!Long} Negated Long\r\n */\r\n LongPrototype.neg = LongPrototype.negate;\r\n\r\n /**\r\n * Returns the sum of this and the specified Long.\r\n * @param {!Long|number|string} addend Addend\r\n * @returns {!Long} Sum\r\n */\r\n LongPrototype.add = function add(addend) {\r\n if (!isLong(addend))\r\n addend = fromValue(addend);\r\n\r\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = addend.high >>> 16;\r\n var b32 = addend.high & 0xFFFF;\r\n var b16 = addend.low >>> 16;\r\n var b00 = addend.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 + b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 + b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 + b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 + b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n };\r\n\r\n /**\r\n * Returns the difference of this and the specified Long.\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\n LongPrototype.subtract = function subtract(subtrahend) {\r\n if (!isLong(subtrahend))\r\n subtrahend = fromValue(subtrahend);\r\n return this.add(subtrahend.neg());\r\n };\r\n\r\n /**\r\n * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.\r\n * @function\r\n * @param {!Long|number|string} subtrahend Subtrahend\r\n * @returns {!Long} Difference\r\n */\r\n LongPrototype.sub = LongPrototype.subtract;\r\n\r\n /**\r\n * Returns the product of this and the specified Long.\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\n LongPrototype.multiply = function multiply(multiplier) {\r\n if (this.isZero())\r\n return ZERO;\r\n if (!isLong(multiplier))\r\n multiplier = fromValue(multiplier);\r\n if (multiplier.isZero())\r\n return ZERO;\r\n if (this.eq(MIN_VALUE))\r\n return multiplier.isOdd() ? MIN_VALUE : ZERO;\r\n if (multiplier.eq(MIN_VALUE))\r\n return this.isOdd() ? MIN_VALUE : ZERO;\r\n\r\n if (this.isNegative()) {\r\n if (multiplier.isNegative())\r\n return this.neg().mul(multiplier.neg());\r\n else\r\n return this.neg().mul(multiplier).neg();\r\n } else if (multiplier.isNegative())\r\n return this.mul(multiplier.neg()).neg();\r\n\r\n // If both longs are small, use float multiplication\r\n if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))\r\n return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);\r\n\r\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\r\n // We can skip products that would overflow.\r\n\r\n var a48 = this.high >>> 16;\r\n var a32 = this.high & 0xFFFF;\r\n var a16 = this.low >>> 16;\r\n var a00 = this.low & 0xFFFF;\r\n\r\n var b48 = multiplier.high >>> 16;\r\n var b32 = multiplier.high & 0xFFFF;\r\n var b16 = multiplier.low >>> 16;\r\n var b00 = multiplier.low & 0xFFFF;\r\n\r\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\r\n c00 += a00 * b00;\r\n c16 += c00 >>> 16;\r\n c00 &= 0xFFFF;\r\n c16 += a16 * b00;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c16 += a00 * b16;\r\n c32 += c16 >>> 16;\r\n c16 &= 0xFFFF;\r\n c32 += a32 * b00;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a16 * b16;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c32 += a00 * b32;\r\n c48 += c32 >>> 16;\r\n c32 &= 0xFFFF;\r\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\r\n c48 &= 0xFFFF;\r\n return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);\r\n };\r\n\r\n /**\r\n * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.\r\n * @function\r\n * @param {!Long|number|string} multiplier Multiplier\r\n * @returns {!Long} Product\r\n */\r\n LongPrototype.mul = LongPrototype.multiply;\r\n\r\n /**\r\n * Returns this Long divided by the specified. The result is signed if this Long is signed or\r\n * unsigned if this Long is unsigned.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\n LongPrototype.divide = function divide(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n if (divisor.isZero())\r\n throw Error('division by zero');\r\n if (this.isZero())\r\n return this.unsigned ? UZERO : ZERO;\r\n var approx, rem, res;\r\n if (!this.unsigned) {\r\n // This section is only relevant for signed longs and is derived from the\r\n // closure library as a whole.\r\n if (this.eq(MIN_VALUE)) {\r\n if (divisor.eq(ONE) || divisor.eq(NEG_ONE))\r\n return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\r\n else if (divisor.eq(MIN_VALUE))\r\n return ONE;\r\n else {\r\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\r\n var halfThis = this.shr(1);\r\n approx = halfThis.div(divisor).shl(1);\r\n if (approx.eq(ZERO)) {\r\n return divisor.isNegative() ? ONE : NEG_ONE;\r\n } else {\r\n rem = this.sub(divisor.mul(approx));\r\n res = approx.add(rem.div(divisor));\r\n return res;\r\n }\r\n }\r\n } else if (divisor.eq(MIN_VALUE))\r\n return this.unsigned ? UZERO : ZERO;\r\n if (this.isNegative()) {\r\n if (divisor.isNegative())\r\n return this.neg().div(divisor.neg());\r\n return this.neg().div(divisor).neg();\r\n } else if (divisor.isNegative())\r\n return this.div(divisor.neg()).neg();\r\n res = ZERO;\r\n } else {\r\n // The algorithm below has not been made for unsigned longs. It's therefore\r\n // required to take special care of the MSB prior to running it.\r\n if (!divisor.unsigned)\r\n divisor = divisor.toUnsigned();\r\n if (divisor.gt(this))\r\n return UZERO;\r\n if (divisor.gt(this.shru(1))) // 15 >>> 1 = 7 ; with divisor = 8 ; true\r\n return UONE;\r\n res = UZERO;\r\n }\r\n\r\n // Repeat the following until the remainder is less than other: find a\r\n // floating-point that approximates remainder / other *from below*, add this\r\n // into the result, and subtract it from the remainder. It is critical that\r\n // the approximate value is less than or equal to the real value so that the\r\n // remainder never becomes negative.\r\n rem = this;\r\n while (rem.gte(divisor)) {\r\n // Approximate the result of division. This may be a little greater or\r\n // smaller than the actual value.\r\n approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));\r\n\r\n // We will tweak the approximate result by changing it in the 48-th digit or\r\n // the smallest non-fractional digit, whichever is larger.\r\n var log2 = Math.ceil(Math.log(approx) / Math.LN2),\r\n delta = (log2 <= 48) ? 1 : pow_dbl(2, log2 - 48),\r\n\r\n // Decrease the approximation until it is smaller than the remainder. Note\r\n // that if it is too large, the product overflows and is negative.\r\n approxRes = fromNumber(approx),\r\n approxRem = approxRes.mul(divisor);\r\n while (approxRem.isNegative() || approxRem.gt(rem)) {\r\n approx -= delta;\r\n approxRes = fromNumber(approx, this.unsigned);\r\n approxRem = approxRes.mul(divisor);\r\n }\r\n\r\n // We know the answer can't be zero... and actually, zero would cause\r\n // infinite recursion since we would make no progress.\r\n if (approxRes.isZero())\r\n approxRes = ONE;\r\n\r\n res = res.add(approxRes);\r\n rem = rem.sub(approxRem);\r\n }\r\n return res;\r\n };\r\n\r\n /**\r\n * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Quotient\r\n */\r\n LongPrototype.div = LongPrototype.divide;\r\n\r\n /**\r\n * Returns this Long modulo the specified.\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\n LongPrototype.modulo = function modulo(divisor) {\r\n if (!isLong(divisor))\r\n divisor = fromValue(divisor);\r\n return this.sub(this.div(divisor).mul(divisor));\r\n };\r\n\r\n /**\r\n * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.\r\n * @function\r\n * @param {!Long|number|string} divisor Divisor\r\n * @returns {!Long} Remainder\r\n */\r\n LongPrototype.mod = LongPrototype.modulo;\r\n\r\n /**\r\n * Returns the bitwise NOT of this Long.\r\n * @returns {!Long}\r\n */\r\n LongPrototype.not = function not() {\r\n return fromBits(~this.low, ~this.high, this.unsigned);\r\n };\r\n\r\n /**\r\n * Returns the bitwise AND of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\n LongPrototype.and = function and(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low & other.low, this.high & other.high, this.unsigned);\r\n };\r\n\r\n /**\r\n * Returns the bitwise OR of this Long and the specified.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\n LongPrototype.or = function or(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low | other.low, this.high | other.high, this.unsigned);\r\n };\r\n\r\n /**\r\n * Returns the bitwise XOR of this Long and the given one.\r\n * @param {!Long|number|string} other Other Long\r\n * @returns {!Long}\r\n */\r\n LongPrototype.xor = function xor(other) {\r\n if (!isLong(other))\r\n other = fromValue(other);\r\n return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);\r\n };\r\n\r\n /**\r\n * Returns this Long with bits shifted to the left by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\n LongPrototype.shiftLeft = function shiftLeft(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);\r\n else\r\n return fromBits(0, this.low << (numBits - 32), this.unsigned);\r\n };\r\n\r\n /**\r\n * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\n LongPrototype.shl = LongPrototype.shiftLeft;\r\n\r\n /**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\n LongPrototype.shiftRight = function shiftRight(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n if ((numBits &= 63) === 0)\r\n return this;\r\n else if (numBits < 32)\r\n return fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);\r\n else\r\n return fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);\r\n };\r\n\r\n /**\r\n * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\n LongPrototype.shr = LongPrototype.shiftRight;\r\n\r\n /**\r\n * Returns this Long with bits logically shifted to the right by the given amount.\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\n LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {\r\n if (isLong(numBits))\r\n numBits = numBits.toInt();\r\n numBits &= 63;\r\n if (numBits === 0)\r\n return this;\r\n else {\r\n var high = this.high;\r\n if (numBits < 32) {\r\n var low = this.low;\r\n return fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);\r\n } else if (numBits === 32)\r\n return fromBits(high, 0, this.unsigned);\r\n else\r\n return fromBits(high >>> (numBits - 32), 0, this.unsigned);\r\n }\r\n };\r\n\r\n /**\r\n * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.\r\n * @function\r\n * @param {number|!Long} numBits Number of bits\r\n * @returns {!Long} Shifted Long\r\n */\r\n LongPrototype.shru = LongPrototype.shiftRightUnsigned;\r\n\r\n /**\r\n * Converts this Long to signed.\r\n * @returns {!Long} Signed long\r\n */\r\n LongPrototype.toSigned = function toSigned() {\r\n if (!this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, false);\r\n };\r\n\r\n /**\r\n * Converts this Long to unsigned.\r\n * @returns {!Long} Unsigned long\r\n */\r\n LongPrototype.toUnsigned = function toUnsigned() {\r\n if (this.unsigned)\r\n return this;\r\n return fromBits(this.low, this.high, true);\r\n };\r\n\r\n /**\r\n * Converts this Long to its byte representation.\r\n * @param {boolean=} le Whether little or big endian, defaults to big endian\r\n * @returns {!Array.<number>} Byte representation\r\n */\r\n LongPrototype.toBytes = function(le) {\r\n return le ? this.toBytesLE() : this.toBytesBE();\r\n }\r\n\r\n /**\r\n * Converts this Long to its little endian byte representation.\r\n * @returns {!Array.<number>} Little endian byte representation\r\n */\r\n LongPrototype.toBytesLE = function() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n lo & 0xff,\r\n (lo >>> 8) & 0xff,\r\n (lo >>> 16) & 0xff,\r\n (lo >>> 24) & 0xff,\r\n hi & 0xff,\r\n (hi >>> 8) & 0xff,\r\n (hi >>> 16) & 0xff,\r\n (hi >>> 24) & 0xff\r\n ];\r\n }\r\n\r\n /**\r\n * Converts this Long to its big endian byte representation.\r\n * @returns {!Array.<number>} Big endian byte representation\r\n */\r\n LongPrototype.toBytesBE = function() {\r\n var hi = this.high,\r\n lo = this.low;\r\n return [\r\n (hi >>> 24) & 0xff,\r\n (hi >>> 16) & 0xff,\r\n (hi >>> 8) & 0xff,\r\n hi & 0xff,\r\n (lo >>> 24) & 0xff,\r\n (lo >>> 16) & 0xff,\r\n (lo >>> 8) & 0xff,\r\n lo & 0xff\r\n ];\r\n }\r\n\r\n return Long;\r\n});\r\n","/// S2 Geometry functions\n// the regional scoreboard is based on a level 6 S2 Cell\n// - https://docs.google.com/presentation/d/1Hl4KapfAENAOf4gv-pSngKwvS_jwNVHRPZTTDzXXn6Q/view?pli=1#slide=id.i22\n// at the time of writing there's no actual API for the intel map to retrieve scoreboard data,\n// but it's still useful to plot the score cells on the intel map\n\n\n// the S2 geometry is based on projecting the earth sphere onto a cube, with some scaling of face coordinates to\n// keep things close to approximate equal area for adjacent cells\n// to convert a lat,lng into a cell id:\n// - convert lat,lng to x,y,z\n// - convert x,y,z into face,u,v\n// - u,v scaled to s,t with quadratic formula\n// - s,t converted to integer i,j offsets\n// - i,j converted to a position along a Hubbert space-filling curve\n// - combine face,position to get the cell id\n\n//NOTE: compared to the google S2 geometry library, we vary from their code in the following ways\n// - cell IDs: they combine face and the hilbert curve position into a single 64 bit number. this gives efficient space\n// and speed. javascript doesn't have appropriate data types, and speed is not cricical, so we use\n// as [face,[bitpair,bitpair,...]] instead\n// - i,j: they always use 30 bits, adjusting as needed. we use 0 to (1<<level)-1 instead\n// (so GetSizeIJ for a cell is always 1)\n\n(function (exports) {\n'use strict';\n\nvar S2 = exports.S2 = { L: {} };\n\nS2.L.LatLng = function (/*Number*/ rawLat, /*Number*/ rawLng, /*Boolean*/ noWrap) {\n var lat = parseFloat(rawLat, 10);\n var lng = parseFloat(rawLng, 10);\n\n if (isNaN(lat) || isNaN(lng)) {\n throw new Error('Invalid LatLng object: (' + rawLat + ', ' + rawLng + ')');\n }\n\n if (noWrap !== true) {\n lat = Math.max(Math.min(lat, 90), -90); // clamp latitude into -90..90\n lng = (lng + 180) % 360 + ((lng < -180 || lng === 180) ? 180 : -180); // wrap longtitude into -180..180\n }\n\n return { lat: lat, lng: lng };\n};\n\nS2.L.LatLng.DEG_TO_RAD = Math.PI / 180;\nS2.L.LatLng.RAD_TO_DEG = 180 / Math.PI;\n\n/*\nS2.LatLngToXYZ = function(latLng) {\n // http://stackoverflow.com/questions/8981943/lat-long-to-x-y-z-position-in-js-not-working\n var lat = latLng.lat;\n var lon = latLng.lng;\n var DEG_TO_RAD = Math.PI / 180.0;\n\n var phi = lat * DEG_TO_RAD;\n var theta = lon * DEG_TO_RAD;\n\n var cosLat = Math.cos(phi);\n var sinLat = Math.sin(phi);\n var cosLon = Math.cos(theta);\n var sinLon = Math.sin(theta);\n var rad = 500.0;\n\n return [\n rad * cosLat * cosLon\n , rad * cosLat * sinLon\n , rad * sinLat\n ];\n};\n*/\nS2.LatLngToXYZ = function(latLng) {\n var d2r = S2.L.LatLng.DEG_TO_RAD;\n\n var phi = latLng.lat*d2r;\n var theta = latLng.lng*d2r;\n\n var cosphi = Math.cos(phi);\n\n return [Math.cos(theta)*cosphi, Math.sin(theta)*cosphi, Math.sin(phi)];\n};\n\nS2.XYZToLatLng = function(xyz) {\n var r2d = S2.L.LatLng.RAD_TO_DEG;\n\n var lat = Math.atan2(xyz[2], Math.sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]));\n var lng = Math.atan2(xyz[1], xyz[0]);\n\n return S2.L.LatLng(lat*r2d, lng*r2d);\n};\n\nvar largestAbsComponent = function(xyz) {\n var temp = [Math.abs(xyz[0]), Math.abs(xyz[1]), Math.abs(xyz[2])];\n\n if (temp[0] > temp[1]) {\n if (temp[0] > temp[2]) {\n return 0;\n } else {\n return 2;\n }\n } else {\n if (temp[1] > temp[2]) {\n return 1;\n } else {\n return 2;\n }\n }\n\n};\n\nvar faceXYZToUV = function(face,xyz) {\n var u,v;\n\n switch (face) {\n case 0: u = xyz[1]/xyz[0]; v = xyz[2]/xyz[0]; break;\n case 1: u = -xyz[0]/xyz[1]; v = xyz[2]/xyz[1]; break;\n case 2: u = -xyz[0]/xyz[2]; v = -xyz[1]/xyz[2]; break;\n case 3: u = xyz[2]/xyz[0]; v = xyz[1]/xyz[0]; break;\n case 4: u = xyz[2]/xyz[1]; v = -xyz[0]/xyz[1]; break;\n case 5: u = -xyz[1]/xyz[2]; v = -xyz[0]/xyz[2]; break;\n default: throw {error: 'Invalid face'};\n }\n\n return [u,v];\n};\n\n\n\n\nS2.XYZToFaceUV = function(xyz) {\n var face = largestAbsComponent(xyz);\n\n if (xyz[face] < 0) {\n face += 3;\n }\n\n var uv = faceXYZToUV (face,xyz);\n\n return [face, uv];\n};\n\nS2.FaceUVToXYZ = function(face,uv) {\n var u = uv[0];\n var v = uv[1];\n\n switch (face) {\n case 0: return [ 1, u, v];\n case 1: return [-u, 1, v];\n case 2: return [-u,-v, 1];\n case 3: return [-1,-v,-u];\n case 4: return [ v,-1,-u];\n case 5: return [ v, u,-1];\n default: throw {error: 'Invalid face'};\n }\n};\n\nvar singleSTtoUV = function(st) {\n if (st >= 0.5) {\n return (1/3.0) * (4*st*st - 1);\n } else {\n return (1/3.0) * (1 - (4*(1-st)*(1-st)));\n }\n};\n\nS2.STToUV = function(st) {\n return [singleSTtoUV(st[0]), singleSTtoUV(st[1])];\n};\n\n\nvar singleUVtoST = function(uv) {\n if (uv >= 0) {\n return 0.5 * Math.sqrt (1 + 3*uv);\n } else {\n return 1 - 0.5 * Math.sqrt (1 - 3*uv);\n }\n};\nS2.UVToST = function(uv) {\n return [singleUVtoST(uv[0]), singleUVtoST(uv[1])];\n};\n\n\nS2.STToIJ = function(st,order) {\n var maxSize = (1<<order);\n\n var singleSTtoIJ = function(st) {\n var ij = Math.floor(st * maxSize);\n return Math.max(0, Math.min(maxSize-1, ij));\n };\n\n return [singleSTtoIJ(st[0]), singleSTtoIJ(st[1])];\n};\n\n\nS2.IJToST = function(ij,order,offsets) {\n var maxSize = (1<<order);\n\n return [\n (ij[0]+offsets[0])/maxSize,\n (ij[1]+offsets[1])/maxSize\n ];\n};\n\n\n\nvar rotateAndFlipQuadrant = function(n, point, rx, ry)\n{\n\tvar newX, newY;\n\tif(ry == 0)\n\t{\n\t\tif(rx == 1){\n\t\t\tpoint.x = n - 1 - point.x;\n\t\t\tpoint.y = n - 1 - point.y\n\n\t\t}\n\n var x = point.x;\n\t\tpoint.x = point.y\n\t\tpoint.y = x;\n\t}\n\n}\n\n\n\n\n\n// hilbert space-filling curve\n// based on http://blog.notdot.net/2009/11/Damn-Cool-Algorithms-Spatial-indexing-with-Quadtrees-and-Hilbert-Curves\n// note: rather then calculating the final integer hilbert position, we just return the list of quads\n// this ensures no precision issues whth large orders (S3 cell IDs use up to 30), and is more\n// convenient for pulling out the individual bits as needed later\nvar pointToHilbertQuadList = function(x,y,order,face) {\n var hilbertMap = {\n 'a': [ [0,'d'], [1,'a'], [3,'b'], [2,'a'] ],\n 'b': [ [2,'b'], [1,'b'], [3,'a'], [0,'c'] ],\n 'c': [ [2,'c'], [3,'d'], [1,'c'], [0,'b'] ],\n 'd': [ [0,'a'], [3,'c'], [1,'d'], [2,'d'] ]\n };\n\n if ('number' !== typeof face) {\n console.warn(new Error(\"called pointToHilbertQuadList without face value, defaulting to '0'\").stack);\n }\n var currentSquare = (face % 2) ? 'd' : 'a';\n var positions = [];\n\n for (var i=order-1; i>=0; i--) {\n\n var mask = 1<<i;\n\n var quad_x = x&mask ? 1 : 0;\n var quad_y = y&mask ? 1 : 0;\n\n var t = hilbertMap[currentSquare][quad_x*2+quad_y];\n\n positions.push(t[0]);\n\n currentSquare = t[1];\n }\n\n return positions;\n};\n\n// S2Cell class\n\nS2.S2Cell = function(){};\n\nS2.S2Cell.FromHilbertQuadKey = function(hilbertQuadkey) {\n var parts = hilbertQuadkey.split('/');\n var face = parseInt(parts[0]);\n var position = parts[1];\n var maxLevel = position.length;\n var point = {\n x : 0,\n y: 0\n };\n var i;\n var level;\n var bit;\n var rx, ry;\n var val;\n\n\tfor(i = maxLevel - 1; i >= 0; i--) {\n\n\t\tlevel = maxLevel - i;\n\t\tbit = position[i];\n\t\trx = 0;\n ry = 0;\n\t\tif (bit === '1') {\n\t\t\try = 1;\n\t\t}\n\t\telse if (bit === '2') {\n\t\t\trx = 1;\n\t\t\try = 1;\n\t\t}\n\t\telse if (bit === '3') {\n\t\t\trx = 1;\n\t\t}\n\n\t\tval = Math.pow(2, level - 1);\n\t\trotateAndFlipQuadrant(val, point, rx, ry);\n\n\t\tpoint.x += val * rx;\n\t\tpoint.y += val * ry;\n\n\t}\n\n if (face % 2 === 1) {\n var t = point.x;\n point.x = point.y;\n point.y = t;\n }\n\n\n return S2.S2Cell.FromFaceIJ(parseInt(face), [point.x, point.y], level);\n};\n\n//static method to construct\nS2.S2Cell.FromLatLng = function(latLng, level) {\n if ((!latLng.lat && latLng.lat !== 0) || (!latLng.lng && latLng.lng !== 0)) {\n throw new Error(\"Pass { lat: lat, lng: lng } to S2.S2Cell.FromLatLng\");\n }\n var xyz = S2.LatLngToXYZ(latLng);\n\n var faceuv = S2.XYZToFaceUV(xyz);\n var st = S2.UVToST(faceuv[1]);\n\n var ij = S2.STToIJ(st,level);\n\n return S2.S2Cell.FromFaceIJ (faceuv[0], ij, level);\n};\n\n/*\nS2.faceIjLevelToXyz = function (face, ij, level) {\n var st = S2.IJToST(ij, level, [0.5, 0.5]);\n var uv = S2.STToUV(st);\n var xyz = S2.FaceUVToXYZ(face, uv);\n\n return S2.XYZToLatLng(xyz);\n return xyz;\n};\n*/\n\nS2.S2Cell.FromFaceIJ = function(face,ij,level) {\n var cell = new S2.S2Cell();\n cell.face = face;\n cell.ij = ij;\n cell.level = level;\n\n return cell;\n};\n\n\nS2.S2Cell.prototype.toString = function() {\n return 'F'+this.face+'ij['+this.ij[0]+','+this.ij[1]+']@'+this.level;\n};\n\nS2.S2Cell.prototype.getLatLng = function() {\n var st = S2.IJToST(this.ij,this.level, [0.5,0.5]);\n var uv = S2.STToUV(st);\n var xyz = S2.FaceUVToXYZ(this.face, uv);\n\n return S2.XYZToLatLng(xyz);\n};\n\nS2.S2Cell.prototype.getCornerLatLngs = function() {\n var result = [];\n var offsets = [\n [ 0.0, 0.0 ],\n [ 0.0, 1.0 ],\n [ 1.0, 1.0 ],\n [ 1.0, 0.0 ]\n ];\n\n for (var i=0; i<4; i++) {\n var st = S2.IJToST(this.ij, this.level, offsets[i]);\n var uv = S2.STToUV(st);\n var xyz = S2.FaceUVToXYZ(this.face, uv);\n\n result.push ( S2.XYZToLatLng(xyz) );\n }\n return result;\n};\n\n\nS2.S2Cell.prototype.getFaceAndQuads = function () {\n var quads = pointToHilbertQuadList(this.ij[0], this.ij[1], this.level, this.face);\n\n return [this.face,quads];\n};\nS2.S2Cell.prototype.toHilbertQuadkey = function () {\n var quads = pointToHilbertQuadList(this.ij[0], this.ij[1], this.level, this.face);\n\n return this.face.toString(10) + '/' + quads.join('');\n};\n\nS2.latLngToNeighborKeys = S2.S2Cell.latLngToNeighborKeys = function (lat, lng, level) {\n return S2.S2Cell.FromLatLng({ lat: lat, lng: lng }, level).getNeighbors().map(function (cell) {\n return cell.toHilbertQuadkey();\n });\n};\nS2.S2Cell.prototype.getNeighbors = function() {\n\n var fromFaceIJWrap = function(face,ij,level) {\n var maxSize = (1<<level);\n if (ij[0]>=0 && ij[1]>=0 && ij[0]<maxSize && ij[1]<maxSize) {\n // no wrapping out of bounds\n return S2.S2Cell.FromFaceIJ(face,ij,level);\n } else {\n // the new i,j are out of range.\n // with the assumption that they're only a little past the borders we can just take the points as\n // just beyond the cube face, project to XYZ, then re-create FaceUV from the XYZ vector\n\n var st = S2.IJToST(ij,level,[0.5,0.5]);\n var uv = S2.STToUV(st);\n var xyz = S2.FaceUVToXYZ(face,uv);\n var faceuv = S2.XYZToFaceUV(xyz);\n face = faceuv[0];\n uv = faceuv[1];\n st = S2.UVToST(uv);\n ij = S2.STToIJ(st,level);\n return S2.S2Cell.FromFaceIJ (face, ij, level);\n }\n };\n\n var face = this.face;\n var i = this.ij[0];\n var j = this.ij[1];\n var level = this.level;\n\n\n return [\n fromFaceIJWrap(face, [i-1,j], level),\n fromFaceIJWrap(face, [i,j-1], level),\n fromFaceIJWrap(face, [i+1,j], level),\n fromFaceIJWrap(face, [i,j+1], level)\n ];\n\n};\n\n//\n// Functional Style\n//\nS2.FACE_BITS = 3;\nS2.MAX_LEVEL = 30;\nS2.POS_BITS = (2 * S2.MAX_LEVEL) + 1; // 61 (60 bits of data, 1 bit lsb marker)\n\nS2.facePosLevelToId = S2.S2Cell.facePosLevelToId = S2.fromFacePosLevel = function (faceN, posS, levelN) {\n var Long = exports.dcodeIO && exports.dcodeIO.Long || require('long');\n var faceB;\n var posB;\n var bin;\n\n if (!levelN) {\n levelN = posS.length;\n }\n if (posS.length > levelN) {\n posS = posS.substr(0, levelN);\n }\n\n // 3-bit face value\n faceB = Long.fromString(faceN.toString(10), true, 10).toString(2);\n while (faceB.length < S2.FACE_BITS) {\n faceB = '0' + faceB;\n }\n\n // 60-bit position value\n posB = Long.fromString(posS, true, 4).toString(2);\n while (posB.length < (2 * levelN)) {\n posB = '0' + posB;\n }\n\n bin = faceB + posB;\n // 1-bit lsb marker\n bin += '1';\n // n-bit padding to 64-bits\n while (bin.length < (S2.FACE_BITS + S2.POS_BITS)) {\n bin += '0';\n }\n\n return Long.fromString(bin, true, 2).toString(10);\n};\n\nS2.keyToId = S2.S2Cell.keyToId\n= S2.toId = S2.toCellId = S2.fromKey\n= function (key) {\n var parts = key.split('/');\n\n return S2.fromFacePosLevel(parts[0], parts[1], parts[1].length);\n};\n\nS2.idToKey = S2.S2Cell.idToKey\n= S2.S2Cell.toKey = S2.toKey\n= S2.fromId = S2.fromCellId\n= S2.S2Cell.toHilbertQuadkey = S2.toHilbertQuadkey\n= function (idS) {\n var Long = exports.dcodeIO && exports.dcodeIO.Long || require('long');\n var bin = Long.fromString(idS, true, 10).toString(2);\n\n while (bin.length < (S2.FACE_BITS + S2.POS_BITS)) {\n bin = '0' + bin;\n }\n\n // MUST come AFTER binstr has been left-padded with '0's\n var lsbIndex = bin.lastIndexOf('1');\n // substr(start, len)\n // substring(start, end) // includes start, does not include end\n var faceB = bin.substring(0, 3);\n // posB will always be a multiple of 2 (or it's invalid)\n var posB = bin.substring(3, lsbIndex);\n var levelN = posB.length / 2;\n\n var faceS = Long.fromString(faceB, true, 2).toString(10);\n var posS = Long.fromString(posB, true, 2).toString(4);\n\n while (posS.length < levelN) {\n posS = '0' + posS;\n }\n\n return faceS + '/' + posS;\n};\n\nS2.keyToLatLng = S2.S2Cell.keyToLatLng = function (key) {\n var cell2 = S2.S2Cell.FromHilbertQuadKey(key);\n return cell2.getLatLng();\n};\n\nS2.idToLatLng = S2.S2Cell.idToLatLng = function (id) {\n var key = S2.idToKey(id);\n return S2.keyToLatLng(key);\n};\n\nS2.S2Cell.latLngToKey = S2.latLngToKey\n= S2.latLngToQuadkey = function (lat, lng, level) {\n if (isNaN(level) || level < 1 || level > 30) {\n throw new Error(\"'level' is not a number between 1 and 30 (but it should be)\");\n }\n // TODO\n //\n // S2.idToLatLng(id)\n // S2.keyToLatLng(key)\n // S2.nextFace(key) // prevent wrapping on nextKey\n // S2.prevFace(key) // prevent wrapping on prevKey\n //\n // .toKeyArray(id) // face,quadtree\n // .toKey(id) // hilbert\n // .toPoint(id) // ij\n // .toId(key) // uint64 (as string)\n // .toLong(key) // long.js\n // .toLatLng(id) // object? or array?, or string (with comma)?\n //\n // maybe S2.HQ.x, S2.GPS.x, S2.CI.x?\n return S2.S2Cell.FromLatLng({ lat: lat, lng: lng }, level).toHilbertQuadkey();\n};\n\nS2.stepKey = function (key, num) {\n var Long = exports.dcodeIO && exports.dcodeIO.Long || require('long');\n var parts = key.split('/');\n\n var faceS = parts[0];\n var posS = parts[1];\n var level = parts[1].length;\n\n var posL = Long.fromString(posS, true, 4);\n // TODO handle wrapping (0 === pos + 1)\n // (only on the 12 edges of the globe)\n var otherL;\n if (num > 0) {\n otherL = posL.add(Math.abs(num));\n }\n else if (num < 0) {\n otherL = posL.subtract(Math.abs(num));\n }\n var otherS = otherL.toString(4);\n\n if ('0' === otherS) {\n console.warning(new Error(\"face/position wrapping is not yet supported\"));\n }\n\n while (otherS.length < level) {\n otherS = '0' + otherS;\n }\n\n return faceS + '/' + otherS;\n};\n\nS2.S2Cell.prevKey = S2.prevKey = function (key) {\n return S2.stepKey(key, -1);\n};\n\nS2.S2Cell.nextKey = S2.nextKey = function (key) {\n return S2.stepKey(key, 1);\n};\n\n})('undefined' !== typeof module ? module.exports : window);\n","import { S2 } from \"s2-geometry\";\n\nimport { GeometryProviderBase } from \"./GeometryProviderBase\";\nimport { LngLat } from \"./interfaces/LngLat\";\n\n/**\n * @class S2GeometryProvider\n *\n * @classdesc Geometry provider based on S2 cells.\n *\n * @example\n * ```js\n * class MyDataProvider extends DataProviderBase {\n * ...\n * }\n *\n * const geometryProvider = new S2GeometryProvider();\n * const dataProvider = new MyDataProvider(geometryProvider);\n * ```\n */\nexport class S2GeometryProvider extends GeometryProviderBase {\n /**\n * Create a new S2 geometry provider instance.\n */\n constructor(private readonly _level: number = 17) { super(); }\n\n /** @inheritdoc */\n public bboxToCellIds(sw: LngLat, ne: LngLat): string[] {\n return this._approxBboxToCellIds(sw, ne);\n }\n\n /** @inheritdoc */\n public getAdjacent(cellId: string): string[] {\n const k = S2.idToKey(cellId);\n const position = k.split('/')[1];\n const level = position.length;\n\n const [a0, a1, a2, a3] = this._getNeighbors(k, level);\n const existing = [k, a0, a1, a2, a3];\n const others = Array\n .from(\n new Set([\n ...this._getNeighbors(a0, level),\n ...this._getNeighbors(a1, level),\n ...this._getNeighbors(a2, level),\n ...this._getNeighbors(a3, level),\n ].filter(\n (o: string): boolean => {\n return !existing.includes(o);\n })));\n\n const adjacent = [a0, a1, a2, a3];\n for (const other of others) {\n let count = 0;\n for (const n of this._getNeighbors(other, level)) {\n if (existing.includes(n)) { count++; }\n }\n if (count === 2) { adjacent.push(other); }\n }\n return adjacent.map((a: string): string => S2.keyToId(a));\n }\n\n /** @inheritdoc */\n public getVertices(cellId: string): LngLat[] {\n const key = S2.idToKey(cellId);\n const cell = S2.S2Cell.FromHilbertQuadKey(key);\n return cell\n .getCornerLatLngs()\n .map(\n (c: S2.ILatLng): LngLat => {\n return { lat: c.lat, lng: c.lng };\n });\n }\n\n /** @inheritdoc */\n public lngLatToCellId(lngLat: LngLat): string {\n return this._lngLatToId(lngLat, this._level);\n }\n\n private _getNeighbors(s2key: string, level: number): string[] {\n const latlng = S2.keyToLatLng(s2key);\n const neighbors = S2.latLngToNeighborKeys(\n latlng.lat,\n latlng.lng,\n level);\n\n return neighbors;\n }\n\n private _lngLatToId(lngLat: LngLat, level: number): string {\n const s2key = S2.latLngToKey(\n lngLat.lat,\n lngLat.lng,\n level);\n\n return S2.keyToId(s2key);\n }\n}\n","import { ClusterContract } from '../contracts/ClusterContract';\nimport { CoreImageEnt } from '../ents/CoreImageEnt';\nimport { SpatialImageEnt } from '../ents/SpatialImageEnt';\nimport { LngLat } from '../interfaces/LngLat';\nimport { LngLatAlt } from '../interfaces/LngLatAlt';\nimport { GraphClusterContract } from './GraphContracts';\nimport {\n GraphCoreImageEnt,\n GraphGeometry,\n GraphSpatialImageEnt,\n} from './GraphEnts';\n\nexport function convertCameraType(graphCameraType: string): string {\n switch (graphCameraType) {\n case \"equirectangular\":\n case \"spherical\":\n return \"spherical\";\n case \"fisheye\":\n return \"fisheye\";\n default:\n return \"perspective\";\n }\n}\n\nexport class GraphConverter {\n public clusterReconstruction(\n source: GraphClusterContract)\n : ClusterContract {\n\n const id: string = null;\n const points = source.points;\n const normalize = 1 / 255;\n for (const pointId in points) {\n if (!points.hasOwnProperty(pointId)) {\n continue;\n }\n const color = points[pointId].color;\n color[0] *= normalize;\n color[1] *= normalize;\n color[2] *= normalize;\n }\n\n const lla = source.reference_lla;\n const reference: LngLatAlt = {\n alt: lla.altitude,\n lat: lla.latitude,\n lng: lla.longitude,\n };\n return {\n id,\n points,\n reference,\n };\n }\n\n public coreImage(\n source: GraphCoreImageEnt)\n : CoreImageEnt {\n\n const geometry = this._geometry(source.geometry);\n const computedGeometry = this._geometry(source.computed_geometry);\n const sequence = { id: source.sequence };\n const id = source.id;\n return {\n computed_geometry: computedGeometry,\n geometry,\n id,\n sequence,\n };\n }\n\n public spatialImage(\n source: GraphSpatialImageEnt)\n : SpatialImageEnt {\n source.camera_type = convertCameraType(source.camera_type);\n source.merge_id = source.merge_cc ? source.merge_cc.toString() : null;\n source.private = null;\n const thumbUrl = source.camera_type === 'spherical' ?\n source.thumb_2048_url : source.thumb_1024_url;\n source.thumb = source.thumb ?? { id: null, url: thumbUrl };\n\n source.cluster = source.sfm_cluster ?? { id: null, url: null };\n source.creator = source.creator ?? { id: null, username: null };\n source.owner = source.organization ?? { id: null };\n source.mesh = source.mesh ?? { id: null, url: null };\n\n return source;\n }\n\n private _geometry(geometry: GraphGeometry): LngLat {\n const coords = geometry?.coordinates;\n const lngLat: LngLat = coords ?\n {\n lat: coords[1],\n lng: coords[0],\n } : null;\n\n return lngLat;\n }\n}\n","export class GraphQueryCreator {\n public readonly imagesPath: string;\n public readonly sequencePath: string;\n\n public readonly coreFields: string[];\n public readonly idFields: string[];\n public readonly spatialFields: string[];\n public readonly imageTileFields: string[];\n\n private readonly _imageTilesPath: string;\n\n constructor() {\n this.imagesPath = 'images';\n this.sequencePath = 'image_ids';\n this._imageTilesPath = 'tiles';\n\n this.coreFields = ['computed_geometry', 'geometry', 'sequence'];\n this.idFields = ['id'];\n this.spatialFields = [\n 'altitude',\n 'atomic_scale',\n 'camera_parameters',\n 'camera_type',\n 'captured_at',\n 'compass_angle',\n 'computed_altitude',\n 'computed_compass_angle',\n 'computed_rotation',\n 'creator',\n 'exif_orientation',\n 'height',\n 'merge_cc',\n 'mesh',\n 'organization',\n 'quality_score',\n 'sfm_cluster',\n 'thumb_1024_url',\n 'thumb_2048_url',\n 'width',\n ];\n this.imageTileFields = ['url', 'z', 'x', 'y'];\n }\n\n public images(imageIds: string[], fields: string[]): string {\n return `image_ids=${imageIds.join(',')}&fields=${fields.join(',')}`;\n }\n\n public imagesS2(cellId: string, fields: string[]): string {\n return `s2=${cellId}&fields=${fields.join(',')}`;\n }\n\n public imageTiles(z: number, fields: string[]): string {\n return `z=${z}&fields=${fields.join(',')}`;\n }\n\n public imageTilesPath(imageId: string): string {\n return `${imageId}/${this._imageTilesPath}`;\n }\n\n public sequence(sequenceId: string): string {\n return `sequence_id=${sequenceId}`;\n }\n}\n","import { MapillaryError } from '../../error/MapillaryError';\nimport {\n decompress,\n fetchArrayBuffer,\n readMeshPbf,\n xhrFetch,\n XMLHttpRequestHeader,\n} from '../Common';\nimport { ClusterContract } from '../contracts/ClusterContract';\nimport { CoreImagesContract } from '../contracts/CoreImagesContract';\nimport { EntContract } from '../contracts/EntContract';\nimport { ImagesContract } from '../contracts/ImagesContract';\nimport { ImageTilesContract } from '../contracts/ImageTilesContract';\nimport { ImageTilesRequestContract }\n from '../contracts/ImageTilesRequestContract';\nimport { MeshContract } from '../contracts/MeshContract';\nimport { SequenceContract } from '../contracts/SequenceContract';\nimport { SpatialImagesContract } from '../contracts/SpatialImagesContract';\nimport { DataProviderBase } from '../DataProviderBase';\nimport { IDEnt } from '../ents/IDEnt';\nimport { ImageEnt } from '../ents/ImageEnt';\nimport { ImageTileEnt } from '../ents/ImageTileEnt';\nimport { SpatialImageEnt } from '../ents/SpatialImageEnt';\nimport { IGeometryProvider } from '../interfaces/IGeometryProvider';\nimport { S2GeometryProvider } from '../S2GeometryProvider';\nimport {\n GraphClusterContract,\n GraphContract,\n GraphError,\n} from './GraphContracts';\nimport { GraphConverter } from './GraphConverter';\nimport { GraphDataProviderOptions } from './GraphDataProviderOptions';\nimport {\n GraphCoreImageEnt,\n GraphImageEnt,\n GraphSpatialImageEnt,\n} from './GraphEnts';\nimport { GraphQueryCreator } from './GraphQueryCreator';\n\nexport class GraphDataProvider extends DataProviderBase {\n private readonly _method: \"GET\";\n private readonly _endpoint: string;\n\n private readonly _convert: GraphConverter;\n private readonly _query: GraphQueryCreator;\n\n private _accessToken: string | undefined;\n\n constructor(\n options?: GraphDataProviderOptions,\n geometry?: IGeometryProvider,\n converter?: GraphConverter,\n queryCreator?: GraphQueryCreator) {\n\n super(geometry ?? new S2GeometryProvider());\n\n this._convert = converter ?? new GraphConverter();\n this._query = queryCreator ?? new GraphQueryCreator();\n\n this._method = 'GET';\n const opts = options ?? {};\n this._endpoint = opts.endpoint ?? \"https://graph.mapillary.com\";\n this._accessToken = opts.accessToken;\n }\n\n public getCluster(\n url: string,\n abort?: Promise<void>)\n : Promise<ClusterContract> {\n return fetchArrayBuffer(url, abort)\n .then(\n (buffer: ArrayBuffer) => {\n const reconstructions =\n <GraphClusterContract[]>\n decompress(buffer);\n\n if (reconstructions.length < 1) {\n throw new Error('Cluster reconstruction empty');\n }\n return this._convert\n .clusterReconstruction(reconstructions[0]);\n });\n }\n\n public getCoreImages(\n cellId: string)\n : Promise<CoreImagesContract> {\n\n const fields = [\n ...this._query.idFields,\n ...this._query.coreFields,\n ];\n const query = this._query.imagesS2(cellId, fields);\n const url = new URL(this._query.imagesPath, this._endpoint).href;\n\n return this\n ._fetchGraphContract<GraphCoreImageEnt[]>(\n query,\n url)\n .then(r => {\n const result: CoreImagesContract = {\n cell_id: cellId,\n images: [],\n };\n const items = r.data;\n for (const item of items) {\n const coreImage = this._convert.coreImage(item);\n result.images.push(coreImage);\n }\n return result;\n });\n }\n\n public getImageBuffer(\n url: string,\n abort?: Promise<void>)\n : Promise<ArrayBuffer> {\n return fetchArrayBuffer(url, abort);\n }\n\n public getImages(\n imageIds: string[])\n : Promise<ImagesContract> {\n\n const fields = [\n ...this._query.idFields,\n ...this._query.coreFields,\n ...this._query.spatialFields,\n ];\n const query = this._query.images(imageIds, fields);\n const url = new URL(this._query.imagesPath, this._endpoint).href;\n\n return this\n ._fetchGraphContract<GraphImageEnt[]>(\n query,\n url)\n .then(r => {\n const result: ImagesContract = [];\n const items = r.data;\n for (const item of items) {\n const coreImage = this._convert.coreImage(item);\n const spatialImage = this._convert.spatialImage(item);\n const image = Object.assign({}, spatialImage, coreImage);\n const contract: EntContract<ImageEnt> = {\n node: image,\n node_id: item.id,\n };\n result.push(contract);\n }\n return result;\n });\n }\n\n public getImageTiles(\n request: ImageTilesRequestContract)\n : Promise<ImageTilesContract> {\n\n const fields = [\n ...this._query.imageTileFields,\n ];\n const query = this._query.imageTiles(request.z, fields);\n const url = new URL(\n this._query.imageTilesPath(request.imageId),\n this._endpoint).href;\n\n return this\n ._fetchGraphContract<ImageTileEnt[]>(\n query,\n url)\n .then(r => {\n const result: ImageTilesContract = {\n node: r.data,\n node_id: request.imageId,\n };\n return result;\n });\n }\n\n public getMesh(\n url: string,\n abort?: Promise<void>)\n : Promise<MeshContract> {\n return fetchArrayBuffer(url, abort)\n .then(\n (buffer: ArrayBuffer) => {\n return readMeshPbf(buffer);\n });\n }\n\n public getSequence(\n sequenceId: string)\n : Promise<SequenceContract> {\n\n const query = this._query.sequence(sequenceId);\n const url = new URL(this._query.sequencePath, this._endpoint).href;\n\n return this\n ._fetchGraphContract<IDEnt[]>(\n query,\n url)\n .then(r => {\n const result: SequenceContract = {\n id: sequenceId,\n image_ids: r.data.map(item => item.id),\n };\n return result;\n });\n }\n\n\n public getSpatialImages(\n imageIds: string[])\n : Promise<SpatialImagesContract> {\n\n const fields = [\n ...this._query.idFields,\n ...this._query.coreFields,\n ...this._query.spatialFields,\n ];\n const query = this._query.images(imageIds, fields);\n const url = new URL(this._query.imagesPath, this._endpoint).href;\n\n return this\n ._fetchGraphContract<GraphSpatialImageEnt[]>(\n query,\n url)\n .then(r => {\n const result: SpatialImagesContract = [];\n const items = r.data;\n for (const item of items) {\n const spatialImage = this._convert.spatialImage(item);\n const contract: EntContract<SpatialImageEnt> = {\n node: spatialImage,\n node_id: item.id,\n };\n result.push(contract);\n }\n return result;\n });\n }\n\n public setAccessToken(accessToken: string): void {\n this._accessToken = accessToken;\n }\n\n private _createHeaders(): XMLHttpRequestHeader[] {\n const headers: XMLHttpRequestHeader[] = [\n { name: 'Accept', value: 'application/json' },\n {\n name: 'Content-Type',\n value: 'application/x-www-form-urlencoded',\n },\n ];\n\n if (this._accessToken) {\n headers.push({\n name: 'Authorization',\n value: `OAuth ${this._accessToken}`,\n });\n }\n return headers;\n }\n\n private _fetchGraphContract<T>(\n body: string,\n url: string): Promise<GraphContract<T>> {\n\n const method = this._method;\n const headers = this._createHeaders();\n const query = `${url}?${body}`;\n\n return xhrFetch<GraphContract<T>>(\n query,\n method,\n \"json\",\n headers,\n null,\n null)\n .catch(\n (error: GraphError) => {\n const message = this._makeErrorMessage(error);\n throw new MapillaryError(message);\n }\n );\n }\n\n private _makeErrorMessage(graphError: GraphError): string {\n const error = graphError.error;\n const message = error ?\n `${error.code} (${error.type}, ${error.fbtrace_id}): ${error.message}` :\n \"Failed to fetch data\";\n return message;\n }\n}\n","import * as THREE from \"three\";\nimport { LngLat } from \"../../../api/interfaces/LngLat\";\n\n/**\n * @class Marker\n *\n * @classdesc Represents an abstract marker class that should be extended\n * by marker implementations used in the marker component.\n */\nexport abstract class Marker {\n protected _id: string;\n protected _geometry: THREE.Object3D;\n protected _lngLat: LngLat;\n\n constructor(id: string, lngLat: LngLat) {\n this._id = id;\n this._lngLat = lngLat;\n }\n\n /**\n * Get id.\n * @returns {string} The id of the marker.\n */\n public get id(): string {\n return this._id;\n }\n\n /**\n * Get geometry.\n *\n * @ignore\n */\n public get geometry(): THREE.Object3D {\n return this._geometry;\n }\n\n /**\n * Get lngLat.\n * @returns {LngLat} The geographic coordinates of the marker.\n */\n public get lngLat(): LngLat {\n return this._lngLat;\n }\n\n /** @ignore */\n public createGeometry(position: number[]): void {\n if (!!this._geometry) {\n return;\n }\n\n this._createGeometry(position);\n\n // update matrix world if raycasting occurs before first render\n this._geometry.updateMatrixWorld(true);\n }\n\n /** @ignore */\n public disposeGeometry(): void {\n if (!this._geometry) {\n return;\n }\n\n this._disposeGeometry();\n\n this._geometry = undefined;\n }\n\n /** @ignore */\n public getInteractiveObjects(): THREE.Object3D[] {\n if (!this._geometry) {\n return [];\n }\n\n return this._getInteractiveObjects();\n }\n\n /** @ignore */\n public lerpAltitude(alt: number, alpha: number): void {\n if (!this._geometry) {\n return;\n }\n\n this._geometry.position.z =\n (1 - alpha) * this._geometry.position.z + alpha * alt;\n }\n\n /** @ignore */\n public updatePosition(position: number[], lngLat?: LngLat): void {\n if (!!lngLat) {\n this._lngLat.lat = lngLat.lat;\n this._lngLat.lng = lngLat.lng;\n }\n\n if (!this._geometry) {\n return;\n }\n\n this._geometry.position.fromArray(position);\n this._geometry.updateMatrixWorld(true);\n }\n\n protected abstract _createGeometry(position: number[]): void;\n\n protected abstract _disposeGeometry(): void;\n\n protected abstract _getInteractiveObjects(): THREE.Object3D[];\n}\n","export function isBrowser(): boolean {\n return (\n typeof window !== \"undefined\" &&\n typeof document !== \"undefined\"\n );\n}\n\nexport function isArraySupported(): boolean {\n return !!(\n Array.prototype &&\n Array.prototype.concat &&\n Array.prototype.filter &&\n Array.prototype.includes &&\n Array.prototype.indexOf &&\n Array.prototype.join &&\n Array.prototype.map &&\n Array.prototype.push &&\n Array.prototype.pop &&\n Array.prototype.reverse &&\n Array.prototype.shift &&\n Array.prototype.slice &&\n Array.prototype.splice &&\n Array.prototype.sort &&\n Array.prototype.unshift\n );\n}\n\nexport function isBlobSupported(): boolean {\n return (\n \"Blob\" in window &&\n \"URL\" in window\n );\n}\n\nexport function isFunctionSupported(): boolean {\n return !!(\n Function.prototype &&\n Function.prototype.apply &&\n Function.prototype.bind\n );\n}\n\nexport function isJSONSupported(): boolean {\n return (\n \"JSON\" in window &&\n \"parse\" in JSON &&\n \"stringify\" in JSON\n );\n}\n\nexport function isMapSupported(): boolean {\n return \"Map\" in window;\n}\n\nexport function isObjectSupported(): boolean {\n return !!(\n Object.assign &&\n Object.keys &&\n Object.values\n );\n}\n\nexport function isPromiseSupported(): boolean {\n return !!(\n \"Promise\" in window &&\n Promise.resolve &&\n Promise.reject &&\n Promise.prototype &&\n Promise.prototype.catch &&\n Promise.prototype.then\n );\n}\n\nexport function isSetSupported(): boolean {\n return \"Set\" in window;\n}\n\nlet isWebGLSupportedCache: boolean = undefined;\nexport function isWebGLSupportedCached(): boolean {\n if (isWebGLSupportedCache === undefined) {\n isWebGLSupportedCache = isWebGLSupported();\n }\n\n return isWebGLSupportedCache;\n}\n\nexport function isWebGLSupported(): boolean {\n const attributes: WebGLContextAttributes = {\n alpha: false,\n antialias: false,\n depth: true,\n failIfMajorPerformanceCaveat: false,\n premultipliedAlpha: true,\n preserveDrawingBuffer: false,\n stencil: true,\n };\n\n const canvas = document.createElement(\"canvas\");\n const webGL2Context = canvas.getContext(\"webgl2\", attributes);\n if (!!webGL2Context) { return true; }\n\n const context =\n canvas.getContext(\"webgl\", attributes) ||\n <WebGLRenderingContext>canvas\n .getContext(\"experimental-webgl\", attributes);\n\n if (!context) { return false; }\n\n const requiredExtensions = [\"OES_standard_derivatives\"];\n const supportedExtensions = context.getSupportedExtensions();\n for (const requiredExtension of requiredExtensions) {\n if (supportedExtensions.indexOf(requiredExtension) === -1) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Test whether the current browser supports the full\n * functionality of MapillaryJS.\n *\n * @description The full functionality includes WebGL rendering.\n *\n * @return {boolean}\n *\n * @example `var supported = isSupported();`\n */\nexport function isSupported(): boolean {\n return isFallbackSupported() &&\n isWebGLSupportedCached();\n}\n\n/**\n * Test whether the current browser supports the fallback\n * functionality of MapillaryJS.\n *\n * @description The fallback functionality does not include WebGL\n * rendering, only 2D canvas rendering.\n *\n * @return {boolean}\n *\n * @example `var fallbackSupported = isFallbackSupported();`\n */\nexport function isFallbackSupported(): boolean {\n return isBrowser() &&\n isArraySupported() &&\n isBlobSupported() &&\n isFunctionSupported() &&\n isJSONSupported() &&\n isMapSupported() &&\n isObjectSupported() &&\n isPromiseSupported() &&\n isSetSupported();\n}\n","/**\n * Enumeration for camera controls.\n *\n * @description Specifies different modes for how the\n * camera is controlled through pointer, keyboard or\n * other modes of input.\n *\n * @enum {number}\n * @readonly\n */\nexport enum CameraControls {\n /**\n * Control the camera with custom logic by\n * attaching a custom camera controls\n * instance to the {@link Viewer}.\n */\n Custom,\n\n /**\n * Control the camera from a birds perspective\n * to get an overview.\n */\n Earth,\n\n /**\n * Control the camera in a first person view\n * from the street level perspective.\n */\n Street,\n}\n","/**\n * Enumeration for render mode\n * @enum {number}\n * @readonly\n * @description Modes for specifying how rendering is done\n * in the viewer. All modes preserves the original aspect\n * ratio of the images.\n */\nexport enum RenderMode {\n\n /**\n * Displays all content within the viewer.\n *\n * @description Black bars shown on both\n * sides of the content. Bars are shown\n * either below and above or to the left\n * and right of the content depending on\n * the aspect ratio relation between the\n * image and the viewer.\n */\n Letterbox,\n\n /**\n * Fills the viewer by cropping content.\n *\n * @description Cropping is done either\n * in horizontal or vertical direction\n * depending on the aspect ratio relation\n * between the image and the viewer.\n */\n Fill,\n}\n","/**\n * Enumeration for transition mode\n * @enum {number}\n * @readonly\n * @description Modes for specifying how transitions\n * between images are performed.\n */\nexport enum TransitionMode {\n /**\n * Default transitions.\n *\n * @description The viewer dynamically determines\n * whether transitions should be performed with or\n * without motion and blending for each transition\n * based on the underlying data.\n */\n Default,\n\n /**\n * Instantaneous transitions.\n *\n * @description All transitions are performed\n * without motion or blending.\n */\n Instantaneous,\n}\n","export enum RenderPass {\n /**\n * Occurs after the background render pass.\n */\n Opaque,\n}\n","import {\n distinctUntilChanged,\n first,\n switchMap,\n} from \"rxjs/operators\";\n\nimport {\n Observable,\n Subscription,\n} from \"rxjs\";\n\nimport { Container } from \"./Container\";\nimport { Navigator } from \"./Navigator\";\nimport { Observer } from \"./Observer\";\nimport { ComponentOptions } from \"./options/ComponentOptions\";\n\nimport { Component } from \"../component/Component\";\nimport { ComponentService } from \"../component/ComponentService\";\nimport { CoverComponent } from \"../component/cover/CoverComponent\";\nimport { ComponentConfiguration }\n from \"../component/interfaces/ComponentConfiguration\";\nimport { CoverConfiguration }\n from \"../component/interfaces/CoverConfiguration\";\nimport { Image } from \"../graph/Image\";\nimport { CoverState } from \"../component/cover/CoverState\";\nimport { FallbackComponentName } from \"../component/fallback/FallbackComponentName\";\nimport { ComponentName } from \"../component/ComponentName\";\n\nexport class ComponentController {\n private _container: Container;\n private _coverComponent: CoverComponent;\n private _observer: Observer;\n private _navigator: Navigator;\n private _componentService: ComponentService;\n private _options: ComponentOptions;\n private _key: string;\n private _navigable: boolean;\n private _configurationSubscription: Subscription;\n\n constructor(\n container: Container,\n navigator: Navigator,\n observer: Observer,\n key: string,\n options: ComponentOptions,\n componentService?: ComponentService) {\n this._container = container;\n this._observer = observer;\n this._navigator = navigator;\n this._options = options != null ? options : {};\n this._key = key;\n this._navigable = key == null;\n this._componentService = !!componentService ?\n componentService :\n new ComponentService(this._container, this._navigator);\n\n this._coverComponent = this._componentService.getCover();\n\n this._initializeComponents();\n\n if (key) {\n this._initilizeCoverComponent();\n this._subscribeCoverComponent();\n } else {\n this._navigator.movedToId$.pipe(\n first(\n (k: string): boolean => {\n return k != null;\n }))\n .subscribe(\n (k: string): void => {\n this._key = k;\n this._componentService.deactivateCover();\n this._coverComponent.configure({\n id: this._key,\n state: CoverState.Hidden,\n });\n this._subscribeCoverComponent();\n this._navigator.stateService.start();\n this._navigator.cacheService.start();\n this._navigator.panService.start();\n this._observer.startEmit();\n });\n }\n }\n\n public get navigable(): boolean {\n return this._navigable;\n }\n\n public get<TComponent extends Component<ComponentConfiguration>>(name: string): TComponent {\n return this._componentService.get<TComponent>(name);\n }\n\n public activate(name: ComponentName | FallbackComponentName): void {\n this._componentService.activate(name);\n }\n\n public activateCover(): void {\n this._coverComponent.configure({ state: CoverState.Visible });\n }\n\n public deactivate(name: ComponentName | FallbackComponentName): void {\n this._componentService.deactivate(name);\n }\n\n public deactivateCover(): void {\n this._coverComponent.configure({ state: CoverState.Loading });\n }\n\n public remove(): void {\n this._componentService.remove();\n\n if (this._configurationSubscription != null) {\n this._configurationSubscription.unsubscribe();\n }\n }\n\n private _initializeComponents(): void {\n const options = this._options;\n\n this._uFalse(options.fallback?.image, \"imagefallback\");\n this._uFalse(options.fallback?.navigation, \"navigationfallback\");\n\n this._uFalse(options.marker, \"marker\");\n this._uFalse(options.popup, \"popup\");\n this._uFalse(options.slider, \"slider\");\n this._uFalse(options.spatial, \"spatial\");\n this._uFalse(options.tag, \"tag\");\n\n this._uTrue(options.attribution, \"attribution\");\n this._uTrue(options.bearing, \"bearing\");\n this._uTrue(options.cache, \"cache\");\n this._uTrue(options.direction, \"direction\");\n this._uTrue(options.image, \"image\");\n this._uTrue(options.keyboard, \"keyboard\");\n this._uTrue(options.pointer, \"pointer\");\n this._uTrue(options.sequence, \"sequence\");\n this._uTrue(options.zoom, \"zoom\");\n }\n\n private _initilizeCoverComponent(): void {\n let options: ComponentOptions = this._options;\n\n this._coverComponent.configure({ id: this._key });\n if (options.cover === undefined || options.cover) {\n this.activateCover();\n } else {\n this.deactivateCover();\n }\n }\n\n private _setNavigable(navigable: boolean): void {\n if (this._navigable === navigable) {\n return;\n }\n\n this._navigable = navigable;\n this._observer.navigable$.next(navigable);\n }\n\n private _subscribeCoverComponent(): void {\n this._configurationSubscription =\n this._coverComponent.configuration$.pipe(\n distinctUntilChanged(\n undefined,\n (c: CoverConfiguration): CoverState => {\n return c.state;\n }))\n .subscribe((conf: CoverConfiguration) => {\n if (conf.state === CoverState.Loading) {\n this._navigator.stateService.currentId$.pipe(\n first(),\n switchMap(\n (key: string): Observable<Image> => {\n const keyChanged: boolean = key == null || key !== conf.id;\n\n if (keyChanged) {\n this._setNavigable(false);\n }\n\n return keyChanged ?\n this._navigator.moveTo$(conf.id) :\n this._navigator.stateService.currentImage$.pipe(\n first());\n }))\n .subscribe(\n (): void => {\n this._navigator.stateService.start();\n this._navigator.cacheService.start();\n this._navigator.panService.start();\n this._observer.startEmit();\n this._coverComponent.configure({ state: CoverState.Hidden });\n this._componentService.deactivateCover();\n this._setNavigable(true);\n },\n (error: Error): void => {\n console.error(\"Failed to deactivate cover.\", error);\n\n this._coverComponent.configure({ state: CoverState.Visible });\n });\n } else if (conf.state === CoverState.Visible) {\n this._observer.stopEmit();\n this._navigator.stateService.stop();\n this._navigator.cacheService.stop();\n this._navigator.playService.stop();\n this._navigator.panService.stop();\n this._componentService.activateCover();\n this._setNavigable(conf.id == null);\n }\n });\n }\n\n private _uFalse<TConfiguration extends ComponentConfiguration>(\n option: boolean | TConfiguration,\n name: ComponentName | FallbackComponentName): void {\n if (option === undefined) {\n this._componentService.deactivate(name);\n return;\n }\n if (typeof option === \"boolean\") {\n if (option) {\n this._componentService.activate(name);\n } else {\n this._componentService.deactivate(name);\n }\n return;\n }\n this._componentService.configure(name, <TConfiguration>option);\n this._componentService.activate(name);\n }\n\n private _uTrue<TConfiguration extends ComponentConfiguration>(\n option: boolean | TConfiguration,\n name: ComponentName | FallbackComponentName): void {\n if (option === undefined) {\n this._componentService.activate(name);\n return;\n }\n if (typeof option === \"boolean\") {\n if (option) {\n this._componentService.activate(name);\n } else {\n this._componentService.deactivate(name);\n }\n return;\n }\n this._componentService.configure(name, <TConfiguration>option);\n this._componentService.activate(name);\n }\n}\n","import * as vd from \"virtual-dom\";\n\nimport {\n combineLatest as observableCombineLatest,\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport {\n distinctUntilChanged,\n filter,\n map,\n pluck,\n publishReplay,\n refCount,\n scan,\n} from \"rxjs/operators\";\n\nimport { RenderMode } from \"./RenderMode\";\nimport { RenderService } from \"./RenderService\";\nimport { ViewportSize } from \"./interfaces/ViewportSize\";\nimport { VirtualNodeHash } from \"./interfaces/VirtualNodeHash\";\n\nimport { AnimationFrame } from \"../state/interfaces/AnimationFrame\";\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\n\ninterface VirtualNodePatch {\n vNode: vd.VNode;\n vpatch: vd.VPatch[];\n}\n\ninterface VirtualNodeHashes {\n [name: string]: vd.VNode;\n}\n\ninterface OffsetStyle {\n bottom: number;\n left: number;\n right: number;\n top: number;\n}\n\ninterface AdaptiveCanvas {\n elementHeight: number;\n elementWidth: number;\n imageAspect: number;\n renderMode: RenderMode;\n}\n\ninterface AdaptiveRenderOperation {\n (adaptive: AdaptiveCanvas): AdaptiveCanvas;\n}\n\nexport class DOMRenderer {\n private _renderService: RenderService;\n private _currentFrame$: Observable<AnimationFrame>;\n\n private _adaptiveOperation$: Subject<AdaptiveRenderOperation> =\n new Subject<AdaptiveRenderOperation>();\n private _offset$: Observable<OffsetStyle>;\n\n private _element$: Observable<Element>;\n private _vPatch$: Observable<vd.VPatch[]>;\n private _vNode$: Observable<vd.VNode>;\n private _render$: Subject<VirtualNodeHash> = new Subject<VirtualNodeHash>();\n private _renderAdaptive$: Subject<VirtualNodeHash> = new Subject<VirtualNodeHash>();\n\n private _subscriptions: SubscriptionHolder = new SubscriptionHolder();\n\n constructor(\n element: HTMLElement,\n renderService: RenderService,\n currentFrame$: Observable<AnimationFrame>) {\n this._renderService = renderService;\n this._currentFrame$ = currentFrame$;\n\n const subs = this._subscriptions;\n\n const rootNode = vd.create(vd.h(\"div.mapillary-dom-renderer\", []));\n element.appendChild(rootNode);\n\n this._offset$ = this._adaptiveOperation$.pipe(\n scan(\n (adaptive: AdaptiveCanvas, operation: AdaptiveRenderOperation): AdaptiveCanvas => {\n return operation(adaptive);\n },\n {\n elementHeight: element.offsetHeight,\n elementWidth: element.offsetWidth,\n imageAspect: 0,\n renderMode: RenderMode.Fill,\n }),\n filter(\n (adaptive: AdaptiveCanvas): boolean => {\n return adaptive.imageAspect > 0 && adaptive.elementWidth > 0 && adaptive.elementHeight > 0;\n }),\n map(\n (adaptive: AdaptiveCanvas): OffsetStyle => {\n const elementAspect = adaptive.elementWidth / adaptive.elementHeight;\n const ratio = adaptive.imageAspect / elementAspect;\n\n let verticalOffset = 0;\n let horizontalOffset = 0;\n\n if (adaptive.renderMode === RenderMode.Letterbox) {\n if (adaptive.imageAspect > elementAspect) {\n verticalOffset = adaptive.elementHeight * (1 - 1 / ratio) / 2;\n } else {\n horizontalOffset = adaptive.elementWidth * (1 - ratio) / 2;\n }\n } else {\n if (adaptive.imageAspect > elementAspect) {\n horizontalOffset = -adaptive.elementWidth * (ratio - 1) / 2;\n } else {\n verticalOffset = -adaptive.elementHeight * (1 / ratio - 1) / 2;\n }\n }\n\n return {\n bottom: verticalOffset,\n left: horizontalOffset,\n right: horizontalOffset,\n top: verticalOffset,\n };\n }));\n\n const imageAspectSubscription = this._currentFrame$.pipe(\n filter(\n (frame: AnimationFrame): boolean => {\n return frame.state.currentImage != null;\n }),\n distinctUntilChanged(\n (k1: string, k2: string): boolean => {\n return k1 === k2;\n },\n (frame: AnimationFrame): string => {\n return frame.state.currentImage.id;\n }),\n map(\n (frame: AnimationFrame): number => {\n return frame.state.currentTransform.basicAspect;\n }),\n map(\n (aspect: number): AdaptiveRenderOperation => {\n return (adaptive: AdaptiveCanvas): AdaptiveCanvas => {\n adaptive.imageAspect = aspect;\n\n return adaptive;\n };\n }))\n .subscribe(this._adaptiveOperation$);\n\n const renderAdaptiveSubscription = observableCombineLatest(\n this._renderAdaptive$.pipe(\n scan(\n (vNodeHashes: VirtualNodeHashes, vNodeHash: VirtualNodeHash): VirtualNodeHashes => {\n if (vNodeHash.vNode == null) {\n delete vNodeHashes[vNodeHash.name];\n } else {\n vNodeHashes[vNodeHash.name] = vNodeHash.vNode;\n }\n return vNodeHashes;\n },\n {})),\n this._offset$).pipe(\n map(\n (vo: [VirtualNodeHashes, OffsetStyle]): VirtualNodeHash => {\n const vNodes: vd.VNode[] = [];\n const hashes: VirtualNodeHashes = vo[0];\n for (const name in hashes) {\n if (!hashes.hasOwnProperty(name)) {\n continue;\n }\n\n vNodes.push(hashes[name]);\n }\n\n const offset = vo[1];\n\n const properties: vd.createProperties = {\n style: {\n bottom: offset.bottom + \"px\",\n left: offset.left + \"px\",\n \"pointer-events\": \"none\",\n position: \"absolute\",\n right: offset.right + \"px\",\n top: offset.top + \"px\",\n },\n };\n\n return {\n name: \"mapillary-dom-adaptive-renderer\",\n vNode: vd.h(\"div.mapillary-dom-adaptive-renderer\", properties, vNodes),\n };\n }))\n .subscribe(this._render$);\n\n this._vNode$ = this._render$.pipe(\n scan(\n (vNodeHashes: VirtualNodeHashes, vNodeHash: VirtualNodeHash): VirtualNodeHashes => {\n if (vNodeHash.vNode == null) {\n delete vNodeHashes[vNodeHash.name];\n } else {\n vNodeHashes[vNodeHash.name] = vNodeHash.vNode;\n }\n\n return vNodeHashes;\n },\n {}),\n map(\n (hashes: VirtualNodeHashes): vd.VNode => {\n const vNodes: vd.VNode[] = [];\n for (const name in hashes) {\n if (!hashes.hasOwnProperty(name)) {\n continue;\n }\n\n vNodes.push(hashes[name]);\n }\n\n return vd.h(\"div.mapillary-dom-renderer\", vNodes);\n }));\n\n this._vPatch$ = this._vNode$.pipe(\n scan(\n (nodePatch: VirtualNodePatch, vNode: vd.VNode): VirtualNodePatch => {\n nodePatch.vpatch = vd.diff(nodePatch.vNode, vNode);\n nodePatch.vNode = vNode;\n return nodePatch;\n },\n { vNode: vd.h(\"div.mapillary-dom-renderer\", []), vpatch: null }),\n pluck(\"vpatch\"));\n\n this._element$ = this._vPatch$.pipe(\n scan(\n (oldElement: Element, vPatch: vd.VPatch[]): Element => {\n return vd.patch(oldElement, vPatch);\n },\n rootNode),\n publishReplay(1),\n refCount());\n\n subs.push(imageAspectSubscription);\n subs.push(renderAdaptiveSubscription);\n subs.push(this._element$.subscribe(() => { /*noop*/ }));\n\n subs.push(this._renderService.size$.pipe(\n map(\n (size: ViewportSize): AdaptiveRenderOperation => {\n return (adaptive: AdaptiveCanvas): AdaptiveCanvas => {\n adaptive.elementWidth = size.width;\n adaptive.elementHeight = size.height;\n\n return adaptive;\n };\n }))\n .subscribe(this._adaptiveOperation$));\n\n subs.push(this._renderService.renderMode$.pipe(\n map(\n (renderMode: RenderMode): AdaptiveRenderOperation => {\n return (adaptive: AdaptiveCanvas): AdaptiveCanvas => {\n adaptive.renderMode = renderMode;\n\n return adaptive;\n };\n }))\n .subscribe(this._adaptiveOperation$));\n }\n\n public get element$(): Observable<Element> {\n return this._element$;\n }\n\n public get render$(): Subject<VirtualNodeHash> {\n return this._render$;\n }\n\n public get renderAdaptive$(): Subject<VirtualNodeHash> {\n return this._renderAdaptive$;\n }\n\n public clear(name: string): void {\n this._renderAdaptive$.next({ name: name, vNode: null });\n this._render$.next({ name: name, vNode: null });\n }\n\n public remove(): void {\n this._subscriptions.unsubscribe();\n }\n}\n","import { map } from './map';\nimport { OperatorFunction } from '../types';\n\n/* tslint:disable:max-line-length */\nexport function pluck<T, K1 extends keyof T>(k1: K1): OperatorFunction<T, T[K1]>;\nexport function pluck<T, K1 extends keyof T, K2 extends keyof T[K1]>(k1: K1, k2: K2): OperatorFunction<T, T[K1][K2]>;\nexport function pluck<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(\n k1: K1,\n k2: K2,\n k3: K3\n): OperatorFunction<T, T[K1][K2][K3]>;\nexport function pluck<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(\n k1: K1,\n k2: K2,\n k3: K3,\n k4: K4\n): OperatorFunction<T, T[K1][K2][K3][K4]>;\nexport function pluck<\n T,\n K1 extends keyof T,\n K2 extends keyof T[K1],\n K3 extends keyof T[K1][K2],\n K4 extends keyof T[K1][K2][K3],\n K5 extends keyof T[K1][K2][K3][K4]\n>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5): OperatorFunction<T, T[K1][K2][K3][K4][K5]>;\nexport function pluck<\n T,\n K1 extends keyof T,\n K2 extends keyof T[K1],\n K3 extends keyof T[K1][K2],\n K4 extends keyof T[K1][K2][K3],\n K5 extends keyof T[K1][K2][K3][K4],\n K6 extends keyof T[K1][K2][K3][K4][K5]\n>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6): OperatorFunction<T, T[K1][K2][K3][K4][K5][K6]>;\nexport function pluck<\n T,\n K1 extends keyof T,\n K2 extends keyof T[K1],\n K3 extends keyof T[K1][K2],\n K4 extends keyof T[K1][K2][K3],\n K5 extends keyof T[K1][K2][K3][K4],\n K6 extends keyof T[K1][K2][K3][K4][K5]\n>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, ...rest: string[]): OperatorFunction<T, unknown>;\nexport function pluck<T>(...properties: string[]): OperatorFunction<T, unknown>;\n/* tslint:enable:max-line-length */\n\n/**\n * Maps each source value to its specified nested property.\n *\n * <span class=\"informal\">Like {@link map}, but meant only for picking one of\n * the nested properties of every emitted value.</span>\n *\n * ![](pluck.png)\n *\n * Given a list of strings or numbers describing a path to a property, retrieves\n * the value of a specified nested property from all values in the source\n * Observable. If a property can't be resolved, it will return `undefined` for\n * that value.\n *\n * ## Example\n * Map every click to the tagName of the clicked target element\n * ```ts\n * import { fromEvent } from 'rxjs';\n * import { pluck } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const tagNames = clicks.pipe(pluck('target', 'tagName'));\n * tagNames.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link map}\n *\n * @param properties The nested properties to pluck from each source\n * value.\n * @return A function that returns an Observable of property values from the\n * source values.\n * @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8.\n */\nexport function pluck<T, R>(...properties: Array<string | number | symbol>): OperatorFunction<T, R> {\n const length = properties.length;\n if (length === 0) {\n throw new Error('list of properties cannot be empty.');\n }\n return map((x) => {\n let currentProp: any = x;\n for (let i = 0; i < length; i++) {\n const p = currentProp?.[properties[i]];\n if (typeof p !== 'undefined') {\n currentProp = p;\n } else {\n return undefined;\n }\n }\n return currentProp;\n });\n}\n","import * as THREE from \"three\";\n\nimport {\n combineLatest as observableCombineLatest,\n merge as observableMerge,\n Observable,\n Subject,\n Subscription,\n} from \"rxjs\";\n\nimport {\n distinctUntilChanged,\n filter,\n first,\n map,\n mergeMap,\n publishReplay,\n refCount,\n scan,\n share,\n skip,\n startWith,\n} from \"rxjs/operators\";\n\nimport { RenderPass } from \"./RenderPass\";\nimport { RenderCamera } from \"./RenderCamera\";\nimport { RenderService } from \"./RenderService\";\nimport { GLFrameRenderer } from \"./interfaces/GLFrameRenderer\";\nimport { GLRenderFunction } from \"./interfaces/GLRenderFunction\";\nimport { GLRenderHash } from \"./interfaces/IGLRenderHash\";\nimport { ViewportSize } from \"./interfaces/ViewportSize\";\n\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\n\ninterface GLRendererStatus {\n needsRender: boolean;\n renderer: THREE.WebGLRenderer;\n}\n\ninterface GLRenderCamera {\n frameId: number;\n needsRender: boolean;\n perspective: THREE.PerspectiveCamera;\n}\n\ninterface GLRenderHashes {\n [name: string]: GLFrameRenderer;\n}\n\ninterface ForceRenderer {\n needsRender: boolean;\n}\n\ninterface GLRendererOperation {\n (renderer: GLRendererStatus): GLRendererStatus;\n}\n\ninterface GLRenderCameraOperation {\n (camera: GLRenderCamera): GLRenderCamera;\n}\n\ninterface GLRenderHashesOperation extends Function {\n (hashes: GLRenderHashes): GLRenderHashes;\n}\n\ninterface ForceRendererOperation {\n (forcer: ForceRenderer): ForceRenderer;\n}\n\ninterface GLRendererCombination {\n camera: GLRenderCamera;\n eraser: ForceRenderer;\n trigger: ForceRenderer;\n renderer: GLRendererStatus;\n renders: GLFrameRenderer[];\n}\n\nexport class GLRenderer {\n private _renderService: RenderService;\n\n private _renderFrame$: Subject<RenderCamera> =\n new Subject<RenderCamera>();\n\n private _renderCameraOperation$: Subject<GLRenderCameraOperation> =\n new Subject<GLRenderCameraOperation>();\n private _renderCamera$: Observable<GLRenderCamera>;\n\n private _render$: Subject<GLRenderHash> = new Subject<GLRenderHash>();\n private _clear$: Subject<string> = new Subject<string>();\n private _renderOperation$: Subject<GLRenderHashesOperation> =\n new Subject<GLRenderHashesOperation>();\n private _renderCollection$: Observable<GLRenderHashes>;\n\n private _rendererOperation$: Subject<GLRendererOperation> =\n new Subject<GLRendererOperation>();\n private _renderer$: Observable<GLRendererStatus>;\n\n private _eraserOperation$: Subject<ForceRendererOperation> = new Subject<ForceRendererOperation>();\n private _eraser$: Observable<ForceRenderer>;\n\n private _triggerOperation$: Subject<ForceRendererOperation> = new Subject<ForceRendererOperation>();\n\n private _webGLRenderer$: Observable<THREE.WebGLRenderer>;\n\n private _renderFrameSubscription: Subscription;\n private _subscriptions: SubscriptionHolder = new SubscriptionHolder();\n\n private _opaqueRender$: Subject<void> = new Subject<void>();\n\n constructor(\n canvas: HTMLCanvasElement,\n canvasContainer: HTMLElement,\n renderService: RenderService) {\n this._renderService = renderService;\n const subs = this._subscriptions;\n\n this._renderer$ = this._rendererOperation$.pipe(\n scan(\n (renderer: GLRendererStatus, operation: GLRendererOperation): GLRendererStatus => {\n return operation(renderer);\n },\n { needsRender: false, renderer: null }),\n filter(\n (renderer: GLRendererStatus): boolean => {\n return !!renderer.renderer;\n }));\n\n this._renderCollection$ = this._renderOperation$.pipe(\n scan(\n (hashes: GLRenderHashes, operation: GLRenderHashesOperation): GLRenderHashes => {\n return operation(hashes);\n },\n {}),\n share());\n\n this._renderCamera$ = this._renderCameraOperation$.pipe(\n scan(\n (rc: GLRenderCamera, operation: GLRenderCameraOperation): GLRenderCamera => {\n return operation(rc);\n },\n { frameId: -1, needsRender: false, perspective: null }));\n\n this._eraser$ = this._eraserOperation$.pipe(\n startWith(\n (eraser: ForceRenderer): ForceRenderer => {\n return eraser;\n }),\n scan(\n (eraser: ForceRenderer, operation: ForceRendererOperation): ForceRenderer => {\n return operation(eraser);\n },\n { needsRender: false }));\n\n const trigger$ = this._triggerOperation$.pipe(\n startWith(\n (trigger: ForceRenderer): ForceRenderer => {\n return trigger;\n }),\n scan(\n (trigger: ForceRenderer, operation: ForceRendererOperation): ForceRenderer => {\n return operation(trigger);\n },\n { needsRender: false }));\n\n const clearColor = new THREE.Color(0x0F0F0F);\n const renderSubscription = observableCombineLatest(\n this._renderer$,\n this._renderCollection$,\n this._renderCamera$,\n this._eraser$,\n trigger$).pipe(\n map(\n ([renderer, hashes, rc, eraser, trigger]:\n [GLRendererStatus, GLRenderHashes, GLRenderCamera, ForceRenderer, ForceRenderer]): GLRendererCombination => {\n const renders: GLFrameRenderer[] = Object.keys(hashes)\n .map((key: string): GLFrameRenderer => {\n return hashes[key];\n });\n\n return { camera: rc, eraser: eraser, trigger: trigger, renderer: renderer, renders: renders };\n }),\n filter(\n (co: GLRendererCombination): boolean => {\n let needsRender: boolean =\n co.renderer.needsRender ||\n co.camera.needsRender ||\n co.eraser.needsRender ||\n co.trigger.needsRender;\n\n const frameId: number = co.camera.frameId;\n\n for (const render of co.renders) {\n if (render.frameId !== frameId) {\n return false;\n }\n\n needsRender = needsRender || render.needsRender;\n }\n\n return needsRender;\n }),\n distinctUntilChanged(\n (n1: number, n2: number): boolean => {\n return n1 === n2;\n },\n (co: GLRendererCombination): number => {\n return co.eraser.needsRender ||\n co.trigger.needsRender ? -co.camera.frameId : co.camera.frameId;\n }))\n .subscribe(\n (co: GLRendererCombination): void => {\n co.renderer.needsRender = false;\n co.camera.needsRender = false;\n co.eraser.needsRender = false;\n co.trigger.needsRender = false;\n\n const perspectiveCamera = co.camera.perspective;\n\n const backgroundRenders: GLRenderFunction[] = [];\n const opaqueRenders: GLRenderFunction[] = [];\n\n for (const render of co.renders) {\n if (render.pass === RenderPass.Background) {\n backgroundRenders.push(render.render);\n } else if (render.pass === RenderPass.Opaque) {\n opaqueRenders.push(render.render);\n }\n }\n\n const renderer = co.renderer.renderer;\n renderer.resetState();\n renderer.setClearColor(clearColor, 1.0);\n renderer.clear();\n\n for (const renderBackground of backgroundRenders) {\n renderBackground(perspectiveCamera, renderer);\n }\n\n renderer.clearDepth();\n\n for (const renderOpaque of opaqueRenders) {\n renderOpaque(perspectiveCamera, renderer);\n }\n\n renderer.resetState();\n\n this._opaqueRender$.next();\n });\n\n subs.push(renderSubscription);\n subs.push(this._renderFrame$.pipe(\n map(\n (rc: RenderCamera): GLRenderCameraOperation => {\n return (irc: GLRenderCamera): GLRenderCamera => {\n irc.frameId = rc.frameId;\n irc.perspective = rc.perspective;\n\n if (rc.changed === true) {\n irc.needsRender = true;\n }\n\n return irc;\n };\n }))\n .subscribe(this._renderCameraOperation$));\n\n this._renderFrameSubscribe();\n\n const renderHash$ = this._render$.pipe(\n map(\n (hash: GLRenderHash) => {\n return (hashes: GLRenderHashes): GLRenderHashes => {\n hashes[hash.name] = hash.renderer;\n\n return hashes;\n };\n }));\n\n const clearHash$ = this._clear$.pipe(\n map(\n (name: string) => {\n return (hashes: GLRenderHashes): GLRenderHashes => {\n delete hashes[name];\n\n return hashes;\n };\n }));\n\n subs.push(observableMerge(renderHash$, clearHash$)\n .subscribe(this._renderOperation$));\n\n this._webGLRenderer$ = this._render$.pipe(\n first(),\n map(\n (): THREE.WebGLRenderer => {\n canvasContainer.appendChild(canvas);\n const element = renderService.element;\n const webGLRenderer = new THREE.WebGLRenderer({ canvas: canvas });\n webGLRenderer.setPixelRatio(window.devicePixelRatio);\n webGLRenderer.setSize(element.offsetWidth, element.offsetHeight);\n webGLRenderer.autoClear = false;\n\n return webGLRenderer;\n }),\n publishReplay(1),\n refCount());\n\n subs.push(this._webGLRenderer$\n .subscribe(() => { /*noop*/ }));\n\n const createRenderer$ = this._webGLRenderer$.pipe(\n first(),\n map(\n (webGLRenderer: THREE.WebGLRenderer): GLRendererOperation => {\n return (renderer: GLRendererStatus): GLRendererStatus => {\n renderer.needsRender = true;\n renderer.renderer = webGLRenderer;\n\n return renderer;\n };\n }));\n\n const resizeRenderer$ = this._renderService.size$.pipe(\n map(\n (size: ViewportSize): GLRendererOperation => {\n return (renderer: GLRendererStatus): GLRendererStatus => {\n if (renderer.renderer == null) {\n return renderer;\n }\n\n renderer.renderer.setSize(size.width, size.height);\n renderer.needsRender = true;\n\n return renderer;\n };\n }));\n\n const clearRenderer$ = this._clear$.pipe(\n map(\n () => {\n return (renderer: GLRendererStatus): GLRendererStatus => {\n if (renderer.renderer == null) {\n return renderer;\n }\n\n renderer.needsRender = true;\n\n return renderer;\n };\n }));\n\n subs.push(observableMerge(\n createRenderer$,\n resizeRenderer$,\n clearRenderer$)\n .subscribe(this._rendererOperation$));\n\n const renderCollectionEmpty$ = this._renderCollection$.pipe(\n filter(\n (hashes: GLRenderHashes): boolean => {\n return Object.keys(hashes).length === 0;\n }),\n share());\n\n subs.push(renderCollectionEmpty$\n .subscribe(\n (): void => {\n if (this._renderFrameSubscription == null) {\n return;\n }\n\n this._renderFrameSubscription.unsubscribe();\n this._renderFrameSubscription = null;\n\n this._renderFrameSubscribe();\n }));\n\n subs.push(renderCollectionEmpty$.pipe(\n map(\n (): ForceRendererOperation => {\n return (eraser: ForceRenderer): ForceRenderer => {\n eraser.needsRender = true;\n\n return eraser;\n };\n }))\n .subscribe(this._eraserOperation$));\n }\n\n public get render$(): Subject<GLRenderHash> {\n return this._render$;\n }\n\n public get opaqueRender$(): Observable<void> {\n return this._opaqueRender$;\n }\n\n public get webGLRenderer$(): Observable<THREE.WebGLRenderer> {\n return this._webGLRenderer$;\n }\n\n public clear(name: string): void {\n this._clear$.next(name);\n }\n\n public remove(): void {\n this._rendererOperation$.next(\n (renderer: GLRendererStatus): GLRendererStatus => {\n if (renderer.renderer != null) {\n const extension = renderer.renderer\n .getContext()\n .getExtension('WEBGL_lose_context');\n if (!!extension) {\n extension.loseContext();\n }\n\n renderer.renderer = null;\n }\n\n return renderer;\n });\n\n if (this._renderFrameSubscription != null) {\n this._renderFrameSubscription.unsubscribe();\n }\n\n this._subscriptions.unsubscribe();\n }\n\n public triggerRerender(): void {\n this._renderService.renderCameraFrame$\n .pipe(\n skip(1),\n first())\n .subscribe(\n (): void => {\n this._triggerOperation$.next(\n (trigger: ForceRenderer): ForceRenderer => {\n trigger.needsRender = true;\n return trigger;\n });\n });\n }\n\n private _renderFrameSubscribe(): void {\n this._render$.pipe(\n first(),\n map(\n (): GLRenderCameraOperation => {\n return (irc: GLRenderCamera): GLRenderCamera => {\n irc.needsRender = true;\n\n return irc;\n };\n }))\n .subscribe(\n (operation: GLRenderCameraOperation): void => {\n this._renderCameraOperation$.next(operation);\n });\n\n this._renderFrameSubscription = this._render$.pipe(\n first(),\n mergeMap(\n (): Observable<RenderCamera> => {\n return this._renderService.renderCameraFrame$;\n }))\n .subscribe(this._renderFrame$);\n }\n}\n","import * as THREE from \"three\";\nimport { isSpherical } from \"./Geo\";\n\nimport { Transform } from \"./Transform\";\n\n/**\n * @class Camera\n *\n * @classdesc Holds information about a camera.\n */\nexport class Camera {\n private _position: THREE.Vector3;\n private _lookat: THREE.Vector3;\n private _up: THREE.Vector3;\n private _focal: number;\n\n /**\n * Create a new camera instance.\n * @param {Transform} [transform] - Optional transform instance.\n */\n constructor(transform?: Transform) {\n if (transform != null) {\n this._position = new THREE.Vector3().fromArray(transform.unprojectSfM([0, 0], 0));\n this._lookat = new THREE.Vector3().fromArray(transform.unprojectSfM([0, 0], 10));\n this._up = transform.upVector();\n this._focal = this._getFocal(transform);\n } else {\n this._position = new THREE.Vector3(0, 0, 0);\n this._lookat = new THREE.Vector3(1, 0, 0);\n this._up = new THREE.Vector3(0, 0, 1);\n this._focal = 1;\n }\n }\n\n /**\n * Get position.\n * @returns {THREE.Vector3} The position vector.\n */\n public get position(): THREE.Vector3 {\n return this._position;\n }\n\n /**\n * Get lookat.\n * @returns {THREE.Vector3} The lookat vector.\n */\n public get lookat(): THREE.Vector3 {\n return this._lookat;\n }\n\n /**\n * Get up.\n * @returns {THREE.Vector3} The up vector.\n */\n public get up(): THREE.Vector3 {\n return this._up;\n }\n\n /**\n * Get focal.\n * @returns {number} The focal length.\n */\n public get focal(): number {\n return this._focal;\n }\n\n /**\n * Set focal.\n */\n public set focal(value: number) {\n this._focal = value;\n }\n\n /**\n * Update this camera to the linearly interpolated value of two other cameras.\n *\n * @param {Camera} a - First camera.\n * @param {Camera} b - Second camera.\n * @param {number} alpha - Interpolation value on the interval [0, 1].\n */\n public lerpCameras(a: Camera, b: Camera, alpha: number): void {\n this._position.subVectors(b.position, a.position).multiplyScalar(alpha).add(a.position);\n this._lookat.subVectors(b.lookat, a.lookat).multiplyScalar(alpha).add(a.lookat);\n this._up.subVectors(b.up, a.up).multiplyScalar(alpha).add(a.up);\n this._focal = (1 - alpha) * a.focal + alpha * b.focal;\n }\n\n /**\n * Copy the properties of another camera to this camera.\n *\n * @param {Camera} other - Another camera.\n */\n public copy(other: Camera): void {\n this._position.copy(other.position);\n this._lookat.copy(other.lookat);\n this._up.copy(other.up);\n this._focal = other.focal;\n }\n\n /**\n * Clone this camera.\n *\n * @returns {Camera} A camera with cloned properties equal to this camera.\n */\n public clone(): Camera {\n let camera: Camera = new Camera();\n\n camera.position.copy(this._position);\n camera.lookat.copy(this._lookat);\n camera.up.copy(this._up);\n camera.focal = this._focal;\n\n return camera;\n }\n\n /**\n * Determine the distance between this camera and another camera.\n *\n * @param {Camera} other - Another camera.\n * @returns {number} The distance between the cameras.\n */\n public diff(other: Camera): number {\n let pd: number = this._position.distanceToSquared(other.position);\n let ld: number = this._lookat.distanceToSquared(other.lookat);\n let ud: number = this._up.distanceToSquared(other.up);\n let fd: number = 100 * Math.abs(this._focal - other.focal);\n\n return Math.max(pd, ld, ud, fd);\n }\n\n /**\n * Get the focal length based on the transform.\n *\n * @description Returns the focal length corresponding\n * to a 90 degree field of view for spherical\n * transforms.\n *\n * Returns the transform focal length for other\n * projection types.\n *\n * @returns {number} Focal length.\n */\n private _getFocal(transform: Transform): number {\n if (!isSpherical(transform.cameraType)) {\n return transform.focal;\n }\n\n return 0.5 / Math.tan(Math.PI / 2);\n }\n}\n","import * as THREE from \"three\";\n\nimport * as Geo from \"../geo/Geo\";\n\nimport { RenderMode } from \"./RenderMode\";\nimport { ViewportSize } from \"./interfaces/ViewportSize\";\n\nimport { Camera } from \"../geo/Camera\";\nimport { Spatial } from \"../geo/Spatial\";\nimport { Transform } from \"../geo/Transform\";\nimport { ViewportCoords } from \"../geo/ViewportCoords\";\nimport { State } from \"../state/State\";\nimport { AnimationFrame } from \"../state/interfaces/AnimationFrame\";\nimport { EulerRotation } from \"../state/interfaces/EulerRotation\";\nimport { isSpherical } from \"../geo/Geo\";\nimport { MathUtils } from \"three\";\n\nexport class RenderCamera {\n private _spatial: Spatial;\n private _viewportCoords: ViewportCoords;\n\n private _alpha: number;\n private _stateTransitionAlpha: number;\n private _stateTransitionFov: number;\n private _renderMode: RenderMode;\n private _zoom: number;\n private _frameId: number;\n\n private _size: ViewportSize;\n\n private _camera: Camera;\n private _perspective: THREE.PerspectiveCamera;\n\n private _rotation: EulerRotation;\n\n private _changed: boolean;\n private _changedForFrame: number;\n\n private _currentImageId: string;\n private _previousImageId: string;\n\n private _currentSpherical: boolean;\n private _previousSpherical: boolean;\n\n private _state: State;\n\n private _currentProjectedPoints: number[][];\n private _previousProjectedPoints: number[][];\n\n private _currentFov: number;\n private _previousFov: number;\n\n private _initialFov: number;\n\n constructor(\n elementWidth: number,\n elementHeight: number,\n renderMode: RenderMode) {\n\n this._spatial = new Spatial();\n this._viewportCoords = new ViewportCoords();\n\n this._size = { width: elementWidth, height: elementHeight };\n\n this._initialFov = 60;\n\n this._alpha = -1;\n this._stateTransitionAlpha = -1;\n this._stateTransitionFov = -1;\n this._renderMode = renderMode;\n this._zoom = 0;\n\n this._frameId = -1;\n\n this._changed = false;\n this._changedForFrame = -1;\n\n this._currentImageId = null;\n this._previousImageId = null;\n\n this._currentSpherical = false;\n this._previousSpherical = false;\n\n this._state = null;\n\n this._currentProjectedPoints = [];\n this._previousProjectedPoints = [];\n\n this._currentFov = this._initialFov;\n this._previousFov = this._initialFov;\n\n this._camera = new Camera();\n\n this._perspective = new THREE.PerspectiveCamera(\n this._initialFov,\n this._computeAspect(elementWidth, elementHeight),\n 0.1,\n 10000);\n this._perspective.position.copy(this._camera.position);\n this._perspective.up.copy(this._camera.up);\n this._perspective.lookAt(this._camera.lookat);\n this._perspective.updateMatrixWorld(true);\n\n this._perspective.matrixAutoUpdate = false;\n\n this._rotation = { phi: 0, theta: 0 };\n }\n\n public get alpha(): number {\n return this._alpha;\n }\n\n public get camera(): Camera {\n return this._camera;\n }\n\n public get changed(): boolean {\n return this._frameId === this._changedForFrame;\n }\n\n public get frameId(): number {\n return this._frameId;\n }\n\n public get perspective(): THREE.PerspectiveCamera {\n return this._perspective;\n }\n\n public get renderMode(): RenderMode {\n return this._renderMode;\n }\n\n public get rotation(): EulerRotation {\n return this._rotation;\n }\n\n public get zoom(): number {\n return this._zoom;\n }\n\n public get size(): ViewportSize {\n return this._size;\n }\n\n public getTilt(): number {\n return 90 - this._spatial.radToDeg(this._rotation.theta);\n }\n\n public fovToZoom(fov: number): number {\n fov = Math.min(90, Math.max(0, fov));\n\n const currentFov = this._computeCurrentFov(0);\n const actualFov = this._alpha === 1 ?\n currentFov :\n this._interpolateFov(currentFov, this._computePreviousFov(0), this._alpha);\n\n const y0 = Math.tan(actualFov / 2 * Math.PI / 180);\n const y1 = Math.tan(fov / 2 * Math.PI / 180);\n\n const zoom = Math.log(y0 / y1) / Math.log(2);\n\n return zoom;\n }\n\n public setFrame(frame: AnimationFrame): void {\n const state = frame.state;\n\n if (state.state !== this._state) {\n this._state = state.state;\n if (this._state !== State.Custom) {\n this.setRenderMode(this._renderMode);\n this.setSize(this._size);\n }\n if (this._state === State.Earth) {\n const y = this._fovToY(this._perspective.fov, this._zoom);\n this._stateTransitionFov = this._yToFov(y, 0);\n }\n\n this._changed = true;\n }\n\n const currentImageId = state.currentImage.id;\n const previousImageId = !!state.previousImage ? state.previousImage.id : null;\n\n if (currentImageId !== this._currentImageId) {\n this._currentImageId = currentImageId;\n this._currentSpherical = isSpherical(state.currentTransform.cameraType);\n this._currentProjectedPoints = this._computeProjectedPoints(state.currentTransform);\n\n this._changed = true;\n }\n\n if (previousImageId !== this._previousImageId) {\n this._previousImageId = previousImageId;\n this._previousSpherical =\n isSpherical(state.previousTransform.cameraType);\n this._previousProjectedPoints = this._computeProjectedPoints(state.previousTransform);\n\n this._changed = true;\n }\n\n const zoom = state.zoom;\n if (zoom !== this._zoom) {\n this._changed = true;\n }\n\n if (this._changed) {\n this._currentFov = this._computeCurrentFov(zoom);\n this._previousFov = this._computePreviousFov(zoom);\n }\n\n const alpha = state.alpha;\n const sta = state.stateTransitionAlpha;\n if (this._changed ||\n alpha !== this._alpha ||\n sta !== this._stateTransitionAlpha) {\n\n this._alpha = alpha;\n this._stateTransitionAlpha = sta;\n\n switch (this._state) {\n case State.Earth: {\n const startFov = this._stateTransitionFov;\n const endFov = this._focalToFov(state.camera.focal);\n const fov = MathUtils.lerp(startFov, endFov, sta);\n const y = this._fovToY(fov, 0);\n this._perspective.fov = this._yToFov(y, zoom);\n break;\n }\n case State.Custom:\n break;\n default:\n this._perspective.fov =\n this._interpolateFov(\n this._currentFov,\n this._previousFov,\n this._alpha);\n this._changed = true;\n break;\n }\n\n this._zoom = zoom;\n\n if (this._state !== State.Custom) {\n this._perspective.updateProjectionMatrix();\n }\n }\n\n const camera: Camera = state.camera;\n\n if (this._camera.diff(camera) > 1e-9) {\n this._camera.copy(camera);\n\n this._rotation = this._computeRotation(camera);\n\n this._perspective.up.copy(camera.up);\n this._perspective.position.copy(camera.position);\n\n // Workaround for shaking camera\n this._perspective.matrixAutoUpdate = true;\n this._perspective.lookAt(camera.lookat);\n this._perspective.matrixAutoUpdate = false;\n\n this._perspective.updateMatrix();\n this._perspective.updateMatrixWorld(false);\n\n this._changed = true;\n }\n\n this._setFrameId(frame.id);\n }\n\n public setProjectionMatrix(matrix: number[]): void {\n this._perspective.fov = this._focalToFov(matrix[5] / 2);\n this._perspective.projectionMatrix.fromArray(matrix);\n this._perspective.projectionMatrixInverse\n .copy(this._perspective.projectionMatrix)\n .invert();\n\n this._changed = true;\n }\n\n public setRenderMode(renderMode: RenderMode): void {\n this._renderMode = renderMode;\n\n if (this._state === State.Custom) {\n return;\n }\n\n this._perspective.fov = this._computeFov();\n this._perspective.updateProjectionMatrix();\n\n this._changed = true;\n }\n\n public setSize(size: ViewportSize): void {\n this._size = size;\n\n if (this._state === State.Custom) {\n return;\n }\n\n this._perspective.aspect = this._computeAspect(size.width, size.height);\n this._perspective.fov = this._computeFov();\n this._perspective.updateProjectionMatrix();\n\n this._changed = true;\n }\n\n private _computeAspect(elementWidth: number, elementHeight: number): number {\n return elementWidth === 0 ? 0 : elementWidth / elementHeight;\n }\n\n private _computeCurrentFov(zoom: number): number {\n if (this._perspective.aspect === 0) {\n return 0;\n }\n\n if (!this._currentImageId) {\n return this._initialFov;\n }\n\n return this._currentSpherical ?\n this._yToFov(1, zoom) :\n this._computeVerticalFov(this._currentProjectedPoints, this._renderMode, zoom, this.perspective.aspect);\n }\n\n private _computeFov(): number {\n this._currentFov = this._computeCurrentFov(this._zoom);\n this._previousFov = this._computePreviousFov(this._zoom);\n\n return this._interpolateFov(this._currentFov, this._previousFov, this._alpha);\n }\n\n private _computePreviousFov(zoom: number): number {\n if (this._perspective.aspect === 0) {\n return 0;\n }\n\n if (!this._currentImageId) {\n return this._initialFov;\n }\n\n return !this._previousImageId ?\n this._currentFov :\n this._previousSpherical ?\n this._yToFov(1, zoom) :\n this._computeVerticalFov(this._previousProjectedPoints, this._renderMode, zoom, this.perspective.aspect);\n }\n\n private _computeProjectedPoints(transform: Transform): number[][] {\n const vertices = [[0.5, 0], [1, 0]];\n const directions = [[0.5, 0], [0, 0.5]];\n const pointsPerLine = 100;\n\n return Geo.computeProjectedPoints(transform, vertices, directions, pointsPerLine, this._viewportCoords);\n }\n\n private _computeRequiredVerticalFov(\n projectedPoint: number[],\n zoom: number,\n aspect: number): number {\n const maxY = Math.max(projectedPoint[0] / aspect, projectedPoint[1]);\n\n return this._yToFov(maxY, zoom);\n }\n\n private _computeRotation(camera: Camera): EulerRotation {\n let direction: THREE.Vector3 = camera.lookat.clone().sub(camera.position);\n let up: THREE.Vector3 = camera.up.clone();\n\n let phi = this._spatial.azimuthal(direction.toArray(), up.toArray());\n let theta = Math.PI / 2 - this._spatial.angleToPlane(direction.toArray(), [0, 0, 1]);\n\n return { phi: phi, theta: theta };\n }\n\n private _computeVerticalFov(\n projectedPoints: number[][],\n renderMode: RenderMode,\n zoom: number,\n aspect: number): number {\n\n const fovs = projectedPoints\n .map(\n (projectedPoint: number[]): number => {\n return this._computeRequiredVerticalFov(projectedPoint, zoom, aspect);\n });\n\n const fov = renderMode === RenderMode.Fill ?\n Math.min(...fovs) * 0.995 :\n Math.max(...fovs);\n\n return fov;\n }\n\n private _yToFov(y: number, zoom: number): number {\n return 2 * Math.atan(y / Math.pow(2, zoom)) * 180 / Math.PI;\n }\n\n private _focalToFov(focal: number): number {\n return 2 * Math.atan2(1, 2 * focal) * 180 / Math.PI;\n }\n\n private _fovToY(fov: number, zoom: number): number {\n return Math.pow(2, zoom) * Math.tan(Math.PI * fov / 360);\n }\n\n private _interpolateFov(v1: number, v2: number, alpha: number): number {\n return alpha * v1 + (1 - alpha) * v2;\n }\n\n private _setFrameId(frameId: number): void {\n this._frameId = frameId;\n\n if (this._changed) {\n this._changed = false;\n this._changedForFrame = frameId;\n }\n }\n}\n","import {\n filter,\n map,\n publishReplay,\n refCount,\n scan,\n skip,\n startWith,\n tap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport {\n BehaviorSubject,\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport { RenderCamera } from \"./RenderCamera\";\nimport { RenderMode } from \"./RenderMode\";\nimport { ViewportSize } from \"./interfaces/ViewportSize\";\n\nimport { Spatial } from \"../geo/Spatial\";\nimport { AnimationFrame } from \"../state/interfaces/AnimationFrame\";\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\n\ninterface RenderCameraOperation {\n (rc: RenderCamera): RenderCamera;\n}\n\nexport class RenderService {\n private _bearing$: Observable<number>;\n\n private _element: HTMLElement;\n private _currentFrame$: Observable<AnimationFrame>;\n\n private _projectionMatrix$: Subject<number[]>;\n\n private _renderCameraOperation$: Subject<RenderCameraOperation>;\n private _renderCameraHolder$: Observable<RenderCamera>;\n private _renderCameraFrame$: Observable<RenderCamera>;\n private _renderCamera$: Observable<RenderCamera>;\n\n private _resize$: Subject<void>;\n private _size$: BehaviorSubject<ViewportSize>;\n\n private _spatial: Spatial;\n\n private _renderMode$: BehaviorSubject<RenderMode>;\n\n private _subscriptions: SubscriptionHolder = new SubscriptionHolder();\n\n constructor(\n element: HTMLElement,\n currentFrame$: Observable<AnimationFrame>,\n renderMode: RenderMode,\n renderCamera?: RenderCamera) {\n\n this._element = element;\n this._currentFrame$ = currentFrame$;\n\n this._spatial = new Spatial();\n\n renderMode = renderMode != null ? renderMode : RenderMode.Fill;\n\n this._resize$ = new Subject<void>();\n this._projectionMatrix$ = new Subject<number[]>();\n this._renderCameraOperation$ =\n new Subject<RenderCameraOperation>();\n\n this._size$ =\n new BehaviorSubject<ViewportSize>({\n height: this._element.offsetHeight,\n width: this._element.offsetWidth,\n });\n\n const subs = this._subscriptions;\n subs.push(this._resize$.pipe(\n map(\n (): ViewportSize => {\n return {\n height: this._element.offsetHeight,\n width: this._element.offsetWidth,\n };\n }))\n .subscribe(this._size$));\n\n this._renderMode$ = new BehaviorSubject<RenderMode>(renderMode);\n\n this._renderCameraHolder$ = this._renderCameraOperation$.pipe(\n startWith(\n (rc: RenderCamera): RenderCamera => {\n return rc;\n }),\n scan(\n (rc: RenderCamera, operation: RenderCameraOperation): RenderCamera => {\n return operation(rc);\n },\n renderCamera ??\n new RenderCamera(\n this._element.offsetWidth,\n this._element.offsetHeight,\n renderMode)),\n publishReplay(1),\n refCount());\n\n this._renderCameraFrame$ = this._currentFrame$.pipe(\n withLatestFrom(this._renderCameraHolder$),\n tap(\n ([frame, rc]: [AnimationFrame, RenderCamera]): void => {\n rc.setFrame(frame);\n }),\n map(\n (args: [AnimationFrame, RenderCamera]): RenderCamera => {\n return args[1];\n }),\n publishReplay(1),\n refCount());\n\n this._renderCamera$ = this._renderCameraFrame$.pipe(\n filter(\n (rc: RenderCamera): boolean => {\n return rc.changed;\n }),\n publishReplay(1),\n refCount());\n\n this._bearing$ = this._renderCamera$.pipe(\n map(\n (rc: RenderCamera): number => {\n let bearing: number =\n this._spatial.radToDeg(\n this._spatial.azimuthalToBearing(rc.rotation.phi));\n\n return this._spatial.wrap(bearing, 0, 360);\n }),\n publishReplay(1),\n refCount());\n\n subs.push(this._size$.pipe(\n skip(1),\n map(\n (size: ViewportSize) => {\n return (rc: RenderCamera): RenderCamera => {\n rc.setSize(size);\n\n return rc;\n };\n }))\n .subscribe(this._renderCameraOperation$));\n\n subs.push(this._renderMode$.pipe(\n skip(1),\n map(\n (rm: RenderMode) => {\n return (rc: RenderCamera): RenderCamera => {\n rc.setRenderMode(rm);\n\n return rc;\n };\n }))\n .subscribe(this._renderCameraOperation$));\n\n subs.push(this._projectionMatrix$.pipe(\n map(\n (projectionMatrix: number[]) => {\n return (rc: RenderCamera): RenderCamera => {\n rc.setProjectionMatrix(projectionMatrix);\n\n return rc;\n };\n }))\n .subscribe(this._renderCameraOperation$));\n\n subs.push(this._bearing$.subscribe(() => { /*noop*/ }));\n subs.push(this._renderCameraHolder$.subscribe(() => { /*noop*/ }));\n subs.push(this._size$.subscribe(() => { /*noop*/ }));\n subs.push(this._renderMode$.subscribe(() => { /*noop*/ }));\n subs.push(this._renderCamera$.subscribe(() => { /*noop*/ }));\n subs.push(this._renderCameraFrame$.subscribe(() => { /*noop*/ }));\n }\n\n public get bearing$(): Observable<number> {\n return this._bearing$;\n }\n\n public get element(): HTMLElement {\n return this._element;\n }\n\n public get projectionMatrix$(): Subject<number[]> {\n return this._projectionMatrix$;\n }\n\n public get renderCamera$(): Observable<RenderCamera> {\n return this._renderCamera$;\n }\n\n public get renderCameraFrame$(): Observable<RenderCamera> {\n return this._renderCameraFrame$;\n }\n\n public get renderMode$(): Subject<RenderMode> {\n return this._renderMode$;\n }\n\n public get resize$(): Subject<void> {\n return this._resize$;\n }\n\n public get size$(): Observable<ViewportSize> {\n return this._size$;\n }\n\n public dispose(): void {\n this._subscriptions.unsubscribe();\n }\n}\n","import {\n fromEvent as observableFromEvent,\n Observable,\n} from \"rxjs\";\n\nexport class KeyboardService {\n private _keyDown$: Observable<KeyboardEvent>;\n private _keyUp$: Observable<KeyboardEvent>;\n\n constructor(canvasContainer: HTMLElement) {\n this._keyDown$ = observableFromEvent<KeyboardEvent>(canvasContainer, \"keydown\");\n this._keyUp$ = observableFromEvent<KeyboardEvent>(canvasContainer, \"keyup\");\n }\n\n public get keyDown$(): Observable<KeyboardEvent> {\n return this._keyDown$;\n }\n\n public get keyUp$(): Observable<KeyboardEvent> {\n return this._keyUp$;\n }\n}\n","import {\n combineLatest as observableCombineLatest,\n concat as observableConcat,\n fromEvent as observableFromEvent,\n merge as observableMerge,\n of as observableOf,\n BehaviorSubject,\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport {\n bufferCount,\n distinctUntilChanged,\n filter,\n first,\n map,\n publishReplay,\n refCount,\n scan,\n share,\n startWith,\n switchMap,\n take,\n takeUntil,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { MouseClaim } from \"./interfaces/MouseClaim\";\nimport { MousePixelDeferral } from \"./interfaces/MousePixelDeferral\";\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\n\ntype Button =\n | 0\n | 2;\n\n// MouseEvent.button\nconst LEFT_BUTTON: Button = 0;\nconst RIGHT_BUTTON: Button = 2;\n\n// MouseEvent.buttons\nconst BUTTONS_MAP = {\n [LEFT_BUTTON]: 1,\n [RIGHT_BUTTON]: 2\n};\n\ntype PointerType =\n | \"mouse\"\n | \"pen\"\n | \"touch\";\n\ninterface FirefoxBrowser {\n InstallTrigger: undefined;\n}\n\nexport class MouseService {\n private _activeSubject$: BehaviorSubject<boolean>;\n private _active$: Observable<boolean>;\n\n private _domMouseDown$: Observable<PointerEvent>;\n private _domMouseMove$: Observable<PointerEvent>;\n\n private _domMouseDragStart$: Observable<PointerEvent>;\n private _domMouseDrag$: Observable<PointerEvent>;\n private _domMouseDragEnd$: Observable<MouseEvent | FocusEvent>;\n\n private _documentMouseMove$: Observable<PointerEvent>;\n private _documentMouseUp$: Observable<PointerEvent>;\n\n private _mouseDown$: Observable<PointerEvent>;\n private _mouseEnter$: Observable<PointerEvent>;\n private _mouseMove$: Observable<PointerEvent>;\n private _mouseLeave$: Observable<PointerEvent>;\n private _mouseUp$: Observable<PointerEvent>;\n private _mouseOut$: Observable<PointerEvent>;\n private _mouseOver$: Observable<PointerEvent>;\n\n private _contextMenu$: Observable<MouseEvent>;\n private _consistentContextMenu$: Observable<MouseEvent>;\n private _click$: Observable<MouseEvent>;\n private _dblClick$: Observable<MouseEvent>;\n private _deferPixelClaims$: Subject<MousePixelDeferral>;\n private _deferPixels$: Observable<number>;\n private _proximateClick$: Observable<MouseEvent>;\n private _staticClick$: Observable<MouseEvent>;\n\n private _mouseWheel$: Observable<WheelEvent>;\n\n private _mouseDragStart$: Observable<PointerEvent>;\n private _mouseDrag$: Observable<PointerEvent>;\n private _mouseDragEnd$: Observable<PointerEvent | FocusEvent>;\n\n private _mouseRightDragStart$: Observable<PointerEvent>;\n private _mouseRightDrag$: Observable<PointerEvent>;\n private _mouseRightDragEnd$: Observable<PointerEvent | FocusEvent>;\n\n private _claimMouse$: Subject<MouseClaim>;\n private _claimWheel$: Subject<MouseClaim>;\n\n private _mouseOwner$: Observable<string>;\n private _wheelOwner$: Observable<string>;\n\n private _windowBlur$: Observable<FocusEvent>;\n\n private _subscriptions: SubscriptionHolder = new SubscriptionHolder();\n\n constructor(\n container: EventTarget,\n canvasContainer: EventTarget,\n domContainer: EventTarget,\n doc: EventTarget) {\n\n const subs = this._subscriptions;\n\n this._activeSubject$ = new BehaviorSubject<boolean>(false);\n\n this._active$ = this._activeSubject$\n .pipe(\n distinctUntilChanged(),\n publishReplay(1),\n refCount());\n\n this._claimMouse$ = new Subject<MouseClaim>();\n this._claimWheel$ = new Subject<MouseClaim>();\n\n this._deferPixelClaims$ = new Subject<MousePixelDeferral>();\n this._deferPixels$ = this._deferPixelClaims$\n .pipe(\n scan(\n (claims: { [key: string]: number }, claim: MousePixelDeferral): { [key: string]: number } => {\n if (claim.deferPixels == null) {\n delete claims[claim.name];\n } else {\n claims[claim.name] = claim.deferPixels;\n }\n\n return claims;\n },\n {}),\n map(\n (claims: { [key: string]: number }): number => {\n let deferPixelMax: number = -1;\n for (const key in claims) {\n if (!claims.hasOwnProperty(key)) {\n continue;\n }\n\n const deferPixels: number = claims[key];\n if (deferPixels > deferPixelMax) {\n deferPixelMax = deferPixels;\n }\n }\n\n return deferPixelMax;\n }),\n startWith(-1),\n publishReplay(1),\n refCount());\n\n subs.push(this._deferPixels$.subscribe((): void => { /* noop */ }));\n\n this._documentMouseMove$ =\n observableFromEvent<PointerEvent>(doc, \"pointermove\")\n .pipe(filter(this._isMousePen));\n this._documentMouseUp$ =\n observableFromEvent<PointerEvent>(doc, \"pointerup\")\n .pipe(filter(this._isMousePen));\n\n this._mouseDown$ =\n observableFromEvent<PointerEvent>(canvasContainer, \"pointerdown\")\n .pipe(filter(this._isMousePen));\n this._mouseEnter$ =\n observableFromEvent<PointerEvent>(canvasContainer, \"pointerenter\")\n .pipe(filter(this._isMousePen));\n this._mouseLeave$ =\n observableFromEvent<PointerEvent>(canvasContainer, \"pointerleave\")\n .pipe(filter(this._isMousePen));\n this._mouseMove$ =\n observableFromEvent<PointerEvent>(canvasContainer, \"pointermove\")\n .pipe(filter(this._isMousePen));\n this._mouseUp$ =\n observableFromEvent<PointerEvent>(canvasContainer, \"pointerup\")\n .pipe(filter(this._isMousePen));\n this._mouseOut$ =\n observableFromEvent<PointerEvent>(canvasContainer, \"pointerout\")\n .pipe(filter(this._isMousePen));\n this._mouseOver$ =\n observableFromEvent<PointerEvent>(canvasContainer, \"pointerover\")\n .pipe(filter(this._isMousePen));\n\n this._domMouseDown$ =\n observableFromEvent<PointerEvent>(domContainer, \"pointerdown\")\n .pipe(filter(this._isMousePen));\n this._domMouseMove$ =\n observableFromEvent<PointerEvent>(domContainer, \"pointermove\")\n .pipe(filter(this._isMousePen));\n\n this._click$ =\n observableFromEvent<MouseEvent>(canvasContainer, \"click\");\n this._contextMenu$ =\n observableFromEvent<MouseEvent>(canvasContainer, \"contextmenu\");\n this._windowBlur$ =\n observableFromEvent<FocusEvent>(window, \"blur\");\n\n this._dblClick$ = observableMerge(\n observableFromEvent<MouseEvent>(container, \"click\"),\n observableFromEvent<MouseEvent>(canvasContainer, \"dblclick\"))\n .pipe(\n bufferCount(3, 1),\n filter(\n (events: MouseEvent[]): boolean => {\n const event1: MouseEvent = events[0];\n const event2: MouseEvent = events[1];\n const event3: MouseEvent = events[2];\n\n return event1.type === \"click\" &&\n event2.type === \"click\" &&\n event3.type === \"dblclick\" &&\n (<HTMLElement>event1.target).parentNode === canvasContainer &&\n (<HTMLElement>event2.target).parentNode === canvasContainer;\n }),\n map(\n (events: MouseEvent[]): MouseEvent => {\n return events[2];\n }),\n share());\n\n subs.push(observableMerge(\n this._domMouseDown$,\n this._domMouseMove$,\n this._dblClick$,\n this._contextMenu$)\n .subscribe(\n (event: MouseEvent): void => {\n event.preventDefault();\n }));\n\n this._mouseWheel$ = observableMerge(\n observableFromEvent<WheelEvent>(canvasContainer, \"wheel\"),\n observableFromEvent<WheelEvent>(domContainer, \"wheel\"))\n .pipe(share());\n\n this._consistentContextMenu$ =\n observableMerge(\n this._mouseDown$,\n this._mouseMove$,\n this._mouseOut$,\n this._mouseUp$,\n this._contextMenu$)\n .pipe(\n bufferCount(3, 1),\n filter(\n (events: MouseEvent[]): boolean => {\n // fire context menu on mouse up both on mac and windows\n return events[0].type === \"pointerdown\" &&\n events[1].type === \"contextmenu\" &&\n events[2].type === \"pointerup\";\n }),\n map(\n (events: MouseEvent[]): MouseEvent => {\n return events[1];\n }),\n share());\n\n const dragStop$ =\n observableMerge(\n this._windowBlur$,\n this._documentMouseMove$\n .pipe(\n filter(\n (e: PointerEvent): boolean => {\n return this._buttonReleased(e, LEFT_BUTTON);\n })),\n this._documentMouseUp$\n .pipe(\n filter(\n (e: PointerEvent): boolean => {\n return this._mouseButton(e) === LEFT_BUTTON;\n })))\n .pipe(share());\n\n const mouseDragInitiate$ =\n this._createMouseDragInitiate$(\n LEFT_BUTTON,\n this._mouseDown$,\n dragStop$,\n true)\n .pipe(share());\n\n this._mouseDragStart$ =\n this._createMouseDragStart$(mouseDragInitiate$)\n .pipe(share());\n this._mouseDrag$ =\n this._createMouseDrag$(mouseDragInitiate$, dragStop$)\n .pipe(share());\n this._mouseDragEnd$ =\n this._createMouseDragEnd$(this._mouseDragStart$, dragStop$)\n .pipe(share());\n\n const domMouseDragInitiate$ =\n this._createMouseDragInitiate$(\n LEFT_BUTTON,\n this._domMouseDown$,\n dragStop$,\n false)\n .pipe(share());\n\n this._domMouseDragStart$ =\n this._createMouseDragStart$(domMouseDragInitiate$)\n .pipe(share());\n this._domMouseDrag$ =\n this._createMouseDrag$(domMouseDragInitiate$, dragStop$)\n .pipe(share());\n this._domMouseDragEnd$ =\n this._createMouseDragEnd$(this._domMouseDragStart$, dragStop$)\n .pipe(share());\n\n const rightDragStop$ =\n observableMerge(\n this._windowBlur$,\n this._documentMouseMove$.pipe(\n filter(\n (e: PointerEvent): boolean => {\n return this._buttonReleased(e, RIGHT_BUTTON);\n })),\n this._documentMouseUp$.pipe(\n filter(\n (e: PointerEvent): boolean => {\n return this._mouseButton(e) === RIGHT_BUTTON;\n })))\n .pipe(share());\n\n const mouseRightDragInitiate$ =\n this._createMouseDragInitiate$(\n RIGHT_BUTTON,\n this._mouseDown$,\n rightDragStop$,\n true)\n .pipe(share());\n\n this._mouseRightDragStart$ =\n this._createMouseDragStart$(mouseRightDragInitiate$)\n .pipe(share());\n this._mouseRightDrag$ =\n this._createMouseDrag$(mouseRightDragInitiate$, rightDragStop$)\n .pipe(share());\n this._mouseRightDragEnd$ =\n this._createMouseDragEnd$(this._mouseRightDragStart$, rightDragStop$)\n .pipe(share());\n\n this._proximateClick$ = this._mouseDown$\n .pipe(\n switchMap(\n (mouseDown: PointerEvent): Observable<MouseEvent> => {\n return this._click$.pipe(\n takeUntil(this._createDeferredMouseMove$(mouseDown, this._documentMouseMove$)),\n take(1));\n }),\n share());\n\n this._staticClick$ = this._mouseDown$\n .pipe(\n switchMap(\n (): Observable<MouseEvent> => {\n return this._click$.pipe(\n takeUntil(this._documentMouseMove$),\n take(1));\n }),\n share());\n\n subs.push(this._mouseDragStart$.subscribe());\n subs.push(this._mouseDrag$.subscribe());\n subs.push(this._mouseDragEnd$.subscribe());\n\n subs.push(this._domMouseDragStart$.subscribe());\n subs.push(this._domMouseDrag$.subscribe());\n subs.push(this._domMouseDragEnd$.subscribe());\n\n subs.push(this._mouseRightDragStart$.subscribe());\n subs.push(this._mouseRightDrag$.subscribe());\n subs.push(this._mouseRightDragEnd$.subscribe());\n\n subs.push(this._staticClick$.subscribe());\n\n this._mouseOwner$ = this._createOwner$(this._claimMouse$)\n .pipe(\n publishReplay(1),\n refCount());\n\n this._wheelOwner$ = this._createOwner$(this._claimWheel$)\n .pipe(\n publishReplay(1),\n refCount());\n\n subs.push(this._mouseOwner$.subscribe(() => { /* noop */ }));\n subs.push(this._wheelOwner$.subscribe(() => { /* noop */ }));\n }\n\n public get active$(): Observable<boolean> {\n return this._active$;\n }\n\n public get activate$(): Subject<boolean> {\n return this._activeSubject$;\n }\n\n public get documentMouseMove$(): Observable<MouseEvent> {\n return this._documentMouseMove$;\n }\n\n public get documentMouseUp$(): Observable<MouseEvent> {\n return this._documentMouseUp$;\n }\n\n public get domMouseDragStart$(): Observable<MouseEvent> {\n return this._domMouseDragStart$;\n }\n\n public get domMouseDrag$(): Observable<MouseEvent> {\n return this._domMouseDrag$;\n }\n\n public get domMouseDragEnd$(): Observable<MouseEvent | FocusEvent> {\n return this._domMouseDragEnd$;\n }\n\n public get domMouseDown$(): Observable<MouseEvent> {\n return this._domMouseDown$;\n }\n\n public get domMouseMove$(): Observable<MouseEvent> {\n return this._domMouseMove$;\n }\n\n public get mouseOwner$(): Observable<string> {\n return this._mouseOwner$;\n }\n\n public get mouseDown$(): Observable<MouseEvent> {\n return this._mouseDown$;\n }\n\n public get mouseEnter$(): Observable<MouseEvent> {\n return this._mouseEnter$;\n }\n\n public get mouseMove$(): Observable<MouseEvent> {\n return this._mouseMove$;\n }\n\n public get mouseLeave$(): Observable<MouseEvent> {\n return this._mouseLeave$;\n }\n\n public get mouseOut$(): Observable<MouseEvent> {\n return this._mouseOut$;\n }\n\n public get mouseOver$(): Observable<MouseEvent> {\n return this._mouseOver$;\n }\n\n public get mouseUp$(): Observable<MouseEvent> {\n return this._mouseUp$;\n }\n\n public get click$(): Observable<MouseEvent> {\n return this._click$;\n }\n\n public get dblClick$(): Observable<MouseEvent> {\n return this._dblClick$;\n }\n\n public get contextMenu$(): Observable<MouseEvent> {\n return this._consistentContextMenu$;\n }\n\n public get mouseWheel$(): Observable<WheelEvent> {\n return this._mouseWheel$;\n }\n\n public get mouseDragStart$(): Observable<MouseEvent> {\n return this._mouseDragStart$;\n }\n\n public get mouseDrag$(): Observable<MouseEvent> {\n return this._mouseDrag$;\n }\n\n public get mouseDragEnd$(): Observable<MouseEvent | FocusEvent> {\n return this._mouseDragEnd$;\n }\n\n public get mouseRightDragStart$(): Observable<MouseEvent> {\n return this._mouseRightDragStart$;\n }\n\n public get mouseRightDrag$(): Observable<MouseEvent> {\n return this._mouseRightDrag$;\n }\n\n public get mouseRightDragEnd$(): Observable<MouseEvent | FocusEvent> {\n return this._mouseRightDragEnd$;\n }\n\n public get proximateClick$(): Observable<MouseEvent> {\n return this._proximateClick$;\n }\n\n public get staticClick$(): Observable<MouseEvent> {\n return this._staticClick$;\n }\n\n public get windowBlur$(): Observable<FocusEvent> {\n return this._windowBlur$;\n }\n\n public dispose(): void {\n this._subscriptions.unsubscribe();\n }\n\n public claimMouse(name: string, zindex: number): void {\n this._claimMouse$.next({ name: name, zindex: zindex });\n }\n\n public unclaimMouse(name: string): void {\n this._claimMouse$.next({ name: name, zindex: null });\n }\n\n public deferPixels(name: string, deferPixels: number): void {\n this._deferPixelClaims$.next({ name: name, deferPixels: deferPixels });\n }\n\n public undeferPixels(name: string): void {\n this._deferPixelClaims$.next({ name: name, deferPixels: null });\n }\n\n public claimWheel(name: string, zindex: number): void {\n this._claimWheel$.next({ name: name, zindex: zindex });\n }\n\n public unclaimWheel(name: string): void {\n this._claimWheel$.next({ name: name, zindex: null });\n }\n\n public filtered$<T>(name: string, observable$: Observable<T>): Observable<T> {\n return this._filtered(name, observable$, this._mouseOwner$);\n }\n\n public filteredWheel$<T>(name: string, observable$: Observable<T>): Observable<T> {\n return this._filtered(name, observable$, this._wheelOwner$);\n }\n\n private _createDeferredMouseMove$(\n origin: PointerEvent,\n mouseMove$: Observable<PointerEvent>): Observable<PointerEvent> {\n return mouseMove$.pipe(\n map(\n (mouseMove: PointerEvent): [PointerEvent, number] => {\n const deltaX: number = mouseMove.clientX - origin.clientX;\n const deltaY: number = mouseMove.clientY - origin.clientY;\n\n return [mouseMove, Math.sqrt(deltaX * deltaX + deltaY * deltaY)];\n }),\n withLatestFrom(this._deferPixels$),\n filter(\n ([[, delta], deferPixels]: [[PointerEvent, number], number]): boolean => {\n return delta > deferPixels;\n }),\n map(\n ([[mouseMove]]: [[PointerEvent, number], number]): PointerEvent => {\n return mouseMove;\n }));\n }\n\n private _createMouseDrag$(\n mouseDragStartInitiate$: Observable<[PointerEvent, PointerEvent]>,\n stop$: Observable<Event>): Observable<PointerEvent> {\n\n return mouseDragStartInitiate$.pipe(\n map(\n ([, mouseMove]: [PointerEvent, PointerEvent]): PointerEvent => {\n return mouseMove;\n }),\n switchMap(\n (mouseMove: PointerEvent): Observable<PointerEvent> => {\n return observableConcat(\n observableOf(mouseMove),\n this._documentMouseMove$).pipe(\n takeUntil(stop$));\n }));\n }\n\n private _createMouseDragEnd$<T>(mouseDragStart$: Observable<PointerEvent>, stop$: Observable<T>): Observable<T> {\n return mouseDragStart$.pipe(\n switchMap(\n (): Observable<T> => {\n return stop$.pipe(first());\n }));\n }\n\n private _createMouseDragStart$(mouseDragStartInitiate$: Observable<[PointerEvent, PointerEvent]>): Observable<PointerEvent> {\n return mouseDragStartInitiate$.pipe(\n map(\n ([mouseDown]: [PointerEvent, PointerEvent]): PointerEvent => {\n return mouseDown;\n }));\n }\n\n private _createMouseDragInitiate$(\n button: number,\n mouseDown$: Observable<PointerEvent>,\n stop$: Observable<Event>,\n defer: boolean): Observable<[PointerEvent, PointerEvent]> {\n\n return mouseDown$.pipe(\n filter(\n (mouseDown: PointerEvent): boolean => {\n return this._mouseButton(mouseDown) === button;\n }),\n switchMap(\n (mouseDown: PointerEvent): Observable<[PointerEvent, PointerEvent]> => {\n return observableCombineLatest(\n observableOf(mouseDown),\n defer ?\n this._createDeferredMouseMove$(mouseDown, this._documentMouseMove$) :\n this._documentMouseMove$).pipe(\n takeUntil(stop$),\n take(1));\n }));\n }\n\n private _createOwner$(claim$: Observable<MouseClaim>): Observable<string> {\n return claim$.pipe(\n scan(\n (claims: { [key: string]: number }, claim: MouseClaim): { [key: string]: number } => {\n if (claim.zindex == null) {\n delete claims[claim.name];\n } else {\n claims[claim.name] = claim.zindex;\n }\n\n return claims;\n },\n {}),\n map(\n (claims: { [key: string]: number }): string => {\n let owner: string = null;\n let zIndexMax: number = -1;\n\n for (const name in claims) {\n if (!claims.hasOwnProperty(name)) {\n continue;\n }\n\n if (claims[name] > zIndexMax) {\n zIndexMax = claims[name];\n owner = name;\n }\n }\n\n return owner;\n }),\n startWith(null));\n }\n\n private _filtered<T>(\n name: string,\n observable$: Observable<T>,\n owner$: Observable<string>): Observable<T> {\n\n return observable$.pipe(\n withLatestFrom(owner$),\n filter(\n ([, owner]: [T, string]): boolean => {\n return owner === name;\n }),\n map(\n ([item]: [T, string]): T => {\n return item;\n }));\n }\n\n private _mouseButton(event: PointerEvent): number {\n const upOrDown = event.type === \"pointerdown\" || event.type === \"pointerup\";\n const InstallTrigger = (<FirefoxBrowser><unknown>window).InstallTrigger;\n if (upOrDown &&\n typeof InstallTrigger !== 'undefined' &&\n event.button === RIGHT_BUTTON && event.ctrlKey &&\n window.navigator.platform.toUpperCase().indexOf('MAC') >= 0) {\n // Fix for the fact that Firefox (detected by InstallTrigger)\n // on Mac determines e.button = 2 when using Control + left click.\n return LEFT_BUTTON;\n }\n return event.button;\n }\n\n private _buttonReleased(event: PointerEvent, button: Button): boolean {\n // Right button `mouseup` is not fired in\n // Chrome on Mac outside the window or iframe. If\n // the button is no longer pressed during move\n // it may have been released and drag stop\n // should be emitted.\n const flag = BUTTONS_MAP[button];\n return event.buttons === undefined || (event.buttons & flag) !== flag;\n }\n\n private _isMousePen(event: PointerEvent): boolean {\n const type = <PointerType>event.pointerType;\n return type === \"mouse\" || type === \"pen\";\n }\n}\n","import * as THREE from \"three\";\nimport * as vd from \"virtual-dom\";\n\nimport {\n publishReplay,\n refCount,\n scan,\n startWith,\n} from \"rxjs/operators\";\n\nimport {\n Observable,\n Subject,\n Subscription,\n} from \"rxjs\";\n\nimport { Alignment } from \"./enums/Alignment\";\nimport { ISpriteAtlas } from \"./interfaces/ISpriteAtlas\";\n\nexport class SpriteAtlas implements ISpriteAtlas {\n private _image: HTMLImageElement;\n private _texture: THREE.Texture;\n private _json: Sprites;\n\n public set json(value: Sprites) {\n this._json = value;\n }\n\n public set image(value: HTMLImageElement) {\n this._image = value;\n this._texture = new THREE.Texture(this._image);\n this._texture.minFilter = THREE.NearestFilter;\n }\n\n public get loaded(): boolean {\n return !!(this._image && this._json);\n }\n\n public getGLSprite(name: string): THREE.Object3D {\n if (!this.loaded) {\n throw new Error(\"Sprites cannot be retrieved before the atlas is loaded.\");\n }\n\n let definition: Sprite = this._json[name];\n\n if (!definition) {\n console.warn(\"Sprite with key\" + name + \"does not exist in sprite definition.\");\n\n return new THREE.Object3D();\n }\n\n let texture: THREE.Texture = this._texture.clone();\n texture.needsUpdate = true;\n\n let width: number = this._image.width;\n let height: number = this._image.height;\n\n texture.offset.x = definition.x / width;\n texture.offset.y = (height - definition.y - definition.height) / height;\n texture.repeat.x = definition.width / width;\n texture.repeat.y = definition.height / height;\n\n let material: THREE.SpriteMaterial = new THREE.SpriteMaterial({ map: texture });\n\n return new THREE.Sprite(material);\n }\n\n public getDOMSprite(\n name: string,\n float?: Alignment): vd.VNode {\n\n if (!this.loaded) {\n throw new Error(\"Sprites cannot be retrieved before the atlas is loaded.\");\n }\n\n if (float == null) {\n float = Alignment.Center;\n }\n\n let definition: Sprite = this._json[name];\n\n if (!definition) {\n console.warn(\"Sprite with key\" + name + \"does not exist in sprite definition.\");\n\n return vd.h(\"div\", {}, []);\n }\n\n let clipTop: number = definition.y;\n let clipRigth: number = definition.x + definition.width;\n let clipBottom: number = definition.y + definition.height;\n let clipLeft: number = definition.x;\n\n let left: number = -definition.x;\n let top: number = -definition.y;\n\n let height: number = this._image.height;\n let width: number = this._image.width;\n\n switch (float) {\n case Alignment.Bottom:\n case Alignment.Center:\n case Alignment.Top:\n left -= definition.width / 2;\n break;\n case Alignment.BottomLeft:\n case Alignment.Left:\n case Alignment.TopLeft:\n left -= definition.width;\n break;\n case Alignment.BottomRight:\n case Alignment.Right:\n case Alignment.TopRight:\n default:\n break;\n }\n\n switch (float) {\n case Alignment.Center:\n case Alignment.Left:\n case Alignment.Right:\n top -= definition.height / 2;\n break;\n case Alignment.Top:\n case Alignment.TopLeft:\n case Alignment.TopRight:\n top -= definition.height;\n break;\n case Alignment.Bottom:\n case Alignment.BottomLeft:\n case Alignment.BottomRight:\n default:\n break;\n }\n\n let pixelRatioInverse: number = 1 / definition.pixelRatio;\n\n clipTop *= pixelRatioInverse;\n clipRigth *= pixelRatioInverse;\n clipBottom *= pixelRatioInverse;\n clipLeft *= pixelRatioInverse;\n left *= pixelRatioInverse;\n top *= pixelRatioInverse;\n height *= pixelRatioInverse;\n width *= pixelRatioInverse;\n\n let properties: vd.createProperties = {\n src: this._image.src,\n style: {\n clip: `rect(${clipTop}px, ${clipRigth}px, ${clipBottom}px, ${clipLeft}px)`,\n height: `${height}px`,\n left: `${left}px`,\n position: \"absolute\",\n top: `${top}px`,\n width: `${width}px`,\n },\n };\n\n return vd.h(\"img\", properties, []);\n }\n}\n\ninterface Sprite {\n width: number;\n height: number;\n x: number;\n y: number;\n pixelRatio: number;\n}\n\ninterface Sprites {\n [key: string]: Sprite;\n}\n\ninterface SpriteAtlasOperation {\n (atlas: SpriteAtlas): SpriteAtlas;\n}\n\nexport class SpriteService {\n private _retina: boolean;\n\n private _spriteAtlasOperation$: Subject<SpriteAtlasOperation>;\n private _spriteAtlas$: Observable<SpriteAtlas>;\n\n private _atlasSubscription: Subscription;\n\n constructor(sprite?: string) {\n this._retina = window.devicePixelRatio > 1;\n\n this._spriteAtlasOperation$ = new Subject<SpriteAtlasOperation>();\n\n this._spriteAtlas$ = this._spriteAtlasOperation$.pipe(\n startWith(\n (atlas: ISpriteAtlas): ISpriteAtlas => {\n return atlas;\n }),\n scan(\n (atlas: SpriteAtlas, operation: SpriteAtlasOperation): SpriteAtlas => {\n return operation(atlas);\n },\n new SpriteAtlas()),\n publishReplay(1),\n refCount());\n\n this._atlasSubscription = this._spriteAtlas$\n .subscribe(() => { /*noop*/ });\n\n if (sprite == null) {\n return;\n }\n\n let format: string = this._retina ? \"@2x\" : \"\";\n\n let imageXmlHTTP: XMLHttpRequest = new XMLHttpRequest();\n imageXmlHTTP.open(\"GET\", sprite + format + \".png\", true);\n imageXmlHTTP.responseType = \"arraybuffer\";\n imageXmlHTTP.onload = () => {\n let image: HTMLImageElement = new Image();\n image.onload = () => {\n this._spriteAtlasOperation$.next(\n (atlas: SpriteAtlas): SpriteAtlas => {\n atlas.image = image;\n\n return atlas;\n });\n };\n\n let blob: Blob = new Blob([imageXmlHTTP.response]);\n image.src = window.URL.createObjectURL(blob);\n };\n\n imageXmlHTTP.onerror = (error: Event) => {\n console.error(new Error(`Failed to fetch sprite sheet (${sprite}${format}.png)`));\n };\n\n imageXmlHTTP.send();\n\n let jsonXmlHTTP: XMLHttpRequest = new XMLHttpRequest();\n jsonXmlHTTP.open(\"GET\", sprite + format + \".json\", true);\n jsonXmlHTTP.responseType = \"text\";\n jsonXmlHTTP.onload = () => {\n let json: Sprites = <Sprites>JSON.parse(jsonXmlHTTP.response);\n\n this._spriteAtlasOperation$.next(\n (atlas: SpriteAtlas): SpriteAtlas => {\n atlas.json = json;\n\n return atlas;\n });\n };\n\n jsonXmlHTTP.onerror = (error: Event) => {\n console.error(new Error(`Failed to fetch sheet (${sprite}${format}.json)`));\n };\n\n jsonXmlHTTP.send();\n }\n\n public get spriteAtlas$(): Observable<SpriteAtlas> {\n return this._spriteAtlas$;\n }\n\n public dispose(): void {\n this._atlasSubscription.unsubscribe();\n }\n}\n","import {\n merge as observableMerge,\n fromEvent as observableFromEvent,\n timer as observableTimer,\n BehaviorSubject,\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport {\n bufferWhen,\n distinctUntilChanged,\n filter,\n first,\n map,\n mergeMap,\n publishReplay,\n refCount,\n scan,\n share,\n skip,\n switchMap,\n take,\n takeUntil,\n} from \"rxjs/operators\";\n\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\nimport { TouchPinch } from \"./interfaces/TouchPinch\";\n\ninterface PinchOperation {\n (pinch: TouchPinch): TouchPinch;\n}\n\nexport class TouchService {\n private _activeSubject$: BehaviorSubject<boolean>;\n private _active$: Observable<boolean>;\n\n private _touchStart$: Observable<TouchEvent>;\n private _touchMove$: Observable<TouchEvent>;\n private _touchEnd$: Observable<TouchEvent>;\n private _touchCancel$: Observable<TouchEvent>;\n\n private _singleTouchDrag$: Observable<TouchEvent>;\n private _singleTouchDragStart$: Observable<TouchEvent>;\n private _singleTouchDragEnd$: Observable<TouchEvent>;\n private _singleTouchMove$: Observable<TouchEvent>;\n\n private _pinchOperation$: Subject<PinchOperation>;\n private _pinch$: Observable<TouchPinch>;\n private _pinchStart$: Observable<TouchEvent>;\n private _pinchEnd$: Observable<TouchEvent>;\n private _pinchChange$: Observable<TouchPinch>;\n\n private _doubleTap$: Observable<TouchEvent>;\n\n private _subscriptions: SubscriptionHolder = new SubscriptionHolder();\n\n constructor(canvasContainer: HTMLElement, domContainer: HTMLElement) {\n const subs = this._subscriptions;\n\n this._activeSubject$ = new BehaviorSubject<boolean>(false);\n\n this._active$ = this._activeSubject$.pipe(\n distinctUntilChanged(),\n publishReplay(1),\n refCount());\n\n subs.push(observableFromEvent<TouchEvent>(domContainer, \"touchmove\")\n .subscribe(\n (event: TouchEvent): void => {\n event.preventDefault();\n }));\n\n this._touchStart$ = observableFromEvent<TouchEvent>(canvasContainer, \"touchstart\");\n this._touchMove$ = observableFromEvent<TouchEvent>(canvasContainer, \"touchmove\");\n this._touchEnd$ = observableFromEvent<TouchEvent>(canvasContainer, \"touchend\");\n this._touchCancel$ = observableFromEvent<TouchEvent>(canvasContainer, \"touchcancel\");\n\n const tapStart$: Observable<TouchEvent> = this._touchStart$.pipe(\n filter(\n (te: TouchEvent): boolean => {\n return te.touches.length === 1 && te.targetTouches.length === 1;\n }),\n share());\n\n this._doubleTap$ = tapStart$.pipe(\n bufferWhen(\n (): Observable<number | TouchEvent> => {\n return tapStart$.pipe(\n first(),\n switchMap(\n (): Observable<number | TouchEvent> => {\n return observableMerge(\n observableTimer(300),\n tapStart$).pipe(\n take(1));\n }));\n }),\n filter(\n (events: TouchEvent[]): boolean => {\n return events.length === 2;\n }),\n map(\n (events: TouchEvent[]): TouchEvent => {\n return events[events.length - 1];\n }),\n share());\n\n subs.push(this._doubleTap$\n .subscribe(\n (event: TouchEvent): void => {\n event.preventDefault();\n }));\n\n this._singleTouchMove$ = this._touchMove$.pipe(\n filter(\n (te: TouchEvent): boolean => {\n return te.touches.length === 1 && te.targetTouches.length === 1;\n }),\n share());\n\n let singleTouchStart$: Observable<TouchEvent> = observableMerge(\n this._touchStart$,\n this._touchEnd$,\n this._touchCancel$).pipe(\n filter(\n (te: TouchEvent): boolean => {\n return te.touches.length === 1 && te.targetTouches.length === 1;\n }));\n\n let multipleTouchStart$: Observable<TouchEvent> = observableMerge(\n this._touchStart$,\n this._touchEnd$,\n this._touchCancel$).pipe(\n filter(\n (te: TouchEvent): boolean => {\n return te.touches.length >= 1;\n }));\n\n let touchStop$: Observable<TouchEvent> = observableMerge(\n this._touchEnd$,\n this._touchCancel$).pipe(\n filter(\n (te: TouchEvent): boolean => {\n return te.touches.length === 0;\n }));\n\n this._singleTouchDragStart$ = singleTouchStart$.pipe(\n mergeMap(\n (): Observable<TouchEvent> => {\n return this._singleTouchMove$.pipe(\n takeUntil(\n observableMerge(\n touchStop$,\n multipleTouchStart$)),\n take(1));\n }));\n\n this._singleTouchDragEnd$ = singleTouchStart$.pipe(\n mergeMap(\n (): Observable<TouchEvent> => {\n return observableMerge(\n touchStop$,\n multipleTouchStart$).pipe(\n first());\n }));\n\n this._singleTouchDrag$ = singleTouchStart$.pipe(\n switchMap(\n (): Observable<TouchEvent> => {\n return this._singleTouchMove$.pipe(\n skip(1),\n takeUntil(\n observableMerge(\n multipleTouchStart$,\n touchStop$)));\n }));\n\n let touchesChanged$: Observable<TouchEvent> = observableMerge(\n this._touchStart$,\n this._touchEnd$,\n this._touchCancel$);\n\n this._pinchStart$ = touchesChanged$.pipe(\n filter(\n (te: TouchEvent): boolean => {\n return te.touches.length === 2 && te.targetTouches.length === 2;\n }));\n\n this._pinchEnd$ = touchesChanged$.pipe(\n filter(\n (te: TouchEvent): boolean => {\n return te.touches.length !== 2 || te.targetTouches.length !== 2;\n }));\n\n this._pinchOperation$ = new Subject<PinchOperation>();\n\n this._pinch$ = this._pinchOperation$.pipe(\n scan(\n (pinch: TouchPinch, operation: PinchOperation): TouchPinch => {\n return operation(pinch);\n },\n {\n changeX: 0,\n changeY: 0,\n clientX: 0,\n clientY: 0,\n distance: 0,\n distanceChange: 0,\n distanceX: 0,\n distanceY: 0,\n originalEvent: null,\n pageX: 0,\n pageY: 0,\n screenX: 0,\n screenY: 0,\n touch1: null,\n touch2: null,\n }));\n\n const pinchSubscription = this._touchMove$.pipe(\n filter(\n (te: TouchEvent): boolean => {\n return te.touches.length === 2 && te.targetTouches.length === 2;\n }),\n map(\n (te: TouchEvent): PinchOperation => {\n return (previous: TouchPinch): TouchPinch => {\n let touch1: Touch = te.touches[0];\n let touch2: Touch = te.touches[1];\n\n let minX: number = Math.min(touch1.clientX, touch2.clientX);\n let maxX: number = Math.max(touch1.clientX, touch2.clientX);\n\n let minY: number = Math.min(touch1.clientY, touch2.clientY);\n let maxY: number = Math.max(touch1.clientY, touch2.clientY);\n\n let centerClientX: number = minX + (maxX - minX) / 2;\n let centerClientY: number = minY + (maxY - minY) / 2;\n\n let centerPageX: number = centerClientX + touch1.pageX - touch1.clientX;\n let centerPageY: number = centerClientY + touch1.pageY - touch1.clientY;\n\n let centerScreenX: number = centerClientX + touch1.screenX - touch1.clientX;\n let centerScreenY: number = centerClientY + touch1.screenY - touch1.clientY;\n\n let distanceX: number = Math.abs(touch1.clientX - touch2.clientX);\n let distanceY: number = Math.abs(touch1.clientY - touch2.clientY);\n\n let distance: number = Math.sqrt(distanceX * distanceX + distanceY * distanceY);\n\n let distanceChange: number = distance - previous.distance;\n\n let changeX: number = distanceX - previous.distanceX;\n let changeY: number = distanceY - previous.distanceY;\n\n let current: TouchPinch = {\n changeX: changeX,\n changeY: changeY,\n clientX: centerClientX,\n clientY: centerClientY,\n distance: distance,\n distanceChange: distanceChange,\n distanceX: distanceX,\n distanceY: distanceY,\n originalEvent: te,\n pageX: centerPageX,\n pageY: centerPageY,\n screenX: centerScreenX,\n screenY: centerScreenY,\n touch1: touch1,\n touch2: touch2,\n };\n\n return current;\n };\n }))\n .subscribe(this._pinchOperation$);\n\n subs.push(pinchSubscription);\n\n this._pinchChange$ = this._pinchStart$.pipe(\n switchMap(\n (): Observable<TouchPinch> => {\n return this._pinch$.pipe(\n skip(1),\n takeUntil(this._pinchEnd$));\n }));\n }\n\n public get active$(): Observable<boolean> {\n return this._active$;\n }\n\n public get activate$(): Subject<boolean> {\n return this._activeSubject$;\n }\n\n public get doubleTap$(): Observable<TouchEvent> {\n return this._doubleTap$;\n }\n\n public get touchStart$(): Observable<TouchEvent> {\n return this._touchStart$;\n }\n\n public get touchMove$(): Observable<TouchEvent> {\n return this._touchMove$;\n }\n\n public get touchEnd$(): Observable<TouchEvent> {\n return this._touchEnd$;\n }\n\n public get touchCancel$(): Observable<TouchEvent> {\n return this._touchCancel$;\n }\n\n public get singleTouchDragStart$(): Observable<TouchEvent> {\n return this._singleTouchDragStart$;\n }\n\n public get singleTouchDrag$(): Observable<TouchEvent> {\n return this._singleTouchDrag$;\n }\n\n public get singleTouchDragEnd$(): Observable<TouchEvent> {\n return this._singleTouchDragEnd$;\n }\n\n public get pinch$(): Observable<TouchPinch> {\n return this._pinchChange$;\n }\n\n public get pinchStart$(): Observable<TouchEvent> {\n return this._pinchStart$;\n }\n\n public get pinchEnd$(): Observable<TouchEvent> {\n return this._pinchEnd$;\n }\n\n public dispose(): void {\n this._subscriptions.unsubscribe();\n }\n}\n","import { Subscriber } from '../Subscriber';\nimport { ObservableInput, OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\nimport { noop } from '../util/noop';\nimport { OperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/from';\n\n/**\n * Buffers the source Observable values, using a factory function of closing\n * Observables to determine when to close, emit, and reset the buffer.\n *\n * <span class=\"informal\">Collects values from the past as an array. When it\n * starts collecting values, it calls a function that returns an Observable that\n * tells when to close the buffer and restart collecting.</span>\n *\n * ![](bufferWhen.png)\n *\n * Opens a buffer immediately, then closes the buffer when the observable\n * returned by calling `closingSelector` function emits a value. When it closes\n * the buffer, it immediately opens a new buffer and repeats the process.\n *\n * ## Example\n *\n * Emit an array of the last clicks every [1-5] random seconds\n *\n * ```ts\n * import { fromEvent, interval } from 'rxjs';\n * import { bufferWhen } from 'rxjs/operators';\n *\n * const clicks = fromEvent(document, 'click');\n * const buffered = clicks.pipe(bufferWhen(() =>\n * interval(1000 + Math.random() * 4000)\n * ));\n * buffered.subscribe(x => console.log(x));\n * ```\n *\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link windowWhen}\n *\n * @param {function(): Observable} closingSelector A function that takes no\n * arguments and returns an Observable that signals buffer closure.\n * @return A function that returns an Observable of arrays of buffered values.\n */\nexport function bufferWhen<T>(closingSelector: () => ObservableInput<any>): OperatorFunction<T, T[]> {\n return operate((source, subscriber) => {\n // The buffer we keep and emit.\n let buffer: T[] | null = null;\n // A reference to the subscriber used to subscribe to\n // the closing notifier. We need to hold this so we can\n // end the subscription after the first notification.\n let closingSubscriber: Subscriber<T> | null = null;\n\n // Ends the previous closing notifier subscription, so it\n // terminates after the first emission, then emits\n // the current buffer if there is one, starts a new buffer, and starts a\n // new closing notifier.\n const openBuffer = () => {\n // Make sure to teardown the closing subscription, we only cared\n // about one notification.\n closingSubscriber?.unsubscribe();\n // emit the buffer if we have one, and start a new buffer.\n const b = buffer;\n buffer = [];\n b && subscriber.next(b);\n\n // Get a new closing notifier and subscribe to it.\n innerFrom(closingSelector()).subscribe((closingSubscriber = new OperatorSubscriber(subscriber, openBuffer, noop)));\n };\n\n // Start the first buffer.\n openBuffer();\n\n // Subscribe to our source.\n source.subscribe(\n new OperatorSubscriber(\n subscriber,\n // Add every new value to the current buffer.\n (value) => buffer?.push(value),\n // When we complete, emit the buffer if we have one,\n // then complete the result.\n () => {\n buffer && subscriber.next(buffer);\n subscriber.complete();\n },\n // Pass all errors through to consumer.\n undefined,\n // Release memory on teardown\n () => (buffer = closingSubscriber = null!)\n )\n );\n });\n}\n","import {\n Observable,\n of as observableOf,\n} from \"rxjs\";\n\nimport { ViewerOptions } from \"../external/viewer\";\n\nexport class ConfigurationService {\n private _imageTiling$: Observable<boolean>;\n private _exploreUrl$: Observable<string>;\n\n constructor(options: ViewerOptions) {\n const host = options?.url?.exploreHost ?? \"www.mapillary.com\";\n const scheme = options?.url?.scheme ?? \"https\";\n const exploreUrl = `${scheme}://${host}`;\n this._exploreUrl$ = observableOf(exploreUrl);\n\n const imageTiling = options?.imageTiling === false ? false : true;\n this._imageTiling$ = observableOf(imageTiling);\n }\n\n public get exploreUrl$(): Observable<string> {\n return this._exploreUrl$;\n }\n\n public get imageTiling$(): Observable<boolean> {\n return this._imageTiling$;\n }\n}\n","import { DOMRenderer } from \"../render/DOMRenderer\";\nimport { GLRenderer } from \"../render/GLRenderer\";\nimport { RenderService } from \"../render/RenderService\";\nimport { StateService } from \"../state/StateService\";\nimport { DOM } from \"../util/DOM\";\n\nimport { ViewerOptions } from \"./options/ViewerOptions\";\nimport { KeyboardService } from \"./KeyboardService\";\nimport { MouseService } from \"./MouseService\";\nimport { SpriteService } from \"./SpriteService\";\nimport { TouchService } from \"./TouchService\";\nimport { ConfigurationService } from \"./ConfigurationService\";\n\nexport class Container {\n public id: string;\n\n public renderService: RenderService;\n\n public glRenderer: GLRenderer;\n public domRenderer: DOMRenderer;\n\n public keyboardService: KeyboardService;\n public mouseService: MouseService;\n public touchService: TouchService;\n\n public spriteService: SpriteService;\n\n public readonly configurationService: ConfigurationService;\n\n private _canvasContainer: HTMLDivElement;\n private _canvas: HTMLCanvasElement;\n private _container: HTMLElement;\n private _domContainer: HTMLDivElement;\n\n private _dom: DOM;\n\n private readonly _trackResize: boolean;\n\n constructor(\n options: ViewerOptions,\n stateService: StateService,\n dom?: DOM) {\n\n this._dom = dom ?? new DOM();\n\n if (typeof options.container === \"string\") {\n this._container = this._dom.document\n .getElementById(options.container);\n if (!this._container) {\n throw new Error(\n `Container \"${options.container}\" not found.`);\n }\n } else if (options.container instanceof HTMLElement) {\n this._container = options.container;\n } else {\n throw new Error(\n `Invalid type: \"container\" must be ` +\n `a String or HTMLElement.`);\n }\n\n this._trackResize =\n options.trackResize === false ?\n false : true;\n\n this.id = this._container.id ??\n \"mapillary-fallback-container-id\";\n\n this._container.classList\n .add(\"mapillary-viewer\");\n\n this._canvasContainer = this._dom\n .createElement(\n \"div\",\n \"mapillary-interactive\",\n this._container);\n\n this._canvas = this._dom\n .createElement(\n \"canvas\",\n \"mapillary-canvas\");\n this._canvas.style.position = \"absolute\";\n this._canvas.setAttribute(\"tabindex\", \"0\");\n\n // Add DOM container after canvas container to\n // render DOM elements on top of the interactive\n // canvas.\n this._domContainer = this._dom\n .createElement(\n \"div\",\n \"mapillary-dom\",\n this._container);\n\n this.configurationService = new ConfigurationService(options);\n\n this.renderService =\n new RenderService(\n this._container,\n stateService.currentState$,\n options.renderMode);\n\n this.glRenderer =\n new GLRenderer(\n this._canvas,\n this._canvasContainer,\n this.renderService);\n\n this.domRenderer =\n new DOMRenderer(\n this._domContainer,\n this.renderService,\n stateService.currentState$);\n\n this.keyboardService =\n new KeyboardService(this._canvasContainer);\n\n this.mouseService =\n new MouseService(\n this._container,\n this._canvasContainer,\n this._domContainer,\n document);\n\n this.touchService =\n new TouchService(\n this._canvasContainer,\n this._domContainer);\n\n this.spriteService =\n new SpriteService(options.sprite);\n\n window.addEventListener('resize', this._onWindowResize, false);\n }\n\n public get canvas(): HTMLCanvasElement {\n return !!this._canvas.parentNode ?\n this._canvas : null;\n }\n\n public get canvasContainer(): HTMLDivElement {\n return this._canvasContainer;\n }\n\n public get container(): HTMLElement {\n return this._container;\n }\n\n public get domContainer(): HTMLDivElement {\n return this._domContainer;\n }\n\n public remove(): void {\n window.removeEventListener('resize', this._onWindowResize, false);\n\n this.spriteService.dispose();\n this.touchService.dispose();\n this.mouseService.dispose();\n\n this.glRenderer.remove();\n this.domRenderer.remove();\n\n this.renderService.dispose();\n\n this._removeNode(this._canvasContainer);\n this._removeNode(this._domContainer);\n\n this._container.classList\n .remove(\"mapillary-viewer\");\n }\n\n private _onWindowResize = () => {\n if (this._trackResize) {\n this.renderService.resize$.next();\n }\n };\n\n private _removeNode(node: Node): void {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n }\n}\n","import {\n empty as observableEmpty,\n from as observableFrom,\n Observable,\n} from \"rxjs\";\n\nimport {\n bufferCount,\n catchError,\n distinctUntilChanged,\n first,\n map,\n mergeMap,\n skip,\n switchMap,\n timeout,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { GraphMode } from \"../graph/GraphMode\";\nimport { GraphService } from \"../graph/GraphService\";\nimport { Image } from \"../graph/Image\";\nimport { NavigationEdgeStatus } from \"../graph/interfaces/NavigationEdgeStatus\";\nimport { StateService } from \"../state/StateService\";\nimport { AnimationFrame } from \"../state/interfaces/AnimationFrame\";\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\nimport { connectedComponent } from \"../api/CellMath\";\nimport { APIWrapper } from \"../api/APIWrapper\";\nimport { LngLat } from \"../api/interfaces/LngLat\";\n\nexport interface CacheServiceConfiguration {\n cellDepth: number;\n}\n\nexport class CacheService {\n private _subscriptions: SubscriptionHolder;\n private _started: boolean;\n private _cellDepth: number;\n\n constructor(\n private readonly _graphService: GraphService,\n private readonly _stateService: StateService,\n private readonly _api: APIWrapper) {\n this._subscriptions = new SubscriptionHolder()\n this._started = false;\n this._cellDepth = 1;\n }\n\n public get started(): boolean {\n return this._started;\n }\n\n public configure(configuration?: CacheServiceConfiguration): void {\n if (!configuration) {\n this._cellDepth = 1;\n return;\n }\n this._cellDepth = Math.max(1, Math.min(3, configuration.cellDepth));\n }\n\n public start(): void {\n if (this._started) { return; }\n\n const subs = this._subscriptions;\n\n subs.push(this._stateService.currentState$\n .pipe(\n distinctUntilChanged(\n undefined,\n (frame: AnimationFrame): string => {\n return frame.state.currentImage.id;\n }),\n map(\n (frame: AnimationFrame): [string[], LngLat, string] => {\n const state = frame.state;\n const trajectory = state.trajectory;\n const trajectoryKeys = trajectory\n .map(\n (n: Image): string => {\n return n.id;\n });\n\n const sequenceKey =\n trajectory[trajectory.length - 1].sequenceId;\n\n return [\n trajectoryKeys,\n state.currentImage.originalLngLat,\n sequenceKey,\n ];\n }),\n bufferCount(1, 5),\n withLatestFrom(this._graphService.graphMode$),\n switchMap(\n ([keepBuffer, graphMode]: [[string[], LngLat, string][], GraphMode]): Observable<void> => {\n const keepKeys = keepBuffer[0][0];\n const lngLat = keepBuffer[0][1];\n const geometry = this._api.data.geometry;\n const cellId = geometry.lngLatToCellId(lngLat)\n const keepCellIds = connectedComponent(\n cellId, this._cellDepth, geometry);\n const keepSequenceKey =\n graphMode === GraphMode.Sequence ?\n keepBuffer[0][2] :\n undefined;\n\n return this._graphService\n .uncache$(keepKeys, keepCellIds, keepSequenceKey);\n }))\n .subscribe(() => { /*noop*/ }));\n\n subs.push(this._graphService.graphMode$\n .pipe(\n skip(1),\n withLatestFrom(this._stateService.currentState$),\n switchMap(\n ([mode, frame]: [GraphMode, AnimationFrame]): Observable<NavigationEdgeStatus> => {\n return mode === GraphMode.Sequence ?\n this._keyToEdges(\n frame.state.currentImage.id,\n (image: Image)\n : Observable<NavigationEdgeStatus> => {\n return image.sequenceEdges$;\n }) :\n observableFrom(frame.state.trajectory\n .map(\n (image: Image): string => {\n return image.id;\n })\n .slice(frame.state.currentIndex)).pipe(\n mergeMap(\n (key: string): Observable<NavigationEdgeStatus> => {\n return this._keyToEdges(\n key,\n (image: Image): Observable<NavigationEdgeStatus> => {\n return image.spatialEdges$;\n });\n },\n 6));\n }))\n .subscribe(() => { /*noop*/ }));\n\n subs.push(\n this._graphService.dataAdded$\n .pipe(\n withLatestFrom(this._stateService.currentId$),\n switchMap(\n ([_, imageId]: [string, string]): Observable<Image> => {\n return this._graphService.cacheImage$(imageId)\n }))\n .subscribe(() => { /*noop*/ }))\n\n this._started = true;\n }\n\n public stop(): void {\n if (!this._started) { return; }\n\n this._subscriptions.unsubscribe();\n this._started = false;\n }\n\n private _keyToEdges(\n key: string,\n imageToEdgeMap: (image: Image) => Observable<NavigationEdgeStatus>)\n : Observable<NavigationEdgeStatus> {\n\n return this._graphService.cacheImage$(key).pipe(\n switchMap(imageToEdgeMap),\n first(\n (status: NavigationEdgeStatus): boolean => {\n return status.cached;\n }),\n timeout(15000),\n catchError(\n (error: Error): Observable<NavigationEdgeStatus> => {\n console.error(`Failed to cache edges (${key}).`, error);\n\n return observableEmpty();\n }));\n }\n}\n","import {\n debounceTime,\n distinctUntilChanged,\n map,\n publishReplay,\n refCount,\n scan,\n startWith,\n} from \"rxjs/operators\";\n\nimport {\n Observable,\n Subject,\n} from \"rxjs\";\n\ninterface Loader {\n task: string;\n loading: boolean;\n}\n\nexport class LoadingService {\n private _loaders$: Observable<{ [key: string]: boolean }>;\n private _loadersSubject$: Subject<any> = new Subject<any>();\n\n constructor() {\n this._loaders$ = this._loadersSubject$.pipe(\n scan(\n (loaders: { [key: string]: boolean }, loader: Loader): { [key: string]: boolean } => {\n if (loader.task !== undefined) {\n loaders[loader.task] = loader.loading;\n }\n return loaders;\n },\n {}),\n startWith({}),\n publishReplay(1),\n refCount());\n }\n\n public get loading$(): Observable<boolean> {\n return this._loaders$.pipe(\n map(\n (loaders: { [key: string]: boolean }): boolean => {\n for (const key in loaders) {\n if (!loaders.hasOwnProperty(key)) {\n continue;\n }\n\n if (loaders[key]) {\n return true;\n }\n }\n\n return false;\n }),\n debounceTime(100),\n distinctUntilChanged());\n }\n\n public taskLoading$(task: string): Observable<boolean> {\n return this._loaders$.pipe(\n map(\n (loaders: { [key: string]: boolean }): boolean => {\n return !!loaders[task];\n }),\n debounceTime(100),\n distinctUntilChanged());\n }\n\n public startLoading(task: string): void {\n this._loadersSubject$.next({ loading: true, task: task });\n }\n\n public stopLoading(task: string): void {\n this._loadersSubject$.next({ loading: false, task: task });\n }\n}\n","import * as THREE from \"three\";\n\nimport {\n of as observableOf,\n combineLatest as observableCombineLatest,\n empty as observableEmpty,\n Observable,\n Subject,\n Subscription,\n} from \"rxjs\";\n\nimport {\n catchError,\n distinctUntilChanged,\n map,\n publishReplay,\n refCount,\n startWith,\n switchMap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport * as Geo from \"../geo/Geo\";\n\nimport { LngLat } from \"../api/interfaces/LngLat\";\nimport { Spatial } from \"../geo/Spatial\";\nimport { Transform } from \"../geo/Transform\";\nimport { ViewportCoords } from \"../geo/ViewportCoords\";\nimport { LngLatAlt } from \"../api/interfaces/LngLatAlt\";\nimport { GraphCalculator } from \"../graph/GraphCalculator\";\nimport { GraphService } from \"../graph/GraphService\";\nimport { Image } from \"../graph/Image\";\nimport { StateService } from \"../state/StateService\";\nimport { AnimationFrame } from \"../state/interfaces/AnimationFrame\";\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\nimport { CameraType } from \"../geo/interfaces/CameraType\";\nimport { isSpherical } from \"../geo/Geo\";\nimport { geodeticToEnu } from \"../geo/GeoCoords\";\n\nenum PanMode {\n Disabled,\n Enabled,\n Started,\n}\n\nexport class PanService {\n private _graphService: GraphService;\n private _stateService: StateService;\n private _graphCalculator: GraphCalculator;\n private _spatial: Spatial;\n private _viewportCoords: ViewportCoords;\n\n private _panImagesSubject$: Subject<[Image, Transform, number][]>;\n private _panImages$: Observable<[Image, Transform, number][]>;\n private _panImagesSubscription: Subscription;\n private _subscriptions: SubscriptionHolder = new SubscriptionHolder();\n\n private _mode: PanMode;\n\n constructor(\n graphService: GraphService,\n stateService: StateService,\n enabled?: boolean,\n graphCalculator?: GraphCalculator,\n spatial?: Spatial,\n viewportCoords?: ViewportCoords) {\n\n this._graphService = graphService;\n this._stateService = stateService;\n this._graphCalculator = graphCalculator ?? new GraphCalculator();\n this._spatial = spatial ?? new Spatial();\n this._viewportCoords = viewportCoords ?? new ViewportCoords();\n\n this._mode = enabled !== false ?\n PanMode.Enabled : PanMode.Disabled;\n\n this._panImagesSubject$ = new Subject<[Image, Transform, number][]>();\n this._panImages$ = this._panImagesSubject$.pipe(\n startWith([]),\n publishReplay(1),\n refCount());\n\n this._subscriptions.push(this._panImages$.subscribe());\n }\n\n public get panImages$(): Observable<[Image, Transform, number][]> {\n return this._panImages$;\n }\n\n public dispose(): void {\n this.stop();\n\n if (this._panImagesSubscription != null) {\n this._panImagesSubscription.unsubscribe();\n }\n\n this._subscriptions.unsubscribe();\n }\n\n public enable(): void {\n if (this._mode !== PanMode.Disabled) {\n return;\n }\n\n this._mode = PanMode.Enabled;\n this.start();\n }\n\n public disable(): void {\n if (this._mode === PanMode.Disabled) {\n return;\n }\n\n this.stop();\n\n this._mode = PanMode.Disabled;\n }\n\n public start(): void {\n if (this._mode !== PanMode.Enabled) {\n return;\n }\n\n const panImages$ = this._stateService.currentImage$.pipe(\n switchMap(\n (current: Image): Observable<[Image, Transform, number][]> => {\n if (!current.merged || isSpherical(current.cameraType)) {\n return observableOf([]);\n }\n\n const current$: Observable<Image> = observableOf(current);\n\n const bounds: LngLat[] = this._graphCalculator.boundingBoxCorners(current.lngLat, 20);\n\n const adjacent$: Observable<Image[]> = this._graphService\n .cacheBoundingBox$(bounds[0], bounds[1]).pipe(\n catchError(\n (error: Error): Observable<Image> => {\n console.error(`Failed to cache periphery bounding box (${current.id})`, error);\n\n return observableEmpty();\n }),\n map(\n (images: Image[]): Image[] => {\n if (isSpherical(current.cameraType)) {\n return [];\n }\n\n const potential: Image[] = [];\n\n for (const image of images) {\n if (image.id === current.id) {\n continue;\n }\n\n if (image.mergeId !== current.mergeId) {\n continue;\n }\n\n if (isSpherical(image.cameraType)) {\n continue;\n }\n\n if (this._distance(image, current) > 4) {\n continue;\n }\n\n potential.push(image);\n }\n\n return potential;\n }));\n\n return observableCombineLatest(current$, adjacent$).pipe(\n withLatestFrom(this._stateService.reference$),\n map(\n ([[cn, adjacent], reference]: [[Image, Image[]], LngLatAlt]): [Image, Transform, number][] => {\n const currentDirection: THREE.Vector3 = this._spatial.viewingDirection(cn.rotation);\n const currentTranslation: number[] = Geo.computeTranslation(\n { lat: cn.lngLat.lat, lng: cn.lngLat.lng, alt: cn.computedAltitude },\n cn.rotation,\n reference);\n const currentTransform: Transform = this._createTransform(cn, currentTranslation);\n const currentAzimuthal: number = this._spatial.wrap(\n this._spatial.azimuthal(\n currentDirection.toArray(),\n currentTransform.upVector().toArray()),\n 0,\n 2 * Math.PI);\n\n const currentProjectedPoints: number[][] = this._computeProjectedPoints(currentTransform);\n\n const currentHFov: number = this._computeHorizontalFov(currentProjectedPoints) / 180 * Math.PI;\n\n const preferredOverlap: number = Math.PI / 8;\n let left: [number, Image, Transform, number] = undefined;\n let right: [number, Image, Transform, number] = undefined;\n\n for (const a of adjacent) {\n const translation: number[] = Geo.computeTranslation(\n { lat: a.lngLat.lat, lng: a.lngLat.lng, alt: a.computedAltitude },\n a.rotation,\n reference);\n\n const transform: Transform = this._createTransform(a, translation);\n const projectedPoints: number[][] = this._computeProjectedPoints(transform);\n const hFov: number = this._computeHorizontalFov(projectedPoints) / 180 * Math.PI;\n\n const direction: THREE.Vector3 = this._spatial.viewingDirection(a.rotation);\n const azimuthal: number = this._spatial.wrap(\n this._spatial.azimuthal(\n direction.toArray(),\n transform.upVector().toArray()),\n 0,\n 2 * Math.PI);\n\n const directionChange: number = this._spatial.angleBetweenVector2(\n currentDirection.x,\n currentDirection.y,\n direction.x,\n direction.y);\n\n let overlap: number = Number.NEGATIVE_INFINITY;\n if (directionChange > 0) {\n if (currentAzimuthal > azimuthal) {\n overlap = currentAzimuthal - 2 * Math.PI + currentHFov / 2 - (azimuthal - hFov / 2);\n } else {\n overlap = currentAzimuthal + currentHFov / 2 - (azimuthal - hFov / 2);\n }\n } else {\n if (currentAzimuthal < azimuthal) {\n overlap = azimuthal + hFov / 2 - (currentAzimuthal + 2 * Math.PI - currentHFov / 2);\n } else {\n overlap = azimuthal + hFov / 2 - (currentAzimuthal - currentHFov / 2);\n }\n }\n\n const nonOverlap: number = Math.abs(hFov - overlap);\n\n const distanceCost: number = this._distance(a, cn);\n const timeCost: number = Math.min(this._timeDifference(a, cn), 4);\n const overlapCost: number = 20 * Math.abs(overlap - preferredOverlap);\n const fovCost: number = Math.min(5, 1 / Math.min(hFov / currentHFov, 1));\n const nonOverlapCost: number = overlap > 0 ? -2 * nonOverlap : 0;\n\n const cost: number = distanceCost + timeCost + overlapCost + fovCost + nonOverlapCost;\n\n if (overlap > 0 &&\n overlap < 0.5 * currentHFov &&\n overlap < 0.5 * hFov &&\n nonOverlap > 0.5 * currentHFov) {\n\n if (directionChange > 0) {\n if (!left) {\n left = [cost, a, transform, hFov];\n } else {\n if (cost < left[0]) {\n left = [cost, a, transform, hFov];\n }\n }\n } else {\n if (!right) {\n right = [cost, a, transform, hFov];\n } else {\n if (cost < right[0]) {\n right = [cost, a, transform, hFov];\n }\n }\n }\n }\n }\n\n const panImagess:\n [Image, Transform, number][] = [];\n\n if (!!left) {\n panImagess.push([left[1], left[2], left[3]]);\n }\n\n if (!!right) {\n panImagess.push([right[1], right[2], right[3]]);\n }\n\n return panImagess;\n }),\n startWith([]));\n }));\n\n this._panImagesSubscription = this._stateService.currentState$.pipe(\n map(\n (frame: AnimationFrame): boolean => {\n return frame.state.imagesAhead > 0;\n }),\n distinctUntilChanged(),\n switchMap(\n (traversing: boolean): Observable<[Image, Transform, number][]> => {\n return traversing ? observableOf([]) : panImages$;\n }))\n .subscribe(\n (panImages: [Image, Transform, number][]): void => {\n this._panImagesSubject$.next(panImages);\n });\n\n this._mode = PanMode.Started;\n }\n\n public stop(): void {\n if (this._mode !== PanMode.Started) {\n return;\n }\n\n this._panImagesSubscription.unsubscribe();\n this._panImagesSubject$.next([]);\n\n this._mode = PanMode.Enabled;\n }\n\n private _distance(image: Image, reference: Image): number {\n const [x, y, z] = geodeticToEnu(\n image.lngLat.lng,\n image.lngLat.lat,\n image.computedAltitude,\n reference.lngLat.lng,\n reference.lngLat.lat,\n reference.computedAltitude);\n\n return Math.sqrt(x * x + y * y + z * z);\n }\n\n private _timeDifference(image: Image, reference: Image): number {\n const milliSecond = (1000 * 60 * 60 * 24 * 30);\n return Math.abs(image.capturedAt - reference.capturedAt) / milliSecond;\n }\n\n private _createTransform(image: Image, translation: number[]): Transform {\n return new Transform(\n image.exifOrientation,\n image.width,\n image.height,\n image.scale,\n image.rotation,\n translation,\n image.assetsCached ? image.image : undefined,\n undefined,\n image.cameraParameters,\n <CameraType>image.cameraType);\n }\n\n private _computeProjectedPoints(transform: Transform): number[][] {\n const vertices: number[][] = [[1, 0]];\n const directions: number[][] = [[0, 0.5]];\n const pointsPerLine: number = 20;\n\n return Geo.computeProjectedPoints(transform, vertices, directions, pointsPerLine, this._viewportCoords);\n }\n\n private _computeHorizontalFov(projectedPoints: number[][]): number {\n const fovs: number[] = projectedPoints\n .map(\n (projectedPoint: number[]): number => {\n return this._coordToFov(projectedPoint[0]);\n });\n\n const fov: number = Math.min(...fovs);\n\n return fov;\n }\n\n private _coordToFov(x: number): number {\n return 2 * Math.atan(x) * 180 / Math.PI;\n }\n}\n","import {\n Observable,\n Subscriber,\n} from \"rxjs\";\nimport { CoreImagesContract } from \"./contracts/CoreImagesContract\";\nimport { ImagesContract } from \"./contracts/ImagesContract\";\nimport { SpatialImagesContract } from \"./contracts/SpatialImagesContract\";\nimport { SequenceContract } from \"./contracts/SequenceContract\";\nimport { ImageTilesRequestContract }\n from \"./contracts/ImageTilesRequestContract\";\nimport { ImageTilesContract } from \"./contracts/ImageTilesContract\";\nimport { IDataProvider } from \"./interfaces/IDataProvider\";\n\n/**\n * @class API\n *\n * @classdesc Provides methods for access to the API.\n */\nexport class APIWrapper {\n constructor(private readonly _data: IDataProvider) { }\n\n public get data(): IDataProvider {\n return this._data;\n }\n\n public getCoreImages$(cellId: string): Observable<CoreImagesContract> {\n return this._wrap$(this._data.getCoreImages(cellId));\n }\n\n public getImages$(imageIds: string[]): Observable<ImagesContract> {\n return this._wrap$(this._data.getImages(imageIds));\n }\n\n public getImageTiles$(\n tiles: ImageTilesRequestContract)\n : Observable<ImageTilesContract> {\n return this._wrap$(this._data.getImageTiles(tiles));\n }\n\n public getSequence$(sequenceId: string): Observable<SequenceContract> {\n return this._wrap$(this._data.getSequence(sequenceId));\n }\n\n public getSpatialImages$(\n imageIds: string[]): Observable<SpatialImagesContract> {\n return this._wrap$(this._data.getSpatialImages(imageIds));\n }\n\n public setAccessToken(accessToken?: string): void {\n this._data.setAccessToken(accessToken);\n }\n\n private _wrap$<T>(promise: Promise<T>): Observable<T> {\n return Observable.create(\n (subscriber: Subscriber<T>): void => {\n promise.then(\n (value: T): void => {\n subscriber.next(value);\n subscriber.complete();\n },\n (error: Error): void => {\n subscriber.error(error);\n });\n });\n }\n}\n","import {\n concat as observableConcat,\n empty as observableEmpty,\n from as observableFrom,\n of as observableOf,\n Observable,\n Subject,\n Subscription,\n} from \"rxjs\";\n\nimport {\n catchError,\n expand,\n finalize,\n first,\n map,\n mergeMap,\n publishReplay,\n refCount,\n startWith,\n tap,\n takeLast,\n} from \"rxjs/operators\";\n\nimport { FilterFunction } from \"./FilterCreator\";\nimport { FilterExpression } from \"./FilterExpression\";\nimport { Graph } from \"./Graph\";\nimport { GraphMode } from \"./GraphMode\";\nimport { Image } from \"./Image\";\nimport { Sequence } from \"./Sequence\";\n\nimport { LngLat } from \"../api/interfaces/LngLat\";\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\nimport { ProviderCellEvent } from \"../api/events/ProviderCellEvent\";\nimport { GraphMapillaryError } from \"../error/GraphMapillaryError\";\n\n/**\n * @class GraphService\n *\n * @classdesc Represents a service for graph operations.\n */\nexport class GraphService {\n private _graph$: Observable<Graph>;\n private _graphMode: GraphMode;\n private _graphMode$: Observable<GraphMode>;\n private _graphModeSubject$: Subject<GraphMode>;\n\n private _firstGraphSubjects$: Subject<Graph>[];\n\n private _dataAdded$: Subject<string> = new Subject<string>();\n\n private _initializeCacheSubscriptions: Subscription[];\n private _sequenceSubscriptions: Subscription[];\n private _spatialSubscriptions: Subscription[];\n private _subscriptions: SubscriptionHolder = new SubscriptionHolder();\n\n /**\n * Create a new graph service instance.\n *\n * @param {Graph} graph - Graph instance to be operated on.\n */\n constructor(graph: Graph) {\n const subs = this._subscriptions;\n\n this._graph$ = observableConcat(\n observableOf(graph),\n graph.changed$).pipe(\n publishReplay(1),\n refCount());\n\n subs.push(this._graph$.subscribe(() => { /*noop*/ }));\n\n this._graphMode = GraphMode.Spatial;\n this._graphModeSubject$ = new Subject<GraphMode>();\n this._graphMode$ = this._graphModeSubject$.pipe(\n startWith(this._graphMode),\n publishReplay(1),\n refCount());\n\n subs.push(this._graphMode$.subscribe(() => { /*noop*/ }));\n\n this._firstGraphSubjects$ = [];\n\n this._initializeCacheSubscriptions = [];\n this._sequenceSubscriptions = [];\n this._spatialSubscriptions = [];\n\n graph.api.data.on(\"datacreate\", this._onDataAdded);\n }\n\n /**\n * Get dataAdded$.\n *\n * @returns {Observable<string>} Observable emitting\n * a cell id every time data has been added to a cell.\n */\n public get dataAdded$(): Observable<string> {\n return this._dataAdded$;\n }\n\n /**\n * Get filter observable.\n *\n * @desciption Emits the filter every time it has changed.\n *\n * @returns {Observable<FilterFunction>} Observable\n * emitting the filter function every time it is set.\n */\n public get filter$(): Observable<FilterFunction> {\n return this._graph$.pipe(\n first(),\n mergeMap(\n (graph: Graph): Observable<FilterFunction> => {\n return graph.filter$;\n }));\n }\n\n /**\n * Get graph mode observable.\n *\n * @description Emits the current graph mode.\n *\n * @returns {Observable<GraphMode>} Observable\n * emitting the current graph mode when it changes.\n */\n public get graphMode$(): Observable<GraphMode> {\n return this._graphMode$;\n }\n\n /**\n * Cache full images in a bounding box.\n *\n * @description When called, the full properties of\n * the image are retrieved. The image cache is not initialized\n * for any new images retrieved and the image assets are not\n * retrieved, {@link cacheImage$} needs to be called for caching\n * assets.\n *\n * @param {LngLat} sw - South west corner of bounding box.\n * @param {LngLat} ne - North east corner of bounding box.\n * @return {Observable<Array<Image>>} Observable emitting a single item,\n * the images of the bounding box, when they have all been retrieved.\n * @throws {Error} Propagates any IO image caching errors to the caller.\n */\n public cacheBoundingBox$(sw: LngLat, ne: LngLat): Observable<Image[]> {\n return this._graph$.pipe(\n first(),\n mergeMap(\n (graph: Graph): Observable<Image[]> => {\n return graph.cacheBoundingBox$(sw, ne);\n }));\n }\n\n /**\n * Cache full images in a cell.\n *\n * @description When called, the full properties of\n * the image are retrieved. The image cache is not initialized\n * for any new images retrieved and the image assets are not\n * retrieved, {@link cacheImage$} needs to be called for caching\n * assets.\n *\n * @param {string} cellId - Id of the cell.\n * @return {Observable<Array<Image>>} Observable emitting a single item,\n * the images of the cell, when they have all been retrieved.\n * @throws {Error} Propagates any IO image caching errors to the caller.\n */\n public cacheCell$(cellId: string): Observable<Image[]> {\n return this._graph$.pipe(\n first(),\n mergeMap(\n (graph: Graph): Observable<Image[]> => {\n return graph.cacheCell$(cellId);\n }));\n }\n\n /**\n * Cache a image in the graph and retrieve it.\n *\n * @description When called, the full properties of\n * the image are retrieved and the image cache is initialized.\n * After that the image assets are cached and the image\n * is emitted to the observable when.\n * In parallel to caching the image assets, the sequence and\n * spatial edges of the image are cached. For this, the sequence\n * of the image and the required tiles and spatial images are\n * retrieved. The sequence and spatial edges may be set before\n * or after the image is returned.\n *\n * @param {string} id - Id of the image to cache.\n * @return {Observable<Image>} Observable emitting a single item,\n * the image, when it has been retrieved and its assets are cached.\n * @throws {Error} Propagates any IO image caching errors to the caller.\n */\n public cacheImage$(id: string): Observable<Image> {\n const firstGraphSubject$: Subject<Graph> = new Subject<Graph>();\n\n this._firstGraphSubjects$.push(firstGraphSubject$);\n\n const firstGraph$: Observable<Graph> = firstGraphSubject$.pipe(\n publishReplay(1),\n refCount());\n\n const image$: Observable<Image> = firstGraph$.pipe(\n map(\n (graph: Graph): Image => {\n return graph.getNode(id);\n }),\n mergeMap(\n (image: Image): Observable<Image> => {\n return image.assetsCached ?\n observableOf(image) :\n image.cacheAssets$();\n }),\n publishReplay(1),\n refCount());\n\n image$.subscribe(\n undefined,\n (error: Error): void => {\n console.error(`Failed to cache image (${id}).`, error);\n });\n\n let initializeCacheSubscription: Subscription;\n initializeCacheSubscription = this._graph$.pipe(\n first(),\n mergeMap(\n (graph: Graph): Observable<Graph> => {\n if (graph.isCachingFull(id) || !graph.hasNode(id)) {\n return graph.cacheFull$(id);\n }\n\n if (graph.isCachingFill(id) || !graph.getNode(id).complete) {\n return graph.cacheFill$(id);\n }\n\n return observableOf<Graph>(graph);\n }),\n tap(\n (graph: Graph): void => {\n if (!graph.hasNode(id)) {\n throw new GraphMapillaryError(`Failed to cache image (${id})`);\n }\n\n if (!graph.hasInitializedCache(id)) {\n graph.initializeCache(id);\n }\n }),\n finalize(\n (): void => {\n if (initializeCacheSubscription == null) {\n return;\n }\n\n this._removeFromArray(initializeCacheSubscription, this._initializeCacheSubscriptions);\n this._removeFromArray(firstGraphSubject$, this._firstGraphSubjects$);\n }))\n .subscribe(\n (graph: Graph): void => {\n firstGraphSubject$.next(graph);\n firstGraphSubject$.complete();\n },\n (error: Error): void => {\n firstGraphSubject$.error(error);\n });\n\n if (!initializeCacheSubscription.closed) {\n this._initializeCacheSubscriptions.push(initializeCacheSubscription);\n }\n\n const graphSequence$: Observable<Graph> = firstGraph$.pipe(\n catchError(\n (): Observable<Graph> => {\n return observableEmpty();\n }),\n mergeMap(\n (graph: Graph): Observable<Graph> => {\n if (graph.isCachingNodeSequence(id) || !graph.hasNodeSequence(id)) {\n return graph.cacheNodeSequence$(id);\n }\n\n return observableOf<Graph>(graph);\n }),\n publishReplay(1),\n refCount());\n\n let sequenceSubscription: Subscription;\n sequenceSubscription = graphSequence$.pipe(\n tap(\n (graph: Graph): void => {\n if (!graph.getNode(id).sequenceEdges.cached) {\n graph.cacheSequenceEdges(id);\n }\n }),\n finalize(\n (): void => {\n if (sequenceSubscription == null) {\n return;\n }\n\n this._removeFromArray(sequenceSubscription, this._sequenceSubscriptions);\n }))\n .subscribe(\n (): void => { return; },\n (error: Error): void => {\n console.error(`Failed to cache sequence edges (${id}).`, error);\n });\n\n if (!sequenceSubscription.closed) {\n this._sequenceSubscriptions.push(sequenceSubscription);\n }\n\n if (this._graphMode === GraphMode.Spatial) {\n let spatialSubscription: Subscription;\n spatialSubscription = firstGraph$.pipe(\n catchError(\n (): Observable<Graph> => {\n return observableEmpty();\n }),\n expand(\n (graph: Graph): Observable<Graph> => {\n if (graph.hasTiles(id)) {\n return observableEmpty();\n }\n\n return observableFrom(graph.cacheTiles$(id)).pipe(\n mergeMap(\n (graph$: Observable<Graph>): Observable<Graph> => {\n return graph$.pipe(\n mergeMap(\n (g: Graph): Observable<Graph> => {\n if (g.isCachingTiles(id)) {\n return observableEmpty();\n }\n\n return observableOf<Graph>(g);\n }),\n catchError(\n (error: Error): Observable<Graph> => {\n console.error(`Failed to cache tile data (${id}).`, error);\n\n return observableEmpty();\n }));\n }));\n }),\n takeLast(1),\n mergeMap(\n (graph: Graph): Observable<Graph> => {\n if (graph.hasSpatialArea(id)) {\n return observableOf<Graph>(graph);\n }\n\n return observableFrom(graph.cacheSpatialArea$(id)).pipe(\n mergeMap(\n (graph$: Observable<Graph>): Observable<Graph> => {\n return graph$.pipe(\n catchError(\n (error: Error): Observable<Graph> => {\n console.error(`Failed to cache spatial images (${id}).`, error);\n\n return observableEmpty();\n }));\n }));\n }),\n takeLast(1),\n mergeMap(\n (graph: Graph): Observable<Graph> => {\n return graph.hasNodeSequence(id) ?\n observableOf<Graph>(graph) :\n graph.cacheNodeSequence$(id);\n }),\n tap(\n (graph: Graph): void => {\n if (!graph.getNode(id).spatialEdges.cached) {\n graph.cacheSpatialEdges(id);\n }\n }),\n finalize(\n (): void => {\n if (spatialSubscription == null) {\n return;\n }\n\n this._removeFromArray(spatialSubscription, this._spatialSubscriptions);\n }))\n .subscribe(\n (): void => { return; },\n (error: Error): void => {\n const message =\n `Failed to cache spatial edges (${id}).`;\n console.error(message, error);\n });\n\n if (!spatialSubscription.closed) {\n this._spatialSubscriptions.push(spatialSubscription);\n }\n }\n\n return image$.pipe(\n first(\n (image: Image): boolean => {\n return image.assetsCached;\n }));\n }\n\n /**\n * Cache a sequence in the graph and retrieve it.\n *\n * @param {string} sequenceId - Sequence id.\n * @returns {Observable<Sequence>} Observable emitting a single item,\n * the sequence, when it has been retrieved and its assets are cached.\n * @throws {Error} Propagates any IO image caching errors to the caller.\n */\n public cacheSequence$(sequenceId: string): Observable<Sequence> {\n return this._graph$.pipe(\n first(),\n mergeMap(\n (graph: Graph): Observable<Graph> => {\n if (graph.isCachingSequence(sequenceId) || !graph.hasSequence(sequenceId)) {\n return graph.cacheSequence$(sequenceId);\n }\n\n return observableOf<Graph>(graph);\n }),\n map(\n (graph: Graph): Sequence => {\n return graph.getSequence(sequenceId);\n }));\n }\n\n /**\n * Cache a sequence and its images in the graph and retrieve the sequence.\n *\n * @description Caches a sequence and its assets are cached and\n * retrieves all images belonging to the sequence. The image assets\n * or edges will not be cached.\n *\n * @param {string} sequenceId - Sequence id.\n * @param {string} referenceImageId - Id of image to use as reference\n * for optimized caching.\n * @returns {Observable<Sequence>} Observable emitting a single item,\n * the sequence, when it has been retrieved, its assets are cached and\n * all images belonging to the sequence has been retrieved.\n * @throws {Error} Propagates any IO image caching errors to the caller.\n */\n public cacheSequenceImages$(sequenceId: string, referenceImageId?: string): Observable<Sequence> {\n return this._graph$.pipe(\n first(),\n mergeMap(\n (graph: Graph): Observable<Graph> => {\n if (graph.isCachingSequence(sequenceId) || !graph.hasSequence(sequenceId)) {\n return graph.cacheSequence$(sequenceId);\n }\n\n return observableOf<Graph>(graph);\n }),\n mergeMap(\n (graph: Graph): Observable<Graph> => {\n if (graph.isCachingSequenceNodes(sequenceId) || !graph.hasSequenceNodes(sequenceId)) {\n return graph.cacheSequenceNodes$(sequenceId, referenceImageId);\n }\n\n return observableOf<Graph>(graph);\n }),\n map(\n (graph: Graph): Sequence => {\n return graph.getSequence(sequenceId);\n }));\n }\n\n /**\n * Dispose the graph service and its children.\n */\n public dispose(): void {\n this._graph$\n .pipe(first())\n .subscribe((graph: Graph) => { graph.unsubscribe(); });\n this._subscriptions.unsubscribe();\n }\n\n /**\n * Set a spatial edge filter on the graph.\n *\n * @description Resets the spatial edges of all cached images.\n *\n * @param {FilterExpression} filter - Filter expression to be applied.\n * @return {Observable<Graph>} Observable emitting a single item,\n * the graph, when the spatial edges have been reset.\n */\n public setFilter$(filter: FilterExpression): Observable<void> {\n this._resetSubscriptions(this._spatialSubscriptions);\n\n return this._graph$.pipe(\n first(),\n tap(\n (graph: Graph): void => {\n graph.resetSpatialEdges();\n graph.setFilter(filter);\n }),\n map(\n (): void => {\n return undefined;\n }));\n }\n\n /**\n * Set the graph mode.\n *\n * @description If graph mode is set to spatial, caching\n * is performed with emphasis on spatial edges. If graph\n * mode is set to sequence no tile data is requested and\n * no spatial edges are computed.\n *\n * When setting graph mode to sequence all spatial\n * subscriptions are aborted.\n *\n * @param {GraphMode} mode - Graph mode to set.\n */\n public setGraphMode(mode: GraphMode): void {\n if (this._graphMode === mode) {\n return;\n }\n\n if (mode === GraphMode.Sequence) {\n this._resetSubscriptions(this._spatialSubscriptions);\n }\n\n this._graphMode = mode;\n this._graphModeSubject$.next(this._graphMode);\n }\n\n /**\n * Reset the graph.\n *\n * @description Resets the graph but keeps the images of the\n * supplied ids.\n *\n * @param {Array<string>} keepIds - Ids of images to keep in graph.\n * @return {Observable<Image>} Observable emitting a single item,\n * the graph, when it has been reset.\n */\n public reset$(keepIds: string[]): Observable<void> {\n this._abortSubjects(this._firstGraphSubjects$);\n this._resetSubscriptions(this._initializeCacheSubscriptions);\n this._resetSubscriptions(this._sequenceSubscriptions);\n this._resetSubscriptions(this._spatialSubscriptions);\n\n return this._graph$.pipe(\n first(),\n tap(\n (graph: Graph): void => {\n graph.reset(keepIds);\n }),\n map(\n (): void => {\n return undefined;\n }));\n }\n\n /**\n * Uncache the graph.\n *\n * @description Uncaches the graph by removing tiles, images and\n * sequences. Keeps the images of the supplied ids and the tiles\n * related to those images.\n *\n * @param {Array<string>} keepIds - Ids of images to keep in graph.\n * @param {Array<string>} keepCellIds - Ids of cells to keep in graph.\n * @param {string} keepSequenceId - Optional id of sequence\n * for which the belonging images should not be disposed or\n * removed from the graph. These images may still be uncached if\n * not specified in keep ids param.\n * @return {Observable<Graph>} Observable emitting a single item,\n * the graph, when the graph has been uncached.\n */\n public uncache$(\n keepIds: string[],\n keepCellIds: string[],\n keepSequenceId?: string)\n : Observable<void> {\n\n return this._graph$.pipe(\n first(),\n tap(\n (graph: Graph): void => {\n graph.uncache(keepIds, keepCellIds, keepSequenceId);\n }),\n map(\n (): void => {\n return undefined;\n }));\n }\n\n private _abortSubjects<T>(subjects: Subject<T>[]): void {\n for (const subject of subjects.slice()) {\n this._removeFromArray(subject, subjects);\n\n subject.error(new Error(\"Cache image request was aborted.\"));\n }\n }\n\n private _onDataAdded = (event: ProviderCellEvent): void => {\n this._graph$\n .pipe(\n first(),\n mergeMap(\n graph => {\n return graph.updateCells$(event.cellIds).pipe(\n tap(() => { graph.resetSpatialEdges(); }));\n }))\n .subscribe(cellId => { this._dataAdded$.next(cellId); });\n };\n\n private _removeFromArray<T>(object: T, objects: T[]): void {\n const index: number = objects.indexOf(object);\n if (index !== -1) {\n objects.splice(index, 1);\n }\n }\n\n private _resetSubscriptions(subscriptions: Subscription[]): void {\n for (const subscription of subscriptions.slice()) {\n this._removeFromArray(subscription, subscriptions);\n\n if (!subscription.closed) {\n subscription.unsubscribe();\n }\n }\n }\n}\n","export class FrameGenerator {\n private _cancelAnimationFrame: (handle: number) => void;\n private _requestAnimationFrame: (cb: () => void) => number;\n\n constructor(root: any) {\n if (root.requestAnimationFrame) {\n this._cancelAnimationFrame = root.cancelAnimationFrame.bind(root);\n this._requestAnimationFrame = root.requestAnimationFrame.bind(root);\n } else if (root.mozRequestAnimationFrame) {\n this._cancelAnimationFrame = root.mozCancelAnimationFrame.bind(root);\n this._requestAnimationFrame = root.mozRequestAnimationFrame.bind(root);\n } else if (root.webkitRequestAnimationFrame) {\n this._cancelAnimationFrame = root.webkitCancelAnimationFrame.bind(root);\n this._requestAnimationFrame = root.webkitRequestAnimationFrame.bind(root);\n } else if (root.msRequestAnimationFrame) {\n this._cancelAnimationFrame = root.msCancelAnimationFrame.bind(root);\n this._requestAnimationFrame = root.msRequestAnimationFrame.bind(root);\n } else if (root.oRequestAnimationFrame) {\n this._cancelAnimationFrame = root.oCancelAnimationFrame.bind(root);\n this._requestAnimationFrame = root.oRequestAnimationFrame.bind(root);\n } else {\n this._cancelAnimationFrame = root.clearTimeout.bind(root);\n this._requestAnimationFrame = (cb: () => void): number => { return root.setTimeout(cb, 1000 / 60); };\n }\n }\n\n public get cancelAnimationFrame(): (handle: number) => void {\n return this._cancelAnimationFrame;\n }\n\n public get requestAnimationFrame(): (cb: () => void) => number {\n return this._requestAnimationFrame;\n }\n}\n","import * as Geo from \"../../geo/Geo\";\n\nimport { TransitionMode } from \"../TransitionMode\";\nimport { EulerRotation } from \"../interfaces/EulerRotation\";\nimport { IStateBase } from \"../interfaces/IStateBase\";\nimport { ArgumentMapillaryError } from \"../../error/ArgumentMapillaryError\";\nimport { Camera } from \"../../geo/Camera\";\nimport { Spatial } from \"../../geo/Spatial\";\nimport { Transform } from \"../../geo/Transform\";\nimport { LngLatAlt } from \"../../api/interfaces/LngLatAlt\";\nimport { Image } from \"../../graph/Image\";\nimport { CameraType } from \"../../geo/interfaces/CameraType\";\n\nexport abstract class StateBase implements IStateBase {\n protected _spatial: Spatial;\n\n protected _reference: LngLatAlt;\n\n protected _alpha: number;\n protected _stateTransitionAlpha: number;\n protected _camera: Camera;\n protected _zoom: number;\n\n protected _currentIndex: number;\n\n protected _trajectory: Image[];\n protected _currentImage: Image;\n protected _previousImage: Image;\n\n protected _trajectoryTransforms: Transform[];\n\n protected _trajectoryCameras: Camera[];\n protected _currentCamera: Camera;\n protected _previousCamera: Camera;\n\n protected _motionless: boolean;\n\n private _referenceThreshold: number;\n private _transitionMode: TransitionMode;\n\n constructor(state: IStateBase) {\n this._spatial = new Spatial();\n\n this._referenceThreshold = 0.01;\n this._transitionMode = state.transitionMode;\n\n this._reference = state.reference;\n\n this._alpha = state.alpha;\n this._stateTransitionAlpha = 0;\n this._camera = state.camera.clone();\n this._zoom = state.zoom;\n\n this._currentIndex = state.currentIndex;\n\n this._trajectory = state.trajectory.slice();\n this._trajectoryTransforms = [];\n this._trajectoryCameras = [];\n\n for (let image of this._trajectory) {\n let translation: number[] = this._imageToTranslation(image, this._reference);\n let transform: Transform = new Transform(\n image.exifOrientation,\n image.width,\n image.height,\n image.scale,\n image.rotation,\n translation,\n image.image,\n undefined,\n image.cameraParameters,\n <CameraType>image.cameraType);\n\n this._trajectoryTransforms.push(transform);\n this._trajectoryCameras.push(new Camera(transform));\n }\n\n this._currentImage = this._trajectory.length > 0 ?\n this._trajectory[this._currentIndex] :\n null;\n\n this._previousImage = this._trajectory.length > 1 && this.currentIndex > 0 ?\n this._trajectory[this._currentIndex - 1] :\n null;\n\n this._currentCamera = this._trajectoryCameras.length > 0 ?\n this._trajectoryCameras[this._currentIndex].clone() :\n new Camera();\n\n this._previousCamera = this._trajectoryCameras.length > 1 && this.currentIndex > 0 ?\n this._trajectoryCameras[this._currentIndex - 1].clone() :\n this._currentCamera.clone();\n }\n\n public get reference(): LngLatAlt {\n return this._reference;\n }\n\n public get alpha(): number {\n return this._getAlpha();\n }\n\n public get stateTransitionAlpha(): number {\n return this._getStateTransitionAlpha();\n }\n\n public get camera(): Camera {\n return this._camera;\n }\n\n public get zoom(): number {\n return this._zoom;\n }\n\n public get trajectory(): Image[] {\n return this._trajectory;\n }\n\n public get currentIndex(): number {\n return this._currentIndex;\n }\n\n public get currentImage(): Image {\n return this._currentImage;\n }\n\n public get previousImage(): Image {\n return this._previousImage;\n }\n\n public get currentCamera(): Camera {\n return this._currentCamera;\n }\n\n public get currentTransform(): Transform {\n return this._trajectoryTransforms.length > 0 ?\n this._trajectoryTransforms[this.currentIndex] : null;\n }\n\n public get previousTransform(): Transform {\n return this._trajectoryTransforms.length > 1 && this.currentIndex > 0 ?\n this._trajectoryTransforms[this.currentIndex - 1] : null;\n }\n\n public get motionless(): boolean {\n return this._motionless;\n }\n\n public get transitionMode(): TransitionMode {\n return this._transitionMode;\n }\n\n public move(delta: number): void { /*noop*/ }\n\n public moveTo(position: number): void { /*noop*/ }\n\n public rotate(delta: EulerRotation): void { /*noop*/ }\n\n public rotateUnbounded(delta: EulerRotation): void { /*noop*/ }\n\n public rotateWithoutInertia(delta: EulerRotation): void { /*noop*/ }\n\n public rotateBasic(basicRotation: number[]): void { /*noop*/ }\n\n public rotateBasicUnbounded(basicRotation: number[]): void { /*noop*/ }\n\n public rotateBasicWithoutInertia(basicRotation: number[]): void { /*noop*/ }\n\n public rotateToBasic(basic: number[]): void { /*noop*/ }\n\n public setSpeed(speed: number): void { /*noop*/ }\n\n public zoomIn(delta: number, reference: number[]): void { /*noop*/ }\n\n public update(delta: number): void { /*noop*/ }\n\n public setCenter(center: number[]): void { /*noop*/ }\n\n public setZoom(zoom: number): void { /*noop*/ }\n\n public dolly(delta: number): void { /*noop*/ }\n\n public orbit(rotation: EulerRotation): void { /*noop*/ }\n\n public setViewMatrix(matrix: number[]): void { /*noop*/ }\n\n public truck(direction: number[]): void { /*noop*/ }\n\n public append(images: Image[]): void {\n if (images.length < 1) {\n throw Error(\"Trajectory can not be empty\");\n }\n\n if (this._currentIndex < 0) {\n this.set(images);\n } else {\n this._trajectory = this._trajectory.concat(images);\n this._appendToTrajectories(images);\n }\n }\n\n public prepend(images: Image[]): void {\n if (images.length < 1) {\n throw Error(\"Trajectory can not be empty\");\n }\n\n this._trajectory = images.slice().concat(this._trajectory);\n this._currentIndex += images.length;\n\n this._setCurrentImage();\n\n let referenceReset: boolean = this._setReference(this._currentImage);\n if (referenceReset) {\n this._setTrajectories();\n } else {\n this._prependToTrajectories(images);\n }\n\n this._setCurrentCamera();\n }\n\n public remove(n: number): void {\n if (n < 0) {\n throw Error(\"n must be a positive integer\");\n }\n\n if (this._currentIndex - 1 < n) {\n throw Error(\"Current and previous images can not be removed\");\n }\n\n for (let i: number = 0; i < n; i++) {\n this._trajectory.shift();\n this._trajectoryTransforms.shift();\n this._trajectoryCameras.shift();\n this._currentIndex--;\n }\n\n this._setCurrentImage();\n }\n\n public clearPrior(): void {\n if (this._currentIndex > 0) {\n this.remove(this._currentIndex - 1);\n }\n }\n\n public clear(): void {\n this.cut();\n\n if (this._currentIndex > 0) {\n this.remove(this._currentIndex - 1);\n }\n }\n\n public cut(): void {\n while (this._trajectory.length - 1 > this._currentIndex) {\n this._trajectory.pop();\n this._trajectoryTransforms.pop();\n this._trajectoryCameras.pop();\n }\n }\n\n public set(images: Image[]): void {\n this._setTrajectory(images);\n this._setCurrentImage();\n this._setReference(this._currentImage);\n this._setTrajectories();\n this._setCurrentCamera();\n }\n\n public getCenter(): number[] {\n return this._currentImage != null ?\n this.currentTransform.projectBasic(this._camera.lookat.toArray()) :\n [0.5, 0.5];\n }\n\n public setTransitionMode(mode: TransitionMode): void {\n this._transitionMode = mode;\n }\n\n protected _getAlpha(): number { return 1; }\n protected _getStateTransitionAlpha(): number { return 1; }\n\n protected _setCurrent(): void {\n this._setCurrentImage();\n\n let referenceReset: boolean = this._setReference(this._currentImage);\n if (referenceReset) {\n this._setTrajectories();\n }\n\n this._setCurrentCamera();\n }\n\n protected _setCurrentCamera(): void {\n this._currentCamera = this._trajectoryCameras[this._currentIndex].clone();\n this._previousCamera = this._currentIndex > 0 ?\n this._trajectoryCameras[this._currentIndex - 1].clone() :\n this._currentCamera.clone();\n }\n\n protected _motionlessTransition(): boolean {\n let imagesSet: boolean = this._currentImage != null && this._previousImage != null;\n\n return imagesSet && (\n this._transitionMode === TransitionMode.Instantaneous || !(\n this._currentImage.merged &&\n this._previousImage.merged &&\n this._withinOriginalDistance() &&\n this._sameConnectedComponent()\n ));\n }\n\n private _setReference(image: Image): boolean {\n // do not reset reference if image is within threshold distance\n if (Math.abs(image.lngLat.lat - this.reference.lat) < this._referenceThreshold &&\n Math.abs(image.lngLat.lng - this.reference.lng) < this._referenceThreshold) {\n return false;\n }\n\n // do not reset reference if previous image exist and transition is with motion\n if (this._previousImage != null && !this._motionlessTransition()) {\n return false;\n }\n\n this._reference.lat = image.lngLat.lat;\n this._reference.lng = image.lngLat.lng;\n this._reference.alt = image.computedAltitude;\n\n return true;\n }\n\n private _setCurrentImage(): void {\n this._currentImage = this._trajectory.length > 0 ?\n this._trajectory[this._currentIndex] :\n null;\n\n this._previousImage = this._currentIndex > 0 ?\n this._trajectory[this._currentIndex - 1] :\n null;\n }\n\n private _setTrajectory(images: Image[]): void {\n if (images.length < 1) {\n throw new ArgumentMapillaryError(\"Trajectory can not be empty\");\n }\n\n if (this._currentImage != null) {\n this._trajectory = [this._currentImage].concat(images);\n this._currentIndex = 1;\n } else {\n this._trajectory = images.slice();\n this._currentIndex = 0;\n }\n }\n\n private _setTrajectories(): void {\n this._trajectoryTransforms.length = 0;\n this._trajectoryCameras.length = 0;\n\n this._appendToTrajectories(this._trajectory);\n }\n\n private _appendToTrajectories(images: Image[]): void {\n for (let image of images) {\n if (!image.assetsCached) {\n throw new ArgumentMapillaryError(\"Assets must be cached when image is added to trajectory\");\n }\n\n let translation: number[] = this._imageToTranslation(image, this.reference);\n let transform: Transform = new Transform(\n image.exifOrientation,\n image.width,\n image.height,\n image.scale,\n image.rotation,\n translation,\n image.image,\n undefined,\n image.cameraParameters,\n <CameraType>image.cameraType);\n\n this._trajectoryTransforms.push(transform);\n this._trajectoryCameras.push(new Camera(transform));\n }\n }\n\n private _prependToTrajectories(images: Image[]): void {\n for (let image of images.reverse()) {\n if (!image.assetsCached) {\n throw new ArgumentMapillaryError(\"Assets must be cached when added to trajectory\");\n }\n\n let translation: number[] = this._imageToTranslation(image, this.reference);\n let transform: Transform = new Transform(\n image.exifOrientation,\n image.width,\n image.height,\n image.scale,\n image.rotation,\n translation,\n image.image,\n undefined,\n image.cameraParameters,\n <CameraType>image.cameraType);\n\n this._trajectoryTransforms.unshift(transform);\n this._trajectoryCameras.unshift(new Camera(transform));\n }\n }\n\n private _imageToTranslation(image: Image, reference: LngLatAlt): number[] {\n return Geo.computeTranslation(\n { alt: image.computedAltitude, lat: image.lngLat.lat, lng: image.lngLat.lng },\n image.rotation,\n reference);\n }\n\n private _sameConnectedComponent(): boolean {\n let current: Image = this._currentImage;\n let previous: Image = this._previousImage;\n\n return !!current && !!previous &&\n current.mergeId === previous.mergeId;\n }\n\n private _withinOriginalDistance(): boolean {\n let current: Image = this._currentImage;\n let previous: Image = this._previousImage;\n\n if (!current || !previous) {\n return true;\n }\n\n // 50 km/h moves 28m in 2s\n let distance = this._spatial.distanceFromLngLat(\n current.originalLngLat.lng,\n current.originalLngLat.lat,\n previous.originalLngLat.lng,\n previous.originalLngLat.lat);\n\n return distance < 25;\n }\n}\n","import { Matrix4, Vector3 } from \"three\";\nimport { StateBase } from \"./StateBase\";\nimport { IStateBase } from \"../interfaces/IStateBase\";\n\nexport class CustomState extends StateBase {\n constructor(state: IStateBase) {\n super(state);\n }\n\n public setViewMatrix(viewMatrix: number[]): void {\n const viewMatrixInverse = new Matrix4()\n .fromArray(viewMatrix)\n .invert();\n\n const me = viewMatrixInverse.elements;\n const eye = new Vector3(me[12], me[13], me[14]);\n const forward = new Vector3(-me[8], -me[9], -me[10]);\n const up = new Vector3(me[4], me[5], me[6]);\n\n const camera = this._camera;\n camera.position.copy(eye);\n camera.lookat.copy(eye\n .clone()\n .add(forward));\n camera.up.copy(up);\n\n const focal = 0.5 / Math.tan(Math.PI / 3);\n camera.focal = focal;\n }\n}\n","import { CatmullRomCurve3, MathUtils, Quaternion, Vector3 } from \"three\";\n\nimport { StateBase } from \"./StateBase\";\nimport { EulerRotation } from \"../interfaces/EulerRotation\";\nimport { IStateBase } from \"../interfaces/IStateBase\";\n\nexport class EarthState extends StateBase {\n private _transition: number = 0;\n private _curveE: CatmullRomCurve3;\n private _curveL: CatmullRomCurve3;\n private _curveU: CatmullRomCurve3;\n private _zoom0: number;\n private _zoom1: number;\n\n constructor(state: IStateBase) {\n super(state);\n\n const eye = this._camera.position.clone();\n const forward = this._camera.lookat\n .clone()\n .sub(eye)\n .normalize();\n const xy = Math.sqrt(forward.x * forward.x + forward.y * forward.y);\n const angle = Math.atan2(forward.z, xy);\n\n const lookat = new Vector3();\n if (angle > -Math.PI / 45) {\n lookat.copy(eye);\n eye.add(new Vector3(forward.x, forward.y, 0)\n .multiplyScalar(-50));\n eye.z = 30;\n } else {\n // Target a point on invented ground and keep forward direction\n const l0 = eye.clone();\n const n = new Vector3(0, 0, 1);\n const p0 = new Vector3(0, 0, -2);\n const d = new Vector3().subVectors(p0, l0).dot(n) / forward.dot(n);\n const maxDistance = 10000;\n const intersection = l0\n .clone()\n .add(\n forward.\n clone()\n .multiplyScalar(Math.min(maxDistance, d)));\n lookat.copy(intersection);\n\n const t = eye\n .clone()\n .sub(intersection)\n .normalize();\n eye.copy(\n intersection.add(\n t.multiplyScalar(Math.max(50, t.length()))));\n }\n\n const eye1 = this._camera.position.clone();\n const lookat1 = eye1.clone().add(forward.clone().normalize().multiplyScalar(10));\n const up1 = this._camera.up.clone();\n\n const eye0 = lookat1.clone();\n const lookat0 = eye0.clone().add(forward.clone().normalize().multiplyScalar(10));\n const up0 = up1.clone();\n\n const eye2 = eye.clone();\n const lookat2 = lookat.clone();\n const up2 = new Vector3(0, 0, 1);\n\n const eye3 = eye.clone().add(lookat2.clone().sub(eye2).normalize().multiplyScalar(-10));\n const lookat3 = lookat2.clone();\n const up3 = up2.clone();\n\n this._curveE = new CatmullRomCurve3([eye0, eye1, eye2, eye3]);\n this._curveL = new CatmullRomCurve3([lookat0, lookat1, lookat2, lookat3]);\n this._curveU = new CatmullRomCurve3([up0, up1, up2, up3]);\n\n this._zoom0 = this._zoom;\n this._zoom1 = 0;\n this._camera.focal = 0.5 / Math.tan(Math.PI / 4);\n }\n\n private get _isTransitioning(): boolean {\n return this._transition < 1;\n }\n\n public dolly(delta: number): void {\n if (this._isTransitioning) {\n return;\n }\n\n const camera = this._camera;\n const offset = camera.position\n .clone()\n .sub(camera.lookat);\n\n const length = offset.length();\n const scaled = length * Math.pow(2, -delta);\n const clipped = Math.max(1, Math.min(scaled, 4000));\n\n offset.normalize();\n offset.multiplyScalar(clipped);\n\n camera.position\n .copy(camera.lookat)\n .add(offset);\n }\n\n public orbit(rotation: EulerRotation): void {\n if (this._isTransitioning) {\n return;\n }\n\n const camera = this._camera;\n const q = new Quaternion()\n .setFromUnitVectors(\n camera.up,\n new Vector3(0, 0, 1));\n const qInverse = q\n .clone()\n .invert();\n\n const offset = camera.position\n .clone()\n .sub(camera.lookat);\n offset.applyQuaternion(q);\n const length = offset.length();\n\n let phi = Math.atan2(offset.y, offset.x);\n phi += rotation.phi;\n\n let theta = Math.atan2(\n Math.sqrt(offset.x * offset.x + offset.y * offset.y),\n offset.z);\n theta += rotation.theta;\n const threshold = Math.PI / 36;\n theta = Math.max(\n threshold,\n Math.min(\n Math.PI / 2 - threshold,\n theta));\n\n offset.x = Math.sin(theta) * Math.cos(phi);\n offset.y = Math.sin(theta) * Math.sin(phi);\n offset.z = Math.cos(theta);\n offset.applyQuaternion(qInverse);\n\n camera.position\n .copy(camera.lookat)\n .add(offset.multiplyScalar(length));\n }\n\n public truck(direction: number[]): void {\n if (this._isTransitioning) {\n return;\n }\n\n const camera = this._camera;\n camera.position\n .add(new Vector3().fromArray(direction));\n camera.lookat\n .add(new Vector3().fromArray(direction));\n }\n\n public update(delta: number): void {\n if (!this._isTransitioning) {\n return;\n }\n\n this._transition = Math.min(this._transition + 2 * delta / 3, 1);\n const sta = MathUtils.smootherstep(this._transition, 0, 1);\n const t = (sta + 1) / 3;\n\n const eye = this._curveE.getPoint(t);\n const lookat = this._curveL.getPoint(t);\n const up = this._curveU.getPoint(t);\n\n this._camera.position.copy(eye);\n this._camera.lookat.copy(lookat);\n this._camera.up.copy(up);\n this._zoom = MathUtils.lerp(this._zoom0, this._zoom1, sta);\n this._stateTransitionAlpha = sta;\n }\n\n protected _getStateTransitionAlpha(): number {\n return this._stateTransitionAlpha;\n }\n}\n","import { EulerRotation } from \"../interfaces/EulerRotation\";\n\nexport class EulerRotationDelta implements EulerRotation {\n private _phi: number;\n private _theta: number;\n\n constructor(phi: number, theta: number) {\n this._phi = phi;\n this._theta = theta;\n }\n\n public get phi(): number {\n return this._phi;\n }\n\n public set phi(value: number) {\n this._phi = value;\n }\n\n public get theta(): number {\n return this._theta;\n }\n\n public set theta(value: number) {\n this._theta = value;\n }\n\n public get isZero(): boolean {\n return this._phi === 0 && this._theta === 0;\n }\n\n public copy(delta: EulerRotation): void {\n this._phi = delta.phi;\n this._theta = delta.theta;\n }\n\n public lerp(other: EulerRotation, alpha: number): void {\n this._phi = (1 - alpha) * this._phi + alpha * other.phi;\n this._theta = (1 - alpha) * this._theta + alpha * other.theta;\n }\n\n public multiply(value: number): void {\n this._phi *= value;\n this._theta *= value;\n }\n\n public threshold(value: number): void {\n this._phi = Math.abs(this._phi) > value ? this._phi : 0;\n this._theta = Math.abs(this._theta) > value ? this._theta : 0;\n }\n\n public lengthSquared(): number {\n return this._phi * this._phi + this._theta * this._theta;\n }\n\n public reset(): void {\n this._phi = 0;\n this._theta = 0;\n }\n}\n","import * as THREE from \"three\";\n\nimport { StateBase } from \"./StateBase\";\n\nimport { EulerRotationDelta } from \"./EulerRotationDelta\";\nimport { EulerRotation } from \"../interfaces/EulerRotation\";\nimport { IStateBase } from \"../interfaces/IStateBase\";\nimport { Camera } from \"../../geo/Camera\";\nimport { Transform } from \"../../geo/Transform\";\nimport { Image } from \"../../graph/Image\";\nimport { isSpherical } from \"../../geo/Geo\";\n\nexport abstract class InteractiveStateBase extends StateBase {\n /**\n * Animation speed in transitions per frame at 60 FPS. Run time\n * animation speed is adjusted to FPS.\n */\n protected _animationSpeed: number;\n\n protected _rotationDelta: EulerRotationDelta;\n protected _requestedRotationDelta: EulerRotationDelta;\n\n protected _basicRotation: number[];\n protected _requestedBasicRotation: number[];\n protected _requestedBasicRotationUnbounded: number[];\n\n protected _rotationAcceleration: number;\n protected _rotationIncreaseAlpha: number;\n protected _rotationDecreaseAlpha: number;\n protected _rotationThreshold: number;\n protected _unboundedRotationAlpha: number;\n\n protected _desiredZoom: number;\n protected _minZoom: number;\n protected _maxZoom: number;\n protected _lookatDepth: number;\n protected _desiredLookat: THREE.Vector3;\n protected _desiredCenter: number[];\n\n constructor(state: IStateBase) {\n super(state);\n\n this._animationSpeed = 1 / 40;\n\n this._rotationDelta = new EulerRotationDelta(0, 0);\n this._requestedRotationDelta = null;\n\n this._basicRotation = [0, 0];\n this._requestedBasicRotation = null;\n this._requestedBasicRotationUnbounded = null;\n\n this._rotationAcceleration = 0.86;\n this._rotationIncreaseAlpha = 0.97;\n this._rotationDecreaseAlpha = 0.9;\n this._rotationThreshold = 1e-3;\n this._unboundedRotationAlpha = 0.8;\n\n this._desiredZoom = state.zoom;\n this._minZoom = 0;\n this._maxZoom = 3;\n this._lookatDepth = 10;\n\n this._desiredLookat = null;\n this._desiredCenter = null;\n }\n\n public rotate(rotationDelta: EulerRotation): void {\n if (this._currentImage == null) {\n return;\n }\n\n if (rotationDelta.phi === 0 && rotationDelta.theta === 0) {\n return;\n }\n\n this._desiredZoom = this._zoom;\n this._desiredLookat = null;\n this._requestedBasicRotation = null;\n\n if (this._requestedRotationDelta != null) {\n this._requestedRotationDelta.phi = this._requestedRotationDelta.phi + rotationDelta.phi;\n this._requestedRotationDelta.theta = this._requestedRotationDelta.theta + rotationDelta.theta;\n } else {\n this._requestedRotationDelta = new EulerRotationDelta(rotationDelta.phi, rotationDelta.theta);\n }\n }\n\n public rotateUnbounded(delta: EulerRotation): void {\n if (this._currentImage == null) {\n return;\n }\n\n this._requestedBasicRotation = null;\n this._requestedRotationDelta = null;\n\n this._applyRotation(delta, this._currentCamera);\n this._applyRotation(delta, this._previousCamera);\n\n if (!this._desiredLookat) {\n return;\n }\n\n const q: THREE.Quaternion = new THREE.Quaternion().setFromUnitVectors(this._currentCamera.up, new THREE.Vector3(0, 0, 1));\n const qInverse: THREE.Quaternion = q.clone().invert();\n\n const offset: THREE.Vector3 = new THREE.Vector3()\n .copy(this._desiredLookat)\n .sub(this._camera.position)\n .applyQuaternion(q);\n\n const length: number = offset.length();\n\n let phi: number = Math.atan2(offset.y, offset.x);\n phi += delta.phi;\n\n let theta: number = Math.atan2(Math.sqrt(offset.x * offset.x + offset.y * offset.y), offset.z);\n theta += delta.theta;\n theta = Math.max(0.1, Math.min(Math.PI - 0.1, theta));\n\n offset.x = Math.sin(theta) * Math.cos(phi);\n offset.y = Math.sin(theta) * Math.sin(phi);\n offset.z = Math.cos(theta);\n\n offset.applyQuaternion(qInverse);\n\n this._desiredLookat\n .copy(this._camera.position)\n .add(offset.multiplyScalar(length));\n }\n\n public rotateWithoutInertia(rotationDelta: EulerRotation): void {\n if (this._currentImage == null) {\n return;\n }\n\n this._desiredZoom = this._zoom;\n this._desiredLookat = null;\n this._requestedBasicRotation = null;\n this._requestedRotationDelta = null;\n\n const threshold: number = Math.PI / (10 * Math.pow(2, this._zoom));\n const delta: EulerRotation = {\n phi: this._spatial.clamp(rotationDelta.phi, -threshold, threshold),\n theta: this._spatial.clamp(rotationDelta.theta, -threshold, threshold),\n };\n\n this._applyRotation(delta, this._currentCamera);\n this._applyRotation(delta, this._previousCamera);\n }\n\n public rotateBasic(basicRotation: number[]): void {\n if (this._currentImage == null) {\n return;\n }\n\n this._desiredZoom = this._zoom;\n this._desiredLookat = null;\n this._requestedRotationDelta = null;\n\n if (this._requestedBasicRotation != null) {\n this._requestedBasicRotation[0] += basicRotation[0];\n this._requestedBasicRotation[1] += basicRotation[1];\n\n let threshold: number = 0.05 / Math.pow(2, this._zoom);\n\n this._requestedBasicRotation[0] =\n this._spatial.clamp(this._requestedBasicRotation[0], -threshold, threshold);\n\n this._requestedBasicRotation[1] =\n this._spatial.clamp(this._requestedBasicRotation[1], -threshold, threshold);\n } else {\n this._requestedBasicRotation = basicRotation.slice();\n }\n }\n\n public rotateBasicUnbounded(basicRotation: number[]): void {\n if (this._currentImage == null) {\n return;\n }\n\n if (this._requestedBasicRotationUnbounded != null) {\n this._requestedBasicRotationUnbounded[0] += basicRotation[0];\n this._requestedBasicRotationUnbounded[1] += basicRotation[1];\n } else {\n this._requestedBasicRotationUnbounded = basicRotation.slice();\n }\n }\n\n public rotateBasicWithoutInertia(basic: number[]): void {\n if (this._currentImage == null) {\n return;\n }\n\n this._desiredZoom = this._zoom;\n this._desiredLookat = null;\n this._requestedRotationDelta = null;\n this._requestedBasicRotation = null;\n\n const threshold: number = 0.05 / Math.pow(2, this._zoom);\n\n const basicRotation: number[] = basic.slice();\n basicRotation[0] = this._spatial.clamp(basicRotation[0], -threshold, threshold);\n basicRotation[1] = this._spatial.clamp(basicRotation[1], -threshold, threshold);\n\n this._applyRotationBasic(basicRotation);\n }\n\n public rotateToBasic(basic: number[]): void {\n if (this._currentImage == null) {\n return;\n }\n\n this._desiredZoom = this._zoom;\n this._desiredLookat = null;\n\n basic[0] = this._spatial.clamp(basic[0], 0, 1);\n basic[1] = this._spatial.clamp(basic[1], 0, 1);\n\n let lookat: number[] = this.currentTransform.unprojectBasic(basic, this._lookatDepth);\n this._currentCamera.lookat.fromArray(lookat);\n }\n\n public zoomIn(delta: number, reference: number[]): void {\n if (this._currentImage == null) {\n return;\n }\n\n this._desiredZoom = Math.max(this._minZoom, Math.min(this._maxZoom, this._desiredZoom + delta));\n\n let currentCenter: number[] = this.currentTransform.projectBasic(\n this._currentCamera.lookat.toArray());\n\n let currentCenterX: number = currentCenter[0];\n let currentCenterY: number = currentCenter[1];\n\n let zoom0: number = Math.pow(2, this._zoom);\n let zoom1: number = Math.pow(2, this._desiredZoom);\n\n let refX: number = reference[0];\n let refY: number = reference[1];\n\n if (isSpherical(this.currentTransform.cameraType)) {\n if (refX - currentCenterX > 0.5) {\n refX = refX - 1;\n } else if (currentCenterX - refX > 0.5) {\n refX = 1 + refX;\n }\n }\n\n let newCenterX: number = refX - zoom0 / zoom1 * (refX - currentCenterX);\n let newCenterY: number = refY - zoom0 / zoom1 * (refY - currentCenterY);\n\n if (isSpherical(this._currentImage.cameraType)) {\n newCenterX = this._spatial\n .wrap(newCenterX + this._basicRotation[0], 0, 1);\n newCenterY = this._spatial\n .clamp(newCenterY + this._basicRotation[1], 0.05, 0.95);\n } else {\n newCenterX = this._spatial.clamp(newCenterX, 0, 1);\n newCenterY = this._spatial.clamp(newCenterY, 0, 1);\n }\n\n this._desiredLookat = new THREE.Vector3()\n .fromArray(this.currentTransform.unprojectBasic([newCenterX, newCenterY], this._lookatDepth));\n }\n\n public setCenter(center: number[]): void {\n this._desiredLookat = null;\n this._requestedRotationDelta = null;\n this._requestedBasicRotation = null;\n this._desiredZoom = this._zoom;\n\n let clamped: number[] = [\n this._spatial.clamp(center[0], 0, 1),\n this._spatial.clamp(center[1], 0, 1),\n ];\n\n if (this._currentImage == null) {\n this._desiredCenter = clamped;\n return;\n }\n\n this._desiredCenter = null;\n\n let currentLookat: THREE.Vector3 = new THREE.Vector3()\n .fromArray(this.currentTransform.unprojectBasic(clamped, this._lookatDepth));\n\n let previousTransform: Transform = this.previousTransform != null ?\n this.previousTransform :\n this.currentTransform;\n let previousLookat: THREE.Vector3 = new THREE.Vector3()\n .fromArray(previousTransform.unprojectBasic(clamped, this._lookatDepth));\n\n this._currentCamera.lookat.copy(currentLookat);\n this._previousCamera.lookat.copy(previousLookat);\n }\n\n public setZoom(zoom: number): void {\n this._desiredLookat = null;\n this._requestedRotationDelta = null;\n this._requestedBasicRotation = null;\n\n this._zoom = this._spatial.clamp(zoom, this._minZoom, this._maxZoom);\n this._desiredZoom = this._zoom;\n }\n\n protected _applyRotation(delta: EulerRotation, camera: Camera): void {\n if (camera == null) {\n return;\n }\n\n let q: THREE.Quaternion = new THREE.Quaternion().setFromUnitVectors(camera.up, new THREE.Vector3(0, 0, 1));\n let qInverse: THREE.Quaternion = q.clone().invert();\n\n let offset: THREE.Vector3 = new THREE.Vector3();\n offset.copy(camera.lookat).sub(camera.position);\n offset.applyQuaternion(q);\n let length: number = offset.length();\n\n let phi: number = Math.atan2(offset.y, offset.x);\n phi += delta.phi;\n\n let theta: number = Math.atan2(Math.sqrt(offset.x * offset.x + offset.y * offset.y), offset.z);\n theta += delta.theta;\n theta = Math.max(0.1, Math.min(Math.PI - 0.1, theta));\n\n offset.x = Math.sin(theta) * Math.cos(phi);\n offset.y = Math.sin(theta) * Math.sin(phi);\n offset.z = Math.cos(theta);\n offset.applyQuaternion(qInverse);\n\n camera.lookat.copy(camera.position).add(offset.multiplyScalar(length));\n }\n\n protected _applyRotationBasic(basicRotation: number[]): void {\n let currentImage: Image = this._currentImage;\n let previousImage: Image = this._previousImage != null ?\n this.previousImage :\n this.currentImage;\n\n let currentCamera: Camera = this._currentCamera;\n let previousCamera: Camera = this._previousCamera;\n\n let currentTransform: Transform = this.currentTransform;\n let previousTransform: Transform = this.previousTransform != null ?\n this.previousTransform :\n this.currentTransform;\n\n let currentBasic: number[] = currentTransform.projectBasic(currentCamera.lookat.toArray());\n let previousBasic: number[] = previousTransform.projectBasic(previousCamera.lookat.toArray());\n\n if (isSpherical(currentImage.cameraType)) {\n currentBasic[0] = this._spatial.wrap(currentBasic[0] + basicRotation[0], 0, 1);\n currentBasic[1] = this._spatial.clamp(currentBasic[1] + basicRotation[1], 0.05, 0.95);\n } else {\n currentBasic[0] = this._spatial.clamp(currentBasic[0] + basicRotation[0], 0, 1);\n currentBasic[1] = this._spatial.clamp(currentBasic[1] + basicRotation[1], 0, 1);\n }\n\n if (isSpherical(previousImage.cameraType)) {\n previousBasic[0] = this._spatial.wrap(previousBasic[0] + basicRotation[0], 0, 1);\n previousBasic[1] = this._spatial.clamp(previousBasic[1] + basicRotation[1], 0.05, 0.95);\n } else {\n previousBasic[0] = this._spatial.clamp(previousBasic[0] + basicRotation[0], 0, 1);\n previousBasic[1] = this._spatial.clamp(currentBasic[1] + basicRotation[1], 0, 1);\n }\n\n let currentLookat: number[] = currentTransform.unprojectBasic(currentBasic, this._lookatDepth);\n currentCamera.lookat.fromArray(currentLookat);\n\n let previousLookat: number[] = previousTransform.unprojectBasic(previousBasic, this._lookatDepth);\n previousCamera.lookat.fromArray(previousLookat);\n }\n\n protected _updateZoom(animationSpeed: number): void {\n let diff: number = this._desiredZoom - this._zoom;\n let sign: number = diff > 0 ? 1 : diff < 0 ? -1 : 0;\n\n if (diff === 0) {\n return;\n } else if (Math.abs(diff) < 2e-3) {\n this._zoom = this._desiredZoom;\n if (this._desiredLookat != null) {\n this._desiredLookat = null;\n }\n } else {\n this._zoom += sign * Math.max(Math.abs(5 * animationSpeed * diff), 2e-3);\n }\n }\n\n protected _updateLookat(animationSpeed: number): void {\n if (this._desiredLookat === null) {\n return;\n }\n\n let diff: number = this._desiredLookat.distanceToSquared(this._currentCamera.lookat);\n\n if (Math.abs(diff) < 1e-6) {\n this._currentCamera.lookat.copy(this._desiredLookat);\n this._desiredLookat = null;\n } else {\n this._currentCamera.lookat.lerp(this._desiredLookat, 5 * animationSpeed);\n }\n }\n\n protected _updateRotation(): void {\n if (this._requestedRotationDelta != null) {\n let length: number = this._rotationDelta.lengthSquared();\n let requestedLength: number = this._requestedRotationDelta.lengthSquared();\n\n if (requestedLength > length) {\n this._rotationDelta.lerp(this._requestedRotationDelta, this._rotationIncreaseAlpha);\n } else {\n this._rotationDelta.lerp(this._requestedRotationDelta, this._rotationDecreaseAlpha);\n }\n\n this._requestedRotationDelta = null;\n\n return;\n }\n\n if (this._rotationDelta.isZero) {\n return;\n }\n\n const alpha: number = isSpherical(this.currentImage.cameraType) ?\n 1 : this._alpha;\n\n this._rotationDelta.multiply(this._rotationAcceleration * alpha);\n this._rotationDelta.threshold(this._rotationThreshold);\n }\n\n protected _updateRotationBasic(): void {\n if (this._requestedBasicRotation != null) {\n let x: number = this._basicRotation[0];\n let y: number = this._basicRotation[1];\n\n let reqX: number = this._requestedBasicRotation[0];\n let reqY: number = this._requestedBasicRotation[1];\n\n if (Math.abs(reqX) > Math.abs(x)) {\n this._basicRotation[0] = (1 - this._rotationIncreaseAlpha) * x + this._rotationIncreaseAlpha * reqX;\n } else {\n this._basicRotation[0] = (1 - this._rotationDecreaseAlpha) * x + this._rotationDecreaseAlpha * reqX;\n }\n\n if (Math.abs(reqY) > Math.abs(y)) {\n this._basicRotation[1] = (1 - this._rotationIncreaseAlpha) * y + this._rotationIncreaseAlpha * reqY;\n } else {\n this._basicRotation[1] = (1 - this._rotationDecreaseAlpha) * y + this._rotationDecreaseAlpha * reqY;\n }\n\n this._requestedBasicRotation = null;\n\n return;\n }\n\n if (this._requestedBasicRotationUnbounded != null) {\n let reqX: number = this._requestedBasicRotationUnbounded[0];\n let reqY: number = this._requestedBasicRotationUnbounded[1];\n\n if (Math.abs(reqX) > 0) {\n this._basicRotation[0] = (1 - this._unboundedRotationAlpha) * this._basicRotation[0] + this._unboundedRotationAlpha * reqX;\n }\n\n if (Math.abs(reqY) > 0) {\n this._basicRotation[1] = (1 - this._unboundedRotationAlpha) * this._basicRotation[1] + this._unboundedRotationAlpha * reqY;\n }\n\n if (this._desiredLookat != null) {\n let desiredBasicLookat: number[] = this.currentTransform.projectBasic(this._desiredLookat.toArray());\n\n desiredBasicLookat[0] += reqX;\n desiredBasicLookat[1] += reqY;\n\n this._desiredLookat = new THREE.Vector3()\n .fromArray(this.currentTransform.unprojectBasic(desiredBasicLookat, this._lookatDepth));\n }\n\n this._requestedBasicRotationUnbounded = null;\n }\n\n if (this._basicRotation[0] === 0 && this._basicRotation[1] === 0) {\n return;\n }\n\n this._basicRotation[0] = this._rotationAcceleration * this._basicRotation[0];\n this._basicRotation[1] = this._rotationAcceleration * this._basicRotation[1];\n\n if (Math.abs(this._basicRotation[0]) < this._rotationThreshold / Math.pow(2, this._zoom) &&\n Math.abs(this._basicRotation[1]) < this._rotationThreshold / Math.pow(2, this._zoom)) {\n this._basicRotation = [0, 0];\n }\n }\n\n protected _clearRotation(): void {\n if (isSpherical(this._currentImage.cameraType)) {\n return;\n }\n\n if (this._requestedRotationDelta != null) {\n this._requestedRotationDelta = null;\n }\n\n if (!this._rotationDelta.isZero) {\n this._rotationDelta.reset();\n }\n\n if (this._requestedBasicRotation != null) {\n this._requestedBasicRotation = null;\n }\n\n if (this._basicRotation[0] > 0 || this._basicRotation[1] > 0) {\n this._basicRotation = [0, 0];\n }\n }\n\n protected _setDesiredCenter(): void {\n if (this._desiredCenter == null) {\n return;\n }\n\n let lookatDirection: THREE.Vector3 = new THREE.Vector3()\n .fromArray(this.currentTransform.unprojectBasic(this._desiredCenter, this._lookatDepth))\n .sub(this._currentCamera.position);\n\n this._currentCamera.lookat.copy(this._currentCamera.position.clone().add(lookatDirection));\n this._previousCamera.lookat.copy(this._previousCamera.position.clone().add(lookatDirection));\n\n this._desiredCenter = null;\n }\n\n protected _setDesiredZoom(): void {\n this._desiredZoom =\n isSpherical(this._currentImage.cameraType) ||\n this._previousImage == null ?\n this._zoom : 0;\n }\n}\n","import { InteractiveStateBase } from \"./InteractiveStateBase\";\nimport { IStateBase } from \"../interfaces/IStateBase\";\nimport { Image } from \"../../graph/Image\";\nimport { isSpherical } from \"../../geo/Geo\";\n\nexport class InteractiveWaitingState extends InteractiveStateBase {\n constructor(state: IStateBase) {\n super(state);\n\n this._adjustCameras();\n\n this._motionless = this._motionlessTransition();\n }\n\n public prepend(images: Image[]): void {\n super.prepend(images);\n\n this._motionless = this._motionlessTransition();\n }\n\n public set(images: Image[]): void {\n super.set(images);\n\n this._motionless = this._motionlessTransition();\n }\n\n public move(delta: number): void {\n this._alpha = Math.max(0, Math.min(1, this._alpha + delta));\n }\n\n public moveTo(position: number): void {\n this._alpha = Math.max(0, Math.min(1, position));\n }\n\n public update(delta: number): void {\n this._updateRotation();\n if (!this._rotationDelta.isZero) {\n this._applyRotation(this._rotationDelta, this._previousCamera);\n this._applyRotation(this._rotationDelta, this._currentCamera);\n }\n\n this._updateRotationBasic();\n if (this._basicRotation[0] !== 0 || this._basicRotation[1] !== 0) {\n this._applyRotationBasic(this._basicRotation);\n }\n\n let animationSpeed = this._animationSpeed * delta / 1e-1 * 6;\n this._updateZoom(animationSpeed);\n this._updateLookat(animationSpeed);\n\n this._camera.lerpCameras(this._previousCamera, this._currentCamera, this.alpha);\n }\n\n protected _getAlpha(): number {\n return this._motionless ? Math.round(this._alpha) : this._alpha;\n }\n\n protected _setCurrentCamera(): void {\n super._setCurrentCamera();\n\n this._adjustCameras();\n }\n\n private _adjustCameras(): void {\n if (this._previousImage == null) {\n return;\n }\n\n if (isSpherical(this._currentImage.cameraType)) {\n let lookat: THREE.Vector3 = this._camera.lookat.clone().sub(this._camera.position);\n this._currentCamera.lookat.copy(lookat.clone().add(this._currentCamera.position));\n }\n\n if (isSpherical(this._previousImage.cameraType)) {\n let lookat: THREE.Vector3 = this._currentCamera.lookat.clone().sub(this._currentCamera.position);\n this._previousCamera.lookat.copy(lookat.clone().add(this._previousCamera.position));\n }\n }\n}\n","import { MathUtils } from \"three\";\n\nimport { InteractiveStateBase } from \"./InteractiveStateBase\";\nimport { IStateBase } from \"../interfaces/IStateBase\";\nimport { Image } from \"../../graph/Image\";\nimport { isSpherical } from \"../../geo/Geo\";\n\nexport class TraversingState extends InteractiveStateBase {\n\n private _baseAlpha: number;\n\n private _speedCoefficient: number;\n\n private _smoothing: boolean;\n\n constructor(state: IStateBase) {\n super(state);\n\n this._adjustCameras();\n\n this._motionless = this._motionlessTransition();\n\n this._baseAlpha = this._alpha;\n this._speedCoefficient = 1;\n this._smoothing = false;\n }\n\n public append(images: Image[]): void {\n let emptyTrajectory: boolean = this._trajectory.length === 0;\n\n if (emptyTrajectory) {\n this._resetTransition();\n }\n\n super.append(images);\n\n if (emptyTrajectory) {\n this._setDesiredCenter();\n this._setDesiredZoom();\n }\n }\n\n public prepend(images: Image[]): void {\n let emptyTrajectory: boolean = this._trajectory.length === 0;\n\n if (emptyTrajectory) {\n this._resetTransition();\n }\n\n super.prepend(images);\n\n if (emptyTrajectory) {\n this._setDesiredCenter();\n this._setDesiredZoom();\n }\n }\n\n public set(images: Image[]): void {\n super.set(images);\n\n this._desiredLookat = null;\n\n this._resetTransition();\n this._clearRotation();\n\n this._setDesiredCenter();\n this._setDesiredZoom();\n\n if (this._trajectory.length < 3) {\n this._smoothing = true;\n }\n }\n\n public setSpeed(speed: number): void {\n this._speedCoefficient = this._spatial.clamp(speed, 0, 10);\n }\n\n public update(delta: number): void {\n if (this._alpha === 1 && this._currentIndex + this._alpha < this._trajectory.length) {\n this._currentIndex += 1;\n\n this._smoothing = this._trajectory.length < 3 &&\n this._currentIndex + 1 === this._trajectory.length;\n\n this._setCurrent();\n this._resetTransition();\n this._clearRotation();\n\n this._desiredZoom =\n isSpherical(this._currentImage.cameraType) ?\n this._zoom : 0;\n\n this._desiredLookat = null;\n }\n\n let animationSpeed: number = this._animationSpeed * delta / 1e-1 * 6;\n this._baseAlpha = Math.min(1, this._baseAlpha + this._speedCoefficient * animationSpeed);\n if (this._smoothing) {\n this._alpha = MathUtils.smootherstep(this._baseAlpha, 0, 1);\n } else {\n this._alpha = this._baseAlpha;\n }\n\n this._updateRotation();\n if (!this._rotationDelta.isZero) {\n this._applyRotation(this._rotationDelta, this._previousCamera);\n this._applyRotation(this._rotationDelta, this._currentCamera);\n }\n\n this._updateRotationBasic();\n if (this._basicRotation[0] !== 0 || this._basicRotation[1] !== 0) {\n this._applyRotationBasic(this._basicRotation);\n }\n\n this._updateZoom(animationSpeed);\n this._updateLookat(animationSpeed);\n\n this._camera.lerpCameras(this._previousCamera, this._currentCamera, this.alpha);\n }\n\n protected _getAlpha(): number {\n return this._motionless ? Math.ceil(this._alpha) : this._alpha;\n }\n\n protected _setCurrentCamera(): void {\n super._setCurrentCamera();\n\n this._adjustCameras();\n }\n\n private _adjustCameras(): void {\n if (this._previousImage == null) {\n return;\n }\n\n let lookat: THREE.Vector3 = this._camera.lookat.clone().sub(this._camera.position);\n this._previousCamera.lookat.copy(lookat.clone().add(this._previousCamera.position));\n\n if (isSpherical(this._currentImage.cameraType)) {\n this._currentCamera.lookat.copy(lookat.clone().add(this._currentCamera.position));\n }\n }\n\n private _resetTransition(): void {\n this._alpha = 0;\n this._baseAlpha = 0;\n\n this._motionless = this._motionlessTransition();\n }\n}\n","import { StateBase } from \"./StateBase\";\nimport { IStateBase } from \"../interfaces/IStateBase\";\nimport { Image } from \"../../graph/Image\";\nimport { isSpherical } from \"../../geo/Geo\";\n\nexport class WaitingState extends StateBase {\n constructor(state: IStateBase) {\n super(state);\n\n this._zoom = 0;\n\n this._adjustCameras();\n\n this._motionless = this._motionlessTransition();\n }\n\n public prepend(images: Image[]): void {\n super.prepend(images);\n\n this._motionless = this._motionlessTransition();\n }\n\n public set(images: Image[]): void {\n super.set(images);\n\n this._motionless = this._motionlessTransition();\n }\n\n public move(delta: number): void {\n this._alpha = Math.max(0, Math.min(1, this._alpha + delta));\n }\n\n public moveTo(position: number): void {\n this._alpha = Math.max(0, Math.min(1, position));\n }\n\n public update(): void {\n this._camera.lerpCameras(this._previousCamera, this._currentCamera, this.alpha);\n }\n\n protected _getAlpha(): number {\n return this._motionless ? Math.round(this._alpha) : this._alpha;\n }\n\n protected _setCurrentCamera(): void {\n super._setCurrentCamera();\n\n this._adjustCameras();\n }\n\n private _adjustCameras(): void {\n if (this._previousImage == null) {\n return;\n }\n\n if (isSpherical(this._currentImage.cameraType)) {\n let lookat: THREE.Vector3 = this._camera.lookat.clone().sub(this._camera.position);\n this._currentCamera.lookat.copy(lookat.clone().add(this._currentCamera.position));\n }\n\n if (isSpherical(this._previousImage.cameraType)) {\n let lookat: THREE.Vector3 = this._currentCamera.lookat.clone().sub(this._currentCamera.position);\n this._previousCamera.lookat.copy(lookat.clone().add(this._previousCamera.position));\n }\n }\n}\n","import { IStateBase } from \"./interfaces/IStateBase\";\nimport { State } from \"./State\";\nimport { CustomState } from \"./state/CustomState\";\nimport { EarthState } from \"./state/EarthState\";\nimport { InteractiveWaitingState } from \"./state/InteractiveWaitingState\";\nimport { StateBase } from \"./state/StateBase\";\nimport { TraversingState } from \"./state/TraversingState\";\nimport { WaitingState } from \"./state/WaitingState\";\n\ntype StateCreators = Map<string, new (state: IStateBase) => StateBase>;\n\nexport class StateTransitionMatrix {\n private readonly _creators: StateCreators;\n private readonly _transitions: Map<string, string[]>;\n\n constructor() {\n const custom = State[State.Custom];\n const earth = State[State.Earth];\n const traverse = State[State.Traversing];\n const wait = State[State.Waiting];\n const waitInteractively = State[State.WaitingInteractively];\n\n this._creators = new Map();\n const creator = this._creators;\n creator.set(custom, CustomState);\n creator.set(earth, EarthState);\n creator.set(traverse, TraversingState);\n creator.set(wait, WaitingState);\n creator.set(waitInteractively, InteractiveWaitingState);\n\n this._transitions = new Map();\n const transitions = this._transitions;\n transitions.set(custom, [earth, traverse]);\n transitions.set(earth, [custom, traverse]);\n transitions.set(traverse, [custom, earth, wait, waitInteractively]);\n transitions.set(wait, [traverse, waitInteractively]);\n transitions.set(waitInteractively, [traverse, wait]);\n }\n\n public getState(state: StateBase): State {\n if (state instanceof CustomState) {\n return State.Custom;\n } else if (state instanceof EarthState) {\n return State.Earth;\n } else if (state instanceof TraversingState) {\n return State.Traversing;\n } else if (state instanceof WaitingState) {\n return State.Waiting;\n } else if (state instanceof InteractiveWaitingState) {\n return State.WaitingInteractively;\n }\n throw new Error(\"Invalid state instance\");\n }\n\n public generate(state: State, options: IStateBase): StateBase {\n const concreteState = this._creators.get(State[state]);\n return new concreteState(options);\n }\n\n public transition(state: StateBase, to: State): StateBase {\n if (!this.validate(state, to)) {\n throw new Error(\"Invalid transition\");\n }\n return this.generate(to, state);\n }\n\n public validate(state: StateBase, to: State): boolean {\n const source = State[this.getState(state)];\n const target = State[to];\n const transitions = this._transitions;\n\n return transitions.has(source) &&\n transitions.get(source).includes(target);\n }\n}\n","import { State } from \"./State\";\nimport { TransitionMode } from \"./TransitionMode\";\nimport { EulerRotation } from \"./interfaces/EulerRotation\";\nimport { IStateContext } from \"./interfaces/IStateContext\";\nimport { StateBase } from \"./state/StateBase\";\n\nimport { Camera } from \"../geo/Camera\";\nimport { Transform } from \"../geo/Transform\";\nimport { LngLatAlt } from \"../api/interfaces/LngLatAlt\";\nimport { Image } from \"../graph/Image\";\nimport { StateTransitionMatrix } from \"./StateTransitionMatrix\";\n\nexport class StateContext implements IStateContext {\n private _state: StateBase;\n private _transitions: StateTransitionMatrix;\n\n constructor(\n state: State,\n transitionMode?: TransitionMode) {\n this._transitions = new StateTransitionMatrix();\n this._state = this._transitions.generate(\n state,\n {\n alpha: 1,\n camera: new Camera(),\n currentIndex: -1,\n reference: { alt: 0, lat: 0, lng: 0 },\n trajectory: [],\n transitionMode: transitionMode == null ? TransitionMode.Default : transitionMode,\n zoom: 0,\n });\n }\n\n public get state(): State {\n return this._transitions.getState(this._state);\n }\n\n public get reference(): LngLatAlt {\n return this._state.reference;\n }\n\n public get alpha(): number {\n return this._state.alpha;\n }\n\n public get stateTransitionAlpha(): number {\n return this._state.stateTransitionAlpha;\n }\n\n public get camera(): Camera {\n return this._state.camera;\n }\n\n public get zoom(): number {\n return this._state.zoom;\n }\n\n public get currentImage(): Image {\n return this._state.currentImage;\n }\n\n public get previousImage(): Image {\n return this._state.previousImage;\n }\n\n public get currentCamera(): Camera {\n return this._state.currentCamera;\n }\n\n public get currentTransform(): Transform {\n return this._state.currentTransform;\n }\n\n public get previousTransform(): Transform {\n return this._state.previousTransform;\n }\n\n public get trajectory(): Image[] {\n return this._state.trajectory;\n }\n\n public get currentIndex(): number {\n return this._state.currentIndex;\n }\n\n public get lastImage(): Image {\n return this._state.trajectory[this._state.trajectory.length - 1];\n }\n\n public get imagesAhead(): number {\n return this._state.trajectory.length - 1 - this._state.currentIndex;\n }\n\n public get motionless(): boolean {\n return this._state.motionless;\n }\n\n public custom(): void {\n this._transition(State.Custom);\n }\n\n public earth(): void {\n this._transition(State.Earth);\n }\n\n public traverse(): void {\n this._transition(State.Traversing);\n }\n\n public wait(): void {\n this._transition(State.Waiting);\n }\n\n public waitInteractively(): void {\n this._transition(State.WaitingInteractively);\n }\n\n public getCenter(): number[] {\n return this._state.getCenter();\n }\n\n public setCenter(center: number[]): void {\n this._state.setCenter(center);\n }\n\n public setZoom(zoom: number): void {\n this._state.setZoom(zoom);\n }\n\n public update(delta: number): void {\n this._state.update(delta);\n }\n\n public append(images: Image[]): void {\n this._state.append(images);\n }\n\n public prepend(images: Image[]): void {\n this._state.prepend(images);\n }\n\n public remove(n: number): void {\n this._state.remove(n);\n }\n\n public clear(): void {\n this._state.clear();\n }\n\n public clearPrior(): void {\n this._state.clearPrior();\n }\n\n public cut(): void {\n this._state.cut();\n }\n\n public set(images: Image[]): void {\n this._state.set(images);\n }\n\n public setViewMatrix(matrix: number[]): void {\n this._state.setViewMatrix(matrix);\n }\n\n public rotate(delta: EulerRotation): void {\n this._state.rotate(delta);\n }\n\n public rotateUnbounded(delta: EulerRotation): void {\n this._state.rotateUnbounded(delta);\n }\n\n public rotateWithoutInertia(delta: EulerRotation): void {\n this._state.rotateWithoutInertia(delta);\n }\n\n public rotateBasic(basicRotation: number[]): void {\n this._state.rotateBasic(basicRotation);\n }\n\n public rotateBasicUnbounded(basicRotation: number[]): void {\n this._state.rotateBasicUnbounded(basicRotation);\n }\n\n public rotateBasicWithoutInertia(basicRotation: number[]): void {\n this._state.rotateBasicWithoutInertia(basicRotation);\n }\n\n public rotateToBasic(basic: number[]): void {\n this._state.rotateToBasic(basic);\n }\n\n public move(delta: number): void {\n this._state.move(delta);\n }\n\n public moveTo(delta: number): void {\n this._state.moveTo(delta);\n }\n\n public zoomIn(delta: number, reference: number[]): void {\n this._state.zoomIn(delta, reference);\n }\n\n public setSpeed(speed: number): void {\n this._state.setSpeed(speed);\n }\n\n public setTransitionMode(mode: TransitionMode): void {\n this._state.setTransitionMode(mode);\n }\n\n public dolly(delta: number): void {\n this._state.dolly(delta);\n }\n\n public orbit(rotation: EulerRotation): void {\n this._state.orbit(rotation);\n }\n\n public truck(direction: number[]): void {\n this._state.truck(direction);\n }\n\n private _transition(to: State): void {\n if (!this._transitions.validate(this._state, to)) {\n const from = this._transitions.getState(this._state);\n console.warn(\n `Transition not valid (${State[from]} - ${State[to]})`);\n return;\n }\n const state = this._transitions.transition(this._state, to);\n this._state = state;\n }\n}\n","import {\n BehaviorSubject,\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport {\n bufferCount,\n distinctUntilChanged,\n filter,\n first,\n map,\n pairwise,\n publishReplay,\n refCount,\n scan,\n share,\n startWith,\n switchMap,\n tap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { FrameGenerator } from \"./FrameGenerator\";\nimport { State } from \"./State\";\nimport { StateContext } from \"./StateContext\";\nimport { TransitionMode } from \"./TransitionMode\";\nimport { AnimationFrame } from \"./interfaces/AnimationFrame\";\nimport { EulerRotation } from \"./interfaces/EulerRotation\";\nimport { IStateContext } from \"./interfaces/IStateContext\";\n\nimport { LngLat } from \"../api/interfaces/LngLat\";\nimport { Camera } from \"../geo/Camera\";\nimport { Image } from \"../graph/Image\";\nimport { Transform } from \"../geo/Transform\";\nimport { LngLatAlt } from \"../api/interfaces/LngLatAlt\";\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\nimport { Clock } from \"three\";\n\ninterface IContextOperation {\n (context: IStateContext): IStateContext;\n}\n\nexport class StateService {\n private _start$: Subject<void>;\n\n private _frame$: Subject<number>;\n\n private _contextOperation$: BehaviorSubject<IContextOperation>;\n private _context$: Observable<IStateContext>;\n private _state$: Observable<State>;\n\n private _currentState$: Observable<AnimationFrame>;\n private _lastState$: Observable<AnimationFrame>;\n private _currentImage$: Observable<Image>;\n private _currentImageExternal$: Observable<Image>;\n private _currentCamera$: Observable<Camera>;\n private _currentId$: BehaviorSubject<string>;\n private _currentTransform$: Observable<Transform>;\n private _reference$: Observable<LngLatAlt>;\n\n private _inMotionOperation$: Subject<boolean>;\n private _inMotion$: Observable<boolean>;\n\n private _inTranslationOperation$: Subject<boolean>;\n private _inTranslation$: Observable<boolean>;\n\n private _appendImage$: Subject<Image> = new Subject<Image>();\n\n private _frameGenerator: FrameGenerator;\n private _frameId: number;\n\n private _clock: Clock = new Clock();\n private _subscriptions: SubscriptionHolder = new SubscriptionHolder();\n\n\n constructor(\n initialState: State,\n transitionMode?: TransitionMode) {\n\n const subs = this._subscriptions;\n\n this._start$ = new Subject<void>();\n this._frame$ = new Subject<number>();\n\n this._contextOperation$ = new BehaviorSubject<IContextOperation>(\n (context: IStateContext): IStateContext => {\n return context;\n });\n\n this._context$ = this._contextOperation$.pipe(\n scan(\n (context: IStateContext, operation: IContextOperation): IStateContext => {\n return operation(context);\n },\n new StateContext(initialState, transitionMode)),\n publishReplay(1),\n refCount());\n\n this._state$ = this._context$.pipe(\n map(\n (context: IStateContext): State => {\n return context.state;\n }),\n distinctUntilChanged(),\n publishReplay(1),\n refCount());\n\n this._currentState$ = this._frame$.pipe(\n withLatestFrom(\n this._context$,\n (frameId: number, context: IStateContext): [number, IStateContext] => {\n return [frameId, context];\n }),\n filter(\n (fc: [number, IStateContext]): boolean => {\n return fc[1].currentImage != null;\n }),\n tap(\n (fc: [number, IStateContext]): void => {\n fc[1].update(this._clock.getDelta());\n }),\n map(\n (fc: [number, IStateContext]): AnimationFrame => {\n return { fps: 60, id: fc[0], state: fc[1] };\n }),\n share());\n\n this._lastState$ = this._currentState$.pipe(\n publishReplay(1),\n refCount());\n\n let imageChanged$ = this._currentState$.pipe(\n distinctUntilChanged(\n undefined,\n (f: AnimationFrame): string => {\n return f.state.currentImage.id;\n }),\n publishReplay(1),\n refCount());\n\n let imageChangedSubject$ = new Subject<AnimationFrame>();\n\n subs.push(imageChanged$\n .subscribe(imageChangedSubject$));\n\n this._currentId$ = new BehaviorSubject<string>(null);\n\n subs.push(imageChangedSubject$.pipe(\n map(\n (f: AnimationFrame): string => {\n return f.state.currentImage.id;\n }))\n .subscribe(this._currentId$));\n\n this._currentImage$ = imageChangedSubject$.pipe(\n map(\n (f: AnimationFrame): Image => {\n return f.state.currentImage;\n }),\n publishReplay(1),\n refCount());\n\n this._currentCamera$ = imageChangedSubject$.pipe(\n map(\n (f: AnimationFrame): Camera => {\n return f.state.currentCamera;\n }),\n publishReplay(1),\n refCount());\n\n this._currentTransform$ = imageChangedSubject$.pipe(\n map(\n (f: AnimationFrame): Transform => {\n return f.state.currentTransform;\n }),\n publishReplay(1),\n refCount());\n\n this._reference$ = imageChangedSubject$.pipe(\n map(\n (f: AnimationFrame): LngLatAlt => {\n return f.state.reference;\n }),\n distinctUntilChanged(\n (r1: LngLat, r2: LngLat): boolean => {\n return r1.lat === r2.lat && r1.lng === r2.lng;\n },\n (reference: LngLatAlt): LngLat => {\n return { lat: reference.lat, lng: reference.lng };\n }),\n publishReplay(1),\n refCount());\n\n this._currentImageExternal$ = imageChanged$.pipe(\n map(\n (f: AnimationFrame): Image => {\n return f.state.currentImage;\n }),\n publishReplay(1),\n refCount());\n\n subs.push(this._appendImage$.pipe(\n map(\n (image: Image) => {\n return (context: IStateContext): IStateContext => {\n context.append([image]);\n\n return context;\n };\n }))\n .subscribe(this._contextOperation$));\n\n this._inMotionOperation$ = new Subject<boolean>();\n\n subs.push(imageChanged$.pipe(\n map(\n (): boolean => {\n return true;\n }))\n .subscribe(this._inMotionOperation$));\n\n subs.push(this._inMotionOperation$.pipe(\n distinctUntilChanged(),\n filter(\n (moving: boolean): boolean => {\n return moving;\n }),\n switchMap(\n (): Observable<boolean> => {\n return this._currentState$.pipe(\n filter(\n (frame: AnimationFrame): boolean => {\n return frame.state.imagesAhead === 0;\n }),\n map(\n (frame: AnimationFrame): [Camera, number] => {\n return [frame.state.camera.clone(), frame.state.zoom];\n }),\n pairwise(),\n map(\n (pair: [[Camera, number], [Camera, number]]): boolean => {\n let c1: Camera = pair[0][0];\n let c2: Camera = pair[1][0];\n\n let z1: number = pair[0][1];\n let z2: number = pair[1][1];\n\n return c1.diff(c2) > 1e-5 || Math.abs(z1 - z2) > 1e-5;\n }),\n first(\n (changed: boolean): boolean => {\n return !changed;\n }));\n }))\n .subscribe(this._inMotionOperation$));\n\n this._inMotion$ = this._inMotionOperation$.pipe(\n distinctUntilChanged(),\n publishReplay(1),\n refCount());\n\n this._inTranslationOperation$ = new Subject<boolean>();\n\n subs.push(imageChanged$.pipe(\n map(\n (): boolean => {\n return true;\n }))\n .subscribe(this._inTranslationOperation$));\n\n subs.push(this._inTranslationOperation$.pipe(\n distinctUntilChanged(),\n filter(\n (inTranslation: boolean): boolean => {\n return inTranslation;\n }),\n switchMap(\n (): Observable<boolean> => {\n return this._currentState$.pipe(\n filter(\n (frame: AnimationFrame): boolean => {\n return frame.state.imagesAhead === 0;\n }),\n map(\n (frame: AnimationFrame): THREE.Vector3 => {\n return frame.state.camera.position.clone();\n }),\n pairwise(),\n map(\n (pair: [THREE.Vector3, THREE.Vector3]): boolean => {\n return pair[0].distanceToSquared(pair[1]) !== 0;\n }),\n first(\n (changed: boolean): boolean => {\n return !changed;\n }));\n }))\n .subscribe(this._inTranslationOperation$));\n\n this._inTranslation$ = this._inTranslationOperation$.pipe(\n distinctUntilChanged(),\n publishReplay(1),\n refCount());\n\n subs.push(this._state$.subscribe(() => { /*noop*/ }));\n subs.push(this._currentImage$.subscribe(() => { /*noop*/ }));\n subs.push(this._currentCamera$.subscribe(() => { /*noop*/ }));\n subs.push(this._currentTransform$.subscribe(() => { /*noop*/ }));\n subs.push(this._reference$.subscribe(() => { /*noop*/ }));\n subs.push(this._currentImageExternal$.subscribe(() => { /*noop*/ }));\n subs.push(this._lastState$.subscribe(() => { /*noop*/ }));\n subs.push(this._inMotion$.subscribe(() => { /*noop*/ }));\n subs.push(this._inTranslation$.subscribe(() => { /*noop*/ }));\n\n this._frameId = null;\n this._frameGenerator = new FrameGenerator(window);\n }\n\n public get currentState$(): Observable<AnimationFrame> {\n return this._currentState$;\n }\n\n public get currentImage$(): Observable<Image> {\n return this._currentImage$;\n }\n\n public get currentId$(): Observable<string> {\n return this._currentId$;\n }\n\n public get currentImageExternal$(): Observable<Image> {\n return this._currentImageExternal$;\n }\n\n public get currentCamera$(): Observable<Camera> {\n return this._currentCamera$;\n }\n\n public get currentTransform$(): Observable<Transform> {\n return this._currentTransform$;\n }\n\n public get state$(): Observable<State> {\n return this._state$;\n }\n\n public get reference$(): Observable<LngLatAlt> {\n return this._reference$;\n }\n\n public get inMotion$(): Observable<boolean> {\n return this._inMotion$;\n }\n\n public get inTranslation$(): Observable<boolean> {\n return this._inTranslation$;\n }\n\n public get appendImage$(): Subject<Image> {\n return this._appendImage$;\n }\n\n public dispose(): void {\n this.stop();\n this._subscriptions.unsubscribe();\n }\n\n public custom(): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => {\n context.custom();\n });\n }\n\n public earth(): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.earth(); });\n }\n\n public traverse(): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.traverse(); });\n }\n\n public wait(): void {\n this._invokeContextOperation((context: IStateContext) => { context.wait(); });\n }\n\n public waitInteractively(): void {\n this._invokeContextOperation((context: IStateContext) => { context.waitInteractively(); });\n }\n\n public appendImagess(images: Image[]): void {\n this._invokeContextOperation((context: IStateContext) => { context.append(images); });\n }\n\n public prependImages(images: Image[]): void {\n this._invokeContextOperation((context: IStateContext) => { context.prepend(images); });\n }\n\n public removeImages(n: number): void {\n this._invokeContextOperation((context: IStateContext) => { context.remove(n); });\n }\n\n public clearImages(): void {\n this._invokeContextOperation((context: IStateContext) => { context.clear(); });\n }\n\n public clearPriorImages(): void {\n this._invokeContextOperation((context: IStateContext) => { context.clearPrior(); });\n }\n\n public cutImages(): void {\n this._invokeContextOperation((context: IStateContext) => { context.cut(); });\n }\n\n public setImages(images: Image[]): void {\n this._invokeContextOperation((context: IStateContext) => { context.set(images); });\n }\n\n public setViewMatrix(matrix: number[]): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.setViewMatrix(matrix); });\n }\n\n public rotate(delta: EulerRotation): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.rotate(delta); });\n }\n\n public rotateUnbounded(delta: EulerRotation): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.rotateUnbounded(delta); });\n }\n\n public rotateWithoutInertia(delta: EulerRotation): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.rotateWithoutInertia(delta); });\n }\n\n public rotateBasic(basicRotation: number[]): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.rotateBasic(basicRotation); });\n }\n\n public rotateBasicUnbounded(basicRotation: number[]): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.rotateBasicUnbounded(basicRotation); });\n }\n\n public rotateBasicWithoutInertia(basicRotation: number[]): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.rotateBasicWithoutInertia(basicRotation); });\n }\n\n public rotateToBasic(basic: number[]): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.rotateToBasic(basic); });\n }\n\n public move(delta: number): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.move(delta); });\n }\n\n public moveTo(position: number): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.moveTo(position); });\n }\n\n public dolly(delta: number): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.dolly(delta); });\n }\n\n public orbit(rotation: EulerRotation): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.orbit(rotation); });\n }\n\n public truck(direction: number[]): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.truck(direction); });\n }\n\n /**\n * Change zoom level while keeping the reference point position approximately static.\n *\n * @parameter {number} delta - Change in zoom level.\n * @parameter {Array<number>} reference - Reference point in basic coordinates.\n */\n public zoomIn(delta: number, reference: number[]): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.zoomIn(delta, reference); });\n }\n\n public getCenter(): Observable<number[]> {\n return this._lastState$.pipe(\n first(),\n map(\n (frame: AnimationFrame): number[] => {\n return (<IStateContext>frame.state).getCenter();\n }));\n }\n\n public getZoom(): Observable<number> {\n return this._lastState$.pipe(\n first(),\n map(\n (frame: AnimationFrame): number => {\n return frame.state.zoom;\n }));\n }\n\n public setCenter(center: number[]): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.setCenter(center); });\n }\n\n public setSpeed(speed: number): void {\n this._invokeContextOperation((context: IStateContext) => { context.setSpeed(speed); });\n }\n\n public setTransitionMode(mode: TransitionMode): void {\n this._invokeContextOperation((context: IStateContext) => { context.setTransitionMode(mode); });\n }\n\n public setZoom(zoom: number): void {\n this._inMotionOperation$.next(true);\n this._invokeContextOperation((context: IStateContext) => { context.setZoom(zoom); });\n }\n\n public start(): void {\n this._clock.start();\n if (this._frameId == null) {\n this._start$.next(null);\n this._frameId = this._frameGenerator.requestAnimationFrame(this._frame.bind(this));\n this._frame$.next(this._frameId);\n }\n }\n\n public stop(): void {\n this._clock.stop();\n if (this._frameId != null) {\n this._frameGenerator.cancelAnimationFrame(this._frameId);\n this._frameId = null;\n }\n }\n\n private _invokeContextOperation(action: (context: IStateContext) => void): void {\n this._contextOperation$\n .next(\n (context: IStateContext): IStateContext => {\n action(context);\n return context;\n });\n }\n\n private _frame(): void {\n this._frameId = this._frameGenerator.requestAnimationFrame(this._frame.bind(this));\n this._frame$.next(this._frameId);\n }\n}\n","import { State } from \"../state/State\";\nimport { CameraControls } from \"./enums/CameraControls\";\n\nexport function cameraControlsToState(cameraControls: CameraControls): State {\n switch (cameraControls) {\n case CameraControls.Custom:\n return State.Custom;\n case CameraControls.Earth:\n return State.Earth;\n case CameraControls.Street:\n return State.Traversing;\n default:\n return null;\n }\n}\n","import {\n from as observableFrom,\n throwError as observableThrowError,\n BehaviorSubject,\n Observable,\n ReplaySubject,\n Subscription,\n} from \"rxjs\";\n\nimport {\n finalize,\n first,\n last,\n map,\n mergeAll,\n mergeMap,\n tap,\n} from \"rxjs/operators\";\n\nimport { CacheService } from \"./CacheService\";\nimport { LoadingService } from \"./LoadingService\";\nimport { PanService } from \"./PanService\";\nimport { PlayService } from \"./PlayService\";\nimport { ViewerOptions } from \"./options/ViewerOptions\";\n\nimport { APIWrapper } from \"../api/APIWrapper\";\nimport { CancelMapillaryError } from \"../error/CancelMapillaryError\";\nimport { FilterExpression } from \"../graph/FilterExpression\";\nimport { Graph } from \"../graph/Graph\";\nimport { GraphService } from \"../graph/GraphService\";\nimport { Image } from \"../graph/Image\";\nimport { NavigationDirection } from \"../graph/edge/NavigationDirection\";\nimport { NavigationEdgeStatus } from \"../graph/interfaces/NavigationEdgeStatus\";\nimport { StateService } from \"../state/StateService\";\nimport { AnimationFrame } from \"../state/interfaces/AnimationFrame\";\nimport { cameraControlsToState } from \"./Modes\";\nimport { CameraControls } from \"./enums/CameraControls\";\nimport { GraphDataProvider } from \"../api/provider/GraphDataProvider\";\n\nexport class Navigator {\n private _api: APIWrapper;\n\n private _cacheService: CacheService;\n private _graphService: GraphService;\n private _loadingService: LoadingService;\n private _loadingName: string;\n private _panService: PanService;\n private _playService: PlayService;\n private _stateService: StateService;\n\n private _idRequested$: BehaviorSubject<string>;\n private _movedToId$: BehaviorSubject<string>;\n\n private _request$: ReplaySubject<Image>;\n private _requestSubscription: Subscription;\n private _imageRequestSubscription: Subscription;\n\n constructor(\n options: ViewerOptions,\n api?: APIWrapper,\n graphService?: GraphService,\n loadingService?: LoadingService,\n stateService?: StateService,\n cacheService?: CacheService,\n playService?: PlayService,\n panService?: PanService) {\n\n if (api) {\n this._api = api;\n } else if (options.dataProvider) {\n this._api = new APIWrapper(options.dataProvider);\n } else {\n this._api = new APIWrapper(new GraphDataProvider({\n accessToken: options.accessToken,\n }));\n }\n\n this._graphService = graphService ??\n new GraphService(new Graph(this.api));\n\n this._loadingName = \"navigator\";\n this._loadingService = loadingService ??\n new LoadingService();\n\n const cameraControls = options.cameraControls ?? CameraControls.Street;\n this._stateService = stateService ??\n new StateService(\n cameraControlsToState(cameraControls),\n options.transitionMode);\n\n this._cacheService = cacheService ??\n new CacheService(\n this._graphService,\n this._stateService,\n this._api);\n\n this._playService = playService ??\n new PlayService(this._graphService, this._stateService);\n\n this._panService = panService ??\n new PanService(\n this._graphService,\n this._stateService,\n options.combinedPanning);\n\n this._idRequested$ = new BehaviorSubject<string>(null);\n this._movedToId$ = new BehaviorSubject<string>(null);\n\n this._request$ = null;\n this._requestSubscription = null;\n this._imageRequestSubscription = null;\n }\n\n public get api(): APIWrapper {\n return this._api;\n }\n\n public get cacheService(): CacheService {\n return this._cacheService;\n }\n\n public get graphService(): GraphService {\n return this._graphService;\n }\n\n public get loadingService(): LoadingService {\n return this._loadingService;\n }\n\n public get movedToId$(): Observable<string> {\n return this._movedToId$;\n }\n\n public get panService(): PanService {\n return this._panService;\n }\n\n public get playService(): PlayService {\n return this._playService;\n }\n\n public get stateService(): StateService {\n return this._stateService;\n }\n\n public dispose(): void {\n this._abortRequest(\"viewer removed\");\n\n this._cacheService.stop();\n this._graphService.dispose();\n this._panService.dispose();\n this._playService.dispose();\n this._stateService.dispose();\n }\n\n public moveTo$(id: string): Observable<Image> {\n this._abortRequest(`to id ${id}`);\n this._loadingService.startLoading(this._loadingName);\n\n const image$ = this._moveTo$(id);\n return this._makeRequest$(image$);\n }\n\n public moveDir$(direction: NavigationDirection): Observable<Image> {\n this._abortRequest(`in dir ${NavigationDirection[direction]}`);\n\n this._loadingService.startLoading(this._loadingName);\n\n const image$ = this.stateService.currentImage$.pipe(\n first(),\n mergeMap(\n (image: Image): Observable<string> => {\n return ([NavigationDirection.Next, NavigationDirection.Prev].indexOf(direction) > -1 ?\n image.sequenceEdges$ :\n image.spatialEdges$).pipe(\n first(),\n map(\n (status: NavigationEdgeStatus): string => {\n for (let edge of status.edges) {\n if (edge.data.direction === direction) {\n return edge.target;\n }\n }\n\n return null;\n }));\n }),\n mergeMap(\n (directionId: string) => {\n if (directionId == null) {\n this._loadingService.stopLoading(this._loadingName);\n\n return observableThrowError(new Error(`Direction (${direction}) does not exist for current image.`));\n }\n\n return this._moveTo$(directionId);\n }));\n\n return this._makeRequest$(image$);\n }\n\n public setFilter$(filter: FilterExpression): Observable<void> {\n this._stateService.clearImages();\n\n return this._movedToId$.pipe(\n first(),\n mergeMap(\n (id: string): Observable<Image> => {\n if (id != null) {\n return this._trajectoryIds$().pipe(\n mergeMap(\n (ids: string[]): Observable<Image> => {\n return this._graphService.setFilter$(filter).pipe(\n mergeMap(\n (): Observable<Image> => {\n return this._cacheIds$(ids);\n }));\n }),\n last());\n }\n\n return this._idRequested$.pipe(\n first(),\n mergeMap(\n (requestedId: string): Observable<Image> => {\n if (requestedId != null) {\n return this._graphService.setFilter$(filter).pipe(\n mergeMap(\n (): Observable<Image> => {\n return this._graphService.cacheImage$(requestedId);\n }));\n }\n\n return this._graphService.setFilter$(filter).pipe(\n map(\n (): Image => {\n return undefined;\n }));\n }));\n }),\n map(\n (): void => {\n return undefined;\n }));\n }\n\n public setAccessToken$(accessToken?: string): Observable<void> {\n this._abortRequest(\"to set user token\");\n\n this._stateService.clearImages();\n\n return this._movedToId$.pipe(\n first(),\n tap(\n (): void => {\n this._api.setAccessToken(accessToken);\n }),\n mergeMap(\n (id: string): Observable<void> => {\n return id == null ?\n this._graphService.reset$([]) :\n this._trajectoryIds$().pipe(\n mergeMap(\n (ids: string[]): Observable<Image> => {\n return this._graphService.reset$(ids).pipe(\n mergeMap(\n (): Observable<Image> => {\n return this._cacheIds$(ids);\n }));\n }),\n last(),\n map(\n (): void => {\n return undefined;\n }));\n }));\n }\n\n private _cacheIds$(ids: string[]): Observable<Image> {\n const cacheImages$ = ids\n .map(\n (id: string): Observable<Image> => {\n return this._graphService.cacheImage$(id);\n });\n\n return observableFrom(cacheImages$).pipe(\n mergeAll());\n }\n\n private _abortRequest(reason: string): void {\n if (this._requestSubscription != null) {\n this._requestSubscription.unsubscribe();\n this._requestSubscription = null;\n }\n\n if (this._imageRequestSubscription != null) {\n this._imageRequestSubscription.unsubscribe();\n this._imageRequestSubscription = null;\n }\n\n if (this._request$ != null) {\n if (!(this._request$.isStopped || this._request$.hasError)) {\n this._request$.error(new CancelMapillaryError(`Request aborted by a subsequent request ${reason}.`));\n }\n\n this._request$ = null;\n }\n }\n\n private _makeRequest$(image$: Observable<Image>): Observable<Image> {\n const request$: ReplaySubject<Image> = new ReplaySubject<Image>(1);\n this._requestSubscription = request$\n .subscribe(undefined, (): void => { /*noop*/ });\n\n this._request$ = request$;\n\n this._imageRequestSubscription = image$\n .subscribe(\n (image: Image): void => {\n this._request$ = null;\n\n request$.next(image);\n request$.complete();\n },\n (error: Error): void => {\n this._request$ = null;\n\n request$.error(error);\n });\n\n return request$;\n }\n\n private _moveTo$(id: string): Observable<Image> {\n this._idRequested$.next(id);\n\n return this._graphService.cacheImage$(id).pipe(\n tap(\n (image: Image) => {\n this._stateService.setImages([image]);\n this._movedToId$.next(image.id);\n }),\n finalize(\n (): void => {\n this._loadingService.stopLoading(this._loadingName);\n }));\n }\n\n private _trajectoryIds$(): Observable<string[]> {\n return this._stateService.currentState$.pipe(\n first(),\n map(\n (frame: AnimationFrame): string[] => {\n return frame.state.trajectory\n .map(\n (image: Image): string => {\n return image.id;\n });\n }));\n }\n}\n","import * as THREE from \"three\";\n\nimport { LngLat } from \"../api/interfaces/LngLat\";\nimport { Spatial } from \"../geo/Spatial\";\nimport { Transform } from \"../geo/Transform\";\nimport { ViewportCoords } from \"../geo/ViewportCoords\";\nimport { LngLatAlt } from \"../api/interfaces/LngLatAlt\";\nimport { RenderCamera } from \"../render/RenderCamera\";\nimport {\n enuToGeodetic,\n geodeticToEnu,\n} from \"../geo/GeoCoords\";\nimport { Unprojection } from \"./interfaces/Unprojection\";\n\nexport class Projection {\n private _spatial: Spatial;\n private _viewportCoords: ViewportCoords;\n\n constructor(viewportCoords?: ViewportCoords, spatial?: Spatial) {\n this._spatial = spatial ?? new Spatial();\n this._viewportCoords = viewportCoords ?? new ViewportCoords();\n }\n\n public basicToCanvas(\n basicPoint: number[],\n container: HTMLElement,\n render: RenderCamera,\n transform: Transform)\n : number[] {\n\n return this._viewportCoords\n .basicToCanvasSafe(\n basicPoint[0],\n basicPoint[1],\n container,\n transform,\n render.perspective);\n }\n\n public canvasToBasic(\n canvasPoint: number[],\n container: HTMLElement,\n render: RenderCamera,\n transform: Transform)\n : number[] {\n\n let basicPoint = this._viewportCoords\n .canvasToBasic(\n canvasPoint[0],\n canvasPoint[1],\n container,\n transform,\n render.perspective);\n\n if (basicPoint[0] < 0 ||\n basicPoint[0] > 1 ||\n basicPoint[1] < 0 ||\n basicPoint[1] > 1) {\n basicPoint = null;\n }\n\n return basicPoint;\n }\n\n public eventToUnprojection(\n event: MouseEvent | Touch,\n container: HTMLElement,\n render: RenderCamera,\n reference: LngLatAlt,\n transform: Transform)\n : Unprojection {\n\n const pixelPoint = this._viewportCoords\n .canvasPosition(event, container);\n\n return this.canvasToUnprojection(\n pixelPoint,\n container,\n render,\n reference,\n transform);\n }\n\n public canvasToUnprojection(\n canvasPoint: number[],\n container: HTMLElement,\n render: RenderCamera,\n reference: LngLatAlt,\n transform: Transform)\n : Unprojection {\n\n const canvasX = canvasPoint[0];\n const canvasY = canvasPoint[1];\n\n const [viewportX, viewportY] =\n this._viewportCoords\n .canvasToViewport(\n canvasX,\n canvasY,\n container);\n\n const point3d = new THREE.Vector3(viewportX, viewportY, 1)\n .unproject(render.perspective);\n\n let basicPoint = transform\n .projectBasic(point3d.toArray());\n\n if (basicPoint[0] < 0 ||\n basicPoint[0] > 1 ||\n basicPoint[1] < 0 ||\n basicPoint[1] > 1) {\n basicPoint = null;\n }\n\n const direction3d = point3d\n .clone()\n .sub(render.camera.position)\n .normalize();\n\n const dist = -2 / direction3d.z;\n\n let lngLat: LngLat = null;\n if (dist > 0 && dist < 100 && !!basicPoint) {\n const point = direction3d\n .clone()\n .multiplyScalar(dist)\n .add(render.camera.position);\n\n const [lng, lat] = enuToGeodetic(\n point.x,\n point.y,\n point.z,\n reference.lng,\n reference.lat,\n reference.alt);\n\n lngLat = { lat, lng };\n }\n\n const unprojection: Unprojection = {\n basicPoint: basicPoint,\n lngLat: lngLat,\n pixelPoint: [canvasX, canvasY],\n };\n\n return unprojection;\n }\n\n public cameraToLngLat(render: RenderCamera, reference: LngLatAlt): LngLat {\n const position = render.camera.position;\n const [lng, lat] = enuToGeodetic(\n position.x,\n position.y,\n position.z,\n reference.lng,\n reference.lat,\n reference.alt);\n\n return { lat, lng };\n }\n\n public lngLatToCanvas(\n lngLat: LngLat,\n container: HTMLElement,\n render: RenderCamera,\n reference: LngLatAlt): number[] {\n\n const point3d = geodeticToEnu(\n lngLat.lng,\n lngLat.lat,\n 0,\n reference.lng,\n reference.lat,\n reference.alt);\n\n const canvas = this._viewportCoords\n .projectToCanvasSafe(\n point3d,\n container,\n render.perspective);\n\n return canvas;\n }\n\n public distanceBetweenLngLats(lngLat1: LngLat, lngLat2: LngLat): number {\n return this._spatial\n .distanceFromLngLat(\n lngLat1.lng,\n lngLat1.lat,\n lngLat2.lng,\n lngLat2.lat);\n }\n}\n","import {\n combineLatest as observableCombineLatest,\n empty as observableEmpty,\n merge as observableMerge,\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport {\n auditTime,\n distinctUntilChanged,\n first,\n map,\n switchMap,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { Container } from \"./Container\";\nimport { Navigator } from \"./Navigator\";\nimport { Projection } from \"./Projection\";\nimport { Unprojection } from \"./interfaces/Unprojection\";\nimport { ViewerMouseEvent } from \"./events/ViewerMouseEvent\";\n\nimport { LngLat } from \"../api/interfaces/LngLat\";\nimport { Transform } from \"../geo/Transform\";\nimport { LngLatAlt } from \"../api/interfaces/LngLatAlt\";\nimport { Image } from \"../graph/Image\";\nimport { NavigationEdgeStatus } from \"../graph/interfaces/NavigationEdgeStatus\";\nimport { RenderCamera } from \"../render/RenderCamera\";\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\nimport { ViewerEventType } from \"./events/ViewerEventType\";\nimport { IViewer } from \"./interfaces/IViewer\";\nimport { ViewerNavigableEvent } from \"./events/ViewerNavigableEvent\";\nimport { ViewerDataLoadingEvent } from \"./events/ViewerDataLoadingEvent\";\nimport { ViewerImageEvent } from \"./events/ViewerImageEvent\";\nimport { ViewerNavigationEdgeEvent } from \"./events/ViewerNavigationEdgeEvent\";\nimport { ViewerStateEvent } from \"./events/ViewerStateEvent\";\nimport { ViewerBearingEvent } from \"./events/ViewerBearingEvent\";\nimport { State } from \"../state/State\";\nimport { ViewerLoadEvent } from \"./events/ViewerLoadEvent\";\nimport { ViewerReferenceEvent } from \"./events/ViewerReferenceEvent\";\n\ntype UnprojectionParams = [\n [\n ViewerMouseEvent['type'],\n MouseEvent,\n ],\n RenderCamera,\n LngLatAlt,\n Transform,\n State,\n];\n\nexport class Observer {\n private _started: boolean;\n\n private _navigable$: Subject<boolean>;\n\n private _subscriptions: SubscriptionHolder =\n new SubscriptionHolder();\n private _emitSubscriptions: SubscriptionHolder =\n new SubscriptionHolder();\n\n private _container: Container;\n private _viewer: IViewer;\n private _navigator: Navigator;\n private _projection: Projection;\n\n constructor(\n viewer: IViewer,\n navigator: Navigator,\n container: Container) {\n this._container = container;\n this._viewer = viewer;\n this._navigator = navigator;\n this._projection = new Projection();\n\n this._started = false;\n\n this._navigable$ = new Subject<boolean>();\n\n const subs = this._subscriptions;\n\n // load, navigable, dataloading should always emit,\n // also when cover is activated.\n subs.push(this._navigable$\n .subscribe(\n (navigable: boolean): void => {\n const type: ViewerEventType = \"navigable\";\n const event: ViewerNavigableEvent = {\n navigable,\n target: this._viewer,\n type,\n };\n this._viewer.fire(type, event);\n }));\n\n subs.push(this._navigator.loadingService.loading$\n .subscribe(\n (loading: boolean): void => {\n const type: ViewerEventType = \"dataloading\";\n const event: ViewerDataLoadingEvent = {\n loading,\n target: this._viewer,\n type,\n };\n this._viewer.fire(type, event);\n }));\n\n subs.push(this._container.glRenderer.opaqueRender$\n .pipe(first())\n .subscribe(\n (): void => {\n const type: ViewerEventType = \"load\";\n const event: ViewerLoadEvent = {\n target: this._viewer,\n type,\n };\n this._viewer.fire(type, event);\n }));\n }\n\n public get started(): boolean {\n return this._started;\n }\n\n public get navigable$(): Subject<boolean> {\n return this._navigable$;\n }\n\n public get projection(): Projection {\n return this._projection;\n }\n\n public dispose(): void {\n this.stopEmit();\n this._subscriptions.unsubscribe();\n }\n\n public project$(\n lngLat: LngLat)\n : Observable<number[]> {\n return observableCombineLatest(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentImage$,\n this._navigator.stateService.reference$).pipe(\n first(),\n map(\n ([render, image, reference]: [RenderCamera, Image, LngLatAlt]): number[] => {\n if (this._projection\n .distanceBetweenLngLats(\n lngLat,\n image.lngLat) > 1000) {\n return null;\n }\n\n const canvasPoint: number[] =\n this._projection.lngLatToCanvas(\n lngLat,\n this._container.container,\n render,\n reference);\n\n return !!canvasPoint ?\n [Math.round(canvasPoint[0]), Math.round(canvasPoint[1])] :\n null;\n }));\n }\n\n public projectBasic$(\n basicPoint: number[])\n : Observable<number[]> {\n return observableCombineLatest(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentTransform$).pipe(\n first(),\n map(\n ([render, transform]: [RenderCamera, Transform]): number[] => {\n const canvasPoint: number[] = this._projection.basicToCanvas(\n basicPoint,\n this._container.container,\n render,\n transform);\n\n return !!canvasPoint ?\n [Math.round(canvasPoint[0]), Math.round(canvasPoint[1])] :\n null;\n }));\n }\n\n public startEmit(): void {\n if (this._started) { return; }\n\n this._started = true;\n const subs = this._emitSubscriptions;\n\n subs.push(this._navigator.stateService.currentImageExternal$\n .subscribe((image: Image): void => {\n const type: ViewerEventType = \"image\";\n const event: ViewerImageEvent = {\n image,\n target: this._viewer,\n type,\n };\n this._viewer.fire(type, event);\n }));\n\n subs.push(this._navigator.stateService.currentImageExternal$.pipe(\n switchMap(\n (image: Image): Observable<NavigationEdgeStatus> => {\n return image.sequenceEdges$;\n }))\n .subscribe(\n (status: NavigationEdgeStatus): void => {\n const type: ViewerEventType = \"sequenceedges\";\n const event: ViewerNavigationEdgeEvent = {\n status,\n target: this._viewer,\n type,\n };\n this._viewer.fire(type, event);\n }));\n\n subs.push(this._navigator.stateService.currentImageExternal$.pipe(\n switchMap(\n (image: Image): Observable<NavigationEdgeStatus> => {\n return image.spatialEdges$;\n }))\n .subscribe(\n (status: NavigationEdgeStatus): void => {\n const type: ViewerEventType = \"spatialedges\";\n const event: ViewerNavigationEdgeEvent = {\n status,\n target: this._viewer,\n type,\n };\n this._viewer.fire(type, event);\n }));\n\n subs.push(this._navigator.stateService.reference$\n .subscribe((reference: LngLatAlt): void => {\n const type: ViewerEventType = \"reference\";\n const event: ViewerReferenceEvent = {\n reference,\n target: this._viewer,\n type,\n };\n this._viewer.fire(type, event);\n }));\n\n subs.push(observableCombineLatest(\n this._navigator.stateService.inMotion$,\n this._container.mouseService.active$,\n this._container.touchService.active$).pipe(\n map(\n (values: boolean[]): boolean => {\n return values[0] || values[1] || values[2];\n }),\n distinctUntilChanged())\n .subscribe(\n (started: boolean) => {\n const type: ViewerEventType = started ? \"movestart\" : \"moveend\";\n const event: ViewerStateEvent = {\n target: this._viewer,\n type,\n };\n this._viewer.fire(type, event);\n }));\n\n subs.push(this._container.renderService.bearing$.pipe(\n auditTime(100),\n distinctUntilChanged(\n (b1: number, b2: number): boolean => {\n return Math.abs(b2 - b1) < 1;\n }))\n .subscribe(\n (bearing): void => {\n const type: ViewerEventType = \"bearing\";\n const event: ViewerBearingEvent = {\n bearing,\n target: this._viewer,\n type,\n };\n this._viewer.fire(type, event);\n }));\n\n const mouseMove$ = this._container.mouseService.active$.pipe(\n switchMap(\n (active: boolean): Observable<MouseEvent> => {\n return active ?\n observableEmpty() :\n this._container.mouseService.mouseMove$;\n }));\n\n subs.push(observableMerge(\n this._mapMouseEvent$(\n \"click\",\n this._container.mouseService.staticClick$),\n this._mapMouseEvent$(\n \"contextmenu\",\n this._container.mouseService.contextMenu$),\n this._mapMouseEvent$(\n \"dblclick\",\n this._container.mouseService.dblClick$),\n this._mapMouseEvent$(\n \"mousedown\",\n this._container.mouseService.mouseDown$),\n this._mapMouseEvent$(\n \"mousemove\",\n mouseMove$),\n this._mapMouseEvent$(\n \"mouseout\",\n this._container.mouseService.mouseOut$),\n this._mapMouseEvent$(\n \"mouseover\",\n this._container.mouseService.mouseOver$),\n this._mapMouseEvent$(\n \"mouseup\",\n this._container.mouseService.mouseUp$))\n .pipe(\n withLatestFrom(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.reference$,\n this._navigator.stateService.currentTransform$,\n this._navigator.stateService.state$),\n map(\n ([[type, event], render, reference, transform, state]\n : UnprojectionParams)\n : ViewerMouseEvent => {\n const unprojection: Unprojection =\n this._projection.eventToUnprojection(\n event,\n this._container.container,\n render,\n reference,\n transform);\n\n const basicPoint = state === State.Traversing ?\n unprojection.basicPoint : null;\n\n return {\n basicPoint,\n lngLat: unprojection.lngLat,\n originalEvent: event,\n pixelPoint: unprojection.pixelPoint,\n target: this._viewer,\n type: type,\n };\n }))\n .subscribe(\n (event: ViewerMouseEvent): void => {\n this._viewer.fire(event.type, event);\n }));\n\n subs.push(this._container.renderService.renderCamera$.pipe(\n distinctUntilChanged(\n ([x1, y1], [x2, y2]): boolean => {\n return this._closeTo(x1, x2, 1e-2) &&\n this._closeTo(y1, y2, 1e-2);\n },\n (rc: RenderCamera): number[] => {\n return rc.camera.position.toArray();\n }))\n .subscribe(\n (): void => {\n const type: ViewerEventType = \"position\";\n const event: ViewerStateEvent = {\n target: this._viewer,\n type,\n };\n this._viewer.fire(type, event);\n }));\n\n subs.push(this._container.renderService.renderCamera$.pipe(\n distinctUntilChanged(\n ([phi1, theta1], [phi2, theta2]): boolean => {\n return this._closeTo(phi1, phi2, 1e-3) &&\n this._closeTo(theta1, theta2, 1e-3);\n },\n (rc: RenderCamera): [number, number] => {\n return [rc.rotation.phi, rc.rotation.theta];\n }))\n .subscribe(\n (): void => {\n const type: ViewerEventType = \"pov\";\n const event: ViewerStateEvent = {\n target: this._viewer,\n type,\n };\n this._viewer.fire(type, event);\n }));\n\n subs.push(this._container.renderService.renderCamera$.pipe(\n distinctUntilChanged(\n (fov1, fov2): boolean => {\n return this._closeTo(fov1, fov2, 1e-2);\n },\n (rc: RenderCamera): number => {\n return rc.perspective.fov;\n }))\n .subscribe(\n (): void => {\n const type: ViewerEventType = \"fov\";\n const event: ViewerStateEvent = {\n target: this._viewer,\n type,\n };\n this._viewer.fire(type, event);\n }));\n }\n\n public stopEmit(): void {\n if (!this.started) { return; }\n\n this._emitSubscriptions.unsubscribe();\n this._started = false;\n }\n\n public unproject$(canvasPoint: number[]): Observable<LngLat> {\n return observableCombineLatest(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.reference$,\n this._navigator.stateService.currentTransform$).pipe(\n first(),\n map(\n ([render, reference, transform]: [RenderCamera, LngLatAlt, Transform]): LngLat => {\n const unprojection: Unprojection =\n this._projection.canvasToUnprojection(\n canvasPoint,\n this._container.container,\n render,\n reference,\n transform);\n\n return unprojection.lngLat;\n }));\n }\n\n public unprojectBasic$(canvasPoint: number[]): Observable<number[]> {\n return observableCombineLatest(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.currentTransform$).pipe(\n first(),\n map(\n ([render, transform]: [RenderCamera, Transform]): number[] => {\n return this._projection.canvasToBasic(\n canvasPoint,\n this._container.container,\n render,\n transform);\n }));\n }\n\n private _closeTo(\n v1: number,\n v2: number,\n absoluteTolerance: number)\n : boolean {\n return Math.abs(v1 - v2) <= absoluteTolerance;\n }\n\n private _mapMouseEvent$(\n type: ViewerEventType,\n mouseEvent$: Observable<MouseEvent>)\n : Observable<[ViewerEventType, MouseEvent]> {\n return mouseEvent$.pipe(\n map(\n (event: MouseEvent): [ViewerEventType, MouseEvent] => {\n return [type, event];\n }));\n }\n}\n","import { combineLatest as observableCombineLatest } from \"rxjs\";\nimport {\n skip,\n take,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { ICustomRenderer } from \"./interfaces/ICustomRenderer\";\nimport { Navigator } from \"./Navigator\";\nimport { Container } from \"./Container\";\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\nimport { LngLatAlt } from \"../api/interfaces/LngLatAlt\";\nimport { WebGLRenderer } from \"three\";\nimport { RenderCamera } from \"../render/RenderCamera\";\nimport { IViewer } from \"./interfaces/IViewer\";\n\nexport class CustomRenderer {\n private _renderers: {\n [id: string]: {\n renderer: ICustomRenderer,\n subs: SubscriptionHolder,\n }\n };\n\n constructor(\n private _container: Container,\n private _navigator: Navigator) {\n this._renderers = {};\n }\n\n public add(renderer: ICustomRenderer, viewer: IViewer): void {\n const subs = new SubscriptionHolder();\n this._renderers[renderer.id] = { subs, renderer };\n\n subs.push(observableCombineLatest(\n [\n this._container.glRenderer.webGLRenderer$,\n this._navigator.stateService.reference$,\n ])\n .pipe(take(1))\n .subscribe(\n ([gl, reference]:\n [WebGLRenderer, LngLatAlt]): void => {\n renderer.onAdd(viewer, reference, gl.getContext());\n }));\n\n subs.push(this._container.glRenderer.opaqueRender$\n .pipe(\n withLatestFrom(\n this._container.renderService.renderCamera$,\n this._container.glRenderer.webGLRenderer$))\n .subscribe(\n ([, renderCamera, glRenderer]:\n [void, RenderCamera, WebGLRenderer]): void => {\n const context = glRenderer.getContext();\n const viewMatrix =\n renderCamera.perspective.matrixWorldInverse;\n const projectionMatrix =\n renderCamera.perspective.projectionMatrix;\n\n renderer.render(\n context,\n viewMatrix.toArray(),\n projectionMatrix.toArray());\n }));\n\n subs.push(this._navigator.stateService.reference$\n .pipe(skip(1))\n .subscribe(\n (reference: LngLatAlt): void => {\n renderer.onReference(viewer, reference);\n }));\n }\n\n public dispose(viewer: IViewer): void {\n for (const id of Object.keys(this._renderers)) {\n this.remove(id, viewer);\n }\n }\n\n public has(id: string): boolean {\n return id in this._renderers;\n }\n\n public remove(id: string, viewer: IViewer): void {\n this._renderers[id].subs.unsubscribe();\n\n const renderer = this._renderers[id].renderer;\n delete this._renderers[id];\n\n this._container.glRenderer.webGLRenderer$\n .subscribe(\n (gl: WebGLRenderer): void => {\n renderer.onRemove(viewer, gl.getContext());\n });\n }\n}\n","import {\n combineLatest as observableCombineLatest,\n empty as observableEmpty,\n Subject,\n} from \"rxjs\";\nimport {\n distinctUntilChanged,\n first,\n map,\n pairwise,\n skip,\n startWith,\n switchMap,\n take,\n withLatestFrom,\n} from \"rxjs/operators\";\n\nimport { ICustomCameraControls } from \"./interfaces/ICustomCameraControls\";\nimport { Navigator } from \"./Navigator\";\nimport { Container } from \"./Container\";\nimport { SubscriptionHolder } from \"../util/SubscriptionHolder\";\nimport { IViewer } from \"./interfaces/IViewer\";\nimport { State } from \"../state/State\";\nimport { MapillaryError } from \"../error/MapillaryError\";\n\nexport class CustomCameraControls {\n private _controls: ICustomCameraControls;\n private _subscriptions: SubscriptionHolder;\n\n constructor(\n private _container: Container,\n private _navigator: Navigator) {\n this._controls = null;\n this._subscriptions = new SubscriptionHolder();\n }\n\n public attach(controls: ICustomCameraControls, viewer: IViewer): void {\n if (this._controls) {\n throw new MapillaryError('Custom camera controls already attached');\n }\n\n this._controls = controls;\n\n const attach$ = new Subject<void>();\n const active$ = attach$\n .pipe(\n switchMap(\n () => {\n return this._navigator.stateService.state$;\n }),\n map(\n (state: State): boolean => {\n return state === State.Custom;\n }),\n distinctUntilChanged());\n\n const subs = this._subscriptions;\n subs.push(active$\n .pipe(\n startWith(false),\n pairwise(),\n withLatestFrom(\n this._navigator.stateService.reference$,\n this._container.renderService.renderCamera$))\n .subscribe(\n ([[deactivate, activate], ref, cam]) => {\n if (activate) {\n controls.onActivate(\n viewer,\n cam.perspective.matrixWorldInverse.toArray(),\n cam.perspective.projectionMatrix.toArray(),\n ref);\n } else if (deactivate) {\n controls.onDeactivate(viewer);\n }\n }));\n\n subs.push(active$\n .pipe(\n switchMap(\n active => {\n return active ?\n this._navigator.stateService.currentState$\n .pipe(skip(1)) :\n observableEmpty();\n\n }))\n .subscribe(\n frame => {\n controls.onAnimationFrame(viewer, frame.id);\n }));\n\n subs.push(active$\n .pipe(\n switchMap(\n active => {\n return active ?\n this._navigator.stateService.reference$\n .pipe(skip(1)) :\n observableEmpty();\n\n }))\n .subscribe(ref => controls.onReference(viewer, ref)));\n\n subs.push(active$\n .pipe(\n switchMap(\n active => {\n return active ?\n this._container.renderService.size$\n .pipe(skip(1)) :\n observableEmpty();\n\n }))\n .subscribe(() => controls.onResize(viewer)));\n\n subs.push(\n observableCombineLatest(\n [\n // Include to ensure GL renderer has been initialized\n this._container.glRenderer.webGLRenderer$,\n this._container.renderService.renderCamera$,\n this._navigator.stateService.reference$,\n this._navigator.stateService.state$,\n ])\n .pipe(first())\n .subscribe(\n (): void => {\n const projectionMatrixCallback =\n (projectionMatrix: number[]) => {\n if (!this._controls ||\n controls !== this._controls) {\n return;\n }\n this._updateProjectionMatrix(projectionMatrix);\n };\n const viewMatrixCallback =\n (viewMatrix: number[]) => {\n if (!this._controls ||\n controls !== this._controls) {\n return;\n }\n this._updateViewMatrix(viewMatrix);\n };\n\n controls.onAttach(\n viewer,\n viewMatrixCallback,\n projectionMatrixCallback);\n\n attach$.next();\n attach$.complete();\n }));\n }\n\n public detach(viewer: IViewer): Promise<ICustomCameraControls> {\n const controls = this._controls;\n this._controls = null;\n\n this._subscriptions.unsubscribe();\n\n return new Promise(resolve => {\n this._navigator.stateService.state$\n .pipe(take(1))\n .subscribe(state => {\n if (!controls) {\n resolve(null);\n return;\n }\n\n if (state === State.Custom) {\n controls.onDeactivate(viewer);\n }\n\n controls.onDetach(viewer);\n resolve(controls);\n });\n });\n }\n\n public dispose(viewer: IViewer): void {\n this.detach(viewer);\n }\n\n public has(controls: ICustomCameraControls): boolean {\n return !!this._controls && controls === this._controls;\n }\n\n private _updateProjectionMatrix(projectionMatrix: number[]): void {\n this._navigator.stateService.state$\n .pipe(first())\n .subscribe(\n state => {\n if (state !== State.Custom) {\n const message =\n \"Incorrect camera control mode for \" +\n \"projection matrix update\";\n console.warn(message);\n return;\n }\n this._container.renderService.projectionMatrix$\n .next(projectionMatrix);\n });\n }\n\n private _updateViewMatrix(viewMatrix: number[]): void {\n this._navigator.stateService.state$\n .pipe(first())\n .subscribe(\n state => {\n if (state !== State.Custom) {\n const message =\n \"Incorrect camera control mode for \" +\n \"view matrix update\";\n console.warn(message);\n return;\n }\n this._navigator.stateService.setViewMatrix(viewMatrix);\n });\n }\n}\n","/**\n * Internal bootstrap\n *\n * This is a workaround to make the CommonJS unit testing\n * work with Jest. Once Jest/Node supports ES6 modules\n * fully this should be removed. GeoRBush is registered\n * here only to avoid loading it during\n * unit tests.\n */\nimport { Graph } from \"./graph/Graph\";\nimport { MarkerSet } from \"./component/marker/MarkerSet\";\nimport { GeoRBush } from \"./geo/GeoRBush\";\nGraph.register(GeoRBush);\nMarkerSet.register(GeoRBush);\n\n/**\n * Component bootstrap\n *\n * Register all components with component service\n * so that they can be activated in the viewer.\n */\nimport { ComponentService } from \"./component/ComponentService\";\n\n// Cover\nimport { CoverComponent } from \"./component/cover/CoverComponent\";\n\nComponentService.registerCover(CoverComponent);\n\n// Component\nimport { AttributionComponent }\n from \"./component/attribution/AttributionComponent\";\nimport { BearingComponent } from \"./component/bearing/BearingComponent\";\nimport { CacheComponent } from \"./component/cache/CacheComponent\";\nimport { DirectionComponent } from \"./component/direction/DirectionComponent\";\nimport { ImageComponent }\n from \"./component/image/ImageComponent\";\nimport { KeyboardComponent } from \"./component/keyboard/KeyboardComponent\";\nimport { MarkerComponent } from \"./component/marker/MarkerComponent\";\nimport { PointerComponent } from \"./component/pointer/PointerComponent\";\nimport { PopupComponent } from \"./component/popup/PopupComponent\";\nimport { SequenceComponent } from \"./component/sequence/SequenceComponent\";\nimport { SliderComponent } from \"./component/slider/SliderComponent\";\nimport { SpatialComponent }\n from \"./component/spatial/SpatialComponent\";\nimport { TagComponent } from \"./component/tag/TagComponent\";\nimport { ZoomComponent } from \"./component/zoom/ZoomComponent\";\n\nComponentService.register(AttributionComponent);\nComponentService.register(BearingComponent);\nComponentService.register(CacheComponent);\nComponentService.register(DirectionComponent);\nComponentService.register(ImageComponent);\nComponentService.register(KeyboardComponent);\nComponentService.register(MarkerComponent);\nComponentService.register(PointerComponent);\nComponentService.register(PopupComponent);\nComponentService.register(SequenceComponent);\nComponentService.register(SliderComponent);\nComponentService.register(SpatialComponent);\nComponentService.register(TagComponent);\nComponentService.register(ZoomComponent);\n\n// Fallback\nimport { ImageFallbackComponent }\n from \"./component/fallback/image/ImageFallbackComponent\";\nimport { NavigationFallbackComponent }\n from \"./component/fallback/navigation/NavigationFallbackComponent\";\n\nComponentService.register(ImageFallbackComponent);\nComponentService.register(NavigationFallbackComponent);\n\n/**\n * External exports\n *\n * Documented public API.\n */\nexport * from \"./external/api\";\nexport * from \"./external/component\";\nexport * from \"./external/viewer\";\n","import * as THREE from \"three\";\nimport { LngLat } from \"../../../api/interfaces/LngLat\";\nimport { CircleMarkerOptions } from \"../interfaces/CircleMarkerOptions\";\nimport { Marker } from \"./Marker\";\n\n/**\n * @class CircleMarker\n *\n * @classdesc Non-interactive marker with a flat circle shape. The circle\n * marker can not be configured to be interactive.\n *\n * Circle marker properties can not be updated after creation.\n *\n * To create and add one `CircleMarker` with default configuration\n * and one with configuration use\n *\n * @example\n * ```js\n * var defaultMarker = new CircleMarker(\n * \"id-1\",\n * { lat: 0, lng: 0, });\n *\n * var configuredMarker = new CircleMarker(\n * \"id-2\",\n * { lat: 0, lng: 0, },\n * {\n * color: \"#0ff\",\n * opacity: 0.3,\n * radius: 0.7,\n * });\n *\n * markerComponent.add([defaultMarker, configuredMarker]);\n * ```\n */\nexport class CircleMarker extends Marker {\n private _color: number | string;\n private _opacity: number;\n private _radius: number;\n\n constructor(id: string, lngLat: LngLat, options?: CircleMarkerOptions) {\n super(id, lngLat);\n\n options = !!options ? options : {};\n this._color = options.color != null ? options.color : 0xffffff;\n this._opacity = options.opacity != null ? options.opacity : 0.4;\n this._radius = options.radius != null ? options.radius : 1;\n }\n\n protected _createGeometry(position: number[]): void {\n const circle: THREE.Mesh = new THREE.Mesh(\n new THREE.CircleGeometry(this._radius, 16),\n new THREE.MeshBasicMaterial({\n color: this._color,\n opacity: this._opacity,\n transparent: true,\n }));\n\n circle.up.fromArray([0, 0, 1]);\n circle.renderOrder = -1;\n\n const group: THREE.Object3D = new THREE.Object3D();\n group.add(circle);\n group.position.fromArray(position);\n\n this._geometry = group;\n }\n\n protected _disposeGeometry(): void {\n for (let mesh of <THREE.Mesh[]>this._geometry.children) {\n mesh.geometry.dispose();\n (<THREE.Material>mesh.material).dispose();\n }\n }\n\n protected _getInteractiveObjects(): THREE.Object3D[] {\n return [];\n }\n}\n","import {\n Observable,\n Subject,\n} from \"rxjs\";\n\nimport { Transform } from \"../../../geo/Transform\";\nimport { ViewportCoords } from \"../../../geo/ViewportCoords\";\nimport { ViewportSize } from \"../../../render/interfaces/ViewportSize\";\nimport { RenderCamera } from \"../../../render/RenderCamera\";\nimport { DOM } from \"../../../util/DOM\";\nimport { Alignment } from \"../../../viewer/enums/Alignment\";\nimport { PopupOffset } from \"../interfaces/PopupOffset\";\nimport { PopupOptions } from \"../interfaces/PopupOptions\";\nimport { PopupAlignment } from \"./PopupAlignment\";\n\n/**\n * @class Popup\n *\n * @classdesc Popup instance for rendering custom HTML content\n * on top of images. Popups are based on 2D basic image coordinates\n * (see the {@link Viewer} class documentation for more information about coordinate\n * systems) and a certain popup is therefore only relevant to a single image.\n * Popups related to a certain image should be removed when moving\n * to another image.\n *\n * A popup must have both its content and its point or rect set to be\n * rendered. Popup options can not be updated after creation but the\n * basic point or rect as well as its content can be changed by calling\n * the appropriate methods.\n *\n * To create and add one `Popup` with default configuration\n * (tooltip visuals and automatic float) and one with specific options\n * use\n *\n * @example\n * ```js\n * var defaultSpan = document.createElement('span');\n * defaultSpan.innerHTML = 'hello default';\n *\n * var defaultPopup = new Popup();\n * defaultPopup.setDOMContent(defaultSpan);\n * defaultPopup.setBasicPoint([0.3, 0.3]);\n *\n * var cleanSpan = document.createElement('span');\n * cleanSpan.innerHTML = 'hello clean';\n *\n * var cleanPopup = new Popup({\n * clean: true,\n * float: Alignment.Top,\n * offset: 10,\n * opacity: 0.7,\n * });\n *\n * cleanPopup.setDOMContent(cleanSpan);\n * cleanPopup.setBasicPoint([0.6, 0.6]);\n *\n * popupComponent.add([defaultPopup, cleanPopup]);\n * ```\n *\n * @description Implementation of API methods and API documentation inspired\n * by/used from https://github.com/mapbox/mapbox-gl-js/blob/v0.38.0/src/ui/popup.js\n */\nexport class Popup {\n protected _notifyChanged$: Subject<Popup>;\n\n private _container: HTMLDivElement;\n private _content: HTMLDivElement;\n private _parentContainer: HTMLElement;\n private _options: PopupOptions;\n private _tip: HTMLDivElement;\n\n private _point: number[];\n private _rect: number[];\n\n private _dom: DOM;\n private _viewportCoords: ViewportCoords;\n\n constructor(\n options?: PopupOptions,\n viewportCoords?: ViewportCoords,\n dom?: DOM) {\n\n this._options = {};\n\n options = !!options ? options : {};\n\n this._options.capturePointer = options.capturePointer === false ?\n options.capturePointer : true;\n\n this._options.clean = options.clean;\n this._options.float = options.float;\n this._options.offset = options.offset;\n this._options.opacity = options.opacity;\n this._options.position = options.position;\n\n this._dom = !!dom ? dom : new DOM();\n this._viewportCoords = !!viewportCoords ? viewportCoords : new ViewportCoords();\n\n this._notifyChanged$ = new Subject<Popup>();\n }\n\n /**\n * @description Internal observable used by the component to\n * render the popup when its position or content has changed.\n * @ignore\n */\n public get changed$(): Observable<Popup> {\n return this._notifyChanged$;\n }\n\n /**\n * @description Internal method used by the component to\n * remove all references to the popup.\n * @ignore\n */\n public remove(): void {\n if (this._content && this._content.parentNode) {\n this._content.parentNode.removeChild(this._content);\n }\n\n if (this._container) {\n this._container.parentNode.removeChild(this._container);\n delete this._container;\n }\n\n if (this._parentContainer) {\n delete this._parentContainer;\n }\n }\n\n /**\n * Sets a 2D basic image coordinates point to the popup's anchor, and\n * moves the popup to it.\n *\n * @description Overwrites any previously set point or rect.\n *\n * @param {Array<number>} basicPoint - Point in 2D basic image coordinates.\n *\n * @example\n * ```js\n * var popup = new Popup();\n * popup.setText('hello image');\n * popup.setBasicPoint([0.3, 0.3]);\n *\n * popupComponent.add([popup]);\n * ```\n */\n public setBasicPoint(basicPoint: number[]): void {\n this._point = basicPoint.slice();\n this._rect = null;\n\n this._notifyChanged$.next(this);\n }\n\n /**\n * Sets a 2D basic image coordinates rect to the popup's anchor, and\n * moves the popup to it.\n *\n * @description Overwrites any previously set point or rect.\n *\n * @param {Array<number>} basicRect - Rect in 2D basic image\n * coordinates ([topLeftX, topLeftY, bottomRightX, bottomRightY]) .\n *\n * @example\n * ```js\n * var popup = new Popup();\n * popup.setText('hello image');\n * popup.setBasicRect([0.3, 0.3, 0.5, 0.6]);\n *\n * popupComponent.add([popup]);\n * ```\n */\n public setBasicRect(basicRect: number[]): void {\n this._rect = basicRect.slice();\n this._point = null;\n\n this._notifyChanged$.next(this);\n }\n\n /**\n * Sets the popup's content to the element provided as a DOM node.\n *\n * @param {Node} htmlNode - A DOM node to be used as content for the popup.\n *\n * @example\n * ```js\n * var div = document.createElement('div');\n * div.innerHTML = 'hello image';\n *\n * var popup = new Popup();\n * popup.setDOMContent(div);\n * popup.setBasicPoint([0.3, 0.3]);\n *\n * popupComponent.add([popup]);\n * ```\n */\n public setDOMContent(htmlNode: Node): void {\n if (this._content && this._content.parentNode) {\n this._content.parentNode.removeChild(this._content);\n }\n\n const className: string = \"mapillary-popup-content\" +\n (this._options.clean === true ? \"-clean\" : \"\") +\n (this._options.capturePointer === true ? \" mapillary-popup-capture-pointer\" : \"\");\n\n this._content = this._dom.createElement(\"div\", className, this._container);\n\n this._content.appendChild(htmlNode);\n\n this._notifyChanged$.next(this);\n }\n\n /**\n * Sets the popup's content to the HTML provided as a string.\n *\n * @description This method does not perform HTML filtering or sanitization,\n * and must be used only with trusted content. Consider\n * {@link Popup.setText} if the\n * content is an untrusted text string.\n *\n * @param {string} html - A string representing HTML content for the popup.\n *\n * @example\n * ```js\n * var popup = new Popup();\n * popup.setHTML('<div>hello image</div>');\n * popup.setBasicPoint([0.3, 0.3]);\n *\n * popupComponent.add([popup]);\n * ```\n */\n public setHTML(html: string): void {\n const frag: DocumentFragment = this._dom.document.createDocumentFragment();\n const temp: HTMLBodyElement = this._dom.createElement(\"body\");\n let child: Node;\n temp.innerHTML = html;\n\n while (true) {\n child = temp.firstChild;\n if (!child) {\n break;\n }\n\n frag.appendChild(child);\n }\n\n this.setDOMContent(frag);\n }\n\n /**\n * Sets the popup's content to a string of text.\n *\n * @description This function creates a Text node in the DOM, so it cannot insert raw HTML.\n * Use this method for security against XSS if the popup content is user-provided.\n *\n * @param {string} text - Textual content for the popup.\n *\n * @example\n * ```js\n * var popup = new Popup();\n * popup.setText('hello image');\n * popup.setBasicPoint([0.3, 0.3]);\n *\n * popupComponent.add([popup]);\n * ```\n */\n public setText(text: string): void {\n this.setDOMContent(this._dom.document.createTextNode(text));\n }\n\n /**\n * @description Internal method for attaching the popup to\n * its parent container so that it is rendered in the DOM tree.\n * @ignore\n */\n public setParentContainer(parentContainer: HTMLElement): void {\n this._parentContainer = parentContainer;\n }\n\n /**\n * @description Internal method for updating the rendered\n * position of the popup called by the popup component.\n * @ignore\n */\n public update(renderCamera: RenderCamera, size: ViewportSize, transform: Transform): void {\n if (!this._parentContainer || !this._content) {\n return;\n }\n\n if (!this._point && !this._rect) {\n return;\n }\n\n if (!this._container) {\n this._container = this._dom.createElement(\"div\", \"mapillary-popup\", this._parentContainer);\n\n const showTip: boolean =\n this._options.clean !== true &&\n this._options.float !== Alignment.Center;\n\n if (showTip) {\n const tipClassName: string =\n \"mapillary-popup-tip\" +\n (this._options.capturePointer === true ? \" mapillary-popup-capture-pointer\" : \"\");\n\n this._tip = this._dom.createElement(\"div\", tipClassName, this._container);\n this._dom.createElement(\"div\", \"mapillary-popup-tip-inner\", this._tip);\n }\n\n this._container.appendChild(this._content);\n this._parentContainer.appendChild(this._container);\n\n if (this._options.opacity != null) {\n this._container.style.opacity = this._options.opacity.toString();\n }\n }\n\n let pointPixel: number[] = null;\n let position: PopupAlignment = this._alignmentToPopupAligment(this._options.position);\n let float: PopupAlignment = this._alignmentToPopupAligment(this._options.float);\n\n const classList: DOMTokenList = this._container.classList;\n\n if (this._point != null) {\n pointPixel =\n this._viewportCoords.basicToCanvasSafe(\n this._point[0],\n this._point[1],\n { offsetHeight: size.height, offsetWidth: size.width },\n transform,\n renderCamera.perspective);\n } else {\n const alignments: PopupAlignment[] =\n [\"center\", \"top\", \"bottom\", \"left\", \"right\", \"top-left\", \"top-right\", \"bottom-left\", \"bottom-right\"];\n\n let appliedPosition: PopupAlignment = null;\n for (const alignment of alignments) {\n if (classList.contains(`mapillary-popup-float-${alignment}`)) {\n appliedPosition = alignment;\n break;\n }\n }\n\n [pointPixel, position] = this._rectToPixel(this._rect, position, appliedPosition, renderCamera, size, transform);\n\n if (!float) {\n float = position;\n }\n }\n\n if (pointPixel == null) {\n this._container.style.display = \"none\";\n return;\n }\n\n this._container.style.display = \"\";\n\n if (!float) {\n const width: number = this._container.offsetWidth;\n const height: number = this._container.offsetHeight;\n const floats: PopupAlignment[] = this._pixelToFloats(pointPixel, size, width, height);\n\n float = floats.length === 0 ? \"top\" : <PopupAlignment>floats.join(\"-\");\n }\n\n const offset: { [key in PopupAlignment]: number[] } = this._normalizeOffset(this._options.offset);\n\n pointPixel = [pointPixel[0] + offset[float][0], pointPixel[1] + offset[float][1]];\n pointPixel = [Math.round(pointPixel[0]), Math.round(pointPixel[1])];\n\n const floatTranslate: { [key in PopupAlignment]: string } = {\n \"bottom\": \"translate(-50%,0)\",\n \"bottom-left\": \"translate(-100%,0)\",\n \"bottom-right\": \"translate(0,0)\",\n \"center\": \"translate(-50%,-50%)\",\n \"left\": \"translate(-100%,-50%)\",\n \"right\": \"translate(0,-50%)\",\n \"top\": \"translate(-50%,-100%)\",\n \"top-left\": \"translate(-100%,-100%)\",\n \"top-right\": \"translate(0,-100%)\",\n };\n\n for (const key in floatTranslate) {\n if (!floatTranslate.hasOwnProperty(key)) {\n continue;\n }\n\n classList.remove(`mapillary-popup-float-${key}`);\n }\n\n classList.add(`mapillary-popup-float-${float}`);\n\n this._container.style.transform = `${floatTranslate[float]} translate(${pointPixel[0]}px,${pointPixel[1]}px)`;\n }\n\n private _rectToPixel(\n rect: number[],\n position: PopupAlignment,\n appliedPosition: PopupAlignment,\n renderCamera: RenderCamera,\n size: ViewportSize,\n transform: Transform): [number[], PopupAlignment] {\n\n if (!position) {\n const width: number = this._container.offsetWidth;\n const height: number = this._container.offsetHeight;\n\n const floatOffsets: { [key: string]: number[]; } = {\n \"bottom\": [0, height / 2],\n \"bottom-left\": [-width / 2, height / 2],\n \"bottom-right\": [width / 2, height / 2],\n \"left\": [-width / 2, 0],\n \"right\": [width / 2, 0],\n \"top\": [0, -height / 2],\n \"top-left\": [-width / 2, -height / 2],\n \"top-right\": [width / 2, -height / 2],\n };\n\n const automaticPositions: PopupAlignment[] =\n [\"top\", \"bottom\", \"left\", \"right\"];\n\n let largestVisibleArea: [number, number[], PopupAlignment] = [0, null, null];\n\n for (const automaticPosition of automaticPositions) {\n const autoPointBasic: number[] = this._pointFromRectPosition(rect, automaticPosition);\n const autoPointPixel: number[] =\n this._viewportCoords.basicToCanvasSafe(\n autoPointBasic[0],\n autoPointBasic[1],\n { offsetHeight: size.height, offsetWidth: size.width },\n transform,\n renderCamera.perspective);\n\n if (autoPointPixel == null) {\n continue;\n }\n\n const floatOffset: number[] = floatOffsets[automaticPosition];\n const offsetedPosition: number[] = [autoPointPixel[0] + floatOffset[0], autoPointPixel[1] + floatOffset[1]];\n const staticCoeff: number = appliedPosition != null && appliedPosition === automaticPosition ? 1 : 0.7;\n const floats: PopupAlignment[] =\n this._pixelToFloats(offsetedPosition, size, width / staticCoeff, height / (2 * staticCoeff));\n\n if (floats.length === 0 &&\n autoPointPixel[0] > 0 &&\n autoPointPixel[0] < size.width &&\n autoPointPixel[1] > 0 &&\n autoPointPixel[1] < size.height) {\n\n return [autoPointPixel, automaticPosition];\n }\n\n const minX: number = Math.max(offsetedPosition[0] - width / 2, 0);\n const maxX: number = Math.min(offsetedPosition[0] + width / 2, size.width);\n const minY: number = Math.max(offsetedPosition[1] - height / 2, 0);\n const maxY: number = Math.min(offsetedPosition[1] + height / 2, size.height);\n\n const visibleX: number = Math.max(0, maxX - minX);\n const visibleY: number = Math.max(0, maxY - minY);\n\n const visibleArea: number = staticCoeff * visibleX * visibleY;\n\n if (visibleArea > largestVisibleArea[0]) {\n largestVisibleArea[0] = visibleArea;\n largestVisibleArea[1] = autoPointPixel;\n largestVisibleArea[2] = automaticPosition;\n }\n }\n\n if (largestVisibleArea[0] > 0) {\n return [largestVisibleArea[1], largestVisibleArea[2]];\n }\n }\n\n const pointBasic: number[] = this._pointFromRectPosition(rect, position);\n const pointPixel: number[] =\n this._viewportCoords.basicToCanvasSafe(\n pointBasic[0],\n pointBasic[1],\n { offsetHeight: size.height, offsetWidth: size.width },\n transform,\n renderCamera.perspective);\n\n return [pointPixel, position != null ? position : \"top\"];\n }\n\n private _alignmentToPopupAligment(float: Alignment): PopupAlignment {\n switch (float) {\n case Alignment.Bottom:\n return \"bottom\";\n case Alignment.BottomLeft:\n return \"bottom-left\";\n case Alignment.BottomRight:\n return \"bottom-right\";\n case Alignment.Center:\n return \"center\";\n case Alignment.Left:\n return \"left\";\n case Alignment.Right:\n return \"right\";\n case Alignment.Top:\n return \"top\";\n case Alignment.TopLeft:\n return \"top-left\";\n case Alignment.TopRight:\n return \"top-right\";\n default:\n return null;\n }\n }\n\n private _normalizeOffset(offset: number | PopupOffset): { [key in PopupAlignment]: number[] } {\n if (offset == null) {\n return this._normalizeOffset(0);\n }\n\n if (typeof offset === \"number\") {\n // input specifies a radius\n const sideOffset: number = <number>offset;\n const sign: number = sideOffset >= 0 ? 1 : -1;\n const cornerOffset: number = sign * Math.round(Math.sqrt(0.5 * Math.pow(sideOffset, 2)));\n return {\n \"bottom\": [0, sideOffset],\n \"bottom-left\": [-cornerOffset, cornerOffset],\n \"bottom-right\": [cornerOffset, cornerOffset],\n \"center\": [0, 0],\n \"left\": [-sideOffset, 0],\n \"right\": [sideOffset, 0],\n \"top\": [0, -sideOffset],\n \"top-left\": [-cornerOffset, -cornerOffset],\n \"top-right\": [cornerOffset, -cornerOffset],\n };\n } else {\n // input specifes a value for each position\n return {\n \"bottom\": offset.bottom || [0, 0],\n \"bottom-left\": offset.bottomLeft || [0, 0],\n \"bottom-right\": offset.bottomRight || [0, 0],\n \"center\": offset.center || [0, 0],\n \"left\": offset.left || [0, 0],\n \"right\": offset.right || [0, 0],\n \"top\": offset.top || [0, 0],\n \"top-left\": offset.topLeft || [0, 0],\n \"top-right\": offset.topRight || [0, 0],\n };\n }\n }\n\n private _pixelToFloats(pointPixel: number[], size: ViewportSize, width: number, height: number): PopupAlignment[] {\n const floats: PopupAlignment[] = [];\n\n if (pointPixel[1] < height) {\n floats.push(\"bottom\");\n } else if (pointPixel[1] > size.height - height) {\n floats.push(\"top\");\n }\n\n if (pointPixel[0] < width / 2) {\n floats.push(\"right\");\n } else if (pointPixel[0] > size.width - width / 2) {\n floats.push(\"left\");\n }\n\n return floats;\n }\n\n private _pointFromRectPosition(rect: number[], position: PopupAlignment): number[] {\n const x0: number = rect[0];\n const x1: number = rect[0] < rect[2] ? rect[2] : rect[2] + 1;\n const y0: number = rect[1];\n const y1: number = rect[3];\n\n switch (position) {\n case \"bottom\":\n return [(x0 + x1) / 2, y1];\n case \"bottom-left\":\n return [x0, y1];\n case \"bottom-right\":\n return [x1, y1];\n case \"center\":\n return [(x0 + x1) / 2, (y0 + y1) / 2];\n case \"left\":\n return [x0, (y0 + y1) / 2];\n case \"right\":\n return [x1, (y0 + y1) / 2];\n case \"top\":\n return [(x0 + x1) / 2, y0];\n case \"top-left\":\n return [x0, y0];\n case \"top-right\":\n return [x1, y0];\n default:\n return [(x0 + x1) / 2, y1];\n }\n }\n}\n","import * as THREE from \"three\";\nimport { LngLat } from \"../../../api/interfaces/LngLat\";\nimport { SimpleMarkerOptions } from \"../interfaces/SimpleMarkerOptions\";\nimport { Marker } from \"./Marker\";\n\n/**\n * @class SimpleMarker\n *\n * @classdesc Interactive marker with ice cream shape. The sphere\n * inside the ice cream can be configured to be interactive.\n *\n * Simple marker properties can not be updated after creation.\n *\n * To create and add one `SimpleMarker` with default configuration\n * (non-interactive) and one interactive with configuration use\n *\n * @example\n * ```js\n * var defaultMarker = new SimpleMarker(\n * \"id-1\",\n * { lat: 0, lng: 0, });\n *\n * var interactiveMarker = new SimpleMarker(\n * \"id-2\",\n * { lat: 0, lng: 0, },\n * {\n * ballColor: \"#00f\",\n * ballOpacity: 0.5,\n * color: \"#00f\",\n * interactive: true,\n * opacity: 0.3,\n * radius: 0.7,\n * });\n *\n * markerComponent.add([defaultMarker, interactiveMarker]);\n * ```\n */\nexport class SimpleMarker extends Marker {\n private _ballColor: number | string;\n private _ballOpacity: number;\n private _circleToRayAngle: number;\n private _color: number | string;\n private _interactive: boolean;\n private _opacity: number;\n private _radius: number;\n\n constructor(id: string, lngLat: LngLat, options?: SimpleMarkerOptions) {\n super(id, lngLat);\n\n options = !!options ? options : {};\n this._ballColor = options.ballColor != null ? options.ballColor : 0xff0000;\n this._ballOpacity = options.ballOpacity != null ? options.ballOpacity : 0.8;\n this._circleToRayAngle = 2;\n this._color = options.color != null ? options.color : 0xff0000;\n this._interactive = !!options.interactive;\n this._opacity = options.opacity != null ? options.opacity : 0.4;\n this._radius = options.radius != null ? options.radius : 1;\n }\n\n protected _createGeometry(position: number[]): void {\n const radius = this._radius;\n const height = this._markerHeight(radius);\n const markerMaterial = new THREE.MeshBasicMaterial({\n color: this._color,\n opacity: this._opacity,\n transparent: true,\n depthWrite: false,\n });\n\n const marker = new THREE.Mesh(\n this._createMarkerGeometry(radius, 8, 8),\n markerMaterial);\n\n const interactive = new THREE.Mesh(\n new THREE.SphereGeometry(radius / 2, 8, 8),\n new THREE.MeshBasicMaterial({\n color: this._ballColor,\n opacity: this._ballOpacity,\n transparent: true,\n }));\n interactive.position.z = height;\n\n interactive.renderOrder = 1;\n\n const group = new THREE.Object3D();\n group.add(interactive);\n group.add(marker);\n group.position.fromArray(position);\n\n this._geometry = group;\n }\n\n protected _disposeGeometry(): void {\n for (const mesh of <THREE.Mesh[]>this._geometry.children) {\n mesh.geometry.dispose();\n (<THREE.Material>mesh.material).dispose();\n }\n }\n\n protected _getInteractiveObjects(): THREE.Object3D[] {\n return this._interactive ? [this._geometry.children[0]] : [];\n }\n\n private _markerHeight(radius: number): number {\n const t = Math.tan(Math.PI - this._circleToRayAngle);\n return radius * Math.sqrt(1 + t * t);\n }\n\n private _createMarkerGeometry(\n radius: number,\n widthSegments: number,\n heightSegments: number): THREE.BufferGeometry {\n\n const height = this._markerHeight(radius);\n const circleToRayAngle = this._circleToRayAngle;\n\n const indexRows: number[][] = [];\n const positions =\n new Float32Array(3 * (widthSegments + 1) * (heightSegments + 1));\n let positionIndex = 0;\n for (let y = 0; y <= heightSegments; ++y) {\n const indexRow: number[] = [];\n for (let x = 0; x <= widthSegments; ++x) {\n const u = x / widthSegments * Math.PI * 2;\n const v = y / heightSegments * Math.PI;\n\n let r = radius;\n if (v > circleToRayAngle) {\n const t = Math.tan(v - circleToRayAngle);\n r = radius * Math.sqrt(1 + t * t);\n }\n\n const arrayIndex = 3 * positionIndex;\n const sinv = Math.sin(v);\n positions[arrayIndex + 0] = r * Math.cos(u) * sinv;\n positions[arrayIndex + 1] = r * Math.sin(u) * sinv;\n positions[arrayIndex + 2] = r * Math.cos(v) + height;\n indexRow.push(positionIndex++);\n }\n\n indexRows.push(indexRow);\n }\n\n const indices = new Uint16Array(6 * widthSegments * heightSegments);\n let index = 0;\n for (let y = 0; y < heightSegments; ++y) {\n for (let x = 0; x < widthSegments; ++x) {\n const pi1 = indexRows[y][x + 1];\n const pi2 = indexRows[y][x];\n const pi3 = indexRows[y + 1][x];\n const pi4 = indexRows[y + 1][x + 1];\n\n indices[index++] = pi1;\n indices[index++] = pi2;\n indices[index++] = pi4;\n indices[index++] = pi2;\n indices[index++] = pi3;\n indices[index++] = pi4;\n }\n }\n\n const geometry = new THREE.BufferGeometry();\n const positionAttribute = new THREE.BufferAttribute(positions, 3);\n geometry.setAttribute(\"position\", positionAttribute);\n geometry.setIndex(new THREE.BufferAttribute(indices, 1));\n return geometry;\n }\n}\n","import {\n combineLatest as observableCombineLatest,\n throwError as observableThrowError,\n Observable,\n} from \"rxjs\";\nimport {\n first,\n} from \"rxjs/operators\";\n\nimport { LngLat } from \"../api/interfaces/LngLat\";\nimport { Component } from \"../component/Component\";\nimport { ComponentConfiguration }\n from \"../component/interfaces/ComponentConfiguration\";\nimport { LngLatAlt } from \"../api/interfaces/LngLatAlt\";\nimport { FilterExpression } from \"../graph/FilterExpression\";\nimport { Image } from \"../graph/Image\";\nimport { NavigationDirection } from \"../graph/edge/NavigationDirection\";\nimport { RenderCamera } from \"../render/RenderCamera\";\nimport { RenderMode } from \"../render/RenderMode\";\nimport { TransitionMode } from \"../state/TransitionMode\";\nimport { EventEmitter } from \"../util/EventEmitter\";\nimport { ICustomRenderer } from \"./interfaces/ICustomRenderer\";\nimport { PointOfView } from \"./interfaces/PointOfView\";\nimport { ViewerOptions } from \"./options/ViewerOptions\";\nimport { ComponentController } from \"./ComponentController\";\nimport { Container } from \"./Container\";\nimport { Navigator } from \"./Navigator\";\nimport { Observer } from \"./Observer\";\nimport { CustomRenderer } from \"./CustomRenderer\";\nimport { IViewer } from \"./interfaces/IViewer\";\nimport { ViewerBearingEvent } from \"./events/ViewerBearingEvent\";\nimport { ViewerEventType } from \"./events/ViewerEventType\";\nimport { ViewerDataLoadingEvent } from \"./events/ViewerDataLoadingEvent\";\nimport { ViewerMouseEvent } from \"./events/ViewerMouseEvent\";\nimport { ViewerNavigableEvent } from \"./events/ViewerNavigableEvent\";\nimport { ViewerNavigationEdgeEvent }\n from \"./events/ViewerNavigationEdgeEvent\";\nimport { ViewerImageEvent } from \"./events/ViewerImageEvent\";\nimport { ViewerStateEvent } from \"./events/ViewerStateEvent\";\nimport { ComponentName } from \"../component/ComponentName\";\nimport { FallbackComponentName }\n from \"../component/fallback/FallbackComponentName\";\nimport { CameraControls } from \"./enums/CameraControls\";\nimport { State } from \"../state/State\";\nimport { ICustomCameraControls } from \"./interfaces/ICustomCameraControls\";\nimport { CustomCameraControls } from \"./CustomCameraControls\";\nimport { ViewerLoadEvent } from \"./events/ViewerLoadEvent\";\nimport { cameraControlsToState } from \"./Modes\";\nimport { ViewerReferenceEvent } from \"./events/ViewerReferenceEvent\";\nimport { IDataProvider } from \"../external/api\";\n\n/**\n * @class Viewer\n *\n * @classdesc The Viewer object represents the navigable image viewer.\n * Create a Viewer by specifying a container, client ID, image ID and\n * other options. The viewer exposes methods and events for programmatic\n * interaction.\n *\n * In the case of asynchronous methods, MapillaryJS returns promises to\n * the results. Notifications are always emitted through JavaScript events.\n */\nexport class Viewer extends EventEmitter implements IViewer {\n /**\n * Private component controller object which manages component states.\n */\n private _componentController: ComponentController;\n\n /**\n * Private container object which maintains the DOM Element,\n * renderers and relevant services.\n */\n private _container: Container;\n\n /**\n * Private observer object which observes the viewer state and\n * fires events on behalf of the viewer.\n */\n private _observer: Observer;\n\n /**\n * Private navigator object which controls navigation.\n */\n private _navigator: Navigator;\n\n /**\n * Private custom camera controls object which handles\n * custom control subscriptions.\n */\n private _customCameraControls: CustomCameraControls;\n\n /**\n * Private custom renderer object which controls WebGL custom\n * rendering subscriptions.\n */\n private _customRenderer: CustomRenderer;\n\n /**\n * Create a new viewer instance.\n *\n * @description The `Viewer` object represents the street imagery\n * viewer on your web page. It exposes methods and properties that\n * you can use to programatically change the view, and fires\n * events as users interact with it.\n *\n * It is possible to initialize the viewer with or\n * without a ID.\n *\n * When you want to show a specific image in the viewer from\n * the start you should initialize it with a ID.\n *\n * When you do not know the first image ID at implementation\n * time, e.g. in a map-viewer application you should initialize\n * the viewer without a ID and call `moveTo` instead.\n *\n * When initializing with an ID the viewer is bound to that ID\n * until the image for that ID has been successfully loaded.\n * Also, a cover with the image of the ID will be shown.\n * If the data for that ID can not be loaded because the ID is\n * faulty or other errors occur it is not possible to navigate\n * to another ID because the viewer is not navigable. The viewer\n * becomes navigable when the data for the ID has been loaded and\n * the image is shown in the viewer. This way of initializing\n * the viewer is mostly for embedding in blog posts and similar\n * where one wants to show a specific image initially.\n *\n * If the viewer is initialized without a ID (with null or\n * undefined) it is not bound to any particular ID and it is\n * possible to move to any ID with `viewer.moveTo(\"<my-image-id>\")`.\n * If the first move to a ID fails it is possible to move to another\n * ID. The viewer will show a black background until a move\n * succeeds. This way of intitializing is suited for a map-viewer\n * application when the initial ID is not known at implementation\n * time.\n *\n * @param {ViewerOptions} options - Optional configuration object\n * specifying Viewer's and the components' initial setup.\n *\n * @example\n * ```js\n * var viewer = new Viewer({\n * accessToken: \"<my-access-token>\",\n * container: \"<my-container-id>\",\n * });\n * ```\n */\n constructor(options: ViewerOptions) {\n super();\n\n this._navigator =\n new Navigator(options);\n\n this._container =\n new Container(\n options,\n this._navigator.stateService);\n\n this._observer =\n new Observer(\n this,\n this._navigator,\n this._container);\n\n this._componentController =\n new ComponentController(\n this._container,\n this._navigator,\n this._observer,\n options.imageId,\n options.component);\n\n this._customRenderer =\n new CustomRenderer(\n this._container,\n this._navigator);\n\n this._customCameraControls =\n new CustomCameraControls(\n this._container,\n this._navigator);\n }\n\n /**\n * Returns the data provider used by the viewer to fetch\n * all contracts, ents, and buffers.\n *\n * @description The viewer's data provider can be set\n * upon initialization through the {@link ViewerOptions.dataProvider}\n * property.\n *\n * @returns {IDataProvider} The viewer's data provider.\n */\n public get dataProvider(): IDataProvider {\n return this._navigator.api.data;\n }\n\n /**\n * Return a boolean indicating if the viewer is in a navigable state.\n *\n * @description The navigable state indicates if the viewer supports\n * moving, i.e. calling the {@link moveTo} and {@link moveDir}\n * methods or changing the authentication state,\n * i.e. calling {@link setAccessToken}. The viewer will not be in a navigable\n * state if the cover is activated and the viewer has been supplied a ID.\n * When the cover is deactivated or the viewer is activated without being\n * supplied a ID it will be navigable.\n *\n * @returns {boolean} Boolean indicating whether the viewer is navigable.\n */\n public get isNavigable(): boolean {\n return this._componentController.navigable;\n }\n\n /**\n * Activate the combined panning functionality.\n *\n * @description The combined panning functionality is active by default.\n */\n public activateCombinedPanning(): void {\n this._navigator.panService.enable();\n }\n\n /**\n * Activate a component.\n *\n * @param {ComponentName | FallbackComponentName} name - Name of\n * the component which will become active.\n *\n * @example\n * ```js\n * viewer.activateComponent(\"marker\");\n * ```\n */\n public activateComponent(\n name: ComponentName | FallbackComponentName): void {\n this._componentController.activate(name);\n }\n\n /**\n * Activate the cover (deactivates all other components).\n */\n public activateCover(): void {\n this._componentController.activateCover();\n }\n\n /**\n * Add a custom renderer to the viewer's rendering pipeline.\n *\n * @description During a render pass, custom renderers\n * are called in the order they were added.\n *\n * @param renderer - The custom renderer implementation.\n */\n public addCustomRenderer(renderer: ICustomRenderer): void {\n this._customRenderer.add(renderer, this);\n }\n\n /**\n * Attach custom camera controls to control the viewer's\n * camera pose and projection.\n *\n * @description Custom camera controls allow the API user\n * to move the viewer's camera freely and define the camera\n * projection. These camera properties are used\n * to render the viewer 3D scene directly into the\n * viewer's GL context.\n *\n * Only a single custom camera control instance can be\n * attached to the viewer. A new custom camera control\n * instance can be attached after detaching a previous\n * one.\n *\n * Set the viewer's camera controls to\n * {@link CameraControls.Custom} to activate attached\n * camera controls. If {@link CameraControls.Custom}\n * has already been set when a custom camera control\n * instance is attached, it will be activated immediately.\n *\n * Set the viewer's camera controls to any other\n * {@link CameraControls} mode to deactivate the\n * custom camera controls.\n *\n * @param controls - The custom camera controls implementation.\n *\n * @throws {MapillaryError} When camera controls attached\n * are already attached to the viewer.\n */\n public attachCustomCameraControls(controls: ICustomCameraControls): void {\n this._customCameraControls.attach(controls, this);\n }\n\n /**\n * Deactivate the combined panning functionality.\n *\n * @description Deactivating the combined panning functionality\n * could be needed in scenarios involving sequence only navigation.\n */\n public deactivateCombinedPanning(): void {\n this._navigator.panService.disable();\n }\n\n /**\n * Deactivate a component.\n *\n * @param {ComponentName | FallbackComponentName} name - Name\n * of component which become inactive.\n *\n * @example\n * ```js\n * viewer.deactivateComponent(\"pointer\");\n * ```\n */\n public deactivateComponent(\n name: ComponentName | FallbackComponentName): void {\n this._componentController.deactivate(name);\n }\n\n /**\n * Deactivate the cover (activates all components marked as active).\n */\n public deactivateCover(): void {\n this._componentController.deactivateCover();\n }\n\n /**\n * Detach a previously attached custom camera control\n * instance from the viewer.\n *\n * @description If no custom camera control instance\n * has previously been attached, calling this method\n * has no effect.\n *\n * Already attached custom camera controls need to\n * be detached before attaching another custom camera\n * control instance.\n */\n public detachCustomCameraControls(): Promise<ICustomCameraControls> {\n return this._customCameraControls.detach(this);\n }\n\n public fire(\n type: ViewerBearingEvent[\"type\"],\n event: ViewerBearingEvent)\n : void;\n public fire(\n type: ViewerDataLoadingEvent[\"type\"],\n event: ViewerDataLoadingEvent)\n : void;\n public fire(\n type: ViewerNavigableEvent[\"type\"],\n event: ViewerNavigableEvent)\n : void;\n public fire(\n type: ViewerImageEvent[\"type\"],\n event: ViewerImageEvent)\n : void;\n public fire(\n type: ViewerNavigationEdgeEvent[\"type\"],\n event: ViewerNavigationEdgeEvent)\n : void;\n public fire(\n type: ViewerReferenceEvent[\"type\"],\n event: ViewerReferenceEvent)\n : void;\n public fire(\n type: ViewerStateEvent[\"type\"],\n event: ViewerStateEvent)\n : void;\n public fire(\n type: ViewerMouseEvent[\"type\"],\n event: ViewerMouseEvent)\n : void;\n public fire<T>(\n type: ViewerEventType,\n event: T)\n : void {\n super.fire(type, event);\n }\n\n /**\n * Get the bearing of the current viewer camera.\n *\n * @description The bearing depends on how the camera\n * is currently rotated and does not correspond\n * to the compass angle of the current image if the view\n * has been panned.\n *\n * Bearing is measured in degrees clockwise with respect to\n * north.\n *\n * @returns {Promise<number>} Promise to the bearing\n * of the current viewer camera.\n *\n * @example\n * ```js\n * viewer.getBearing().then(b => { console.log(b); });\n * ```\n */\n public getBearing(): Promise<number> {\n return new Promise<number>(\n (resolve: (value: number) => void, reject: (reason: Error) => void): void => {\n this._container.renderService.bearing$.pipe(\n first())\n .subscribe(\n (bearing: number): void => {\n resolve(bearing);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Get the viewer's camera control mode.\n *\n * @description The camera control mode determines\n * how the camera is controlled when the viewer\n * receives pointer and keyboard input.\n *\n * @returns {CameraControls} controls - Camera control mode.\n *\n * @example\n * ```js\n * viewer.getCameraControls().then(c => { console.log(c); });\n * ```\n */\n public getCameraControls(): Promise<CameraControls> {\n return new Promise<number>((\n resolve: (value: CameraControls) => void,\n reject: (reason: Error) => void)\n : void => {\n this._navigator.stateService.state$.pipe(\n first())\n .subscribe(\n (state: State): void => {\n switch (state) {\n case State.Custom:\n resolve(CameraControls.Custom);\n break;\n case State.Earth:\n resolve(CameraControls.Earth);\n break;\n default:\n resolve(CameraControls.Street);\n break;\n }\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Returns the viewer's canvas element.\n *\n * @description This is the element onto which the viewer renders\n * the WebGL content.\n *\n * @returns {HTMLCanvasElement} The viewer's canvas element, or\n * null or not initialized.\n */\n public getCanvas(): HTMLCanvasElement {\n return <HTMLCanvasElement>this._container.canvas;\n }\n\n /**\n * Returns the HTML element containing the viewer's canvas element.\n *\n * @description This is the element to which event bindings for viewer\n * interactivity (such as panning and zooming) are attached.\n *\n * @returns {HTMLDivElement} The container for the viewer's\n * canvas element.\n */\n public getCanvasContainer(): HTMLDivElement {\n return this._container.canvasContainer;\n }\n\n /**\n * Get the basic coordinates of the current image that is\n * at the center of the viewport.\n *\n * @description Basic coordinates are 2D coordinates on the [0, 1] interval\n * and have the origin point, (0, 0), at the top left corner and the\n * maximum value, (1, 1), at the bottom right corner of the original\n * image.\n *\n * @returns {Promise<number[]>} Promise to the basic coordinates\n * of the current image at the center for the viewport.\n *\n * @example\n * ```js\n * viewer.getCenter().then(c => { console.log(c); });\n * ```\n */\n public getCenter(): Promise<number[]> {\n return new Promise<number[]>(\n (resolve: (value: number[]) => void, reject: (reason: Error) => void): void => {\n this._navigator.stateService.getCenter()\n .subscribe(\n (center: number[]): void => {\n resolve(center);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Get a component.\n *\n * @param {string} name - Name of component.\n * @returns {Component} The requested component.\n *\n * @example\n * ```js\n * var pointerComponent = viewer.getComponent(\"pointer\");\n * ```\n */\n public getComponent<TComponent extends Component<ComponentConfiguration>>(\n name: ComponentName | FallbackComponentName): TComponent {\n return this._componentController.get<TComponent>(name);\n }\n\n /**\n * Returns the viewer's containing HTML element.\n *\n * @returns {HTMLElement} The viewer's container.\n */\n public getContainer(): HTMLElement {\n return this._container.container;\n }\n\n /**\n * Get the viewer's current vertical field of view.\n *\n * @description The vertical field of view rendered on the viewer canvas\n * measured in degrees.\n *\n * @returns {Promise<number>} Promise to the current field of view\n * of the viewer camera.\n *\n * @example\n * ```js\n * viewer.getFieldOfView().then(fov => { console.log(fov); });\n * ```\n */\n public getFieldOfView(): Promise<number> {\n return new Promise<number>(\n (resolve: (value: number) => void, reject: (reason: Error) => void): void => {\n this._container.renderService.renderCamera$.pipe(\n first())\n .subscribe(\n (rc: RenderCamera): void => {\n resolve(rc.perspective.fov);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Get the viewer's current image.\n *\n * @returns {Promise<Image>} Promise to the current image.\n *\n * @example\n * ```js\n * viewer.getImage().then(image => { console.log(image.id); });\n * ```\n */\n public getImage(): Promise<Image> {\n return new Promise<Image>(\n (resolve: (image: Image) => void, reject: (reason: Error) => void): void => {\n this._navigator.stateService.currentImage$.pipe(\n first())\n .subscribe(\n (image) => { resolve(image); },\n (error) => { reject(error); });\n }\n );\n }\n\n /**\n * Get the viewer's current point of view.\n *\n * @returns {Promise<PointOfView>} Promise to the current point of view\n * of the viewer camera.\n *\n * @example\n * ```js\n * viewer.getPointOfView().then(pov => { console.log(pov); });\n * ```\n */\n public getPointOfView(): Promise<PointOfView> {\n return new Promise<PointOfView>(\n (resolve: (value: PointOfView) => void, reject: (reason: Error) => void): void => {\n observableCombineLatest(\n this._container.renderService.renderCamera$,\n this._container.renderService.bearing$).pipe(\n first())\n .subscribe(\n ([rc, bearing]: [RenderCamera, number]): void => {\n resolve({\n bearing: bearing,\n tilt: rc.getTilt(),\n });\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Get the viewer's current position\n *\n * @returns {Promise<LngLat>} Promise to the viewers's current\n * position.\n *\n * @example\n * ```js\n * viewer.getPosition().then(pos => { console.log(pos); });\n * ```\n */\n public getPosition(): Promise<LngLat> {\n return new Promise<LngLat>(\n (resolve: (value: LngLat) => void, reject: (reason: Error) => void): void => {\n observableCombineLatest(\n this._container.renderService.renderCamera$,\n this._navigator.stateService.reference$).pipe(\n first())\n .subscribe(\n ([render, reference]: [RenderCamera, LngLatAlt]): void => {\n resolve(this._observer.projection.cameraToLngLat(render, reference));\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Get the viewer's current reference position.\n *\n * @description The reference position specifies the origin in\n * the viewer's topocentric coordinate system.\n *\n * @returns {Promise<LngLatAlt>} Promise to the reference position.\n *\n * @example\n * ```js\n * viewer.getReference().then(reference => { console.log(reference); });\n * ```\n */\n public getReference(): Promise<LngLatAlt> {\n return new Promise<LngLatAlt>(\n (resolve: (reference: LngLatAlt) => void, reject: (reason: Error) => void): void => {\n this._navigator.stateService.reference$.pipe(\n first())\n .subscribe(\n (reference) => { resolve(reference); },\n (error) => { reject(error); });\n }\n );\n }\n\n /**\n * Get the image's current zoom level.\n *\n * @returns {Promise<number>} Promise to the viewers's current\n * zoom level.\n *\n * @example\n * ```js\n * viewer.getZoom().then(z => { console.log(z); });\n * ```\n */\n public getZoom(): Promise<number> {\n return new Promise<number>(\n (resolve: (value: number) => void, reject: (reason: Error) => void): void => {\n this._navigator.stateService.getZoom()\n .subscribe(\n (zoom: number): void => {\n resolve(zoom);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Check if a controls instance is the camera controls that are\n * currently attached to the viewer.\n *\n * @param {ICustomCameraControls} controls - Camera controls instance.\n * @returns {boolean} Value indicating whether the controls instance\n * is currently attached.\n */\n public hasCustomCameraControls(controls: ICustomCameraControls): boolean {\n return this._customCameraControls.has(controls);\n }\n\n /**\n * Check if a custom renderer has been added to the viewer's\n * rendering pipeline.\n *\n * @param {string} id - Unique ID of the custom renderer.\n * @returns {boolean} Value indicating whether the customer\n * renderer has been added.\n */\n public hasCustomRenderer(rendererId: string): boolean {\n return this._customRenderer.has(rendererId);\n }\n\n /**\n * Navigate in a given direction.\n *\n * @param {NavigationDirection} direction - Direction in which which to move.\n * @returns {Promise<Image>} Promise to the image that was navigated to.\n * @throws If the current image does not have the edge direction\n * or the edges has not yet been cached.\n * @throws Propagates any IO errors to the caller.\n * @throws When viewer is not navigable.\n * @throws {@link CancelMapillaryError} When a subsequent move request\n * is made before the move dir call has completed.\n *\n * @example\n * ```js\n * viewer.moveDir(NavigationDirection.Next).then(\n * image => { console.log(image); },\n * error => { console.error(error); });\n * ```\n */\n public moveDir(direction: NavigationDirection): Promise<Image> {\n const moveDir$: Observable<Image> = this.isNavigable ?\n this._navigator.moveDir$(direction) :\n observableThrowError(new Error(\"Calling moveDir is not supported when viewer is not navigable.\"));\n\n return new Promise<Image>(\n (resolve: (value: Image) => void, reject: (reason: Error) => void): void => {\n moveDir$.subscribe(\n (image: Image): void => {\n resolve(image);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Navigate to a given image ID.\n *\n * @param {string} imageId - Id of the image to move to.\n * @returns {Promise<Image>} Promise to the image that was navigated to.\n * @throws Propagates any IO errors to the caller.\n * @throws When viewer is not navigable.\n * @throws {@link CancelMapillaryError} When a subsequent\n * move request is made before the move to ID call has completed.\n *\n * @example\n * ```js\n * viewer.moveTo(\"<my-image-id>\").then(\n * image => { console.log(image); },\n * error => { console.error(error); });\n * ```\n */\n public moveTo(imageId: string): Promise<Image> {\n const moveTo$: Observable<Image> = this.isNavigable ?\n this._navigator.moveTo$(imageId) :\n observableThrowError(new Error(\"Calling moveTo is not supported when viewer is not navigable.\"));\n\n return new Promise<Image>(\n (resolve: (value: Image) => void, reject: (reason: Error) => void): void => {\n moveTo$.subscribe(\n (image: Image): void => {\n resolve(image);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n public off(\n type: ViewerBearingEvent[\"type\"],\n handler: (event: ViewerBearingEvent) => void)\n : void;\n public off(\n type: ViewerDataLoadingEvent[\"type\"],\n handler: (event: ViewerDataLoadingEvent) => void)\n : void;\n public off(\n type: ViewerNavigableEvent[\"type\"],\n handler: (event: ViewerNavigableEvent) => void)\n : void;\n public off(\n type: ViewerImageEvent[\"type\"],\n handler: (event: ViewerImageEvent) => void)\n : void;\n public off(\n type: ViewerNavigationEdgeEvent[\"type\"],\n handler: (event: ViewerNavigationEdgeEvent) => void)\n : void;\n public off(\n type: ViewerReferenceEvent[\"type\"],\n handler: (event: ViewerReferenceEvent) => void)\n : void;\n public off(\n type: ViewerStateEvent[\"type\"],\n handler: (event: ViewerStateEvent) => void)\n : void;\n public off(\n type: ViewerMouseEvent[\"type\"],\n handler: (event: ViewerMouseEvent) => void)\n : void;\n public off<T>(\n type: ViewerEventType,\n handler: (event: T) => void)\n : void {\n super.off(type, handler);\n }\n\n /**\n * Fired when the viewing direction of the camera changes.\n *\n * @event bearing\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"bearing\", function() {\n * console.log(\"A bearing event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"bearing\",\n handler: (event: ViewerBearingEvent) => void)\n : void;\n /**\n * Fired when a pointing device (usually a mouse) is\n * pressed and released at the same point in the viewer.\n *\n * @event click\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"click\", function() {\n * console.log(\"A click event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"click\",\n handler: (event: ViewerMouseEvent) => void)\n : void;\n /**\n * Fired when the right button of the mouse is clicked\n * within the viewer.\n *\n * @event contextmenu\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"contextmenu\", function() {\n * console.log(\"A contextmenu event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"contextmenu\",\n handler: (event: ViewerMouseEvent) => void)\n : void;\n /**\n * Fired when the viewer is loading data.\n *\n * @event loading\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"dataloading\", function() {\n * console.log(\"A loading event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"dataloading\",\n handler: (event: ViewerDataLoadingEvent) => void)\n : void;\n /**\n * Fired when a pointing device (usually a mouse) is clicked twice at\n * the same point in the viewer.\n *\n * @event dblclick\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"dblclick\", function() {\n * console.log(\"A dblclick event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"dblclick\",\n handler: (event: ViewerMouseEvent) => void)\n : void;\n /**\n * Fired when the viewer's vertical field of view changes.\n *\n * @event fov\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"fov\", function() {\n * console.log(\"A fov event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"fov\",\n handler: (event: ViewerStateEvent) => void)\n : void;\n /**\n * Fired immediately after all necessary resources\n * have been downloaded and the first visually complete\n * rendering of the viewer has occurred.\n *\n * This event is only fired for viewer configurations where\n * the WebGL context is created, i.e. not when using the\n * fallback functionality only.\n *\n * @event load\n * @example\n * @example\n * ```js\n * // Set an event listener\n * viewer.on('load', function(event) {\n * console.log('A load event has occured');\n * });\n * ```\n */\n public on(\n type: \"load\",\n handler: (event: ViewerLoadEvent) => void)\n : void;\n /**\n * Fired when a pointing device (usually a mouse) is pressed\n * within the viewer.\n *\n * @event mousedown\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"mousedown\", function() {\n * console.log(\"A mousedown event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"mousedown\",\n handler: (event: ViewerMouseEvent) => void)\n : void;\n /**\n * Fired when a pointing device (usually a mouse)\n * is moved within the viewer.\n *\n * @event mousemove\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"mousemove\", function() {\n * console.log(\"A mousemove event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"mousemove\",\n handler: (event: ViewerMouseEvent) => void)\n : void;\n /**\n * Fired when a pointing device (usually a mouse)\n * leaves the viewer's canvas.\n *\n * @event mouseout\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"mouseout\", function() {\n * console.log(\"A mouseout event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"mouseout\",\n handler: (event: ViewerMouseEvent) => void)\n : void;\n /**\n * Fired when a pointing device (usually a mouse)\n * is moved onto the viewer's canvas.\n *\n * @event mouseover\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"mouseover\", function() {\n * console.log(\"A mouseover event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"mouseover\",\n handler: (event: ViewerMouseEvent) => void)\n : void;\n /**\n * Fired when a pointing device (usually a mouse)\n * is released within the viewer.\n *\n * @event mouseup\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"mouseup\", function() {\n * console.log(\"A mouseup event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"mouseup\",\n handler: (event: ViewerMouseEvent) => void)\n : void;\n /**\n * Fired when the viewer motion stops and it is in a fixed\n * position with a fixed point of view.\n *\n * @event moveend\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"moveend\", function() {\n * console.log(\"A moveend event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"moveend\",\n handler: (event: ViewerStateEvent) => void)\n : void;\n /**\n * Fired when the motion from one view to another start,\n * either by changing the position (e.g. when changing image)\n * or when changing point of view\n * (e.g. by interaction such as pan and zoom).\n *\n * @event movestart\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"movestart\", function() {\n * console.log(\"A movestart event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"movestart\",\n handler: (event: ViewerStateEvent) => void)\n : void;\n /**\n * Fired when the navigable state of the viewer changes.\n *\n * @event navigable\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"navigable\", function() {\n * console.log(\"A navigable event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"navigable\",\n handler: (event: ViewerNavigableEvent) => void)\n : void;\n /**\n * Fired every time the viewer navigates to a new image.\n *\n * @event image\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"image\", function() {\n * console.log(\"A image event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"image\",\n handler: (event: ViewerImageEvent) => void)\n : void;\n /**\n * Fired when the viewer's position changes.\n *\n * @description The viewer's position changes when transitioning\n * between images.\n *\n * @event position\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"position\", function() {\n * console.log(\"A position event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"position\",\n handler: (event: ViewerStateEvent) => void)\n : void;\n /**\n * Fired when the viewer's point of view changes. The\n * point of view changes when the bearing, or tilt changes.\n *\n * @event pov\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"pov\", function() {\n * console.log(\"A pov event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"pov\",\n handler: (event: ViewerStateEvent) => void)\n : void;\n /**\n * Fired when the viewer's reference position changes.\n *\n * The reference position specifies the origin in\n * the viewer's topocentric coordinate system.\n *\n * @event reference\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"reference\", function(reference) {\n * console.log(\"A reference event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"reference\",\n handler: (event: ViewerReferenceEvent) => void)\n : void;\n /**\n * Fired when the viewer is removed. After this event is emitted\n * you must not call any methods on the viewer.\n *\n * @event remove\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"remove\", function() {\n * console.log(\"A remove event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"remove\",\n handler: (event: ViewerStateEvent) => void)\n : void;\n /**\n * Fired every time the sequence edges of the current image changes.\n *\n * @event sequenceedges\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"sequenceedges\", function() {\n * console.log(\"A sequenceedges event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"sequenceedges\",\n handler: (event: ViewerNavigationEdgeEvent) => void)\n : void;\n /**\n * Fired every time the spatial edges of the current image changes.\n *\n * @event spatialedges\n * @example\n * ```js\n * // Initialize the viewer\n * var viewer = new Viewer({ // viewer options });\n * // Set an event listener\n * viewer.on(\"spatialedges\", function() {\n * console.log(\"A spatialedges event has occurred.\");\n * });\n * ```\n */\n public on(\n type: \"spatialedges\",\n handler: (event: ViewerNavigationEdgeEvent) => void)\n : void;\n public on<T>(\n type: ViewerEventType,\n handler: (event: T) => void)\n : void {\n super.on(type, handler);\n }\n\n /**\n * Project geodetic coordinates to canvas pixel coordinates.\n *\n * @description The geodetic coordinates may not always correspond to pixel\n * coordinates, e.g. if the geodetic coordinates have a position behind the\n * viewer camera. In the case of no correspondence the returned value will\n * be `null`.\n *\n * If the distance from the viewer camera position to the provided\n * longitude-latitude is more than 1000 meters `null` will be returned.\n *\n * The projection is performed from the ground plane, i.e.\n * the altitude with respect to the ground plane for the geodetic\n * point is zero.\n *\n * Note that whenever the camera moves, the result of the method will be\n * different.\n *\n * @param {LngLat} lngLat - Geographical coordinates to project.\n * @returns {Promise<Array<number>>} Promise to the pixel coordinates corresponding\n * to the lngLat.\n *\n * @example\n * ```js\n * viewer.project({ lat: 0, lng: 0 })\n * .then(pixelPoint => {\n * if (!pixelPoint) {\n * console.log(\"no correspondence\");\n * }\n *\n * console.log(pixelPoint);\n * });\n * ```\n */\n public project(lngLat: LngLat): Promise<number[]> {\n return new Promise<number[]>(\n (resolve: (value: number[]) => void, reject: (reason: Error) => void): void => {\n this._observer.project$(lngLat)\n .subscribe(\n (pixelPoint: number[]): void => {\n resolve(pixelPoint);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Project basic image coordinates for the current image to canvas pixel\n * coordinates.\n *\n * @description The basic image coordinates may not always correspond to a\n * pixel point that lies in the visible area of the viewer container. In the\n * case of no correspondence the returned value can be `null`.\n *\n *\n * @param {Array<number>} basicPoint - Basic images coordinates to project.\n * @returns {Promise<Array<number>>} Promise to the pixel coordinates corresponding\n * to the basic image point.\n *\n * @example\n * ```js\n * viewer.projectFromBasic([0.3, 0.7])\n * .then(pixelPoint => { console.log(pixelPoint); });\n * ```\n */\n public projectFromBasic(basicPoint: number[]): Promise<number[]> {\n return new Promise<number[]>(\n (resolve: (value: number[]) => void, reject: (reason: Error) => void): void => {\n this._observer.projectBasic$(basicPoint)\n .subscribe(\n (pixelPoint: number[]): void => {\n resolve(pixelPoint);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Clean up and release all internal resources associated with\n * this viewer.\n *\n * @description This includes DOM elements, event bindings, and\n * WebGL resources.\n *\n * Use this method when you are done using the viewer and wish to\n * ensure that it no longer consumes browser resources. Afterwards,\n * you must not call any other methods on the viewer.\n *\n * @fires remove\n *\n * @example\n * ```js\n * viewer.remove();\n * ```\n */\n public remove(): void {\n this._customRenderer.dispose(this);\n this._customCameraControls.dispose(this);\n this._observer.dispose();\n this._componentController.remove();\n this._navigator.dispose();\n this._container.remove();\n\n const type: ViewerEventType = \"remove\";\n const event: ViewerStateEvent = {\n target: this,\n type,\n };\n this.fire(type, event);\n }\n\n /**\n * Remove a custom renderer from the viewer's rendering pipeline.\n *\n * @param id - Unique ID of the custom renderer.\n */\n public removeCustomRenderer(rendererId: string): void {\n this._customRenderer.remove(rendererId, this);\n }\n\n /**\n * Detect the viewer's new width and height and resize it\n * manually.\n *\n * @description The components will also detect the viewer's\n * new size and resize their rendered elements if needed.\n *\n * When the {@link ViewerOptions.trackResize} option is\n * set to true, the viewer will automatically resize\n * when the browser window is resized. If any other\n * custom behavior is preferred, the option should be set\n * to false and the {@link Viewer.resize} method should\n * be called on demand.\n *\n * @example\n * ```js\n * viewer.resize();\n * ```\n */\n public resize(): void {\n this._container.renderService.resize$.next();\n }\n\n /**\n * Set the viewer's camera control mode.\n *\n * @description The camera control mode determines\n * how the camera is controlled when the viewer\n * receives pointer and keyboard input.\n *\n * Changing the camera control mode is not possible\n * when the slider component is active and attempts\n * to do so will be ignored.\n *\n * @param {CameraControls} controls - Camera control mode.\n *\n * @example\n * ```js\n * viewer.setCameraControls(CameraControls.Street);\n * ```\n */\n public setCameraControls(controls: CameraControls): void {\n const state = cameraControlsToState(controls);\n if (state === State.Traversing) {\n this._navigator.stateService.traverse();\n } else if (state === State.Earth) {\n this._navigator.stateService.earth();\n } else if (state === State.Custom) {\n this._navigator.stateService.custom();\n } else {\n console.warn(\n `Unsupported camera control transition (${controls})`);\n }\n }\n\n /**\n * Set the basic coordinates of the current image to be in the\n * center of the viewport.\n *\n * @description Basic coordinates are 2D coordinates on the [0, 1] interval\n * and has the origin point, (0, 0), at the top left corner and the\n * maximum value, (1, 1), at the bottom right corner of the original\n * image.\n *\n * @param {number[]} The basic coordinates of the current\n * image to be at the center for the viewport.\n *\n * @example\n * ```js\n * viewer.setCenter([0.5, 0.5]);\n * ```\n */\n public setCenter(center: number[]): void {\n this._navigator.stateService.setCenter(center);\n }\n\n /**\n * Set the viewer's current vertical field of view.\n *\n * @description Sets the vertical field of view rendered\n * on the viewer canvas measured in degrees. The value\n * will be clamped to be able to set a valid zoom level\n * based on the projection model of the current image and\n * the viewer's current render mode.\n *\n * @param {number} fov - Vertical field of view in degrees.\n *\n * @example\n * ```js\n * viewer.setFieldOfView(45);\n * ```\n */\n public setFieldOfView(fov: number): void {\n this._container.renderService.renderCamera$.pipe(\n first())\n .subscribe(\n (rc: RenderCamera): void => {\n const zoom: number = rc.fovToZoom(fov);\n this._navigator.stateService.setZoom(zoom);\n });\n }\n\n /**\n * Set the filter selecting images to use when calculating\n * the spatial edges.\n *\n * @description The following filter types are supported:\n *\n * Comparison\n *\n * `[\"==\", key, value]` equality: `image[key] = value`\n *\n * `[\"!=\", key, value]` inequality: `image[key] ≠value`\n *\n * `[\"<\", key, value]` less than: `image[key] < value`\n *\n * `[\"<=\", key, value]` less than or equal: `image[key] ≤ value`\n *\n * `[\">\", key, value]` greater than: `image[key] > value`\n *\n * `[\">=\", key, value]` greater than or equal: `image[key] ≥ value`\n *\n * Set membership\n *\n * `[\"in\", key, v0, ..., vn]` set inclusion: `image[key] ∈ {v0, ..., vn}`\n *\n * `[\"!in\", key, v0, ..., vn]` set exclusion: `image[key] ∉ {v0, ..., vn}`\n *\n * Combining\n *\n * `[\"all\", f0, ..., fn]` logical `AND`: `f0 ∧ ... ∧ fn`\n *\n * A key must be a string that identifies a property name of a\n * simple {@link Image} property, i.e. a key of the {@link FilterKey}\n * type. A value must be a string, number, or\n * boolean. Strictly-typed comparisons are used. The values\n * `f0, ..., fn` of the combining filter must be filter expressions.\n *\n * Clear the filter by setting it to null or empty array.\n *\n * Commonly used filter properties (see the {@link Image} class\n * documentation for a full list of properties that can be used\n * in a filter) are shown the the example code.\n *\n * @param {FilterExpression} [filter] - The filter expression.\n * Applied filter is cleared if omitted.\n * @returns {Promise<void>} Promise that resolves after filter is applied.\n *\n * @example\n * ```js\n * // Examples\n * viewer.setFilter([\"==\", \"cameraType\", \"spherical\"]);\n * viewer.setFilter([\">=\", \"capturedAt\", <my-time-stamp>]);\n * viewer.setFilter([\"in\", \"sequenceId\", \"<sequence-id-1>\", \"<sequence-id-2>\"]);\n * ```\n */\n public setFilter(filter?: FilterExpression): Promise<void> {\n return new Promise<void>(\n (resolve: (value: void) => void, reject: (reason: Error) => void): void => {\n this._navigator.setFilter$(filter)\n .subscribe(\n (): void => {\n resolve(undefined);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Set the viewer's render mode.\n *\n * @param {RenderMode} renderMode - Render mode.\n *\n * @example\n * ```js\n * viewer.setRenderMode(RenderMode.Letterbox);\n * ```\n */\n public setRenderMode(renderMode: RenderMode): void {\n this._container.renderService.renderMode$.next(renderMode);\n }\n\n /**\n * Set the viewer's transition mode.\n *\n * @param {TransitionMode} transitionMode - Transition mode.\n *\n * @example\n * ```js\n * viewer.setTransitionMode(TransitionMode.Instantaneous);\n * ```\n */\n public setTransitionMode(transitionMode: TransitionMode): void {\n this._navigator.stateService.setTransitionMode(transitionMode);\n }\n\n /**\n * Set an access token for authenticated API requests of protected\n * resources.\n *\n * The token may be a user access token or a client access token.\n *\n * @description When the supplied user token is null or undefined,\n * any previously set user bearer token will be cleared and the\n * viewer will make unauthenticated requests.\n *\n * Calling setAccessToken aborts all outstanding move requests.\n * The promises of those move requests will be rejected with a\n * {@link CancelMapillaryError} the rejections need to be caught.\n *\n * Calling setAccessToken also resets the complete viewer cache\n * so it should not be called repeatedly.\n *\n * @param {string} [accessToken] accessToken - Optional user\n * access token or client access token.\n * @returns {Promise<void>} Promise that resolves after token\n * is set.\n *\n * @throws When viewer is not navigable.\n *\n * @example\n * ```js\n * viewer.setAccessToken(\"<my access token>\")\n * .then(() => { console.log(\"user token set\"); });\n * ```\n */\n public setAccessToken(accessToken?: string): Promise<void> {\n const setAccessToken$: Observable<void> = this.isNavigable ?\n this._navigator.setAccessToken$(accessToken) :\n observableThrowError(new Error(\"Calling setAccessToken is not supported when viewer is not navigable.\"));\n\n return new Promise<void>(\n (resolve: (value: void) => void, reject: (reason: Error) => void): void => {\n setAccessToken$\n .subscribe(\n (): void => {\n resolve(undefined);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Set the image's current zoom level.\n *\n * @description Possible zoom level values are on the [0, 3] interval.\n * Zero means zooming out to fit the image to the view whereas three\n * shows the highest level of detail.\n *\n * @param {number} The image's current zoom level.\n *\n * @example\n * ```js\n * viewer.setZoom(2);\n * ```\n */\n public setZoom(zoom: number): void {\n this._navigator.stateService.setZoom(zoom);\n }\n\n /**\n * Trigger the rendering of a single frame.\n *\n * @description Use this method with custom renderers to\n * force the viewer to rerender when the custom content\n * changes. Calling this multiple times before the next\n * frame is rendered will still result in only a single\n * frame being rendered.\n */\n public triggerRerender(): void {\n this._container.glRenderer.triggerRerender();\n }\n\n /**\n * Unproject canvas pixel coordinates to geodetic\n * coordinates.\n *\n * @description The pixel point may not always correspond to geodetic\n * coordinates. In the case of no correspondence the returned value will\n * be `null`.\n *\n * The unprojection to a lngLat will be performed towards the ground plane, i.e.\n * the altitude with respect to the ground plane for the returned lngLat is zero.\n *\n * @param {Array<number>} pixelPoint - Pixel coordinates to unproject.\n * @returns {Promise<LngLat>} Promise to the lngLat corresponding to the pixel point.\n *\n * @example\n * ```js\n * viewer.unproject([100, 100])\n * .then(lngLat => { console.log(lngLat); });\n * ```\n */\n public unproject(pixelPoint: number[]): Promise<LngLat> {\n return new Promise<LngLat>(\n (resolve: (value: LngLat) => void, reject: (reason: Error) => void): void => {\n this._observer.unproject$(pixelPoint)\n .subscribe(\n (lngLat: LngLat): void => {\n resolve(lngLat);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n\n /**\n * Unproject canvas pixel coordinates to basic image coordinates for the\n * current image.\n *\n * @description The pixel point may not always correspond to basic image\n * coordinates. In the case of no correspondence the returned value will\n * be `null`.\n *\n * @param {Array<number>} pixelPoint - Pixel coordinates to unproject.\n * @returns {Promise<LngLat>} Promise to the basic coordinates corresponding\n * to the pixel point.\n *\n * @example\n * ```js\n * viewer.unprojectToBasic([100, 100])\n * .then(basicPoint => { console.log(basicPoint); });\n * ```\n */\n public unprojectToBasic(pixelPoint: number[]): Promise<number[]> {\n return new Promise<number[]>(\n (resolve: (value: number[]) => void, reject: (reason: Error) => void): void => {\n this._observer.unprojectBasic$(pixelPoint)\n .subscribe(\n (basicPoint: number[]): void => {\n resolve(basicPoint);\n },\n (error: Error): void => {\n reject(error);\n });\n });\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","TypeError","String","__","this","constructor","create","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","__generator","body","f","y","t","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","n","v","op","pop","length","push","__values","o","s","m","i","__read","r","ar","error","__spreadArray","to","from","il","j","__await","__asyncGenerator","asyncIterator","q","a","resume","fulfill","settle","shift","__asyncValues","isFunction","createErrorClass","createImpl","ctorFunc","instance","Error","stack","UnsubscriptionError","_super","errors","message","map","err","toString","join","name","arrRemove","arr","item","index","indexOf","splice","initialTeardown","Subscription","closed","_parentage","isArray","_parentage_1","remove","_teardowns","_teardowns_1","teardown_1","execTeardown","teardown","_hasParent","_addParent","parent","includes","_removeParent","empty","EMPTY_SUBSCRIPTION","EMPTY","isSubscription","add","unsubscribe","config","onUnhandledError","onStoppedNotification","undefined","useDeprecatedSynchronousErrorHandling","useDeprecatedNextContext","timeoutProvider","setTimeout","_i","args","delegate","clearTimeout","handle","reportUnhandledError","noop","COMPLETE_NOTIFICATION","createNotification","kind","context","errorContext","cb","isRoot","errorThrown","_a","destination","_this","EMPTY_OBSERVER","Subscriber","complete","SafeSubscriber","isStopped","handleStoppedNotification","nextNotification","_next","_error","_complete","observerOrNext","context_1","bind","wrapForErrorHandling","defaultErrorHandler","handler","notification","subscriber","observable","identity","x","pipeFromArray","fns","input","reduce","prev","fn","subscribe","_subscribe","Observable","operator","source","isObserver","_trySubscribe","sink","promiseCtor","getPromiseCtor","subscription","Symbol_observable","operations","hasLift","lift","operate","init","liftedSource","onNext","onComplete","onError","onFinalize","OperatorSubscriber","refCount","connection","_refCount","refCounter","sharedConnection","_connection","conn","connect","subjectFactory","ConnectableObservable","getSubject","subject","_subject","subject_1","_teardown","higherOrderRefCount","ObjectUnsubscribedError","Subject","AnonymousSubject","_throwIfClosed","copy","observers","slice","copy_1","hasError","thrownError","_checkFinalizedStatuses","_innerSubscribe","_value","BehaviorSubject","getValue","dateTimestampProvider","now","Date","_bufferSize","_windowTime","_timestampProvider","_infiniteTimeWindow","Infinity","Math","max","ReplaySubject","_buffer","_trimBuffer","adjustedBufferSize","last","scheduler","work","Action","state","delay","intervalProvider","setInterval","clearInterval","AsyncAction","id","recycleAsyncId","pending","requestAsyncId","_id","flush","_scheduler","_execute","_delay","errorValue","errored","actions","schedulerActionCtor","Scheduler","schedule","asyncScheduler","SchedulerAction","AsyncScheduler","action","_active","execute","async","emptyScheduled","scheduleArray","isArrayLike","isPromise","caughtSchedule","scheduleAsyncIterable","sub","isInteropObservable","isIterable","Symbol_iterator","isAsyncIterable","obj","createInvalidObservableTypeError","readableStreamLikeToAsyncGenerator","readableStream","reader","getReader","read","_b","releaseLock","isReadableStreamLike","scheduled","scheduleObservable","schedulePromise","scheduleIterable","scheduleReadableStreamLike","innerFrom","obs","fromArrayLike","promise","fromAsyncIterable","iterable","iterable_1","array","asyncIterable","asyncIterable_1","process","catch","internalFromArray","isScheduler","popResultSelector","popScheduler","popNumber","defaultValue","of","throwError","errorOrErrorFactory","errorFactory","EmptyError","isValidDate","isNaN","TimeoutError","info","timeout","schedulerArg","first","each","_with","timeoutErrorFactory","_c","_d","meta","originalSourceSubscription","timerSubscription","lastValue","seen","startTimer","project","mapOneOrManyArgs","callOrApply","getPrototypeOf","objectProto","getKeys","argsArgArrayOrObject","first_1","keys","key","createObject","values","combineLatest","resultSelector","observables","combineLatestInit","pipe","valueTransform","maybeSchedule","active","remainingFirstValues","hasFirstValue","mergeInternals","concurrent","onBeforeNext","expand","innerSubScheduler","additionalTeardown","buffer","isComplete","checkComplete","outerNext","doInnerSub","innerComplete","innerValue","bufferedValue","mergeMap","ii","mergeAll","concatAll","concat","nodeEventEmitterMethods","eventTargetMethods","jqueryMethods","fromEvent","target","eventName","options","addEventListener","removeEventListener","isEventTarget","methodName","addListener","removeListener","isNodeStyleEventEmitter","toCommonHandlerRegistry","on","off","isJQueryStyleEventEmitter","subTarget","timer","dueTime","intervalOrScheduler","intervalDuration","due","merge","sources","argsOrArgArray","filter","predicate","zip","buffers","completed","sourceIndex","every","some","auditTime","duration","durationSelector","hasValue","durationSubscriber","endDuration","cleanupDuration","bufferCount","bufferSize","startBufferEvery","count","toEmit","buffers_1","toEmit_1","buffers_2","catchError","selector","handledResult","innerSub","syncUnsub","scanInternals","accumulator","seed","hasSeed","emitOnNext","emitBeforeComplete","hasState","arguments","concatMap","DEFAULT_CONFIG","connector","subscribable","debounceTime","activeTask","lastTime","emit","emitWhenIdle","targetTime","defaultIfEmpty","take","distinctUntilChanged","comparator","keySelector","defaultCompare","previousKey","currentKey","throwIfEmpty","defaultErrorFactory","finalize","callback","hasDefaultValue","takeLast","buffer_1","multicast","subjectOrSubjectFactory","pairwise","hasPrev","publish","publishReplay","windowTime","selectorOrScheduler","timestampProvider","retry","configOrCount","resetOnSuccess","soFar","subscribeForRetry","resub_1","notifier","notifierSubscriber_1","scan","share","resetOnError","resetOnComplete","resetOnRefCountZero","wrapperSource","resetConnection","hasCompleted","hasErrored","cancelReset","reset","resetAndUnsubscribe","dest","handleReset","skip","skipWhile","taking","startWith","switchMap","innerSubscriber","innerIndex","outerIndex","takeUntil","takeWhile","inclusive","tap","tapObserver","isUnsub","withLatestFrom","inputs","len","otherValues","ready","FilterCreator","[object Object]","Function","_compile","_compileComparisonOp","_compileInOp","_compileNegation","_compileLogicalOp","property","checkType","left","_compilePropertyReference","right","JSON","stringify","compare","_compare","sort","filters","compile","expression","AddEquation","CubeReflectionMapping","CubeRefractionMapping","CubeUVReflectionMapping","RepeatWrapping","ClampToEdgeWrapping","MirroredRepeatWrapping","NearestFilter","LinearFilter","LinearMipmapLinearFilter","UnsignedByteType","UnsignedShortType","UnsignedIntType","FloatType","HalfFloatType","UnsignedInt248Type","RGBFormat","RGBAFormat","DepthFormat","DepthStencilFormat","InterpolateDiscrete","InterpolateLinear","InterpolateSmooth","ZeroCurvatureEnding","ZeroSlopeEnding","WrapAroundEnding","NormalAnimationBlendMode","LinearEncoding","sRGBEncoding","GammaEncoding","RGBEEncoding","KeepStencilOp","StaticDrawUsage","DynamicDrawUsage","GLSL3","EventDispatcher","type","listener","_listeners","listeners","listenerArray","event","l","_seed","DEG2RAD","PI","RAD2DEG","_lut","hasRandomUUID","crypto","generateUUID","randomUUID","toUpperCase","d0","random","d1","d2","d3","clamp","min","euclideanModulo","lerp","isPowerOfTwo","floorPowerOfTwo","pow","floor","log","LN2","MathUtils","freeze","mapLinear","a1","a2","b1","b2","inverseLerp","damp","lambda","dt","exp","pingpong","abs","smoothstep","smootherstep","randInt","low","high","randFloat","randFloatSpread","range","seededRandom","degToRad","degrees","radToDeg","radians","ceilPowerOfTwo","ceil","setQuaternionFromProperEuler","c","order","cos","sin","c2","s2","c13","s13","c1_3","s1_3","c3_1","s3_1","set","console","warn","Vector2","width","height","scalar","w","addVectors","subVectors","multiplyScalar","elements","minVal","maxVal","divideScalar","round","sqrt","atan2","distanceToSquared","dx","dy","normalize","alpha","v1","v2","offset","attribute","getX","getY","center","angle","isVector2","Matrix3","n11","n12","n13","n21","n22","n23","n31","n32","n33","te","me","xAxis","yAxis","zAxis","setFromMatrix3Column","multiplyMatrices","ae","be","a11","a12","a13","a21","a22","a23","a31","a32","a33","b11","b12","b13","b21","b22","b23","b31","b32","b33","h","t11","t12","t13","det","detInv","tmp","matrix4","setFromMatrix4","invert","transpose","tx","ty","sx","sy","rotation","cx","cy","theta","matrix","fromArray","arrayMax","createElementNS","document","hashString","str","h1","h2","ch","charCodeAt","imul","_canvas","isMatrix3","ImageUtils","image","test","src","HTMLCanvasElement","canvas","getContext","ImageData","putImageData","drawImage","toDataURL","textureId","Texture","DEFAULT_IMAGE","mapping","DEFAULT_MAPPING","wrapS","wrapT","magFilter","minFilter","format","anisotropy","encoding","super","defineProperty","uuid","mipmaps","internalFormat","repeat","matrixAutoUpdate","generateMipmaps","premultiplyAlpha","flipY","unpackAlignment","userData","version","onUpdate","isRenderTargetTexture","setUvTransform","parse","isRootObject","textures","output","metadata","wrap","images","url","isDataTexture","serializeImage","dispatchEvent","uv","applyMatrix3","needsUpdate","HTMLImageElement","ImageBitmap","getDataURL","data","isTexture","Vector4","z","acos","epsilon","epsilon2","m11","m12","m13","m21","m22","m23","m31","m32","m33","xx","yy","zz","xy","xz","yz","getZ","getW","isVector4","WebGLRenderTarget","depth","scissor","scissorTest","viewport","texture","depthBuffer","stencilBuffer","depthTexture","dispose","clone","isWebGLRenderTarget","isWebGLMultipleRenderTargets","WebGLMultisampleRenderTarget","samples","isWebGLMultisampleRenderTarget","Quaternion","_x","_y","_z","_w","qa","qb","qm","slerpQuaternions","dst","dstOffset","src0","srcOffset0","src1","srcOffset1","x0","y0","z0","w0","x1","y1","z1","w1","dir","sqrSin","Number","EPSILON","tDir","_onChangeCallback","quaternion","euler","update","isEuler","_order","c1","c3","s1","s3","axis","halfAngle","trace","vFrom","vTo","dot","angleTo","slerp","conjugate","multiplyQuaternions","qax","qay","qaz","qaw","qbx","qby","qbz","qbw","cosHalfTheta","sqrSinHalfTheta","sinHalfTheta","halfTheta","ratioA","ratioB","u1","sqrt1u1","sqrtu1","u2","u3","isQuaternion","Vector3","multiplyVectors","applyQuaternion","_quaternion$4","setFromEuler","setFromAxisAngle","qx","qy","qz","qw","ix","iy","iz","iw","camera","applyMatrix4","matrixWorldInverse","projectionMatrix","projectionMatrixInverse","matrixWorld","crossVectors","ax","ay","az","bx","by","bz","denominator","lengthSq","planeNormal","_vector$c","projectOnVector","normal","dz","setFromSphericalCoords","radius","phi","sinPhiRadius","setFromCylindricalCoords","setFromMatrixColumn","sz","u","isVector3","Box3","minX","minY","minZ","maxX","maxY","maxZ","points","makeEmpty","expandByPoint","size","halfSize","_vector$b","object","expandByObject","box","isEmpty","point","vector","addScalar","updateWorldMatrix","geometry","boundingBox","computeBoundingBox","_box$3","union","children","sphere","clampPoint","plane","constant","triangle","getCenter","_center","_extents","_v0$2","_v1$7","_v2$3","_f0","_f1","_f2","axes","satForAxes","_triangleNormal","getSize","_points","setFromPoints","equals","isBox3","_testAxis","v0","extents","p0","p1","p2","_box$2","_v1$6","_toFarthestPoint","_toPoint","Sphere","optionalCenter","maxRadiusSq","distanceTo","radiusSum","intersectsSphere","distanceToPoint","deltaLengthSq","expandByScalar","getMaxScaleOnAxis","missingRadiusHalf","_vector$a","_segCenter","_segDir","_diff","_edge1","_edge2","_normal$1","Ray","origin","direction","ray","at","directionDistance","distanceSqToPoint","optionalPointOnRay","optionalPointOnSegment","segExtent","a01","b0","s0","sqrDist","extDet","invDet","tca","radius2","thc","t0","t1","distanceToPlane","distToPoint","tmin","tmax","tymin","tymax","tzmin","tzmax","invdirx","invdiry","invdirz","intersectBox","backfaceCulling","sign","DdN","DdQxE2","DdE1xQ","cross","QdN","transformDirection","Matrix4","n14","n24","n34","n41","n42","n43","n44","scaleX","_v1$5","scaleY","scaleZ","af","bf","ce","cf","de","df","ac","ad","bc","bd","compose","_zero","_one","eye","up","a14","a24","a34","a41","a42","a43","a44","b14","b24","b34","b41","b42","b43","b44","t14","scaleXSq","scaleYSq","scaleZSq","yx","zx","zy","position","scale","x2","y2","z2","wx","wy","wz","determinant","_m1$2","invSX","invSY","invSZ","setFromRotationMatrix","top","bottom","near","far","isMatrix4","_matrix$1","_quaternion$3","Euler","DefaultOrder","asin","makeRotationFromQuaternion","newOrder","setFromQuaternion","optionalResult","RotationOrders","Layers","mask","channel","layers","_object3DId","_v1$4","_q1","_m1$1","_target","_position$3","_scale$2","_quaternion$2","_xAxis","_yAxis","_zAxis","_addedEvent","_removedEvent","Object3D","DefaultUp","_onChange","defineProperties","configurable","enumerable","modelViewMatrix","normalMatrix","DefaultMatrixAutoUpdate","matrixWorldNeedsUpdate","visible","castShadow","receiveShadow","frustumCulled","renderOrder","animations","updateMatrix","premultiply","decompose","multiply","rotateOnAxis","distance","translateOnAxis","setFromMatrixPosition","isCamera","isLight","lookAt","extractRotation","isObject3D","getObjectByProperty","traverse","traverseVisible","traverseAncestors","force","updateMatrixWorld","updateParents","updateChildren","geometries","materials","shapes","skeletons","serialize","library","element","toJSON","toArray","isInstancedMesh","instanceMatrix","instanceColor","isScene","background","isColor","environment","isMesh","isLine","isPoints","parameters","shape","isSkinnedMesh","bindMode","bindMatrix","skeleton","material","uuids","animation","extractFromCache","cache","recursive","child","_v0$1","_v1$3","_v2$2","_v3$1","_vab","_vac","_vbc","_vap","_vbp","_vcp","Triangle","targetLengthSq","dot00","dot01","dot02","dot11","dot12","denom","invDenom","getBarycoord","p3","uv1","uv2","uv3","addScaledVector","i0","i1","i2","fromBufferAttribute","getNormal","setFromCoplanarPoints","getUV","containsPoint","isFrontFacing","intersectsTriangle","d4","vc","d5","d6","vb","va","materialId","Material","fog","blending","side","vertexColors","opacity","transparent","blendSrc","blendDst","blendEquation","blendSrcAlpha","blendDstAlpha","blendEquationAlpha","depthFunc","depthTest","depthWrite","stencilWriteMask","stencilFunc","stencilRef","stencilFuncMask","stencilFail","stencilZFail","stencilZPass","stencilWrite","clippingPlanes","clipIntersection","clipShadows","shadowSide","colorWrite","precision","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","dithering","alphaToCoverage","premultipliedAlpha","toneMapped","_alphaTest","alphaTest","onBeforeCompile","newValue","flatShading","currentValue","color","getHex","roughness","metalness","sheen","sheenColor","sheenRoughness","emissive","emissiveIntensity","specular","specularIntensity","specularColor","shininess","clearcoat","clearcoatRoughness","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","clearcoatNormalScale","matcap","alphaMap","lightMap","lightMapIntensity","aoMap","aoMapIntensity","bumpMap","bumpScale","normalMap","normalMapType","normalScale","displacementMap","displacementScale","displacementBias","roughnessMap","metalnessMap","emissiveMap","specularMap","specularIntensityMap","specularColorMap","envMap","combine","envMapIntensity","reflectivity","refractionRatio","gradientMap","transmission","transmissionMap","thickness","thicknessMap","attenuationDistance","attenuationColor","sizeAttenuation","linewidth","dashSize","gapSize","wireframe","wireframeLinewidth","wireframeLinecap","wireframeLinejoin","srcPlanes","dstPlanes","isMaterial","_colorKeywords","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","_hslA","_hslB","hue2rgb","SRGBToLinear","LinearToSRGB","Color","setRGB","setHex","setStyle","hex","style","handleAlpha","string","parseFloat","exec","components","parseInt","setHSL","charAt","setColorName","toLowerCase","gammaFactor","safeInverse","copyGammaToLinear","copyLinearToGamma","copySRGBToLinear","copyLinearToSRGB","hue","saturation","lightness","delta","getHSL","color1","color2","normalized","NAMES","MeshBasicMaterial","setValues","isMeshBasicMaterial","_vector$9","_vector2$1","BufferAttribute","itemSize","usage","updateRange","index1","index2","colors","vectors","setXY","setXYZ","applyNormalMatrix","onUploadCallback","isBufferAttribute","Uint16BufferAttribute","Uint16Array","Uint32BufferAttribute","Uint32Array","isFloat16BufferAttribute","Float32BufferAttribute","Float32Array","_m1","_obj","_offset","_box$1","_boxMorphTargets","_vector$8","BufferGeometry","attributes","morphAttributes","morphTargetsRelative","groups","boundingSphere","drawRange","start","materialIndex","getNormalMatrix","tangent","computeBoundingSphere","makeRotationX","makeRotationY","makeRotationZ","makeTranslation","makeScale","negate","translate","setAttribute","morphAttributesPosition","isGLBufferAttribute","setFromBufferAttribute","morphAttribute","jl","indices","positions","normals","uvs","nVertices","tangents","tan1","tan2","vA","vB","vC","uvA","uvB","uvC","sdir","tdir","handleTriangle","isFinite","group","tmp2","n2","handleVertex","positionAttribute","getAttribute","normalAttribute","pA","pB","pC","nA","nB","nC","ab","normalizeNormals","isBufferGeometry","attributeArray1","attribute2","attributeArray2","attributeOffset","convertBufferAttribute","array2","isInterleavedBufferAttribute","stride","geometry2","newAttribute","morphArray","addGroup","hasMorphAttributes","attributeArray","setIndex","assign","_inverseMatrix$2","_ray$2","_sphere$3","_vA$1","_vB$1","_vC$1","_tempA","_tempB","_tempC","_morphA","_morphB","_morphC","_uvA$1","_uvB$1","_uvC$1","_intersectionPoint","_intersectionPointWorld","Mesh","updateMorphTargets","morphTargetInfluences","morphTargetDictionary","ml","morphTargets","raycaster","intersects","intersectsBox","intersection","morphPosition","groupMaterial","checkBufferGeometryIntersection","faceIndex","face","isGeometry","morphInfluences","influence","boneTransform","intersect","intersectTriangle","checkIntersection","BoxGeometry","widthSegments","heightSegments","depthSegments","scope","vertices","numberOfVertices","groupStart","buildPlane","udir","vdir","gridX","gridY","segmentWidth","segmentHeight","widthHalf","heightHalf","depthHalf","gridX1","gridY1","vertexCounter","groupCount","cloneUniforms","mergeUniforms","uniforms","merged","UniformsUtils","ShaderMaterial","defines","vertexShader","fragmentShader","lights","clipping","extensions","derivatives","fragDepth","drawBuffers","shaderTextureLOD","defaultAttributeValues","index0AttributeName","uniformsNeedUpdate","glslVersion","isShaderMaterial","Camera","PerspectiveCamera","fov","aspect","zoom","focus","view","filmGauge","filmOffset","updateProjectionMatrix","focalLength","vExtentSlope","getFilmHeight","atan","fullWidth","fullHeight","enabled","offsetX","offsetY","skew","getFilmWidth","makePerspective","isPerspectiveCamera","CubeCamera","renderTarget","isWebGLCubeRenderTarget","cameraPX","cameraNX","cameraPY","cameraNY","cameraPZ","cameraNZ","renderer","scene","currentXrEnabled","xr","currentRenderTarget","getRenderTarget","setRenderTarget","render","CubeTexture","isCubeTexture","WebGLCubeRenderTarget","dummy","isInteger","_needsFlipEnvMap","shader","tEquirect","mesh","currentMinFilter","stencil","clear","_vector1","_vector2","_normalMatrix","Plane","setFromNormalAndCoplanarPoint","inverseNormalLength","line","startSign","endSign","end","intersectsPlane","optionalNormalMatrix","referencePoint","coplanarPoint","isPlane","_sphere$2","_vector$7","Frustum","p4","p5","planes","frustum","me0","me1","me2","me3","me4","me5","me6","me7","me8","me9","me10","me11","me12","me13","me14","me15","setComponents","sprite","negRadius","WebGLAnimation","isAnimating","animationLoop","requestId","onAnimationFrame","time","frame","requestAnimationFrame","stop","cancelAnimationFrame","setAnimationLoop","setContext","WebGLAttributes","gl","capabilities","isWebGL2","WeakMap","get","deleteBuffer","delete","bufferType","cached","bytesPerElement","elementSize","createBuffer","bindBuffer","bufferData","Float64Array","Int16Array","Int32Array","Int8Array","Uint8Array","Uint8ClampedArray","BYTES_PER_ELEMENT","bufferSubData","subarray","updateBuffer","PlaneGeometry","width_half","height_half","segment_width","segment_height","ShaderChunk","alphamap_fragment","alphamap_pars_fragment","alphatest_fragment","alphatest_pars_fragment","aomap_fragment","aomap_pars_fragment","begin_vertex","beginnormal_vertex","bsdfs","bumpmap_pars_fragment","clipping_planes_fragment","clipping_planes_pars_fragment","clipping_planes_pars_vertex","clipping_planes_vertex","color_fragment","color_pars_fragment","color_pars_vertex","color_vertex","common","cube_uv_reflection_fragment","defaultnormal_vertex","displacementmap_pars_vertex","displacementmap_vertex","emissivemap_fragment","emissivemap_pars_fragment","encodings_fragment","encodings_pars_fragment","envmap_fragment","envmap_common_pars_fragment","envmap_pars_fragment","envmap_pars_vertex","envmap_physical_pars_fragment","envmap_vertex","fog_vertex","fog_pars_vertex","fog_fragment","fog_pars_fragment","gradientmap_pars_fragment","lightmap_fragment","lightmap_pars_fragment","lights_lambert_vertex","lights_pars_begin","lights_toon_fragment","lights_toon_pars_fragment","lights_phong_fragment","lights_phong_pars_fragment","lights_physical_fragment","lights_physical_pars_fragment","lights_fragment_begin","lights_fragment_maps","lights_fragment_end","logdepthbuf_fragment","logdepthbuf_pars_fragment","logdepthbuf_pars_vertex","logdepthbuf_vertex","map_fragment","map_pars_fragment","map_particle_fragment","map_particle_pars_fragment","metalnessmap_fragment","metalnessmap_pars_fragment","morphnormal_vertex","morphtarget_pars_vertex","morphtarget_vertex","normal_fragment_begin","normal_fragment_maps","normal_pars_fragment","normal_pars_vertex","normal_vertex","normalmap_pars_fragment","clearcoat_normal_fragment_begin","clearcoat_normal_fragment_maps","clearcoat_pars_fragment","output_fragment","packing","premultiplied_alpha_fragment","project_vertex","dithering_fragment","dithering_pars_fragment","roughnessmap_fragment","roughnessmap_pars_fragment","shadowmap_pars_fragment","shadowmap_pars_vertex","shadowmap_vertex","shadowmask_pars_fragment","skinbase_vertex","skinning_pars_vertex","skinning_vertex","skinnormal_vertex","specularmap_fragment","specularmap_pars_fragment","tonemapping_fragment","tonemapping_pars_fragment","transmission_fragment","transmission_pars_fragment","uv_pars_fragment","uv_pars_vertex","uv_vertex","uv2_pars_fragment","uv2_pars_vertex","uv2_vertex","worldpos_vertex","background_vert","background_frag","cube_vert","cube_frag","depth_vert","depth_frag","distanceRGBA_vert","distanceRGBA_frag","equirect_vert","equirect_frag","linedashed_vert","linedashed_frag","meshbasic_vert","meshbasic_frag","meshlambert_vert","meshlambert_frag","meshmatcap_vert","meshmatcap_frag","meshnormal_vert","meshnormal_frag","meshphong_vert","meshphong_frag","meshphysical_vert","meshphysical_frag","meshtoon_vert","meshtoon_frag","points_vert","points_frag","shadow_vert","shadow_frag","sprite_vert","sprite_frag","UniformsLib","diffuse","uvTransform","uv2Transform","specularmap","envmap","flipEnvMap","ior","maxMipLevel","aomap","lightmap","emissivemap","bumpmap","normalmap","displacementmap","roughnessmap","metalnessmap","gradientmap","fogDensity","fogNear","fogFar","fogColor","ambientLightColor","lightProbe","directionalLights","properties","directionalLightShadows","shadowBias","shadowNormalBias","shadowRadius","shadowMapSize","directionalShadowMap","directionalShadowMatrix","spotLights","coneCos","penumbraCos","decay","spotLightShadows","spotShadowMap","spotShadowMatrix","pointLights","pointLightShadows","shadowCameraNear","shadowCameraFar","pointShadowMap","pointShadowMatrix","hemisphereLights","skyColor","groundColor","rectAreaLights","ltc_1","ltc_2","ShaderLib","basic","lambert","phong","standard","toon","dashed","totalSize","t2D","cube","equirect","distanceRGBA","referencePosition","nearDistance","farDistance","shadow","WebGLBackground","cubemaps","objects","clearColor","planeMesh","boxMesh","clearAlpha","currentBackground","currentBackgroundVersion","currentTonemapping","setClear","getClearColor","setClearColor","getClearAlpha","setClearAlpha","renderList","forceClear","session","getSession","environmentBlendMode","autoClear","autoClearColor","autoClearDepth","autoClearStencil","deleteAttribute","onBeforeRender","copyPosition","toneMapping","unshift","WebGLBindingStates","maxVertexAttributes","getParameter","extension","vaoAvailable","bindingStates","defaultState","createBindingState","currentState","bindVertexArrayObject","vao","bindVertexArray","bindVertexArrayOES","deleteVertexArrayObject","deleteVertexArray","deleteVertexArrayOES","newAttributes","enabledAttributes","attributeDivisors","program","initAttributes","enableAttribute","enableAttributeAndDivisor","meshPerAttribute","enableVertexAttribArray","disableUnusedAttributes","disableVertexAttribArray","vertexAttribPointer","vertexAttribIPointer","resetDefaultState","setup","updateBuffers","programMap","stateMap","createVertexArray","createVertexArrayOES","getBindingState","cachedAttributes","geometryAttributes","attributesNum","cachedAttribute","geometryAttribute","saveCache","isInstancedBufferGeometry","programAttributes","getAttributes","materialDefaultAttributeValues","programAttribute","location","isInstancedInterleavedBuffer","locationSize","_maxInstanceCount","isInstancedBufferAttribute","vertexAttrib2fv","vertexAttrib3fv","vertexAttrib4fv","vertexAttrib1fv","setupVertexAttributes","geometryId","programId","releaseStatesOfGeometry","releaseStatesOfProgram","WebGLBufferRenderer","mode","setMode","drawArrays","renderInstances","primcount","WebGLCapabilities","maxAnisotropy","getMaxPrecision","getShaderPrecisionFormat","WebGL2RenderingContext","WebGL2ComputeRenderingContext","maxPrecision","has","logarithmicDepthBuffer","maxTextures","maxVertexTextures","maxTextureSize","maxCubemapSize","maxAttributes","maxVertexUniforms","maxVaryings","maxFragmentUniforms","vertexTextures","floatFragmentTextures","getMaxAnisotropy","MAX_TEXTURE_MAX_ANISOTROPY_EXT","floatVertexTextures","maxSamples","WebGLClipping","globalState","numGlobalPlanes","localClippingEnabled","renderingShadows","viewNormalMatrix","uniform","resetGlobalState","numPlanes","numIntersection","projectPlanes","skipTransform","nPlanes","dstArray","flatSize","viewMatrix","i4","enableLocalClipping","beginShadows","endShadows","setState","useCache","materialProperties","nGlobal","lGlobal","clippingState","WebGLCubeMaps","mapTextureMapping","onTextureDispose","cubemap","fromEquirectangularTexture","physical","sheenColorMap","sheenRoughnessMap","transmissionSamplerSize","transmissionSamplerMap","OrthographicCamera","scaleW","scaleH","makeOrthographic","isOrthographicCamera","RawShaderMaterial","isRawShaderMaterial","SIZE_MAX","EXTRA_LOD_SIGMA","TOTAL_LODS","LOD_MAX","MAX_SAMPLES","ENCODINGS","3004","3005","3006","_flatCamera","_lodPlanes","_sizeLods","_sigmas","_createPlanes","_clearColor","_oldTarget","PHI","INV_PHI","_axisDirections","PMREMGenerator","_renderer","_pingPongRenderTarget","_blurMaterial","weights","poleAxis","latitudinal","dTheta","mipInt","inputEncoding","outputEncoding","_getCommonVertexShader","_getEncodings","_getBlurShader","_equirectShader","_cubemapShader","_compileMaterial","sigma","cubeUVRenderTarget","_allocateTargets","_sceneToCubeUV","_blur","_applyPMREM","_cleanup","equirectangular","_fromTexture","_getCubemapShader","_getEquirectShader","outputTarget","_setViewport","_textureToCubeUV","params","_isLDR","_createRenderTarget","tmpMesh","cubeCamera","upSign","forwardSign","originalAutoClear","backgroundMaterial","backgroundBox","useSolidColor","col","_setEncoding","lodIn","lodOut","pingPongRenderTarget","_halfBlur","targetIn","targetOut","sigmaRadians","blurMaterial","blurMesh","blurUniforms","pixels","radiansPerPixel","sigmaPixels","sum","weight","outputSize","lod","sizeLod","texelSize","cubeFaces","positionSize","uvSize","faceIndexSize","coordinates","fill","WebGLCubeUVMaps","cubeUVmaps","pmremGenerator","cubemapUV","isEquirectMap","isCubeMap","isCubeTextureComplete","fromEquirectangular","fromCubemap","WebGLExtensions","getExtension","WebGLGeometries","wireframeAttributes","onGeometryDispose","memory","updateWireframeAttribute","geometryIndex","geometryPosition","previousAttribute","getWireframeAttribute","currentAttribute","WebGLIndexedBufferRenderer","drawElements","WebGLInfo","calls","triangles","lines","programs","autoReset","instanceCount","DataTexture2DArray","wrapR","numericalSort","absNumericalSort","denormalize","morph","WebGLMorphtargets","influencesList","morphTextures","workInfluences","objectInfluences","numberOfMorphTargets","entry","hasMorphNormals","morphNormals","numberOfVertexData","vertexDataStride","morphTarget","morphNormal","morphInfluencesSum","morphBaseInfluence","getUniforms","setValue","influences","MAX_SAFE_INTEGER","hasAttribute","WebGLObjects","updateMap","onInstancedMeshDispose","instancedMesh","buffergeometry","hasEventListener","isDataTexture2DArray","DataTexture3D","isDataTexture3D","emptyTexture","emptyTexture2dArray","emptyTexture3d","emptyCubeTexture","arrayCacheF32","arrayCacheI32","mat4array","mat3array","mat2array","flatten","nBlocks","blockSize","firstElem","arraysEqual","copyArray","allocTexUnits","allocateTextureUnit","setValueV1f","uniform1f","addr","setValueV2f","uniform2f","uniform2fv","setValueV3f","uniform3f","uniform3fv","setValueV4f","uniform4f","uniform4fv","setValueM2","uniformMatrix2fv","setValueM3","uniformMatrix3fv","setValueM4","uniformMatrix4fv","setValueV1i","uniform1i","setValueV2i","uniform2iv","setValueV3i","uniform3iv","setValueV4i","uniform4iv","setValueV1ui","uniform1ui","setValueV2ui","uniform2uiv","setValueV3ui","uniform3uiv","setValueV4ui","uniform4uiv","setValueT1","unit","safeSetTexture2D","setValueT3D1","setTexture3D","setValueT6","safeSetTextureCube","setValueT2DArray1","setTexture2DArray","setValueV1fArray","uniform1fv","setValueV2fArray","setValueV3fArray","setValueV4fArray","setValueM2Array","setValueM3Array","setValueM4Array","setValueV1iArray","uniform1iv","setValueV2iArray","setValueV3iArray","setValueV4iArray","setValueV1uiArray","uniform1uiv","setValueV2uiArray","setValueV3uiArray","setValueV4uiArray","setValueT1Array","units","setValueT6Array","SingleUniform","activeInfo","getSingularSetter","PureArrayUniform","getPureArraySetter","StructuredUniform","seq","updateCache","RePathPart","addUniform","container","uniformObject","parseUniform","path","pathLength","lastIndex","match","matchEnd","idIsIndex","subscript","WebGLUniforms","getProgramParameter","getActiveUniform","getUniformLocation","WebGLShader","createShader","shaderSource","compileShader","setOptional","upload","seqWithValue","programIdCount","getEncodingComponents","getShaderErrors","status","getShaderParameter","getShaderInfoLog","trim","split","addLineNumbers","getShaderSource","getTexelDecodingFunction","functionName","getTexelEncodingFunction","getToneMappingFunction","toneMappingName","filterEmptyLine","replaceLightNums","replace","numDirLights","numSpotLights","numRectAreaLights","numPointLights","numHemiLights","numDirLightShadows","numSpotLightShadows","numPointLightShadows","replaceClippingPlaneNums","numClippingPlanes","numClipIntersection","includePattern","resolveIncludes","includeReplacer","include","deprecatedUnrollLoopPattern","unrollLoopPattern","unrollLoops","loopReplacer","deprecatedLoopReplacer","snippet","generatePrecision","precisionstring","WebGLProgram","cacheKey","shadowMapTypeDefine","shadowMapType","generateShadowMapTypeDefine","envMapTypeDefine","envMapMode","generateEnvMapTypeDefine","envMapModeDefine","generateEnvMapModeDefine","envMapBlendingDefine","generateEnvMapBlendingDefine","gammaFactorDefine","customExtensions","extensionDerivatives","envMapCubeUV","tangentSpaceNormalMap","shaderID","extensionFragDepth","rendererExtensionFragDepth","extensionDrawBuffers","rendererExtensionDrawBuffers","extensionShaderTextureLOD","rendererExtensionShaderTextureLod","generateExtensions","customDefines","chunks","generateDefines","createProgram","prefixVertex","prefixFragment","versionString","shaderName","instancing","instancingColor","supportsVertexTextures","maxBones","useFog","fogExp2","objectSpaceNormalMap","vertexTangents","vertexAlphas","vertexUvs","uvsVertexOnly","skinning","useVertexTexture","morphTargetsCount","doubleSided","flipSided","shadowMapEnabled","physicallyCorrectLights","mapEncoding","matcapEncoding","envMapEncoding","emissiveMapEncoding","specularColorMapEncoding","sheenColorMapEncoding","lightMapEncoding","depthPacking","fragmentGlsl","glVertexShader","glFragmentShader","attachShader","bindAttribLocation","linkProgram","debug","checkShaderErrors","programLog","getProgramInfoLog","vertexLog","fragmentLog","runnable","haveDiagnostics","vertexErrors","fragmentErrors","getError","diagnostics","prefix","cachedUniforms","deleteShader","getActiveAttrib","getAttribLocation","fetchAttributeLocations","destroy","deleteProgram","usedTimes","WebGLPrograms","cubeuvmaps","shaderIDs","MeshDepthMaterial","MeshDistanceMaterial","MeshNormalMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial","MeshStandardMaterial","MeshPhysicalMaterial","MeshMatcapMaterial","LineBasicMaterial","LineDashedMaterial","PointsMaterial","ShadowMaterial","SpriteMaterial","parameterNames","getTextureEncodingFromMap","getParameters","shadows","isMeshStandardMaterial","bones","nVertexUniforms","nVertexMatrices","getMaxBones","useAlphaTest","useClearcoat","isFogExp2","directional","spot","rectArea","hemi","shadowMap","customProgramCacheKey","getProgramCacheKey","acquireProgram","pl","preexistingProgram","releaseProgram","WebGLProperties","painterSortStable","groupOrder","reversePainterSortStable","WebGLRenderList","renderItems","renderItemsIndex","opaque","transmissive","defaultProgram","getNextRenderItem","renderItem","finish","customOpaqueSort","customTransparentSort","WebGLRenderLists","lists","renderCallDepth","list","UniformsCache","light","halfWidth","halfHeight","nextVersion","shadowCastingLightsFirst","lightA","lightB","WebGLLights","shadowCache","ShadowUniformsCache","hash","directionalLength","pointLength","spotLength","rectAreaLength","hemiLength","numDirectionalShadows","numPointShadows","numSpotShadows","ambient","probe","directionalShadow","spotShadow","rectAreaLTC1","rectAreaLTC2","pointShadow","vector3","matrix42","scaleFactor","intensity","isAmbientLight","isLightProbe","sh","coefficients","isDirectionalLight","shadowUniforms","bias","normalBias","mapSize","isSpotLight","penumbra","isRectAreaLight","isPointLight","isHemisphereLight","LTC_FLOAT_1","LTC_FLOAT_2","LTC_HALF_1","LTC_HALF_2","setupView","WebGLRenderState","lightsArray","shadowsArray","setupLights","setupLightsView","pushLight","pushShadow","shadowLight","WebGLRenderStates","renderStates","renderState","isMeshDepthMaterial","isMeshDistanceMaterial","WebGLShadowMap","_objects","_capabilities","_frustum","_shadowMapSize","_viewportSize","_viewport","_depthMaterial","_distanceMaterial","_materialCache","_maxTextureSize","0","1","2","shadowMaterialVertical","VSM_SAMPLES","shadow_pass","resolution","shadowMaterialHorizontal","HORIZONTAL_PASS","fullScreenTri","fullScreenMesh","VSMPass","blurSamples","mapPass","renderBufferDirect","getDepthMaterial","customMaterial","customDistanceMaterial","customDepthMaterial","keyA","keyB","materialsForVariant","cachedMaterial","renderObject","shadowCamera","intersectsObject","k","kl","depthMaterial","autoUpdate","activeCubeFace","getActiveCubeFace","activeMipmapLevel","getActiveMipmapLevel","_state","setBlending","setTest","setScissorTest","shadowFrameExtents","getFrameExtents","isPointLightShadow","pars","viewportCount","getViewportCount","vp","getViewport","updateMatrices","getFrustum","WebGLState","colorBuffer","locked","currentColorMask","currentColorClear","setMask","colorMask","setLocked","lock","currentDepthMask","currentDepthFunc","currentDepthClear","enable","disable","depthMask","setFunc","clearDepth","currentStencilMask","currentStencilFunc","currentStencilRef","currentStencilFuncMask","currentStencilFail","currentStencilZFail","currentStencilZPass","currentStencilClear","stencilTest","stencilMask","setOp","stencilOp","clearStencil","enabledCapabilities","xrFramebuffer","currentBoundFramebuffers","currentProgram","currentBlendingEnabled","currentBlending","currentBlendEquation","currentBlendSrc","currentBlendDst","currentBlendEquationAlpha","currentBlendSrcAlpha","currentBlendDstAlpha","currentPremultipledAlpha","currentFlipSided","currentCullFace","currentLineWidth","currentPolygonOffsetFactor","currentPolygonOffsetUnits","lineWidthAvailable","glVersion","currentTextureSlot","currentBoundTextures","scissorParam","viewportParam","currentScissor","currentViewport","createTexture","bindTexture","texParameteri","texImage2D","emptyTextures","setFlipSided","setCullFace","equationToGL","101","102","MIN_EXT","MAX_EXT","factorToGL","200","201","202","204","210","208","206","203","205","209","207","blendEquationSeparate","blendFuncSeparate","blendFunc","frontFace","cullFace","setPolygonOffset","factor","activeTexture","webglSlot","bindFramebuffer","framebuffer","bindXRFramebuffer","useProgram","setMaterial","frontFaceCW","setLineWidth","lineWidth","webglType","webglTexture","boundTexture","unbindTexture","compressedTexImage2D","texImage3D","WebGLTextures","_gl","utils","_videoTextures","useOffscreenCanvas","OffscreenCanvas","createCanvas","resizeImage","needsPowerOfTwo","needsNewCanvas","maxSize","isPowerOfTwo$1","textureNeedsGenerateMipmaps","supportsMips","generateMipmap","__maxMipLevel","log2","getInternalFormat","internalFormatName","glFormat","glType","filterFallback","textureProperties","__webglInit","deleteTexture","__webglTexture","deallocateTexture","isVideoTexture","onRenderTargetDispose","renderTargetProperties","deleteFramebuffer","__webglFramebuffer","__webglDepthbuffer","deleteRenderbuffer","__webglMultisampledFramebuffer","__webglColorRenderbuffer","__webglDepthRenderbuffer","attachmentProperties","deallocateRenderTarget","textureUnits","setTexture2D","slot","updateVideoTexture","__version","uploadTexture","setTextureCube","initTexture","pixelStorei","isCompressed","isCompressedTexture","cubeImage","convert","glInternalFormat","setTextureParameters","mipmap","mipmapImage","uploadCubeTexture","wrappingToGL","filterToGL","1004","1005","1007","textureType","__currentAnisotropy","texParameterf","TEXTURE_MAX_ANISOTROPY_EXT","textureNeedsPowerOfTwo","isDepthTexture","setupFrameBufferTexture","attachment","textureTarget","framebufferTexture2D","setupRenderBufferStorage","renderbuffer","isMultisample","bindRenderbuffer","getRenderTargetSamples","renderbufferStorageMultisample","renderbufferStorage","framebufferRenderbuffer","setupDepthRenderbuffer","isCube","webglDepthTexture","setupDepthTexture","createRenderbuffer","warnedTexture2D","warnedTextureCube","textureUnit","resetTextureUnits","setupRenderTarget","isMultipleRenderTargets","isRenderTarget3D","createFramebuffer","glTextureType","updateRenderTargetMipmap","updateMultisampleRenderTarget","blitFramebuffer","WebGLUtils","HALF_FLOAT_OES","COMPRESSED_RGB_S3TC_DXT1_EXT","COMPRESSED_RGBA_S3TC_DXT1_EXT","COMPRESSED_RGBA_S3TC_DXT3_EXT","COMPRESSED_RGBA_S3TC_DXT5_EXT","COMPRESSED_RGB_PVRTC_4BPPV1_IMG","COMPRESSED_RGB_PVRTC_2BPPV1_IMG","COMPRESSED_RGBA_PVRTC_4BPPV1_IMG","COMPRESSED_RGBA_PVRTC_2BPPV1_IMG","COMPRESSED_RGB_ETC1_WEBGL","COMPRESSED_RGB8_ETC2","COMPRESSED_RGBA8_ETC2_EAC","UNSIGNED_INT_24_8_WEBGL","ArrayCamera","cameras","isArrayCamera","Group","isGroup","_moveEvent","WebXRController","_targetRay","_grip","_hand","joints","inputState","pinching","hasLinearVelocity","linearVelocity","hasAngularVelocity","angularVelocity","inputSource","referenceSpace","inputPose","gripPose","handPose","targetRay","grip","hand","visibilityState","getPose","targetRaySpace","transform","inputjoint","jointPose","getJointPose","jointName","joint","jointRadius","indexTip","thumbTip","distanceToPinch","threshold","handedness","gripSpace","WebXRManager","framebufferScaleFactor","referenceSpaceType","pose","glBinding","glFramebuffer","glProjLayer","glBaseLayer","glMultisampledFramebuffer","glColorRenderbuffer","glDepthRenderbuffer","xrFrame","depthStyle","clearStyle","controllers","inputSourcesMap","Map","cameraL","cameraR","cameraVR","_currentDepthNear","_currentDepthFar","onSessionEvent","controller","onSessionEnd","forEach","disconnect","isPresenting","onInputSourcesChange","inputSources","removed","added","cameraAutoUpdate","getController","getTargetRaySpace","getControllerGrip","getGripSpace","getHand","getHandSpace","setFramebufferScaleFactor","setReferenceSpaceType","getReferenceSpace","getBaseLayer","getBinding","getFrame","setSession","getContextAttributes","xrCompatible","makeXRCompatible","layerInit","antialias","XRWebGLLayer","updateRenderState","baseLayer","WebGLRenderingContext","depthFormat","projectionlayerInit","colorFormat","XRWebGLBinding","createProjectionLayer","textureWidth","textureHeight","requestReferenceSpace","cameraLPos","cameraRPos","updateCamera","depthNear","depthFar","ipd","projL","projR","topFov","bottomFov","leftFov","rightFov","zOffset","xOffset","translateX","translateZ","near2","far2","left2","right2","top2","bottom2","setProjectionFromUnion","getCamera","getFoveation","fixedFoveation","setFoveation","foveation","onAnimationFrameCallback","getViewerPose","views","cameraVRNeedsUpdate","glSubImage","getViewSubImage","depthStencilTexture","colorTexture","invalidateFramebuffer","WebGLMaterials","refreshUniformsCommon","uvScaleMap","uv2ScaleMap","refreshUniformsStandard","refreshFogUniforms","isFog","density","refreshMaterialUniforms","pixelRatio","transmissionRenderTarget","isMeshLambertMaterial","refreshUniformsLambert","isMeshToonMaterial","refreshUniformsToon","isMeshPhongMaterial","refreshUniformsPhong","isMeshPhysicalMaterial","refreshUniformsPhysical","isMeshMatcapMaterial","refreshUniformsMatcap","refreshUniformsDepth","refreshUniformsDistance","isMeshNormalMaterial","refreshUniformsNormal","isLineBasicMaterial","refreshUniformsLine","isLineDashedMaterial","refreshUniformsDash","isPointsMaterial","refreshUniformsPoints","isSpriteMaterial","refreshUniformsSprites","isShadowMaterial","WebGLRenderer","display","createCanvasElement","_context","_alpha","_depth","_stencil","_antialias","_premultipliedAlpha","_preserveDrawingBuffer","preserveDrawingBuffer","_powerPreference","powerPreference","_failIfMajorPerformanceCaveat","failIfMajorPerformanceCaveat","currentRenderList","currentRenderState","renderListStack","renderStateStack","domElement","sortObjects","toneMappingExposure","_isContextLost","_currentActiveCubeFace","_currentActiveMipmapLevel","_currentRenderTarget","_currentMaterialId","_currentCamera","_currentViewport","_currentScissor","_currentScissorTest","_width","_height","_pixelRatio","_opaqueSort","_transparentSort","_scissor","_scissorTest","_currentDrawBuffers","_clippingEnabled","_localClippingEnabled","_transmissionRenderTarget","_projScreenMatrix","_vector3","_emptyScene","overrideMaterial","getTargetPixelRatio","programCache","renderLists","morphtargets","bufferRenderer","indexedBufferRenderer","contextNames","contextAttributes","contextName","onContextLost","onContextRestore","isWebGL1Renderer","rangeMin","rangeMax","initGLContext","preventDefault","infoAutoReset","shadowMapAutoUpdate","shadowMapNeedsUpdate","onMaterialDispose","releaseMaterialProgramReferences","deallocateMaterial","forceContextLoss","loseContext","forceContextRestore","restoreContext","getPixelRatio","setPixelRatio","setSize","updateStyle","setViewport","getDrawingBufferSize","setDrawingBufferSize","getCurrentViewport","getScissor","setScissor","getScissorTest","boolean","setOpaqueSort","method","setTransparentSort","bits","onXRSessionStart","onXRSessionEnd","needsProgramChange","needsLights","lightsStateVersion","getProgram","refreshProgram","refreshMaterial","refreshLights","p_uniforms","m_uniforms","uCamPos","cameraPosition","boneTexture","computeBoneTexture","boneTextureSize","uniformsList","setProgram","rangeFactor","dataCount","rangeStart","rangeCount","drawStart","drawEnd","drawCount","isLineSegments","isLineLoop","isSprite","projectObject","isLOD","intersectsSprite","renderScene","opaqueObjects","transmissiveObjects","transparentObjects","needsAntialias","currentToneMapping","renderObjects","renderTransmissionPass","onAfterRender","programCacheKey","updateCommonMaterialProperties","onBuild","materialNeedsLights","progUniforms","window","setFromProjectionMatrix","camera2","drawBuffersWEBGL","layer","framebufferTextureLayer","readRenderTargetPixels","activeCubeFaceIndex","textureFormat","halfFloatSupportedByExt","checkFramebufferStatus","readPixels","copyFramebufferToTexture","level","levelScale","copyTexImage2D","copyTextureToTexture","srcTexture","dstTexture","texSubImage2D","compressedTexSubImage2D","copyTextureToTexture3D","sourceBox","glTarget","unpackRowLen","unpackImageHeight","unpackSkipPixels","unpackSkipRows","unpackSkipImages","texSubImage3D","compressedTexSubImage3D","resetState","__THREE_DEVTOOLS__","CustomEvent","detail","isWebGLRenderer","Scene","InterleavedBuffer","arrayBuffers","_uuid","ib","setUsage","isInterleavedBuffer","_vector$6","InterleavedBufferAttribute","interleavedBuffer","interleavedBuffers","_geometry","_intersectPoint","_worldScale","_mvPosition","_alignedPosition","_rotatedPosition","_viewWorldMatrix","_vA","_vB","_vC","_uvA","_uvB","_uvC","Sprite","float32Array","setFromMatrixScale","transformVertex","vertexPosition","mvPosition","_basePosition","_skinIndex","_skinWeight","_vector$5","_matrix","SkinnedMesh","bindMatrixInverse","calculateInverses","skinWeight","manhattanLength","setXYZW","skinIndex","getComponent","boneIndex","boneInverses","isBone","InstancedBufferAttribute","_instanceLocalMatrix","_instanceWorldMatrix","_instanceIntersects","_mesh","raycastTimes","instanceId","getMatrixAt","raycast","linecap","linejoin","_start$1","_end$1","_inverseMatrix$1","_ray$1","_sphere$1","Line","lineDistances","localThreshold","localThresholdSq","vStart","vEnd","interSegment","interRay","distanceSqToSegment","_start","_end","LineSegments","_inverseMatrix","_ray","_sphere","_position$2","Points","testPoint","rayPointDistanceSq","intersectPoint","closestPointToPoint","distanceToRay","video","requestVideoFrameCallback","updateVideo","readyState","HAVE_CURRENT_DATA","isCanvasTexture","CircleGeometry","segments","thetaStart","thetaLength","vertex","segment","Curve","arcLengthDivisions","optionalTarget","getUtoTmapping","getPoint","divisions","getPointAt","lengths","getLengths","cacheArcLengths","current","arcLengths","targetArcLength","comparison","lengthBefore","t2","pt1","pt2","getTangent","binormals","vec","mat","getTangentAt","MAX_VALUE","tz","makeRotationAxis","json","EllipseCurve","aX","aY","xRadius","yRadius","aStartAngle","aEndAngle","aClockwise","aRotation","twoPi","deltaAngle","samePoints","fromJSON","isEllipseCurve","ArcCurve","aRadius","CubicPoly","c0","initCatmullRom","x3","tension","initNonuniformCatmullRom","dt0","dt1","dt2","calc","isArcCurve","px","py","pz","CatmullRomCurve3","curveType","intPoint","CatmullRom","QuadraticBezier","QuadraticBezierP0","QuadraticBezierP1","QuadraticBezierP2","CubicBezier","CubicBezierP0","CubicBezierP1","CubicBezierP2","CubicBezierP3","isCatmullRomCurve3","CubicBezierCurve","v3","isCubicBezierCurve","CubicBezierCurve3","isCubicBezierCurve3","LineCurve","isLineCurve","QuadraticBezierCurve","isQuadraticBezierCurve","QuadraticBezierCurve3","isQuadraticBezierCurve3","SplineCurve","isSplineCurve","Curves","LineCurve3","isLineCurve3","CurvePath","curves","autoClose","curve","startPoint","endPoint","getLength","curveLengths","getCurveLengths","diff","segmentLength","lens","cacheLengths","sums","pts","getPoints","Path","currentPoint","moveTo","lineTo","aCPx","aCPy","aCP1x","aCP1y","aCP2x","aCP2y","npts","absarc","absellipse","firstPoint","lastPoint","Shape","holes","holesPts","getPointsHoles","hole","Earcut","holeIndices","dim","hasHoles","outerLen","outerNode","linkedList","invSize","queue","steiner","getLeftmost","compareX","eliminateHole","filterPoints","eliminateHoles","earcutLinked","clockwise","signedArea","insertNode","removeNode","again","area","ear","pass","zOrder","prevZ","nextZ","tail","numMerges","pSize","qSize","inSize","sortLinked","indexCurve","isEarHashed","isEar","cureLocalIntersections","splitEarcut","pointInTriangle","minTX","minTY","maxTX","maxTY","locallyInside","isValidDiagonal","splitPolygon","hx","hy","mx","my","tanMin","sectorContainsSector","findHoleBridge","leftmost","intersectsPolygon","inside","middleInside","q1","q2","o1","o2","o3","o4","onSegment","num","Node","an","bp","ShapeUtils","contour","faces","removeDupEndPts","addContour","holeIndex","ExtrudeGeometry","verticesArray","uvArray","addShape","placeholder","curveSegments","steps","bevelEnabled","bevelThickness","bevelSize","bevelOffset","bevelSegments","extrudePath","uvgen","UVGenerator","WorldUVGenerator","amount","extrudePts","splineTube","binormal","position2","extrudeByPath","getSpacedPoints","computeFrenetFrames","shapePoints","extractPoints","isClockWise","reverse","hl","ahole","triangulateShape","scalePt2","pt","vlen","flen","getBevelVec","inPt","inPrev","inNext","v_trans_x","v_trans_y","shrink_by","v_prev_x","v_prev_y","v_next_x","v_next_y","v_prev_lensq","collinear0","v_prev_len","v_next_len","ptPrevShift_x","ptPrevShift_y","sf","v_trans_lensq","direction_eq","contourMovements","holesMovements","oneHoleMovements","verticesMovements","bs","vert","sidewalls","layeroffset","sl","slen1","slen2","f4","f3","addVertex","nextIndex","generateTopUV","addUV","generateSideWallUV","vector2","buildLidFaces","buildSideFaces","computeVertexNormals","toJSON$1","geometryShapes","indexA","indexB","indexC","a_x","a_y","b_x","b_y","c_x","c_y","indexD","a_z","b_z","c_z","d_x","d_y","d_z","ShapeGeometry","indexOffset","shapeVertices","shapeHoles","shapeHole","SphereGeometry","phiStart","phiLength","thetaEnd","grid","verticesRow","uOffset","STANDARD","PHYSICAL","_sheen","_clearcoat","_transmission","TOON","MATCAP","AnimationUtils","arraySlice","isTypedArray","convertArray","forceClone","ArrayBuffer","isView","DataView","getKeyframeOrder","times","sortedArray","nValues","srcOffset","flattenJSON","jsonKeys","valuePropertyName","subclip","sourceClip","startFrame","endFrame","fps","clip","tracks","track","valueSize","getValueSize","minStartTime","resetDuration","makeClipAdditive","targetClip","referenceFrame","referenceClip","numTracks","referenceTime","referenceTrack","referenceTrackType","ValueTypeName","targetTrack","find","referenceOffset","referenceValueSize","createInterpolant","isInterpolantFactoryMethodGLTFCubicSpline","targetOffset","targetValueSize","referenceValue","startIndex","endIndex","interpolant","evaluate","resultBuffer","numTimes","valueStart","multiplyQuaternionsFlat","valueEnd","blendMode","Interpolant","parameterPositions","sampleValues","sampleSize","_cachedIndex","settings","DefaultSettings_","pp","validate_interval","seek","linear_scan","forward_scan","giveUpAt","afterEnd_","t1global","beforeStart_","mid","intervalChanged_","interpolate_","copySampleValue_","CubicInterpolant","_weightPrev","_offsetPrev","_weightNext","_offsetNext","endingStart","endingEnd","iPrev","iNext","tPrev","tNext","getSettings_","halfDt","o0","oP","oN","wP","wN","ppp","sP","sN","LinearInterpolant","offset1","offset0","weight1","weight0","DiscreteInterpolant","KeyframeTrack","interpolation","TimeBufferType","ValueBufferType","setInterpolation","DefaultInterpolation","trackType","getInterpolation","factoryMethod","InterpolantFactoryMethodDiscrete","InterpolantFactoryMethodLinear","InterpolantFactoryMethodSmooth","timeOffset","timeScale","startTime","endTime","nKeys","valid","prevTime","currTime","smoothInterpolation","writeIndex","keep","offsetP","offsetN","readOffset","writeOffset","TypedKeyframeTrack","BooleanKeyframeTrack","ColorKeyframeTrack","NumberKeyframeTrack","QuaternionLinearInterpolant","slerpFlat","QuaternionKeyframeTrack","StringKeyframeTrack","VectorKeyframeTrack","AnimationClip","jsonTracks","frameTime","parseKeyframeTrack","clipTracks","morphTargetSequence","noLoop","numMorphTargets","objectOrClipArray","clipArray","animationToMorphTargets","pattern","parts","animationMorphTargets","clips","CreateFromMorphTargetSequence","addNonemptyTrack","trackName","animationKeys","propertyName","destTracks","clipName","hierarchyTracks","hierarchy","morphTargetNames","morphTargetName","animationKey","boneName","validate","optimize","typeName","getTrackTypeForValueTypeName","Cache","files","file","DefaultLoadingManager","onLoad","onProgress","urlModifier","isLoading","itemsLoaded","itemsTotal","handlers","onStart","itemStart","itemEnd","itemError","resolveURL","setURLModifier","addHandler","regex","loader","removeHandler","getHandler","global","Loader","manager","crossOrigin","withCredentials","resourcePath","requestHeader","load","loading","FileLoader","req","Request","headers","Headers","credentials","fetch","response","callbacks","contentLength","total","lengthComputable","loaded","ReadableStream","readData","close","byteLength","ProgressEvent","enqueue","statusText","stream","Response","responseType","arrayBuffer","blob","text","DOMParser","parseFromString","mimeType","ImageLoader","onImageLoad","removeEventListeners","onImageError","substr","CubeTextureLoader","urls","setCrossOrigin","setPath","loadTexture","TextureLoader","Light","_projScreenMatrix$1","_lightPositionWorld$1","_lookTarget$1","LightShadow","_frameExtents","_viewportCount","_viewports","shadowMatrix","viewportIndex","SpotLightShadow","isSpotLightShadow","power","_lightPositionWorld","_lookTarget","PointLightShadow","_cubeDirections","_cubeUps","DirectionalLightShadow","isDirectionalLightShadow","SphericalHarmonics3","coeff","shBasis","isSphericalHarmonics3","LightProbe","createImageBitmap","fetchOptions","res","colorSpaceConversion","imageBitmap","isImageBitmapLoader","AudioContext","webkitAudioContext","AudioLoader","setResponseType","setRequestHeader","setWithCredentials","bufferCopy","decodeAudioData","audioBuffer","sky","ground","isHemisphereLightProbe","isAmbientLightProbe","Clock","autoStart","oldTime","elapsedTime","running","getElapsedTime","getDelta","newTime","performance","PropertyMixer","binding","mixFunction","mixFunctionAdditive","setIdentity","_slerp","_slerpAdditive","_setAdditiveIdentityQuaternion","_workIndex","_select","_setAdditiveIdentityOther","_lerp","_lerpAdditive","_setAdditiveIdentityNumeric","_mixBufferRegion","_mixBufferRegionAdditive","_setIdentity","_origIndex","_addIndex","cumulativeWeight","cumulativeWeightAdditive","useCount","referenceCount","accuIndex","currentWeight","mix","weightAdditive","originalValueOffset","targetIndex","workOffset","_RESERVED_CHARS_RE","_reservedRe","RegExp","_wordChar","_wordCharOrDot","_directoryRe","_nodeRe","_objectRe","_propertyRe","_trackRe","_supportedObjectNames","PropertyBinding","rootNode","parsedPath","parseTrackName","node","findNode","nodeName","_getValue_unbound","_setValue_unbound","root","isAnimationObjectGroup","Composite","matches","results","objectName","objectIndex","propertyIndex","lastDot","lastIndexOf","substring","bone","getBoneByName","searchNodeSubtree","childNode","subTreeNode","targetObject","resolvedProperty","targetArray","sourceArray","_getValue_unavailable","_setValue_unavailable","nodeProperty","versioning","Versioning","None","NeedsUpdate","MatrixWorldNeedsUpdate","bindingType","BindingType","Direct","ArrayElement","HasFromToArray","EntireArray","GetterByBindingType","SetterByBindingTypeAndVersioning","targetGroup","optionalParsedPath","_targetGroup","_bindings","subscribe_","firstValidIndex","nCachedObjects_","bindings","unbind","_getValue_direct","_getValue_array","_getValue_arrayElement","_getValue_toArray","_setValue_direct","_setValue_direct_setNeedsUpdate","_setValue_direct_setMatrixWorldNeedsUpdate","_setValue_array","_setValue_array_setNeedsUpdate","_setValue_array_setMatrixWorldNeedsUpdate","_setValue_arrayElement","_setValue_arrayElement_setNeedsUpdate","_setValue_arrayElement_setMatrixWorldNeedsUpdate","_setValue_fromArray","_setValue_fromArray_setNeedsUpdate","_setValue_fromArray_setMatrixWorldNeedsUpdate","AnimationAction","mixer","localRoot","_mixer","_clip","_localRoot","nTracks","interpolants","interpolantSettings","_interpolantSettings","_interpolants","_propertyBindings","_cacheIndex","_byClipCacheIndex","_timeScaleInterpolant","_weightInterpolant","loop","_loopCount","_startTime","_effectiveTimeScale","_effectiveWeight","repetitions","paused","clampWhenFinished","zeroSlopeAtStart","zeroSlopeAtEnd","_activateAction","_deactivateAction","stopFading","stopWarping","_isActiveAction","_scheduleFading","fadeOutAction","warp","fadeOut","fadeIn","fadeInDuration","fadeOutDuration","startEndRatio","endStartRatio","fadeInAction","crossFadeFrom","weightInterpolant","_takeBackControlInterpolant","startTimeScale","endTimeScale","_lendControlInterpolant","timeScaleInterpolant","_root","deltaTime","timeDirection","_updateWeight","timeRunning","_updateTimeScale","clipTime","_updateTime","propertyMixers","accumulateAdditive","accumulate","interpolantValue","loopCount","pingPong","_setEndings","handle_stop","loopDelta","atStart","atEnd","weightNow","weightThen","_initMemoryManager","_accuIndex","prototypeAction","rootUuid","bindingsByRoot","_bindingsByRootAndName","bindingsByName","_addInactiveBinding","clipUuid","actionsForClip","_actionsByClip","_bindAction","knownActions","_addInactiveAction","_lendBinding","saveOriginalState","_lendAction","restoreOriginalState","_takeBackBinding","_takeBackAction","_actions","_nActiveActions","_nActiveBindings","_controlInterpolants","_nActiveControlInterpolants","stats","inUse","controlInterpolants","actionsByClip","actionByRoot","lastInactiveAction","cacheIndex","knownActionsForClip","lastKnownAction","byClipCacheIndex","_removeInactiveBindingsForAction","_removeInactiveBinding","prevIndex","lastActiveIndex","firstInactiveAction","firstInactiveIndex","lastActiveAction","bindingByName","propBinding","lastInactiveBinding","firstInactiveBinding","lastActiveBinding","_controlInterpolantsResultBuffer","__cacheIndex","lastActiveInterpolant","optionalRoot","clipObject","findByName","existingAction","newAction","nActions","_update","nBindings","timeInSeconds","actionsToRemove","_removeInactiveAction","Raycaster","LOD","coords","unproject","intersectObject","ascSort","_vector$2","_boneMatrix","_matrixWorldInv","getBoneList","boneList","_floatView","construct","fromPoints","setColors","isSkeletonHelper","extractUrlBase","TextDecoder","decode","fromCharCode","decodeURIComponent","escape","Handlers","isIntersectionBox","isIntersectionSphere","setFromMatrix","flattenToArrayOffset","multiplyVector3","multiplyVector3Array","applyToBufferAttribute","applyToVector3Array","getInverse","extractPosition","getPosition","setRotationFromQuaternion","multiplyToArray","multiplyVector4","rotateAxis","crossVector","rotateX","rotateY","rotateZ","rotateByAxis","makeFrustum","isIntersectionLine","intersectsLine","inverse","isIntersectionPlane","getArea","barycoordFromPoint","midpoint","getMidpoint","prototypenormal","getPlane","extractAllPoints","extrude","makeGeometry","fromAttribute","distanceToManhattan","manhattanDistanceTo","lengthManhattan","setEulerFromRotationMatrix","setEulerFromQuaternion","getPositionFromMatrix","getScaleFromMatrix","getColumnFromMatrix","applyProjection","getChildByName","getObjectByName","renderDepth","getWorldRotation","applyMatrix","eulerOrder","useQuaternion","setDrawMode","drawMode","initBones","setLens","setFocalLength","onlyShadow","shadowCameraFov","shadowCameraLeft","shadowCameraRight","shadowCameraTop","shadowCameraBottom","shadowCameraVisible","shadowDarkness","shadowMapWidth","shadowMapHeight","dynamic","setDynamic","copyIndicesArray","setArray","addIndex","addAttribute","addDrawCall","clearDrawCalls","clearGroups","computeOffsets","removeAttribute","drawcalls","offsets","getArrays","addShapeList","wrapAround","overdraw","wrapRGB","shading","clearTarget","animate","getCurrentRenderTarget","getPrecision","resetGLState","supportsFloatTextures","supportsHalfFloatTextures","supportsStandardDerivatives","supportsCompressedTextureS3TC","supportsCompressedTexturePVRTC","supportsBlendMinMax","supportsInstancedArrays","enableScissorTest","initMaterial","addPrePlugin","addPostPlugin","updateShadowMap","setFaceCulling","allocTextureUnit","setTexture","getActiveMipMapLevel","shadowMapCullFace","vr","gammaInput","gammaOutput","toneMappingWhitePoint","renderReverseSided","renderSingleSided","gain","createGain","getInput","autoplay","detune","loopStart","loopEnd","playbackRate","isPlaying","hasPlaybackControl","sourceType","_startedAt","_progress","_connected","audioNode","mediaElement","createMediaElementSource","mediaStream","createMediaStreamSource","play","currentTime","createBufferSource","onended","onEnded","setDetune","setPlaybackRate","getOutput","setTargetAtTime","getFilters","setFilters","setBuffer","updateCubeMap","loadTextureCube","loadCompressedTexture","loadCompressedTextureCube","revision","__THREE__","WGS84A","WGS84B","geodeticToEnu","lng","lat","alt","refLng","refLat","refAlt","ecef","geodeticToEcef","ecefToEnu","enuToGeodetic","enuToEcef","ecefToGeodetic","X","Y","Z","refEcef","V","cosLng","sinLng","cosLat","sinLat","L","nhcl","a2mb2","ea","eb","sinTheta","cosTheta","N","GraphCalculator","lngLat","sw","ne","compassAngle","orientation","rz","THREE.Matrix4","THREE.Euler","re","makeRotationFromEuler","THREE.Vector4","setAxisAngleFromRotationMatrix","Image","core","_cache","_core","_spatial","assetsCached","cameraParameters","camera_parameters","cameraType","camera_type","capturedAt","captured_at","clusterId","cluster","clusterUrl","computed_compass_angle","compass_angle","computedAltitude","computed_altitude","computedCompassAngle","computedLngLat","computed_geometry","creatorId","creator","creatorUsername","username","exifOrientation","exif_orientation","image$","merge_id","mergeId","originalAltitude","altitude","originalCompassAngle","originalLngLat","ownerId","owner","private","qualityScore","quality_score","computed_rotation","atomic_scale","sequenceId","sequence","sequenceEdges","sequenceEdges$","spatialEdges","spatialEdges$","cacheAssets$","cacheImage$","edges","cacheSequenceEdges","cacheSpatialEdges","resetSequenceEdges","resetSpatialEdges","ImageCache","provider","_disposed","_provider","_image","_sequenceEdges","_spatialEdges","_imageChanged$","_image$","_iamgeSubscription","_sequenceEdgesChanged$","_sequenceEdges$","_sequenceEdgesSubscription","_spatialEdgesChanged$","_spatialEdges$","_spatialEdgesSubscription","_cachingAssets$","spatial","observableCombineLatest","_cacheImage$","_cacheMesh$","imageCache","observableOf","_disposeImage","_imageAborter","_meshAborter","abort","thumb","getImageBuffer","onload","URL","revokeObjectURL","onerror","Blob","createObjectURL","thumbId","_createEmptyMesh","meshId","getMesh","Sequence","_imageIds","image_ids","imageIds","EdgeCalculatorCoefficients","sphericalPreferredDistance","sphericalMotion","sphericalSequencePenalty","sphericalMergeCCPenalty","stepPreferredDistance","stepMotion","stepRotation","stepSequencePenalty","stepMergeCCPenalty","similarDistance","similarRotation","turnDistance","turnMotion","turnSequencePenalty","turnMergeCCPenalty","NavigationDirection","EdgeCalculatorDirections","StepForward","motionChange","useFallback","StepBackward","StepLeft","StepRight","turns","TurnLeft","directionChange","TurnRight","TurnU","spherical","EdgeCalculatorSettings","sphericalMinDistance","sphericalMaxDistance","sphericalMaxItems","sphericalMaxStepTurnChange","rotationMaxDistance","turnMaxRigDistance","rotationMaxDirectionChange","rotationMaxVerticalDirectionChange","similarMaxDirectionChange","similarMaxDistance","similarMinTimeDifference","stepMaxDistance","stepMaxDirectionChange","stepMaxDrift","turnMaxDistance","turnMaxDirectionChange","turnMinRigDirectionChange","maxDistance","MapillaryError","ArgumentMapillaryError","Spatial","deg","rad","angleAxis","THREE.Vector3","rotationMatrix","translation","rotate","interval","wrapAngle","angle1","angle2","rotation1","rotation2","R1T","R2","tr","norm","_epsilon","projection","directionVector","upVector","upProjection","planeProjection","lng1","lat1","lng2","lat2","dLat","dLng","hav","isSpherical","isFisheye","computeTranslation","reference","C","RC","computeProjectedPoints","basicVertices","basicDirections","pointsPerLine","viewportCoords","basicPoints","THREE.Camera","unprojectSfM","basicPoint","worldPoint","unprojectBasic","cameraPoint","worldToCamera","EdgeCalculator","directions","_settings","_directions","_coefficients","potentialImages","fallbackIds","currentDirection","viewingDirection","currentVerticalDirection","angleToPlane","potentialEdges","potential","enu","motion","angleBetweenVector2","verticalMotion","verticalDirectionChange","relativeRotationAngle","worldMotionAzimuth","sameSequence","sameMergeCC","sameUser","potentialEdge","nextId","findNext","Next","NaN","prevId","findPrev","Prev","nodeSpherical","sequenceGroups","similarEdges","calculateScore","lowestScore","similarEdge","score","Similar","edge","fallback","motionDifference","angleDifference","directionMotionDifference","drift","potentialId","turn","rig","directionDifference","Spherical","sphericalEdges","potentialSpherical","potentialSteps","turnChange","maxRotationDifference","occupiedAngles","stepAngles","occupiedDifference","occupiedAngle","difference","occupiedStepAngles","stepAngle","occupations","allOccupiedAngles","minOccupiedDifference","occupation","GraphMapillaryError","Graph","api","nodeIndex","graphCalculator","edgeCalculator","filterCreator","configuration","_api","_cachedNodes","_cachedNodeTiles","_cachedSequenceNodes","_cachedSpatialEdges","_cachedTiles","_cachingFill$","_cachingFull$","_cachingSequenceNodes$","_cachingSequences$","_cachingSpatialArea$","_cachingTiles$","_changed$","_filterCreator","_filter","createFilter","_filterSubject$","_filter$","observableConcat","_filterSubscription","_defaultAlt","_edgeCalculator","_graphCalculator","_configuration","maxSequences","maxUnusedImages","maxUnusedPreStoredImages","maxUnusedTiles","_nodes","_nodeIndex","_spatialIndex","_nodeIndexTiles","_nodeToTile","_preStored","_requiredNodeTiles","_requiredSpatialArea","_sequences","_tileThreshold","spatialIndex","changed$","filter$","cacheTiles$","bboxToCellIds","_cacheTile$","observableFrom","nodes","search","fullNodes","coreNodes","coreNodeBatches","observableMerge","batch","getSpatialImages$","items","hasNode","node_id","getNode","_makeFull","acc","cellId","cachedCell","accessed","getTime","cellNodes","filled","getImages$","lngLatToCellId","_preStore","_setNode","_cacheSequence$","sequenceKey","computeSequenceEdges","referenceNodeKey","hasSequence","hasSequenceNodes","getSequence","batches","referenceIndex","referenceBatchSize","batchesToCache","sequenceNodes$","spatialArea","cacheNodes","cacheKeys","spatialNodes$","spatialNodeBatch$","spatialNode","batchKey","all","fallbackKeys","prevKey","nextKey","allSpatialNodes","potentialNodes","spatialNodeKey","getPotentialEdges","computeStepEdges","computeTurnEdges","computeSphericalEdges","computePerspectiveToSphericalEdges","computeSimilarEdges","nodeTiles","caching","hs","cacheTile$","graph","initializeCache","_updateCachedTileAccess","_updateCachedNodeAccess","hasNodeSequence","bbox","boundingBoxCorners","spatialItems","spatialNodes","spatialItem","sequenceAccess","cachedKeys","cachedKey","keepKeys","keepIds","keepCellIds","keepSequenceId","idsInUse","_addNewKeys","tileThreshold","calculator","keepCells","Set","nodeCellIds","nodeCellId","potentialCells","uncacheCells","uncacheCell","_uncacheTile","potentialPreStored","nonCachedPreStored","prestoredNodes","uncachePreStored","na1","na2","na","_uncachePreStored","uncacheNodes","n1","nodeAccess","uncache","potentialSequences","uncacheSequences","cellIds","cachedCells","cachingCells","_updateCell$","observableEmpty","dict","getSequence$","getCoreImages$","contract","cores","hCache","preStored","_removeFromPreStore","preStoredNode","preStoredNodeIndexItem","insert","nodeIndexItem","fillNode","rotationFromCompass","makeComplete","keepSequenceKey","nodeIndexCell","nodeToCell","cell","MarkerSet","_hash","_index","_indexChanged$","_updated$","updated$","markers","updated","marker","indexItem","ids","changed","quickselect","quickselectStep","sd","swap","findItem","equalsFn","calcBBox","toBBox","distBBox","destNode","createNode","extend","leaf","compareNodeMinX","compareNodeMinY","bboxArea","bboxMargin","intersectionArea","contains","multiSelect","GeoRBush","maxEntries","_maxEntries","_minEntries","_all","nodesToSearch","childBBox","_build","_splitRoot","tmpNode","_insert","indexes","goingUp","_condense","M","N2","N1","compareMinX","compareMinY","right3","targetNode","minArea","minEnlargement","enlargement","isNode","insertPath","_chooseSubtree","_split","_adjustParentBBoxes","_chooseSplitAxis","splitIndex","_chooseSplitIndex","newNode","minOverlap","bbox1","bbox2","overlap","_allDistMargin","leftBBox","rightBBox","margin","siblings","ComponentService","navigator","componentName","registeredComponents","component","_components","_coverComponent","registeredCoverComponent","activate","_coverActivated","coverComponent","coverActivated","deactivate","_checkName","conf","configure","nativeIsArray","xIsArray","VirtualPatch","NONE","VTEXT","VNODE","WIDGET","PROPS","ORDER","INSERT","REMOVE","THUNK","vpatch","vNode","patch","require$$0","isVnode","isVtext","isWidget_1","isThunk_1","isVNode","isVText","require$$1","isWidget","require$$2","isThunk","require$$3","handleThunk_1","renderedA","renderedB","renderThunk","thunk","previous","renderedThunk","vnode","isObject","isVhook","hook","unhook","isHook","getPrototype","VPatch","require$$4","require$$5","handleThunk","require$$6","diffProps","aKey","aValue","bValue","objectDiff","bKey","walk","applyClear","thunks","clearState","appendPatch","tagName","namespace","propsPatch","aChildren","orderedSet","bChildren","bChildIndex","keyIndex","bKeys","bFree","free","moves","aChildIndex","aKeys","newChildren","freeIndex","freeCount","deletedItems","itemIndex","aItem","lastFreeIndex","newItem","simulateItem","simulate","simulateIndex","removes","inserts","wantedItem","reorder","aLen","bLen","leftNode","rightNode","diffChildren","destroyWidgets","hasWidgets","hasThunks","thunkPatch","hasPatches","hooks","undefinedKeys","descendantHooks","diff_1","domWalk","ret","childNodes","domComment","Comment","nodeValue","ownerDocument","nodeType","domText","DOMText","replaceData","dispatchEvent_1","ev","elem","currentTarget","handleEvent","parentNode","addEventListener_1","removeEventListener_1","voidElements","serializeNode","escapeText","strings","tagname","namespaceURI","props","isProperty","ns","_attributes","prop","className","ds","dataset","datasetify","textContent","innerText","innerHTML","serializeElement","tuple","styles","attr","stylify","htmlns","DOMElement","appendChild","removeChild","replaceChild","needle","insertBefore","setAttributeNS","localName","colonPosition","getAttributeNS","removeAttributeNS","hasAttributeNS","getElementsByClassName","classNames","classes","elems","nodeClasses","getElementsByTagName","domFragment","DocumentFragment","Event","family","initEvent","bubbles","cancelable","require$$7","require$$8","Document","head","createElement","documentElement","proto","createTextNode","createDocumentFragment","createEvent","createComment","getElementById","doccy","minDocument","topLevel","minDoc","applyProperties_1","propName","propValue","removeProperty","patchObject","previousValue","attrName","replacer","attrValue","applyProperties","createElement_1","opts","doc","noChild","recurse","tree","rootIndex","indexInRange","vChildren","vChild","currentIndex","currentItem","minIndex","maxIndex","ascending","updateWidget","destroyWidget","domNode","domIndex","patchOp","renderOptions","leftVNode","vText","stringPatch","widget","updating","widgetPatch","vNodePatch","keyMap","reorderChildren","oldRoot","newRoot","replaceRoot","patchRecursive","patches","patchIndices","applyPatch","patchList","patch_1","isVHook","VirtualNode","noProperties","noChildren","descendants","vtext","VirtualText","undef","nativeSplit","compliantExecNpcg","separator","limit","separator2","lastLength","flags","ignoreCase","multiline","extended","sticky","lastLastIndex","classIdSplit","notClassId","parseTag_1","tag","part","noId","tagParts","softSetHook","SoftSetHook","Individual","moduleName","versionValue","OneVersionConstraint","hashKey","EvStore","evHook","EvHook","VNode","VText","isVThunk","parseTag","require$$9","require$$10","addChild","isChild","errorString","foreignObject","parentVnode","UnexpectedVirtualElement","CoverState","ComponentSize","virtualDom","transformProperties","EventEmitter","_events","_listens","eventType","SubscriptionHolder","_subscriptions","Component","_activated","_container","_name","_navigator","_configuration$","_configurationSubject$","defaultConfiguration","newConf","activated","activated$","_activated$","_getDefaultConfiguration","configuration$","_activate","_deactivate","domRenderer","glRenderer","fire","CoverComponent","originalSrc$","_getImageSrc$","subs","stateService","currentImage$","keySrc$","imageElement","Visible","k1","k2","configurationService","exploreUrl$","renderService","size$","exploreUrl","vd.h","compactClass","Hidden","doneContainer","_getCoverBackgroundVNode","_getCoverButtonVNode","render$","cover","Loading","coverButton","coverLogo","href","coverIndicator","onclick","backgroundImage","imageId","AttributionComponent","attribution","_makeAttribution","viewportWidth","compact","date","_makeDate","_makeBy","icon","_makeCreatorBy","_makeGeneralBy","mapillary","rel","content","imageBy","makeImageUrl","imagesBy","toDateString","formatted","ViewportCoords","basicX","basicY","point3d","_unprojectDepth","projectToCanvas","basicToViewportSafe","viewportToCanvas","projectToViewport","pointCamera","clientRect","getBoundingClientRect","clientX","clientLeft","clientY","clientTop","canvasX","canvasY","unprojectFromCanvas","projectBasic","canvasWidth","canvasHeight","containerToCanvas","offsetWidth","offsetHeight","topLeftBasic","viewportToBasic","topRightBasic","bottomRightBasic","bottomLeftBasic","topBasicDistance","rightBasicDistance","bottomBasicDistance","leftBasicDistance","topPixelDistance","rightPixelDistance","bottomPixelDistance","leftPixelDistance","basicToCanvas","clientWidth","clientHeight","canvasToViewport","unprojectFromViewport","viewportX","viewportY","BearingComponent","_viewportCoords","_svgNamespace","_distinctThreshold","_animationSpeed","cameraBearingFov$","renderCamera$","rc","vFov","perspective","hFov","POSITIVE_INFINITY","azimuthalToBearing","imageFov$","currentState$","currentImage","panService","panImages$","panImages","currentTransform","currentProjectedPoints","_computeProjectedPoints","_computeHorizontalFov","hFovLeft","hFovRight","hFovLeft1","hFovRight1","hFovLeft2","hFovRight2","offset$","bearing$","bearing","imageFovOperation$","smoothImageFov$","operation","curr","_interpolate","nbf","renderCameraFrame$","nbfState","imageBearingFov$","no","nfl","nfr","_createBackground","fovIndicator","_createFovIndicator","north","_createNorth","cameraSector","_createCircleSectorCompass","_createCircleSector","Small","Automatic","oncontextmenu","fovLeft","fovRigth","arc","_createFovArc","viewBox","fill-opacity","stroke","stroke-width","arcStart","arcEnd","startX","startY","endX","endY","description","Geo.computeProjectedPoints","projectedPoints","fovs","projectedPoint","_coordToFov","CacheComponent","nc","sequenceDepth","_cache$","edgeStatus","sphericalDepth","stepDepth","turnDepth","spherical$","observableZip","ed","es","edgesDepths$","graphService","_imageToEdges$","CancelMapillaryError","DirectionDOMCalculator","_minThresholdWidth","_maxThresholdWidth","_minThresholdHeight","_maxThresholdHeight","_configure","_resize","_reset","minWidth","_minWidth","maxWidth","_maxWidth","containerWidth","_containerWidth","containerWidthCss","_containerWidthCss","containerMarginCss","_containerMarginCss","containerLeftCss","_containerLeftCss","containerHeight","_containerHeight","containerHeightCss","_containerHeightCss","containerBottomCss","_containerBottomCss","stepCircleSize","_stepCircleSize","stepCircleSizeCss","_stepCircleSizeCss","stepCircleMarginCss","_stepCircleMarginCss","turnCircleSize","_turnCircleSize","turnCircleSizeCss","_turnCircleSizeCss","outerRadius","_outerRadius","innerRadius","_innerRadius","shadowOffset","_shadowOffset","second","relativeAngle","angleToCoordinates","_getMaxWidth","_elementWidth","_elementHeight","_getContainerWidth","_getContainerHeight","_getStepCircleDiameter","_getTurnCircleDiameter","_getOuterRadius","_getInnerRadius","_numberToCssPixels","elementWidth","elementHeight","relativeWidth","relativeHeight","DirectionDOMRenderer","_calculator","_rotation","_highlightKey","_distinguishSequence","_needsRender","_stepEdges","_turnEdges","_sphericalEdges","_sequenceEdgeKeys","_stepDirections","_turnDirections","_turnNames","isIE","documentMode","_isEdge","StyleMedia","needsRender","_createSphericalArrows","_createPerspectiveToSphericalArrows","_createStepArrows","_createTurnArrows","_getContainer","_setEdges","_setNeedsRender","_clearEdges","renderCamera","highlightId","distinguishSequence","resize","edgeKey","arrows","sphericalEdge","_createVNodeByKey","stepEdge","_createSphericalToPerspectiveArrow","azimuth","relativePhi","_createVNodeInactive","_createVNodeByDirection","turnEdge","_createVNodeByTurn","shiftVertically","_createVNode","moveTo$","moveDir$","circleProperties","data-id","circleClassName","onClick","translationX","translationY","shadowTranslation","relativeAngleToCoordiantes","-webkit-filter","chevron","azimuthDeg","circleTransform","marginLeft","marginTop","DirectionComponent","directionDOMRenderer","_hoveredIdSubject$","_hoveredId$","setConfiguration","setImage","cacheSequence$","setEdges","setRenderCamera","element$","mouseService","mouseMove$","mouseUp$","hovered","querySelector","Shaders","fragment","MeshFactory","imagePlaneDepth","imageSphereRadius","_imagePlaneDepth","_imageSphereRadius","_createImageSphere","_createImagePlaneFisheye","_createImagePlane","basicX0","basicX1","basicY0","basicY1","_createTexture","materialParameters","_createDistortedPlaneMaterialParameters","THREE.ShaderMaterial","_getFlatImagePlaneGeoFromBasic","THREE.Mesh","_createSphereCurtainMesh","_createCurtainMeshFisheye","_createCurtainMesh","_createDistortedCurtainMesh","_createCurtainPlaneMaterialParameters","_useMesh","_getImagePlaneGeo","_getRegularFlatImagePlaneGeo","_createCurtainPlaneMaterialParametersFisheye","_getImagePlaneGeoFisheye","_createDistortedCurtainPlaneMaterialParameters","_createCurtainSphereMaterialParameters","_getImageSphereGeo","_getFlatImageSphereGeo","_createSphereMaterialParameters","_createPlaneMaterialParameters","_createPlaneMaterialParametersFisheye","_getRegularFlatImagePlaneGeoFisheye","projectorMat","rt","projectorTex","sphericalCurtain","curtain","focal","ck1","ck2","basicRt","radial_peak","radialPeak","scale_x","basicHeight","basicWidth","scale_y","fisheye","fisheyeCurtain","perspectiveCurtain","perspectiveDistortedCurtain","projectorMatrix","perspectiveDistorted","THREE.Texture","THREE.LinearFilter","hasValidScale","srtInverse","numVertices","THREE.BufferGeometry","THREE.BufferAttribute","boundedZ","THREE.SphereGeometry","_getFlatImagePlaneGeo","_createFlatGeometry","_getFlatImagePlaneGeoFisheye","MeshScene","_planes","_planesOld","_planesPeriphery","_scene","THREE.Scene","_sceneOld","_scenePeriphery","planesOld","planesPeriphery","sceneOld","scenePeriphery","_dispose","_clear","addImagePlanes","_clearPeriphery","addPeripheryPlanes","_clearOld","addImagePlanesOld","ImageGLRenderer","_factory","_alphaOld","_fadeOutSpeed","_currentKey","_previousKey","_providerDisposers","_frameId","frameId","createMesh","setPeripheryPlanes","_updateFrameId","_updateAlpha","_updateAlphaOld","_updateImagePlanes","createdSubscription","textureCreated$","_updateTexture","updatedSubscription","textureUpdated$","disposeProvider","_extend","perspectiveCamera","planeAlpha","peripheryAlpha","previousImage","previousMesh","previousTransform","previousPlanes","updateImagePlanes","currentMesh","oldTexture","RenderPass","TileLoader","_urls$","aborter","uniqueId","_inventId","request","urls$","getImageTiles$","TileStore","_tiles","_urlLevels","_urls","ents","ent","inventId","tile","RegionOfInterestCalculator","viewportBoundaryPoints","_viewportBoundaryPoints","_viewportPointsBoundingBox","_clipBoundingBox","viewportPixelWidth","viewportPixelHeight","centralViewportPixel","cpbox","inverted","pixelHeight","pixelWidth","pointsPerSide","os","viewportPoints","_boundingBoxSpherical","_boundingBox","NEGATIVE_INFINITY","xs","ys","_sign","intervalX","_intervalSpherical","maxdx","maxi","levelTilePixelSize","baseImageLevel","rawImageLevel","basicToTileCoords2D","tilePixelSize","tileToPixelCoords2D","scaledTS","hasOverlap1D","base","hasOverlap2D","tile1","tile2","overlapX","overlapY","verifySize","TextureProvider","store","_imageId","_size","_level","_holder","_createdSubject$","_created$","_hasSubject$","_has$","_renderedLevel","_rendered","_urlSubscriptions","_loader","_store","_background","_aborts","_render","disposed","hasTexture$","roi","virtualWidth","clampedImageLevel","_initRender","tiles","topLeft","bottomRight","cornersToTilesCoords2D","_fetchTiles","getTile","getImage$","tile$","tileId","_renderToTarget","_removeFromArray","_markRendered","hasURLLevel","getURLs$","addURLs","getURL","_fetchTile","THREE.OrthographicCamera","MAX_TEXTURE_SIZE","backgroundSize","targetWidth","targetHeight","THREE.WebGLRenderTarget","THREE.RGBFormat","others","entries","otherId","other","pixel","THREE.PlaneGeometry","THREE.MeshBasicMaterial","State","GraphMode","SequenceMode","SliderConfigurationMode","ImageComponent","_imageTileLoader","_roiCalculator","_rendererOperation$","_rendererCreator$","_rendererDisposer$","_renderer$","renderHash","Background","clearNeedsRender","updateFrame","textureProvider$","imageTiling$","webGLRenderer$","currentNode","setTextureProvider","pair","roiTrigger$","state$","inTranslation$","inTranslation","Traversing","Waiting","WaitingInteractively","valueOf","lookat","pl0","pl1","stalled","currentTransform$","computeRegionOfInterest","setRegionOfInterest","panNodes","clearPeripheryPlanes","cachedPanNodes$","nts","addPeripheryPlane","updateTextureImage","inTransition$","panTrigger$","active$","touchService","inMotion$","mouseActive","touchActive","inMotion","inTransition","trigger","cn","ct","closest","HandlerBase","_component","_enabled","isEnabled","_enable","_getConfiguration","_disable","KeySequenceNavigationHandler","_keyDownSubscription","keyboardService","keyDown$","keyCode","altKey","shiftKey","keySequenceNavigation","KeySpatialNavigationHandler","shifts","_rotationFromCamera","navigationAngle","smallestAngle","toKey","_moveTo","_moveDir","keySpatialNavigation","KeyZoomHandler","ctrlKey","metaKey","unprojected","zoomIn","keyZoom","KeyPlayHandler","playService","playing$","direction$","speed$","Earth","playing","speed","earth","newDirection","setDirection","setSpeed","keyPlay","KeyboardComponent","_keyPlayHandler","_keySequenceNavigationHandler","_keySpatialNavigationHandler","_keyZoomHandler","MarkerScene","_interactiveObjects","_markers","_objectMarkers","_raycaster","THREE.Raycaster","createGeometry","interactiveObject","getInteractiveObjects","setFromCamera","THREE.Vector2","intersectObjects","lerpAltitude","updatePosition","disposeGeometry","MarkerComponent","_markerScene","_markerSet","_relativeGroundAltitude","markerId","getAll","pixelPoint","markerIds","removeAll","groundAltitude$","geoInitiated$","reference$","clampedConfiguration$","visibleBBoxSize","currentLngLat$","visibleBBox$","visibleMarkers$","markerScene","sceneMarkers","markersToRemove","exists","distanceX","distanceY","groundDistance","Opaque","hoveredMarkerId$","canvasPosition","draggingStarted$","filtered$","mouseDragStart$","draggingStopped$","mouseDragEnd$","filteredDragging$","dragging","mouseDown$","documentMouseUp$","mouseDown","filteredDragging","claim","claimMouse","claimWheel","unclaimMouse","unclaimWheel","groundCanvasX","groundCanvasY","mouseDrag$","groundX","groundY","markerEvent","colinearPointOnSegment","parallel","ux","uy","vx","vy","tripletOrientation","segmentsIntersect","segmentIntersection","x4","y3","y4","den","insideViewport","insideBasic","viewportDistances","boundaryPointsViewport","basicBoundaryPoints","visibleBoundaryPoints","viewportSides","intersections","Lines.segmentsIntersect","Lines.segmentIntersection","topLeftBasicX","topLeftBasicY","topRightBasicX","topRightBasicY","bottomRightBasicX","bottomRightBasicY","bottomLeftBasicX","bottomLeftBasicY","maximums","visibleBoundaryPoint","boundary","distances","BounceHandler","_bounceSubscription","noForce","ImageBoundary.viewportDistances","horizontalDistance","verticalDistance","directionPhi","directionTheta","rotateUnbounded","MouseOperator","_filteredPairwiseMouseDrag$","mouseRightDragStart$","mouseRightDrag$","mouseRightDragEnd$","mouseDragStart","DragPanHandler","_activeMouseSubscription","activate$","documentMouseMove$","_preventDefaultSubscription","touchMove$","touchMovingStarted$","singleTouchDragStart$","touchMovingStopped$","singleTouchDragEnd$","_activeTouchSubscription","rotation$","imagesAhead","filteredPairwiseMouseDrag$","singleTouchDrag$","touches","events","previousEvent","movementX","movementY","directionX","directionY","_rotateWithoutInertiaSubscription","rotateWithoutInertia","_rotateSubscription","rotationBuffer","_drainBuffer","drainedBuffer","bufferedRotation","dragPan","EarthControlHandler","earth$","mouseWheel$","e1","e2","planePoint","currentIntersection","_planeIntersection","previousIntersection","truck","_mousePairToRotation","orbit","filteredPairwiseMouseRightDrag$","filteredWheel$","deltaY","deltaMode","dolly","previousCanvas","currentX","currentY","_eventToViewport","previousX","previousY","l0","ScrollZoomHandler","_zoomSubscription","scrollZoom","TouchZoomHandler","pinch$","pinch","originalEvent","pinchStarted$","pinchStart$","pinchStopped$","pinchEnd$","_activeSubscription","distanceChange","touchZoom","PointerComponent","_bounceHandler","_dragPanHandler","_earthControlHandler","_scrollZoomHandler","_touchZoomHandler","earthControl","DOM","_document","PopupComponent","dom","_dom","_popups","_added$","_popups$","popups","popup","setParentContainer","_popupContainer","_remove","SequenceDOMRenderer","_stepperDefaultWidth","_controlsDefaultWidth","_defaultHeight","_expandControls","_mode","Default","_speed","_changingSpeed","_changingPosition","_mouseEnterDirection$","_mouseLeaveDirection$","_notifyChanged$","_notifyChangingPositionChanged$","_notifySpeedChanged$","_notifyIndexChanged$","changingPositionChanged$","index$","mouseEnterDirection$","mouseLeaveDirection$","_changingSubscription","touchEnd$","touchEvent","_setChangingPosition","playEnabled","stepper","_createStepper","controls","_createSequenceControls","playback","_createPlaybackControls","timeline","_createTimelineControls","onPosition","boundingRect","domContainer","stopPropagation","onMove","positionInputProperties","onchange","oninput","onkeydown","onpointerdown","onpointermove","ontouchmove","ontouchstart","disabled","positionInput","positionContainerClass","onSpeed","speedInput","Playback","switchIcon","switchButtonProperties","switchButtonClassName","switchButton","slowIcon","slowContainer","fastIcon","fastContainer","closeIcon","closeButtonProperties","closeButton","playbackChildren","_createSpeedInput","playbackProperties","canPlay","buttonProperties","iconProperties","buttonClass","borderRadius","expanderProperties","border-bottom-right-radius","border-top-right-radius","expanderBar","expander","fastIconClassName","timelineIconClassName","Timeline","timelineIcon","timelineProperties","nextProperties","onpointerenter","onpointerleave","prevProperties","border-bottom-left-radius","border-top-left-radius","nextClass","_getStepClassName","prevClass","nextIcon","prevIcon","playingButton","_createPlayingButton","buttons","_createSequenceArrows","containerProperties","_createPositionInput","SequenceComponent","_sequenceDOMRenderer","_containerWidth$","edgeStatus$","sequence$","rendererId$","changing","setGraphMode","graphMode$","cacheSequenceImages$","position$","firstCurrentId","changingPosition","skipCount","value1","value2","getContainerWidth","Transform","textureScale","_orientation","_getValue","imageWidth","imageHeight","keepOrientation","_basicAspect","_basicWidth","_basicHeight","_getCameraParameters","_focal","_scale","_worldToCamera","createWorldToCamera","_worldToCameraInverse","_scaledWorldToCamera","_createScaledWorldToCamera","_scaledWorldToCameraInverse","_basicWorldToCamera","_createBasicWorldToCamera","_textureScale","_ck1","_ck2","_cameraType","_radialPeak","_getRadialPeak","basicAspect","srt","rte","projector","_normalizedToTextureMatrix","sfm","projectSfM","_sfmToBasic","_basicToSfm","_bearingToSfm","_sfmToBearing","unprojectedWorld","dxn","dyn","_distortionFromDistortedRadius","denomTheta","dr","distortedRadius","distortion","xn","yn","r2","rp2","rotatedX","rotatedY","padding","setPosition","scaledWorldToCamera","root1","root2","minRoot","maxRoot","SliderGLRenderer","_disabled","_curtain","_currentProviderDisposers","_previousProviderDisposers","_setTextureProvider","_updateTexturePrev","_updateCurtain","currentAspect","previousAspect","originalKey","providerDisposers","updateTexture","shaderMaterial","currentChanged","previousChanged","modeChanged","_setDisabled","motionless","Stationary","setImagePlanesOld","previousNode","opticalCenter","_getBasicCorners","createFlatMesh","createCurtainMesh","createDistortedCurtainMesh","setImagePlanes","SliderDOMRenderer","_interacting","_notifyModeChanged$","_notifyPositionChanged$","_stopInteractionSubscription","mode$","modeVisible","_createModeButton","_createModeButton2d","Motion","onChange","SliderComponent","_domRenderer","_glRendererOperation$","_glRendererCreator$","_glRendererDisposer$","_glRenderer$","initialPosition","motionless$","sliderVisible$","sliderVisible","enabledState","_waitSubscription","interactive","waitInteractively","wait","basicMin","basicMax","shiftedMax","basicPosition","updateCurtain","_catchCacheImage$","foreground","nf","co","trajectory","setImages","prependImages","pls","samePosition","sameLookat","sameZoom","sameHeight","sameWidth","textureProviderPrev$","setTextureProviderPrev","roiTriggerPrev$","shiftedRoi","currentViewingDirection","previousViewingDirection","shiftX","shiftY","spanningWidth","spanningHeight","zoomShiftX","zoomShiftY","currentBasicAspect","previousBasicAspect","cornerMinX","cornerMinY","cornerMaxX","cornerMaxY","hasTexturePrev$","PlayService","_graphService","_stateService","_directionSubject$","_direction$","_playing","_playingSubject$","_playing$","_speedSubject$","_speed$","_imagesAhead","_mapImagesAhead","_mapSpeed","_bridging$","cutImages","stateSpeed","_setSpeed","_graphModeSubscription","sequenceSpeed","_cacheSubscription","lastRequestKey","previousRequestKeys","lastTrajectoryKey","newRequestKeys","_playingSubscription","lastImage","increasingTime","appendImagess","_clearSubscription","clearPriorImages","_setPlaying","currentLastImages$","kc1","kl1","kc2","kl2","_stopSubscription","hasEdge","_earthSubscription","CameraVisualizationMode","OriginalPositionMode","ClusterPoints","_originalSize","originalSize","_makeAttributes","setColor","pointId","CellLine","closedPolygon","isLeafLevel","leafLevel","levelToRootBoundingBox","half","levelToSize","SpatialOctreeNode","self","_generateBoundingBoxes","mins","boundingBoxes","SpatialOctree","rootLevel","_makeRoot","leaves","SpatialIntersection","octree","_objectImageMap","_octree","_interactiveLayer","_lineThreshold","_largeLineThreshold","interactiveLayer","onMap","deleted","useLarge","PositionLine","originalOrigin","_relativeAltitude","_modeToAltitude","Altitude","CameraFrameBase","_makePositions","_updateColorAttribute","colorAttribute","SphericalCameraFrame","_makeAxis","_makeLat","_makeLng","south","dist","originX","originY","originZ","PerspectiveCameraFrame","_makeDiags","_makeFrame","cameraCenter","vertex2d","corner","vertices2d","_subsample","subsamples","resetEnu","prevEnu","prevReference","prevX","prevY","SpatialCell","_intersection","_positionLines","_positions","_cameraFrames","_clusters","_connectedComponents","_props","clusterVisibles","_frameMaterial","_positionMaterial","hasImage","ccId","idMap","cId","sId","cameraFrames","positionLines","_setCameraVisibility","_disposeCameras","_disposePositions","Cluster","ConnectedComponent","cvm","defaultId","Homogeneous","frames","lineId","positionParameters","positionMode","originalPosition","SpatialAssets","_colors","_randomColor","isModeVisible","PointVisualizationMode","SpatialScene","_rayNearScale","_originalPointSize","_originalCameraSize","_imageCellMap","_assets","_images","_cells","_cellClusters","_cameraVisualizationMode","cameraVisualizationMode","_cameraSize","cameraSize","_pointSize","pointSize","_pointVisualizationMode","pointVisualizationMode","Original","_positionMode","originalPositionMode","_cellsVisible","cellsVisible","_hoveredId","_selectedId","hover","select","reconstruction","hasCluster","_getClusterVisible","getColor","created","applyPositionMode","addImage","colorId","getColorId","visualize","_highlight","clusterVisible","hasCell","clusters","cells","resetReference","imageCells","applyCameraSize","_getNear","imageCell","applyFilter","imageCV","pointsVisible","_resetCameraColor","isOverview","resetIntersectionThreshold","assets","getCamerasByMode","_disposeReconstruction","nceMap","_disposeCell","_disposePoints","applyCameraColor","SpatialCache","_data","_cacheRequests","_clusterCells","_cachingCells$","_cachingClusters$","hasClusters","isCachingClusters","duplicatedClusters","getCell","cd","_cacheClusters$","isCachingCell","cacheCell$","cancellation","_hasCluster","_getCluster","_getCluster$","getCluster","connectedComponent","connectedComponentRecursive","currentDepth","maxDepth","adjacent","aCells","getAdjacent","newCells","SpatialComponent","cacheService","cellDepth","imageFilter","setFilter","cellId$","cellGridDepth$","cellGridDepth","sequencePlay$","isOverview$","Custom","isOverviewState","setNavigationState","cell$","isd","sequencePlay","_cellsInFov","addCell","_cellToTopocentric","_addSceneImages","reconstructions$","getClusters","cacheClusters$","addCluster","_computeTranslation","setCameraSize","setCameraVisualizationMode","setCellVisibility","setPointSize","pvm","setPointVisualizationMode","opm","setPositionMode","dblClick$","intersectChange$","mouseHover$","mouseEnter$","mouseLeave$","windowBlur$","mouseHover","setHoveredImage","currentId$","setSelectedImage","updatedCell$","dataAdded$","updateCell$","updateClusters$","_createTransform","_computeOriginalPosition","getVertices","azimuthal","vertexBearing","Geo.computeTranslation","Geometry","GeometryTagError","PointsGeometry","clamped","setPoint2d","_getPoints3d","getRect2d","centroid2d","getCentroid2d","maxDistanceX","leftMostIndex","points2d","CreateTag","_transform","_aborted$","_glObjectsChanged$","_geometryChangedSubscription","_onGeometryChanged","glObjects","_glObjects","aborted$","created$","glObjectsChanged$","geometryChanged$","polygon3d","_getLinePositions","THREE.LineBasicMaterial","THREE.Line","earcut","bridge","bridgeReverse","filteredBridge","deviation","polygonArea","trianglesArea","dimensions","Queue","_down","_up","pos","halfLength","best","polylabel","polygon","cellSize","degeneratePoleOfInaccessibility","cellQueue","compareMax","Cell","bestCell","getCentroidCell","bboxCell","numProbes","poleOfInaccessibility","minDistSq","ring","getSegDistSq","pointToPolygonDist","SQRT2","default","DEFAULT_COMPARE","SplayTree","noDuplicates","_noDuplicates","rotateRight","rotateLeft","gp","ggp","comp","splay","cmp","minNode","sMax","maxNode","returnValue","successor","predecessor","ctx","Q","presort","loadRecursive","middle","pivot","computeFields","inOut","otherInOut","isSubject","isVertical","prevInResult","inResult","isInResult","resultTransition","isIn","thisIn","thatIn","determineResultTransition","SweepEvent","otherEvent","edgeType","otherPos","outputContourId","isExteriorRing","isBelow","contourId","splitter","elen","Qnew","hh","bvirt","enow","fnow","eindex","findex","hindex","B","C1","C2","D","orient2d","detleft","detright","detsum","acxtail","acytail","bcxtail","bcytail","ahi","alo","bhi","blo","_j","_0","acx","bcx","acy","bcy","estimate","errbound","C1len","C2len","Dlen","orient2dadapt","compareEvents","specialCases","divideSegment","se","crossProduct","dotProduct","possibleIntersection","se1","se2","inter","noEndpointTouch","toPoint","kross","sqrKross","sqrLenA","sa","sb","smin","smax","nintersections","leftCoincide","rightCoincide","compareSegments","le1","le2","isAbove","Contour","holeIds","holeOf","nextPos","resultEvents","processed","origPos","newPos","initializeContourFromContext","contours","lowerContourId","lowerContour","parentContourId","connectEdges","sortedEvents","sorted","orderEvents","markAsProcessed","initial","TinyQueue","peek","processPolygon","contourOrHole","trivial","trivialOperation","sbbox","cbbox","eventQueue","polygonSet","jj","fillQueue","compareBBoxes","sweepLine","Tree","rightbound","begin","prevEvent","prevprevEvent","prevprev","subdivideSegments","polygons","isExterior","rings","holeId","VertexGeometry","_subsampleThreshold","_createCamera","_deunproject","subsampled","subsample","points3d","holes2d","holes3d","hole2d","hole3d","flattened","bbox2d","lookat2d","_triangulateSubarea","point2d","pointWorld","subsampledPolygon2d","polygon2d","_unproject","polygonHoles2d","polygonHoles3d","subsampledHole2d","_triangulate","RectGeometry","rect","coord","_anchorIndex","_rect","_inverted","anchorIndex","opposite","original","anchor","deltaX","passingBoundaryLeftward","passingBoundaryRightward","centerX","centerY","minTranslationX","maxTranslationX","minTranslationY","maxTranslationY","_getPoints2d","_rectToVertices2d","_rectToNonAdjustedVertices2d","_getPoleOfInaccessibility2d","pole2d","_project","getPoints3d","sides","intervalY","ExtremePointCreateTag","_options","indicateCompleter","_rectGeometry","_createGlObjects","removePoint2d","_disposeObjects","vNodes","getPoints2d","nonModifiedIndex","pointX","pointY","pointCanvas","basicToCanvasSafe","_canvasToTransform","completerProperties","pointProperties","_colorToBackground","centroidX","centroidY","centroidCanvas","dotProperties","_outline","_createOutine","_disposeLine","PolygonGeometry","polygonLength","_polygon","_holes","holeLength","closing","centroid","xi","yi","xi1","yi1","getVertices3d","getHoleVertices3d","_triangulateSpherical","getHolePoints3d","OutlineCreateTag","polygonGeometry","removeVertex2d","vertexIndex","getVertex2d","canvasPoint","firstVertexBasicX","firstVertexBasicY","firstVertexCanvas","firstClass","lastVertexBasicX","lastVertexBasicY","lastVertexCanvas","verticesBasic","vertexBasic","vertexCanvas","addVertex2d","TagCreator","_tagOperation$","_createPoints$","_createPolygon$","_createRect$","_delete$","_tag$","_replayedTag$","createColor","indicatePointsCompleter","createRect$","createPolygon$","createPoints$","delete$","tag$","replayedTag$","TagDOMRenderer","tags","createTag","atlas","getDOMObjects","TagScene","_createTag","_objectTags","_retrievableObjects","_tags","_add","intersectedIds","tagObjects","_removeObjects","retrievableObjects","getGLObjects","retrievableObject","getRetrievableObjects","TagMode","TagOperation","TagDomain","Alignment","RenderTag","_tag","_interact$","interact$","OutlineRenderTagBase","_changedSubscription","_onTagChanged","_getTriangles","_updateFillMaterial","_updateLineBasicMaterial","_createLine","_fill","cursor","_updateLine","ExtremePointRenderTag","_createFill","_createOutline","_disposeFill","_disposeOutline","editable","lineColor","_colorToCss","vertexBasicX","vertexBasicY","interact","_interact","Vertex","indicateVertices","_updateFillGeometry","_updateOulineGeometry","glObjectsChanged","_updateOutlineMaterial","getTriangles3d","THREE.Color","fillColor","fillOpacity","lineOpacity","Tag","ExtremePointTag","_editable","_fillColor","_fillOpacity","_indicateVertices","_lineColor","_lineOpacity","_lineWidth","OutlineRenderTag","domain","TwoDimensional","_createHoles","_disposeHoles","isRect","isPerspective","iconBasicX","iconBasicY","iconIndex","getPoleOfInaccessibility2d","iconCanvas","getDOMSprite","iconFloat","click$","textBasicX","textBasicY","textCanvas","textCanvasX","textCanvasY","textColor","centroidBasicX","centroidBasicY","Centroid","getVertices2d","_updateHoleGeometries","_updateHoleMaterials","_in3dDomain","get3dDomainTriangles3d","_getHoles3d","holePoints3d","ThreeDimensional","OutlineTag","twoDimensionalPolygon","_twoDimensionalPolygon","_domain","_icon","_iconFloat","Center","_iconIndex","_text","_textColor","_click$","SpotRenderTag","interactNone","Bottom","pointerEvents","textTransform","interactorProperties","SpotTag","_color","TagSet","_hashDeactivated","_assertActivationState","hashDeactivated","hasDeactivated","should","PointGeometry","_point","TagHandlerBase","_getNameExtension","canvasToBasic","CreateHandlerBase","tagCreator","_tagCreator","_geometryCreated$","geometryCreated$","_enableCreate","classList","_disableCreate","mouseEvent$","_mouseEventToBasic","CreatePointHandler","deferPixels","_geometryCreatedSubscription","_mouseEventToBasic$","proximateClick$","_validateBasic","undeferPixels","CreateVertexHandler","transformChanged$","_deleteSubscription","basicClick$","_createSubscription","_create$","_setVertexSubscription","domMouseMove$","_setVertex2d","_addPointSubscription","_addPoint","_geometryCreateSubscription","CreatePointsHandler","addPoint2d","CreatePolygonHandler","addPoint","setVertex2d","CreateRectHandler","rectGeometry","getNonAdjustedVertex2d","_initializeAnchorIndexingSubscription","initializeAnchorIndexing","setOppositeVertex2d","CreateRectDragHandler","basicMouse$","basicMouseDragEnd$","EditVertexHandler","tagSet","_tagSet","interaction$","interaction","_claimMouseSubscription","domMouseDragStart$","_cursorSubscription","interactionCursors","interactionCursor","_unclaimMouseSubscription","domMouseDragEnd$","_updateGeometrySubscription","domMouseDrag$","insideElement","mouseEvent","setCentroid2d","TagComponent","_tagDomRenderer","_tagScene","_createHandlers","CreatePoint","CreatePoints","CreatePolygon","CreateRect","CreateRectDrag","_editVertexHandler","_renderTags$","id1","id2","_tagChanged$","_renderTagGLChanged$","_createGeometryChanged$","_createGLObjectsChanged$","_creatingConfiguration$","renderTags","addDeactivated","tagId","renderTag","getDeactivated","getAllDeactivated","tagIds","removeDeactivated","removeAllDeactivated","handlerGeometryCreated$","changeMode","_disableCreateHandlers","hasCreateTag","removeCreateTag","addCreateTag","updateCreateTagObjects","updateObjects","spriteService","spriteAtlas$","tagScene","createHandlers","ZoomComponent","_zoomDelta$","zoomInIcon","zoomInButton","zoomOutIcon","zoomOutButton","zoomDelta","ImageFallbackComponent","_canvasId","canvasSize$","adaptableDomRenderer","parentElement","renderAdaptive$","NavigationFallbackComponent","_seqNames","_spaTopNames","_spaBottomNames","spa","edgeDirections","seqs","_createArrowRow","spaTops","spaBottoms","seqContainer","spaTopContainer","spaBottomContainer","spaContainer","arrowNames","arrowName","visibility","zero$1","buf","LITERALS$1","L_CODES$1","D_CODES$1","MAX_BITS$1","extra_lbits","extra_dbits","extra_blbits","bl_order","static_ltree","static_dtree","_dist_code","_length_code","MAX_MATCH$1","base_length","base_dist","StaticTreeDesc","static_tree","extra_bits","extra_base","max_length","has_stree","static_l_desc","static_d_desc","static_bl_desc","TreeDesc","dyn_tree","stat_desc","max_code","d_code","put_short","pending_buf","send_bits","bi_valid","bi_buf","send_code","bi_reverse","code","gen_codes","bl_count","next_code","init_block","dyn_ltree","dyn_dtree","bl_tree","END_BLOCK","opt_len","static_len","last_lit","bi_windup","smaller","_n2","_m2","pqdownheap","heap","heap_len","compress_block","ltree","dtree","lc","extra","lx","d_buf","l_buf","build_tree","desc","stree","heap_max","xbits","overflow","gen_bitlen","scan_tree","curlen","prevlen","nextlen","max_count","min_count","REP_3_6","REPZ_3_10","REPZ_11_138","send_tree","static_init_done","_tr_stored_block$1","stored_len","header","copy_block","trees","_tr_init","LENGTH_CODES$1","tr_static_init","l_desc","d_desc","bl_desc","_tr_stored_block","_tr_flush_block","opt_lenb","static_lenb","max_blindex","strm","data_type","black_mask","detect_data_type","BL_CODES$1","build_bl_tree","strategy","lcodes","dcodes","blcodes","rank","send_all_trees","_tr_tally","lit_bufsize","_tr_align","STATIC_TREES","bi_flush","adler32_1","adler","crcTable","table","makeTable","crc32_1","crc","messages","-1","-2","-3","-4","-5","-6","constants$2","Z_NO_FLUSH","Z_PARTIAL_FLUSH","Z_SYNC_FLUSH","Z_FULL_FLUSH","Z_FINISH","Z_BLOCK","Z_TREES","Z_OK","Z_STREAM_END","Z_NEED_DICT","Z_ERRNO","Z_STREAM_ERROR","Z_DATA_ERROR","Z_MEM_ERROR","Z_BUF_ERROR","Z_NO_COMPRESSION","Z_BEST_SPEED","Z_BEST_COMPRESSION","Z_DEFAULT_COMPRESSION","Z_FILTERED","Z_HUFFMAN_ONLY","Z_RLE","Z_FIXED","Z_DEFAULT_STRATEGY","Z_BINARY","Z_TEXT","Z_UNKNOWN","Z_DEFLATED","Z_NO_FLUSH$2","Z_FULL_FLUSH$1","Z_FINISH$3","Z_BLOCK$1","Z_OK$3","Z_STREAM_END$3","Z_STREAM_ERROR$2","Z_DATA_ERROR$2","Z_BUF_ERROR$1","Z_DEFAULT_COMPRESSION$1","Z_DEFAULT_STRATEGY$1","Z_DEFLATED$2","MAX_MATCH","MIN_LOOKAHEAD","HCRC_STATE","BUSY_STATE","FINISH_STATE","errorCode","msg","zero","HASH","hash_shift","hash_mask","flush_pending","avail_out","pending_out","next_out","total_out","flush_block_only","block_start","strstart","put_byte","putShortMSB","read_buf","avail_in","next_in","total_in","longest_match","cur_match","chain_length","max_chain_length","best_len","prev_length","nice_match","w_size","_win","wmask","w_mask","strend","scan_end1","scan_end","good_match","lookahead","match_start","fill_window","_w_size","more","window_size","hash_size","ins_h","deflate_fast","hash_head","bflush","match_length","max_lazy_match","MIN_MATCH","deflate_slow","max_insert","prev_match","match_available","Config","good_length","max_lazy","nice_length","max_chain","func","configuration_table","max_block_size","pending_buf_size","max_start","DeflateState","gzhead","gzindex","last_flush","w_bits","hash_bits","HEAP_SIZE","MAX_BITS","deflateResetKeep","deflateReset","deflateInit2","windowBits","memLevel","deflate_1$2","deflateInit","deflateSetHeader","deflate","beg","val","old_flush","hcrc","comment","level_flags","bstate","deflate_huff","deflate_rle","deflateEnd","deflateSetDictionary","dictionary","dictLength","tmpDict","avail","deflateInfo","_has","chunk","STR_APPLY_UIA_OK","_utf8len","TextEncoder","encode","m_pos","str_len","buf_len","out","utf16buf","c_len","buf2binstring","zstream","toString$1","Z_NO_FLUSH$1","Z_FINISH$2","Z_OK$2","Z_STREAM_END$2","Z_DEFLATED$1","Deflate$1","chunkSize","opt","raw","gzip","ended","_dict_set","flush_mode","_flush_mode","onData","onEnd","inffast","_in","_out","dmax","wsize","whave","wnext","s_window","hold","lcode","dcode","lmask","dmask","here","from_source","lencode","distcode","lenbits","distbits","dolen","dodist","sane","MAXBITS","lbase","lext","dbase","dext","inftrees","lens_index","codes","table_index","incr","sym","drop","used","huff","base_index","offs","here_bits","here_op","here_val","extra_index","Z_FINISH$1","Z_OK$1","Z_STREAM_END$1","Z_NEED_DICT$1","Z_STREAM_ERROR$1","Z_DATA_ERROR$1","Z_MEM_ERROR$1","TYPE","BAD","zswap32","InflateState","havedict","check","wbits","ncode","nlen","ndist","have","lendyn","distdyn","back","was","inflateResetKeep","inflateReset","inflateReset2","inflateInit2","lenfix","distfix","virgin","fixedtables","updatewindow","inflate_1$2","inflateInit","inflate","put","last_bits","last_op","last_val","hbuf","inf_leave","xflags","extra_len","inflateEnd","inflateGetHeader","inflateSetDictionary","dictid","inflateInfo","gzheader","Inflate$1","inflate$1","inflator","last_avail_out","next_out_utf8","utf8str","inflate_1$1","Inflate","inflateRaw","ungzip","constants","inflate_1","isLE","mLen","nBytes","eLen","eMax","eBias","nBits","pbf","Pbf","ieee754","Varint","Fixed64","Bytes","Fixed32","SHIFT_LEFT_32","SHIFT_RIGHT_32","utf8TextDecoder","readPackedEnd","readVarint","toNum","isSigned","makeRoomForExtraLength","startPos","extraLen","realloc","writePackedVarint","writeVarint","writePackedSVarint","writeSVarint","writePackedFloat","writeFloat","writePackedDouble","writeDouble","writePackedBoolean","writeBoolean","writePackedFixed32","writeFixed32","writePackedSFixed32","writeSFixed32","writePackedFixed64","writeFixed64","writePackedSFixed64","writeSFixed64","readUInt32","writeInt32","readInt32","decompress","inflated","pako.inflate","fetchArrayBuffer","xhrFetch","xhr","XMLHttpRequest","open","ontimeout","onabort","send","readMeshPbf","readFields","readMeshPbfField","readFloat","readField","readMessage","readFixed32","readSFixed32","readFixed64","readSFixed64","readDouble","readVarintRemainder","readVarint64","readSVarint","readBoolean","Boolean","readString","readUtf8TextDecoder","b3","bytesPerSequence","readUtf8","readBytes","readPackedVarint","readPackedSVarint","readPackedBoolean","readPackedFloat","readPackedDouble","readPackedFixed32","readPackedSFixed32","readPackedFixed64","readPackedSFixed64","writeTag","writeBigVarintLow","lsb","writeBigVarintHigh","writeBigVarint","writeString","lead","writeUtf8","write","writeBytes","writeRawMessage","writeMessage","writeBytesField","writeFixed32Field","writeSFixed32Field","writeFixed64Field","writeSFixed64Field","writeVarintField","writeSVarintField","writeStringField","writeFloatField","writeDoubleField","writeBooleanField","DataProviderBase","accessToken","GeometryProviderBase","centerLat","centerLng","_lngLatToCellIds","_enuToGeodetic","bboxCorners","_getLngLatBoundingBoxCorners","factory","module","Long","unsigned","isLong","__isLong__","INT_CACHE","UINT_CACHE","fromInt","cachedObj","fromBits","fromNumber","UZERO","ZERO","TWO_PWR_64_DBL","MAX_UNSIGNED_VALUE","TWO_PWR_63_DBL","MIN_VALUE","neg","TWO_PWR_32_DBL","lowBits","highBits","pow_dbl","fromString","radix","RangeError","radixToPower","mul","fromValue","TWO_PWR_16_DBL","TWO_PWR_24","ONE","UONE","NEG_ONE","LongPrototype","toInt","toNumber","isZero","isNegative","eq","radixLong","div","rem1","rem","remDiv","digits","getHighBits","getHighBitsUnsigned","getLowBits","getLowBitsUnsigned","getNumBitsAbs","bit","isPositive","isOdd","isEven","notEquals","neq","lessThan","lt","lessThanOrEqual","lte","greaterThan","gt","greaterThanOrEqual","gte","thisNeg","otherNeg","not","addend","a48","a16","a00","b48","b16","c48","c32","c16","c00","subtract","subtrahend","multiplier","b00","divide","divisor","approx","toUnsigned","shru","shr","shl","approxRes","approxRem","modulo","mod","and","or","xor","shiftLeft","numBits","shiftRight","shiftRightUnsigned","toSigned","toBytes","le","toBytesLE","toBytesBE","hi","lo","exports","S2","LatLng","rawLat","rawLng","noWrap","DEG_TO_RAD","RAD_TO_DEG","LatLngToXYZ","latLng","d2r","cosphi","XYZToLatLng","xyz","r2d","XYZToFaceUV","temp","largestAbsComponent","faceXYZToUV","FaceUVToXYZ","singleSTtoUV","st","STToUV","singleUVtoST","UVToST","STToIJ","singleSTtoIJ","ij","IJToST","rotateAndFlipQuadrant","rx","ry","pointToHilbertQuadList","hilbertMap","currentSquare","S2Cell","FromHilbertQuadKey","hilbertQuadkey","maxLevel","FromFaceIJ","FromLatLng","faceuv","getLatLng","getCornerLatLngs","getFaceAndQuads","quads","toHilbertQuadkey","latLngToNeighborKeys","getNeighbors","fromFaceIJWrap","FACE_BITS","MAX_LEVEL","POS_BITS","facePosLevelToId","fromFacePosLevel","faceN","posS","levelN","faceB","posB","bin","dcodeIO","keyToId","toId","toCellId","fromKey","idToKey","fromId","fromCellId","idS","lsbIndex","faceS","keyToLatLng","idToLatLng","latLngToKey","latLngToQuadkey","stepKey","otherL","posL","otherS","warning","S2GeometryProvider","_approxBboxToCellIds","a0","a3","_getNeighbors","existing","_lngLatToId","s2key","latlng","GraphConverter","lla","reference_lla","latitude","longitude","computedGeometry","graphCameraType","convertCameraType","merge_cc","thumbUrl","thumb_2048_url","thumb_1024_url","sfm_cluster","organization","GraphQueryCreator","imagesPath","sequencePath","_imageTilesPath","coreFields","idFields","spatialFields","imageTileFields","fields","GraphDataProvider","converter","queryCreator","_convert","_query","_method","_endpoint","endpoint","_accessToken","reconstructions","clusterReconstruction","query","imagesS2","_fetchGraphContract","cell_id","coreImage","spatialImage","imageTiles","imageTilesPath","_createHeaders","_makeErrorMessage","graphError","fbtrace_id","Marker","_lngLat","_createGeometry","_disposeGeometry","_getInteractiveObjects","isWebGLSupportedCache","isWebGLSupportedCached","requiredExtensions","supportedExtensions","getSupportedExtensions","requiredExtension","isWebGLSupported","isFallbackSupported","CameraControls","RenderMode","TransitionMode","ComponentController","observer","componentService","_observer","_key","_navigable","_componentService","getCover","_initializeComponents","_initilizeCoverComponent","_subscribeCoverComponent","movedToId$","deactivateCover","startEmit","navigable","_configurationSubscription","_uFalse","navigation","slider","_uTrue","keyboard","pointer","activateCover","navigable$","keyChanged","_setNavigable","stopEmit","option","DOMRenderer","currentFrame$","_renderService","_currentFrame$","vd.create","_offset$","_adaptiveOperation$","adaptive","imageAspect","renderMode","Fill","elementAspect","ratio","verticalOffset","horizontalOffset","Letterbox","imageAspectSubscription","renderAdaptiveSubscription","_renderAdaptive$","vNodeHashes","vNodeHash","vo","hashes","pointer-events","_render$","_vNode$","_vPatch$","nodePatch","vd.diff","currentProp","pluck","_element$","oldElement","vPatch","vd.patch","renderMode$","GLRenderer","canvasContainer","_renderCollection$","_renderOperation$","_renderCamera$","_renderCameraOperation$","_eraser$","_eraserOperation$","eraser","trigger$","_triggerOperation$","renderSubscription","renders","backgroundRenders","opaqueRenders","renderBackground","renderOpaque","_opaqueRender$","_renderFrame$","irc","_renderFrameSubscribe","renderHash$","clearHash$","_clear$","_webGLRenderer$","webGLRenderer","THREE.WebGLRenderer","devicePixelRatio","createRenderer$","resizeRenderer$","clearRenderer$","renderCollectionEmpty$","_renderFrameSubscription","opaqueRender$","_position","_lookat","_getFocal","pd","ld","ud","fd","RenderCamera","_initialFov","_stateTransitionAlpha","_stateTransitionFov","_renderMode","_zoom","_changed","_changedForFrame","_currentImageId","_previousImageId","_currentSpherical","_previousSpherical","_currentProjectedPoints","_previousProjectedPoints","_currentFov","_previousFov","_camera","_perspective","THREE.PerspectiveCamera","_computeAspect","currentFov","_computeCurrentFov","actualFov","_interpolateFov","_computePreviousFov","setRenderMode","_fovToY","_yToFov","currentImageId","previousImageId","sta","stateTransitionAlpha","startFov","endFov","_focalToFov","_computeRotation","_setFrameId","_computeFov","_computeVerticalFov","_computeRequiredVerticalFov","RenderService","_element","_resize$","_projectionMatrix$","_size$","_renderMode$","_renderCameraHolder$","_renderCameraFrame$","setFrame","_bearing$","rm","setProjectionMatrix","projectionMatrix$","resize$","KeyboardService","_keyDown$","observableFromEvent","_keyUp$","keyUp$","BUTTONS_MAP","MouseService","_activeSubject$","_active$","_claimMouse$","_claimWheel$","_deferPixelClaims$","_deferPixels$","claims","deferPixelMax","_documentMouseMove$","_isMousePen","_documentMouseUp$","_mouseDown$","_mouseEnter$","_mouseLeave$","_mouseMove$","_mouseUp$","_mouseOut$","_mouseOver$","_domMouseDown$","_domMouseMove$","_contextMenu$","_windowBlur$","_dblClick$","event1","event2","event3","_mouseWheel$","_consistentContextMenu$","dragStop$","_buttonReleased","_mouseButton","mouseDragInitiate$","_createMouseDragInitiate$","_mouseDragStart$","_createMouseDragStart$","_mouseDrag$","_createMouseDrag$","_mouseDragEnd$","_createMouseDragEnd$","domMouseDragInitiate$","_domMouseDragStart$","_domMouseDrag$","_domMouseDragEnd$","rightDragStop$","mouseRightDragInitiate$","_mouseRightDragStart$","_mouseRightDrag$","_mouseRightDragEnd$","_proximateClick$","_createDeferredMouseMove$","_staticClick$","_mouseOwner$","_createOwner$","_wheelOwner$","domMouseDown$","mouseOwner$","mouseOut$","mouseOver$","contextMenu$","staticClick$","zindex","observable$","_filtered","mouseMove","mouseDragStartInitiate$","stop$","button","defer","claim$","zIndexMax","owner$","upOrDown","InstallTrigger","platform","flag","pointerType","SpriteAtlas","_json","_texture","THREE.NearestFilter","definition","THREE.Object3D","THREE.SpriteMaterial","THREE.Sprite","float","clipTop","clipRigth","clipBottom","clipLeft","Top","BottomLeft","Left","TopLeft","BottomRight","Right","TopRight","pixelRatioInverse","SpriteService","_retina","_spriteAtlasOperation$","_spriteAtlas$","_atlasSubscription","imageXmlHTTP","jsonXmlHTTP","TouchService","_touchStart$","_touchMove$","_touchEnd$","_touchCancel$","tapStart$","targetTouches","closingSelector","_doubleTap$","observableTimer","closingSubscriber","openBuffer","_singleTouchMove$","singleTouchStart$","multipleTouchStart$","touchStop$","_singleTouchDragStart$","_singleTouchDragEnd$","_singleTouchDrag$","touchesChanged$","_pinchStart$","_pinchEnd$","_pinchOperation$","_pinch$","changeX","changeY","pageX","pageY","screenX","screenY","touch1","touch2","pinchSubscription","centerClientX","centerClientY","centerPageX","centerPageY","centerScreenX","centerScreenY","_pinchChange$","doubleTap$","touchStart$","touchCancel$","ConfigurationService","host","exploreHost","scheme","_exploreUrl$","imageTiling","_imageTiling$","Container","_trackResize","HTMLElement","trackResize","_canvasContainer","_domContainer","_onWindowResize","_removeNode","CacheService","_started","_cellDepth","started","trajectoryKeys","keepBuffer","graphMode","uncache$","_keyToEdges","imageToEdgeMap","LoadingService","_loaders$","_loadersSubject$","loaders","task","loading$","PanMode","PanService","Enabled","Disabled","_panImagesSubject$","_panImages$","_panImagesSubscription","current$","bounds","cacheBoundingBox$","_distance","currentTranslation","currentAzimuthal","currentHFov","preferredOverlap","nonOverlap","cost","_timeDifference","panImagess","traversing","Started","APIWrapper","_wrap$","getCoreImages","getImages","getImageTiles","getSpatialImages","setAccessToken","GraphService","_graph$","updateCells$","_dataAdded$","_graphMode","_graphModeSubject$","_graphMode$","_firstGraphSubjects$","_initializeCacheSubscriptions","_sequenceSubscriptions","_spatialSubscriptions","_onDataAdded","firstGraphSubject$","firstGraph$","initializeCacheSubscription","isCachingFull","cacheFull$","isCachingFill","cacheFill$","hasInitializedCache","graphSequence$","isCachingNodeSequence","cacheNodeSequence$","sequenceSubscription","spatialSubscription","hasTiles","graph$","isCachingTiles","hasSpatialArea","cacheSpatialArea$","isCachingSequence","referenceImageId","isCachingSequenceNodes","cacheSequenceNodes$","_resetSubscriptions","_abortSubjects","subjects","subscriptions","FrameGenerator","_cancelAnimationFrame","_requestAnimationFrame","mozRequestAnimationFrame","mozCancelAnimationFrame","webkitRequestAnimationFrame","webkitCancelAnimationFrame","msRequestAnimationFrame","msCancelAnimationFrame","oRequestAnimationFrame","oCancelAnimationFrame","StateBase","_referenceThreshold","_transitionMode","transitionMode","_reference","_currentIndex","_trajectory","_trajectoryTransforms","_trajectoryCameras","_imageToTranslation","_currentImage","_previousImage","_previousCamera","_getAlpha","_getStateTransitionAlpha","currentCamera","_motionless","basicRotation","_appendToTrajectories","_setCurrentImage","_setReference","_setTrajectories","_prependToTrajectories","_setCurrentCamera","cut","_setTrajectory","Instantaneous","_withinOriginalDistance","_sameConnectedComponent","_motionlessTransition","distanceFromLngLat","CustomState","forward","EarthState","eye1","lookat1","up1","eye0","lookat0","up0","eye2","lookat2","up2","eye3","lookat3","up3","_curveE","_curveL","_curveU","_zoom0","_zoom1","_isTransitioning","_transition","scaled","clipped","setFromUnitVectors","qInverse","EulerRotationDelta","_phi","_theta","InteractiveStateBase","_rotationDelta","_requestedRotationDelta","_basicRotation","_requestedBasicRotation","_requestedBasicRotationUnbounded","_rotationAcceleration","_rotationIncreaseAlpha","_rotationDecreaseAlpha","_rotationThreshold","_unboundedRotationAlpha","_desiredZoom","_minZoom","_maxZoom","_lookatDepth","_desiredLookat","_desiredCenter","rotationDelta","_applyRotation","THREE.Quaternion","_applyRotationBasic","currentCenter","currentCenterX","currentCenterY","zoom0","zoom1","refX","refY","newCenterX","newCenterY","currentLookat","previousLookat","previousCamera","currentBasic","previousBasic","animationSpeed","lengthSquared","reqX","reqY","desiredBasicLookat","lookatDirection","InteractiveWaitingState","_adjustCameras","prepend","_updateRotation","_updateRotationBasic","_updateZoom","_updateLookat","lerpCameras","TraversingState","_baseAlpha","_speedCoefficient","_smoothing","emptyTrajectory","_resetTransition","append","_setDesiredCenter","_setDesiredZoom","_clearRotation","_setCurrent","WaitingState","StateTransitionMatrix","custom","_creators","_transitions","transitions","generate","getState","StateContext","setCenter","setZoom","clearPrior","setViewMatrix","rotateBasic","rotateBasicUnbounded","rotateBasicWithoutInertia","rotateToBasic","move","setTransitionMode","transition","StateService","initialState","_start$","_frame$","_contextOperation$","_context$","_state$","_currentState$","fc","_clock","_lastState$","imageChanged$","imageChangedSubject$","_currentId$","_currentImage$","_currentCamera$","_currentTransform$","_reference$","r1","_currentImageExternal$","_appendImage$","_inMotionOperation$","moving","_inMotion$","_inTranslationOperation$","_inTranslation$","_frameGenerator","currentImageExternal$","currentCamera$","appendImage$","_invokeContextOperation","_frame","cameraControlsToState","cameraControls","Street","Navigator","loadingService","dataProvider","_loadingName","_loadingService","_cacheService","_playService","_panService","combinedPanning","_idRequested$","_movedToId$","_request$","_requestSubscription","_imageRequestSubscription","_abortRequest","startLoading","_moveTo$","_makeRequest$","directionId","stopLoading","observableThrowError","clearImages","_trajectoryIds$","setFilter$","_cacheIds$","requestedId","reset$","reason","request$","Projection","canvasToUnprojection","direction3d","projectToCanvasSafe","lngLat1","lngLat2","Observer","viewer","_viewer","_projection","_navigable$","distanceBetweenLngLats","lngLatToCanvas","_emitSubscriptions","_mapMouseEvent$","unprojection","eventToUnprojection","_closeTo","phi1","theta1","phi2","theta2","fov1","fov2","absoluteTolerance","CustomRenderer","_renderers","onAdd","onReference","onRemove","CustomCameraControls","_controls","attach$","ref","cam","onActivate","onDeactivate","onResize","onAttach","_updateViewMatrix","_updateProjectionMatrix","onDetach","detach","register","registerCover","_opacity","_radius","circle","THREE.CircleGeometry","capturePointer","clean","_content","_parentContainer","basicRect","htmlNode","html","frag","firstChild","setDOMContent","parentContainer","tipClassName","_tip","pointPixel","_alignmentToPopupAligment","alignments","appliedPosition","alignment","_rectToPixel","floats","_pixelToFloats","_normalizeOffset","floatTranslate","bottom-left","bottom-right","top-left","top-right","floatOffsets","automaticPositions","largestVisibleArea","automaticPosition","autoPointBasic","_pointFromRectPosition","autoPointPixel","floatOffset","offsetedPosition","staticCoeff","visibleArea","pointBasic","sideOffset","cornerOffset","bottomLeft","topRight","_ballColor","ballColor","_ballOpacity","ballOpacity","_circleToRayAngle","_interactive","_markerHeight","markerMaterial","_createMarkerGeometry","circleToRayAngle","indexRows","positionIndex","indexRow","arrayIndex","sinv","pi1","pi2","pi3","pi4","_componentController","_customRenderer","_customCameraControls","isNavigable","attach","tilt","getTilt","cameraToLngLat","getZoom","rendererId","project$","projectBasic$","fovToZoom","setAccessToken$","triggerRerender","unproject$","unprojectBasic$"],"mappings":";;;;;;;;;;;;;;oFAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOC,OAAOK,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,MAC3EN,EAAGC,IAGrB,SAASS,EAAUV,EAAGC,GACzB,GAAiB,mBAANA,GAA0B,OAANA,EAC3B,MAAM,IAAIU,UAAU,uBAAyBC,OAAOX,GAAK,iCAE7D,SAASY,IAAOC,KAAKC,YAAcf,EADnCD,EAAcC,EAAGC,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