@babylonjs/viewer
Version:
The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.
65 lines • 213 kB
JavaScript
class e extends Error{}e._setPrototypeOf=Object.setPrototypeOf||((e,t)=>(e.__proto__=t,e));class t extends e{constructor(n="Operation aborted"){super(n),this.name="AbortError",e._setPrototypeOf(this,t.prototype)}}class n{get resolve(){return this._resolve}get reject(){return this._reject}constructor(){this.promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}}class i{constructor(){this._currentOperation=Promise.resolve()}lockAsync(e,t){t?.throwIfAborted();const n=t?()=>(t.throwIfAborted(),e()):e,i=this._currentOperation.then(n);return this._currentOperation=new Promise(e=>{i.then(()=>e(),e)}),i}static async LockAsync(e,t,i){if(i?.throwIfAborted(),0===t.length)return await e();const r=new n;let s=0;for(const n of t)n.lockAsync(async()=>(s++,s===t.length&&r.resolve(await e()),await r.promise),i).catch(e=>r.reject(e));return await r.promise}}class r{static _CheckLimit(e,t){let n=r._LogLimitOutputs[e];return n?n.current++:(n={limit:t,current:1},r._LogLimitOutputs[e]=n),n.current<=n.limit}static _GenerateLimitMessage(e,t=1){const n=r._LogLimitOutputs[e];if(!n||!r.MessageLimitReached)return;const i=this._Levels[t];n.current===n.limit&&r[i.name](r.MessageLimitReached.replace(/%LIMIT%/g,""+n.limit).replace(/%TYPE%/g,i.name??""))}static _AddLogEntry(e){r._LogCache=e+r._LogCache,r.OnNewCacheEntry&&r.OnNewCacheEntry(e)}static _FormatMessage(e){const t=e=>e<10?"0"+e:""+e,n=new Date;return"["+t(n.getHours())+":"+t(n.getMinutes())+":"+t(n.getSeconds())+"]: "+e}static _LogDisabled(e,t){}static _LogEnabled(e=1,t,n){const i=Array.isArray(t)?t[0]:t;if(void 0!==n&&!r._CheckLimit(i,n))return;const s=r._FormatMessage(i),o=this._Levels[e],a=Array.isArray(t)?t.slice(1):[];o.logFunc&&o.logFunc("BJS - "+s,...a);const l=`<div style='color:${o.color}'>${s}</div><br>`;r._AddLogEntry(l),r._GenerateLimitMessage(i,e)}static get LogCache(){return r._LogCache}static ClearLogCache(){r._LogCache="",r._LogLimitOutputs={},r.errorsCount=0}static set LogLevels(e){r.Log=r._LogDisabled,r.Warn=r._LogDisabled,r.Error=r._LogDisabled;const t=[r.MessageLogLevel,r.WarningLogLevel,r.ErrorLogLevel];for(const n of t)if((e&n)===n){const e=this._Levels[n];r[e.name]=r._LogEnabled.bind(r,n)}}}r.NoneLogLevel=0,r.MessageLogLevel=1,r.WarningLogLevel=2,r.ErrorLogLevel=4,r.AllLogLevel=7,r.MessageLimitReached="Too many %TYPE%s (%LIMIT%), no more %TYPE%s will be reported for this message.",r._LogCache="",r._LogLimitOutputs={},r._Levels=[{},{color:"white",logFunc:console.log,name:"Log"},{color:"orange",logFunc:console.warn,name:"Warn"},{},{color:"red",logFunc:console.error,name:"Error"}],r.errorsCount=0,r.Log=r._LogEnabled.bind(r,r.MessageLogLevel),r.Warn=r._LogEnabled.bind(r,r.WarningLogLevel),r.Error=r._LogEnabled.bind(r,r.ErrorLogLevel);const s="undefined"!=typeof WeakRef;class o{constructor(e,t=!1,n,i){this.initialize(e,t,n,i)}initialize(e,t=!1,n,i){return this.mask=e,this.skipNextObservers=t,this.target=n,this.currentTarget=i,this}}class a{constructor(e,t,n=null){this.callback=e,this.mask=t,this.scope=n,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1,this._remove=null}remove(e=!1){this._remove&&this._remove(e)}}class l{static FromPromise(e,t){const n=new l;return e.then(e=>{n.notifyObservers(e)}).catch(e=>{if(!t)throw e;t.notifyObservers(e)}),n}get observers(){return this._observers}constructor(e,t=!1){this.notifyIfTriggered=t,this._observers=new Array,this._numObserversMarkedAsDeleted=0,this._hasNotified=!1,this._eventState=new o(0),e&&(this._onObserverAdded=e)}add(e,t=-1,n=!1,i=null,r=!1){if(!e)return null;const o=new a(e,t,i);o.unregisterOnNextCall=r,n?this._observers.unshift(o):this._observers.push(o),this._onObserverAdded&&this._onObserverAdded(o),this._hasNotified&&this.notifyIfTriggered&&void 0!==this._lastNotifiedValue&&this.notifyObserver(o,this._lastNotifiedValue);const l=s?new WeakRef(this):{deref:()=>this};return o._remove=(e=!1)=>{const t=l.deref();t&&(e?t.remove(o):t._remove(o))},o}addOnce(e){return this.add(e,void 0,void 0,void 0,!0)}remove(e){if(!e)return!1;e._remove=null;return-1!==this._observers.indexOf(e)&&(this._deferUnregister(e),!0)}removeCallback(e,t){for(let n=0;n<this._observers.length;n++){const i=this._observers[n];if(!i._willBeUnregistered&&(i.callback===e&&(!t||t===i.scope)))return this._deferUnregister(i),!0}return!1}_deferUnregister(e){e._willBeUnregistered||(this._numObserversMarkedAsDeleted++,e.unregisterOnNextCall=!1,e._willBeUnregistered=!0,setTimeout(()=>{this._remove(e)},0))}_remove(e,t=!0){if(!e)return!1;const n=this._observers.indexOf(e);return-1!==n&&(t&&this._numObserversMarkedAsDeleted--,this._observers.splice(n,1),!0)}makeObserverTopPriority(e){this._remove(e,!1),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e,!1),this._observers.push(e)}notifyObservers(e,t=-1,n,i,r){if(this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=e),!this._observers.length)return!0;const s=this._eventState;s.mask=t,s.target=n,s.currentTarget=i,s.skipNextObservers=!1,s.lastReturnValue=e,s.userInfo=r;for(const n of this._observers)if(!n._willBeUnregistered&&(n.mask&t&&(n.unregisterOnNextCall&&this._deferUnregister(n),n.scope?s.lastReturnValue=n.callback.apply(n.scope,[e,s]):s.lastReturnValue=n.callback(e,s)),s.skipNextObservers))return!1;return!0}notifyObserver(e,t,n=-1){if(this.notifyIfTriggered&&(this._hasNotified=!0,this._lastNotifiedValue=t),e._willBeUnregistered)return;const i=this._eventState;i.mask=n,i.skipNextObservers=!1,e.unregisterOnNextCall&&this._deferUnregister(e),e.callback(t,i)}hasObservers(){return this._observers.length-this._numObserversMarkedAsDeleted>0}clear(){for(;this._observers.length;){const e=this._observers.pop();e&&(e._remove=null)}this._onObserverAdded=null,this._numObserversMarkedAsDeleted=0,this.cleanLastNotifiedState()}cleanLastNotifiedState(){this._hasNotified=!1,this._lastNotifiedValue=void 0}clone(){const e=new l;return e._observers=this._observers.slice(0),e}hasSpecificMask(e=-1){for(const t of this._observers)if(t.mask&e||t.mask===e)return!0;return!1}}function c(...e){for(const t of e)t?.throwIfAborted()}function u(e){(async()=>{try{await e}catch(e){e instanceof t||r.Error(e)}})()}const h=["none","normal","high"],d=["none","standard","aces","neutral"];function p(e){return d.includes(e)}class m{constructor(){this.screenPosition=[NaN,NaN],this.worldPosition=[NaN,NaN,NaN],this.visibility=NaN}}const _={clearColor:[0,0,0,0],autoSuspendRendering:!0,environmentConfig:{intensity:1,blur:.3,rotation:0},environmentLighting:"auto",environmentSkybox:"none",cameraAutoOrbit:{enabled:!1,delay:2e3,speed:.05},animationAutoPlay:!1,animationSpeed:1,shadowConfig:{quality:"none"},postProcessing:{toneMapping:"neutral",contrast:1,exposure:1,ssao:"auto"},useRightHandedSystem:!1,useOpenPBR:!1},f=Math.PI/2,g=Math.PI/2.4;class b{constructor(){this.onEnvironmentChanged=new l,this.onEnvironmentConfigurationChanged=new l,this.onEnvironmentError=new l,this.onShadowsConfigurationChanged=new l,this.onPostProcessingChanged=new l,this.onModelChanged=new l,this.onModelError=new l,this.onLoadingProgressChanged=new l,this.onCameraAutoOrbitChanged=new l,this.onSelectedAnimationChanged=new l,this.onAnimationSpeedChanged=new l,this.onIsAnimationPlayingChanged=new l,this.onAnimationProgressChanged=new l,this.onSelectedMaterialVariantChanged=new l,this.onHotSpotsChanged=new l,this.onCamerasAsHotSpotsChanged=new l,this.onAfterRenderObservable=new l,this.onClearColorChanged=new l,this._loadOperations=new Set,this._isDisposed=!1,this._loadEnvironmentLightingLock=new i,this._loadEnvironmentLightingAbortController=null,this._loadEnvironmentSkyboxLock=new i,this._loadEnvironmentSkyboxAbortController=null,this._environmentIntensity=_.environmentConfig.intensity,this._environmentBlur=_.environmentConfig.blur,this._environmentRotation=_.environmentConfig.rotation,this._autoOrbitEnabled=_.cameraAutoOrbit.enabled,this._autoOrbitSpeed=_.cameraAutoOrbit.speed,this._autoOrbitDelay=_.cameraAutoOrbit.delay,this._clearColor={r:0,g:0,b:0,a:0},this._hotSpots={},this._loadModelLock=new i,this._loadModelAbortController=null,this._updateShadowsLock=new i,this._shadowsAbortController=null,this._shadowQuality=_.shadowConfig.quality}get loadingProgress(){if(this._loadOperations.size>0){let e=0;for(const t of this._loadOperations){if(null==t.progress)return!0;e+=t.progress}return e/this._loadOperations.size}return!1}_beginLoadOperation(){const e=this;let t=null;const n={get progress(){return t},set progress(n){t=n,e.onLoadingProgressChanged.notifyObservers()},dispose:()=>{e._loadOperations.delete(n),e.onLoadingProgressChanged.notifyObservers()}};return this._loadOperations.add(n),this.onLoadingProgressChanged.notifyObservers(),n}_throwIfDisposedOrAborted(...e){if(this._isDisposed)throw new Error("Viewer is disposed.");c(...e)}get _loadEnvironmentLightingAbortSignal(){return this._loadEnvironmentLightingAbortController?.signal}get _loadEnvironmentSkyboxAbortSignal(){return this._loadEnvironmentSkyboxAbortController?.signal}async loadEnvironment(e,t,n){return await this._updateEnvironment(e,t,n)}async resetEnvironment(e,t){return await this._updateEnvironment(void 0,e,t)}async _updateEnvironment(e,n,r){this._throwIfDisposedOrAborted(r);const s=!n||!!n.lighting,o=!n||!!n.skybox;if(!s&&!o)return;const a={...n,lighting:s,skybox:o},l=[],u=[];if(s){this._loadEnvironmentLightingAbortController?.abort(new t("New environment lighting is being loaded before previous environment lighting finished loading."));const e=this._loadEnvironmentLightingAbortController=new AbortController;l.push(this._loadEnvironmentLightingLock),u.push(e)}if(o){this._loadEnvironmentSkyboxAbortController?.abort(new t("New environment skybox is being loaded before previous environment skybox finished loading."));const e=this._loadEnvironmentSkyboxAbortController=new AbortController;l.push(this._loadEnvironmentSkyboxLock),u.push(e)}const h=new AbortController,d=()=>{u.every(e=>e.signal.aborted)&&h.abort(new t(u.map(e=>e.signal.reason).join(" | ")))};for(const e of u)e.signal.addEventListener("abort",d);try{await i.LockAsync(async()=>{c(r,h.signal),await this._loadEnvironmentImpl(e?.trim()??e,a,r,h.signal)},l)}finally{for(const e of u)e.signal.removeEventListener("abort",d)}}get environmentConfig(){return{intensity:this._environmentIntensity,blur:this._environmentBlur,rotation:this._environmentRotation}}set environmentConfig(e){void 0!==e.blur&&e.blur!==this._environmentBlur&&(this._environmentBlur=e.blur,this._applyEnvironmentBlur()),void 0!==e.intensity&&e.intensity!==this._environmentIntensity&&(this._environmentIntensity=e.intensity,this._applyEnvironmentIntensity()),void 0!==e.rotation&&e.rotation!==this._environmentRotation&&(this._environmentRotation=e.rotation,this._applyEnvironmentRotation()),this.onEnvironmentConfigurationChanged.notifyObservers()}get cameraAutoOrbit(){return{enabled:this._autoOrbitEnabled,speed:this._autoOrbitSpeed,delay:this._autoOrbitDelay}}set cameraAutoOrbit(e){let t=!1;void 0!==e.enabled&&e.enabled!==this._autoOrbitEnabled&&(this._autoOrbitEnabled=e.enabled,this._applyCameraAutoOrbitEnabled(),t=!0),void 0!==e.speed&&e.speed!==this._autoOrbitSpeed&&(this._autoOrbitSpeed=e.speed,this._applyCameraAutoOrbitSpeed(),t=!0),void 0!==e.delay&&e.delay!==this._autoOrbitDelay&&(this._autoOrbitDelay=e.delay,this._applyCameraAutoOrbitDelay(),t=!0),t&&this.onCameraAutoOrbitChanged.notifyObservers()}get clearColor(){return this._clearColor}set clearColor(e){this._clearColor.r=e.r,this._clearColor.g=e.g,this._clearColor.b=e.b,this._clearColor.a=e.a,this._applyClearColor(),this.onClearColorChanged.notifyObservers()}get hotSpots(){return this._hotSpots}set hotSpots(e){this._hotSpots=e,this.onHotSpotsChanged.notifyObservers()}get _loadModelAbortSignal(){return this._loadModelAbortController?.signal}async loadModel(e,t,n){return await this._updateModel(e,t,n)}async resetModel(e){return await this._updateModel(void 0,void 0,e)}async _updateModel(e,n,i){this._throwIfDisposedOrAborted(i),this._loadModelAbortController?.abort(new t("New model is being loaded before previous model finished loading."));const r=this._loadModelAbortController=new AbortController;await this._loadModelLock.lockAsync(async()=>{c(i,r.signal),await this._loadModelImpl(e,n,i,r.signal)}),r.signal.aborted||await this._afterLoadModel(e,n,i,r.signal)}async _afterLoadModel(e,t,n,i){}get _shadowsAbortSignal(){return this._shadowsAbortController?.signal}get shadowConfig(){return{quality:this._shadowQuality}}async updateShadows(e,t){if(void 0===e.quality||e.quality===this._shadowQuality)return;const n=this._shadowQuality;this._shadowQuality=e.quality;try{await this._updateShadows(this._shadowQuality,t)}catch(t){throw this._shadowQuality===e.quality&&(this._shadowQuality=n),t}this.onShadowsConfigurationChanged.notifyObservers()}async _updateShadows(e=this._shadowQuality,n){this._throwIfDisposedOrAborted(n),this._shadowsAbortController?.abort(new t("Shadows quality is being changed before previous shadows finished initializing."));const i=this._shadowsAbortController=new AbortController;await this._updateShadowsLock.lockAsync(async()=>{c(n,i.signal),await this._updateShadowsImpl(e,n,i.signal)})}dispose(){this._loadEnvironmentLightingAbortController?.abort(new t("The viewer is being disposed.")),this._loadEnvironmentLightingAbortController=null,this._loadEnvironmentSkyboxAbortController?.abort(new t("The viewer is being disposed.")),this._loadEnvironmentSkyboxAbortController=null,this._loadModelAbortController?.abort(new t("The viewer is being disposed.")),this._loadModelAbortController=null,this._shadowsAbortController?.abort(new t("The viewer is being disposed.")),this._shadowsAbortController=null,this.onEnvironmentChanged.clear(),this.onEnvironmentConfigurationChanged.clear(),this.onEnvironmentError.clear(),this.onShadowsConfigurationChanged.clear(),this.onPostProcessingChanged.clear(),this.onModelChanged.clear(),this.onModelError.clear(),this.onLoadingProgressChanged.clear(),this.onCameraAutoOrbitChanged.clear(),this.onSelectedAnimationChanged.clear(),this.onAnimationSpeedChanged.clear(),this.onIsAnimationPlayingChanged.clear(),this.onAnimationProgressChanged.clear(),this.onSelectedMaterialVariantChanged.clear(),this.onHotSpotsChanged.clear(),this.onCamerasAsHotSpotsChanged.clear(),this.onAfterRenderObservable.clear(),this.onClearColorChanged.clear(),this._isDisposed=!0}reset(...e){this._reset(!0,...e)}_reset(e,...t){const n=0===t.length;(n||t.includes("source"))&&this._resetModel(),(n||t.includes("environment"))&&this._resetEnvironment(),(n||t.includes("shadow"))&&this._resetShadows(),(n||t.includes("animation"))&&this._resetAnimation(),(n||t.includes("camera"))&&this._resetCamera(e),(n||t.includes("post-processing"))&&this._resetPostProcessing(),(n||t.includes("material-variant"))&&this._resetMaterialVariant()}_resetModel(){u(this._updateModel(this._options?.source))}_resetShadows(){u(this.updateShadows({quality:this._options?.shadowConfig?.quality??_.shadowConfig.quality}))}_resetMaterialVariant(){this.selectedMaterialVariant=this._options?.selectedMaterialVariant??null}}function v(e,t,n,i,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?i.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,i.name):{}),d=!1,p=n.length-1;p>=0;p--){var m={};for(var _ in i)m[_]="access"===_?{}:i[_];for(var _ in i.access)m.access[_]=i.access[_];m.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var f=(0,n[p])("accessor"===l?{get:h.get,set:h.set}:h[c],m);if("accessor"===l){if(void 0===f)continue;if(null===f||"object"!=typeof f)throw new TypeError("Object expected");(a=o(f.get))&&(h.get=a),(a=o(f.set))&&(h.set=a),(a=o(f.init))&&r.unshift(a)}else(a=o(f))&&("field"===l?r.unshift(a):h[c]=a)}u&&Object.defineProperty(u,i.name,h),d=!0}function y(e,t,n){for(var i=arguments.length>2,r=0;r<t.length;r++)n=i?t[r].call(e,n):t[r].call(e);return i?n:void 0}function w(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function x(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function C(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const A=e=>(t,n)=>{void 0!==n?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},M=globalThis,S=M.ShadowRoot&&(void 0===M.ShadyCSS||M.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,k=Symbol(),P=new WeakMap;
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/let E=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==k)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(S&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=P.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&P.set(t,e))}return e}toString(){return this.cssText}};const T=(e,...t)=>{const n=1===e.length?e[0]:t.reduce((t,n,i)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[i+1],e[0]);return new E(n,e,k)},O=S?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new E("string"==typeof e?e:e+"",void 0,k))(t)})(e):e,{is:B,defineProperty:I,getOwnPropertyDescriptor:$,getOwnPropertyNames:L,getOwnPropertySymbols:R,getPrototypeOf:N}=Object,V=globalThis,z=V.trustedTypes,F=z?z.emptyScript:"",D=V.reactiveElementPolyfillSupport,G=(e,t)=>e,U={toAttribute(e,t){switch(t){case Boolean:e=e?F:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},W=(e,t)=>!B(e,t),j={attribute:!0,type:String,converter:U,reflect:!1,useDefault:!1,hasChanged:W};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/Symbol.metadata??=Symbol("metadata"),V.litPropertyMetadata??=new WeakMap;let H=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=j){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);void 0!==i&&I(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:r}=$(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:i,set(t){const s=i?.call(this);r?.call(this,t),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??j}static _$Ei(){if(this.hasOwnProperty(G("elementProperties")))return;const e=N(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(G("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(G("properties"))){const e=this.properties,t=[...L(e),...R(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(O(e))}else void 0!==e&&t.push(O(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(S)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const n of t){const t=document.createElement("style"),i=M.litNonce;void 0!==i&&t.setAttribute("nonce",i),t.textContent=n.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(void 0!==i&&!0===n.reflect){const r=(void 0!==n.converter?.toAttribute?n.converter:U).toAttribute(t,n.type);this._$Em=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(void 0!==i&&this._$Em!==i){const e=n.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:U;this._$Em=i;const s=r.fromAttribute(t,e.type);this[i]=s??this._$Ej?.get(i)??s,this._$Em=null}}requestUpdate(e,t,n,i=!1,r){if(void 0!==e){const s=this.constructor;if(!1===i&&(r=this[e]),n??=s.getPropertyOptions(e),!((n.hasChanged??W)(r,t)||n.useDefault&&n.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:r},s){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),!0!==r||void 0!==s)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===i&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e){const{wrapped:e}=n,i=this[t];!0!==e||this._$AL.has(t)||void 0===i||this.C(t,void 0,n,i)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};H.elementStyles=[],H.shadowRootOptions={mode:"open"},H[G("elementProperties")]=new Map,H[G("finalized")]=new Map,D?.({ReactiveElement:H}),(V.reactiveElementVersions??=[]).push("2.1.2");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const q={attribute:!0,type:String,converter:U,reflect:!1,hasChanged:W},Y=(e=q,t,n)=>{const{kind:i,metadata:r}=n;let s=globalThis.litPropertyMetadata.get(r);if(void 0===s&&globalThis.litPropertyMetadata.set(r,s=new Map),"setter"===i&&((e=Object.create(e)).wrapped=!0),s.set(n.name,e),"accessor"===i){const{name:i}=n;return{set(n){const r=t.get.call(this);t.set.call(this,n),this.requestUpdate(i,r,e,!0,n)},init(t){return void 0!==t&&this.C(i,void 0,e,t),t}}}if("setter"===i){const{name:i}=n;return function(n){const r=this[i];t.call(this,n),this.requestUpdate(i,r,e,!0,n)}}throw Error("Unsupported decorator location: "+i)};function X(e){return(t,n)=>"object"==typeof n?Y(e,t,n):((e,t,n)=>{const i=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),i?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function Q(e){return X({...e,state:!0,attribute:!1})}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function Z(e,t){return(t,n,i)=>((e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,n),n))(t,n,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const J=globalThis,K=e=>e,ee=J.trustedTypes,te=ee?ee.createPolicy("lit-html",{createHTML:e=>e}):void 0,ne="$lit$",ie=`lit$${Math.random().toFixed(9).slice(2)}$`,re="?"+ie,se=`<${re}>`,oe=document,ae=()=>oe.createComment(""),le=e=>null===e||"object"!=typeof e&&"function"!=typeof e,ce=Array.isArray,ue="[ \t\n\f\r]",he=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,de=/-->/g,pe=/>/g,me=RegExp(`>|${ue}(?:([^\\s"'>=/]+)(${ue}*=${ue}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),_e=/'/g,fe=/"/g,ge=/^(?:script|style|textarea|title)$/i,be=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),ve=Symbol.for("lit-noChange"),ye=Symbol.for("lit-nothing"),we=new WeakMap,xe=oe.createTreeWalker(oe,129);function Ce(e,t){if(!ce(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==te?te.createHTML(t):t}const Ae=(e,t)=>{const n=e.length-1,i=[];let r,s=2===t?"<svg>":3===t?"<math>":"",o=he;for(let t=0;t<n;t++){const n=e[t];let a,l,c=-1,u=0;for(;u<n.length&&(o.lastIndex=u,l=o.exec(n),null!==l);)u=o.lastIndex,o===he?"!--"===l[1]?o=de:void 0!==l[1]?o=pe:void 0!==l[2]?(ge.test(l[2])&&(r=RegExp("</"+l[2],"g")),o=me):void 0!==l[3]&&(o=me):o===me?">"===l[0]?(o=r??he,c=-1):void 0===l[1]?c=-2:(c=o.lastIndex-l[2].length,a=l[1],o=void 0===l[3]?me:'"'===l[3]?fe:_e):o===fe||o===_e?o=me:o===de||o===pe?o=he:(o=me,r=void 0);const h=o===me&&e[t+1].startsWith("/>")?" ":"";s+=o===he?n+se:c>=0?(i.push(a),n.slice(0,c)+ne+n.slice(c)+ie+h):n+ie+(-2===c?t:h)}return[Ce(e,s+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]};class Me{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let r=0,s=0;const o=e.length-1,a=this.parts,[l,c]=Ae(e,t);if(this.el=Me.createElement(l,n),xe.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=xe.nextNode())&&a.length<o;){if(1===i.nodeType){if(i.hasAttributes())for(const e of i.getAttributeNames())if(e.endsWith(ne)){const t=c[s++],n=i.getAttribute(e).split(ie),o=/([.?@])?(.*)/.exec(t);a.push({type:1,index:r,name:o[2],strings:n,ctor:"."===o[1]?Te:"?"===o[1]?Oe:"@"===o[1]?Be:Ee}),i.removeAttribute(e)}else e.startsWith(ie)&&(a.push({type:6,index:r}),i.removeAttribute(e));if(ge.test(i.tagName)){const e=i.textContent.split(ie),t=e.length-1;if(t>0){i.textContent=ee?ee.emptyScript:"";for(let n=0;n<t;n++)i.append(e[n],ae()),xe.nextNode(),a.push({type:2,index:++r});i.append(e[t],ae())}}}else if(8===i.nodeType)if(i.data===re)a.push({type:2,index:r});else{let e=-1;for(;-1!==(e=i.data.indexOf(ie,e+1));)a.push({type:7,index:r}),e+=ie.length-1}r++}}static createElement(e,t){const n=oe.createElement("template");return n.innerHTML=e,n}}function Se(e,t,n=e,i){if(t===ve)return t;let r=void 0!==i?n._$Co?.[i]:n._$Cl;const s=le(t)?void 0:t._$litDirective$;return r?.constructor!==s&&(r?._$AO?.(!1),void 0===s?r=void 0:(r=new s(e),r._$AT(e,n,i)),void 0!==i?(n._$Co??=[])[i]=r:n._$Cl=r),void 0!==r&&(t=Se(e,r._$AS(e,t.values),r,i)),t}class ke{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??oe).importNode(t,!0);xe.currentNode=i;let r=xe.nextNode(),s=0,o=0,a=n[0];for(;void 0!==a;){if(s===a.index){let t;2===a.type?t=new Pe(r,r.nextSibling,this,e):1===a.type?t=new a.ctor(r,a.name,a.strings,this,e):6===a.type&&(t=new Ie(r,this,e)),this._$AV.push(t),a=n[++o]}s!==a?.index&&(r=xe.nextNode(),s++)}return xe.currentNode=oe,i}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class Pe{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=ye,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Se(this,e,t),le(e)?e===ye||null==e||""===e?(this._$AH!==ye&&this._$AR(),this._$AH=ye):e!==this._$AH&&e!==ve&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>ce(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==ye&&le(this._$AH)?this._$AA.nextSibling.data=e:this.T(oe.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=Me.createElement(Ce(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new ke(i,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=we.get(e.strings);return void 0===t&&we.set(e.strings,t=new Me(e)),t}k(e){ce(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const r of e)i===t.length?t.push(n=new Pe(this.O(ae()),this.O(ae()),this,this.options)):n=t[i],n._$AI(r),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=K(e).nextSibling;K(e).remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class Ee{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,r){this.type=1,this._$AH=ye,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=ye}_$AI(e,t=this,n,i){const r=this.strings;let s=!1;if(void 0===r)e=Se(this,e,t,0),s=!le(e)||e!==this._$AH&&e!==ve,s&&(this._$AH=e);else{const i=e;let o,a;for(e=r[0],o=0;o<r.length-1;o++)a=Se(this,i[n+o],t,o),a===ve&&(a=this._$AH[o]),s||=!le(a)||a!==this._$AH[o],a===ye?e=ye:e!==ye&&(e+=(a??"")+r[o+1]),this._$AH[o]=a}s&&!i&&this.j(e)}j(e){e===ye?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Te extends Ee{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ye?void 0:e}}class Oe extends Ee{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ye)}}class Be extends Ee{constructor(e,t,n,i,r){super(e,t,n,i,r),this.type=5}_$AI(e,t=this){if((e=Se(this,e,t,0)??ye)===ve)return;const n=this._$AH,i=e===ye&&n!==ye||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,r=e!==ye&&(n===ye||i);i&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class Ie{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Se(this,e)}}const $e=J.litHtmlPolyfillSupport;$e?.(Me,Pe),(J.litHtmlVersions??=[]).push("3.3.2");const Le=globalThis;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/let Re=class extends H{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const i=n?.renderBefore??t;let r=i._$litPart$;if(void 0===r){const e=n?.renderBefore??null;i._$litPart$=r=new Pe(t.insertBefore(ae(),e),e,void 0,n??{})}return r._$AI(e),r})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ve}};Re._$litElement$=!0,Re.finalized=!0,Le.litElementHydrateSupport?.({LitElement:Re});const Ne=Le.litElementPolyfillSupport;Ne?.({LitElement:Re}),(Le.litElementVersions??=[]).push("4.2.2");
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const Ve=2;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class ze{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const Fe=(e,t)=>{const n=e._$AN;if(void 0===n)return!1;for(const e of n)e._$AO?.(t,!1),Fe(e,t);return!0},De=e=>{let t,n;do{if(void 0===(t=e._$AM))break;n=t._$AN,n.delete(e),e=t}while(0===n?.size)},Ge=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(void 0===n)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),je(t)}};function Ue(e){void 0!==this._$AN?(De(this),this._$AM=e,Ge(this)):this._$AM=e}function We(e,t=!1,n=0){const i=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(t)if(Array.isArray(i))for(let e=n;e<i.length;e++)Fe(i[e],!1),De(i[e]);else null!=i&&(Fe(i,!1),De(i));else Fe(this,e)}const je=e=>{e.type==Ve&&(e._$AP??=We,e._$AQ??=Ue)};class He extends ze{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),Ge(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(Fe(this,e),De(this))}setValue(e){if((e=>void 0===e.strings)(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}const qe=new WeakMap,Ye=(e=>(...t)=>({_$litDirective$:e,values:t}))(class extends He{render(e){return ye}update(e,[t]){const n=t!==this.G;return n&&void 0!==this.G&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.G=t,this.ht=e.options?.host,this.rt(this.ct=e.element)),ye}rt(e){if(this.isConnected||(e=void 0),"function"==typeof this.G){const t=this.ht??globalThis;let n=qe.get(t);void 0===n&&(n=new WeakMap,qe.set(t,n)),void 0!==n.get(this.G)&&this.G.call(this.ht,void 0),n.set(this.G,e),void 0!==e&&this.G.call(this.ht,e)}else this.G.value=e}get lt(){return"function"==typeof this.G?qe.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),Xe=[.5,1,1.5,2];function Qe(e){if(!e)return null;const t=document.createElement("canvas");t.width=t.height=1;const n=t.getContext("2d");if(!n)throw new Error("Unable to get 2d context for parseColor");n.clearRect(0,0,1,1),n.fillStyle=e,n.fillRect(0,0,1,1);const i=n.getImageData(0,0,1,1).data;return{r:i[0]/255,g:i[1]/255,b:i[2]/255,a:i[3]/255}}function Ze(e){return null==e?null:Number(e)}function Je(e){if(!e)return null;const t=e.trim().split(/\s+/);if(3!==t.length)throw new Error(`Camera orbit and target should be defined as three space separated numbers, but was specified as "${e}".`);return t.map(e=>Number(e))}function Ke(e){return e&&function(e){return h.includes(e)}(e)?e:null}function et(e){return e&&"auto"!==e?"reframe"===e?"reframe":e.trim().split(/\s+/):"auto"}let tt=(()=>{var e,n,s,o,a,l,c,u,h,d,m,_,f,g,b,w,A,M,S,k,P,E,O,B,I,$,L,R,N,V,z,F,D,G;let U,W,j,H,q,Y,J,K,ee,te,ne,ie,re,se,oe,ae,le,ce,ue,he,de,pe,me,_e,fe,ge,ve,ye,we,xe,Ce,Ae,Me,Se,ke=Re,Pe=[],Ee=[],Te=[],Oe=[],Be=[],Ie=[],$e=[],Le=[],Ne=[],Ve=[],ze=[],Fe=[],De=[],Ge=[],Ue=[],We=[],je=[],He=[],qe=[],tt=[],nt=[],it=[],rt=[],st=[],ot=[],at=[],lt=[],ct=[],ut=[],ht=[],dt=[],pt=[],mt=[],_t=[],ft=[],gt=[],bt=[],vt=[],yt=[],wt=[],xt=[],Ct=[],At=[],Mt=[],St=[],kt=[],Pt=[],Et=[],Tt=[],Ot=[],Bt=[],It=[],$t=[],Lt=[],Rt=[],Nt=[],Vt=[],zt=[],Ft=[],Dt=[],Gt=[],Ut=[],Wt=[],jt=[],Ht=[],qt=[],Yt=[];return e=class extends ke{constructor(e={}){super(),this._options=(y(this,Pe),e),this._viewerLock=new i,this._animationSliderResizeObserver=null,this._propertyBindings=[this._createPropertyBinding("clearColor",e=>e.onClearColorChanged,e=>e.clearColor=this.clearColor??{r:0,g:0,b:0,a:0},e=>this.clearColor=e.clearColor),this._createPropertyBinding("skyboxBlur",e=>e.onEnvironmentConfigurationChanged,e=>e.environmentConfig={blur:this.skyboxBlur??e.environmentConfig.blur},e=>this.skyboxBlur=e.environmentConfig.blur),this._createPropertyBinding("environmentIntensity",e=>e.onEnvironmentConfigurationChanged,e=>e.environmentConfig={intensity:this.environmentIntensity??e.environmentConfig.intensity},e=>this.environmentIntensity=e.environmentConfig.intensity),this._createPropertyBinding("environmentRotation",e=>e.onEnvironmentConfigurationChanged,e=>e.environmentConfig={rotation:this.environmentRotation??e.environmentConfig.rotation},e=>this.environmentRotation=e.environmentConfig.rotation),this._createPropertyBinding("toneMapping",e=>e.onPostProcessingChanged,e=>{this.toneMapping&&(e.postProcessing={toneMapping:this.toneMapping})},e=>this.toneMapping=e.postProcessing?.toneMapping),this._createPropertyBinding("contrast",e=>e.onPostProcessingChanged,e=>e.postProcessing={contrast:this.contrast??void 0},e=>this.contrast=e.postProcessing.contrast),this._createPropertyBinding("exposure",e=>e.onPostProcessingChanged,e=>e.postProcessing={exposure:this.exposure??void 0},e=>this.exposure=e.postProcessing.exposure),this._createPropertyBinding("ssao",e=>e.onPostProcessingChanged,e=>e.postProcessing={ssao:this.ssao??void 0},e=>this.ssao=e.postProcessing.ssao),this._createPropertyBinding("cameraAutoOrbit",e=>e.onCameraAutoOrbitChanged,e=>e.cameraAutoOrbit={enabled:this.cameraAutoOrbit},e=>this.cameraAutoOrbit=e.cameraAutoOrbit.enabled),this._createPropertyBinding("cameraAutoOrbitSpeed",e=>e.onCameraAutoOrbitChanged,e=>e.cameraAutoOrbit={speed:this.cameraAutoOrbitSpeed??void 0},e=>this.cameraAutoOrbitSpeed=e.cameraAutoOrbit.speed),this._createPropertyBinding("cameraAutoOrbitDelay",e=>e.onCameraAutoOrbitChanged,e=>e.cameraAutoOrbit={delay:this.cameraAutoOrbitDelay??void 0},e=>this.cameraAutoOrbitDelay=e.cameraAutoOrbit.delay),this._createPropertyBinding("animationSpeed",e=>e.onAnimationSpeedChanged,e=>e.animationSpeed=this.animationSpeed,e=>{let t=e.animationSpeed;t=Xe.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e),this.animationSpeed=t,this._dispatchCustomEvent("animationspeedchange",e=>new Event(e))}),this._createPropertyBinding("selectedAnimation",e=>e.onSelectedAnimationChanged,e=>e.selectedAnimation=this.selectedAnimation??e.selectedAnimation,e=>this.selectedAnimation=e.selectedAnimation),this._createPropertyBinding("selectedMaterialVariant",e=>e.onSelectedMaterialVariantChanged,e=>e.selectedMaterialVariant=this.selectedMaterialVariant??e.selectedMaterialVariant??"",e=>this.selectedMaterialVariant=e.selectedMaterialVariant),this._createPropertyBinding("hotSpots",e=>e.onHotSpotsChanged,e=>e.hotSpots=this.hotSpots??e.hotSpots,e=>this.hotSpots=e.hotSpots),this._createPropertyBinding("camerasAsHotSpots",e=>e.onCamerasAsHotSpotsChanged,e=>e.camerasAsHotSpots=this.camerasAsHotSpots??e.camerasAsHotSpots,e=>this.camerasAsHotSpots=e.camerasAsHotSpots)],n.set(this,y(this,Ee,!1)),s.set(this,(y(this,Te),y(this,Oe,!1===this._options.autoSuspendRendering))),o.set(this,(y(this,Be),y(this,Ie,this._options.source??null))),a.set(this,(y(this,$e),y(this,Le,null))),l.set(this,(y(this,Ne),y(this,Ve,this._options.useOpenPBR??!1))),c.set(this,(y(this,ze),y(this,Fe,this._options.environmentLighting??null))),u.set(this,(y(this,De),y(this,Ge,this._options.environmentSkybox??null))),h.set(this,(y(this,Ue),y(this,We,this._options.environmentConfig?.intensity??null))),d.set(this,(y(this,je),y(this,He,this._options.environmentConfig?.rotation??null))),m.set(this,(y(this,qe),y(this,tt,null))),_.set(this,(y(this,nt),y(this,it,!1))),f.set(this,(y(this,rt),y(this,st,this._options.environmentConfig?.blur??null))),g.set(this,(y(this,ot),y(this,at,this._options.postProcessing?.toneMapping??null))),b.set(this,(y(this,lt),y(this,ct,this._options.postProcessing?.contrast??null))),w.set(this,(y(this,ut),y(this,ht,this._options.postProcessing?.exposure??null))),A.set(this,(y(this,dt),y(this,pt,this._options.postProcessing?.ssao??null))),M.set(this,(y(this,mt),y(this,_t,this._options.clearColor?{r:this._options.clearColor[0],g:this._options.clearColor[1],b:this._options.clearColor[2],a:this._options.clearColor[3]??1}:null))),S.set(this,(y(this,ft),y(this,gt,this._options.cameraAutoOrbit?.enabled??!1))),k.set(this,(y(this,bt),y(this,vt,this._options.cameraAutoOrbit?.speed??null))),P.set(this,(y(this,yt),y(this,wt,this._options.cameraAutoOrbit?.delay??null))),E.set(this,(y(this,xt),y(this,Ct,this._options.hotSpots??{}))),O.set(this,(y(this,At),y(this,Mt,!!this._options.animationAutoPlay))),B.set(this,(y(this,St),y(this,kt,this._options.selectedAnimation??null))),I.set(this,(y(this,Pt),y(this,Et,this._options.animationSpeed??1))),$.set(this,(y(this,Tt),y(this,Ot,0))),L.set(this,(y(this,Bt),y(this,It,[]))),R.set(this,(y(this,$t),y(this,Lt,!1))),N.set(this,(y(this,Rt),y(this,Nt,!0))),V.set(this,(y(this,Vt),y(this,zt,this._options.selectedMaterialVariant??null))),z.set(this,(y(this,Ft),y(this,Dt,!1))),F.set(this,(y(this,Gt),y(this,Ut,"auto"))),D.set(this,(y(this,Wt),y(this,jt,void 0))),G.set(this,(y(this,Ht),y(this,qt,void 0))),y(this,Yt),this._options=e}static get observedAttributes(){return[...super.observedAttributes,"camera-orbit","camera-target"]}queryHotSpot(e,t){return!!this._viewer&&this._viewer.queryHotSpot(e,t)}focusHotSpot(e){return!!this._viewer&&this._viewer.focusHotSpot(e)}get _isFaultedBacking(){return x(this,n,"f")}set _isFaultedBacking(e){C(this,n,e,"f")}get _isFaulted(){return this._isFaultedBacking}get renderWhenIdle(){return x(this,s,"f")}set renderWhenIdle(e){C(this,s,e,"f")}get source(){return x(this,o,"f")}set source(e){C(this,o,e,"f")}get extension(){return x(this,a,"f")}set extension(e){C(this,a,e,"f")}get useOpenPBR(){return x(this,l,"f")}set useOpenPBR(e){C(this,l,e,"f")}get environment(){return{lighting:this.environmentLighting,skybox:this.environmentSkybox}}set environment(e){this.environmentLighting=e||null,this.environmentSkybox=e||null}get environmentLighting(){return x(this,c,"f")}set environmentLighting(e){C(this,c,e,"f")}get environmentSkybox(){return x(this,u,"f")}set environmentSkybox(e){C(this,u,e,"f")}get environmentIntensity(){return x(this,h,"f")}set environmentIntensity(e){C(this,h,e,"f")}get environmentRotation(){return x(this,d,"f")}set environmentRotation(e){C(this,d,e,"f")}get shadowQuality(){return x(this,m,"f")}set shadowQuality(e){C(this,m,e,"f")}get _loadingProgress(){return x(this,_,"f")}set _loadingProgress(e){C(this,_,e,"f")}get loadingProgress(){return this._loadingProgress}get skyboxBlur(){return x(this,f,"f")}set skyboxBlur(e){C(this,f,e,"f")}get toneMapping(){return x(this,g,"f")}set toneMapping(e){C(this,g,e,"f")}get contrast(){return x(this,b,"f")}set contrast(e){C(this,b,e,"f")}get exposure(){return x(this,w,"f")}set exposure(e){C(this,w,e,"f")}get ssao(){return x(this,A,"f")}set ssao(e){C(this,A,e,"f")}get clearColor(){return x(this,M,"f")}set clearColor(e){C(this,M,e,"f")}get cameraAutoOrbit(){return x(this,S,"f")}set cameraAutoOrbit(e){C(this,S,e,"f")}get cameraAutoOrbitSpeed(){return x(this,k,"f")}set cameraAutoOrbitSpeed(e){C(this,k,e,"f")}get cameraAutoOrbitDelay(){return x(this,P,"f")}set cameraAutoOrbitDelay(e){C(this,P,e,"f")}get hotSpots(){return x(this,E,"f")}set hotSpots(e){C(this,E,e,"f")}get _hasHotSpots(){return Object.keys(this.hotSpots).length>0}get animationAutoPlay(){return x(this,O,"f")}set animationAutoPlay(e){C(this,O,e,"f")}get animations(){return this._animations}get _hasAnimations(){return this._animations.length>0}get selectedAnimation(){return x(this,B,"f")}set selectedAnimation(e){C(this,B,e,"f")}get isAnimationPlaying(){return this._isAnimationPlaying}get animationSpeed(){return x(this,I,"f")}set animationSpeed(e){C(this,I,e,"f")}get animationProgress(){return x(this,$,"f")}set animationProgress(e){C(this,$,e,"f")}get _animations(){return x(this,L,"f")}set _animations(e){C(this,L,e,"f")}get _isAnimationPlaying(){return x(this,R,"f")}set _isAnimationPlaying(e){C(this,R,e,"f")}get _showAnimationSlider(){return x(this,N,"f")}set _showAnimationSlider(e){C(this,N,e,"f")}get materialVariants(){return this._viewer?.materialVariants??[]}get selectedMaterialVariant(){return x(this,V,"f")}set selectedMaterialVariant(e){C(this,V,e,"f")}get camerasAsHotSpots(){return x(this,z,"f")}set camerasAsHotSpots(e){C(this,z,e,"f")}get resetMode(){return x(this,F,"f")}set resetMode(e){C(this,F,e,"f")}get _canvasContainer(){return x(this,D,"f")}set _canvasContainer(e){C(this,D,e,"f")}get _hotSpotSelect(){return x(this,G,"f")}set _hotSpotSelect(e){C(this,G,e,"f")}toggleAnimation(){this._viewer?.toggleAnimation()}reset(){this._reset(this.resetMode)}_reset(e){switch(e){case"auto":this._viewer?.resetCamera(void 0);break;case"reframe":this._viewer?.resetCamera(!0);break;default:this._viewer?.reset(...e)}}resetCamera(){this._reset("reframe")}reload(){this._tearDownViewer(),this._setupViewer()}connectedCallback(){super.connectedCallback(),this._setupViewer()}disconnectedCallback(){super.disconnectedCallback(),this._tearDownViewer()}attributeChangedCallback(e,t,n){if(super.attributeChangedCallback(e,t,n),this.hasUpdated)if("camera-orbit"==e){const e=Je(n);e?this._viewer?.updateCamera({alpha:e[0],beta:e[1],radius:e[2]}):this._viewer?.resetCamera(!1)}else if("camera-target"==e){const e=Je(n);e?this._viewer?.updateCamera({targetX:e[0],targetY:e[1],targetZ:e[2]}):this._viewer?.resetCamera(!1)}}update(e){super.update(e),this._hotSpotSelect&&(this._hotSpotSelect.value=""),this._needsReload(e)?(this._tearDownViewer(),this._setupViewer()):(this._propertyBindings.filter(t=>e.has(t.property)).forEach(e=>e.updateViewer()),(e.has("source")||e.has("useOpenPBR"))&&this._updateModel(),(e.has("environmentLighting")||e.has("environmentSkybox"))&&this._updateEnv({lighting:e.has("environmentLighting"),skybox:e.has("environmentSkybox")}),e.has("shadowQuality")&&this._updateShadows(this.shadowQuality))}_needsReload(e){return null!=e.get("renderWhenIdle")}render(){return be`<div class="full-size"><div id="canvasContainer" class="full-size"></div>${this._renderOverlay()}</div>`}_renderProgressBar(){const e=!1!==this.loadingProgress,t="boolean"==typeof this.loadingProgress?0:100*this.loadingProgress,n=!0===this.loadingProgress;return be`<div part="progress-bar" class="bar loading-progress-outer ${e?"":"loading-progress-outer-inactive"}" aria-label="Loading Progress"><div class="loading-progress-inner ${n?"loading-progress-inner-indeterminate":""}" style="${n?"":`width: ${t}%`}"></div></div>`}_renderToolbar(){let e=[];if(this._viewer?.isModelLoaded){this._hasAnimations&&e.push(be`<div class="animation-timeline"><button aria-label="${this.isAnimationPlaying?"Pause":"Play"}" @click="${this.toggleAnimation}">${this.isAnimationPlaying?be`<svg viewBox="0 0 24 24"><path d="${"M5.74609 3C4.7796 3 3.99609 3.7835 3.99609 4.75V19.25C3.99609 20.2165 4.7796 21 5.74609 21H9.24609C10.2126 21 10.9961 20.2165 10.9961 19.25V4.75C10.9961 3.7835 10.2126 3 9.24609 3H5.74609ZM14.7461 3C13.7796 3 12.9961 3.7835 12.9961 4.75V19.25C12.9961 20.2165 13.7796 21 14.7461 21H18.2461C19.2126 21 19.9961 20.2165 19.9961 19.25V4.75C19.9961 3.7835 19.2126 3 18.2461 3H14.7461Z"}" fill="currentColor"></path></svg>`:be`<svg viewBox="0 0 24 24"><path d="${"M5 5.27368C5 3.56682 6.82609 2.48151 8.32538 3.2973L20.687 10.0235C22.2531 10.8756 22.2531 13.124 20.687 13.9762L8.32538 20.7024C6.82609 21.5181 5 20.4328 5 18.726V5.27368Z"}" fill="currentColor"></path></svg>`}</button> <input ${Ye(this._onAnimationSliderChanged)} aria-label="Animation Progress" class="animation-timeline-input" style="${this._showAnimationSlider?"":"visibility: hidden"}" type="range" min="0" max="1" step="0.0001" .value="${this.animationProgress}" @input="${this._onAnimationTimelineChanged}" @pointerdown="${this._onAnimationTimelinePointerDown}"></div><select aria-label="Select Animation Speed" @cha