@google/model-viewer
Version:
Easily display interactive 3D models on the web and in AR!
1,108 lines • 484 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ModelViewerElement={},e.three)}(this,function(e,t){"use strict";
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const i=globalThis,s=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),n=new WeakMap;let r=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==a)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 i=void 0!==t&&1===t.length;i&&(e=n.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&n.set(t,e))}return e}toString(){return this.cssText}};const o=s?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new r("string"==typeof e?e:e+"",void 0,a))(t)})(e):e,{is:A,defineProperty:l,getOwnPropertyDescriptor:c,getOwnPropertyNames:h,getOwnPropertySymbols:d,getPrototypeOf:g}=Object,p=globalThis,u=p.trustedTypes,m=u?u.emptyScript:"",b=p.reactiveElementPolyfillSupport,f=(e,t)=>e,I={toAttribute(e,t){switch(t){case Boolean:e=e?m:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},C=(e,t)=>!A(e,t),E={attribute:!0,type:String,converter:I,reflect:!1,useDefault:!1,hasChanged:C};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let y=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=E){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 i=Symbol(),s=this.getPropertyDescriptor(e,i,t);void 0!==s&&l(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:a}=c(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const n=s?.call(this);a?.call(this,t),this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??E}static _$Ei(){if(this.hasOwnProperty(f("elementProperties")))return;const e=g(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(f("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(f("properties"))){const e=this.properties,t=[...h(e),...d(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(o(e))}else void 0!==e&&t.push(o(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"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 i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);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 s of t){const t=document.createElement("style"),a=i.litNonce;void 0!==a&&t.setAttribute("nonce",a),t.textContent=s.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,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(void 0!==s&&!0===i.reflect){const a=(void 0!==i.converter?.toAttribute?i.converter:I).toAttribute(t,i.type);this._$Em=e,null==a?this.removeAttribute(s):this.setAttribute(s,a),this._$Em=null}}_$AK(e,t){const i=this.constructor,s=i._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=i.getPropertyOptions(s),a="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:I;this._$Em=s;const n=a.fromAttribute(t,e.type);this[s]=n??this._$Ej?.get(s)??n,this._$Em=null}}requestUpdate(e,t,i,s=!1,a){if(void 0!==e){const n=this.constructor;if(!1===s&&(a=this[e]),i??=n.getPropertyOptions(e),!((i.hasChanged??C)(a,t)||i.useDefault&&i.reflect&&a===this._$Ej?.get(e)&&!this.hasAttribute(n._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:a},n){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??t??this[e]),!0!==a||void 0!==n)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===s&&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,i]of e){const{wrapped:e}=i,s=this[t];!0!==e||this._$AL.has(t)||void 0===s||this.C(t,void 0,i,s)}}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){}};y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[f("elementProperties")]=new Map,y[f("finalized")]=new Map,b?.({ReactiveElement:y}),(p.reactiveElementVersions??=[]).push("2.1.2");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const B=globalThis,w=e=>e,x=B.trustedTypes,v=x?x.createPolicy("lit-html",{createHTML:e=>e}):void 0,S="$lit$",Q=`lit$${Math.random().toFixed(9).slice(2)}$`,M="?"+Q,R=`<${M}>`,T=document,D=()=>T.createComment(""),F=e=>null===e||"object"!=typeof e&&"function"!=typeof e,k=Array.isArray,L="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,U=/>/g,G=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),N=/'/g,O=/"/g,q=/^(?:script|style|textarea|title)$/i,H=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),j=Symbol.for("lit-noChange"),z=Symbol.for("lit-nothing"),K=new WeakMap,V=T.createTreeWalker(T,129);function J(e,t){if(!k(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==v?v.createHTML(t):t}const W=(e,t)=>{const i=e.length-1,s=[];let a,n=2===t?"<svg>":3===t?"<math>":"",r=P;for(let t=0;t<i;t++){const i=e[t];let o,A,l=-1,c=0;for(;c<i.length&&(r.lastIndex=c,A=r.exec(i),null!==A);)c=r.lastIndex,r===P?"!--"===A[1]?r=_:void 0!==A[1]?r=U:void 0!==A[2]?(q.test(A[2])&&(a=RegExp("</"+A[2],"g")),r=G):void 0!==A[3]&&(r=G):r===G?">"===A[0]?(r=a??P,l=-1):void 0===A[1]?l=-2:(l=r.lastIndex-A[2].length,o=A[1],r=void 0===A[3]?G:'"'===A[3]?O:N):r===O||r===N?r=G:r===_||r===U?r=P:(r=G,a=void 0);const h=r===G&&e[t+1].startsWith("/>")?" ":"";n+=r===P?i+R:l>=0?(s.push(o),i.slice(0,l)+S+i.slice(l)+Q+h):i+Q+(-2===l?t:h)}return[J(e,n+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]};let Y=class e{constructor({strings:t,_$litType$:i},s){let a;this.parts=[];let n=0,r=0;const o=t.length-1,A=this.parts,[l,c]=W(t,i);if(this.el=e.createElement(l,s),V.currentNode=this.el.content,2===i||3===i){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=V.nextNode())&&A.length<o;){if(1===a.nodeType){if(a.hasAttributes())for(const e of a.getAttributeNames())if(e.endsWith(S)){const t=c[r++],i=a.getAttribute(e).split(Q),s=/([.?@])?(.*)/.exec(t);A.push({type:1,index:n,name:s[2],strings:i,ctor:"."===s[1]?te:"?"===s[1]?ie:"@"===s[1]?se:ee}),a.removeAttribute(e)}else e.startsWith(Q)&&(A.push({type:6,index:n}),a.removeAttribute(e));if(q.test(a.tagName)){const e=a.textContent.split(Q),t=e.length-1;if(t>0){a.textContent=x?x.emptyScript:"";for(let i=0;i<t;i++)a.append(e[i],D()),V.nextNode(),A.push({type:2,index:++n});a.append(e[t],D())}}}else if(8===a.nodeType)if(a.data===M)A.push({type:2,index:n});else{let e=-1;for(;-1!==(e=a.data.indexOf(Q,e+1));)A.push({type:7,index:n}),e+=Q.length-1}n++}}static createElement(e,t){const i=T.createElement("template");return i.innerHTML=e,i}};function X(e,t,i=e,s){if(t===j)return t;let a=void 0!==s?i._$Co?.[s]:i._$Cl;const n=F(t)?void 0:t._$litDirective$;return a?.constructor!==n&&(a?._$AO?.(!1),void 0===n?a=void 0:(a=new n(e),a._$AT(e,i,s)),void 0!==s?(i._$Co??=[])[s]=a:i._$Cl=a),void 0!==a&&(t=X(e,a._$AS(e,t.values),a,s)),t}class ${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:i}=this._$AD,s=(e?.creationScope??T).importNode(t,!0);V.currentNode=s;let a=V.nextNode(),n=0,r=0,o=i[0];for(;void 0!==o;){if(n===o.index){let t;2===o.type?t=new Z(a,a.nextSibling,this,e):1===o.type?t=new o.ctor(a,o.name,o.strings,this,e):6===o.type&&(t=new ae(a,this,e)),this._$AV.push(t),o=i[++r]}n!==o?.index&&(a=V.nextNode(),n++)}return V.currentNode=T,s}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class Z{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=z,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.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=X(this,e,t),F(e)?e===z||null==e||""===e?(this._$AH!==z&&this._$AR(),this._$AH=z):e!==this._$AH&&e!==j&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>k(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!==z&&F(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,s="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=Y.createElement(J(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new $(s,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=K.get(e.strings);return void 0===t&&K.set(e.strings,t=new Y(e)),t}k(e){k(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const a of e)s===t.length?t.push(i=new Z(this.O(D()),this.O(D()),this,this.options)):i=t[s],i._$AI(a),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=w(e).nextSibling;w(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,i,s,a){this.type=1,this._$AH=z,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=a,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=z}_$AI(e,t=this,i,s){const a=this.strings;let n=!1;if(void 0===a)e=X(this,e,t,0),n=!F(e)||e!==this._$AH&&e!==j,n&&(this._$AH=e);else{const s=e;let r,o;for(e=a[0],r=0;r<a.length-1;r++)o=X(this,s[i+r],t,r),o===j&&(o=this._$AH[r]),n||=!F(o)||o!==this._$AH[r],o===z?e=z:e!==z&&(e+=(o??"")+a[r+1]),this._$AH[r]=o}n&&!s&&this.j(e)}j(e){e===z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}let te=class extends ee{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===z?void 0:e}};class ie extends ee{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==z)}}class se extends ee{constructor(e,t,i,s,a){super(e,t,i,s,a),this.type=5}_$AI(e,t=this){if((e=X(this,e,t,0)??z)===j)return;const i=this._$AH,s=e===z&&i!==z||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,a=e!==z&&(i===z||s);s&&this.element.removeEventListener(this.name,this,i),a&&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 ae{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){X(this,e)}}const ne=B.litHtmlPolyfillSupport;ne?.(Y,Z),(B.litHtmlVersions??=[]).push("3.3.3");const re=(e,t,i)=>{const s=i?.renderBefore??t;let a=s._$litPart$;if(void 0===a){const e=i?.renderBefore??null;s._$litPart$=a=new Z(t.insertBefore(D(),e),e,void 0,i??{})}return a._$AI(e),a
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/},oe=globalThis;let Ae=class extends y{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=re(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return j}};Ae._$litElement$=!0,Ae.finalized=!0,oe.litElementHydrateSupport?.({LitElement:Ae});const le=oe.litElementPolyfillSupport;le?.({LitElement:Ae}),(oe.litElementVersions??=[]).push("4.2.2");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const ce={attribute:!0,type:String,converter:I,reflect:!1,hasChanged:C},he=(e=ce,t,i)=>{const{kind:s,metadata:a}=i;let n=globalThis.litPropertyMetadata.get(a);if(void 0===n&&globalThis.litPropertyMetadata.set(a,n=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),n.set(i.name,e),"accessor"===s){const{name:s}=i;return{set(i){const a=t.get.call(this);t.set.call(this,i),this.requestUpdate(s,a,e,!0,i)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=i;return function(i){const a=this[s];t.call(this,i),this.requestUpdate(s,a,e,!0,i)}}throw Error("Unsupported decorator location: "+s)};function de(e){return(t,i)=>"object"==typeof i?he(e,t,i):((e,t,i)=>{const s=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),s?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)}
/* @license
* Copyright 2026 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var ge=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};class pe extends y{constructor(){super(...arguments),this.src=null,this.offset=null,this.orientation=null,this.scale=null,this.background=!1}static get is(){return"extra-model"}updated(e){if(super.updated(e),e.has("src")||e.has("offset")||e.has("orientation")||e.has("scale")||e.has("background")){const t=e.has("src");this.dispatchEvent(new CustomEvent("extra-model-changed",{bubbles:!0,composed:!0,detail:{srcChanged:t,src:this.src,offset:this.offset,orientation:this.orientation,scale:this.scale,background:this.background}}))}}}ge([de({type:String})],pe.prototype,"src",void 0),ge([de({type:String})],pe.prototype,"offset",void 0),ge([de({type:String})],pe.prototype,"orientation",void 0),ge([de({type:String})],pe.prototype,"scale",void 0),ge([de({type:Boolean})],pe.prototype,"background",void 0),customElements.define("extra-model",pe);
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const ue=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,me=ue&&null!=self.XRSession.prototype.requestHitTestSource,be=null!=self.ResizeObserver,fe=null!=self.IntersectionObserver,Ie=me;(()=>{const e=navigator.userAgent||navigator.vendor||self.opera;let t=!1;(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0)})();const Ce=/android/i.test(navigator.userAgent),Ee=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,ye=/firefox/i.test(navigator.userAgent),Be=/OculusBrowser/.test(navigator.userAgent),we=Ee&&/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent),xe=Ee&&/GSA\//.test(navigator.userAgent),ve=Ce&&!ye&&!Be;Boolean(window.webkit&&window.webkit.messageHandlers);const Se=(()=>{if(Ee){if(we)return!0;const e=document.createElement("a");return Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))}return!1})(),Qe=e=>e&&"null"!==e?Re(e):null,Me=()=>{if(Ie)return;const e=[];throw ue||e.push("WebXR Device API"),me||e.push("WebXR Hit Test API"),new Error(`The following APIs are required for AR, but are missing in this browser: ${e.join(", ")}`)},Re=e=>new URL(e,window.location.toString()).toString(),Te=(e,t)=>{let i=null;return(...s)=>{null!=i&&self.clearTimeout(i),i=self.setTimeout(()=>{i=null,e(...s)},t)}},De=(e,t,i)=>Math.max(t,Math.min(i,e)),Fe=(()=>{const e=new RegExp("[?&]model-viewer-debug-mode(&|$)");return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)})();
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var ke=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const Le=Symbol("currentEnvironmentMap"),Pe=Symbol("currentBackground"),_e=Symbol("updateEnvironment"),Ue=Symbol("cancelEnvironmentUpdate");
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const Ge=H`
<style>
:host {
display: block;
position: relative;
contain: strict;
width: 300px;
height: 150px;
}
.container {
position: relative;
overflow: hidden;
}
.userInput {
width: 100%;
height: 100%;
display: none;
position: relative;
outline-offset: -1px;
outline-width: 1px;
}
canvas {
position: absolute;
display: none;
pointer-events: none;
/* NOTE(cdata): Chrome 76 and below apparently have a bug
* that causes our canvas not to display pixels unless it is
* on its own render layer
* @see https://github.com/google/model-viewer/pull/755#issuecomment-536597893
*/
transform: translateZ(0);
}
.show {
display: block;
}
/* Adapted from HTML5 Boilerplate
*
* @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */
.screen-reader-only {
border: 0;
left: 0;
top: 0;
clip: rect(0, 0, 0, 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
white-space: nowrap;
width: 1px;
pointer-events: none;
}
.slot {
position: absolute;
pointer-events: none;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.slot > * {
pointer-events: initial;
}
.annotation-wrapper ::slotted(*) {
opacity: var(--max-hotspot-opacity, 1);
transition: opacity 0.3s;
}
.pointer-tumbling .annotation-wrapper ::slotted(*) {
pointer-events: none;
}
.annotation-wrapper ::slotted(*) {
pointer-events: initial;
}
.annotation-wrapper.hide:not(:focus-within) ::slotted(*) {
opacity: var(--min-hotspot-opacity, 0.25);
}
.slot.poster {
display: none;
background-color: inherit;
}
.slot.poster.show {
display: inherit;
}
.slot.poster > * {
pointer-events: initial;
}
.slot.poster:not(.show) > * {
pointer-events: none;
}
#default-poster {
width: 100%;
height: 100%;
/* The default poster is a <button> so we need to set display
* to prevent it from being affected by text-align: */
display: block;
position: absolute;
border: none;
padding: 0;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
background-color: #fff0;
}
#default-progress-bar {
display: block;
position: relative;
width: 100%;
height: 100%;
pointer-events: none;
overflow: hidden;
}
#default-progress-bar > .bar {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: var(--progress-bar-height, 5px);
background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4));
transition: transform 0.09s;
transform-origin: top left;
transform: scaleX(0);
overflow: hidden;
}
#default-progress-bar > .bar.hide {
transition: opacity 0.3s 1s;
opacity: 0;
}
.centered {
align-items: center;
justify-content: center;
}
.cover {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
}
.slot.interaction-prompt {
display: var(--interaction-prompt-display, flex);
overflow: hidden;
opacity: 0;
will-change: opacity;
transition: opacity 0.3s;
}
.slot.interaction-prompt.visible {
opacity: 1;
}
.animated-container {
will-change: transform, opacity;
opacity: 0;
transition: opacity 0.3s;
}
.slot.interaction-prompt > * {
pointer-events: none;
}
.slot.ar-button {
-moz-user-select: none;
-webkit-tap-highlight-color: transparent;
user-select: none;
display: var(--ar-button-display, block);
}
.slot.ar-button:not(.enabled) {
display: none;
}
.fab {
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
width: 40px;
height: 40px;
cursor: pointer;
background-color: #fff;
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15);
border-radius: 100px;
}
.fab > * {
opacity: 0.87;
}
#default-ar-button {
position: absolute;
bottom: 16px;
right: 16px;
transform: scale(var(--ar-button-scale, 1));
transform-origin: bottom right;
}
.slot.pan-target {
display: block;
position: absolute;
width: 0;
height: 0;
left: 50%;
top: 50%;
transform: translate3d(-50%, -50%, 0);
background-color: transparent;
opacity: 0;
transition: opacity 0.3s;
}
#default-pan-target {
width: 6px;
height: 6px;
border-radius: 6px;
border: 1px solid white;
box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.8);
}
.slot.default {
pointer-events: none;
}
.slot.progress-bar {
pointer-events: none;
}
.slot.exit-webxr-ar-button {
pointer-events: none;
}
.slot.exit-webxr-ar-button > slot,
.slot.exit-webxr-ar-button ::slotted(*) {
pointer-events: auto;
}
.slot.exit-webxr-ar-button:not(.enabled) {
display: none;
}
#default-exit-webxr-ar-button {
pointer-events: auto;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: env(safe-area-inset-top, 16px);
right: 16px;
width: 40px;
height: 40px;
box-sizing: border-box;
}
#default-exit-webxr-ar-button > svg {
fill: #fff;
}
</style>
<div class="container">
<div class="userInput" tabindex="0" role="img"
aria-label="3D model">
<div class="slot canvas">
<slot name="canvas">
<canvas></canvas>
</slot>
</div>
</div>
<!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM
will have their <slot> elements removed by ShadyCSS -->
<div class="slot poster">
<slot name="poster">
<button type="button" id="default-poster" aria-hidden="true" aria-label="Loading 3D model"></button>
</slot>
</div>
<div class="slot ar-button">
<slot name="ar-button">
<a id="default-ar-button" part="default-ar-button" class="fab"
tabindex="2"
role="button"
href="javascript:void(0);"
aria-label="View in your space">
${H`
<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px"
viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/>
<g id="Art_layer">
<path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/>
<path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/>
<path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/>
<path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/>
<g>
<path d="M18.25,7.6l-5.5-3.18c-0.46-0.27-1.04-0.27-1.5,0L5.75,7.6C5.29,7.87,5,8.36,5,8.9v6.35c0,0.54,0.29,1.03,0.75,1.3
l5.5,3.18c0.46,0.27,1.04,0.27,1.5,0l5.5-3.18c0.46-0.27,0.75-0.76,0.75-1.3V8.9C19,8.36,18.71,7.87,18.25,7.6z M7,14.96v-4.62
l4,2.32v4.61L7,14.96z M12,10.93L8,8.61l4-2.31l4,2.31L12,10.93z M13,17.27v-4.61l4-2.32v4.62L13,17.27z"/>
</g>
</g>
</svg>`}
</a>
</slot>
</div>
<div class="slot pan-target">
<slot name="pan-target">
<div id="default-pan-target">
</div>
</slot>
</div>
<div class="slot interaction-prompt cover centered">
<div id="prompt" class="animated-container">
<slot name="interaction-prompt" aria-hidden="true">
${H`
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36">
<defs>
<path id="A" d="M.001.232h24.997V36H.001z" />
</defs>
<g transform="translate(-11 -4)" fill="none" fill-rule="evenodd">
<path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" />
<g transform="translate(11 3)">
<path d="M8.733 11.165c.04-1.108.766-2.027 1.743-2.307a2.54 2.54 0 0 1 .628-.089c.16 0 .314.017.463.044 1.088.2 1.9 1.092 1.9 2.16v8.88h1.26c2.943-1.39 5-4.45 5-8.025a9.01 9.01 0 0 0-1.9-5.56l-.43-.5c-.765-.838-1.683-1.522-2.712-2-1.057-.49-2.226-.77-3.46-.77s-2.4.278-3.46.77c-1.03.478-1.947 1.162-2.71 2l-.43.5a9.01 9.01 0 0 0-1.9 5.56 9.04 9.04 0 0 0 .094 1.305c.03.21.088.41.13.617l.136.624c.083.286.196.56.305.832l.124.333a8.78 8.78 0 0 0 .509.953l.065.122a8.69 8.69 0 0 0 3.521 3.191l1.11.537v-9.178z" fill-opacity=".5" fill="#e4e4e4" />
<path d="M22.94 26.218l-2.76 7.74c-.172.485-.676.8-1.253.8H12.24c-1.606 0-3.092-.68-3.98-1.82-1.592-2.048-3.647-3.822-6.11-5.27-.095-.055-.15-.137-.152-.23-.004-.1.046-.196.193-.297.56-.393 1.234-.6 1.926-.6a3.43 3.43 0 0 1 .691.069l4.922.994V10.972c0-.663.615-1.203 1.37-1.203s1.373.54 1.373 1.203v9.882h2.953c.273 0 .533.073.757.21l6.257 3.874c.027.017.045.042.07.06.41.296.586.77.426 1.22M4.1 16.614c-.024-.04-.042-.083-.065-.122a8.69 8.69 0 0 1-.509-.953c-.048-.107-.08-.223-.124-.333l-.305-.832c-.058-.202-.09-.416-.136-.624l-.13-.617a9.03 9.03 0 0 1-.094-1.305c0-2.107.714-4.04 1.9-5.56l.43-.5c.764-.84 1.682-1.523 2.71-2 1.058-.49 2.226-.77 3.46-.77s2.402.28 3.46.77c1.03.477 1.947 1.16 2.712 2l.428.5a9 9 0 0 1 1.901 5.559c0 3.577-2.056 6.636-5 8.026h-1.26v-8.882c0-1.067-.822-1.96-1.9-2.16-.15-.028-.304-.044-.463-.044-.22 0-.427.037-.628.09-.977.28-1.703 1.198-1.743 2.306v9.178l-1.11-.537C6.18 19.098 4.96 18 4.1 16.614M22.97 24.09l-6.256-3.874c-.102-.063-.218-.098-.33-.144 2.683-1.8 4.354-4.855 4.354-8.243 0-.486-.037-.964-.104-1.43a9.97 9.97 0 0 0-1.57-4.128l-.295-.408-.066-.092a10.05 10.05 0 0 0-.949-1.078c-.342-.334-.708-.643-1.094-.922-1.155-.834-2.492-1.412-3.94-1.65l-.732-.088-.748-.03a9.29 9.29 0 0 0-1.482.119c-1.447.238-2.786.816-3.94 1.65a9.33 9.33 0 0 0-.813.686 9.59 9.59 0 0 0-.845.877l-.385.437-.36.5-.288.468-.418.778-.04.09c-.593 1.28-.93 2.71-.93 4.222 0 3.832 2.182 7.342 5.56 8.938l1.437.68v4.946L5 25.64a4.44 4.44 0 0 0-.888-.086c-.017 0-.034.003-.05.003-.252.004-.503.033-.75.08a5.08 5.08 0 0 0-.237.056c-.193.046-.382.107-.568.18-.075.03-.15.057-.225.1-.25.114-.494.244-.723.405a1.31 1.31 0 0 0-.566 1.122 1.28 1.28 0 0 0 .645 1.051C4 29.925 5.96 31.614 7.473 33.563a5.06 5.06 0 0 0 .434.491c1.086 1.082 2.656 1.713 4.326 1.715h6.697c.748-.001 1.43-.333 1.858-.872.142-.18.256-.38.336-.602l2.757-7.74c.094-.26.13-.53.112-.794s-.088-.52-.203-.76a2.19 2.19 0 0 0-.821-.91" fill-opacity=".6" fill="#000" />
<path d="M22.444 24.94l-6.257-3.874a1.45 1.45 0 0 0-.757-.211h-2.953v-9.88c0-.663-.616-1.203-1.373-1.203s-1.37.54-1.37 1.203v16.643l-4.922-.994a3.44 3.44 0 0 0-.692-.069 3.35 3.35 0 0 0-1.925.598c-.147.102-.198.198-.194.298.004.094.058.176.153.23 2.462 1.448 4.517 3.22 6.11 5.27.887 1.14 2.373 1.82 3.98 1.82h6.686c.577 0 1.08-.326 1.253-.8l2.76-7.74c.16-.448-.017-.923-.426-1.22-.025-.02-.043-.043-.07-.06z" fill="#fff" />
<g transform="translate(0 .769)">
<mask id="B" fill="#fff">
<use xlink:href="#A" />
</mask>
<path d="M23.993 24.992a1.96 1.96 0 0 1-.111.794l-2.758 7.74c-.08.22-.194.423-.336.602-.427.54-1.11.87-1.857.872h-6.698c-1.67-.002-3.24-.633-4.326-1.715-.154-.154-.3-.318-.434-.49C5.96 30.846 4 29.157 1.646 27.773c-.385-.225-.626-.618-.645-1.05a1.31 1.31 0 0 1 .566-1.122 4.56 4.56 0 0 1 .723-.405l.225-.1a4.3 4.3 0 0 1 .568-.18l.237-.056c.248-.046.5-.075.75-.08.018 0 .034-.003.05-.003.303-.001.597.027.89.086l3.722.752V20.68l-1.436-.68c-3.377-1.596-5.56-5.106-5.56-8.938 0-1.51.336-2.94.93-4.222.015-.03.025-.06.04-.09.127-.267.268-.525.418-.778.093-.16.186-.316.288-.468.063-.095.133-.186.2-.277L3.773 5c.118-.155.26-.29.385-.437.266-.3.544-.604.845-.877a9.33 9.33 0 0 1 .813-.686C6.97 2.167 8.31 1.59 9.757 1.35a9.27 9.27 0 0 1 1.481-.119 8.82 8.82 0 0 1 .748.031c.247.02.49.05.733.088 1.448.238 2.786.816 3.94 1.65.387.28.752.588 1.094.922a9.94 9.94 0 0 1 .949 1.078l.066.092c.102.133.203.268.295.408a9.97 9.97 0 0 1 1.571 4.128c.066.467.103.945.103 1.43 0 3.388-1.67 6.453-4.353 8.243.11.046.227.08.33.144l6.256 3.874c.37.23.645.55.82.9.115.24.185.498.203.76m.697-1.195c-.265-.55-.677-1.007-1.194-1.326l-5.323-3.297c2.255-2.037 3.564-4.97 3.564-8.114 0-2.19-.637-4.304-1.84-6.114-.126-.188-.26-.37-.4-.552-.645-.848-1.402-1.6-2.252-2.204C15.472.91 13.393.232 11.238.232A10.21 10.21 0 0 0 5.23 2.19c-.848.614-1.606 1.356-2.253 2.205-.136.18-.272.363-.398.55C1.374 6.756.737 8.87.737 11.06c0 4.218 2.407 8.08 6.133 9.842l.863.41v3.092l-2.525-.51c-.356-.07-.717-.106-1.076-.106a5.45 5.45 0 0 0-3.14.996c-.653.46-1.022 1.202-.99 1.983a2.28 2.28 0 0 0 1.138 1.872c2.24 1.318 4.106 2.923 5.543 4.772 1.26 1.62 3.333 2.59 5.55 2.592h6.698c1.42-.001 2.68-.86 3.134-2.138l2.76-7.74c.272-.757.224-1.584-.134-2.325" fill-opacity=".05" fill="#000" mask="url(#B)" />
</g>
</g>
</g>
</svg>`
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/}
</slot>
</div>
</div>
<div id="finger0" class="animated-container cover">
<slot name="finger0" aria-hidden="true">
</slot>
</div>
<div id="finger1" class="animated-container cover">
<slot name="finger1" aria-hidden="true">
</slot>
</div>
<div class="slot default">
<slot></slot>
<div class="slot progress-bar">
<slot name="progress-bar">
<div id="default-progress-bar" aria-hidden="true">
<div class="bar" part="default-progress-bar"></div>
</div>
</slot>
</div>
<div class="slot exit-webxr-ar-button">
<slot name="exit-webxr-ar-button">
<a id="default-exit-webxr-ar-button" part="default-exit-webxr-ar-button"
tabindex="3"
aria-label="Exit AR"
aria-hidden="true">
${H`
<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">
<!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement
support for dynamic re-coloring of UI components -->
<defs>
<filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%">
<feGaussianBlur in="SourceAlpha" stdDeviation="1"/>
<feOffset dx="0" dy="0" result="offsetblur"/>
<feFlood flood-color="#000000"/>
<feComposite in2="offsetblur" operator="in"/>
<feMerge>
<feMergeNode/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
</defs>
<path filter="url(#drop-shadow)" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</svg>`
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/}
</a>
</slot>
</div>
</div>
</div>
<div class="screen-reader-only" role="region" aria-label="Live announcements">
<span id="status" role="status"></span>
</div>`;var Ne=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var i,s=WebAssembly.validate(e)?n("b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuec:q:6dkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:Ctklbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk:183lYud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxavaialfgmar9Rgoad;8qbbcj;abad9Uc;WFbGcjdadca0EhPdndndnadTmbaoadfhscbhzinaeaz9nmdamax9RaD6miabazad2fhHaxaDfhOaPaeaz9RazaPfae6EgAcsfgocl4cifcd4hCavcj;cbfaoc9WGgXcetfhQavcj;cbfaXci2fhLavcj;cbfaXfhKcbhYaoc;ab6h8AincbhodnawTmbaxaYcd4fRbbhokaocFeGhEcbh3avcj;cbfh5indndndndnaEa3cet4ciGgoc9:fPdebdkamaO9RaX6mwavcj;cbfa3aX2faOaX;8qbbaOaAfhOxdkavcj;cbfa3aX2fcbaX;8kbxekamaO9RaC6moaoclVcbawEhraOaCfhocbhidna8Ambamao9Rc;Gb6mbcbhlina5alfhidndndndndndnaOalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaoclffahc:q:yjjbfRbbfhoxikaiaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaocwffahc:q:yjjbfRbbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaaaocdffahc:q:yjjbfRbbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaoclffahc:q:yjjbfRbbfhoxikaiczfaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaocwffahc:q:yjjbfRbbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaaaocdffahc:q:yjjbfRbbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaoclffahc:q:yjjbfRbbfhoxikaicafaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaocwffahc:q:yjjbfRbbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaaaocdffahc:q:yjjbfRbbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngicitc:q1jjbfpbibaic:q:yjjbfRbbgipsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaiaoclffaqc:q:yjjbfRbbfhoxikaic8Wfaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngicitc:q1jjbfpbibaic:q:yjjbfRbbgipsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaiaocwffaqc:q:yjjbfRbbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitc:q1jjbfpbibaic:q:yjjbfRbbgipsaoRbegqcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqc:q:yjjbfRbbfhokalc;abfhialcjefaX0meaihlamao9Rc;Fb0mbkkdnaiaX9pmbaici4hlinamao9RcK6mwa5aifhqdndndndndndnaOaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spkbbaaaoclffahc:q:yjjbfRbbfhoxikaqaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spkbbaaaocwffahc:q:yjjbfRbbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpkbbaaaocdffahc:q:yjjbfRbbfhokalcdfhlaiczfgiaX6mbkkaohOaoTmoka5aXfh5a3cefg3cl9hmbkdndndndnawTmbasaYcd4fRbbglciGPlbedwbkaXTmdavcjdfaYfhlavaYfpbdbhgcbhoinalavcj;cbfaofpblbg8JaKaofpblbg8KpmbzeHdOiAlCvXoQrLg8LaQaofpblbg8MaLaofpblbg8NpmbzeHdOiAlCvXoQrLgypmbezHdiOAlvCXorQLg8Ecep9Ta8Epxeeeeeeeeeeeeeeeeg8Fp9op9Hp9rg8Eagp9Uggp9Abbbaladfglaga8Ea8Epmlvorlvorlvorlvorp9Uggp9Abbbaladfglaga8Ea8EpmwDqkwDqkwDqkwDqkp9Uggp9Abbbaladfglaga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bhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiaPfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaOfhiazaOfhxxekaxcbalRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhAascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhzaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkaOhlxekalcefhlkaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDclfaO87ebaDcdfaz87ebxekabarcdtfgDaABdbaDcwfaOBdbaDclfazBdbkavc;abfaocitfgDazBdbaDaABdlavaicdtfaABdbavc;abfaocefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfaocdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnaecvfal9nmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:2Pliur97eue978Jjjjjbc8W9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalaeSmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskaipxFubbFubbFubbFubbgxpklbdnalTmbcbhvabhdinadczfgmampbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraipblbaDaopmlvorxmPsCXQL358E8Fp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgPp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;MeawaqawaPp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oaoarpmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalaeSmbaiczfpxbbbbbbbbbbbbbbbbgopklbaiaopklbaiabalcitfgdaeciGglcitgv;8qbbaiaxpkladnalTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraipblaaDaopmlvorxmPsCXQL358E8Fp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgPp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;MeawaqawaPp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oaoarpmbezHdiOAlvCXorQLp9qpklbkadaiav;8qbbkk:Iwllue97euo978Jjjjjbca9Rhidnaec98GglTmbcbhvabhoinaocKfpx:ji:1S:ji:1S:ji:1S:ji:1SaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkpxibbbibbbibbbibbbp9qgxp;6ep;Negmaxaxp:1ep;7egxaxp;KearaDpmbediwDqkzHOAKY8AEgxczp:Reczp:Sep;6egrarp;Meaxczp:Sep;6egDaDp;Meaqczp:Reczp:Sep;6egqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gxp;KepxFFbbFFbbFFbbFFbbgPp9oamaDp;Meaxp;Keczp:Rep9qgDamarp;Meaxp;KeaPp9oamaqp;Meaxp;Keczp:Rep9qgxpmwDKYqk8AExm35Ps8E8Fgrp5eakclp:RegmpEi:T:j83ibawarp5bampEd:T:j83ibaocwfaDaxpmbezHdiOAlvCXorQLgxp5eampEe:T:j83ibaoaxp5bampEb:T:j83ibaocafhoavclfgval6mbkkdnalaeSmbaiczfpxbbbbbbbbbbbbbbbbgmpklbaiampklbaiabalcitfgoaeciGgvcitgw;8qbbdnavTmbaipx:ji:1S:ji:1S:ji:1S:ji:1SaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkpxibbbibbbibbbibbbp9qgxp;6ep;Negmaxaxp:1ep;7egxaxp;KearaDpmbediwDqkzHOAKY8AEgxczp:Reczp:Sep;6egrarp;Meaxczp:Sep;6egDaDp;Meaqczp:Reczp:Sep;6egqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gxp;KepxFFbbFFbbFFbbFFbbgPp9oamaDp;Meaxp;Keczp:Rep9qgDamarp;Meaxp;KeaPp9oamaqp;Meaxp;Keczp:Rep9qgxpmwDKYqk8AExm35Ps8E8Fgrp5eakclp:RegmpEi:T:j83iKaiarp5bampEd:T:j83izaiaDaxpmbezHdiOAlvCXorQLgxp5eampEe:T:j83iwaiaxp5bampEb:T:j83ibkaoaiaw;8qbbkk;uddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbadczfhdaeclfgeav6mbkkdnavalSmbaic8WfpxbbbbbbbbbbbbbbbbgopklbaicafaopklbaiczfaopklbaiaopklbaiabavcdtfgdalciGgecdtgv;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepklbkadaiav;8qbbkk:CPvdue97euw97eu8Jjjjjbc8W9Rhiaec98Ghldndnadcl9hmbaipxbbbbbbbbbbbbbbbbgvpklbdnalTmbcbhoabhdinadpbbbhradpxbbuJbbuJbbuJbbuJaipblbarcKp:Tep9qgwcep:Seawp9qgDcdp:SeaDp9qgDclp:SeaDp9qgqp;6ep;NegDarcwp:RecKp:SegkarpxFbbbFbbbFbbbFbbbgxp9ogmp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gPp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oaDamakp:Xearczp:RecKp:Segrp:Uep;6ep;MeaPp;Keaxp9op9qaDamakarp:Uep:Xep;6ep;MeaPp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qaDaqawcep:Rep9oawpxebbbebbbebbbebbbp9op9qp;6ep;MeaPp;KecKp:Rep9qpkbbadczfhdaoclfgoal6mbkkalaeSmeaiavpklaaicafabalcdtfgdaeciGglcdtgo;8qbbaiavpklbdnalTmbaipblahraipxbbuJbbuJbbuJbbuJaipblbarcKp:Tep9qgwcep:Seawp9qgDcdp:SeaDp9qgDclp:SeaDp9qgqp;6ep;NegDarcwp:RecKp:SegkarpxFbbbFbbbFbbbFbbbgxp9ogmp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gPp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oaDamakp:Xearczp:RecKp:Segrp:Uep;6ep;MeaPp;Keaxp9op9qaDamakarp:Uep:Xep;6ep;MeaPp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qaDaqawcep:Rep9oawpxebbbebbbebbbebbbp9op9qp;6ep;MeaPp;KecKp:Rep9qpklakadaicafao;8qbbskaipxbbbbbbbbbbbbbbbbgvpklbdnalTmbcbhoabhdinadczfgspxbFu9hbFu9hbFu9hbFu9hadpbbbgDaspbbbgPpmlvorxmPsCXQL358E8Fgmczp:Teaipblbp9qgrcep:Searp9qgwcdp:Seawp9qgwclp:Seawp9qgwcwp:Seawp9qgqp;6ep;NegwaDaPpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbgPp9ogkaDczp:Segxp:Ueamczp:Reczp:Segmp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gDp;KeaPp9oawakaxamp:Uep:Xep;6ep;MeaDp;Keczp:Rep9qgxawaqarcep:Rep9oarpxebbbebbbebbbebbbp9op9qp;6ep;MeaDp;Keczp:Reawamakp:Uep;6ep;MeaDp;KeaPp9op9qgrpmwDKYqk8AExm35Ps8E8FpkbbadaxarpmbezHdiOAlvCXorQLpkbbadcafhdaoclfgoal6mbkkalaeSmbaiczfpxbbbbbbbbbbbbbbbbgrpklbaiarpklbaiabalcitfgdaeciGglcitgo;8qbbaiavpkladnalTmbaipxbFu9hbFu9hbFu9hbFu9haipblbgDaipblzgPpmlvorxmPsCXQL358E8Fgmczp:Teaipblap9qgrcep:Searp9qgwcdp:Seawp9qgwclp:Seawp9qgwcwp:Seawp9qgqp;6ep;NegwaDaPpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbgPp9ogkaDczp:Segxp:Ueamczp:Reczp:Segmp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gDp;KeaPp9oawakaxamp:Uep:Xep;6ep;MeaDp;Keczp:Rep9qgxawaqarcep:Rep9oarpxebbbebbbebbbebbbp9op9qp;6ep;MeaDp;Keczp:Reawamakp:Uep;6ep;MeaDp;KeaPp9op9qgrpmwDKYqk8AExm35Ps8E8FpklzaiaxarpmbezHdiOAlvCXorQLpklbkadaiao;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz:Dbb"):n("b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuec:W:Odkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79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cba8KahcjeGcr4fghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fag9c8F1:NgicKtc8F91aha8J9c8N1:NfghRbbG86bbarc96fcbahaicjeGcr4fgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbb83bbarcwfaicwf8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbcbaocl49Rh8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E93aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:XseHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiaPfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaOfhiazaOfhxxekaxcbalRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhAascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhzaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkaOhlxekalcefhlkaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDclfaO87ebaDcdfaz87ebxekabarcdtfgDaABdbaDcwfaOBdbaDclfazBdbkavc;abfaocitfgDazBdbaDaABdlavaicdtfaABdbavc;abfaocefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfaocdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnaecvfal9nmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk::ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxabaiarcefciGfcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGfgkcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkabaiarcufciGfcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkabakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K1jjbgeabcifc98GfgbBd:K1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;teeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiaeydlBdlaiaeydwBdwaiaeydxBdxaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk:3eedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdxaialBdwaialBdlaialBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk81dbcjwk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:Kwkl8WNbb"),a=WebAssembly.instantiate(s,{}).then(function(e){(i=e.instance).exports.__wasm_call_ctors()});function n(e){for(var i=new Uint8Array(e.length),s=0;s<e.length;++s){var a=e.charCodeAt(s);i[s]=a>96?a-97:a>64?a-39:a+4}var n=0;for(s=0;s<e.length;++s)i[n++]=i[s]<60?t[i[s]]:64*(i[s]-60)+i[++s];return i.buffer.slice(0,n)}function r(e,t,i,s,a,n,r){var o=e.exports.sbrk,A=s+3&-4,l=o(A*a),c=o(n.length),h=new Uint8Array(e.exports.memory.buffer);h.set(n,c);var d=t(l,s,a,c,n.length);if(0==d&&r&&r(l,A,a),i.set(h.subarray(l,l+s*a)),o(l-o(0)),0!=d)throw new Error("Malformed buffer data: "+d)}var o={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp",COLOR:"meshopt_decodeFilterColor"},A={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},l=[],c=0;function h(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var i=e.data;t.pending-=i.count,t.requests[i.id][i.action](i.value),delete t.requests[i.id]},t}function d(e){var t=e.data;if(!t.id)return self.close();self.ready.then(function(e){try{var i=new Uint8Array(t.count*t.size);r(e,e.exports[t.mode],i,t.count,t.size,t.source,e.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:i},[i.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:"reject",value:e})}})}return{ready:a,supported:!0,useWorkers:function(e){!function(e){for(var t="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(s)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+d.name+";"+r.toString()+d.toString(),i=new Blob([t],{type:"text/javascript"}),a=URL.createObjectURL(i),n=l.length;n<e;++n)l[n]=h(a);for(n=e;n<l.length;++n)l[n].object.postMessage({});l.length=e,URL.revokeObjectURL(a)}(e)},decodeVertexBuffer:function(e,t,s,a,n){r(i,i.exports.meshopt_decodeVertexBuffer,e,t,s,a,i.exports[o[n]])},decodeIndexBuffer:function(e,t,s,a){r(i,i.exports.meshopt_decodeIndexBuffer,e,t,s,a)},decodeIndexSequence:function(e,t,s,a){r(i,i.exports.meshopt_decodeIndexSequence,e,t,s,a)},decodeGltfBuffer:function(e,t,s,a,n,l){r(i,i.exports[A[n]],e,t,s,a,i.exports[o[l]])},decodeGltfBufferAsync:function(e,t,s,n,h){return l.length>0?function(e,t,i,s,a){for(var n=l[0],r=1;r<l.length;++r)l[r].pending<n.pending&&(n=l[r]);return new Promise(function(r,o){var A=new Uint8Array(i),l=++c;n.pending+=e,n.requests[l]={resolve:r,reject:o},n.object.postMessage({id:l,count:e,size:t,source:A,mode:s,filter:a},[A.buffer])})}(e,t,s,A[n],o[h]):a.then(function(){var a=new Uint8Array(e*t);return r(i,i.exports[A[n]],a,e,t,s,i.exports[o[h]]),a})}}}();const Oe=new WeakMap;class qe extends t.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,i,s,a){const n=new t.FileLoader(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,e=>{this.parse(e,i,a)},s,a)}parse(e,i,s=()=>{}){this.decodeDracoFile(e,i,null,null,t.SRGBColorSpace,s).catch(s)}decodeDracoFile(e,i,s,a,n=t.LinearSRGBColorSpace,r=()=>{}){const o={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:a||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:n};return this.decodeGeometry(e,o).then(i).catch(r)}decodeGeometry(e,t){const i=JSON.stringify(t);if(Oe.has(e)){const t=Oe.get(e);if(t.key===i)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const a=this.workerNextTaskID++,n=e.byteLength,r=this._getWorker(a,n).then(i=>(s=i,new Promise((i,n)=>{s._callbacks[a]={resolve:i,reject:n},s.postMessage({type:"decode",id:a,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return r.catch(()=>!0).then(()=>{s&&a&&this._releaseTask(s,a)}),Oe.set(e,{key:i,promise:r}),r}_createGeometry(e){const i=new t.BufferGeometry;e.index&&i.setIndex(new t.BufferAttribute(e.index.array,1));for(let s=0;s<e.attributes.length;s++){const{name:a,array:n,itemSize:r,stride:o,vertexColorSpace:A}=e.attributes[s];let l;if(r===o)l=new t.BufferAttribute(n,r);else{const e=new t.InterleavedBuffer(n,o);l=new t.InterleavedBufferAttribute(e,r,0)}"color"===a&&(this._assignVertexColorSpace(l,A),l.normalized=n instanceof Float32Array==!1),i.setAttribute(a,l)}return i}_assignVertexColorSpace(e,i){if(i!==t.SRGBColorSpace)return;const s=new t.Color;for(let i=0,a=e.count;i<a;i++)s.fromBufferAttribute(e,i),t.ColorManagement.colorSpaceToWorking(s,t.SRGBColorSpace),e.setXYZ(i,s.r,s.g,s.b)}_loadLibrary(e,i){const s=new t.FileLoader(this.manager);return s.setPath(this.decoderPath),s.setResponseType(i),s.setWithCredentials(this.withCredentials),new Promise((t,i)=>{s.load(e,t,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{const i=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const s=He.toString(),a=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const i=t.data;switch(i.type){case"decode":e._callbacks[i.id].resolve(i);break;case"error":e._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}function He(){let e,t;function i(e,t,i,s,a,n){const r=i.num_points(),o=n.num_components(),A=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,a),l=o*a.BYTES_PER_ELEMENT,c=4*Math.ceil(l/4),h=c/a.BYTES_PER_ELEMENT,d=r*l,g=r*c,p=e._malloc(d);t.GetAttributeDataArrayForAllPoints(i,n,A,d,p);const u=new a(e.HEAPF32.buffer,p,d/a.BYTES_PER_ELEMENT);let m;if(l===c)m=u.slice();else{m=new a(g/a.BYTES_PER_ELEMENT);let e=0;for(let t=0,i=u.length;t<i;t++){for(let i=0;i<o;i++)m[e+i]=u[t*o+i];e+=h}}return e._free(p),{name:s,count:r,itemSize:o,array:m,stride:h}}onmessage=function(s){const a=s.data;switch(a.type){case"init":e=a.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":const s=a.buffer,n=a.taskConfig;t.then(e=>{const t=e.draco,r=new t.Decoder;try{const e=function(e,t,s,a){const n=a.attributeIDs,r=a.attributeTypes;let o,A;const l=t.GetEncodedGeometryType(s);if(l===e.TRIANGULAR_MESH)o=new e.Mesh,A=t.DecodeArrayToMesh(s,s.byteLength,o);else{if(l!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new e.PointCloud,A=t.DecodeArrayToPointCloud(s,s.byteLength,o)}if(!A.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+A.error_msg());const c={index:null,attributes:[]};for(const s in n){const A=self[r[s]];let l,h;if(a.useUniqueIDs)h=n[s],l=t.GetAttributeByUniqueId(o,h);else{if(h=t.GetAttributeId(o,e[n[s]]),-1===h)continue;l=t.GetAttribute(o,h)}const d=i(e,t,o,s,A,l);"color"===s&&(d.vertexColorSpace=a.vertexColorSpace),c.attributes.push(d)}l===e.TRIANGULAR_MESH&&(c.index=function(e,t,i){const s=i.num_faces(),a=3*s,n=4*a,r=e._malloc(n);t.GetTrianglesUInt32Array(i,n,r);const o=new Uint32Array(e.HEAPF32.buffer,r,a).slice();return e._free(r),{array:o,itemSize:1}}(e,t,o));return e.destroy(o),c}(t,r,new Int8Array(s),n),o=e.attributes.map(e=>e.array.buffer);e.index&&o.push(e.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:e},o)}catch(e){console.error(e),self.postMessage({type:"error",id:a.id,error:e.message})}finally{t.destroy(r)}})}}}function je(e,i){if(i===t.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(i===t.TriangleFanDrawMode||i===t.TriangleStripDrawMode){let s=e.getIndex();if(null===s){const t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<i.count;e++)t.push(e);e.setIndex(t),s=e.getIndex()}const a=s.count-2,n=[];if(i===t.TriangleFanDrawMode)for(let e=1;e<=a;e++)n.push(s.getX(0)),n.push(s.getX(e)),n.push(s.getX(e+1));else for(let e=0;e<a;e++)e%2==0?(n.push(s.getX(e)),n.push(s.getX(e+1)),n.push(s.getX(e+2))):(n.push(s.getX(e+2)),n.push(s.getX(e+1)),n.push(s.getX(e)));n.length/3!==a&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=e.clone();return r.setIndex(n),r.clearGroups(),r}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",i),e}function ze(e){const t=new Map,i=new Map,s=e.clone();return Ke(e,s,function(e,s){t.set(s,e),i.set(e,s)}),s.traverse(function(e){if(!e.isSkinnedMesh)return;const s=e,a=t.get(e),n=a.skeleton.bones;s.skeleton=a.skeleton.clone(),s.bindMatrix.copy(a.bindMatrix),s.skeleton.bones=n.map(function(e){return i.get(e)}),s.bind(s.skeleton,s.bindMatrix)}),s}function Ke(e,t,i){i(e,t);for(let s=0;s<e.children.length;s++)Ke(e.children[s],t.children[s],i)}class Ve extends t.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new et(e)}),this.register(function(e){return new tt(e)}),this.register(function(e){return new ct(e)}),this.register(function(e){return new ht(e)}),this.register(function(e){return new dt(e)}),this.register(function(e){return new st(e)}),this.register(function(e){return new at(e)}),this.register(function(e){return new nt(e)}),this.register(function(e){return new rt(e)}),this.register(function(e){return new Ze(e)}),this.register(function(e){return new ot(e)}),this.register(function(e){return new it(e)}),this.register(function(e){return new lt(e)}),this.register(function(e){return new At(e)}),this.register(function(e){return new Xe(e)}),this.register(function(e){return new gt(e,Ye.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new gt(e,Ye.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new pt(e)})}load(e,i,s,a){const n=this;let r;if(""!==this.resourcePath)r=this.resourcePath;else if(""!==this.path){const i=t.LoaderUtils.extractUrlBase(e);r=t.LoaderUtils.resolveURL(i,this.path)}else r=t.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const o=function(t){a?a(t):console.error(t),n.manager.itemError(e),n.manager.itemEnd(e)},A=new t.FileLoader(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,function(t){try{n.parse(t,r,function(t){i(t),n.manager.itemEnd(e)},o)}catch(e){o(e)}},s,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,s){let a;const n={},r={},o=new TextDecoder;if("string"==typeof e)a=JSON.parse(e);else if(e instanceof ArrayBuffer){if(o.decode(new Uint8Array(e,0,4))===ut){try{n[Ye.KHR_BINARY_GLTF]=new ft(e)}catch(e){return void(s&&s(e))}a=JSON.parse(n[Ye.KHR_BINARY_GLTF].content)}else a=JSON.parse(o.decode(e))}else a=e;if(void 0===a.asset||a.asset.version[0]<2)return void(s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const A=new jt(a,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});A.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](A);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),r[t.name]=t,n[t.name]=!0}if(a.extensionsUsed)for(let e=0;e<a.extensionsUsed.length;++e){const t=a.extensionsUsed[e],i=a.extensionsRequired||[];switch(t){case Ye.KHR_MATERIALS_UNLIT:n[t]=new $e;break;case Ye.KHR_DRACO_MESH_COMPRESSION:n[t]=new It(a,this.dracoLoader);break;case Ye.KHR_TEXTURE_TRANSFORM:n[t]=new Ct;break;case Ye.KHR_MESH_QUANTIZATION:n[t]=new Et;break;default:i.indexOf(t)>=0&&void 0===r[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}A.setExtensions(n),A.setPlugins(r),A.parse(i,s)}parseAsync(e,t){const i=this;return new Promise(function(s,a){i.parse(e,t,s,a)})}}function Je(){let e={};return{get:function(t){return e[t]},add:function(t,i){e[t]=i},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function We(e,t,i){const s=e.json.materials[t];return s.extensions&&s.extensions[i]?s.extensions[i]:null}const Ye={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Xe{constructor(e){this.parser=e,this.name=Ye.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,s=t.length;i<s;i++){const s=t[i];s.extensions&&s.extensions[this.name]&&void 0!==s.extensions[this.name].light&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const i=this.parser,s="light:"+e;let a=i.cache.get(s);if(a)return a;const n=i.json,r=((n.extensions&&n.extensions[this.name]||{}).lights||[])[e];let o;const A=new t.Color(16777215);void 0!==r.color&&A.setRGB(r.color[0],r.color[1],r.color[2],t.LinearSRGBColorSpace);const l=void 0!==r.range?r.range:0;switch(r.type){case"directional":o=new t.DirectionalLight(A),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new t.PointLight(A),o.distance=l;break;case"spot":o=new t.SpotLight(A),o.distance=l,r.spot=r.spot||{},r.spot.innerConeAngle=void 0!==r.spot.innerConeAngle?r.spot.innerConeAngle:0,r.spot.outerConeAngle=void 0!==r.spot.outerConeAngle?r.spot.outerConeAngle:Math.PI/4,o.angle=r.spot.outerConeAngle,o.penumbra=1-r.spot.innerConeAngle/r.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+r.type)}return o.position.set(0,0,0),Ut(o,r),void 0!==r.intensity&&(o.intensity=r.intensity),o.name=i.createUniqueName(r.name||"light_"+e),a=Promise.resolve(o),i.cache.add(s,a),a}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,i=this.parser,s=i.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;return void 0===a?null:this._loadLight(a).then(function(e){return i._getNodeRef(t.cache,a,e)})}}let $e=class{constructor(){this.name=Ye.KHR_MATERIALS_UNLIT}getMaterialType(){return t.MeshBasicMaterial}extendParams(e,i,s){const a=[];e.color=new t.Color(1,1,1),e.opacity=1;const n=i.pbrMetallicRoughness;if(n){if(Array.isArray(n.baseColorFactor)){const i=n.baseColorFactor;e.color.setRGB(i[0],i[1],i[2],t.LinearSRGBColorSpace),e.opacity=i[3]}void 0!==n.baseColorTexture&&a.push(s.assignTexture(e,"map",n.baseColorTexture,t.SRGBColorSpace))}return Promise.all(a)}},Ze=class{constructor(e){this.parser=e,this.name=Ye.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=We(this.parser,e,this.name);return null===i||void 0!==i.emissiveStrength&&(t.emissiveIntensity=i.emissiveStrength),Promise.resolve()}},et=class{constructor(e){this.parser=e,this.name=Ye.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return null!==We(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,i){const s=We(this.parser,e,this.name);if(null===s)return Promise.resolve();const a=[];if(void 0!==s.clearcoatFactor&&(i.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&a.push(this.parser.assignTexture(i,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(i.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&a.push(this.parser.assignTexture(i,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(a.push(this.parser.assignTexture(i,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){const e=s.clearcoatNormalTexture.scale;i.clearcoatNormalScale=new t.Vector2(e,e)}return Promise.all(a)}},tt=class{constructor(e){this.parser=e,this.name=Ye.KHR_MATERIALS_DISPERSION}getMaterialType(e){return null!==We(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=We(this.parser,e,this.name);return null===i||(t.dispersion=void 0!==i.dispersion?i.dispersion:0),Promise.resolve()}},it=class{constructor(e){this.parser=e,this.name=Ye.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return null!==We(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=We(this.parser,e,this.name);if(null===i)return Promise.resolve();const s=[];return void 0!==i.iridescenceFactor&&(t.iridescence=i.iridescenceFactor),void 0!==i.iridescenceTexture&&s.push(this.parser.assignTexture(t,"iridescenceMap",i.iridescenceTexture)),void 0!==i.iridescenceIor&&(t.iridescenceIOR=i.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==i.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),void 0!==i.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),void 0!==i.iridescenceThicknessTexture&&s.push(this.parser.assignTexture(t,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(s)}},st=class{constructor(e){this.parser=e,this.name=Ye.KHR_MATERIALS_SHEEN}getMaterialType(e){return null!==We(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,i){const s=We(this.parser,e,this.name);if(null===s)return Promise.resolve();const a=[];if(i.sheenColor=new t.Color(0,0,0),i.sheenRoughness=0,i.sheen=1,void 0!==s.sheenColorFactor){const e=s.sheenColorFactor;i.sheenColor.setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace)}return void 0!==s.sheenRoughnessFactor&&(i.sheenRoughness=s.sheenRoughnessFactor),void 0!==s.sheenColorTexture&&a.push(this.parser.assignTexture(i,"sheenColorMap",s.sheenColorTexture,t.SRGBColorSpace)),void 0!==s.sheenRoughnessTexture&&a.push(this.parser.assignTexture(i,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(a)}},at=class{constructor(e){this.parser=e,this.name=Ye.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return null!==We(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=We(this.parser,e,this.name);if(null===i)return Promise.resolve();const s=[];return void 0!==i.transmissionFactor&&(t.transmission=i.transmissionFactor),void 0!==i.transmissionTexture&&s.push(this.parser.assignTexture(t,"transmissionMap",i.transmissionTexture)),Promise.all(s)}},nt=class{constructor(e){this.parser=e,this.name=Ye.KHR_MATERIALS_VOLUME}getMaterialType(e){return null!==We(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,i){const s=We(this.parser,e,this.name);if(null===s)return Promise.resolve();const a=[];i.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&a.push(this.parser.assignTexture(i,"thicknessMap",s.thicknessTexture)),i.attenuationDistance=s.attenuationDistance||1/0;const n=s.attenuationColor||[1,1,1];return i.attenuationColor=(new t.Color).setRGB(n[0],n[1],n[2],t.LinearSRGBColorSpace),Promise.all(a)}},rt=class{constructor(e){this.parser=e,this.name=Ye.KHR_MATERIALS_IOR}getMaterialType(e){return null!==We(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=We(this.parser,e,this.name);return null===i||(t.ior=void 0!==i.ior?i.ior:1.5),Promise.resolve()}},ot=class{constructor(e){this.parser=e,this.name=Ye.KHR_MATERIALS_SPECULAR}getMaterialType(e){return null!==We(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,i){const s=We(this.parser,e,this.name);if(null===s)return Promise.resolve();const a=[];i.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&a.push(this.parser.assignTexture(i,"specularIntensityMap",s.specularTexture));const n=s.specularColorFactor||[1,1,1];return i.specularColor=(new t.Color).setRGB(n[0],n[1],n[2],t.LinearSRGBColorSpace),void 0!==s.specularColorTexture&&a.push(this.parser.assignTexture(i,"specularColorMap",s.specularColorTexture,t.SRGBColorSpace)),Promise.all(a)}},At=class{constructor(e){this.parser=e,this.name=Ye.EXT_MATERIALS_BUMP}getMaterialType(e){return null!==We(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=We(this.parser,e,this.name);if(null===i)return Promise.resolve();const s=[];return t.bumpScale=void 0!==i.bumpFactor?i.bumpFactor:1,void 0!==i.bumpTexture&&s.push(this.parser.assignTexture(t,"bumpMap",i.bumpTexture)),Promise.all(s)}},lt=class{constructor(e){this.parser=e,this.name=Ye.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return null!==We(this.parser,e,this.name)?t.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const i=We(this.parser,e,this.name);if(null===i)return Promise.resolve();const s=[];return void 0!==i.anisotropyStrength&&(t.anisotropy=i.anisotropyStrength),void 0!==i.anisotropyRotation&&(t.anisotropyRotation=i.anisotropyRotation),void 0!==i.anisotropyTexture&&s.push(this.parser.assignTexture(t,"anisotropyMap",i.anisotropyTexture)),Promise.all(s)}};class ct{constructor(e){this.parser=e,this.name=Ye.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,s=i.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const a=s.extensions[this.name],n=t.options.ktx2Loader;if(!n){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,a.source,n)}}class ht{constructor(e){this.parser=e,this.name=Ye.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,i=this.parser,s=i.json,a=s.textures[e];if(!a.extensions||!a.extensions[t])return null;const n=a.extensions[t],r=s.images[n.source];let o=i.textureLoader;if(r.uri){const e=i.options.manager.getHandler(r.uri);null!==e&&(o=e)}return i.loadTextureImage(e,n.source,o)}}class dt{constructor(e){this.parser=e,this.name=Ye.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,i=this.parser,s=i.json,a=s.textures[e];if(!a.extensions||!a.extensions[t])return null;const n=a.extensions[t],r=s.images[n.source];let o=i.textureLoader;if(r.uri){const e=i.options.manager.getHandler(r.uri);null!==e&&(o=e)}return i.loadTextureImage(e,n.source,o)}}class gt{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const e=i.extensions[this.name],s=this.parser.getDependency("buffer",e.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(t){const i=e.byteOffset||0,s=e.byteLength||0,n=e.count,r=e.byteStride,o=new Uint8Array(t,i,s);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(n,r,o,e.mode,e.filter).then(function(e){return e.buffer}):a.ready.then(function(){const t=new ArrayBuffer(n*r);return a.decodeGltfBuffer(new Uint8Array(t),n,r,o,e.mode,e.filter),t})})}return null}}let pt=class{constructor(e){this.name=Ye.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const i=this.parser.json,s=i.nodes[e];if(!s.extensions||!s.extensions[this.name]||void 0===s.mesh)return null;const a=i.meshes[s.mesh];for(const e of a.primitives)if(e.mode!==xt.TRIANGLES&&e.mode!==xt.TRIANGLE_STRIP&&e.mode!==xt.TRIANGLE_FAN&&void 0!==e.mode)return null;const n=s.extensions[this.name].attributes,r=[],o={};for(const e in n)r.push(this.parser.getDependency("accessor",n[e]).then(t=>(o[e]=t,o[e])));return r.length<1?null:(r.push(this.parser.createNodeMesh(e)),Promise.all(r).then(e=>{const i=e.pop(),s=i.isGroup?i.children:[i],a=e[0].count,n=[];for(const e of s){const i=new t.Matrix4,s=new t.Vector3,r=new t.Quaternion,A=new t.Vector3(1,1,1),l=new t.InstancedMesh(e.geometry,e.material,a);for(let e=0;e<a;e++)o.TRANSLATION&&s.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&r.fromBufferAttribute(o.ROTATION,e),o.SCALE&&A.fromBufferAttribute(o.SCALE,e),l.setMatrixAt(e,i.compose(s,r,A));for(const i in o)if("_COLOR_0"===i){const e=o[i];l.instanceColor=new t.InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==i&&"ROTATION"!==i&&"SCALE"!==i&&e.geometry.setAttribute(i,o[i]);t.Object3D.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),n.push(l)}return i.isGroup?(i.clear(),i.add(...n),i):n[0]}))}};const ut="glTF",mt=1313821514,bt=5130562;class ft{constructor(e){this.name=Ye.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==ut)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-12,a=new DataView(e,12);let n=0;for(;n<s;){const t=a.getUint32(n,!0);n+=4;const s=a.getUint32(n,!0);if(n+=4,s===mt){const s=new Uint8Array(e,12+n,t);this.content=i.decode(s)}else if(s===bt){const i=12+n;this.body=e.slice(i,i+t)}n+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class It{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Ye.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,i){const s=this.json,a=this.dracoLoader,n=e.extensions[this.name].bufferView,r=e.extensions[this.name].attributes,o={},A={},l={};for(const e in r){const t=Rt[e]||e.toLowerCase();o[t]=r[e]}for(const t in e.attributes){const i=Rt[t]||t.toLowerCase();if(void 0!==r[t]){const a=s.accessors[e.attributes[t]],n=vt[a.componentType];l[i]=n.name,A[i]=!0===a.normalized}}return i.getDependency("bufferView",n).then(function(e){return new Promise(function(i,s){a.decodeDracoFile(e,function(e){for(const t in e.attributes){const i=e.attributes[t],s=A[t];void 0!==s&&(i.normalized=s)}i(e)},o,l,t.LinearSRGBColorSpace,s)})})}}class Ct{constructor(){this.name=Ye.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class Et{constructor(){this.name=Ye.KHR_MESH_QUANTIZATION}}class yt extends t.Interpolant{constructor(e,t,i,s){super(e,t,i,s)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,s=this.valueSize,a=e*s*3+s;for(let e=0;e!==s;e++)t[e]=i[a+e];return t}interpolate_(e,t,i,s){const a=this.resultBuffer,n=this.sampleValues,r=this.valueSize,o=2*r,A=3*r,l=s-t,c=(i-t)/l,h=c*c,d=h*c,g=e*A,p=g-A,u=-2*d+3*h,m=d-h,b=1-u,f=m-h+c;for(let e=0;e!==r;e++){const t=n[p+e+r],i=n[p+e+o]*l,s=n[g+e+r],A=n[g+e]*l;a[e]=b*t+f*i+u*s+m*A}return a}}const Bt=new t.Quaternion;class wt extends yt{interpolate_(e,t,i,s){const a=super.interpolate_(e,t,i,s);return Bt.fromArray(a).normalize().toArray(a),a}}const xt={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},vt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},St={9728:t.NearestFilter,9729:t.LinearFilter,9984:t.NearestMipmapNearestFilter,9985:t.LinearMipmapNearestFilter,9986:t.NearestMipmapLinearFilter,9987:t.LinearMipmapLinearFilter},Qt={33071:t.ClampToEdgeWrapping,33648:t.MirroredRepeatWrapping,10497:t.RepeatWrapping},Mt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Rt={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Tt={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Dt={CUBICSPLINE:void 0,LINEAR:t.InterpolateLinear,STEP:t.InterpolateDiscrete},Ft="OPAQUE",kt="MASK",Lt="BLEND";function Pt(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new t.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:t.FrontSide})),e.DefaultMaterial}function _t(e,t,i){for(const s in i.extensions)void 0===e[s]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=i.extensions[s])}function Ut(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Gt(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let i=0,s=t.weights.length;i<s;i++)e.morphTargetInfluences[i]=t.weights[i];if(t.extras&&Array.isArray(t.extras.targetNames)){const i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(let t=0,s=i.length;t<s;t++)e.morphTargetDictionary[i[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Nt(e){let t;const i=e.extensions&&e.extensions[Ye.KHR_DRACO_MESH_COMPRESSION];if(t=i?"draco:"+i.bufferView+":"+i.indices+":"+Ot(i.attributes):e.indices+":"+Ot(e.attributes)+":"+e.mode,void 0!==e.targets)for(let i=0,s=e.targets.length;i<s;i++)t+=":"+Ot(e.targets[i]);return t}function Ot(e){let t="";const i=Object.keys(e).sort();for(let s=0,a=i.length;s<a;s++)t+=i[s]+":"+e[i[s]]+";";return t}function qt(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const Ht=new t.Matrix4;class jt{constructor(e={},i={}){this.json=e,this.extensions={},this.plugins={},this.options=i,this.cache=new Je,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,a=-1,n=!1,r=-1;if("undefined"!=typeof navigator&&void 0!==navigator.userAgent){const e=navigator.userAgent;s=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);a=s&&t?parseInt(t[1],10):-1,n=e.indexOf("Firefox")>-1,r=n?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||s&&a<17||n&&r<98?this.textureLoader=new t.TextureLoader(this.options.manager):this.textureLoader=new t.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new t.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,s=this.json,a=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(t){const n={scene:t[0][s.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:s.asset,parser:i,userData:{}};return _t(a,n,s),Ut(n,s),Promise.all(i._invokeAll(function(e){return e.afterRoot&&e.afterRoot(n)})).then(function(){for(const e of n.scenes)e.updateMatrixWorld();e(n)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let i=0,s=t.length;i<s;i++){const s=t[i].joints;for(let t=0,i=s.length;t<i;t++)e[s[t]].isBone=!0}for(let t=0,s=e.length;t<s;t++){const s=e[t];void 0!==s.mesh&&(this._addNodeRef(this.meshCache,s.mesh),void 0!==s.skin&&(i[s.mesh].isSkinnedMesh=!0)),void 0!==s.camera&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const s=i.clone(),a=(e,t)=>{const i=this.associations.get(e);null!=i&&this.associations.set(t,i);for(const[i,s]of e.children.entries())a(s,t.children[i])};return a(i,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const s=e(t[i]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let s=0;s<t.length;s++){const a=e(t[s]);a&&i.push(a)}return i}getDependency(e,t){const i=e+":"+t;let s=this.cache.get(i);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":s=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)}),!s)throw new Error("Unknown type: "+e)}this.cache.add(i,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,s=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(s.map(function(t,s){return i.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){const i=this.json.buffers[e],s=this.fileLoader;if(i.type&&"arraybuffer"!==i.type)throw new Error("THREE.GLTFLoader: "+i.type+" buffer type is not supported.");if(void 0===i.uri&&0===e)return Promise.resolve(this.extensions[Ye.KHR_BINARY_GLTF].body);const a=this.options;return new Promise(function(e,n){s.load(t.LoaderUtils.resolveURL(i.uri,a.path),e,void 0,function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+i.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){const i=t.byteLength||0,s=t.byteOffset||0;return e.slice(s,s+i)})}loadAccessor(e){const i=this,s=this.json,a=this.json.accessors[e];if(void 0===a.bufferView&&void 0===a.sparse){const e=Mt[a.type],i=vt[a.componentType],s=!0===a.normalized,n=new i(a.count*e);return Promise.resolve(new t.BufferAttribute(n,e,s))}const n=[];return void 0!==a.bufferView?n.push(this.getDependency("bufferView",a.bufferView)):n.push(null),void 0!==a.sparse&&(n.push(this.getDependency("bufferView",a.sparse.indices.bufferView)),n.push(this.getDependency("bufferView",a.sparse.values.bufferView))),Promise.all(n).then(function(e){const n=e[0],r=Mt[a.type],o=vt[a.componentType],A=o.BYTES_PER_ELEMENT,l=A*r,c=a.byteOffset||0,h=void 0!==a.bufferView?s.bufferViews[a.bufferView].byteStride:void 0,d=!0===a.normalized;let g,p;if(h&&h!==l){const e=Math.floor(c/h),s="InterleavedBuffer:"+a.bufferView+":"+a.componentType+":"+e+":"+a.count;let l=i.cache.get(s);l||(g=new o(n,e*h,a.count*h/A),l=new t.InterleavedBuffer(g,h/A),i.cache.add(s,l)),p=new t.InterleavedBufferAttribute(l,r,c%h/A,d)}else g=null===n?new o(a.count*r):new o(n,c,a.count*r),p=new t.BufferAttribute(g,r,d);if(void 0!==a.sparse){const i=Mt.SCALAR,s=vt[a.sparse.indices.componentType],A=a.sparse.indices.byteOffset||0,l=a.sparse.values.byteOffset||0,c=new s(e[1],A,a.sparse.count*i),h=new o(e[2],l,a.sparse.count*r);null!==n&&(p=new t.BufferAttribute(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let e=0,t=c.length;e<t;e++){const t=c[e];if(p.setX(t,h[e*r]),r>=2&&p.setY(t,h[e*r+1]),r>=3&&p.setZ(t,h[e*r+2]),r>=4&&p.setW(t,h[e*r+3]),r>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}p.normalized=d}return p})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,a=t.images[s];let n=this.textureLoader;if(a.uri){const e=i.manager.getHandler(a.uri);null!==e&&(n=e)}return this.loadTextureImage(e,s,n)}loadTextureImage(e,i,s){const a=this,n=this.json,r=n.textures[e],o=n.images[i],A=(o.uri||o.bufferView)+":"+r.sampler;if(this.textureCache[A])return this.textureCache[A];const l=this.loadImageSource(i,s).then(function(i){i.flipY=!1,i.name=r.name||o.name||"",""===i.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(i.name=o.uri);const s=(n.samplers||{})[r.sampler]||{};return i.magFilter=St[s.magFilter]||t.LinearFilter,i.minFilter=St[s.minFilter]||t.LinearMipmapLinearFilter,i.wrapS=Qt[s.wrapS]||t.RepeatWrapping,i.wrapT=Qt[s.wrapT]||t.RepeatWrapping,i.generateMipmaps=!i.isCompressedTexture&&i.minFilter!==t.NearestFilter&&i.minFilter!==t.LinearFilter,a.associations.set(i,{textures:e}),i}).catch(function(){return null});return this.textureCache[A]=l,l}loadImageSource(e,i){const s=this,a=this.json,n=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());const r=a.images[e],o=self.URL||self.webkitURL;let A=r.uri||"",l=!1;if(void 0!==r.bufferView)A=s.getDependency("bufferView",r.bufferView).then(function(e){l=!0;const t=new Blob([e],{type:r.mimeType});return A=o.createObjectURL(t),A});else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(A).then(function(e){return new Promise(function(s,a){let r=s;!0===i.isImageBitmapLoader&&(r=function(e){const i=new t.Texture(e);i.needsUpdate=!0,s(i)}),i.load(t.LoaderUtils.resolveURL(e,n.path),r,void 0,a)})}).then(function(e){var t;return!0===l&&o.revokeObjectURL(A),Ut(e,r),e.userData.mimeType=r.mimeType||((t=r.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",A),e});return this.sourceCache[e]=c,c}assignTexture(e,t,i,s){const a=this;return this.getDependency("texture",i.index).then(function(n){if(!n)return null;if(void 0!==i.texCoord&&i.texCoord>0&&((n=n.clone()).channel=i.texCoord),a.extensions[Ye.KHR_TEXTURE_TRANSFORM]){const e=void 0!==i.extensions?i.extensions[Ye.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=a.associations.get(n);n=a.extensions[Ye.KHR_TEXTURE_TRANSFORM].extendTexture(n,e),a.associations.set(n,t)}}return void 0!==s&&(n.colorSpace=s),e[t]=n,n})}assignFinalMaterial(e){const i=e.geometry;let s=e.material;const a=void 0===i.attributes.tangent,n=void 0!==i.attributes.color,r=void 0===i.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+s.uuid;let i=this.cache.get(e);i||(i=new t.PointsMaterial,t.Material.prototype.copy.call(i,s),i.color.copy(s.color),i.map=s.map,i.sizeAttenuation=!1,this.cache.add(e,i)),s=i}else if(e.isLine){const e="LineBasicMaterial:"+s.uuid;let i=this.cache.get(e);i||(i=new t.LineBasicMaterial,t.Material.prototype.copy.call(i,s),i.color.copy(s.color),i.map=s.map,this.cache.add(e,i)),s=i}if(a||n||r){let e="ClonedMaterial:"+s.uuid+":";a&&(e+="derivative-tangents:"),n&&(e+="vertex-colors:"),r&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=s.clone(),n&&(t.vertexColors=!0),r&&(t.flatShading=!0),a&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(s))),s=t}e.material=s}getMaterialType(){return t.MeshStandardMaterial}loadMaterial(e){const i=this,s=this.json,a=this.extensions,n=s.materials[e];let r;const o={},A=[];if((n.extensions||{})[Ye.KHR_MATERIALS_UNLIT]){const e=a[Ye.KHR_MATERIALS_UNLIT];r=e.getMaterialType(),A.push(e.extendParams(o,n,i))}else{const s=n.pbrMetallicRoughness||{};if(o.color=new t.Color(1,1,1),o.opacity=1,Array.isArray(s.baseColorFactor)){const e=s.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace),o.opacity=e[3]}void 0!==s.baseColorTexture&&A.push(i.assignTexture(o,"map",s.baseColorTexture,t.SRGBColorSpace)),o.metalness=void 0!==s.metallicFactor?s.metallicFactor:1,o.roughness=void 0!==s.roughnessFactor?s.roughnessFactor:1,void 0!==s.metallicRoughnessTexture&&(A.push(i.assignTexture(o,"metalnessMap",s.metallicRoughnessTexture)),A.push(i.assignTexture(o,"roughnessMap",s.metallicRoughnessTexture))),r=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),A.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}!0===n.doubleSided&&(o.side=t.DoubleSide);const l=n.alphaMode||Ft;if(l===Lt?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===kt&&(o.alphaTest=void 0!==n.alphaCutoff?n.alphaCutoff:.5)),void 0!==n.normalTexture&&r!==t.MeshBasicMaterial&&(A.push(i.assignTexture(o,"normalMap",n.normalTexture)),o.normalScale=new t.Vector2(1,1),void 0!==n.normalTexture.scale)){const e=n.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==n.occlusionTexture&&r!==t.MeshBasicMaterial&&(A.push(i.assignTexture(o,"aoMap",n.occlusionTexture)),void 0!==n.occlusionTexture.strength&&(o.aoMapIntensity=n.occlusionTexture.strength)),void 0!==n.emissiveFactor&&r!==t.MeshBasicMaterial){const e=n.emissiveFactor;o.emissive=(new t.Color).setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace)}return void 0!==n.emissiveTexture&&r!==t.MeshBasicMaterial&&A.push(i.assignTexture(o,"emissiveMap",n.emissiveTexture,t.SRGBColorSpace)),Promise.all(A).then(function(){const t=new r(o);return n.name&&(t.name=n.name),Ut(t,n),i.associations.set(t,{materials:e}),n.extensions&&_t(a,t,n),t})}createUniqueName(e){const i=t.PropertyBinding.sanitizeNodeName(e||"");return i in this.nodeNamesUsed?i+"_"+ ++this.nodeNamesUsed[i]:(this.nodeNamesUsed[i]=0,i)}loadGeometries(e){const i=this,s=this.extensions,a=this.primitiveCache;function n(e){return s[Ye.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,i).then(function(t){return zt(t,e,i)})}const r=[];for(let s=0,o=e.length;s<o;s++){const o=e[s],A=Nt(o),l=a[A];if(l)r.push(l.promise);else{let e;e=o.extensions&&o.extensions[Ye.KHR_DRACO_MESH_COMPRESSION]?n(o):zt(new t.BufferGeometry,o,i),a[A]={primitive:o,promise:e},r.push(e)}}return Promise.all(r)}loadMesh(e){const i=this,s=this.json,a=this.extensions,n=s.meshes[e],r=n.primitives,o=[];for(let e=0,t=r.length;e<t;e++){const t=void 0===r[e].material?Pt(this.cache):this.getDependency("material",r[e].material);o.push(t)}return o.push(i.loadGeometries(r)),Promise.all(o).then(function(s){const o=s.slice(0,s.length-1),A=s[s.length-1],l=[];for(let s=0,c=A.length;s<c;s++){const c=A[s],h=r[s];let d;const g=o[s];if(h.mode===xt.TRIANGLES||h.mode===xt.TRIANGLE_STRIP||h.mode===xt.TRIANGLE_FAN||void 0===h.mode)d=!0===n.isSkinnedMesh?new t.SkinnedMesh(c,g):new t.Mesh(c,g),!0===d.isSkinnedMesh&&d.normalizeSkinWeights(),h.mode===xt.TRIANGLE_STRIP?d.geometry=je(d.geometry,t.TriangleStripDrawMode):h.mode===xt.TRIANGLE_FAN&&(d.geometry=je(d.geometry,t.TriangleFanDrawMode));else if(h.mode===xt.LINES)d=new t.LineSegments(c,g);else if(h.mode===xt.LINE_STRIP)d=new t.Line(c,g);else if(h.mode===xt.LINE_LOOP)d=new t.LineLoop(c,g);else{if(h.mode!==xt.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);d=new t.Points(c,g)}Object.keys(d.geometry.morphAttributes).length>0&&Gt(d,n),d.name=i.createUniqueName(n.name||"mesh_"+e),Ut(d,n),h.extensions&&_t(a,d,h),i.assignFinalMaterial(d),l.push(d)}for(let t=0,s=l.length;t<s;t++)i.associations.set(l[t],{meshes:e,primitives:t});if(1===l.length)return n.extensions&&_t(a,l[0],n),l[0];const c=new t.Group;n.extensions&&_t(a,c,n),i.associations.set(c,{meshes:e});for(let e=0,t=l.length;e<t;e++)c.add(l[e]);return c})}loadCamera(e){let i;const s=this.json.cameras[e],a=s[s.type];if(a)return"perspective"===s.type?i=new t.PerspectiveCamera(t.MathUtils.radToDeg(a.yfov),a.aspectRatio||1,a.znear||1,a.zfar||2e6):"orthographic"===s.type&&(i=new t.OrthographicCamera(-a.xmag,a.xmag,a.ymag,-a.ymag,a.znear,a.zfar)),s.name&&(i.name=this.createUniqueName(s.name)),Ut(i,s),Promise.resolve(i);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const i=this.json.skins[e],s=[];for(let e=0,t=i.joints.length;e<t;e++)s.push(this._loadNodeShallow(i.joints[e]));return void 0!==i.inverseBindMatrices?s.push(this.getDependency("accessor",i.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(e){const s=e.pop(),a=e,n=[],r=[];for(let e=0,o=a.length;e<o;e++){const o=a[e];if(o){n.push(o);const i=new t.Matrix4;null!==s&&i.fromArray(s.array,16*e),r.push(i)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',i.joints[e])}return new t.Skeleton(n,r)})}loadAnimation(e){const i=this.json,s=this,a=i.animations[e],n=a.name?a.name:"animation_"+e,r=[],o=[],A=[],l=[],c=[];for(let e=0,t=a.channels.length;e<t;e++){const t=a.channels[e],i=a.samplers[t.sampler],s=t.target,n=s.node,h=void 0!==a.parameters?a.parameters[i.input]:i.input,d=void 0!==a.parameters?a.parameters[i.output]:i.output;void 0!==s.node&&(r.push(this.getDependency("node",n)),o.push(this.getDependency("accessor",h)),A.push(this.getDependency("accessor",d)),l.push(i),c.push(s))}return Promise.all([Promise.all(r),Promise.all(o),Promise.all(A),Promise.all(l),Promise.all(c)]).then(function(e){const i=e[0],r=e[1],o=e[2],A=e[3],l=e[4],c=[];for(let e=0,t=i.length;e<t;e++){const t=i[e],a=r[e],n=o[e],h=A[e],d=l[e];if(void 0===t)continue;t.updateMatrix&&t.updateMatrix();const g=s._createAnimationTracks(t,a,n,h,d);if(g)for(let e=0;e<g.length;e++)c.push(g[e])}const h=new t.AnimationClip(n,void 0,c);return Ut(h,a),h})}createNodeMesh(e){const t=this.json,i=this,s=t.nodes[e];return void 0===s.mesh?null:i.getDependency("mesh",s.mesh).then(function(e){const t=i._getNodeRef(i.meshCache,s.mesh,e);return void 0!==s.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,i=s.weights.length;t<i;t++)e.morphTargetInfluences[t]=s.weights[t]}),t})}loadNode(e){const i=this,s=this.json.nodes[e],a=i._loadNodeShallow(e),n=[],r=s.children||[];for(let e=0,t=r.length;e<t;e++)n.push(i.getDependency("node",r[e]));const o=void 0===s.skin?Promise.resolve(null):i.getDependency("skin",s.skin);return Promise.all([a,Promise.all(n),o]).then(function(e){const i=e[0],s=e[1],a=e[2];null!==a&&i.traverse(function(e){e.isSkinnedMesh&&e.bind(a,Ht)});for(let e=0,t=s.length;e<t;e++)i.add(s[e]);if(void 0!==i.userData.pivot&&s.length>0){const e=i.userData.pivot,a=s[0];i.pivot=(new t.Vector3).fromArray(e),i.position.x-=e[0],i.position.y-=e[1],i.position.z-=e[2],a.position.set(0,0,0),delete i.userData.pivot}return i})}_loadNodeShallow(e){const i=this.json,s=this.extensions,a=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const n=i.nodes[e],r=n.name?a.createUniqueName(n.name):"",o=[],A=a._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return A&&o.push(A),void 0!==n.camera&&o.push(a.getDependency("camera",n.camera).then(function(e){return a._getNodeRef(a.cameraCache,n.camera,e)})),a._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){o.push(e)}),this.nodeCache[e]=Promise.all(o).then(function(i){let o;if(o=!0===n.isBone?new t.Bone:i.length>1?new t.Group:1===i.length?i[0]:new t.Object3D,o!==i[0])for(let e=0,t=i.length;e<t;e++)o.add(i[e]);if(n.name&&(o.userData.name=n.name,o.name=r),Ut(o,n),n.extensions&&_t(s,o,n),void 0!==n.matrix){const e=new t.Matrix4;e.fromArray(n.matrix),o.applyMatrix4(e)}else void 0!==n.translation&&o.position.fromArray(n.translation),void 0!==n.rotation&&o.quaternion.fromArray(n.rotation),void 0!==n.scale&&o.scale.fromArray(n.scale);if(a.associations.has(o)){if(void 0!==n.mesh&&a.meshCache.refs[n.mesh]>1){const e=a.associations.get(o);a.associations.set(o,{...e})}}else a.associations.set(o,{});return a.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){const i=this.extensions,s=this.json.scenes[e],a=this,n=new t.Group;s.name&&(n.name=a.createUniqueName(s.name)),Ut(n,s),s.extensions&&_t(i,n,s);const r=s.nodes||[],o=[];for(let e=0,t=r.length;e<t;e++)o.push(a.getDependency("node",r[e]));return Promise.all(o).then(function(e){for(let t=0,i=e.length;t<i;t++){const i=e[t];null!==i.parent?n.add(ze(i)):n.add(i)}return a.associations=(e=>{const i=new Map;for(const[e,s]of a.associations)(e instanceof t.Material||e instanceof t.Texture)&&i.set(e,s);return e.traverse(e=>{const t=a.associations.get(e);null!=t&&i.set(e,t)}),i})(n),n})}_createAnimationTracks(e,i,s,a,n){const r=[],o=e.name?e.name:e.uuid,A=[];let l;switch(Tt[n.path]===Tt.weights?e.traverse(function(e){e.morphTargetInfluences&&A.push(e.name?e.name:e.uuid)}):A.push(o),Tt[n.path]){case Tt.weights:l=t.NumberKeyframeTrack;break;case Tt.rotation:l=t.QuaternionKeyframeTrack;break;case Tt.translation:case Tt.scale:l=t.VectorKeyframeTrack;break;default:if(1===s.itemSize)l=t.NumberKeyframeTrack;else l=t.VectorKeyframeTrack}const c=void 0!==a.interpolation?Dt[a.interpolation]:t.InterpolateLinear,h=this._getArrayFromAccessor(s);for(let e=0,t=A.length;e<t;e++){const t=new l(A[e]+"."+Tt[n.path],i.array,h,c);"CUBICSPLINE"===a.interpolation&&this._createCubicSplineTrackInterpolant(t),r.push(t)}return r}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=qt(t.constructor),i=new Float32Array(t.length);for(let s=0,a=t.length;s<a;s++)i[s]=t[s]*e;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof t.QuaternionKeyframeTrack?wt:yt)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function zt(e,i,s){const a=i.attributes,n=[];function r(t,i){return s.getDependency("accessor",t).then(function(t){e.setAttribute(i,t)})}for(const t in a){const i=Rt[t]||t.toLowerCase();i in e.attributes||n.push(r(a[t],i))}if(void 0!==i.indices&&!e.index){const t=s.getDependency("accessor",i.indices).then(function(t){e.setIndex(t)});n.push(t)}return t.ColorManagement.workingColorSpace!==t.LinearSRGBColorSpace&&"COLOR_0"in a&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${t.ColorManagement.workingColorSpace}" not supported.`),Ut(e,i),function(e,i,s){const a=i.attributes,n=new t.Box3;if(void 0===a.POSITION)return;{const e=s.json.accessors[a.POSITION],i=e.min,r=e.max;if(void 0===i||void 0===r)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(n.set(new t.Vector3(i[0],i[1],i[2]),new t.Vector3(r[0],r[1],r[2])),e.normalized){const t=qt(vt[e.componentType]);n.min.multiplyScalar(t),n.max.multiplyScalar(t)}}const r=i.targets;if(void 0!==r){const e=new t.Vector3,i=new t.Vector3;for(let t=0,a=r.length;t<a;t++){const a=r[t];if(void 0!==a.POSITION){const t=s.json.accessors[a.POSITION],n=t.min,r=t.max;if(void 0!==n&&void 0!==r){if(i.setX(Math.max(Math.abs(n[0]),Math.abs(r[0]))),i.setY(Math.max(Math.abs(n[1]),Math.abs(r[1]))),i.setZ(Math.max(Math.abs(n[2]),Math.abs(r[2]))),t.normalized){const e=qt(vt[t.componentType]);i.multiplyScalar(e)}e.max(i)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(e)}e.boundingBox=n;const o=new t.Sphere;n.getCenter(o.center),o.radius=n.min.distanceTo(n.max)/2,e.boundingSphere=o}(e,i,s),Promise.all(n).then(function(){return void 0!==i.targets?function(e,t,i){let s=!1,a=!1,n=!1;for(let e=0,i=t.length;e<i;e++){const i=t[e];if(void 0!==i.POSITION&&(s=!0),void 0!==i.NORMAL&&(a=!0),void 0!==i.COLOR_0&&(n=!0),s&&a&&n)break}if(!s&&!a&&!n)return Promise.resolve(e);const r=[],o=[],A=[];for(let l=0,c=t.length;l<c;l++){const c=t[l];if(s){const t=void 0!==c.POSITION?i.getDependency("accessor",c.POSITION):e.attributes.position;r.push(t)}if(a){const t=void 0!==c.NORMAL?i.getDependency("accessor",c.NORMAL):e.attributes.normal;o.push(t)}if(n){const t=void 0!==c.COLOR_0?i.getDependency("accessor",c.COLOR_0):e.attributes.color;A.push(t)}}return Promise.all([Promise.all(r),Promise.all(o),Promise.all(A)]).then(function(t){const i=t[0],r=t[1],o=t[2];return s&&(e.morphAttributes.position=i),a&&(e.morphAttributes.normal=r),n&&(e.morphAttributes.color=o),e.morphTargetsRelative=!0,e})}(e,i.targets,s):e})}class Kt{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0,this.workerCreator=null}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const i=this.workersResolve[e];if(i&&i(t),this.queue.length){const{resolve:t,msg:i,transfer:s}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(i,s)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(i=>{const s=this._getIdleWorker();-1!==s?(this._initWorker(s),this.workerStatus|=1<<s,this.workersResolve[s]=i,this.workers[s].postMessage(e,t)):this.queue.push({resolve:i,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const Vt=9,Jt=15,Wt=16,Yt=22,Xt=37,$t=43,Zt=76,ei=83,ti=97,ii=100,si=103,ai=109,ni=122,ri=123,oi=131,Ai=132,li=133,ci=134,hi=137,di=138,gi=139,pi=140,ui=141,mi=142,bi=145,fi=146,Ii=148,Ci=152,Ei=153,yi=154,Bi=155,wi=156,xi=157,vi=158,Si=165,Qi=166,Mi=1000054e3,Ri=1000054001,Ti=1000054004,Di=1000054005,Fi=1000066e3,ki=1000066004;class Li{constructor(e,t,i,s){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,i),this._littleEndian=s,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){const i=this._offset;let s=0;for(;this._dataView.getUint8(this._offset)!==t&&s<e;)s++,this._offset++;return s<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+i,s)}}const Pi=[171,75,84,88,32,50,48,187,13,10,26,10];function _i(e){return(new TextDecoder).decode(e)}let Ui,Gi,Ni;const Oi={env:{emscripten_notify_memory_growth:function(e){Ni=new Uint8Array(Gi.exports.memory.buffer)}}};class qi{init(){return Ui||(Ui="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Hi).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Oi)).then(this._init):WebAssembly.instantiate(Buffer.from(Hi,"base64"),Oi).then(this._init),Ui)}_init(e){Gi=e.instance,Oi.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Gi)throw new Error("ZSTDDecoder: Await .init() before decoding.");const i=e.byteLength,s=Gi.exports.malloc(i);Ni.set(e,s),t=t||Number(Gi.exports.ZSTD_findDecompressedSize(s,i));const a=Gi.exports.malloc(t),n=Gi.exports.ZSTD_decompress(a,t,s,i),r=Ni.slice(a,a+n);return Gi.exports.free(s),Gi.exports.free(a),r}}const Hi="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIA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hxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgAC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EEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgAC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z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";t.ColorManagement.spaces[t.SRGBColorSpace];const ji=new WeakMap;let zi,Ki=0;class Vi extends t.Loader{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new Kt,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return console.warn('KTX2Loader: "detectSupportAsync()" has been deprecated. Use "detectSupport()" and "await renderer.init();" when creating the renderer.'),await e.init(),this.detectSupport(e)}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-s3tc"),bptcSupported:e.hasFeature("texture-compression-bc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},"undefined"!=typeof navigator&&void 0!==navigator.platform&&void 0!==navigator.userAgent&&navigator.platform.indexOf("Linux")>=0&&navigator.userAgent.indexOf("Firefox")>=0&&this.workerConfig.astcSupported&&this.workerConfig.etc2Supported&&this.workerConfig.bptcSupported&&this.workerConfig.dxtSupported&&(this.workerConfig.astcSupported=!1,this.workerConfig.etc2Supported=!1)),this}init(){if(!this.transcoderPending){const e=new t.FileLoader(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const i=e.loadAsync("basis_transcoder.js"),s=new t.FileLoader(this.manager);s.setPath(this.transcoderPath),s.setResponseType("arraybuffer"),s.setWithCredentials(this.withCredentials);const a=s.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([i,a]).then(([e,t])=>{const i=Vi.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(Vi.EngineFormat),"let _EngineType = "+JSON.stringify(Vi.EngineType),"let _TranscoderFormat = "+JSON.stringify(Vi.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Vi.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s])),this.transcoderBinary=t,this.workerPool.setWorkerCreator(()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e})}),Ki>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Ki++}return this.transcoderPending}load(e,i,s,a){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const n=new t.FileLoader(this.manager);n.setPath(this.path),n.setCrossOrigin(this.crossOrigin),n.setWithCredentials(this.withCredentials),n.setRequestHeader(this.requestHeader),n.setResponseType("arraybuffer"),n.load(e,e=>{this.parse(e,i,a)},s,a)}parse(e,t,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(ji.has(e)){return ji.get(e).promise.then(t).catch(i)}this._createTexture(e).then(e=>t?t(e):null).catch(i)}_createTextureFrom(e,i){const{type:s,error:a,data:{faces:n,width:r,height:o,format:A,type:l,dfdFlags:c}}=e;if("error"===s)return Promise.reject(a);let h;if(6===i.faceCount)h=new t.CompressedCubeTexture(n,A,l);else{const e=n[0].mipmaps;h=i.layerCount>1?new t.CompressedArrayTexture(e,r,o,i.layerCount,A,l):new t.CompressedTexture(e,r,o,A,l)}return h.minFilter=1===n[0].mipmaps.length?t.LinearFilter:t.LinearMipmapLinearFilter,h.magFilter=t.LinearFilter,h.generateMipmaps=!1,h.needsUpdate=!0,h.colorSpace=Xi(i),h.premultiplyAlpha=!!(1&c),h}async _createTexture(e,i={}){const s=function(e){const t=new Uint8Array(e.buffer,e.byteOffset,Pi.length);if(t[0]!==Pi[0]||t[1]!==Pi[1]||t[2]!==Pi[2]||t[3]!==Pi[3]||t[4]!==Pi[4]||t[5]!==Pi[5]||t[6]!==Pi[6]||t[7]!==Pi[7]||t[8]!==Pi[8]||t[9]!==Pi[9]||t[10]!==Pi[10]||t[11]!==Pi[11])throw new Error("Missing KTX 2.0 identifier.");const i={vkFormat:0,typeSize:1,pixelWidth:0,pixelHeight:0,pixelDepth:0,layerCount:0,faceCount:1,levelCount:0,supercompressionScheme:0,levels:[],dataFormatDescriptor:[{vendorId:0,descriptorType:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],keyValue:{},globalData:null},s=17*Uint32Array.BYTES_PER_ELEMENT,a=new Li(e,Pi.length,s,!0);i.vkFormat=a._nextUint32(),i.typeSize=a._nextUint32(),i.pixelWidth=a._nextUint32(),i.pixelHeight=a._nextUint32(),i.pixelDepth=a._nextUint32(),i.layerCount=a._nextUint32(),i.faceCount=a._nextUint32(),i.levelCount=a._nextUint32(),i.supercompressionScheme=a._nextUint32();const n=a._nextUint32(),r=a._nextUint32(),o=a._nextUint32(),A=a._nextUint32(),l=a._nextUint64(),c=a._nextUint64(),h=3*Math.max(i.levelCount,1)*8,d=new Li(e,Pi.length+s,h,!0);for(let t=0,s=Math.max(i.levelCount,1);t<s;t++)i.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const g=new Li(e,n,r,!0);g._skip(4);const p=g._nextUint16(),u=g._nextUint16(),m=g._nextUint16(),b=g._nextUint16(),f={vendorId:p,descriptorType:u,versionNumber:m,colorModel:g._nextUint8(),colorPrimaries:g._nextUint8(),transferFunction:g._nextUint8(),flags:g._nextUint8(),texelBlockDimension:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],bytesPlane:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],samples:[]},I=(b/4-6)/4;for(let e=0;e<I;e++){const t={bitOffset:g._nextUint16(),bitLength:g._nextUint8(),channelType:g._nextUint8(),samplePosition:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],sampleLower:Number.NEGATIVE_INFINITY,sampleUpper:Number.POSITIVE_INFINITY};64&t.channelType?(t.sampleLower=g._nextInt32(),t.sampleUpper=g._nextInt32()):(t.sampleLower=g._nextUint32(),t.sampleUpper=g._nextUint32()),f.samples[e]=t}i.dataFormatDescriptor.length=0,i.dataFormatDescriptor.push(f);const C=new Li(e,o,A,!0);for(;C._offset<A;){const e=C._nextUint32(),t=C._scan(e),s=_i(t);if(i.keyValue[s]=C._nextUint8Array(e-t.byteLength-1),s.match(/^ktx/i)){const e=_i(i.keyValue[s]);i.keyValue[s]=e.substring(0,e.lastIndexOf("\0"))}C._skip(e%4?4-e%4:0)}if(c<=0)return i;const E=new Li(e,l,c,!0),y=E._nextUint16(),B=E._nextUint16(),w=E._nextUint32(),x=E._nextUint32(),v=E._nextUint32(),S=E._nextUint32(),Q=[];for(let e=0,t=Math.max(i.levelCount,1);e<t;e++)Q.push({imageFlags:E._nextUint32(),rgbSliceByteOffset:E._nextUint32(),rgbSliceByteLength:E._nextUint32(),alphaSliceByteOffset:E._nextUint32(),alphaSliceByteLength:E._nextUint32()});const M=l+E._offset,R=M+w,T=R+x,D=T+v,F=new Uint8Array(e.buffer,e.byteOffset+M,w),k=new Uint8Array(e.buffer,e.byteOffset+R,x),L=new Uint8Array(e.buffer,e.byteOffset+T,v),P=new Uint8Array(e.buffer,e.byteOffset+D,S);return i.globalData={endpointCount:y,selectorCount:B,imageDescs:Q,endpointsData:F,selectorsData:k,tablesData:L,extendedData:P},i}(new Uint8Array(e)),a=s.vkFormat===Fi&&167===s.dataFormatDescriptor[0].colorModel;if(!(0===s.vkFormat||a&&!this.workerConfig.astcHDRSupported))return async function(e){const{vkFormat:i}=e;if(void 0===Wi[i])throw new Error("THREE.KTX2Loader: Unsupported vkFormat: "+i);void 0===Yi[i]&&console.warn('THREE.KTX2Loader: Missing ".type" for vkFormat: '+i);let s;2===e.supercompressionScheme&&(zi||(zi=new Promise(async e=>{const t=new qi;await t.init(),e(t)})),s=await zi);const a=[];for(let n=0;n<e.levels.length;n++){const r=Math.max(1,e.pixelWidth>>n),o=Math.max(1,e.pixelHeight>>n),A=e.pixelDepth?Math.max(1,e.pixelDepth>>n):0,l=e.levels[n];let c,h;if(0===e.supercompressionScheme)c=l.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");c=s.decode(l.levelData,l.uncompressedByteLength)}h=Yi[i]===t.FloatType?new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):Yi[i]===t.HalfFloatType?new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):Yi[i]===t.UnsignedInt5999Type||Yi[i]===t.UnsignedInt101111Type?new Uint32Array(c.buffer,c.byteOffset,c.byteLength/Uint32Array.BYTES_PER_ELEMENT):c,a.push({data:h,width:r,height:o,depth:A})}const n=0===e.levelCount||a.length>1;let r;if(Ji.has(Wi[i]))r=0===e.pixelDepth?new t.DataTexture(a[0].data,e.pixelWidth,e.pixelHeight):new t.Data3DTexture(a[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth),r.minFilter=n?t.NearestMipmapNearestFilter:t.NearestFilter,r.magFilter=t.NearestFilter,r.generateMipmaps=0===e.levelCount;else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");r=new t.CompressedTexture(a,e.pixelWidth,e.pixelHeight),r.minFilter=n?t.LinearMipmapLinearFilter:t.LinearFilter,r.magFilter=t.LinearFilter}return r.mipmaps=a,r.type=Yi[i],r.format=Wi[i],r.colorSpace=Xi(e),r.needsUpdate=!0,Promise.resolve(r)}(s);const n=i,r=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:n},[e])).then(e=>this._createTextureFrom(e.data,s));return ji.set(e,{promise:r}),r}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Ki--}}Vi.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},Vi.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},Vi.EngineFormat={RGBAFormat:t.RGBAFormat,RGBA_ASTC_4x4_Format:t.RGBA_ASTC_4x4_Format,RGB_BPTC_UNSIGNED_Format:t.RGB_BPTC_UNSIGNED_Format,RGBA_BPTC_Format:t.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:t.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:t.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:t.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:t.RGB_ETC1_Format,RGB_ETC2_Format:t.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:t.RGB_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format:t.RGBA_S3TC_DXT1_Format},Vi.EngineType={UnsignedByteType:t.UnsignedByteType,HalfFloatType:t.HalfFloatType,FloatType:t.FloatType},Vi.BasisWorker=function(){let e,t,i;const s=_EngineFormat,a=_EngineType,n=_TranscoderFormat,r=_BasisFormat;self.addEventListener("message",function(s){const n=s.data;switch(n.type){case"init":e=n.config,o=n.transcoderBinary,t=new Promise(e=>{i={wasmBinary:o,onRuntimeInitialized:e},BASIS(i)}).then(()=>{i.initializeBasis(),void 0===i.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")});break;case"transcode":t.then(()=>{try{const{faces:t,buffers:s,width:o,height:h,hasAlpha:d,format:g,type:p,dfdFlags:u}=function(t){const s=new i.KTX2File(new Uint8Array(t));function n(){s.close(),s.delete()}if(!s.isValid())throw n(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");let o;if(s.isUASTC())o=r.UASTC;else if(s.isETC1S())o=r.ETC1S;else{if(!s.isHDR())throw new Error("THREE.KTX2Loader: Unknown Basis encoding");o=r.UASTC_HDR}const h=s.getWidth(),d=s.getHeight(),g=s.getLayers()||1,p=s.getLevels(),u=s.getFaces(),m=s.getHasAlpha(),b=s.getDFDFlags(),{transcoderFormat:f,engineFormat:I,engineType:C}=function(t,i,s,a){const n=A[t];for(let r=0;r<n.length;r++){const o=n[r];if(o.if&&!e[o.if])continue;if(!o.basisFormat.includes(t))continue;if(a&&o.transcoderFormat.length<2)continue;if(o.needsPowerOfTwo&&(!l(i)||!l(s)))continue;return{transcoderFormat:o.transcoderFormat[a?1:0],engineFormat:o.engineFormat[a?1:0],engineType:o.engineType[0]}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}(o,h,d,m);if(!h||!d||!p)throw n(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!s.startTranscoding())throw n(),new Error("THREE.KTX2Loader: .startTranscoding failed");const E=[],y=[];for(let e=0;e<u;e++){const t=[];for(let i=0;i<p;i++){const r=[];let o,A;for(let t=0;t<g;t++){const l=s.getImageLevelInfo(i,t,e);0!==e||0!==i||0!==t||l.origWidth%4==0&&l.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),p>1?(o=l.origWidth,A=l.origHeight):(o=l.width,A=l.height);let c=new Uint8Array(s.getImageTranscodedSizeInBytes(i,t,0,f));const h=s.transcodeImage(c,i,t,e,f,0,-1,-1);if(C===a.HalfFloatType&&(c=new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!h)throw n(),new Error("THREE.KTX2Loader: .transcodeImage failed.");r.push(c)}const l=c(r);t.push({data:l,width:o,height:A}),y.push(l.buffer)}E.push({mipmaps:t,width:h,height:d,format:I,type:C})}return n(),{faces:E,buffers:y,width:h,height:d,hasAlpha:m,dfdFlags:b,format:I,type:C}}(n.buffer);self.postMessage({type:"transcode",id:n.id,data:{faces:t,width:o,height:h,hasAlpha:d,format:g,type:p,dfdFlags:u}},s)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}})}var o});const o=[{if:"astcSupported",basisFormat:[r.UASTC],transcoderFormat:[n.ASTC_4x4,n.ASTC_4x4],engineFormat:[s.RGBA_ASTC_4x4_Format,s.RGBA_ASTC_4x4_Format],engineType:[a.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[r.ETC1S,r.UASTC],transcoderFormat:[n.BC7_M5,n.BC7_M5],engineFormat:[s.RGBA_BPTC_Format,s.RGBA_BPTC_Format],engineType:[a.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[r.ETC1S,r.UASTC],transcoderFormat:[n.BC1,n.BC3],engineFormat:[s.RGBA_S3TC_DXT1_Format,s.RGBA_S3TC_DXT5_Format],engineType:[a.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[r.ETC1S,r.UASTC],transcoderFormat:[n.ETC1,n.ETC2],engineFormat:[s.RGB_ETC2_Format,s.RGBA_ETC2_EAC_Format],engineType:[a.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[r.ETC1S,r.UASTC],transcoderFormat:[n.ETC1],engineFormat:[s.RGB_ETC1_Format],engineType:[a.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[r.ETC1S,r.UASTC],transcoderFormat:[n.PVRTC1_4_RGB,n.PVRTC1_4_RGBA],engineFormat:[s.RGB_PVRTC_4BPPV1_Format,s.RGBA_PVRTC_4BPPV1_Format],engineType:[a.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[r.UASTC_HDR],transcoderFormat:[n.BC6H],engineFormat:[s.RGB_BPTC_UNSIGNED_Format],engineType:[a.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[r.ETC1S,r.UASTC],transcoderFormat:[n.RGBA32,n.RGBA32],engineFormat:[s.RGBAFormat,s.RGBAFormat],engineType:[a.UnsignedByteType,a.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[r.UASTC_HDR],transcoderFormat:[n.RGBA_HALF],engineFormat:[s.RGBAFormat],engineType:[a.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],A={[r.ETC1S]:o.filter(e=>e.basisFormat.includes(r.ETC1S)).sort((e,t)=>e.priorityETC1S-t.priorityETC1S),[r.UASTC]:o.filter(e=>e.basisFormat.includes(r.UASTC)).sort((e,t)=>e.priorityUASTC-t.priorityUASTC),[r.UASTC_HDR]:o.filter(e=>e.basisFormat.includes(r.UASTC_HDR)).sort((e,t)=>e.priorityHDR-t.priorityHDR)};function l(e){return e<=2||!(e&e-1)&&0!==e}function c(e){if(1===e.length)return e[0];let t=0;for(let i=0;i<e.length;i++){t+=e[i].byteLength}const i=new Uint8Array(t);let s=0;for(let t=0;t<e.length;t++){const a=e[t];i.set(a,s),s+=a.byteLength}return i}};const Ji=new Set([t.RGBAFormat,t.RGBFormat,t.RGFormat,t.RedFormat]),Wi={[ai]:t.RGBAFormat,[si]:t.RGFormat,[ii]:t.RedFormat,[ti]:t.RGBAFormat,[ei]:t.RGFormat,[Zt]:t.RedFormat,[$t]:t.RGBAFormat,[Xt]:t.RGBAFormat,[Yt]:t.RGFormat,[Wt]:t.RGFormat,[Jt]:t.RedFormat,[Vt]:t.RedFormat,[ri]:t.RGBFormat,[ni]:t.RGBFormat,[Ci]:t.RGBA_ETC2_EAC_Format,[Ii]:t.RGB_ETC2_Format,[Ei]:t.R11_EAC_Format,[yi]:t.SIGNED_R11_EAC_Format,[Bi]:t.RG11_EAC_Format,[wi]:t.SIGNED_RG11_EAC_Format,[Fi]:t.RGBA_ASTC_4x4_Format,[vi]:t.RGBA_ASTC_4x4_Format,[xi]:t.RGBA_ASTC_4x4_Format,[ki]:t.RGBA_ASTC_6x6_Format,[Qi]:t.RGBA_ASTC_6x6_Format,[Si]:t.RGBA_ASTC_6x6_Format,[ci]:t.RGBA_S3TC_DXT1_Format,[li]:t.RGBA_S3TC_DXT1_Format,[Ai]:t.RGB_S3TC_DXT1_Format,[oi]:t.RGB_S3TC_DXT1_Format,[di]:t.RGBA_S3TC_DXT5_Format,[hi]:t.RGBA_S3TC_DXT5_Format,[pi]:t.SIGNED_RED_RGTC1_Format,[gi]:t.RED_RGTC1_Format,[mi]:t.SIGNED_RED_GREEN_RGTC2_Format,[ui]:t.RED_GREEN_RGTC2_Format,[fi]:t.RGBA_BPTC_Format,[bi]:t.RGBA_BPTC_Format,[Di]:t.RGBA_PVRTC_4BPPV1_Format,[Ri]:t.RGBA_PVRTC_4BPPV1_Format,[Ti]:t.RGBA_PVRTC_2BPPV1_Format,[Mi]:t.RGBA_PVRTC_2BPPV1_Format},Yi={[ai]:t.FloatType,[si]:t.FloatType,[ii]:t.FloatType,[ti]:t.HalfFloatType,[ei]:t.HalfFloatType,[Zt]:t.HalfFloatType,[$t]:t.UnsignedByteType,[Xt]:t.UnsignedByteType,[Yt]:t.UnsignedByteType,[Wt]:t.UnsignedByteType,[Jt]:t.UnsignedByteType,[Vt]:t.UnsignedByteType,[ri]:t.UnsignedInt5999Type,[ni]:t.UnsignedInt101111Type,[Ci]:t.UnsignedByteType,[Ii]:t.UnsignedByteType,[Ei]:t.UnsignedByteType,[yi]:t.UnsignedByteType,[Bi]:t.UnsignedByteType,[wi]:t.UnsignedByteType,[Fi]:t.HalfFloatType,[vi]:t.UnsignedByteType,[xi]:t.UnsignedByteType,[ki]:t.HalfFloatType,[Qi]:t.UnsignedByteType,[Si]:t.UnsignedByteType,[ci]:t.UnsignedByteType,[li]:t.UnsignedByteType,[Ai]:t.UnsignedByteType,[oi]:t.UnsignedByteType,[di]:t.UnsignedByteType,[hi]:t.UnsignedByteType,[pi]:t.UnsignedByteType,[gi]:t.UnsignedByteType,[mi]:t.UnsignedByteType,[ui]:t.UnsignedByteType,[fi]:t.UnsignedByteType,[bi]:t.UnsignedByteType,[Di]:t.UnsignedByteType,[Ri]:t.UnsignedByteType,[Ti]:t.UnsignedByteType,[Mi]:t.UnsignedByteType};function Xi(e){const i=e.dataFormatDescriptor[0];return 1===i.colorPrimaries?2===i.transferFunction?t.SRGBColorSpace:t.LinearSRGBColorSpace:10===i.colorPrimaries?2===i.transferFunction?"display-p3":"display-p3-linear":(0===i.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${i.colorPrimaries}"`),t.NoColorSpace)}
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var $i,Zi;const es=Symbol("retainerCount"),ts=Symbol("recentlyUsed"),is=Symbol("evict"),ss=Symbol("evictionThreshold"),as=Symbol("cache");class ns{constructor(e,t=5){this[$i]=new Map,this[Zi]=[],this[as]=e,this[ss]=t}set evictionThreshold(e){this[ss]=e,this[is]()}get evictionThreshold(){return this[ss]}get cache(){return this[as]}retainerCount(e){return this[es].get(e)||0}reset(){this[es].clear(),this[ts]=[]}retain(e){this[es].has(e)||this[es].set(e,0),this[es].set(e,this[es].get(e)+1);const t=this[ts].indexOf(e);-1!==t&&this[ts].splice(t,1),this[ts].unshift(e),this[is]()}release(e){this[es].has(e)&&this[es].set(e,Math.max(this[es].get(e)-1,0)),this[is]()}[($i=es,Zi=ts,is)](){if(!(this[ts].length<this[ss]))for(let e=this[ts].length-1;e>=this[ss];--e){const t=this[ts][e];0===this[es].get(t)&&(this[as].delete(t),this[ts].splice(e,1))}}}
/* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const rs=e=>{const t=new Map;for(const i of e.mappings)for(const e of i.variants)t.set(e,{material:null,gltfMaterialIndex:i.material});return t};class os{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,i=t.json;if(void 0===i.extensions||void 0===i.extensions[this.name])return null;const s=(e=>{const t=[],i=new Set;for(const s of e){let e=s,a=0;for(;i.has(e);)e=s+"."+ ++a;i.add(e),t.push(e)}return t})((i.extensions[this.name].variants||[]).map(e=>e.name));for(const s of e.scenes)s.traverse(e=>{const s=e;if(!s.material)return;const a=t.associations.get(s);if(null==a||null==a.meshes||null==a.primitives)return;const n=i.meshes[a.meshes].primitives[a.primitives].extensions;n&&n[this.name]&&(s.userData.variantMaterials=rs(n[this.name]))});return e.userData.variants=s,Promise.resolve()}}
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var As,ls;t.Texture.DEFAULT_ANISOTROPY=4;const cs=new Map,hs=new Map;let ds;const gs=new qe;let ps;const us=new Vi;let ms,bs;const fs=Symbol("loader"),Is=Symbol("evictionPolicy"),Cs=Symbol("GLTFInstance");class Es extends t.EventDispatcher{static setDRACODecoderLocation(e){ds=e,gs.setDecoderPath(e)}static getDRACODecoderLocation(){return ds}static setKTX2TranscoderLocation(e){ps=e,us.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return ps}static setMeshoptDecoderLocation(e){var t;ms!==e&&(ms=e,bs=(t=e,new Promise((e,i)=>{const s=document.createElement("script");document.body.appendChild(s),s.onload=e,s.onerror=i,s.async=!0,s.src=t})).then(()=>Ne.ready).then(()=>Ne))}static getMeshoptDecoderLocation(){return ms}static initializeKTX2Loader(e){us.detectSupport(e)}static get cache(){return cs}static clearCache(){cs.forEach((e,t)=>{this.delete(t)}),this[Is].reset()}static has(e){return cs.has(e)}static async delete(e){if(!this.has(e))return;const t=cs.get(e);hs.delete(e),cs.delete(e);(await t).dispose()}static hasFinishedLoading(e){return!!hs.get(e)}constructor(e){super(),this[ls]=(new Ve).register(e=>new os(e)),this[Cs]=e,this[fs].setDRACOLoader(gs),this[fs].setKTX2Loader(us)}get[(As=Is,ls=fs,Is)](){return this.constructor[Is]}async preload(e,t,i=()=>{}){if(this[fs].setWithCredentials(t.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!cs.has(e)){null!=bs&&this[fs].setMeshoptDecoder(await bs);const t=((e,t,i=()=>{})=>{const s=e=>{const t=e.loaded/e.total;i(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise((i,a)=>{t.load(e,i,s,a)})})(e,this[fs],e=>{i(.8*e)}),s=this[Cs],a=t.then(e=>s.prepare(e)).then(e=>(i(.9),new s(e))).catch(e=>(console.error(e),new s));cs.set(e,a)}await cs.get(e),hs.set(e,!0),i&&i(1)}async load(e,t,i=()=>{}){await this.preload(e,t,i);const s=await cs.get(e),a=await s.clone();return this[Is].retain(e),a.dispose=()=>{this[Is].release(e)},a}}Es[As]=new ns(Es);class ys extends t.Object3D{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new t.Vector2(.5,.5),this.addEventListener("removed",function(){this.traverse(function(e){e.element&&e.element instanceof e.element.ownerDocument.defaultView.Element&&null!==e.element.parentNode&&e.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const Bs=new t.Vector3,ws=new t.Matrix4,xs=new t.Matrix4,vs=new t.Vector3,Ss=new t.Vector3;class Qs{constructor(e={}){const t=this;let i,s,a,n;const r={objects:new WeakMap},o=void 0!==e.element?e.element:document.createElement("div");function A(e){e.isCSS2DObject&&(e.element.style.display="none");for(let t=0,i=e.children.length;t<i;t++)A(e.children[t])}function l(e,i,s){if(!1!==e.visible){if(e.isCSS2DObject){Bs.setFromMatrixPosition(e.matrixWorld),Bs.applyMatrix4(xs);const A=Bs.z>=-1&&Bs.z<=1&&!0===e.layers.test(s.layers),l=e.element;l.style.display=!0===A?"":"none",!0===A&&(e.onBeforeRender(t,i,s),l.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(Bs.x*a+a)+"px,"+(-Bs.y*n+n)+"px)",l.parentNode!==o&&o.appendChild(l),e.onAfterRender(t,i,s));const h={distanceToCameraSquared:c(s,e)};r.objects.set(e,h)}for(let t=0,a=e.children.length;t<a;t++)l(e.children[t],i,s)}else A(e)}function c(e,t){return vs.setFromMatrixPosition(e.matrixWorld),Ss.setFromMatrixPosition(t.matrixWorld),vs.distanceToSquared(Ss)}o.style.overflow="hidden",this.domElement=o,this.sortObjects=!0,this.getSize=function(){return{width:i,height:s}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),ws.copy(t.matrixWorldInverse),xs.multiplyMatrices(t.projectionMatrix,ws),l(e,e,t),this.sortObjects&&function(e){const t=function(e){const t=[];return e.traverseVisible(function(e){e.isCSS2DObject&&t.push(e)}),t}(e).sort(function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return r.objects.get(e).distanceToCameraSquared-r.objects.get(t).distanceToCameraSquared}),i=t.length;for(let e=0,s=t.length;e<s;e++)t[e].element.style.zIndex=i-e}(e)},this.setSize=function(e,t){i=e,s=t,a=i/2,n=s/2,o.style.width=e+"px",o.style.height=t+"px"}}}function Ms(e,i,s){let a=s;const n=new t.Vector3;return e.updateWorldMatrix(!0,!0),e.traverseVisible(e=>{const{geometry:t}=e;if(void 0!==t){const{position:s}=t.attributes;if(void 0!==s)for(let t=0,r=s.count;t<r;t++)e.isMesh?e.getVertexPosition(t,n):n.fromBufferAttribute(s,t),e.isSkinnedMesh||n.applyMatrix4(e.matrixWorld),a=i(a,n)}}),a}const Rs={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class Ts{constructor(){this.textureUtils=null,this.pluginCallbacks=[],this.register(function(e){return new ca(e)}),this.register(function(e){return new ha(e)}),this.register(function(e){return new ua(e)}),this.register(function(e){return new ma(e)}),this.register(function(e){return new ba(e)}),this.register(function(e){return new fa(e)}),this.register(function(e){return new da(e)}),this.register(function(e){return new ga(e)}),this.register(function(e){return new pa(e)}),this.register(function(e){return new Ia(e)}),this.register(function(e){return new Ca(e)}),this.register(function(e){return new Ea(e)}),this.register(function(e){return new ya(e)}),this.register(function(e){return new Ba(e)})}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}setTextureUtils(e){return this.textureUtils=e,this}parse(e,t,i,s){const a=new la,n=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)n.push(this.pluginCallbacks[e](a));a.setPlugins(n),a.setTextureUtils(this.textureUtils),a.writeAsync(e,t,s).catch(i)}parseAsync(e,t){const i=this;return new Promise(function(s,a){i.parse(e,s,a,t)})}}const Ds=0,Fs=1,ks=2,Ls=3,Ps=4,_s=5120,Us=5121,Gs=5122,Ns=5123,Os=5124,qs=5125,Hs=5126,js=34962,zs=34963,Ks=9728,Vs=9729,Js=9984,Ws=9985,Ys=9986,Xs=9987,$s=33071,Zs=33648,ea=10497,ta="KHR_mesh_quantization",ia={};ia[t.NearestFilter]=Ks,ia[t.NearestMipmapNearestFilter]=Js,ia[t.NearestMipmapLinearFilter]=Ys,ia[t.LinearFilter]=Vs,ia[t.LinearMipmapNearestFilter]=Ws,ia[t.LinearMipmapLinearFilter]=Xs,ia[t.ClampToEdgeWrapping]=$s,ia[t.RepeatWrapping]=ea,ia[t.MirroredRepeatWrapping]=Zs;const sa={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},aa=new t.Color;function na(e,t){return e.length===t.length&&e.every(function(e,i){return e===t[i]})}function ra(e){return 4*Math.ceil(e/4)}function oa(e,t=0){const i=ra(e.byteLength);if(i!==e.byteLength){const s=new Uint8Array(i);if(s.set(new Uint8Array(e)),0!==t)for(let a=e.byteLength;a<i;a++)s[a]=t;return s.buffer}return e}function Aa(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}class la{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter r"+t.REVISION}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map},this.textureUtils=null}setPlugins(e){this.plugins=e}setTextureUtils(e){this.textureUtils=e}async writeAsync(e,t,i={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},i),this.options.animations.length>0&&(this.options.trs=!0),await this.processInputAsync(e),await Promise.all(this.pending);const s=this,a=s.buffers,n=s.json;i=s.options;const r=s.extensionsUsed,o=s.extensionsRequired,A=new Blob(a,{type:"application/octet-stream"}),l=Object.keys(r),c=Object.keys(o);if(l.length>0&&(n.extensionsUsed=l),c.length>0&&(n.extensionsRequired=c),n.buffers&&n.buffers.length>0&&(n.buffers[0].byteLength=A.size),!0===i.binary){const e=new FileReader;e.readAsArrayBuffer(A),e.onloadend=function(){const i=oa(e.result),s=new DataView(new ArrayBuffer(8));s.setUint32(0,i.byteLength,!0),s.setUint32(4,5130562,!0);const a=oa((r=JSON.stringify(n),(new TextEncoder).encode(r).buffer),32);var r;const o=new DataView(new ArrayBuffer(8));o.setUint32(0,a.byteLength,!0),o.setUint32(4,1313821514,!0);const A=new ArrayBuffer(12),l=new DataView(A);l.setUint32(0,1179937895,!0),l.setUint32(4,2,!0);const c=12+o.byteLength+a.byteLength+s.byteLength+i.byteLength;l.setUint32(8,c,!0);const h=new Blob([A,o,a,s,i],{type:"application/octet-stream"}),d=new FileReader;d.readAsArrayBuffer(h),d.onloadend=function(){t(d.result)}}}else if(n.buffers&&n.buffers.length>0){const e=new FileReader;e.readAsDataURL(A),e.onloadend=function(){const i=e.result;n.buffers[0].uri=i,t(n)}}else t(n)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const i=this.options,s=this.extensionsUsed;try{const a=JSON.parse(JSON.stringify(e.userData));if(i.includeCustomExtensions&&a.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in a.gltfExtensions)t.extensions[e]=a.gltfExtensions[e],s[e]=!0;delete a.gltfExtensions}Object.keys(a).length>0&&(t.extras=a)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e,t=!1){if(!1===this.uids.has(e)){const t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const i=new t.Vector3;for(let t=0,s=e.count;t<s;t++)if(Math.abs(i.fromBufferAttribute(e,t).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const i=this.cache;if(i.attributesNormalized.has(e))return i.attributesNormalized.get(e);const s=e.clone(),a=new t.Vector3;for(let e=0,t=s.count;e<t;e++)a.fromBufferAttribute(s,e),0===a.x&&0===a.y&&0===a.z?a.setX(1):a.normalize(),s.setXYZ(e,a.x,a.y,a.z);return i.attributesNormalized.set(e,s),s}applyTextureTransform(e,t){let i=!1;const s={};0===t.offset.x&&0===t.offset.y||(s.offset=t.offset.toArray(),i=!0),0!==t.rotation&&(s.rotation=t.rotation,i=!0),1===t.repeat.x&&1===t.repeat.y||(s.scale=t.repeat.toArray(),i=!0),i&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=s,this.extensionsUsed.KHR_texture_transform=!0)}async buildMetalRoughTextureAsync(e,i){if(e===i)return e;function s(e){return e.colorSpace===t.SRGBColorSpace?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}e instanceof t.CompressedTexture&&(e=await this.decompressTextureAsync(e)),i instanceof t.CompressedTexture&&(i=await this.decompressTextureAsync(i));const a=e?e.image:null,n=i?i.image:null,r=Math.max(a?a.width:0,n?n.width:0),o=Math.max(a?a.height:0,n?n.height:0),A=Aa();A.width=r,A.height=o;const l=A.getContext("2d",{willReadFrequently:!0});l.fillStyle="#00ffff",l.fillRect(0,0,r,o);const c=l.getImageData(0,0,r,o);if(a){l.drawImage(a,0,0,r,o);const t=s(e),i=l.getImageData(0,0,r,o).data;for(let e=2;e<i.length;e+=4)c.data[e]=256*t(i[e]/256)}if(n){l.drawImage(n,0,0,r,o);const e=s(i),t=l.getImageData(0,0,r,o).data;for(let i=1;i<t.length;i+=4)c.data[i]=256*e(t[i]/256)}l.putImageData(c,0,0);const h=(e||i).clone();return h.source=new t.Source(A),h.colorSpace=t.NoColorSpace,h.channel=(e||i).channel,e&&i&&e.channel!==i.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),h}async decompressTextureAsync(e,t=1/0){if(null===this.textureUtils)throw new Error("THREE.GLTFExporter: setTextureUtils() must be called to process compressed textures.");return await this.textureUtils.decompress(e,t)}processBuffer(e){const t=this.json,i=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),i.push(e),0}processBufferView(e,i,s,a,n){const r=this.json;let o;switch(r.bufferViews||(r.bufferViews=[]),i){case _s:case Us:o=1;break;case Gs:case Ns:o=2;break;default:o=4}let A=e.itemSize*o;n===js&&(A=4*Math.ceil(A/4));const l=ra(a*A),c=new DataView(new ArrayBuffer(l));let h=0;for(let n=s;n<s+a;n++){for(let s=0;s<e.itemSize;s++){let a;e.itemSize>4?a=e.array[n*e.itemSize+s]:(0===s?a=e.getX(n):1===s?a=e.getY(n):2===s?a=e.getZ(n):3===s&&(a=e.getW(n)),!0===e.normalized&&(a=t.MathUtils.normalize(a,e.array))),i===Hs?c.setFloat32(h,a,!0):i===Os?c.setInt32(h,a,!0):i===qs?c.setUint32(h,a,!0):i===Gs?c.setInt16(h,a,!0):i===Ns?c.setUint16(h,a,!0):i===_s?c.setInt8(h,a):i===Us&&c.setUint8(h,a),h+=o}h%A!==0&&(h+=A-h%A)}const d={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};void 0!==n&&(d.target=n),n===js&&(d.byteStride=A),this.byteOffset+=l,r.bufferViews.push(d);return{id:r.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,i=t.json;return i.bufferViews||(i.bufferViews=[]),new Promise(function(s){const a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){const e=oa(a.result),n={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,s(i.bufferViews.push(n)-1)}})}processAccessor(e,i,s,a){const n=this.json;let r;if(e.array.constructor===Float32Array)r=Hs;else if(e.array.constructor===Int32Array)r=Os;else if(e.array.constructor===Uint32Array)r=qs;else if(e.array.constructor===Int16Array)r=Gs;else if(e.array.constructor===Uint16Array)r=Ns;else if(e.array.constructor===Int8Array)r=_s;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);r=Us}if(void 0===s&&(s=0),void 0!==a&&a!==1/0||(a=e.count),0===a)return null;const o=function(e,i,s){const a={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let n=i;n<i+s;n++)for(let i=0;i<e.itemSize;i++){let s;e.itemSize>4?s=e.array[n*e.itemSize+i]:(0===i?s=e.getX(n):1===i?s=e.getY(n):2===i?s=e.getZ(n):3===i&&(s=e.getW(n)),!0===e.normalized&&(s=t.MathUtils.normalize(s,e.array))),a.min[i]=Math.min(a.min[i],s),a.max[i]=Math.max(a.max[i],s)}return a}(e,s,a);let A;void 0!==i&&(A=e===i.index?zs:js);const l=this.processBufferView(e,r,s,a,A),c={bufferView:l.id,byteOffset:l.byteOffset,componentType:r,count:a,max:o.max,min:o.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(c.normalized=!0),n.accessors||(n.accessors=[]),n.accessors.push(c)-1}processImage(e,i,s,a="image/png"){if(null!==e){const n=this,r=n.cache,o=n.json,A=n.options,l=n.pending;r.images.has(e)||r.images.set(e,{});const c=r.images.get(e),h=a+":flipY/"+s.toString();if(void 0!==c[h])return c[h];o.images||(o.images=[]);const d={mimeType:a},g=Aa();g.width=Math.min(e.width,A.maxTextureSize),g.height=Math.min(e.height,A.maxTextureSize);const p=g.getContext("2d",{willReadFrequently:!0});if(!0===s&&(p.translate(0,g.height),p.scale(1,-1)),void 0!==e.data){i!==t.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported.",i),(e.width>A.maxTextureSize||e.height>A.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const s=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<s.length;t+=4)s[t+0]=e.data[t+0],s[t+1]=e.data[t+1],s[t+2]=e.data[t+2],s[t+3]=e.data[t+3];p.putImageData(new ImageData(s,e.width,e.height),0,0)}else{if(!("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas))throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");p.drawImage(e,0,0,g.width,g.height)}!0===A.binary?l.push(function(e,t){if("undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas){let i;return"image/jpeg"===t?i=.92:"image/webp"===t&&(i=.8),e.convertToBlob({type:t,quality:i})}return new Promise(i=>e.toBlob(i,t))}(g,a).then(e=>n.processBufferViewImage(e)).then(e=>{d.bufferView=e})):d.uri=t.ImageUtils.getDataURL(g,a);const u=o.images.push(d)-1;return c[h]=u,u}throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const i={magFilter:ia[e.magFilter],minFilter:ia[e.minFilter],wrapS:ia[e.wrapS],wrapT:ia[e.wrapT]};return t.samplers.push(i)-1}async processTextureAsync(e){const i=this.options,s=this.cache,a=this.json;if(s.textures.has(e))return s.textures.get(e);a.textures||(a.textures=[]),e instanceof t.CompressedTexture&&(e=await this.decompressTextureAsync(e,i.maxTextureSize));let n=e.userData.mimeType;"image/webp"===n&&(n="image/png");const r={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,n)};e.name&&(r.name=e.name),await this._invokeAllAsync(async function(t){t.writeTexture&&await t.writeTexture(e,r)});const o=a.textures.push(r)-1;return s.textures.set(e,o),o}async processMaterialAsync(e){const i=this.cache,s=this.json;if(i.materials.has(e))return i.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;s.materials||(s.materials=[]);const a={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const n=e.color.toArray().concat([e.opacity]);if(na(n,[1,1,1,1])||(a.pbrMetallicRoughness.baseColorFactor=n),e.isMeshStandardMaterial?(a.pbrMetallicRoughness.metallicFactor=e.metalness,a.pbrMetallicRoughness.roughnessFactor=e.roughness):(a.pbrMetallicRoughness.metallicFactor=0,a.pbrMetallicRoughness.roughnessFactor=1),e.metalnessMap||e.roughnessMap){const t=await this.buildMetalRoughTextureAsync(e.metalnessMap,e.roughnessMap),i={index:await this.processTextureAsync(t),texCoord:t.channel};this.applyTextureTransform(i,t),a.pbrMetallicRoughness.metallicRoughnessTexture=i}if(e.map){const t={index:await this.processTextureAsync(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),a.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){const t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(a.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const t={index:await this.processTextureAsync(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),a.emissiveTexture=t}}if(e.normalMap){const t={index:await this.processTextureAsync(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),a.normalTexture=t}if(e.aoMap){const t={index:await this.processTextureAsync(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),a.occlusionTexture=t}e.transparent?a.alphaMode="BLEND":e.alphaTest>0&&(a.alphaMode="MASK",a.alphaCutoff=e.alphaTest),e.side===t.DoubleSide&&(a.doubleSided=!0),""!==e.name&&(a.name=e.name),this.serializeUserData(e,a),await this._invokeAllAsync(async function(t){t.writeMaterialAsync&&await t.writeMaterialAsync(e,a)});const r=s.materials.push(a)-1;return i.materials.set(e,r),r}async processMeshAsync(e){const t=this.cache,i=this.json,s=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,i=e.material.length;t<i;t++)s.push(e.material[t].uuid);else s.push(e.material.uuid);const a=s.join(":");if(t.meshes.has(a))return t.meshes.get(a);const n=e.geometry;let r;r=e.isLineSegments?Fs:e.isLineLoop?ks:e.isLine?Ls:e.isPoints?Ds:e.material.wireframe?Fs:Ps;const o={},A={},l=[],c=[],h={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},d=n.getAttribute("normal");void 0===d||this.isNormalizedNormalAttribute(d)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),n.setAttribute("normal",this.createNormalizedNormalAttribute(d)));let g=null;for(let e in n.attributes){if("morph"===e.slice(0,5))continue;const i=n.attributes[e];e=h[e]||e.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),t.attributes.has(this.getUID(i))){A[e]=t.attributes.get(this.getUID(i));continue}g=null;const s=i.array;"JOINTS_0"!==e||s instanceof Uint16Array||s instanceof Uint8Array?(s instanceof Uint32Array||s instanceof Int32Array)&&!e.startsWith("_")&&(console.warn(`GLTFExporter: Attribute "${e}" converted to type FLOAT.`),g=Ts.Utils.toTypedBufferAttribute(i,Float32Array)):(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),g=Ts.Utils.toTypedBufferAttribute(i,Uint16Array));const a=this.processAccessor(g||i,n);null!==a&&(e.startsWith("_")||this.detectMeshQuantization(e,i),A[e]=a,t.attributes.set(this.getUID(i),a))}if(void 0!==d&&n.setAttribute("normal",d),0===Object.keys(A).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){const i=[],s=[],a={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)a[e.morphTargetDictionary[t]]=t;for(let r=0;r<e.morphTargetInfluences.length;++r){const o={};let A=!1;for(const e in n.morphAttributes){if("position"!==e&&"normal"!==e){A||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),A=!0);continue}const i=n.morphAttributes[e][r],s=e.toUpperCase(),a=n.attributes[e];if(t.attributes.has(this.getUID(i,!0))){o[s]=t.attributes.get(this.getUID(i,!0));continue}const l=i.clone();if(!n.morphTargetsRelative)for(let e=0,t=i.count;e<t;e++)for(let t=0;t<i.itemSize;t++)0===t&&l.setX(e,i.getX(e)-a.getX(e)),1===t&&l.setY(e,i.getY(e)-a.getY(e)),2===t&&l.setZ(e,i.getZ(e)-a.getZ(e)),3===t&&l.setW(e,i.getW(e)-a.getW(e));o[s]=this.processAccessor(l,n),t.attributes.set(this.getUID(a,!0),o[s])}c.push(o),i.push(e.morphTargetInfluences[r]),void 0!==e.morphTargetDictionary&&s.push(a[r])}o.weights=i,s.length>0&&(o.extras={},o.extras.targetNames=s)}const p=Array.isArray(e.material);if(p&&0===n.groups.length)return null;let u=!1;if(p&&null===n.index){const e=[];for(let t=0,i=n.attributes.position.count;t<i;t++)e[t]=t;n.setIndex(e),u=!0}const m=p?e.material:[e.material],b=p?n.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,i=b.length;e<i;e++){const i={mode:r,attributes:A};if(this.serializeUserData(n,i),c.length>0&&(i.targets=c),null!==n.index){let s=this.getUID(n.index);void 0===b[e].start&&void 0===b[e].count||(s+=":"+b[e].start+":"+b[e].count),t.attributes.has(s)?i.indices=t.attributes.get(s):(i.indices=this.processAccessor(n.index,n,b[e].start,b[e].count),t.attributes.set(s,i.indices)),null===i.indices&&delete i.indices}const s=await this.processMaterialAsync(m[b[e].materialIndex]);null!==s&&(i.material=s),l.push(i)}!0===u&&n.setIndex(null),o.primitives=l,i.meshes||(i.meshes=[]),await this._invokeAllAsync(function(t){t.writeMesh&&t.writeMesh(e,o)});const f=i.meshes.push(o)-1;return t.meshes.set(a,f),f}detectMeshQuantization(e,t){if(this.extensionsUsed[ta])return;let i;switch(t.array.constructor){case Int8Array:i="byte";break;case Uint8Array:i="unsigned byte";break;case Int16Array:i="short";break;case Uint16Array:i="unsigned short";break;default:return}t.normalized&&(i+=" normalized");const s=e.split("_",1)[0];Rs[s]&&Rs[s].includes(i)&&(this.extensionsUsed[ta]=!0,this.extensionsRequired[ta]=!0)}processCamera(e){const i=this.json;i.cameras||(i.cameras=[]);const s=e.isOrthographicCamera,a={type:s?"orthographic":"perspective"};return s?a.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:a.perspective={aspectRatio:e.aspect,yfov:t.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(a.name=e.type),i.cameras.push(a)-1}processAnimation(e,i){const s=this.json,a=this.nodeMap;s.animations||(s.animations=[]);const n=(e=Ts.Utils.mergeMorphTargetTracks(e.clone(),i)).tracks,r=[],o=[];for(let e=0;e<n.length;++e){const s=n[e],A=t.PropertyBinding.parseTrackName(s.name);let l=t.PropertyBinding.findNode(i,A.nodeName);const c=sa[A.propertyName];if("bones"===A.objectName&&(l=!0===l.isSkinnedMesh?l.skeleton.getBoneByName(A.objectIndex):void 0),!l||!c){console.warn('THREE.GLTFExporter: Could not export animation track "%s".',s.name);continue}const h=1;let d,g=s.values.length/s.times.length;c===sa.morphTargetInfluences&&(g/=l.morphTargetInfluences.length),!0===s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(d="CUBICSPLINE",g/=3):d=s.getInterpolation()===t.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new t.BufferAttribute(s.times,h)),output:this.processAccessor(new t.BufferAttribute(s.values,g)),interpolation:d}),r.push({sampler:o.length-1,target:{node:a.get(l),path:c}})}const A={name:e.name||"clip_"+s.animations.length,samplers:o,channels:r};return this.serializeUserData(e,A),s.animations.push(A),s.animations.length-1}processSkin(e){const i=this.json,s=this.nodeMap,a=i.nodes[s.get(e)],n=e.skeleton;if(void 0===n)return null;const r=e.skeleton.bones[0];if(void 0===r)return null;const o=[],A=new Float32Array(16*n.bones.length),l=new t.Matrix4;for(let t=0;t<n.bones.length;++t)o.push(s.get(n.bones[t])),l.copy(n.boneInverses[t]),l.multiply(e.bindMatrix).toArray(A,16*t);void 0===i.skins&&(i.skins=[]),i.skins.push({inverseBindMatrices:this.processAccessor(new t.BufferAttribute(A,16)),joints:o,skeleton:s.get(r)});return a.skin=i.skins.length-1}async processNodeAsync(e){const t=this.json,i=this.options,s=this.nodeMap;if(t.nodes||(t.nodes=[]),null!==e.pivot)return await this._processNodeWithPivotAsync(e);const a={};if(i.trs){const t=e.quaternion.toArray(),i=e.position.toArray(),s=e.scale.toArray();na(t,[0,0,0,1])||(a.rotation=t),na(i,[0,0,0])||(a.translation=i),na(s,[1,1,1])||(a.scale=s)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===na(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(a.matrix=e.matrix.elements);if(""!==e.name&&(a.name=String(e.name)),this.serializeUserData(e,a),e.isMesh||e.isLine||e.isPoints){const t=await this.processMeshAsync(e);null!==t&&(a.mesh=t)}else e.isCamera&&(a.camera=this.processCamera(e));e.isSkinnedMesh&&this.skins.push(e);const n=t.nodes.push(a)-1;if(s.set(e,n),e.children.length>0){const t=[];for(let s=0,a=e.children.length;s<a;s++){const a=e.children[s];if(a.visible||!1===i.onlyVisible){const e=await this.processNodeAsync(a);null!==e&&t.push(e)}}t.length>0&&(a.children=t)}return await this._invokeAllAsync(function(t){t.writeNode&&t.writeNode(e,a)}),n}async _processNodeWithPivotAsync(e){const t=this.json,i=this.options,s=this.nodeMap,a=e.pivot,n={},r=e.quaternion.toArray(),o=[e.position.x+a.x,e.position.y+a.y,e.position.z+a.z],A=e.scale.toArray();na(r,[0,0,0,1])||(n.rotation=r),na(o,[0,0,0])||(n.translation=o),na(A,[1,1,1])||(n.scale=A),n.extras={pivot:a.toArray()},""!==e.name&&(n.name=String(e.name)),this.serializeUserData(e,n);const l=t.nodes.push(n)-1;s.set(e,l);const c={},h=[-a.x,-a.y,-a.z];if(na(h,[0,0,0])||(c.translation=h),e.isMesh||e.isLine||e.isPoints){const t=await this.processMeshAsync(e);null!==t&&(c.mesh=t)}else e.isCamera&&(c.camera=this.processCamera(e));e.isSkinnedMesh&&this.skins.push(e);const d=[t.nodes.push(c)-1];if(e.children.length>0){const t=[];for(let s=0,a=e.children.length;s<a;s++){const a=e.children[s];if(a.visible||!1===i.onlyVisible){const e=await this.processNodeAsync(a);null!==e&&t.push(e)}}t.length>0&&(c.children=t)}return n.children=d,await this._invokeAllAsync(function(t){t.writeNode&&t.writeNode(e,n)}),l}async processSceneAsync(e){const t=this.json,i=this.options;t.scenes||(t.scenes=[],t.scene=0);const s={};""!==e.name&&(s.name=e.name),t.scenes.push(s);const a=[];for(let t=0,s=e.children.length;t<s;t++){const s=e.children[t];if(s.visible||!1===i.onlyVisible){const e=await this.processNodeAsync(s);null!==e&&a.push(e)}}a.length>0&&(s.nodes=a),this.serializeUserData(e,s)}async processObjectsAsync(e){const i=new t.Scene;i.name="AuxScene";for(let t=0;t<e.length;t++)i.children.push(e[t]);await this.processSceneAsync(i)}async processInputAsync(e){const i=this.options;e=e instanceof Array?e:[e],await this._invokeAllAsync(function(t){t.beforeParse&&t.beforeParse(e)});const s=[];for(let i=0;i<e.length;i++)e[i]instanceof t.Scene?await this.processSceneAsync(e[i]):s.push(e[i]);s.length>0&&await this.processObjectsAsync(s);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let t=0;t<i.animations.length;++t)this.processAnimation(i.animations[t],e[0]);await this._invokeAllAsync(function(t){t.afterParse&&t.afterParse(e)})}async _invokeAllAsync(e){for(let t=0,i=this.plugins.length;t<i;t++)await e(this.plugins[t])}}class ca{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);const i=this.writer,s=i.json,a=i.extensionsUsed,n={};e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",e.distance>0&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",e.distance>0&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(1-e.penumbra)*e.angle,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),a[this.name]||(s.extensions=s.extensions||{},s.extensions[this.name]={lights:[]},a[this.name]=!0);const r=s.extensions[this.name].lights;r.push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:r.length-1}}}class ha{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}async writeMaterialAsync(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class da{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;const i=this.writer,s=i.extensionsUsed,a={};if(a.clearcoatFactor=e.clearcoat,e.clearcoatMap){const t={index:await i.processTextureAsync(e.clearcoatMap),texCoord:e.clearcoatMap.channel};i.applyTextureTransform(t,e.clearcoatMap),a.clearcoatTexture=t}if(a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const t={index:await i.processTextureAsync(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};i.applyTextureTransform(t,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){const t={index:await i.processTextureAsync(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};1!==e.clearcoatNormalScale.x&&(t.scale=e.clearcoatNormalScale.x),i.applyTextureTransform(t,e.clearcoatNormalMap),a.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class ga{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.dispersion)return;const i=this.writer.extensionsUsed,s={};s.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class pa{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;const i=this.writer,s=i.extensionsUsed,a={};if(a.iridescenceFactor=e.iridescence,e.iridescenceMap){const t={index:await i.processTextureAsync(e.iridescenceMap),texCoord:e.iridescenceMap.channel};i.applyTextureTransform(t,e.iridescenceMap),a.iridescenceTexture=t}if(a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const t={index:await i.processTextureAsync(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};i.applyTextureTransform(t,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class ua{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const i=this.writer,s=i.extensionsUsed,a={};if(a.transmissionFactor=e.transmission,e.transmissionMap){const t={index:await i.processTextureAsync(e.transmissionMap),texCoord:e.transmissionMap.channel};i.applyTextureTransform(t,e.transmissionMap),a.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class ma{constructor(e){this.writer=e,this.name="KHR_materials_volume"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const i=this.writer,s=i.extensionsUsed,a={};if(a.thicknessFactor=e.thickness,e.thicknessMap){const t={index:await i.processTextureAsync(e.thicknessMap),texCoord:e.thicknessMap.channel};i.applyTextureTransform(t,e.thicknessMap),a.thicknessTexture=t}e.attenuationDistance!==1/0&&(a.attenuationDistance=e.attenuationDistance),a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class ba{constructor(e){this.writer=e,this.name="KHR_materials_ior"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;const i=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class fa{constructor(e){this.writer=e,this.name="KHR_materials_specular"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(aa)&&!e.specularIntensityMap&&!e.specularColorMap)return;const i=this.writer,s=i.extensionsUsed,a={};if(e.specularIntensityMap){const t={index:await i.processTextureAsync(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};i.applyTextureTransform(t,e.specularIntensityMap),a.specularTexture=t}if(e.specularColorMap){const t={index:await i.processTextureAsync(e.specularColorMap),texCoord:e.specularColorMap.channel};i.applyTextureTransform(t,e.specularColorMap),a.specularColorTexture=t}a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class Ia{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;const i=this.writer,s=i.extensionsUsed,a={};if(e.sheenRoughnessMap){const t={index:await i.processTextureAsync(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};i.applyTextureTransform(t,e.sheenRoughnessMap),a.sheenRoughnessTexture=t}if(e.sheenColorMap){const t={index:await i.processTextureAsync(e.sheenColorMap),texCoord:e.sheenColorMap.channel};i.applyTextureTransform(t,e.sheenColorMap),a.sheenColorTexture=t}a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class Ca{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;const i=this.writer,s=i.extensionsUsed,a={};if(e.anisotropyMap){const t={index:await i.processTextureAsync(e.anisotropyMap)};i.applyTextureTransform(t,e.anisotropyMap),a.anisotropyTexture=t}a.anisotropyStrength=e.anisotropy,a.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class Ea{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;const i=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class ya{constructor(e){this.writer=e,this.name="EXT_materials_bump"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;const i=this.writer,s=i.extensionsUsed,a={};if(e.bumpMap){const t={index:await i.processTextureAsync(e.bumpMap),texCoord:e.bumpMap.channel};i.applyTextureTransform(t,e.bumpMap),a.bumpTexture=t}a.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class Ba{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,i){if(!e.isInstancedMesh)return;const s=this.writer,a=e,n=new Float32Array(3*a.count),r=new Float32Array(4*a.count),o=new Float32Array(3*a.count),A=new t.Matrix4,l=new t.Vector3,c=new t.Quaternion,h=new t.Vector3;for(let e=0;e<a.count;e++)a.getMatrixAt(e,A),A.decompose(l,c,h),l.toArray(n,3*e),c.toArray(r,4*e),h.toArray(o,3*e);const d={TRANSLATION:s.processAccessor(new t.BufferAttribute(n,3)),ROTATION:s.processAccessor(new t.BufferAttribute(r,4)),SCALE:s.processAccessor(new t.BufferAttribute(o,3))};a.instanceColor&&(d._COLOR_0=s.processAccessor(a.instanceColor)),i.extensions=i.extensions||{},i.extensions[this.name]={attributes:d},s.extensionsUsed[this.name]=!0,s.extensionsRequired[this.name]=!0}}let wa,xa,va,Sa;Ts.Utils={insertKeyframe:function(e,t){const i=.001,s=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),n=new e.ValueBufferType(e.values.length+s),r=e.createInterpolant(new e.ValueBufferType(s));let o;if(0===e.times.length){a[0]=t;for(let e=0;e<s;e++)n[e]=0;o=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<i)return 0;a[0]=t,a.set(e.times,1),n.set(r.evaluate(t),0),n.set(e.values,s),o=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<i)return e.times.length-1;a[a.length-1]=t,a.set(e.times,0),n.set(e.values,0),n.set(r.evaluate(t),e.values.length),o=a.length-1}else for(let A=0;A<e.times.length;A++){if(Math.abs(e.times[A]-t)<i)return A;if(e.times[A]<t&&e.times[A+1]>t){a.set(e.times.slice(0,A+1),0),a[A+1]=t,a.set(e.times.slice(A+1),A+2),n.set(e.values.slice(0,(A+1)*s),0),n.set(r.evaluate(t),(A+1)*s),n.set(e.values.slice((A+1)*s),(A+2)*s),o=A+1;break}}return e.times=a,e.values=n,o},mergeMorphTargetTracks:function(e,i){const s=[],a={},n=e.tracks;for(let e=0;e<n.length;++e){let r=n[e];const o=t.PropertyBinding.parseTrackName(r.name),A=t.PropertyBinding.findNode(i,o.nodeName);if("morphTargetInfluences"!==o.propertyName||void 0===o.propertyIndex){s.push(r);continue}if(r.createInterpolant!==r.InterpolantFactoryMethodDiscrete&&r.createInterpolant!==r.InterpolantFactoryMethodLinear){if(r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),r=r.clone(),r.setInterpolation(t.InterpolateLinear)}const l=A.morphTargetInfluences.length,c=A.morphTargetDictionary[o.propertyIndex];if(void 0===c)throw new Error("THREE.GLTFExporter: Morph target name not found: "+o.propertyIndex);let h;if(void 0===a[A.uuid]){h=r.clone();const e=new h.ValueBufferType(l*h.times.length);for(let t=0;t<h.times.length;t++)e[t*l+c]=h.values[t];h.name=(o.nodeName||"")+".morphTargetInfluences",h.values=e,a[A.uuid]=h,s.push(h);continue}const d=r.createInterpolant(new r.ValueBufferType(1));h=a[A.uuid];for(let e=0;e<h.times.length;e++)h.values[e*l+c]=d.evaluate(h.times[e]);for(let e=0;e<r.times.length;e++){const t=this.insertKeyframe(h,r.times[e]);h.values[t*l+c]=r.values[e]}}return e.tracks=s,e},toTypedBufferAttribute:function(e,i){const s=new t.BufferAttribute(new i(e.count*e.itemSize),e.itemSize,!1);if(!e.normalized&&!e.isInterleavedBufferAttribute)return s.array.set(e.array),s;for(let t=0,i=e.count;t<i;t++)for(let i=0;i<e.itemSize;i++)s.setComponent(t,i,e.getComponent(t,i));return s}};
/* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const Qa=e=>void 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter(e=>Ma(e.material)),Ma=e=>!(!e||!e.isMaterial||Array.isArray(e));class Ra{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){const t=new Set,i=e=>{if(!Qa(e))return;const i=e.userData.variantMaterials,s=e.userData.variantData;for(const[e,a]of s){const s=i.get(a.index);s&&Ma(s.material)&&t.add(e)}};if(Array.isArray(e))for(const t of e)t.traverse(i);else e.traverse(i);t.forEach(e=>this.variantNames.push(e))}async writeMesh(e,t){if(!Qa(e))return;const i=e.userData,s=i.variantMaterials,a=i.variantData,n=new Map,r=new Map,o=Array.from(a.values()).sort((e,t)=>e.index-t.index);for(const[e,t]of o.entries())r.set(t.index,e);for(const e of a.values()){const t=s.get(e.index);if(!t||!Ma(t.material))continue;const i=await this.writer.processMaterialAsync(t.material);n.has(i)||n.set(i,{material:i,variants:[]}),n.get(i).variants.push(r.get(e.index))}const A=Array.from(n.values()).map(e=>e.variants.sort((e,t)=>e-t)&&e).sort((e,t)=>e.material-t.material);if(0===A.length)return;const l=Ma(i.originalMaterial)?await this.writer.processMaterialAsync(i.originalMaterial):-1;for(const e of t.primitives)l>=0&&(e.material=l),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:A}}afterParse(){if(0===this.variantNames.length)return;const e=this.writer.json;e.extensions=e.extensions||{};const t=this.variantNames.map(e=>({name:e}));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}class Ta{constructor(e,i,s,a,n){this.xrLight=e,this.renderer=i,this.lightProbe=s,this.xrWebGLBinding=null,this.estimationStartCallback=n,this.frameCallback=this.onXRFrame.bind(this);const r=i.xr.getSession();if(a&&"XRWebGLBinding"in window){const s=new t.WebGLCubeRenderTarget(16);e.environment=s.texture;const a=i.getContext();switch(r.preferredReflectionFormat){case"srgba8":a.getExtension("EXT_sRGB");break;case"rgba16f":a.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(r,a),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}r.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const i=t.getLightEstimate(this.lightProbe);if(i){this.xrLight.lightProbe.sh.fromArray(i.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const e=Math.max(1,Math.max(i.primaryLightIntensity.x,Math.max(i.primaryLightIntensity.y,i.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(i.primaryLightIntensity.x/e,i.primaryLightIntensity.y/e,i.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(i.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class Da extends t.Group{constructor(e,i=!0){super(),this.lightProbe=new t.LightProbe,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new t.DirectionalLight,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let s=null,a=!1;e.xr.addEventListener("sessionstart",()=>{const t=e.xr.getSession();"requestLightProbe"in t&&t.requestLightProbe({reflectionFormat:t.preferredReflectionFormat}).then(t=>{s=new Ta(this,e,t,i,()=>{a=!0,this.dispatchEvent({type:"estimationstart"})})})}),e.xr.addEventListener("sessionend",()=>{s&&(s.dispose(),s=null),a&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{s&&(s.dispose(),s=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class Fa{constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,i,s){const a=2e-4*this.naturalFrequency;if(null==e||0===s)return t;if(e===t&&0===this.velocity)return t;if(i<0)return e;const n=e-t,r=this.velocity+this.naturalFrequency*n,o=n+i*r,A=Math.exp(-this.naturalFrequency*i),l=(r-this.naturalFrequency*o)*A,c=-this.naturalFrequency*(l+r*A);return Math.abs(l)<a*Math.abs(s)&&c*n>=0?(this.velocity=0,t):(this.velocity=l,t+o*A)}}
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const ka={MIN_TOUCH_AREA:.05,BASE_RADIUS:.15,LINE_WIDTH:.02,SEGMENTS:16,DELTA_PHI:Math.PI/32,COLORS:{EDGE_FALLOFF:new t.Color(.98,.98,.98),EDGE_CUTOFF:new t.Color(.8,.8,.8),FILL_FALLOFF:new t.Color(.4,.4,.4),FILL_CUTOFF:new t.Color(.4,.4,.4),ACTIVE_EDGE:new t.Color(1,1,1),ACTIVE_FILL:new t.Color(.6,.6,.6)},MAX_OPACITY:.75,FILL_OPACITY_MULTIPLIER:.5,INTERACTIVE_OPACITY_MULTIPLIER:1.2,MIN_DISTANCE:.5,MAX_DISTANCE:10,BASE_SCALE:1,DISTANCE_SCALE_FACTOR:.3,COLOR_LERP_FACTOR:.15,SCREEN_SPACE_SCALE:1.2,SIZE_UPDATE_THRESHOLD:.001,GEOMETRY_UPDATE_DEBOUNCE:100},La=new t.Vector2,Pa=(e,t,i,s,a)=>{let n=t>0?i>0?0:-Math.PI/2:i>0?Math.PI/2:Math.PI;for(let r=0;r<=ka.SEGMENTS;++r)e.push(t+(s-a)*Math.cos(n),i+(s-a)*Math.sin(n),0,t+s*Math.cos(n),i+s*Math.sin(n),0),n+=ka.DELTA_PHI};class _a extends t.Mesh{constructor(e,i){super(new t.BufferGeometry),this.shadowHeight=0,this.isActive=!1,this.isHovered=!1,this.lastGeometryUpdateTime=0,this.needsGeometryUpdate=!1,this.scene=e,this.side=i,this.currentSize=new t.Vector3,this.goalSize=new t.Vector3,this.sizeDamper=new Fa,this.updateSizeFromScene(),this.edgeMaterial=new t.MeshBasicMaterial({color:ka.COLORS.EDGE_FALLOFF,transparent:!0,opacity:0,side:t.DoubleSide,depthWrite:!1,blending:t.AdditiveBlending}),this.fillMaterial=new t.MeshBasicMaterial({color:ka.COLORS.FILL_FALLOFF,transparent:!0,opacity:0,side:t.DoubleSide,depthWrite:!1,blending:t.NormalBlending}),this.material=this.edgeMaterial,this.goalOpacity=0,this.opacityDamper=new Fa,this.createHitMeshes(),this.updatePositionFromScene(),e.target.add(this),e.target.add(this.hitBox),this.offsetHeight=0}updateSizeFromScene(){const{size:e}=this.scene;this.goalSize.copy(e);const t=Math.sqrt(e.x*e.x+e.z*e.z),i=Math.max(ka.MIN_TOUCH_AREA,.4*t);this.goalSize.x<i&&(this.goalSize.x=i),this.goalSize.z<i&&(this.goalSize.z=i),this.updateGeometry()}updateGeometry(){const e=this.geometry,i=[],s=[],a=this.goalSize.x/2,n=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,r=Math.min(a,n),o=Math.max(.7*ka.BASE_RADIUS,.2*r),A=Math.max(.7*ka.LINE_WIDTH,.025*r);Pa(s,a,n,o,A),Pa(s,-a,n,o,A),Pa(s,-a,-n,o,A),Pa(s,a,-n,o,A);const l=s.length/3;for(let e=0;e<l-2;e+=2)i.push(e,e+1,e+3,e,e+3,e+2);const c=l-2;i.push(c,c+1,1,c,1,0),e.setAttribute("position",new t.Float32BufferAttribute(s,3)),e.setIndex(i),e.computeBoundingSphere()}createHitMeshes(){const e=this.goalSize.x/2,i=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,s=Math.min(e,i),a=Math.max(.7*ka.BASE_RADIUS,.2*s);this.hitPlane=new t.Mesh(new t.PlaneGeometry(2*(e+a),2*(i+a))),this.hitPlane.visible=!1,this.hitPlane.material.side=t.DoubleSide,this.add(this.hitPlane),this.hitBox=new t.Mesh(new t.BoxGeometry(this.goalSize.x+2*a,this.goalSize.y+a,this.goalSize.z+2*a)),this.hitBox.visible=!1,this.hitBox.material.side=t.DoubleSide,this.add(this.hitBox)}updatePositionFromScene(){const{boundingBox:e}=this.scene;switch(e.getCenter(this.position),this.rotation.set(0,0,0),this.side){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=e.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=e.min.z,this.position.z=this.shadowHeight}if(this.hitBox){const t=(this.side,(this.goalSize.y+ka.BASE_RADIUS)/2);this.hitBox.position.y=t+e.min.y}}updateFromModelChanges(){this.updateSizeFromScene(),this.updatePositionFromScene(),this.updateGeometry(),this.updateHitMeshes(),this.ensureProperOrientation(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=performance.now()}ensureProperOrientation(){"bottom"===this.side?(this.rotation.x=-Math.PI/2,this.rotation.y=0,this.rotation.z=0):"back"===this.side&&(this.rotation.x=0,this.rotation.y=0,this.rotation.z=0)}setScreenSpaceMode(e){e?this.scale.set(ka.SCREEN_SPACE_SCALE,ka.SCREEN_SPACE_SCALE,ka.SCREEN_SPACE_SCALE):this.scale.set(1,1,1)}updateHitMeshes(){if(this.hitPlane&&this.hitBox){const e=this.goalSize.x/2,i=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,s=Math.min(e,i),a=Math.max(.7*ka.BASE_RADIUS,.2*s),n=new t.PlaneGeometry(2*(e+a),2*(i+a));this.hitPlane.geometry.dispose(),this.hitPlane.geometry=n;const r=new t.BoxGeometry(this.goalSize.x+2*a,this.goalSize.y+a,this.goalSize.z+2*a);this.hitBox.geometry.dispose(),this.hitBox.geometry=r}}setInteractionState(e,t=!1){this.isActive=e,this.isHovered=t,this.updateVisualState()}updateVisualState(){let e,t;this.isActive?(e=ka.COLORS.ACTIVE_EDGE,t=ka.COLORS.ACTIVE_FILL):this.isHovered?(e=ka.COLORS.EDGE_FALLOFF,t=ka.COLORS.FILL_FALLOFF):(e=ka.COLORS.EDGE_CUTOFF,t=ka.COLORS.FILL_CUTOFF),this.edgeMaterial.color.lerp(e,ka.COLOR_LERP_FACTOR),this.fillMaterial.color.lerp(t,ka.COLOR_LERP_FACTOR)}applyDistanceScaling(e){const t=e.distanceTo(this.position),i=Math.max(ka.MIN_DISTANCE,Math.min(ka.MAX_DISTANCE,t)),s=ka.BASE_SCALE+(i-ka.MIN_DISTANCE)*ka.DISTANCE_SCALE_FACTOR;this.scale.set(s,s,s)}getHit(e,t,i){La.set(t,-i),this.hitPlane.visible=!0;const s=e.positionAndNormalFromPoint(La,this.hitPlane);return this.hitPlane.visible=!1,null==s?null:s.position}getExpandedHit(e,t,i){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const s=this.getHit(e,t,i);return this.hitPlane.scale.set(1,1,1),s}controllerIntersection(e,t){this.hitBox.visible=!0;const i=e.hitFromController(t,this.hitBox);return this.hitBox.visible=!1,i}set offsetHeight(e){e-=.001,"back"===this.side?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?ka.MAX_OPACITY:0}updateOpacity(e){const t=this.material,i=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1);this.edgeMaterial.opacity=i,this.fillMaterial.opacity=i*ka.FILL_OPACITY_MULTIPLIER,(this.isActive||this.isHovered)&&(this.edgeMaterial.opacity=i*ka.INTERACTIVE_OPACITY_MULTIPLIER),this.visible=i>0}update(e,i){if(this.updateOpacity(e),!this.currentSize.equals(this.goalSize)){const i=new t.Vector3;i.x=this.sizeDamper.update(this.currentSize.x,this.goalSize.x,e,1),i.y=this.sizeDamper.update(this.currentSize.y,this.goalSize.y,e,1),i.z=this.sizeDamper.update(this.currentSize.z,this.goalSize.z,e,1);i.distanceTo(this.currentSize)>ka.SIZE_UPDATE_THRESHOLD&&(this.currentSize.copy(i),this.needsGeometryUpdate=!0)}const s=performance.now();this.needsGeometryUpdate&&s-this.lastGeometryUpdateTime>ka.GEOMETRY_UPDATE_DEBOUNCE&&(this.updateGeometry(),this.updateHitMeshes(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=s),i&&this.applyDistanceScaling(i),this.updateVisualState()}getSize(){return this.goalSize.clone()}dispose(){const{geometry:e,material:t}=this.hitPlane;e.dispose(),t.dispose(),this.hitBox.geometry.dispose(),this.hitBox.material.dispose(),this.geometry.dispose(),this.edgeMaterial.dispose(),this.fillMaterial.dispose(),this.hitBox.removeFromParent(),this.removeFromParent()}}
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const Ua=(e,t)=>({type:"number",number:e,unit:t}),Ga=(()=>{const e={};return t=>{const i=t;if(i in e)return e[i];const s=[];let a=0;for(;t;){if(++a>1e3){t="";break}const e=Na(t),i=e.nodes[0];if(null==i||0===i.terms.length)break;s.push(i),t=e.remainingInput}return e[i]=s}})(),Na=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,i=/^[\),]/;return s=>{const a=[];for(;s.length&&(s=s.trim(),!i.test(s));)if("("===s[0]){const{nodes:e,remainingInput:t}=ja(s);s=t,a.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(s)){const e=Oa(s),t=e.nodes[0];if("("===(s=e.remainingInput)[0]){const{nodes:e,remainingInput:i}=ja(s);a.push({type:"function",name:t,arguments:e}),s=i}else a.push(t)}else if(t.test(s))a.push({type:"operator",value:s[0]}),s=s.slice(1);else{const{nodes:e,remainingInput:t}="#"===s[0]?Ha(s):qa(s);if(0===e.length)break;a.push(e[0]),s=t}return{nodes:[{type:"expression",terms:a}],remainingInput:s}}})(),Oa=(()=>{const e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{const i=t.match(e);return{nodes:[{type:"ident",value:null==i?t:t.substr(0,i.index)}],remainingInput:null==i?"":t.substr(i.index)}}})(),qa=(()=>{const e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,i=/^(m|mm|cm|rad|deg|[%])$/;return s=>{const a=s.match(e),n=null==a?"0":a[0],r=(s=null==n?s:s.slice(n.length)).match(t);let o=null!=r&&""!==r[0]?r[0]:null;const A=null==r?s:s.slice(o.length);return null==o||i.test(o)||(o=null),{nodes:[{type:"number",number:parseFloat(n)||0,unit:o}],remainingInput:A}}})(),Ha=(()=>{const e=/^([a-f0-9]{8}|[a-f0-9]{6}|[a-f0-9]{4}|[a-f0-9]{3})(?![a-f0-9])/i;return t=>{const i=(t=t.slice(1).trim()).match(e);return{nodes:null==i?[]:[{type:"hex",value:i[0]}],remainingInput:null==i?t:t.slice(i[0].length)}}})(),ja=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const i=Na(e);if(t.push(i.nodes[0]),","===(e=i.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},za=Symbol("visitedTypes");class Ka{constructor(e){this[za]=e}walk(e,t){const i=e.slice();for(;i.length;){const e=i.shift();switch(this[za].indexOf(e.type)>-1&&t(e),e.type){case"expression":i.unshift(...e.terms);break;case"function":i.unshift(e.name,...e.arguments)}}}}const Va=Object.freeze({type:"number",number:0,unit:null}),Ja=(e,t=0)=>{const{number:i,unit:s}=e;if(!isFinite(i))return{type:"number",number:t,unit:"rad"};if("rad"===e.unit||null==e.unit)return e;return{type:"number",number:("deg"===s&&null!=i?i:0)*Math.PI/180,unit:"rad"}},Wa=(e,t=0)=>{let i,{number:s,unit:a}=e;if(isFinite(s)){if("m"===e.unit)return e}else s=t,a="m";switch(a){default:i=1;break;case"cm":i=.01;break;case"mm":i=.001}return{type:"number",number:i*s,unit:"m"}},Ya=(()=>{const e=e=>e,t={rad:e,deg:Ja,m:e,mm:Wa,cm:Wa};return(e,i=Va)=>{isFinite(e.number)||(e.number=i.number,e.unit=i.unit);const{unit:s}=e;if(null==s)return e;const a=t[s];return null==a?i:a(e)}})();
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Xa,$a,Za;const en=Symbol("evaluate"),tn=Symbol("lastValue");class sn{constructor(){this[Xa]=null}static evaluatableFor(e,t=Va){if(e instanceof sn)return e;if("number"===e.type)return"%"===e.unit?new rn(e,t):e;switch(e.name.value){case"calc":return new hn(e,t);case"env":return new An(e)}return Va}static evaluate(e){return e instanceof sn?e.evaluate():e}static isConstant(e){return!(e instanceof sn)||e.isConstant}static applyIntrinsics(e,t){const{basis:i,keywords:s}=t,{auto:a}=s;return i.map((t,i)=>{const n=null==a[i]?t:a[i];let r=e[i]?e[i]:n;if("ident"===r.type){const e=r.value;e in s&&(r=s[e][i])}return null!=r&&"ident"!==r.type||(r=n),"%"===r.unit?Ua(r.number/100*t.number,t.unit):(r=Ya(r,t),r.unit!==t.unit?t:r)})}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[tn]||(this[tn]=this[en]()),this[tn]}}Xa=tn;const an=Symbol("percentage"),nn=Symbol("basis");class rn extends sn{constructor(e,t){super(),this[an]=e,this[nn]=t}get isConstant(){return!0}[en](){return Ua(this[an].number/100*this[nn].number,this[nn].unit)}}const on=Symbol("identNode");class An extends sn{constructor(e){super(),this[$a]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[on]=t)}get isConstant(){return!1}[($a=on,en)](){if(null!=this[on]&&"window-scroll-y"===this[on].value){return{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}}return Va}}const ln=/[\*\/]/,cn=Symbol("evaluator");class hn extends sn{constructor(e,t=Va){if(super(),this[Za]=null,1!==e.arguments.length)return;const i=e.arguments[0].terms.slice(),s=[];for(;i.length;){const e=i.shift();if(s.length>0){const i=s[s.length-1];if("operator"===i.type&&ln.test(i.value)){const i=s.pop(),a=s.pop();if(null==a)return;s.push(new un(i,sn.evaluatableFor(a,t),sn.evaluatableFor(e,t)));continue}}s.push("operator"===e.type?e:sn.evaluatableFor(e,t))}for(;s.length>2;){const[e,i,a]=s.splice(0,3);if("operator"!==i.type)return;s.unshift(new un(i,sn.evaluatableFor(e,t),sn.evaluatableFor(a,t)))}1===s.length&&(this[cn]=s[0])}get isConstant(){return null==this[cn]||sn.isConstant(this[cn])}[(Za=cn,en)](){return null!=this[cn]?sn.evaluate(this[cn]):Va}}const dn=Symbol("operator"),gn=Symbol("left"),pn=Symbol("right");class un extends sn{constructor(e,t,i){super(),this[dn]=e,this[gn]=t,this[pn]=i}get isConstant(){return sn.isConstant(this[gn])&&sn.isConstant(this[pn])}[en](){const e=Ya(sn.evaluate(this[gn])),t=Ya(sn.evaluate(this[pn])),{number:i,unit:s}=e,{number:a,unit:n}=t;if(null!=n&&null!=s&&n!=s)return Va;const r=s||n;let o;switch(this[dn].value){case"+":o=i+a;break;case"-":o=i-a;break;case"/":o=i/a;break;case"*":o=i*a;break;default:return Va}return{type:"number",number:o,unit:r}}}const mn=Symbol("evaluatables"),bn=Symbol("intrinsics");class fn extends sn{constructor(e,t){super(),this[bn]=t;const i=e[0],s=null!=i?i.terms:[];this[mn]=t.basis.map((e,t)=>{const i=s[t];return null==i?{type:"ident",value:"auto"}:"ident"===i.type?i:sn.evaluatableFor(i,e)})}get isConstant(){for(const e of this[mn])if(!sn.isConstant(e))return!1;return!0}[en](){const e=this[mn].map(e=>sn.evaluate(e));return sn.applyIntrinsics(e,this[bn]).map(e=>e.number)}}
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var In,Cn,En,yn;const Bn=Symbol("instances"),wn=Symbol("activateListener"),xn=Symbol("deactivateListener"),vn=Symbol("notifyInstances"),Sn=Symbol("notify"),Qn=Symbol("callback");class Mn{static[vn](){for(const e of Mn[Bn])e[Sn]()}static[(In=Bn,wn)](){window.addEventListener("scroll",this[vn],{passive:!0})}static[xn](){window.removeEventListener("scroll",this[vn])}constructor(e){this[Qn]=e}observe(){0===Mn[Bn].size&&Mn[wn](),Mn[Bn].add(this)}disconnect(){Mn[Bn].delete(this),0===Mn[Bn].size&&Mn[xn]()}[Sn](){this[Qn]()}}Mn[In]=new Set;const Rn=Symbol("computeStyleCallback"),Tn=Symbol("astWalker"),Dn=Symbol("dependencies"),Fn=Symbol("onScroll");class kn{constructor(e){this[Cn]={},this[En]=new Ka(["function"]),this[yn]=()=>{this[Rn]({relatedState:"window-scroll"})},this[Rn]=e}observeEffectsFor(e){const t={},i=this[Dn];this[Tn].walk(e,e=>{const{name:s}=e,a=e.arguments[0].terms[0];if("env"===s.value&&null!=a&&"ident"===a.type&&"window-scroll-y"===a.value)if(null==t["window-scroll"]){const e="window-scroll"in i?i["window-scroll"]:new Mn(this[Fn]);e.observe(),delete i["window-scroll"],t["window-scroll"]=e}});for(const e in i){i[e].disconnect()}this[Dn]=t}dispose(){for(const e in this[Dn]){this[Dn][e].disconnect()}}}Cn=Dn,En=Tn,yn=Fn;
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const Ln=e=>{const t=e.observeEffects||!1,i=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(s,a)=>{const n=s.updated,r=s.connectedCallback,o=s.disconnectedCallback,A=Symbol(`${a}StyleEffector`),l=Symbol(`${a}StyleEvaluator`),c=Symbol(`${a}UpdateEvaluator`),h=Symbol(`${a}EvaluateAndSync`);Object.defineProperties(s,{[A]:{value:null,writable:!0},[l]:{value:null,writable:!0},[c]:{value:function(){const e=Ga(this[a]);this[l]=new fn(e,i(this)),null==this[A]&&t&&(this[A]=new kn(()=>this[h]())),null!=this[A]&&this[A].observeEffectsFor(e)}},[h]:{value:function(){if(null==this[l])return;const t=this[l].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(a)&&(this[c](),this[h]()),n.call(this,e)}},connectedCallback:{value:function(){r.call(this),this.requestUpdate(a,this[a])}},disconnectedCallback:{value:function(){o.call(this),null!=this[A]&&(this[A].dispose(),this[A]=null)}}})}},Pn=e=>e<.5?2*e*e:(4-2*e)*e-1,_n=(e,t,i=Pn)=>s=>e+(t-e)*i(s),Un=e=>{const t=[],i=[];let s=e.initialValue;for(let a=0;a<e.keyframes.length;++a){const n=e.keyframes[a],{value:r,frames:o}=n,A=n.ease||Pn,l=_n(s,r,A);t.push(l),i.push(o),s=r}return((e,t)=>{const i=t.map((s=0,e=>s+=e));var s;return t=>{t=De(t,0,1),t*=i[i.length-1];const s=i.findIndex(e=>e>=t),a=s<1?0:i[s-1],n=i[s];return e[s]((t-a)/(n-a))}})(t,i)};
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Gn=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const Nn=Un({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),On=Un({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),qn="0deg 75deg 105%",Hn=["front","right","back","left"],jn=["upper-","","lower-"],zn="auto",Kn="basic",Vn="wiggle",Jn="none",Wn=()=>({basis:[Ja(Ua(30,"deg"))],keywords:{auto:[null]}}),Yn=()=>({basis:[Ja(Ua(12,"deg"))],keywords:{auto:[null]}}),Xn=(()=>{const e=Ga(qn)[0].terms,t=Ya(e[0]),i=Ya(e[1]);return e=>{const s=e[eh].idealCameraDistance();return{basis:[t,i,Ua(s,"m")],keywords:{auto:[null,null,Ua(105,"%")]}}}})(),$n=e=>{const t=2.2*e[eh].boundingSphere.radius;return{basis:[Ua(-1/0,"rad"),Ua(0,"rad"),Ua(t,"m")],keywords:{auto:[null,null,null]}}},Zn=e=>{const t=Xn(e),i=new fn([],t).evaluate()[2];return{basis:[Ua(1/0,"rad"),Ua(Math.PI,"rad"),Ua(i,"m")],keywords:{auto:[null,null,null]}}},er=e=>{e[eh].updateBoundingBoxAndShadowIfDirty();const i=e[eh].boundingBox.getCenter(new t.Vector3);return{basis:[Ua(i.x,"m"),Ua(i.y,"m"),Ua(i.z,"m")],keywords:{auto:[null,null,null]}}},tr=Math.PI/2,ir=Math.PI/3,sr=tr/2,ar=2*Math.PI,nr=Symbol("controls"),rr=Symbol("panElement"),or=Symbol("promptElement"),Ar=Symbol("promptAnimatedContainer"),lr=Symbol("fingerAnimatedContainers"),cr=Symbol("deferInteractionPrompt"),hr=Symbol("updateAria"),dr=Symbol("a11y"),gr=Symbol("updateA11y"),pr=Symbol("updateCameraForRadius"),ur=Symbol("cancelPrompts"),mr=Symbol("onChange"),br=Symbol("onPointerChange"),fr=Symbol("waitingToPromptUser"),Ir=Symbol("userHasInteracted"),Cr=Symbol("promptElementVisibleTime"),Er=Symbol("lastPromptOffset"),yr=Symbol("cancellationSource"),Br=Symbol("lastSpherical"),wr=Symbol("jumpCamera"),xr=Symbol("initialized"),vr=Symbol("maintainThetaPhi"),Sr=Symbol("syncCameraOrbit"),Qr=Symbol("syncFieldOfView"),Mr=Symbol("syncCameraTarget"),Rr=Symbol("syncMinCameraOrbit"),Tr=Symbol("syncMaxCameraOrbit"),Dr=Symbol("syncMinFieldOfView"),Fr=Symbol("syncMaxFieldOfView"),kr=new t.Vector2,Lr=new t.Vector3,Pr=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:0,maximumPolarAngle:Math.PI,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),_r=Math.PI/8,Ur=.04,Gr={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class Nr extends t.EventDispatcher{constructor(e,i,s){super(),this.camera=e,this.element=i,this.scene=s,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=Gr.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new t.Matrix3,this.panPerPixel=0,this.spherical=new t.Spherical,this.goalSpherical=new t.Spherical,this.thetaDamper=new Fa,this.phiDamper=new Fa,this.radiusDamper=new Fa,this.logFov=Math.log(Pr.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new Fa,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(const e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.touchModeZoom=(e,t)=>{if(!this._disableZoom){const e=this.twoTouchDistance(this.pointers[0],this.pointers[1]),t=Ur*this.zoomSensitivity*(this.lastSeparation-e)*50/this.scene.height;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panPerPixel>0&&this.movePan(e,t)},this.disableScroll=e=>{e.preventDefault()},this.touchModeRotate=(e,t)=>{const{touchAction:i}=this._options;if(!this.touchDecided&&"none"!==i){this.touchDecided=!0;const s=Math.abs(e),a=Math.abs(t);if(this.changeSource===Gr.USER_INTERACTION&&("pan-y"===i&&a>s||"pan-x"===i&&s>a))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.onPointerDown=e=>{if(this.pointers.length>2)return;const{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY,this.startTime=performance.now());try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),this.isUserPointing=!1,"touch"===e.pointerType?(this.changeSource=e.altKey?Gr.AUTOMATIC:Gr.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=Gr.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===Gr.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=e=>{const t=this.pointers.find(t=>t.id===e.pointerId);if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);const i=this.pointers.length,s=(e.clientX-t.clientX)/i,a=(e.clientY-t.clientY)/i;0===s&&0===a||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?Gr.AUTOMATIC:Gr.USER_INTERACTION,null!==this.touchMode&&this.touchMode(s,a)):(this.changeSource=Gr.USER_INTERACTION,this.panPerPixel>0?this.movePan(s,a):this.handleSinglePointerMove(s,a)))},this.onPointerUp=e=>{const{element:t}=this,i=this.pointers.findIndex(t=>t.id===e.pointerId);-1!==i&&this.pointers.splice(i,1),this.panPerPixel>0&&!e.altKey&&this.resetRadius(),0===this.pointers.length?(t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(e)):null!==this.touchMode&&this.onTouchChange(e),this.scene.element[rr].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=Gr.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*Ur*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=Gr.USER_INTERACTION;(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?(e.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=t},this._options=Object.assign({},Pr),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchmove",()=>{},{passive:!1}),e.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this._interactionEnabled){const{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(e){this._disableZoom!=e&&(this._disableZoom=e,!0===e?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new t.Spherical){return e.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(e,t){this.camera.far=0===t?2:t,this.camera.near=Math.max(e,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(e=this.goalSpherical.theta,t=this.goalSpherical.phi,i=this.goalSpherical.radius){const{minimumAzimuthalAngle:s,maximumAzimuthalAngle:a,minimumPolarAngle:n,maximumPolarAngle:r,minimumRadius:o,maximumRadius:A}=this._options,{theta:l,phi:c,radius:h}=this.goalSpherical,d=De(e,s,a);isFinite(s)||isFinite(a)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-d)+d);const g=De(t,n,r),p=De(i,o,A);return(d!==l||g!==c||p!==h)&&(!!(isFinite(d)&&isFinite(g)&&isFinite(p))&&(this.goalSpherical.theta=d,this.goalSpherical.phi=g,this.goalSpherical.radius=p,this.goalSpherical.makeSafe(),!0))}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:i}=this._options;e=De(e,t,i),this.goalLogFov=Math.log(e)}setDamperDecayTime(e){this.thetaDamper.setDecayTime(e),this.phiDamper.setDecayTime(e),this.radiusDamper.setDecayTime(e),this.fovDamper.setDecayTime(e)}adjustOrbit(e,t,i){const{theta:s,phi:a,radius:n}=this.goalSpherical,{minimumRadius:r,maximumRadius:o,minimumFieldOfView:A,maximumFieldOfView:l}=this._options,c=this.spherical.theta-s,h=Math.PI-.001,d=s-De(e,-h-c,h-c),g=a-t,p=0===i?0:((i>0?o:r)-n)/(Math.log(i>0?l:A)-this.goalLogFov),u=n+i*(isFinite(p)?p:2*(o-r));if(this.setOrbit(d,g,u),0!==i){const e=this.goalLogFov+i;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:i,maximumRadius:s}=this._options,a=this.spherical.theta-this.goalSpherical.theta;return Math.abs(a)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(a)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,i),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,s),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){const{style:e}=this.element;if(this._interactionEnabled){const{touchAction:t}=this._options;this._disableZoom&&"none"!==t?e.touchAction="manipulation":e.touchAction=t}else e.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new t.Euler(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix())}userAdjustOrbit(e,t,i){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,i*this.inputSensitivity)}wrapAngle(e){const t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){const{clientX:i,clientY:s}=e,{clientX:a,clientY:n}=t,r=a-i,o=n-s;return Math.sqrt(r*r+o*o)}handleSinglePointerMove(e,t){const i=this.pixelLengthToSphericalAngle(e),s=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(i,s,0)}initializePan(){const{theta:e,phi:t}=this.spherical,i=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(i),-Math.cos(t)*Math.sin(i),0,0,Math.sin(t),0,Math.sin(i),-Math.cos(t)*Math.cos(i),0)}movePan(e,t){const{scene:i}=this,s=Lr.set(e,t,0).multiplyScalar(this.inputSensitivity),a=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;s.multiplyScalar(a);const n=i.getTarget();n.add(s.applyMatrix3(this.panProjection)),i.boundingSphere.clampPoint(n,n),i.setTarget(n.x,n.y,n.z)}recenter(e){if(performance.now()>this.startTime+300||Math.abs(e.clientX-this.startPointerPosition.clientX)>2||Math.abs(e.clientY-this.startPointerPosition.clientY)>2)return;const{scene:t}=this,i=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==i){const{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(i.position),t.setTarget(i.position.x,i.position.y,i.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(kr.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);const i=e.getTarget(),{theta:s,phi:a}=this.spherical,n=s-e.yaw,r=Lr.set(Math.sin(a)*Math.sin(n),Math.cos(a),Math.sin(a)*Math.cos(n)),o=r.dot(t.position.sub(i));i.add(r.multiplyScalar(o)),e.setTarget(i.x,i.y,i.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-o)}onTouchChange(e){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&(this.initializePan(),e.altKey||(this.scene.element[rr].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[rr].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,Ur*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-_r,0);break;case"ArrowDown":this.userAdjustOrbit(0,_r,0);break;case"ArrowLeft":this.userAdjustOrbit(-_r,0,0);break;case"ArrowRight":this.userAdjustOrbit(_r,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-10);break;case"ArrowDown":this.movePan(0,10);break;case"ArrowLeft":this.movePan(-10,0);break;case"ArrowRight":this.movePan(10,0);break;default:t=!1}return t}}const Or='<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed">\n <path d="M6.4,19L5,17.6L10.6,12L5,6.4L6.4,5L12,10.6L17.6,5L19,6.4L13.4,12L19,17.6L17.6,19L12,13.4L6.4,19Z"/>\n</svg>',qr='<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed">\n <path d="M7,17V9H5V7H9V17H7ZM11,17V15H13V17H11ZM16,17V9H14V7H18V17H16ZM11,13V11H13V13H11Z"/>\n</svg>',Hr='<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#E1E2E8">\n <defs>\n <clipPath id="clip0">\n <path d="M0,0h24v24h-24z"/>\n </clipPath>\n </defs>\n <g clip-path="url(#clip0)">\n <path d="M12,22C10.75,22 9.575,21.767 8.475,21.3C7.392,20.817 6.442,20.175 5.625,19.375C4.825,18.558 4.183,17.608 3.7,16.525C3.233,15.425 3,14.25 3,13H5C5,14.95 5.675,16.608 7.025,17.975C8.392,19.325 10.05,20 12,20C13.95,20 15.6,19.325 16.95,17.975C18.317,16.608 19,14.95 19,13C19,11.05 18.317,9.4 16.95,8.05C15.6,6.683 13.95,6 12,6H11.85L13.4,7.55L12,9L8,5L12,1L13.4,2.45L11.85,4H12C13.25,4 14.417,4.242 15.5,4.725C16.6,5.192 17.55,5.833 18.35,6.65C19.167,7.45 19.808,8.4 20.275,9.5C20.758,10.583 21,11.75 21,13C21,14.25 20.758,15.425 20.275,16.525C19.808,17.608 19.167,18.558 18.35,19.375C17.55,20.175 16.6,20.817 15.5,21.3C14.417,21.767 13.25,22 12,22Z"/>\n </g>\n</svg>',jr={width:.16,height:.07,cornerRadius:.03,opacity:1,color:0,minDistance:.5,maxDistance:10,baseScale:1,distanceScaleFactor:.3},zr=.05,Kr=.01,Vr=.07,Jr={canvasSize:128,filter:t.LinearFilter};class Wr extends t.Object3D{constructor(){super(),this.isActualSize=!1,this.preRenderIcons(),this.createPanel(),this.createButtons(),this.opacityDamper=new Fa,this.goalOpacity=jr.opacity}createPanel(){const e=this.createPanelShape(),i=new t.ShapeGeometry(e),s=new t.MeshBasicMaterial({color:jr.color,opacity:jr.opacity,transparent:!0});this.panelMesh=new t.Mesh(i,s),this.panelMesh.name="MenuPanel",this.add(this.panelMesh)}createButtons(){this.exitButton=this.createButton("close"),this.exitButton.name="ExitButton",this.exitButton.position.set(Vr/2,0,Kr),this.add(this.exitButton),this.toggleButton=this.createButton("view-real-size"),this.toggleButton.name="ToggleButton",this.toggleButton.position.set(-.035,0,Kr),this.add(this.toggleButton)}createPanelShape(){const e=new t.Shape,{width:i,height:s,cornerRadius:a}=jr;return e.moveTo(-i/2+a,-s/2),e.lineTo(i/2-a,-s/2),e.quadraticCurveTo(i/2,-s/2,i/2,-s/2+a),e.lineTo(i/2,s/2-a),e.quadraticCurveTo(i/2,s/2,i/2-a,s/2),e.lineTo(-i/2+a,s/2),e.quadraticCurveTo(-i/2,s/2,-i/2,s/2-a),e.lineTo(-i/2,-s/2+a),e.quadraticCurveTo(-i/2,-s/2,-i/2+a,-s/2),e}preRenderIcons(){[{key:"close",svg:Or},{key:"view-real-size",svg:qr},{key:"replay",svg:Hr}].forEach(({key:e,svg:t})=>{Wr.iconTextures.has(e)||this.createTextureFromSvg(t,e)})}createTextureFromSvg(e,i){const s=document.createElement("canvas");s.width=Jr.canvasSize,s.height=Jr.canvasSize;const a=s.getContext("2d"),n=new Image,r=new Blob([e],{type:"image/svg+xml"}),o=URL.createObjectURL(r);n.onload=()=>{a.drawImage(n,0,0,Jr.canvasSize,Jr.canvasSize);const e=new t.CanvasTexture(s);e.needsUpdate=!0,e.minFilter=Jr.filter,Wr.iconTextures.set(i,e),URL.revokeObjectURL(o)},n.src=o}createButton(e){const i=new t.MeshBasicMaterial({transparent:!0}),s=new t.PlaneGeometry(zr,zr),a=new t.Mesh(s,i),n=Wr.iconTextures.get(e);if(n)a.material.map=n,a.material.needsUpdate=!0;else{this.createTextureFromSvg("close"===e?Or:"view-real-size"===e?qr:Hr,e);const t=()=>{const i=Wr.iconTextures.get(e);i?(a.material.map=i,a.material.needsUpdate=!0):setTimeout(t,10)};t()}return a}exitButtonControllerIntersection(e,t){return e.hitFromController(t,this.exitButton)}scaleModeButtonControllerIntersection(e,t){return e.hitFromController(t,this.toggleButton)}handleScaleToggle(e,t,i,s){if(!e)return null;this.isActualSize=!this.isActualSize;const a=this.isActualSize?"replay":"view-real-size";this.updateScaleModeButtonLabel(a);const n=this.isActualSize?1:t;return Math.max(i,Math.min(s,n))}updateScaleModeButtonLabel(e){const t=Wr.iconTextures.get(e);t&&(this.toggleButton.material.map=t,this.toggleButton.material.needsUpdate=!0)}updatePosition(e,i){if(!i)return;const s=new t.Vector3;i.getWorldPosition(s);const a=i.getSize(),n=Math.min(a.x,a.z),r=Math.max(.5,Math.min(2,n/1)),o=-.2*r,A=.9*r,l=(new t.Vector3).copy(e.position).sub(s);l.y=0,l.normalize();const c=(new t.Vector3).copy(s).add(new t.Vector3(0,o,0)).add(l.multiplyScalar(A));this.position.copy(c);const h=e.position.distanceTo(c),d=Math.max(jr.minDistance,Math.min(jr.maxDistance,h)),g=jr.baseScale+(d-jr.minDistance)*jr.distanceScaleFactor;this.scale.set(g,g,g),this.lookAt(e.position)}set show(e){this.goalOpacity=e?jr.opacity:0}updateOpacity(e){const i=this.panelMesh.material.opacity,s=this.opacityDamper.update(i,this.goalOpacity,e,1);this.traverse(e=>{if(e instanceof t.Mesh){const t=e.material;t.transparent&&(t.opacity=s)}}),this.visible=s>0}dispose(){var e;this.children.forEach(e=>{if(e instanceof t.Mesh){e.geometry&&e.geometry.dispose();(Array.isArray(e.material)?e.material:[e.material]).forEach(e=>{e&&("map"in e&&e.map instanceof t.CanvasTexture&&e.map.dispose(),e.dispose())})}}),null===(e=this.parent)||void 0===e||e.remove(this)}}Wr.iconTextures=new Map;
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const Yr=.8,Xr=150,$r=new t.Vector3(0,1,0),Zr=.01,eo=.001,to="not-presenting",io="session-started",so="object-placed",ao="failed",no="tracking",ro="not-tracking",oo=new t.Vector3,Ao=new t.Quaternion,lo=new t.Matrix4,co=new t.Vector3,ho=new t.PerspectiveCamera(45,1,.1,100),go=(new t.BufferGeometry).setFromPoints([new t.Vector3(0,0,0),new t.Vector3(0,0,-1)]),po="screen-space",uo="world-space";class mo extends t.EventDispatcher{isWorldSpaceReady(){return this.xrMode===uo&&this.worldSpaceInitialPlacementDone}constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.menuPanel=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.xrMode=null,this.xrController1=null,this.xrController2=null,this.selectedXRController=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new t.Vector3,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastDragPosition=new t.Vector3,this.deltaRotation=new t.Quaternion,this.scaleLine=new t.Line(go),this.firstRatio=0,this.lastAngle=0,this.goalPosition=new t.Vector3,this.goalYaw=0,this.goalScale=1,this.xDamper=new Fa,this.yDamper=new Fa,this.zDamper=new Fa,this.yawDamper=new Fa,this.pitchDamper=new Fa,this.rollDamper=new Fa,this.scaleDamper=new Fa,this.wasTwoFingering=!1,this.worldSpaceInitialPlacementDone=!1,this.initialModelScale=1,this.minScale=1,this.maxScale=1,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onControllerSelectStart=e=>{var i,s,a;const n=this.presentedScene,r=e.target,o=this.menuPanel;if(null!=this.menuPanel.exitButtonControllerIntersection(n,r))return null===(i=this.menuPanel)||void 0===i||i.dispose(),void this.stopPresenting();if(null!=this.menuPanel.scaleModeButtonControllerIntersection(n,r)){const e=this.menuPanel.handleScaleToggle(this.worldSpaceInitialPlacementDone,this.initialModelScale,this.minScale,this.maxScale);return void(null!==e&&(this.goalScale=e))}o&&(o.show=!1);const A=this.placementBox.controllerIntersection(n,r);if(null!=A){const e=(new t.Box3).setFromObject(n.scenePivot).min.y+.2;if(A.point.y<=e)null!=this.selectedXRController?(this.selectedXRController.userData.line.visible=!1,n.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/n.scenePivot.scale.x,this.scaleLine.visible=!0)):r.attach(n.scenePivot),this.selectedXRController=r,n.setShadowIntensity(.01);else if(r==this.xrController1?this.xrController1.userData.isSelected=!0:r==this.xrController2&&(this.xrController2.userData.isSelected=!0),(null===(s=this.xrController1)||void 0===s?void 0:s.userData.isSelected)&&(null===(a=this.xrController2)||void 0===a?void 0:a.userData.isSelected))n.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/n.scenePivot.scale.x,this.scaleLine.visible=!0);else{const e=r===this.xrController1?this.xrController2:this.xrController1;r.userData.initialX=r.position.x,e.userData.turning=!1,r.userData.turning=!0,r.userData.line.visible=!1}}},this.onControllerSelectEnd=e=>{const t=e.target;if(t.userData.turning=!1,t.userData.line.visible=!0,this.isTwoHandInteraction=!1,this.scaleLine.visible=!1,t==this.xrController1?this.xrController1.userData.isSelected=!1:t==this.xrController2&&(this.xrController2.userData.isSelected=!1),null!=this.selectedXRController&&this.selectedXRController!=t)return;const i=this.presentedScene;i.attach(i.scenePivot),this.selectedXRController=null,this.goalYaw=Math.atan2(i.scenePivot.matrix.elements[8],i.scenePivot.matrix.elements[10]),this.goalPosition.x=i.scenePivot.position.x,this.goalPosition.z=i.scenePivot.position.z,this.isWorldSpaceReady()&&(this.goalPosition.y=i.scenePivot.position.y);this.menuPanel.show=!0},this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.updateFromModelChanges(),this.placementBox.setScreenSpaceMode(this.xrMode===po)),this.xrMode!==po&&(this.menuPanel&&(this.menuPanel.dispose(),this.menuPanel=null),this.menuPanel=new Wr,this.presentedScene.add(this.menuPanel),this.menuPanel.updatePosition(this.presentedScene.getCamera(),this.placementBox))},this.onSelectStart=e=>{const t=this.transientHitTestSource;if(null==t)return;const i=this.frame.getHitTestResultsForTransientInput(t),s=this.presentedScene,a=this.placementBox;if(1===i.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,i=a.getHit(this.presentedScene,t[0],t[1]);a.show=!0,null!=i?(this.isTranslating=!0,this.lastDragPosition.copy(i)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===i.length){a.show=!0,this.isTwoHandInteraction=!0;const{separation:e,angle:t}=this.fingerPolar(i);return this.lastAngle=t,0===this.firstRatio&&(this.firstRatio=e/s.scenePivot.scale.x),void(s.canScale&&this.setScale(e))}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.onBeforeXRSelect=e=>{const t=e.composedPath();for(const i of t)if(i instanceof HTMLElement){const t=i.tagName.toLowerCase();if("input"===t||"button"===t||"select"===t||"textarea"===t||"a"===t||i.hasAttribute("data-pointer-coalesce")||i.classList.contains("interactive")){e.preventDefault();break}}},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){Me();const e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:[],optionalFeatures:["hit-test","dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return Me(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return console.warn("Request to present in WebXR denied:"),console.warn(e),console.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&console.warn("Cannot present while a model is already presenting");let i=new Promise((e,t)=>{requestAnimationFrame(()=>e())});e.setHotspotsVisibility(!1),e.queueRender(),await i,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),null!=this.overlay&&this.overlay.addEventListener("beforexrselect",this.onBeforeXRSelect),!0===t&&(this.xrLight=new Da(this.threeRenderer),this.xrLight.addEventListener("estimationstart",()=>{if(!this.isPresenting||null==this.xrLight)return;const e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment}));const s=await this.resolveARSession();s.addEventListener("end",()=>{this.postSessionCleanup()},{once:!0});const a=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");a.classList.add("enabled"),a.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=a;const n=await s.requestReferenceSpace("viewer");this.xrMode=s.interactionMode,this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);const r=20*Math.PI/180,o=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(r),z:-Math.cos(r)});s.requestHitTestSource({space:n,offsetRay:o}).then(e=>{this.initialHitSource=e}),this.xrMode!==po&&(this.setupXRControllers(),this.xDamper.setDecayTime(Xr),this.yDamper.setDecayTime(Xr),this.zDamper.setDecayTime(Xr),this.yawDamper.setDecayTime(Xr),this.pitchDamper.setDecayTime(Xr),this.rollDamper.setDecayTime(Xr),this.scaleDamper.setDecayTime(Xr)),this.currentSession=s,this.placementBox=new _a(e,this.placeOnWall?"back":"bottom"),this.placementBox&&this.placementBox.setScreenSpaceMode(this.xrMode===po),this.placementComplete=!1,this.xrMode!==po&&(this.menuPanel=new Wr,e.add(this.menuPanel),this.menuPanel.updatePosition(e.getCamera(),this.placementBox)),this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:io})}setupXRControllerLine(e){if(!e.userData.line){const i=new t.Line(go);i.name="line",i.scale.z=5,e.userData.turning=!1,e.userData.line=i,e.add(i)}}setupController(e){this.setupXRControllerLine(e),e.addEventListener("selectstart",this.onControllerSelectStart),e.addEventListener("selectend",this.onControllerSelectEnd)}setupXRControllers(){this.xrController1=this.threeRenderer.xr.getController(0),this.xrController2=this.threeRenderer.xr.getController(1),this.setupController(this.xrController1),this.setupController(this.xrController2),this.scaleLine.name="scale line",this.scaleLine.visible=!1,this.xrController1.add(this.scaleLine);const e=this.presentedScene;e.add(this.xrController1),e.add(this.xrController2)}hover(e){if(this.xrMode===po||this.selectedXRController==e)return!1;const t=this.presentedScene,i=this.placementBox.controllerIntersection(t,e);return e.userData.line.scale.z=null==i?5:i.distance,null!=i}controllerSeparation(){return this.xrController1.position.distanceTo(this.xrController2.position)}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise(e=>{this.resolveCleanup=e});try{await this.currentSession.end(),await e}catch(e){console.warn("Error while trying to end WebXR AR session"),console.warn(e),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){const e=this.presentedScene;if(null!=e){const t=e.getTarget();this.oldTarget.copy(t),this.placeOnWall?t.z=e.boundingBox.min.z:t.y=e.boundingBox.min.y,e.setTarget(t.x,t.y,t.z)}}cleanupXRController(e){e.userData.turning=!1,e.userData.line.visible=!0,e.removeEventListener("selectstart",this.onControllerSelectStart),e.removeEventListener("selectend",this.onControllerSelectEnd),e.removeFromParent()}postSessionCleanup(){const e=this.currentSession;null!=e&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const t=this.presentedScene;if(this._presentedScene=null,null!=t){const{element:e}=t;null!=this.xrLight&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),null!=this.menuPanel&&(this.menuPanel.dispose(),this.menuPanel=null),t.add(t.scenePivot),t.scenePivot.quaternion.set(0,0,0,1),t.scenePivot.position.set(0,0,0),t.scenePivot.scale.set(1,1,1),t.setShadowOffset(0);const i=this.turntableRotation;null!=i&&(t.yaw=i);const s=this.oldShadowIntensity;null!=s&&t.setShadowIntensity(s),t.setEnvironmentAndSkybox(e[Le],e[Pe]);const a=this.oldTarget;t.setTarget(a.x,a.y,a.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0);const{width:n,height:r}=e.getBoundingClientRect();t.setSize(n,r),requestAnimationFrame(()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:Gr.NONE}}))})}this.renderer.height=0;const i=this.exitWebXRButtonContainer;null!=i&&(i.classList.remove("enabled"),i.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const s=this.transientHitTestSource;null!=s&&(s.cancel(),this.transientHitTestSource=null);const a=this.initialHitSource;null!=a&&(a.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.xrMode!==po&&(null!=this.xrController1&&(this.cleanupXRController(this.xrController1),this.xrController1=null),null!=this.xrController2&&(this.cleanupXRController(this.xrController2),this.xrController2=null),this.selectedXRController=null,this.scaleLine.visible=!1),this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,null!=this.overlay&&(this.overlay.removeEventListener("beforexrselect",this.onBeforeXRSelect),this.overlay=null),this.worldSpaceInitialPlacementDone=!1,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:to})}updateView(e){const t=this.presentedScene,i=this.threeRenderer.xr;i.updateCamera(ho),t.xrCamera=i.getCamera();const{elements:s}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(s[1],s[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}const a=i.getBaseLayer();if(null!=a){const t=a instanceof XRWebGLLayer?a.getViewport(e):i.getBinding().getViewSubImage(a,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){const e=this.presentedScene,{scenePivot:t,element:i}=e,{position:s}=t,a=e.getCamera(),{width:n,height:r}=this.overlay.getBoundingClientRect();e.setSize(n,r),a.projectionMatrixInverse.copy(a.projectionMatrix).invert();const{theta:o}=i.getCameraOrbit(),A=a.getWorldDirection(oo);if(e.yaw=Math.atan2(-A.x,-A.z)-o,this.goalYaw=e.yaw,this.xrMode!==uo||this.worldSpaceInitialPlacementDone){if(this.xrMode===po){const t=Math.max(1,2*e.boundingSphere.radius);s.copy(a.position).add(A.multiplyScalar(t)),this.updateTarget();const i=e.getTarget();s.add(i).sub(this.oldTarget),this.goalPosition.copy(s)}}else{const{position:i,scale:n}=this.calculateWorldSpaceOptimalPlacement(e,a);this.goalPosition.copy(i),this.goalScale=n,this.initialModelScale=n,s.copy(i),t.scale.set(n,n,n),this.worldSpaceInitialPlacementDone=!0,this.calculateWorldSpaceScaleLimits(e),this.enableWorldSpaceUserInteraction()}if(e.setHotspotsVisibility(!0),this.xrMode===po){const{session:e}=this.frame;e.addEventListener("selectstart",this.onSelectStart),e.addEventListener("selectend",this.onSelectEnd),e.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then(e=>{this.transientHitTestSource=e})}}getTouchLocation(){const{axes:e}=this.inputSource.gamepad;let t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return null!=t&&(oo.copy(t).sub(this.presentedScene.getCamera().position),oo.length()>10)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),i=e.getPose(t);if(null==i)return null;const s=lo.fromArray(i.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(s.elements[4],s.elements[6])),s.elements[5]>.75!==this.placeOnWall?co.setFromMatrixPosition(s):null}moveToFloor(e){if(this.xrMode===uo&&!this.worldSpaceInitialPlacementDone)return this.placementBox.show=!1,void this.dispatchEvent({type:"status",status:so});const t=this.initialHitSource;if(null==t)return;const i=e.getHitTestResults(t);if(0==i.length)return;const s=i[0],a=this.getHitPoint(s);null!=a&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(a):this.goalPosition.y=a.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:so}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,i=e[1].inputSource.gamepad.axes,s=i[0]-t[0],a=i[1]-t[1],n=Math.atan2(a,s);let r=this.lastAngle-n;return r>Math.PI?r-=2*Math.PI:r<-Math.PI&&(r+=2*Math.PI),{separation:Math.sqrt(s*s+a*a),deltaYaw:r,angle:n}}setScale(e){let t=e/this.firstRatio;t=Math.abs(t-1)<.2?1:t,this.isWorldSpaceReady()&&(t=Math.max(this.minScale,Math.min(this.maxScale,t))),this.goalScale=t}processInput(e){const t=this.transientHitTestSource;if(null==t)return;const i=e.getHitTestResultsForTransientInput(t),s=this.presentedScene,a=s.scenePivot.scale.x;if(2===i.length){if(!this.wasTwoFingering){const{separation:e,angle:t}=this.fingerPolar(i);return this.firstRatio=e/a,this.lastAngle=t,this.wasTwoFingering=!0,void(this.isTwoHandInteraction=!0)}const{separation:e,deltaYaw:t,angle:n}=this.fingerPolar(i);return this.goalYaw+=t,this.lastAngle=n,s.canScale&&this.setScale(e),void(this.isTwoHandInteraction=!0)}if(this.wasTwoFingering&&(this.wasTwoFingering=!1,this.isTwoHandInteraction=!1,this.firstRatio=0),this.isTranslating||this.isTwoHandInteraction||this.isRotating)if(this.isRotating){const e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&i.forEach(e=>{if(e.inputSource!==this.inputSource)return;let t=null;if(e.results.length>0&&(t=this.getHitPoint(e.results[0])),null==t&&(t=this.getTouchLocation()),null!=t){if(this.goalPosition.sub(this.lastDragPosition),this.isWorldSpaceReady())this.goalPosition.add(t);else if(!1===this.placeOnWall){const e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/a,this.presentedScene.setShadowOffset(e);const i=oo.copy(s.getCamera().position),n=-e/(i.y-t.y);i.multiplyScalar(n),t.multiplyScalar(1-n).add(i)}this.goalPosition.add(t)}else this.goalPosition.add(t);this.lastDragPosition.copy(t)}})}applyXRControllerRotation(e,t){if(!e.userData.turning)return;const i=.3*(e.position.x-e.userData.initialX);this.deltaRotation.setFromAxisAngle($r,i),t.quaternion.multiplyQuaternions(this.deltaRotation,t.quaternion)}handleScalingInXR(e,t){if(this.xrMode===uo&&!this.worldSpaceInitialPlacementDone)return;if(this.xrController1&&this.xrController2&&this.isTwoHandInteraction){const e=this.controllerSeparation();this.setScale(e),this.scaleLine.scale.z=-e,this.scaleLine.lookAt(this.xrController2.position)}const i=e.scenePivot.scale.x;if(this.goalScale!==i){const s=this.scaleDamper.update(i,this.goalScale,t,1);e.scenePivot.scale.set(s,s,s)}}updatePivotPosition(e,t){const{scenePivot:i}=e,s=this.placementBox,a=e.boundingSphere.radius,n=this.goalPosition,r=i.position;let o=Gr.NONE;if(!n.equals(r)){o=Gr.USER_INTERACTION;let{x:i,y:A,z:l}=r;if(i=this.xDamper.update(i,n.x,t,a),A=this.yDamper.update(A,n.y,t,a),l=this.zDamper.update(l,n.z,t,a),r.set(i,A,l),this.xrMode===po&&!this.isTranslating){const t=n.y-A;this.placementComplete&&!1===this.placeOnWall?(s.offsetHeight=t/e.scenePivot.scale.x,e.setShadowOffset(t)):0===t&&(this.placementComplete=!0,s.show=!1,e.setShadowIntensity(Yr))}this.xrMode!==po&&n.equals(r)&&e.setShadowIntensity(Yr),this.isWorldSpaceReady()&&e.setShadowIntensity(Yr)}if(this.xrMode===uo&&!this.worldSpaceInitialPlacementDone&&this.goalScale!==i.scale.x){const e=this.scaleDamper.update(i.scale.x,this.goalScale,t,1);i.scale.set(e,e,e)}return e.updateTarget(t),o}updateYaw(e,t){Ao.setFromAxisAngle(oo.set(0,1,0),this.goalYaw);const i=e.scenePivot.quaternion.angleTo(Ao),s=i-this.yawDamper.update(i,0,t,Math.PI);e.scenePivot.quaternion.rotateTowards(Ao,s)}updateMenuPanel(e,t,i){this.menuPanel&&(this.menuPanel.updateOpacity(i),this.menuPanel.updatePosition(e.getCamera(),t))}applyXRInputToScene(e){const t=this.presentedScene,i=t.scenePivot,s=this.placementBox;if(this.updatePlacementBoxOpacity(s,e),this.updateTwoHandInteractionState(),this.applyXRControllerRotations(i),this.handleScalingInXR(t,e),i.parent!==t)return void this.updateMenuPanel(t,s,e);const a=this.updatePivotPosition(t,e);this.updateYaw(t,e),this.dispatchCameraChangeEvent(t,a),this.updateMenuPanel(t,s,e)}updatePlacementBoxOpacity(e,t){const i=this.presentedScene.getCamera();e.update(t,i.position);const s=this.hover(this.xrController1),a=this.hover(this.xrController2),n=(s||a)&&!this.isTwoHandInteraction;e.setInteractionState(this.isTranslating||this.isRotating,n)}updateTwoHandInteractionState(){var e,t;const i=(null===(e=this.xrController1)||void 0===e?void 0:e.userData.isSelected)&&(null===(t=this.xrController2)||void 0===t?void 0:t.userData.isSelected);this.isTwoHandInteraction=!!i}applyXRControllerRotations(e){this.isTwoHandInteraction||(this.xrController1&&this.applyXRControllerRotation(this.xrController1,e),this.xrController2&&this.applyXRControllerRotation(this.xrController2,e))}dispatchCameraChangeEvent(e,t){e.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:t}}))}updateXRControllerHover(){const e=this.hover(this.xrController1),t=this.hover(this.xrController2),i=(e||t)&&!this.isTwoHandInteraction;this.placementBox&&(this.placementBox.setInteractionState(this.isTranslating||this.isRotating,i),this.placementBox.show=i)}enableWorldSpaceUserInteraction(){this.placementBox&&(this.placementBox.show=!0),this.presentedScene&&this.presentedScene.setShadowIntensity(Yr)}handleFirstView(e,t){this.xrMode===uo&&this.worldSpaceInitialPlacementDone||this.moveToFloor(e),this.processInput(e);const i=t-this.lastTick;this.applyXRInputToScene(i),this.renderer.preRender(this.presentedScene,t,i),this.lastTick=t,this.presentedScene.renderShadow(this.threeRenderer)}onWebXRFrame(e,t){this.xrMode!==po&&this.updateXRControllerHover(),this.frame=t,++this.frames;const i=this.threeRenderer.xr.getReferenceSpace(),s=t.getViewerPose(i);null==s&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:ro}));const a=this.presentedScene;if(null==s||null==a||!a.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:no}));let n=!0;for(const i of s.views)this.updateView(i),n&&(this.handleFirstView(t,e),n=!1),this.threeRenderer.render(a,a.getCamera())}calculateWorldSpaceOptimalPlacement(e,i){const s=e.boundingBox,a={x:(s.max.x-s.min.x)/2,y:(s.max.y-s.min.y)/2,z:(s.max.z-s.min.z)/2},n=.15,r=Math.max(1.65,2*Math.max(a.x,a.z)+n),o=15*Math.PI/180,A=new t.Vector3(0,-r*Math.sin(o),-r*Math.cos(o)),l=i.matrixWorld,c=A.clone().applyMatrix4(l),h=Math.max(a.x,a.z)+n,d=a.y,g=.3*r,p=.3*r/Math.max(d,Zr),u=g/Math.max(h,Zr),m=Math.min(p,u);return{position:c.clone().sub(new t.Vector3(0,m*a.y,0)),scale:m}}calculateWorldSpaceScaleLimits(e){const t=e.size,i=Math.max(t.x,t.y,t.z),s=Math.max(Math.min(t.x,t.y,t.z),eo),a=Zr/Math.max(i,eo),n=70/Math.max(s,eo);this.minScale=Math.min(a,n,this.goalScale),this.maxScale=Math.max(a,n,this.goalScale)}}
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const bo=Symbol("prepared"),fo=Symbol("prepare"),Io=Symbol("preparedGLTF"),Co=Symbol("clone");class Eo{static prepare(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[bo])return e;const t=this[fo](e);return t[bo]=!0,t}static[fo](e){const{scene:t}=e,i=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:i})}get parser(){return this[Io].parser}get animations(){return this[Io].animations}get scene(){return this[Io].scene}get scenes(){return this[Io].scenes}get cameras(){return this[Io].cameras}get asset(){return this[Io].asset}get userData(){return this[Io].userData}constructor(e){this[Io]=e}clone(){return new(0,this.constructor)(this[Co]())}dispose(){this.scenes.forEach(e=>{e.traverse(e=>{const i=e;if(!i.material)return;(Array.isArray(i.material)?i.material:[i.material]).forEach(e=>{for(const i in e){const s=e[i];if(s instanceof t.Texture){const e=s.source.data;null!=e.close&&e.close(),s.dispose()}}e.dispose()}),i.geometry.dispose()})})}[Co](){const e=this[Io],t=ze(this.scene);yo(t,this.scene);const i=[t],s=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:i,userData:s})}}const yo=(e,t)=>{Bo(e,t,(e,t)=>{void 0!==t.userData.variantMaterials&&(e.userData.variantMaterials=new Map(t.userData.variantMaterials)),void 0!==t.userData.variantData&&(e.userData.variantData=t.userData.variantData),void 0!==t.userData.originalMaterial&&(e.userData.originalMaterial=t.userData.originalMaterial)})},Bo=(e,t,i)=>{i(e,t);for(let s=0;s<e.children.length;s++)Bo(e.children[s],t.children[s],i)},wo=Symbol("threeGLTF"),xo=Symbol("gltf"),vo=Symbol("gltfElementMap"),So=Symbol("threeObjectMap"),Qo=Symbol("parallelTraverseThreeScene"),Mo=Symbol("correlateOriginalThreeGLTF"),Ro=Symbol("correlateCloneThreeGLTF");class To{static from(e,t){return null!=t?this[Ro](e,t):this[Mo](e)}static[Mo](e){const i=e.parser.json,s=e.parser.associations,a=new Map,n={name:"Default"},r={index:-1};for(const e of s.keys())e instanceof t.Material&&null==s.get(e)&&(r.index<0&&(null==i.materials&&(i.materials=[]),r.index=i.materials.length,i.materials.push(n)),e.name=n.name,s.set(e,{materials:r.index}));for(const[e,t]of s){t&&(e.userData=e.userData||{},e.userData.associations=t);for(const s in t)if(null!=s&&"primitives"!==s){const n=s,r=(i[n]||[])[t[n]];if(null==r)continue;let o=a.get(r);null==o&&(o=new Set,a.set(r,o)),o.add(e)}}return new To(e,i,s,a)}static[Ro](e,t){const i=t.threeGLTF,s=t.gltf,a=JSON.parse(JSON.stringify(s)),n=new Map,r=new Map;for(let s=0;s<i.scenes.length;s++)this[Qo](i.scenes[s],e.scenes[s],(e,i)=>{const s=t.threeObjectMap.get(e);if(null!=s)for(const e in s)if(null!=e&&"primitives"!==e){const t=e,o=s[t],A=a[t][o],l=n.get(i)||{};l[t]=o,n.set(i,l);const c=r.get(A)||new Set;c.add(i),r.set(A,c)}});return new To(e,a,n,r)}static[Qo](e,t,i){const s=(e,t)=>{if(i(e,t),e.isObject3D){const a=e,n=t;if(a.material)if(Array.isArray(a.material))for(let e=0;e<a.material.length;++e)i(a.material[e],n.material[e]);else i(a.material,n.material);for(let i=0;i<e.children.length;++i)s(e.children[i],t.children[i])}};s(e,t)}get threeGLTF(){return this[wo]}get gltf(){return this[xo]}get gltfElementMap(){return this[vo]}get threeObjectMap(){return this[So]}constructor(e,t,i,s){this[wo]=e,this[xo]=t,this[vo]=s,this[So]=i}}
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const Do=Symbol("correlatedSceneGraph");class Fo extends Eo{static[fo](e){const i=super[fo](e);null==i[Do]&&(i[Do]=To.from(i));const{scene:s}=i,a=new t.Sphere(void 0,1/0);return s.traverse(e=>{e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid);const s=e;if(s.material){const{geometry:e}=s;s.castShadow=!0,s.isSkinnedMesh&&(e.boundingSphere=a,e.boundingBox=null);const n=s.material;if(!0===n.isMeshBasicMaterial&&(n.toneMapped=!1),n.shadowSide=t.FrontSide,n.aoMap){const{gltf:t,threeObjectMap:s}=i[Do],a=s.get(n);if(null!=t.materials&&null!=a&&null!=a.materials){const i=t.materials[a.materials];i.occlusionTexture&&0===i.occlusionTexture.texCoord&&null!=e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv)}}}}),i}get correlatedSceneGraph(){return this[Io][Do]}[Co](){const e=super[Co](),t=new Map;return e.scene.traverse(e=>{const i=e;if(i.material){const e=i.material;if(null!=e){if(t.has(e.uuid))return void(i.material=t.get(e.uuid));i.material=e.clone(),t.set(e.uuid,i.material)}}const s=e;void 0!==s.target&&s.add(s.target)}),e[Do]=To.from(e,this.correlatedSceneGraph),e}}const ko=(e,i,s)=>{let a;switch(e){case t.UnsignedByteType:a=new Uint8ClampedArray(i*s*4);break;case t.HalfFloatType:a=new Uint16Array(i*s*4);break;case t.UnsignedIntType:a=new Uint32Array(i*s*4);break;case t.ByteType:a=new Int8Array(i*s*4);break;case t.ShortType:a=new Int16Array(i*s*4);break;case t.IntType:a=new Int32Array(i*s*4);break;case t.FloatType:a=new Float32Array(i*s*4);break;default:throw new Error("Unsupported data type")}return a};let Lo;class Po{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const i={format:t.RGBAFormat,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:void 0!==e.renderTargetOptions?.anisotropy?e.renderTargetOptions?.anisotropy:1,generateMipmaps:void 0!==e.renderTargetOptions?.generateMipmaps&&e.renderTargetOptions?.generateMipmaps,magFilter:void 0!==e.renderTargetOptions?.magFilter?e.renderTargetOptions?.magFilter:t.LinearFilter,minFilter:void 0!==e.renderTargetOptions?.minFilter?e.renderTargetOptions?.minFilter:t.LinearFilter,samples:void 0!==e.renderTargetOptions?.samples?e.renderTargetOptions?.samples:void 0,wrapS:void 0!==e.renderTargetOptions?.wrapS?e.renderTargetOptions?.wrapS:t.ClampToEdgeWrapping,wrapT:void 0!==e.renderTargetOptions?.wrapT?e.renderTargetOptions?.wrapT:t.ClampToEdgeWrapping};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=Po.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new t.Scene,this._camera=new t.OrthographicCamera,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((e,i,s,a)=>{if(void 0!==Lo)return Lo;const n=new t.WebGLRenderTarget(1,1,a);i.setRenderTarget(n);const r=new t.Mesh(new t.PlaneGeometry,new t.MeshBasicMaterial({color:16777215}));i.render(r,s),i.setRenderTarget(null);const o=ko(e,n.width,n.height);return i.readRenderTargetPixels(n,0,0,n.width,n.height,o),n.dispose(),r.geometry.dispose(),r.material.dispose(),Lo=0!==o[0],Lo})(this._type,this._renderer,this._camera,i)){let e;if(this._type===t.HalfFloatType)e=this._renderer.extensions.has("EXT_color_buffer_float")?t.FloatType:void 0;void 0!==e?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${t.FloatType}`),this._type=e):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new t.Mesh(new t.PlaneGeometry,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new t.WebGLRenderTarget(this.width,this.height,i),this._renderTarget.texture.mapping=void 0!==e.renderTargetOptions?.mapping?e.renderTargetOptions?.mapping:t.UVMapping}static instantiateRenderer(){const e=new t.WebGLRenderer;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=ko(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const i=new t.DataTexture(this.toArray(),this.width,this.height,t.RGBAFormat,this._type,e?.mapping||t.UVMapping,e?.wrapS||t.ClampToEdgeWrapping,e?.wrapT||t.ClampToEdgeWrapping,e?.magFilter||t.LinearFilter,e?.minFilter||t.LinearFilter,e?.anisotropy||1,t.LinearSRGBColorSpace);return i.generateMipmaps=void 0!==e?.generateMipmaps&&e?.generateMipmaps,i}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof t.ShaderMaterial&&Object.values(this.material.uniforms).forEach(e=>{e.value instanceof t.Texture&&e.value.dispose()}),Object.values(this.material).forEach(e=>{e instanceof t.Texture&&e.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class _o extends Error{}class Uo extends Error{}const Go=(e,t,i)=>{const s=new RegExp(`${t}="([^"]*)"`,"i").exec(e);if(s)return s[1];const a=new RegExp(`<${t}[^>]*>([\\s\\S]*?)</${t}>`,"i").exec(e);if(a){const e=a[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return e&&3===e.length?e.map(e=>e.replace(/<\/?rdf:li>/g,"")):a[1].trim()}if(void 0!==i)return i;throw new Error(`Can't find ${t} in gainmap metadata`)};class No{options;constructor(e){this.options={debug:!(!e||void 0===e.debug)&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise((t,i)=>{const s=this.options.debug,a=new DataView(e.buffer);if(65496!==a.getUint16(0))return void i(new Error("Not a valid jpeg"));const n=a.byteLength;let r,o=2,A=0;for(;o<n;){if(++A>250)return void i(new Error(`Found no marker after ${A} loops 😵`));if(255!==a.getUint8(o))return void i(new Error(`Not a valid marker at offset 0x${o.toString(16)}, found: 0x${a.getUint8(o).toString(16)}`));if(r=a.getUint8(o+1),s&&console.log(`Marker: ${r.toString(16)}`),226===r){s&&console.log("Found APP2 marker (0xffe2)");const e=o+4;if(1297106432===a.getUint32(e)){const s=e+4;let n;if(18761===a.getUint16(s))n=!1;else{if(19789!==a.getUint16(s))return void i(new Error("No valid endianness marker found in TIFF header"));n=!0}if(42!==a.getUint16(s+2,!n))return void i(new Error("Not valid TIFF data! (no 0x002A marker)"));const r=a.getUint32(s+4,!n);if(r<8)return void i(new Error("Not valid TIFF data! (First offset less than 8)"));const o=s+r,A=a.getUint16(o,!n),l=o+2;let c=0;for(let e=l;e<l+12*A;e+=12)45057===a.getUint16(e,!n)&&(c=a.getUint32(e+8,!n));const h=o+2+12*A+4,d=[];for(let e=h;e<h+16*c;e+=16){const t={MPType:a.getUint32(e,!n),size:a.getUint32(e+4,!n),dataOffset:a.getUint32(e+8,!n),dependantImages:a.getUint32(e+12,!n),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=s+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,d.push(t)}if(this.options.extractNonFII&&d.length){const e=new Blob([a]),i=[];for(const t of d){if(t.isFII&&!this.options.extractFII)continue;const s=e.slice(t.start,t.end+1,"image/jpeg");i.push(s)}t(i)}}}o+=2+a.getUint16(o+2)}})}}const Oo=async e=>{const t=(e=>{let t;t="undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):e.toString();let i=t.indexOf("<x:xmpmeta");for(;-1!==i;){const e=t.indexOf("x:xmpmeta>",i),s=t.slice(i,e+10);try{const e=Go(s,"hdrgm:GainMapMin","0"),t=Go(s,"hdrgm:GainMapMax"),i=Go(s,"hdrgm:Gamma","1"),a=Go(s,"hdrgm:OffsetSDR","0.015625"),n=Go(s,"hdrgm:OffsetHDR","0.015625"),r=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(s),o=r?r[1]:"0",A=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(s);if(!A)throw new Error("Incomplete gainmap metadata");const l=A[1];return{gainMapMin:Array.isArray(e)?e.map(e=>parseFloat(e)):[parseFloat(e),parseFloat(e),parseFloat(e)],gainMapMax:Array.isArray(t)?t.map(e=>parseFloat(e)):[parseFloat(t),parseFloat(t),parseFloat(t)],gamma:Array.isArray(i)?i.map(e=>parseFloat(e)):[parseFloat(i),parseFloat(i),parseFloat(i)],offsetSdr:Array.isArray(a)?a.map(e=>parseFloat(e)):[parseFloat(a),parseFloat(a),parseFloat(a)],offsetHdr:Array.isArray(n)?n.map(e=>parseFloat(e)):[parseFloat(n),parseFloat(n),parseFloat(n)],hdrCapacityMin:parseFloat(o),hdrCapacityMax:parseFloat(l)}}catch(e){}i=t.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new Uo("Gain map XMP metadata not found");const i=new No({extractFII:!0,extractNonFII:!0}),s=await i.extract(e);if(2!==s.length)throw new _o("Gain map recovery image not found");return{sdr:new Uint8Array(await s[0].arrayBuffer()),gainMap:new Uint8Array(await s[1].arrayBuffer()),metadata:t}},qo=e=>new Promise((t,i)=>{const s=document.createElement("img");s.onload=()=>{t(s)},s.onerror=e=>{i(e)},s.src=URL.createObjectURL(e)});class Ho extends t.Loader{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,i){super(i),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new t.LoadingManager}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new t.Texture,sdr:new t.Texture});return this._config.createQuadRenderer({width:16,height:16,type:t.HalfFloatType,colorSpace:t.LinearSRGBColorSpace,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,i){const s=t?new Blob([t],{type:"image/jpeg"}):void 0,a=new Blob([e],{type:"image/jpeg"});let n,r,o=!1;if("undefined"==typeof createImageBitmap){const e=await Promise.all([s?qo(s):Promise.resolve(void 0),qo(a)]);r=e[0],n=e[1],o="flipY"===i}else{const e=await Promise.all([s?createImageBitmap(s,{imageOrientation:i||"flipY"}):Promise.resolve(void 0),createImageBitmap(a,{imageOrientation:i||"flipY"})]);r=e[0],n=e[1]}return{sdrImage:n,gainMapImage:r,needsFlip:o}}createTextures(e,i,s){const a=new t.Texture(i||new ImageData(2,2),t.UVMapping,t.ClampToEdgeWrapping,t.ClampToEdgeWrapping,t.LinearFilter,t.LinearMipMapLinearFilter,t.RGBAFormat,t.UnsignedByteType,1,t.LinearSRGBColorSpace);a.flipY=s,a.needsUpdate=!0;const n=new t.Texture(e,t.UVMapping,t.ClampToEdgeWrapping,t.ClampToEdgeWrapping,t.LinearFilter,t.LinearMipMapLinearFilter,t.RGBAFormat,t.UnsignedByteType,1,t.SRGBColorSpace);return n.flipY=s,n.needsUpdate=!0,{gainMap:a,sdr:n}}updateQuadRenderer(e,t,i,s,a){e.width=t.width,e.height=t.height,e.material.gainMap=i,e.material.sdr=s,e.material.gainMapMin=a.gainMapMin,e.material.gainMapMax=a.gainMapMax,e.material.offsetHdr=a.offsetHdr,e.material.offsetSdr=a.offsetSdr,e.material.gamma=a.gamma,e.material.hdrCapacityMin=a.hdrCapacityMin,e.material.hdrCapacityMax=a.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,a.hdrCapacityMax),e.material.needsUpdate=!0}}class jo extends t.ShaderMaterial{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:i,offsetSdr:s,gainMapMin:a,gainMapMax:n,maxDisplayBoost:r,hdrCapacityMin:o,hdrCapacityMax:A,sdr:l,gainMap:c}){super({name:"GainMapDecoderMaterial",vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n// min half float value\n#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )\n// max half float value\n#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )\n\nuniform sampler2D sdr;\nuniform sampler2D gainMap;\nuniform vec3 gamma;\nuniform vec3 offsetHdr;\nuniform vec3 offsetSdr;\nuniform vec3 gainMapMin;\nuniform vec3 gainMapMax;\nuniform float weightFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 rgb = texture2D( sdr, vUv ).rgb;\n vec3 recovery = texture2D( gainMap, vUv ).rgb;\n vec3 logRecovery = pow( recovery, gamma );\n vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;\n vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;\n vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));\n gl_FragColor = vec4( clampedHdrColor , 1.0 );\n}\n",uniforms:{sdr:{value:l},gainMap:{value:c},gamma:{value:new t.Vector3(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new t.Vector3).fromArray(i)},offsetSdr:{value:(new t.Vector3).fromArray(s)},gainMapMin:{value:(new t.Vector3).fromArray(a)},gainMapMax:{value:(new t.Vector3).fromArray(n)},weightFactor:{value:(Math.log2(r)-o)/(A-o)}},blending:t.NoBlending,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=r,this._hdrCapacityMin=o,this._hdrCapacityMax=A,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class zo extends Ho{constructor(e,t){super({renderer:e,createMaterial:e=>new jo(e),createQuadRenderer:e=>new Po(e)},t)}async render(e,t,i,s){const{sdrImage:a,gainMapImage:n,needsFlip:r}=await this.processImages(i,s,"flipY"),{gainMap:o,sdr:A}=this.createTextures(a,n,r);this.updateQuadRenderer(e,a,o,A,t),e.render()}}class Ko extends zo{load(e,i,s,a){const n=this.prepareQuadRenderer(),r=new t.FileLoader(this._internalLoadingManager);return r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setPath(this.path),r.setWithCredentials(this.withCredentials),this.manager.itemStart(e),r.load(e,async t=>{if("string"==typeof t)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const s=new Uint8Array(t);let r,o,A;try{const e=await Oo(s);r=e.sdr,o=e.gainMap,A=e.metadata}catch(t){if(!(t instanceof Uo||t instanceof _o))throw t;console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),A={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},r=s}try{await this.render(n,A,r.buffer,o?.buffer)}catch(t){return this.manager.itemError(e),"function"==typeof a&&a(t),void n.disposeOnDemandRenderer()}"function"==typeof i&&i(n),this.manager.itemEnd(e),n.disposeOnDemandRenderer()},s,t=>{this.manager.itemError(e),"function"==typeof a&&a(t)}),n}}class Vo extends t.DataTextureLoader{constructor(e){super(e),this.type=t.HalfFloatType}parse(e){const i=function(e,t){switch(e){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(t||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(t||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(t||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(t||""))}},s=function(e,t,i){t=t||1024;let s=e.pos,a=-1,n=0,r="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));for(;0>(a=o.indexOf("\n"))&&n<t&&s<e.byteLength;)r+=o,n+=o.length,s+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));return-1<a&&(e.pos+=n+a+1,r+o.slice(0,a))},a=function(e,t,i,s){const a=e[t+3],n=Math.pow(2,a-128)/255;i[s+0]=e[t+0]*n,i[s+1]=e[t+1]*n,i[s+2]=e[t+2]*n,i[s+3]=1},n=function(e,i,s,a){const n=e[i+3],r=Math.pow(2,n-128)/255;s[a+0]=t.DataUtils.toHalfFloat(Math.min(e[i+0]*r,65504)),s[a+1]=t.DataUtils.toHalfFloat(Math.min(e[i+1]*r,65504)),s[a+2]=t.DataUtils.toHalfFloat(Math.min(e[i+2]*r,65504)),s[a+3]=t.DataUtils.toHalfFloat(1)},r=new Uint8Array(e);r.pos=0;const o=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,n=/^\s*FORMAT=(\S+)\s*$/,r=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let A,l;for((e.pos>=e.byteLength||!(A=s(e)))&&i(1,"no header found"),(l=A.match(/^#\?(\S+)/))||i(3,"bad initial token"),o.valid|=1,o.programtype=l[1],o.string+=A+"\n";A=s(e),!1!==A;)if(o.string+=A+"\n","#"!==A.charAt(0)){if((l=A.match(t))&&(o.gamma=parseFloat(l[1])),(l=A.match(a))&&(o.exposure=parseFloat(l[1])),(l=A.match(n))&&(o.valid|=2,o.format=l[1]),(l=A.match(r))&&(o.valid|=4,o.height=parseInt(l[1],10),o.width=parseInt(l[2],10)),2&o.valid&&4&o.valid)break}else o.comments+=A+"\n";return 2&o.valid||i(3,"missing format specifier"),4&o.valid||i(3,"missing image size specifier"),o}(r),A=o.width,l=o.height,c=function(e,t,s){const a=t;if(a<8||a>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);a!==(e[2]<<8|e[3])&&i(3,"wrong scanline width");const n=new Uint8Array(4*t*s);n.length||i(4,"unable to allocate buffer space");let r=0,o=0;const A=4*a,l=new Uint8Array(4),c=new Uint8Array(A);let h=s;for(;h>0&&o<e.byteLength;){o+4>e.byteLength&&i(1),l[0]=e[o++],l[1]=e[o++],l[2]=e[o++],l[3]=e[o++],2==l[0]&&2==l[1]&&(l[2]<<8|l[3])==a||i(3,"bad rgbe scanline format");let t,s=0;for(;s<A&&o<e.byteLength;){t=e[o++];const a=t>128;if(a&&(t-=128),(0===t||s+t>A)&&i(3,"bad scanline data"),a){const i=e[o++];for(let e=0;e<t;e++)c[s++]=i}else c.set(e.subarray(o,o+t),s),s+=t,o+=t}const d=a;for(let e=0;e<d;e++){let t=0;n[r]=c[e+t],t+=a,n[r+1]=c[e+t],t+=a,n[r+2]=c[e+t],t+=a,n[r+3]=c[e+t],r+=4}h--}return n}(r.subarray(r.pos),A,l);let h,d,g;switch(this.type){case t.FloatType:g=c.length/4;const e=new Float32Array(4*g);for(let t=0;t<g;t++)a(c,4*t,e,4*t);h=e,d=t.FloatType;break;case t.HalfFloatType:g=c.length/4;const i=new Uint16Array(4*g);for(let e=0;e<g;e++)n(c,4*e,i,4*e);h=i,d=t.HalfFloatType;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:A,height:l,data:h,header:o.string,gamma:o.gamma,exposure:o.exposure,type:d}}setDataType(e){return this.type=e,this}load(e,i,s,a){return super.load(e,function(e,s){switch(e.type){case t.FloatType:case t.HalfFloatType:e.colorSpace=t.LinearSRGBColorSpace,e.minFilter=t.LinearFilter,e.magFilter=t.LinearFilter,e.generateMipmaps=!1,e.flipY=!0}i&&i(e,s)},s,a)}}class Jo extends Vo{constructor(e){console.warn("RGBELoader has been deprecated. Please use HDRLoader instead."),super(e)}}
/* @license
* Copyright 2021 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const Wo={topLight:{intensity:500,position:[.418,16.199,.3]},room:{position:[-.757,13.219,.717],scale:[31.713,28.305,28.591]},boxes:[{position:[-10.906,2.009,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,.857,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:50,position:[-16.116,14.37,8.208],scale:[.1,2.428,2.739]},{intensity:50,position:[-16.109,18.021,-8.207],scale:[.1,2.425,2.751]},{intensity:17,position:[14.904,12.198,-1.832],scale:[.15,4.265,6.331]},{intensity:43,position:[-.462,8.89,14.52],scale:[4.38,5.441,.088]},{intensity:20,position:[3.235,11.486,-12.541],scale:[2.5,2,.1]},{intensity:100,position:[0,20,0],scale:[1,.1,1]}]},Yo={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class Xo extends t.Scene{constructor(e){super(),this.position.y=-3.5;const i=new t.BoxGeometry;i.deleteAttribute("uv");const s=new t.MeshStandardMaterial({metalness:0,side:t.BackSide}),a=new t.MeshStandardMaterial({metalness:0}),n="legacy"==e?Wo:Yo,r=new t.PointLight(16777215,n.topLight.intensity,28,2);r.position.set(...n.topLight.position),this.add(r);const o=new t.Mesh(i,s);o.position.set(...n.room.position),o.scale.set(...n.room.scale),this.add(o);for(const e of n.boxes){const s=new t.Mesh(i,a);s.position.set(...e.position),s.rotation.set(0,e.rotation,0),s.scale.set(...e.scale),this.add(s)}for(const e of n.lights){const s=new t.Mesh(i,this.createAreaLightMaterial(e.intensity));s.position.set(...e.position),s.scale.set(...e.scale),this.add(s)}}createAreaLightMaterial(e){const i=new t.MeshBasicMaterial;return i.color.setScalar(e),i}}
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const $o=20,Zo=/\.hdr(\.js)?$/,eA=/\.ktx2(\?|#|$)/;class tA{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}ldrLoader(e){return null==this._ldrLoader&&(this._ldrLoader=new t.TextureLoader),this._ldrLoader.setWithCredentials(e),this._ldrLoader}imageLoader(e){return null==this._imageLoader&&(this._imageLoader=new Ko(this.threeRenderer)),this._imageLoader.setWithCredentials(e),this._imageLoader}hdrLoader(e){return null==this._hdrLoader&&(this._hdrLoader=new Jo,this._hdrLoader.setDataType(t.HalfFloatType)),this._hdrLoader.setWithCredentials(e),this._hdrLoader}async getLottieLoader(e){if(null==this._lottieLoader){const{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(e),this._lottieLoader}async loadImage(e,t,i){if("image/ktx2"===i||eA.test(e))return this.loadKTX2(e,t);const s=await new Promise((i,s)=>this.ldrLoader(t).load(e,i,()=>{},s));return s.name=e,s.flipY=!1,s}async loadKTX2(e,t){us.setWithCredentials(t);const i=await new Promise((t,i)=>us.load(e,t,()=>{},i));return i.name=e,i.flipY=!1,i}async loadLottie(e,t,i){const s=await this.getLottieLoader(i);s.setQuality(t);const a=await new Promise((t,i)=>s.load(e,t,()=>{},i));return a.name=e,a}async loadEquirect(e,i=!1,s=()=>{}){try{const a=Zo.test(e),n=a?this.hdrLoader(i):this.imageLoader(i),r=await new Promise((t,i)=>n.load(e,e=>{const{renderTarget:i}=e;if(null!=i){let s;try{const t=e.toDataTexture();t.needsUpdate=!0;const a=t.image.data;let n=!1;const r=a.length;for(let e=0;e<r;e++)if(0!==a[e]){n=!0;break}n?(s=t,e.dispose(!0)):(console.warn("Decoded DataTexture is completely black, falling back to render target texture."),s=i.texture,e.dispose(!1))}catch(t){console.warn("Failed to convert gainmap to DataTexture, falling back to render target texture:",t),s=i.texture,e.dispose(!1)}t(s)}else t(e)},e=>{s(e.loaded/e.total*.9)},i));return s(1),r.name=e,r.mapping=t.EquirectangularReflectionMapping,a||r.type===t.HalfFloatType||(r.colorSpace=t.SRGBColorSpace),r}finally{s&&s(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,i=()=>{},s=!1){const a="legacy"!==t;"legacy"!==t&&"neutral"!==t||(t=null),t=Qe(t);let n,r=Promise.resolve(null);e&&(r=this.loadEquirectFromUrl(e,s,i)),n=t?this.loadEquirectFromUrl(t,s,i):e?this.loadEquirectFromUrl(e,s,i):a?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[o,A]=await Promise.all([n,r]);if(null==o)throw new Error("Failed to load environment map.");return{environmentMap:o,skybox:A}}async loadEquirectFromUrl(e,t,i){if(!this.skyboxCache.has(e)){const s=this.loadEquirect(e,t,i);this.skyboxCache.set(e,s),s.catch(()=>{this.skyboxCache.get(e)===s&&this.skyboxCache.delete(e)})}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,i){await((e=0)=>new Promise(t=>setTimeout(t,e)))();const s=this.threeRenderer,a=new t.WebGLCubeRenderTarget(256,{generateMipmaps:!1,type:t.HalfFloatType,format:t.RGBAFormat,colorSpace:t.LinearSRGBColorSpace,depthBuffer:!0}),n=new t.CubeCamera(.1,100,a),r=n.renderTarget.texture;r.name=i;const o=s.outputColorSpace,A=s.toneMapping;return s.toneMapping=t.NoToneMapping,s.outputColorSpace=t.LinearSRGBColorSpace,n.update(s,e),this.blurCubemap(a,.04),s.toneMapping=A,s.outputColorSpace=o,r}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new Xo("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new Xo("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,i){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader($o);const e=new t.BoxGeometry,i=new t.Mesh(e,this.blurMaterial);this.blurScene=new t.Scene,this.blurScene.add(i)}const s=e.clone();this.halfblur(e,s,i,"latitudinal"),this.halfblur(s,e,i,"longitudinal")}halfblur(e,i,s,a){const n=e.width,r=isFinite(s)?Math.PI/(2*n):2*Math.PI/39,o=s/r,A=isFinite(s)?1+Math.floor(3*o):$o;A>$o&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${A} samples when the maximum is set to 20`);const l=[];let c=0;for(let e=0;e<$o;++e){const t=e/o,i=Math.exp(-t*t/2);l.push(i),0==e?c+=i:e<A&&(c+=2*i)}for(let e=0;e<l.length;e++)l[e]=l[e]/c;const h=this.blurMaterial.uniforms;h.envMap.value=e.texture,h.samples.value=A,h.weights.value=l,h.latitudinal.value="latitudinal"===a,h.dTheta.value=r;new t.CubeCamera(.1,100,i).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const i=new Float32Array(e),s=new t.Vector3(0,1,0);return new t.ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:s}},vertexShader:"\n \n varying vec3 vOutputDirection;\n \n void main() {\n \n vOutputDirection = vec3( position );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n ",fragmentShader:"\n varying vec3 vOutputDirection;\n \n uniform samplerCube envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform vec3 poleAxis;\n \n vec3 getSample( float theta, vec3 axis ) {\n \n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n \n return vec3( textureCube( envMap, sampleDirection ) );\n \n }\n \n void main() {\n \n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n \n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n \n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n \n }\n \n axis = normalize( axis );\n \n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n \n for ( int i = 1; i < n; i++ ) {\n \n if ( i >= samples ) {\n \n break;\n \n }\n \n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n \n }\n }\n ",blending:t.NoBlending,depthTest:!1,depthWrite:!1,side:t.BackSide})}async dispose(){for(const[,e]of this.skyboxCache){(await e).dispose()}null!=this.generatedEnvironmentMap&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),null!=this.blurMaterial&&this.blurMaterial.dispose()}}
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const iA=[1,.79,.62,.5,.4,.31,.25],sA="high-performance";class aA extends t.EventDispatcher{static get singleton(){return this._singleton||(this._singleton=new aA({powerPreference:(self.ModelViewerElement||{}).powerPreference||sA,debug:Fe()})),this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new aA({powerPreference:(self.ModelViewerElement||{}).powerPreference||sA,debug:Fe()});for(const t of e)t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return iA[this.scaleStep]}set minScale(e){let t=1;for(;t<iA.length&&!(iA[t]<e);)++t;this.lastStep=t-1}constructor(e){super(),this.loader=new Es(Fo),this.width=0,this.height=0,this.dpr=1,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=3,this.avgFrameDuration=50,this.onWebGLContextLost=e=>{this.dispatchEvent({type:"contextlost",sourceEvent:e})},this.onWebGLContextRestored=()=>{var e;null===(e=this.textureUtils)||void 0===e||e.dispose(),this.textureUtils=this.canRender?new tA(this.threeRenderer):null;for(const e of this.scenes)e.element[_e]()},this.dpr=window.devicePixelRatio,this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new t.WebGLRenderer({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:e.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!e.debug,onShaderError:null},this.threeRenderer.toneMapping=t.NeutralToneMapping}catch(e){console.warn(e)}this.arRenderer=this.canRender?new mo(this):null,this.textureUtils=this.canRender?new tA(this.threeRenderer):null,this.canRender&&Es.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}registerScene(e){if(this.scenes.add(e),e.forceRescale(),this.canRender){const i=new t.Vector2;this.threeRenderer.getSize(i),e.canvas.width=i.x,e.canvas.height=i.y,this.scenes.size>0&&this.threeRenderer.setAnimationLoop((e,t)=>this.render(e,t))}}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return e.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:e.element[Zc]}countVisibleScenes(){const{canvas3D:e}=this;let t=0,i=null;for(const s of this.scenes){const{element:a}=s;a.modelIsVisible&&null==s.externalRenderer&&++t,e.parentElement===s.canvas.parentElement&&(i=s)}const s=t>1;if(null!=i){const t=s&&!this.multipleScenesVisible,a=!i.element.modelIsVisible;if(t||a){const{width:t,height:s}=this.sceneSize(i);this.copyPixels(i,t,s),e.parentElement.removeChild(e)}}this.multipleScenesVisible=s}updateRendererSize(){var e;const t=window.devicePixelRatio;if(t!==this.dpr)for(const e of this.scenes){const{element:t}=e;t[Nc](t.getBoundingClientRect())}let i=0,s=0;for(const e of this.scenes)i=Math.max(i,e.width),s=Math.max(s,e.height);if(i!==this.width||s!==this.height||t!==this.dpr){this.width=i,this.height=s,this.dpr=t,i=Math.ceil(i*t),s=Math.ceil(s*t),this.canRender&&this.threeRenderer.setSize(i,s,!1);for(const t of this.scenes){const{canvas:a}=t;a.width=i,a.height=s,t.forceRescale(),null===(e=t.effectRenderer)||void 0===e||e.setSize(i,s)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=De(.2*(e-this.avgFrameDuration),-5,5),this.avgFrameDuration>60?++this.scaleStep:this.avgFrameDuration<40&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else{if(0==e.scaleStep)return!1;e.scaleStep=0,this.rescaleCanvas(e)}return!0}rescaleCanvas(e){const t=iA[e.scaleStep],i=Math.ceil(this.width/t),s=Math.ceil(this.height/t),{style:a}=e.canvas;a.width=`${i}px`,a.height=`${s}px`,this.canvas3D.style.width=`${i}px`,this.canvas3D.style.height=`${s}px`;const n=this.dpr*t,r=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:n,minimumDpr:this.dpr*iA[this.lastStep],pixelWidth:Math.ceil(e.width*n),pixelHeight:Math.ceil(e.height*n),reason:r}}))}sceneSize(e){const{dpr:t}=this,i=iA[e.scaleStep];return{width:Math.min(Math.ceil(e.width*i*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*i*t),this.canvas3D.height)}}copyPixels(e,t,i){const s=e.context;null!=s?(s.clearRect(0,0,t,i),s.drawImage(this.canvas3D,0,0,t,i,0,0,t,i),e.canvas.classList.add("show")):console.log("could not acquire 2d context")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const i of this.scenes)i.element.modelIsVisible===t&&e.push(i);return e}get isPresenting(){var e;return!0===(null===(e=this.arRenderer)||void 0===e?void 0:e.isPresenting)}preRender(e,i,s){const{element:a,exposure:n,toneMapping:r}=e;a[ih](i,s);const o="number"==typeof n&&!Number.isNaN(n),A=a.environmentImage,l=a.skyboxImage,c=r===t.NeutralToneMapping&&("neutral"===A||"legacy"===A||!A&&!l);this.threeRenderer.toneMappingExposure=(o?n:1)*(c?1.3:1)}render(e,t){if(null!=t)return void(null!=this.arRenderer&&this.arRenderer.onWebXRFrame(e,t));const i=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(i),this.renderedLastFrame=!1);const{canvas3D:s}=this;for(const t of this.orderedScenes()){const{element:a}=t;if(!a.loaded||!a.modelIsVisible&&t.renderCount>0)continue;if(this.preRender(t,e,i),!this.shouldRender(t))continue;if(null!=t.externalRenderer){const e=t.getCamera();e.updateMatrix();const{matrix:i,projectionMatrix:s}=e,a=i.elements.slice(),n=t.getTarget();a[12]+=n.x,a[13]+=n.y,a[14]+=n.z,t.externalRenderer.render({viewMatrix:a,projectionMatrix:s.elements});continue}if(!a.modelIsVisible&&!this.multipleScenesVisible)for(const e of this.scenes)e.element.modelIsVisible&&e.queueRender();const{width:n,height:r}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-r,n,r),null!=t.effectRenderer?t.effectRenderer.render(i):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=t.toneMapping,this.threeRenderer.render(t,t.camera)),this.multipleScenesVisible||!t.element.modelIsVisible&&0===t.renderCount?this.copyPixels(t,n,r):s.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(s),t.canvas.classList.remove("show")),t.hasRendered(),++t.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const e=[];for(const t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}}
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const nA=Symbol("correlatedObjects"),rA=Symbol("onUpdate");class oA{constructor(e,t){this[rA]=e,this[nA]=t}}
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const AA=new t.MeshBasicMaterial,lA=new t.PlaneGeometry(2,2);let cA=0;const hA=Symbol("threeTexture"),dA=Symbol("threeTextures");let gA=class extends oA{get[hA](){var e;return null===(e=this[nA])||void 0===e?void 0:e.values().next().value}get[dA](){return this[nA]}constructor(e,t){super(e,new Set(t?[t]:[]));const i=this[hA].image;i.src||(i.src=t.name?t.name:"adhoc_image"+cA++),i.name||(i.name=t&&i&&i.src?i.src.split("/").pop():"adhoc_image")}get name(){return this[hA].image.name||""}get uri(){return this[hA].image.src}get bufferView(){return this[hA].image.bufferView}get element(){const e=this[hA];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[hA];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return null!=this.uri?"external":"embedded"}set name(e){for(const t of this[dA])t.image.name=e}update(){const e=this[hA];e&&e.isCanvasTexture&&!e.animation&&(this[hA].needsUpdate=!0,this[rA]())}async createThumbnail(e,i){const s=new t.Scene;AA.map=this[hA];const a=new t.Mesh(lA,AA);s.add(a);const n=new t.OrthographicCamera(-1,1,1,-1,0,1),{threeRenderer:r}=aA.singleton,o=new t.WebGLRenderTarget(e,i);r.setRenderTarget(o),r.render(s,n),r.setRenderTarget(null);const A=new Uint8Array(e*i*4);r.readRenderTargetPixels(o,0,0,e,i,A),Qc.width=e,Qc.height=i;const l=Qc.getContext("2d"),c=l.createImageData(e,i);return c.data.set(A),l.putImageData(c,0,0),new Promise(async(e,t)=>{Qc.toBlob(i=>{if(!i)return t("Failed to capture thumbnail.");e(URL.createObjectURL(i))},"image/png")})}};var pA,uA;!function(e){e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.NearestMipmapNearest=9984]="NearestMipmapNearest",e[e.LinearMipmapNearest=9985]="LinearMipmapNearest",e[e.NearestMipmapLinear=9986]="NearestMipmapLinear",e[e.LinearMipmapLinear=9987]="LinearMipmapLinear"}(pA||(pA={})),function(e){e[e.ClampToEdge=33071]="ClampToEdge",e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.Repeat=10497]="Repeat"}(uA||(uA={}));
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const mA=new Map([[uA.Repeat,t.RepeatWrapping],[uA.ClampToEdge,t.ClampToEdgeWrapping],[uA.MirroredRepeat,t.MirroredRepeatWrapping]]),bA=new Map([[t.RepeatWrapping,uA.Repeat],[t.ClampToEdgeWrapping,uA.ClampToEdge],[t.MirroredRepeatWrapping,uA.MirroredRepeat]]),fA=new Map([[pA.Nearest,t.NearestFilter],[pA.Linear,t.LinearFilter],[pA.NearestMipmapNearest,t.NearestMipmapNearestFilter],[pA.LinearMipmapNearest,t.LinearMipmapNearestFilter],[pA.NearestMipmapLinear,t.NearestMipmapLinearFilter],[pA.LinearMipmapLinear,t.LinearMipmapLinearFilter]]),IA=new Map([[t.NearestFilter,pA.Nearest],[t.LinearFilter,pA.Linear],[t.NearestMipmapNearestFilter,pA.NearestMipmapNearest],[t.LinearMipmapNearestFilter,pA.LinearMipmapNearest],[t.NearestMipmapLinearFilter,pA.NearestMipmapLinear],[t.LinearMipmapLinearFilter,pA.LinearMipmapLinear]]),CA=new Map([[pA.Nearest,t.NearestFilter],[pA.Linear,t.LinearFilter]]),EA=new Map([[t.NearestFilter,pA.Nearest],[t.LinearFilter,pA.Linear]]),yA=e=>IA.has(e),BA=e=>EA.has(e),wA=e=>bA.has(e),xA=Symbol("threeTexture"),vA=Symbol("threeTextures"),SA=Symbol("setProperty");class QA extends oA{get[xA](){var e;return null===(e=this[nA])||void 0===e?void 0:e.values().next().value}get[vA](){return this[nA]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[xA].name||""}get minFilter(){return IA.get(this[xA].minFilter)}get magFilter(){return EA.get(this[xA].magFilter)}get wrapS(){return bA.get(this[xA].wrapS)}get wrapT(){return bA.get(this[xA].wrapT)}get rotation(){return this[xA].rotation}get scale(){return hh(this[xA].repeat)}get offset(){return hh(this[xA].offset)}setMinFilter(e){this[SA]("minFilter",fA.get(e))}setMagFilter(e){this[SA]("magFilter",CA.get(e))}setWrapS(e){this[SA]("wrapS",mA.get(e))}setWrapT(e){this[SA]("wrapT",mA.get(e))}setRotation(e){null==e&&(e=0),this[SA]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[SA]("repeat",new t.Vector2(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[SA]("offset",new t.Vector2(e.u,e.v))}[SA](e,t){if(((e,t)=>{switch(e){case"minFilter":return yA(t);case"magFilter":return BA(t);case"wrapS":case"wrapT":return wA(t);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${e}" on Sampler`)}})(e,t))for(const i of this[vA])i[e]=t,i.needsUpdate=!0;this[rA]()}}
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const MA=Symbol("image"),RA=Symbol("sampler"),TA=Symbol("threeTexture");class DA extends oA{get[TA](){var e;return null===(e=this[nA])||void 0===e?void 0:e.values().next().value}constructor(e,t){super(e,new Set(t?[t]:[])),this[RA]=new QA(e,t),this[MA]=new gA(e,t)}get name(){return this[TA].name||""}set name(e){for(const t of this[nA])t.name=e}get sampler(){return this[RA]}get source(){return this[MA]}}
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var FA,kA,LA;const PA=Symbol("texture"),_A=Symbol("transform"),UA=Symbol("materials"),GA=Symbol("usage"),NA=Symbol("onUpdate"),OA=Symbol("activeVideo");var qA;!function(e){e[e.Base=0]="Base",e[e.MetallicRoughness=1]="MetallicRoughness",e[e.Normal=2]="Normal",e[e.Occlusion=3]="Occlusion",e[e.Emissive=4]="Emissive",e[e.Clearcoat=5]="Clearcoat",e[e.ClearcoatRoughness=6]="ClearcoatRoughness",e[e.ClearcoatNormal=7]="ClearcoatNormal",e[e.SheenColor=8]="SheenColor",e[e.SheenRoughness=9]="SheenRoughness",e[e.Transmission=10]="Transmission",e[e.Thickness=11]="Thickness",e[e.Specular=12]="Specular",e[e.SpecularColor=13]="SpecularColor",e[e.Iridescence=14]="Iridescence",e[e.IridescenceThickness=15]="IridescenceThickness",e[e.Anisotropy=16]="Anisotropy"}(qA||(qA={}));class HA{constructor(e,i,s,a){this[FA]=null,this[kA]={rotation:0,scale:new t.Vector2(1,1),offset:new t.Vector2(0,0)},this[LA]=!1,s&&(this[_A].rotation=s.rotation,this[_A].scale.copy(s.repeat),this[_A].offset.copy(s.offset),this[PA]=new DA(e,s)),this[NA]=e,this[UA]=a,this[GA]=i}get texture(){return this[PA]}setTexture(e){var i,s;const a=null!=e?e.source[hA]:null,n=null===(i=this[PA])||void 0===i?void 0:i.source[hA];if(null!=n&&n.isVideoTexture?this[OA]=!1:(null===(s=this[PA])||void 0===s?void 0:s.source.animation)&&this[PA].source.animation.removeEventListener("enterFrame",this[NA]),this[PA]=e,null!=a&&a.isVideoTexture){const e=a.image;if(this[OA]=!0,null!=e.requestVideoFrameCallback){const t=()=>{this[OA]&&(this[NA](),e.requestVideoFrameCallback(t))};e.requestVideoFrameCallback(t)}else{const e=()=>{this[OA]&&(this[NA](),requestAnimationFrame(e))};requestAnimationFrame(e)}}else null!=(null==e?void 0:e.source.animation)&&e.source.animation.addEventListener("enterFrame",this[NA]);let r=t.SRGBColorSpace;if(this[UA])for(const e of this[UA]){switch(this[GA]){case qA.Base:e.map=a;break;case qA.MetallicRoughness:r=t.LinearSRGBColorSpace,e.metalnessMap=a,e.roughnessMap=a;break;case qA.Normal:r=t.LinearSRGBColorSpace,e.normalMap=a;break;case qA.Occlusion:r=t.LinearSRGBColorSpace,e.aoMap=a;break;case qA.Emissive:e.emissiveMap=a;break;case qA.Clearcoat:e.clearcoatMap=a;break;case qA.ClearcoatRoughness:e.clearcoatRoughnessMap=a;break;case qA.ClearcoatNormal:e.clearcoatNormalMap=a;break;case qA.SheenColor:e.sheenColorMap=a;break;case qA.SheenRoughness:e.sheenRoughnessMap=a;break;case qA.Transmission:e.transmissionMap=a;break;case qA.Thickness:e.thicknessMap=a;break;case qA.Specular:e.specularIntensityMap=a;break;case qA.SpecularColor:e.specularColorMap=a;break;case qA.Iridescence:e.iridescenceMap=a;break;case qA.IridescenceThickness:e.iridescenceThicknessMap=a;break;case qA.Anisotropy:e.anisotropyMap=a}e.needsUpdate=!0}a&&(a.colorSpace=r,a.rotation=this[_A].rotation,a.repeat=this[_A].scale,a.offset=this[_A].offset),this[NA]()}}FA=PA,kA=_A,LA=OA;
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const jA=Symbol("threeMaterial"),zA=Symbol("threeMaterials"),KA=Symbol("baseColorTexture"),VA=Symbol("metallicRoughnessTexture");class JA extends oA{get[zA](){return this[nA]}get[jA](){var e;return null===(e=this[nA])||void 0===e?void 0:e.values().next().value}constructor(e,t){super(e,t);const{map:i,metalnessMap:s}=t.values().next().value;this[KA]=new HA(e,qA.Base,i,t),this[VA]=new HA(e,qA.MetallicRoughness,s,t)}get baseColorFactor(){const e=[0,0,0,this[jA].opacity];return this[jA].color.toArray(e),e}get metallicFactor(){return this[jA].metalness}get roughnessFactor(){return this[jA].roughness}get baseColorTexture(){return this[KA]}get metallicRoughnessTexture(){return this[VA]}setBaseColorFactor(e){const i=new t.Color;e instanceof Array?i.fromArray(e):i.set(e);for(const t of this[zA])t.color.set(i),e instanceof Array&&e.length>3?t.opacity=e[3]:(e=[0,0,0,t.opacity],i.toArray(e));this[rA]()}setMetallicFactor(e){for(const t of this[zA])t.metalness=e;this[rA]()}setRoughnessFactor(e){for(const t of this[zA])t.roughness=e;this[rA]()}}
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var WA,YA;const XA=Symbol("pbrMetallicRoughness"),$A=Symbol("normalTexture"),ZA=Symbol("occlusionTexture"),el=Symbol("emissiveTexture"),tl=Symbol("backingThreeMaterial"),il=Symbol("applyAlphaCutoff"),sl=Symbol("getAlphaMode"),al=Symbol("lazyLoadGLTFInfo"),nl=Symbol("initialize"),rl=Symbol("getLoadedMaterial"),ol=Symbol("ensureMaterialIsLoaded"),Al=Symbol("gltfIndex"),ll=Symbol("setActive"),cl=Symbol("variantIndices"),hl=Symbol("isActive"),dl=Symbol("modelVariants"),gl=Symbol("name"),pl=Symbol("pbrTextures");class ul extends oA{get[(WA=cl,YA=pl,tl)](){return this[nA].values().next().value}constructor(e,t,i,s,a,n,r=void 0){super(e,a),this[WA]=new Set,this[YA]=new Map,this[Al]=t,this[hl]=i,this[dl]=s,this[gl]=n,null==r?this[nl]():this[al]=r}[nl](){const e=this[rA],t=this[nA];this[XA]=new JA(e,t);const{normalMap:i,aoMap:s,emissiveMap:a}=t.values().next().value;this[$A]=new HA(e,qA.Normal,i,t),this[ZA]=new HA(e,qA.Occlusion,s,t),this[el]=new HA(e,qA.Emissive,a,t);const n=i=>{this[pl].set(i,new HA(e,i,null,t))};n(qA.Clearcoat),n(qA.ClearcoatRoughness),n(qA.ClearcoatNormal),n(qA.SheenColor),n(qA.SheenRoughness),n(qA.Transmission),n(qA.Thickness),n(qA.Specular),n(qA.SpecularColor),n(qA.Iridescence),n(qA.IridescenceThickness),n(qA.Anisotropy)}async[rl](){if(null!=this[al]){const e=await this[al].doLazyLoad();return this[nl](),this[al]=void 0,this.ensureLoaded=async()=>{},e}return null}colorFromRgb(e){const i=new t.Color;return e instanceof Array?i.fromArray(e):i.set(e),i}[ol](){if(null!=this[al])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[rl]()}get isLoaded(){return null==this[al]}get isActive(){return this[hl]}[ll](e){this[hl]=e}get name(){return this[gl]||""}set name(e){if(this[gl]=e,null!=this[nA])for(const t of this[nA])t.name=e}get pbrMetallicRoughness(){return this[ol](),this[XA]}get normalTexture(){return this[ol](),this[$A]}get occlusionTexture(){return this[ol](),this[ZA]}get emissiveTexture(){return this[ol](),this[el]}get emissiveFactor(){return this[ol](),this[tl].emissive.toArray()}get index(){return this[Al]}hasVariant(e){const t=this[dl].get(e);return null!=t&&this[cl].has(t.index)}setEmissiveFactor(e){this[ol]();const t=this.colorFromRgb(e);for(const e of this[nA])e.emissive.set(t);this[rA]()}[sl](){return this[tl].transparent?"BLEND":this[tl].alphaTest>0?"MASK":"OPAQUE"}[il](){this[ol]();for(const e of this[nA])"MASK"===this[sl]()?null==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[ol]();for(const t of this[nA])t.alphaTest=e,t.needsUpdate=!0;this[il](),this[rA]()}getAlphaCutoff(){return this[ol](),this[tl].alphaTest}setDoubleSided(e){this[ol]();for(const i of this[nA])i.side=e?t.DoubleSide:t.FrontSide,i.needsUpdate=!0;this[rA]()}getDoubleSided(){return this[ol](),this[tl].side==t.DoubleSide}setAlphaMode(e){this[ol]();const t=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(const i of this[nA])t(i,"BLEND"===e),i.alphaTest="MASK"===e?.5:void 0,i.needsUpdate=!0;this[rA]()}getAlphaMode(){return this[ol](),this[sl]()}get emissiveStrength(){return this[ol](),this[tl].emissiveIntensity}setEmissiveStrength(e){this[ol]();for(const t of this[nA])t.emissiveIntensity=e;this[rA]()}get clearcoatFactor(){return this[ol](),this[tl].clearcoat}get clearcoatRoughnessFactor(){return this[ol](),this[tl].clearcoatRoughness}get clearcoatTexture(){return this[ol](),this[pl].get(qA.Clearcoat)}get clearcoatRoughnessTexture(){return this[ol](),this[pl].get(qA.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[ol](),this[pl].get(qA.ClearcoatNormal)}get clearcoatNormalScale(){return this[ol](),this[tl].clearcoatNormalScale.x}setClearcoatFactor(e){this[ol]();for(const t of this[nA])t.clearcoat=e;this[rA]()}setClearcoatRoughnessFactor(e){this[ol]();for(const t of this[nA])t.clearcoatRoughness=e;this[rA]()}setClearcoatNormalScale(e){this[ol]();for(const i of this[nA])i.clearcoatNormalScale=new t.Vector2(e,e);this[rA]()}get ior(){return this[ol](),this[tl].ior}setIor(e){this[ol]();for(const t of this[nA])t.ior=e;this[rA]()}get sheenColorFactor(){return this[ol](),this[tl].sheenColor.toArray()}get sheenColorTexture(){return this[ol](),this[pl].get(qA.SheenColor)}get sheenRoughnessFactor(){return this[ol](),this[tl].sheenRoughness}get sheenRoughnessTexture(){return this[ol](),this[pl].get(qA.SheenRoughness)}setSheenColorFactor(e){this[ol]();const t=this.colorFromRgb(e);for(const e of this[nA])e.sheenColor.set(t),e.sheen=1;this[rA]()}setSheenRoughnessFactor(e){this[ol]();for(const t of this[nA])t.sheenRoughness=e,t.sheen=1;this[rA]()}get transmissionFactor(){return this[ol](),this[tl].transmission}get transmissionTexture(){return this[ol](),this[pl].get(qA.Transmission)}setTransmissionFactor(e){this[ol]();for(const t of this[nA])t.transmission=e;this[rA]()}get thicknessFactor(){return this[ol](),this[tl].thickness}get thicknessTexture(){return this[ol](),this[pl].get(qA.Thickness)}get attenuationDistance(){return this[ol](),this[tl].attenuationDistance}get attenuationColor(){return this[ol](),this[tl].attenuationColor.toArray()}setThicknessFactor(e){this[ol]();for(const t of this[nA])t.thickness=e;this[rA]()}setAttenuationDistance(e){this[ol]();for(const t of this[nA])t.attenuationDistance=e;this[rA]()}setAttenuationColor(e){this[ol]();const t=this.colorFromRgb(e);for(const e of this[nA])e.attenuationColor.set(t);this[rA]()}get specularFactor(){return this[ol](),this[tl].specularIntensity}get specularTexture(){return this[ol](),this[pl].get(qA.Specular)}get specularColorFactor(){return this[ol](),this[tl].specularColor.toArray()}get specularColorTexture(){return this[ol](),this[pl].get(qA.SheenColor)}setSpecularFactor(e){this[ol]();for(const t of this[nA])t.specularIntensity=e;this[rA]()}setSpecularColorFactor(e){this[ol]();const t=this.colorFromRgb(e);for(const e of this[nA])e.specularColor.set(t);this[rA]()}get iridescenceFactor(){return this[ol](),this[tl].iridescence}get iridescenceTexture(){return this[ol](),this[pl].get(qA.Iridescence)}get iridescenceIor(){return this[ol](),this[tl].iridescenceIOR}get iridescenceThicknessMinimum(){return this[ol](),this[tl].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[ol](),this[tl].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[ol](),this[pl].get(qA.IridescenceThickness)}setIridescenceFactor(e){this[ol]();for(const t of this[nA])t.iridescence=e;this[rA]()}setIridescenceIor(e){this[ol]();for(const t of this[nA])t.iridescenceIOR=e;this[rA]()}setIridescenceThicknessMinimum(e){this[ol]();for(const t of this[nA])t.iridescenceThicknessRange[0]=e;this[rA]()}setIridescenceThicknessMaximum(e){this[ol]();for(const t of this[nA])t.iridescenceThicknessRange[1]=e;this[rA]()}get anisotropyStrength(){return this[ol](),this[tl].anisotropy}get anisotropyRotation(){return this[ol](),this[tl].anisotropyRotation}get anisotropyTexture(){return this[ol](),this[pl].get(qA.Anisotropy)}setAnisotropyStrength(e){this[ol]();for(const t of this[nA])t.anisotropy=e;this[rA]()}setAnisotropyRotation(e){this[ol]();for(const t of this[nA])t.anisotropyRotation=e;this[rA]()}}let ml=class{constructor(e){this.name="",this.children=new Array,this.name=e}};class bl extends ml{constructor(e,t,i,s){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:a,threeGLTF:n,threeObjectMap:r}=s;this.parser=n.parser,this.modelVariants=i,this.mesh.userData.variantData=i;const o=r.get(e.material);null!=o.materials?this.initialMaterialIdx=this.activeMaterialIdx=o.materials:console.error(`Primitive (${e.name}) missing initial material reference.`);const A=e.userData.associations||{};if(null==A.meshes)return void console.error("Mesh is missing primitive index association");const l=((a.meshes||[])[A.meshes].primitives||[])[A.primitives];if(null!=l){if(null!=l.material)this.materials.set(l.material,t[l.material]);else{const e=t.findIndex(e=>"Default"===e.name);e>=0?this.materials.set(e,t[e]):console.warn("gltfPrimitive has no material!")}if(l.extensions&&l.extensions.KHR_materials_variants){const e=l.extensions.KHR_materials_variants,s=n.parser.json.extensions.KHR_materials_variants.variants;for(const a of e.mappings){const e=t[a.material];this.materials.set(a.material,e);for(const t of a.variants){const{name:a}=s[t];this.variantToMaterialMap.set(t,e),e[cl].add(t),i.has(a)||i.set(a,{name:a,index:t})}}}}else console.error("Mesh primitive definition is missing.")}async setActiveMaterial(e){const t=this.materials.get(e);if(e!==this.activeMaterialIdx){const i=t[nA],s=await t[rl]();this.mesh.material=null!=s?s:i.values().next().value,this.parser.assignFinalMaterial(this.mesh),i.add(this.mesh.material),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(null==e)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(e)){const t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(null!=this.variantToMaterialMap&&null!=e){const t=this.variantToMaterialMap.get(e);if(null!=t)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(const e of this.variantToMaterialMap.keys()){const t=this.mesh.userData.variantMaterials.get(e);if(null!=t.material)continue;const i=await this.enableVariantHelper(e);null!=i&&(t.material=i)}}get variantInfo(){return this.variantToMaterialMap}addVariant(e,t){if(!this.ensureVariantIsUnused(t))return!1;this.modelVariants.has(t)||this.modelVariants.set(t,{name:t,index:this.modelVariants.size});const i=this.modelVariants.get(t).index;return e[cl].add(i),this.variantToMaterialMap.set(i,e),this.materials.set(e.index,e),this.updateVariantUserData(i,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);const t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[cl].add(e),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map;this.mesh.userData.variantMaterials.set(e,{material:t[nA].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return null==t||!this.variantInfo.has(t.index)||(console.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var fl,Il,Cl,El,yl,Bl;const wl=Symbol("materials"),xl=Symbol("hierarchy"),vl=Symbol("roots"),Sl=Symbol("primitives"),Ql=Symbol("prepareVariantsForExport"),Ml=Symbol("switchVariant"),Rl=Symbol("materialFromPoint"),Tl=Symbol("nodeFromPoint"),Dl=Symbol("nodeFromIndex"),Fl=Symbol("variantData"),kl=Symbol("availableVariants"),Ll=Symbol("modelOnUpdate"),Pl=Symbol("cloneMaterial");class _l{constructor(e,t,i,s){this.gltf=e,this.gltfElementMap=t,this.mapKey=i,this.doLazyLoad=s}}class Ul{constructor(e,i=()=>{}){this[fl]=new Array,this[Il]=new Array,this[Cl]=new Array,this[El]=new Array,this[yl]=()=>{},this[Bl]=new Map,this[Ll]=i;const{gltf:s,threeGLTF:a,gltfElementMap:n}=e;for(const[e,t]of s.materials.entries()){const r=n.get(t);if(null!=r)this[wl].push(new ul(i,e,!0,this[Fl],r,t.name));else{const r=(s.materials||[])[e],o=new Set;n.set(r,o);const A=async()=>{const t=await a.parser.getDependency("material",e);return o.add(t),t};this[wl].push(new ul(i,e,!1,this[Fl],o,t.name,new _l(s,n,r,A)))}}const r=new Map,o=new Array;for(const e of a.scene.children)o.push(e);for(;o.length>0;){const i=o.pop();let s=null;i instanceof t.Mesh?(s=new bl(i,this.materials,this[Fl],e),this[Sl].push(s)):s=new ml(i.name);const a=r.get(i);null!=a?a.children.push(s):this[vl].push(s),this[xl].push(s);for(const e of i.children)o.push(e),r.set(i,s)}}get materials(){return this[wl]}[(fl=wl,Il=xl,Cl=vl,El=Sl,yl=Ll,Bl=Fl,kl)](){const e=Array.from(this[Fl].values());return e.sort((e,t)=>e.index-t.index),e.map(e=>e.name)}getMaterialByName(e){const t=this[wl].filter(t=>t.name===e);return t.length>0?t[0]:null}[Dl](e,t){const i=this[xl].find(i=>{if(i instanceof bl){const{meshes:s,primitives:a}=i.mesh.userData.associations;if(s==e&&a==t)return!0}return!1});return null==i?null:i}[Tl](e){const t=this[xl].find(t=>{if(t instanceof bl){if(t.mesh===e.object)return!0}return!1});return t||null}[Rl](e){const t=this[Tl](e);return t?t.getActiveMaterial():null}async[Ml](e){for(const t of this[Sl])await t.enableVariant(e);for(const e of this.materials)e[ll](!1);for(const e of this[Sl])this.materials[e.getActiveMaterial().index][ll](!0)}async[Ql](){const e=new Array;for(const t of this[Sl])e.push(t.instantiateVariants());await Promise.all(e)}[Pl](e,t){const i=this.materials[e];i.isLoaded||console.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");const s=i[nA],a=new Set;for(const[e,i]of s.entries()){const n=i.clone();n.name=t+(s.size>1?"_inst"+e:""),a.add(n)}const n=new ul(this[Ll],this[wl].length,!1,this[Fl],a,t);return this[wl].push(n),n}createMaterialInstanceForVariant(e,t,i,s=!0){let a=null;for(const s of this[Sl]){const n=this[Fl].get(i);null!=n&&s.variantInfo.has(n.index)||null!=s.getMaterial(e)&&(this.hasVariant(i)||this.createVariant(i),null==a&&(a=this[Pl](e,t)),s.addVariant(a,i))}if(s&&null!=a){a[ll](!0),this.materials[e][ll](!1);for(const e of this[Sl])e.enableVariant(i)}return a}createVariant(e){this[Fl].has(e)?console.warn(`Variant '${e}'' already exists`):this[Fl].set(e,{name:e,index:this[Fl].size})}hasVariant(e){return this[Fl].has(e)}setMaterialToVariant(e,t){if(null!=this[kl]().find(e=>e===t))if(e<0||e>=this.materials.length)console.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const i of this[Sl]){const s=i.getMaterial(e);null!=s&&i.addVariant(s,t)}else console.warn(`Can't add material to '${t}', the variant does not exist.'`)}updateVariantName(e,t){const i=this[Fl].get(e);null!=i&&(i.name=t,this[Fl].set(t,i),this[Fl].delete(e))}deleteVariant(e){const t=this[Fl].get(e);if(null!=t){for(const i of this.materials)i.hasVariant(e)&&i[cl].delete(t.index);for(const e of this[Sl])e.deleteVariant(t.index);this[Fl].delete(e)}}}
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var Gl=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const Nl=Symbol("currentGLTF"),Ol=Symbol("originalGltfJson"),ql=Symbol("model"),Hl=Symbol("extraModels"),jl=Symbol("getOnUpdateMethod"),zl=Symbol("buildTexture");
/* @license
* Copyright 2023 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class Kl extends t.Mesh{constructor(){super(void 0,new t.MeshBasicMaterial({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(e){this.material.map=e}isUsable(){return this.height>0&&this.radius>0&&null!=this.geometry&&null!=this.map}updateGeometry(e=this.height,i=this.radius,s=128){e==this.height&&i==this.radius&&s==this.resolution||(this.height=e,this.radius=i,this.resolution=s,e>0&&i>0&&(this.geometry.dispose(),this.geometry=function(e,i,s){const a=new t.SphereGeometry(i,2*s,s);a.scale(1,1,-1);const n=a.getAttribute("position"),r=new t.Vector3;for(let t=0;t<n.count;++t)if(r.fromBufferAttribute(n,t),r.y<0){const i=3*-e/2,s=r.y<i?-e/r.y:1-r.y*r.y/(3*i*i);r.multiplyScalar(s),r.toArray(n.array,3*t)}return n.needsUpdate=!0,a}
/* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(e,i,s)))}}const Vl=new t.Vector3,Jl=new t.Vector3,Wl=new t.Vector3,Yl=new t.Matrix3,Xl=new t.Triangle,$l=new t.Quaternion;class Zl extends ys{constructor(e){super(document.createElement("div")),this.normal=new t.Vector3(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivotEl=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivotEl),this.pivotEl.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface,null!=e.modelIndex&&(this.modelIndex=e.modelIndex)}get facingCamera(){return!this.element.classList.contains("hide")}show(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}hide(){!this.facingCamera&&this.initialized||this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,0===this.referenceCount}updatePosition(e){if(null==e)return;const t=Ga(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,Ya(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;const t=Ga(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(){const{mesh:e,tri:t,bary:i}=this;if(null==e||null==t||null==i)return;e.getVertexPosition(t.x,Vl),e.getVertexPosition(t.y,Jl),e.getVertexPosition(t.z,Wl),Vl.toArray(Yl.elements,0),Jl.toArray(Yl.elements,3),Wl.toArray(Yl.elements,6),this.position.copy(i).applyMatrix3(Yl);const s=this.parent;s.worldToLocal(e.localToWorld(this.position)),Xl.set(Vl,Jl,Wl),Xl.getNormal(this.normal).transformDirection(e.matrixWorld);const a=s.parent;$l.setFromAxisAngle(Vl.set(0,1,0),-a.rotation.y),this.normal.applyQuaternion($l)}orient(e){this.pivotEl.style.transform=`rotate(${e}rad)`}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach(t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const i=t,s=i.dataset.visibilityAttribute;if(null!=s){const t=`data-${s}`;i.toggleAttribute(t,e)}i.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))}),this.initialized=!0}}const ec={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},tc={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};function ic(e,t,i){return(1-i)*e+i*t}
/* @license
* Copyright 2022 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class sc extends t.Object3D{constructor(e,i,s){super(),this.camera=new t.OrthographicCamera,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new t.MeshDepthMaterial,this.horizontalBlurMaterial=new t.ShaderMaterial(ec),this.verticalBlurMaterial=new t.ShaderMaterial(tc),this.intensity=0,this.softness=1,this.boundingBox=new t.Box3,this.size=new t.Vector3,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:a}=this;a.rotation.x=Math.PI/2,a.left=-.5,a.right=.5,a.bottom=-.5,a.top=.5,this.add(a);const n=new t.PlaneGeometry,r=new t.MeshBasicMaterial({opacity:1,transparent:!0,side:t.BackSide});this.floor=new t.Mesh(n,r),this.floor.userData.noHit=!0,a.add(this.floor),this.blurPlane=new t.Mesh(n),this.blurPlane.visible=!1,a.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace(/gl_FragColor\s*=\s*vec4\(\s*vec3\(\s*1\.0\s*-\s*fragCoordZ\s*\),\s*opacity\s*\);/,"gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.depthMaterial.side=t.DoubleSide,this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,i,s)}setScene(e,t,i){const{boundingBox:s,size:a,rotation:n,position:r}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(a.x,a.y,a.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(r),"back"===i){const{min:e,max:t}=s;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[a.y,a.z]=[a.z,a.y],n.x=Math.PI/2,n.y=Math.PI}else n.x=0,n.y=0;if(this.isAnimated){const e=s.min.y,t=s.max.y;a.y=this.maxDimension,s.expandByVector(a.subScalar(this.maxDimension).multiplyScalar(-.5)),s.min.y=e,s.max.y=t,a.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===i?r.y=s.min.y:r.z=s.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:i}=this,s=this.isAnimated?2:1,a=s*Math.pow(2,9-3*e);this.setMapSize(a);const n=t.y/2,r=t.y*s;i.near=0,i.far=ic(r,n,e),this.depthMaterial.opacity=1/e,i.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:i}=this;this.isAnimated&&(e*=2);const s=Math.floor(i.x>i.z?e:e*i.x/i.z),a=Math.floor(i.x>i.z?e*i.z/i.x:e),n=10+s,r=10+a;if(null==this.renderTarget||this.renderTarget.width===n&&this.renderTarget.height===r||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const e={format:t.RGBAFormat};this.renderTarget=new t.WebGLRenderTarget(n,r,e),this.renderTargetBlur=new t.WebGLRenderTarget(n,r,e),this.floor.material.map=this.renderTarget.texture}const o=i.x*(1+10/s),A=i.z*(1+10/a);this.camera.left=-o/2,this.camera.right=o/2,this.camera.bottom=-A/2,this.camera.top=A/2,this.camera.scale.set(1,1,1),this.floor.scale.set(o,A,1),this.blurPlane.scale.set(o,A,1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*ic(.3,1,this.softness*this.softness)):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.intensity}setOffset(e){this.floor.position.z=-e+this.gap()}gap(){return.001*this.maxDimension}render(e,t){t.overrideMaterial=this.depthMaterial,this.floor.visible=!1;const i=e.xr.enabled;e.xr.enabled=!1;const s=e.getRenderTarget();e.setRenderTarget(this.renderTarget);const a=e.getClearAlpha();e.setClearAlpha(0);const n=e.state;null!=n&&(n.buffers.color.setMask(!0),n.buffers.depth.setMask(!0)),e.clear();const r=e.autoClear;e.autoClear=!1,e.render(t,this.camera),e.autoClear=r,t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=i,e.setRenderTarget(s),e.setClearAlpha(a)}blurShadow(e){const{camera:t,horizontalBlurMaterial:i,verticalBlurMaterial:s,renderTarget:a,renderTargetBlur:n,blurPlane:r}=this;r.visible=!0,r.material=i,i.uniforms.h.value=1/this.renderTarget.width,i.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(n),e.render(r,t),r.material=s,s.uniforms.v.value=1/this.renderTarget.height,s.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(a),e.render(r,t),r.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}
/* @license
* Copyright 2025 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/const ac=new t.Vector3,nc=new t.Vector3,rc=new t.Vector3,oc=new t.Raycaster,Ac=new t.Vector3,lc=new t.Vector2;class cc extends t.Scene{constructor({canvas:e,element:i,width:s,height:a}){super(),this.annotationRenderer=new Qs,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.appendedAnimations=[],this.markedAnimations=[],this.camera=new t.PerspectiveCamera(45,1,.1,100),this.xrCamera=null,this.url=null,this.extraUrls=[],this.scenePivot=new t.Object3D,this.target=new t.Object3D,this.animationNames=[],this.boundingBox=new t.Box3,this.boundingSphere=new t.Sphere,this.size=new t.Vector3,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=t.NeutralToneMapping,this.canScale=!0,this.isDirty=!1,this.goalTarget=new t.Vector3,this.targetDamperX=new Fa,this.targetDamperY=new Fa,this.targetDamperZ=new Fa,this._currentGLTFs=[],this._models=[],this.boundsAndShadowDirty=!1,this.mixers=[],this.mixerPausedStates=[],this.mixerEventSubscriptions=[],this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationActions=[],this.groundedSkybox=new Kl,this.name="ModelScene",this.element=i,this.canvas=e,this.camera=new t.PerspectiveCamera(45,1,.1,100),this.camera.name="MainCamera",this.add(this.scenePivot),this.scenePivot.name="Pivot",this.scenePivot.add(this.target),this.setSize(s,a),this.target.name="Target",this.mixers=[];const{domElement:n}=this.annotationRenderer,{style:r}=n;r.display="none",r.pointerEvents="none",r.position="absolute",r.top="0",this.element.shadowRoot.querySelector(".default").appendChild(n),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(e){this.reset(),this._models=[e],this.target.add(e),await this.setupScene()}async setSource(e,t=[],i=()=>{}){if((!e||e===this.url)&&t.join(",")===this.extraUrls.join(","))return void i(1);if(this.reset(),this.url=e,this.extraUrls=t,null!=this.externalRenderer){const e=await this.externalRenderer.load(i);return this.boundingSphere.radius=e.framedRadius,void(this.idealAspect=e.fieldOfViewAspect)}null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);let s=[];try{const a=[];e&&a.push(e),t&&a.push(...t),a.length>0&&(s=await new Promise((e,t)=>{this.cancelPendingSourceChange=()=>t(),(async()=>{try{const t=await Promise.all(a.map(e=>this.element[nh].loader.load(e,this.element,i)));e(t)}catch(e){t(e)}})()}))}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this.extraUrls=t,this._currentGLTFs=s;for(const e of s)null!=e?(this._models.push(e.scene),this.target.add(e.scene),this.mixers.push(this.createMixer(e.scene)),this.mixerPausedStates.push(!1),this.currentAnimationActions.push(null)):(this.mixers.push(this.createMixer(this.target)),this.mixerPausedStates.push(!1),this.currentAnimationActions.push(null));const a=new Map,n=[],r=[];for(const e of s)for(const t of e.animations||[])a.set(t.name,t),n.push(t.name),r.push(t);this.animations=r,this.animationsByName=a,this.animationNames=n,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}updateModelTransforms(e,i,s,a){const n=this._models[e];if(n){if(i){const e=Ga(i)[0].terms;if(e.length>=3){const t=Ya(e[0]).number,i=Ya(e[1]).number,s=Ya(e[2]).number;n.position.set(t,i,s)}}if(s){const e=Ga(s)[0].terms;if(e.length>=3){const i=Ya(e[0]).number,s=Ya(e[1]).number,a=Ya(e[2]).number;n.quaternion.setFromEuler(new t.Euler(s,a,i,"YXZ"))}}if(a){const e=a.split(" ").map(e=>e.trim()).filter(e=>e.length>0).map(Number);1!==e.length||isNaN(e[0])?3!==e.length||e.some(isNaN)||n.scale.set(e[0],e[1],e[2]):n.scale.setScalar(e[0])}n.updateMatrixWorld(!0),this.boundsAndShadowDirty=!0,this.queueRender()}}updateBoundingBoxAndShadowIfDirty(){this.boundsAndShadowDirty&&(this.boundsAndShadowDirty=!1,this.updateBoundingBox(),this.updateShadow())}reset(){this.url=null,this.extraUrls=[],this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();const{_models:e}=this;for(const t of e)null!=t&&t.removeFromParent();this._models=[];const t=this._currentGLTFs;for(const e of t)null!=e&&e.dispose();this._currentGLTFs=[];for(const e of this.currentAnimationActions)null!=e&&e.stop();this.currentAnimationActions=[];for(const e of this.mixers)e.stopAllAction(),e.uncacheRoot(this);this.mixers=[],this.mixerPausedStates=[]}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[Nl]=null,this.element[Ol]=null,this.element[ql]=null}get currentGLTF(){return this._currentGLTFs[0]||null}get currentGLTFs(){return this._currentGLTFs}setSize(e,t){if(this.width!==e||this.height!==t){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,null!=this.externalRenderer){const i=window.devicePixelRatio;this.externalRenderer.resize(e*i,t*i)}this.queueRender()}}markBakedShadow(e){e.userData.noHit=!0,this.bakedShadows.add(e)}unmarkBakedShadow(e){e.userData.noHit=!1,e.visible=!0,this.bakedShadows.delete(e),this.boundingBox.expandByObject(e)}findBakedShadows(e){const i=new t.Box3;e.traverse(e=>{const t=e;if(!t.material)return;if(!t.material.transparent)return;i.setFromObject(t);const s=i.getSize(Ac),a=Math.min(s.x,s.y,s.z);Math.max(s.x,s.y,s.z)<100*a||this.markBakedShadow(t)})}checkBakedShadows(){const{min:e,max:i}=this.boundingBox,s=new t.Box3;this.boundingBox.getSize(this.size);for(const t of this.bakedShadows)s.setFromObject(t),s.min.y<e.y+this.size.y/100&&s.min.x<=e.x&&s.max.x>=i.x&&s.min.z<=e.z&&s.max.z>=i.z||s.min.z<e.z+this.size.z/100&&s.min.x<=e.x&&s.max.x>=i.x&&s.min.y<=e.y&&s.max.y>=i.y||this.unmarkBakedShadow(t)}applyTransform(){const{models:e}=this;if(0===e.length)return;const i=Ga(this.element.orientation)[0].terms,s=Ya(i[0]).number,a=Ya(i[1]).number,n=Ya(i[2]).number,r=Ga(this.element.scale)[0].terms;for(const i of e)i.quaternion.setFromEuler(new t.Euler(a,n,s,"YXZ")),i.scale.set(r[0].number,r[1].number,r[2].number)}updateBoundingBox(){const{models:e}=this;if(0===e.length)return;for(const t of e)this.target.remove(t),this.findBakedShadows(t);const i=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1);let s=new t.Box3;for(const t of e)s=Ms(t,i,s);if(this.boundingBox=s,this.boundingBox.isEmpty()){this.setBakedShadowVisibility(!0),this.bakedShadows.forEach(e=>this.unmarkBakedShadow(e)),s=new t.Box3;for(const t of e)s=Ms(t,i,s);this.boundingBox=s}this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size);for(const t of e)this.target.add(t)}async updateFraming(){const{models:e}=this;if(0===e.length)return;for(const t of e)this.target.remove(t);this.setBakedShadowVisibility(!1);const{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget());const i=(e,i)=>Math.max(e,t.distanceToSquared(i));let s=0;for(const t of e)s=Math.max(s,Ms(t,i,0));this.boundingSphere.radius=Math.sqrt(s);const a=(e,i)=>{i.sub(t);const s=Math.sqrt(i.x*i.x+i.z*i.z);return Math.max(e,s/(this.idealCameraDistance()-Math.abs(i.y)))};let n=0;for(const t of e)n=Math.max(n,Ms(t,a,0));this.idealAspect=n/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility();for(const t of e)this.target.add(t)}setBakedShadowVisibility(e=this.shadowIntensity<=0){for(const t of this.bakedShadows)t.visible=e}idealCameraDistance(){const e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){const t=Math.tan(e/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect);return 2*Math.atan(t)*180/Math.PI}getNDC(e,t){if(null!=this.xrCamera)lc.set(e/window.screen.width,t/window.screen.height);else{const i=this.element.getBoundingClientRect();lc.set((e-i.x)/this.width,(t-i.y)/this.height)}return lc.multiplyScalar(2).subScalar(1),lc.y*=-1,lc}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[nh].arRenderer.presentedScene!==this&&(this.environment=e,this.setBackground(t),this.queueRender())}setBackground(e){this.groundedSkybox.map=e,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=e)}farRadius(){return this.boundingSphere.radius*(null!=this.groundedSkybox.parent?10:1)}setGroundedSkybox(){const e=Ga(this.element.skyboxHeight)[0].terms[0],t=Ya(e).number,i=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,i),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,i){this.goalTarget.set(-e,-t,-i)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}getDynamicTarget(){return this.target.position.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){const t=this.goalTarget,i=this.target.position;if(t.equals(i))return!1;{const s=this.boundingSphere.radius/10;let{x:a,y:n,z:r}=i;return a=this.targetDamperX.update(a,t.x,e,s),n=this.targetDamperY.update(n,t.y,e,s),r=this.targetDamperZ.update(r,t.z,e,s),this.groundedSkybox.position.x=-a,this.groundedSkybox.position.z=-r,this.target.position.set(a,n,r),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:i,z:s}=this.position;this.yaw=Math.atan2(e-i,t-s)}get model(){return this._models[0]||null}get models(){return this._models}set yaw(e){this.scenePivot.rotation.y=e,this.groundedSkybox.rotation.y=-e,this.queueRender()}get yaw(){return this.scenePivot.rotation.y}set animationTime(e){for(const t of this.mixers)t.setTime(e);this.queueShadowRender()}get animationTime(){let e=0;for(const i of this.currentAnimationActions)if(null!=i){let s=i.time;const a=Math.max(i._loopCount,0);if(i.loop===t.LoopPingPong&&!(1&~a)){s=(i.getClip()?i.getClip().duration:0)-i.time}s>e&&(e=s)}return e}set animationTimeScale(e){for(const t of this.mixers)t.timeScale=e}get animationTimeScale(){return this.mixers.length>0?this.mixers[0].timeScale:1}get duration(){let e=0;for(const t of this.currentAnimationActions)if(null!=t&&t.getClip()){const i=t.getClip().duration;i>e&&(e=i)}return e}get hasActiveAnimation(){return this.currentAnimationActions.some(e=>null!=e)}playAnimation(e=null,i=0,s=t.LoopRepeat,a=1/0,n=null){const r=null!=n?n:0,o=null!=n?n+1:this._models.length;for(let t=r;t<o;t++){const n=this._currentGLTFs[t];if(null==n)continue;const r=n.animations||[];if(0===r.length)continue;let o=null;if(null!=e){for(let t=r.length-1;t>=0;t--)if(r[t].name===e){o=r[t];break}if(null==o){const t=parseInt(e);!isNaN(t)&&t>=0&&t<r.length&&(o=r[t])}}null==o&&(o=r[0]);try{const e=this.currentAnimationActions[t],n=this.mixers[t],r=n.clipAction(o,this._models[t]);this.currentAnimationActions[t]=r,this.element.paused?(n.stopAllAction(),this.mixerPausedStates[t]=!0):(r.paused=!1,this.mixerPausedStates[t]=!1,null!=e&&r!==e?r.crossFadeFrom(e,i,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),r.setLoop(s,a),r.enabled=!0,r.clampWhenFinished=!0,r.play()}catch(e){console.error(e)}}}appendAnimation(e="",i=t.LoopRepeat,s=1/0,a=1,n=1,r=!1,o=!1,A=!0,l=null,c=!1,h=null){if(null==this.currentGLTF||e===this.element.animationName)return;const{animations:d}=this;if(null==d||0===d.length)return;const g=e?this.animationsByName.get(e):null;if(null==g)return;if("string"==typeof s?isNaN(parseFloat(s))?(s=1/0,console.warn(`Invalid repetitionCount value: ${s}. Using default: Infinity`)):(parseInt(s)<1&&console.warn(`Invalid repetitionCount value: ${s}. Using 1 as minimum.`),s=Math.max(parseInt(s),1)):"number"!=typeof s||isNaN(s)?(console.warn(`Invalid repetitionCount value: ${s}. Using default: Infinity`),s=1/0):s<1&&(console.warn(`Invalid repetitionCount value: ${s}. Using 1 as minimum.`),s=1),1===s&&i!==t.LoopOnce&&(i=t.LoopOnce),"string"==typeof a){const e=parseFloat(a);isNaN(e)||e<0||e>1?(a=1,console.warn(`Invalid weight value: ${a}. Using default: 1`)):a=e}if("string"==typeof n){const e=parseFloat(n);isNaN(e)||e<0?(n=1,console.warn(`Invalid timeScale value: ${n}. Using default: 1`)):n=e}if("string"==typeof l){const e=parseFloat(l);isNaN(e)?(l=null,console.warn(`Invalid time value: ${l}. Using default: 0 or previous time`)):l=e}const{shouldFade:p,duration:u}=this.parseFadeValue(r,!1,1.25);let m=!1,b=0;"boolean"==typeof o?(m=o,b=o?1.25:0):"number"==typeof o?(m=o>0,b=Math.max(o,0),o<0&&console.warn(`Invalid warp value: ${o}. Using default: false`)):"string"==typeof o&&("true"===o.toLowerCase().trim()?(m=!0,b=1.25):"false"===o.toLowerCase().trim()?m=!1:isNaN(parseFloat(o))?console.warn(`Invalid warp value: ${o}. Using default: false`):(b=Math.max(parseFloat(o),0),m=b>0,b<=0&&console.warn(`Invalid warp value: ${o}. Using default: false`)));try{c&&this.appendedAnimations.includes(e)&&(this.markedAnimations.map(e=>e.name).includes(e)||this.markedAnimations.push({name:e,loopMode:i,repetitionCount:s}));const t=null!=h?h:0,r=null!=h?h+1:this.mixers.length;for(let e=t;e<r;e++){const t=this.mixers[e],r=t.existingAction(g)||t.clipAction(g,this._models[e]||this),o=r.timeScale;"number"==typeof l&&(r.time=Math.min(Math.max(l,0),g.duration)),p?r.fadeIn(u):a>=0&&(r.weight=Math.min(Math.max(a,0),1)),m?r.warp(A?o:0,n,b):r.timeScale=n,r.isRunning()||(r.time==g.duration&&r.stop(),r.setLoop(i,s),r.paused=!1,r.enabled=!0,r.clampWhenFinished=!0,r.play())}this.appendedAnimations.includes(e)||this.element[eh].appendedAnimations.push(e)}catch(e){console.error(e)}}parseFadeValue(e,t=!0,i=1.5){if("boolean"==typeof e)return{shouldFade:e,duration:e?i:0};if("number"==typeof e){const t=Math.max(e,0);return{shouldFade:t>0,duration:t}}if("string"==typeof e){const t=e.toLowerCase().trim();if("true"===t)return{shouldFade:!0,duration:i};if("false"===t)return{shouldFade:!1,duration:0};const s=parseFloat(t);if(!isNaN(s)){const e=Math.max(s,0);return{shouldFade:e>0,duration:e}}}return console.warn(`Invalid fade value: ${e}. Using default: ${t}`),{shouldFade:t,duration:t?i:0}}detachAnimation(e="",t=!0,i=null){if(null==this.currentGLTF||e===this.element.animationName)return;const{animations:s}=this;if(null==s||0===s.length)return;const a=e?this.animationsByName.get(e):null;if(null==a)return;const{shouldFade:n,duration:r}=this.parseFadeValue(t,!0,1.5);try{const t=null!=i?i:0,s=null!=i?i+1:this.mixers.length;for(let e=t;e<s;e++){const t=this.mixers[e],i=t.existingAction(a)||t.clipAction(a,this._models[e]||this);n?i.fadeOut(r):i.stop()}this.element[eh].appendedAnimations=this.element[eh].appendedAnimations.filter(t=>t!==e)}catch(e){console.error(e)}}updateAnimationLoop(e="",i=t.LoopRepeat,s=1/0,a=null){if(null==this.currentGLTF||e===this.element.animationName)return;const{animations:n}=this;if(null==n||0===n.length)return;let r=null;if(e&&(r=this.animationsByName.get(e)),null!=r)try{const e=null!=a?a:0,t=null!=a?a+1:this.mixers.length;for(let a=e;a<t;a++){const e=this.mixers[a],t=e.existingAction(r)||e.clipAction(r,this._models[a]||this);t.stop(),t.setLoop(i,s),t.play()}}catch(e){console.error(e)}}stopAnimation(){this.currentAnimationActions.fill(null);for(const e of this.mixers)e.stopAllAction();this.mixerPausedStates.fill(!0)}isAllAnimationsPaused(){return this.mixerPausedStates.every(e=>e)}pauseAnimation(e=null){const t=null!=e?e:0,i=null!=e?e+1:this.mixers.length;for(let e=t;e<i;e++)this.mixerPausedStates[e]=!0}unpauseAnimation(e=null){const t=null!=e?e:0,i=null!=e?e+1:this.mixers.length;for(let e=t;e<i;e++)this.mixerPausedStates[e]=!1}updateAnimation(e){for(let t=0;t<this.mixers.length;t++)this.mixerPausedStates[t]||this.mixers[t].update(e);this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixerEventSubscriptions.push({event:e,callback:t});for(const i of this.mixers)i.addEventListener(e,t)}createMixer(e){const i=new t.AnimationMixer(e);for(const{event:e,callback:t}of this.mixerEventSubscriptions)i.addEventListener(e,t);return i}updateShadow(){const e=this.shadow;if(null!=e){const t="wall"===this.element.arPlacement?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){this.updateBoundingBoxAndShadowIfDirty();const t=this.shadow;null!=t&&1==t.needsUpdate&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if(this.shadowIntensity=e,null!=this.currentGLTF&&(this.setBakedShadowVisibility(),!(e<=0&&null==this.shadow))){if(null==this.shadow){const e="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new sc(this,this.shadowSoftness,e)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;const t=this.shadow;null!=t&&t.setSoftness(e)}setShadowOffset(e){const t=this.shadow;null!=t&&t.setOffset(e)}getHit(e=this){return oc.intersectObject(e,!0).find(e=>e.object.visible&&!e.object.userData.noHit)}hitFromController(e,t=this){return oc.setFromXRController(e),this.getHit(t)}hitFromPoint(e,t=this){return oc.setFromCamera(e,this.getCamera()),this.getHit(t)}getModelIndexFromHit(e){let t=e.object;for(;null!=t;){const e=this.models.indexOf(t);if(-1!==e)return e;t=t.parent}return 0}positionAndNormalFromPoint(e,i=this){var s;const a=this.hitFromPoint(e,i);if(null==a)return null;const n=a.point,r=null!=a.face?a.face.normal.clone().applyNormalMatrix((new t.Matrix3).getNormalMatrix(a.object.matrixWorld)):oc.ray.direction.clone().multiplyScalar(-1),o=null!==(s=a.uv)&&void 0!==s?s:null,A=this.getModelIndexFromHit(a),l=this.models[A]||this.target;return{position:n,normal:r,uv:o,modelIndex:A,worldToModel:(new t.Matrix4).copy(l.matrixWorld).invert()}}surfaceFromPoint(e,i=this){var s;const a=this.hitFromPoint(e,i);if(null==a||null==a.face)return null;const n=this.getModelIndexFromHit(a),r=0===n?this.element.model:null===(s=this.element.extraModels)||void 0===s?void 0:s[n-1];if(null==r)return null;const o=r[Tl](a);if(null==o)return null;const{meshes:A,primitives:l}=o.mesh.userData.associations,c=new t.Vector3,h=new t.Vector3,d=new t.Vector3,{a:g,b:p,c:u}=a.face,m=a.object;m.getVertexPosition(g,c),m.getVertexPosition(p,h),m.getVertexPosition(u,d);const b=new t.Triangle(c,h,d),f=new t.Vector3;b.getBarycoord(m.worldToLocal(a.point),f),b.getBarycoord(m.worldToLocal(a.point),f);const I=`${A} ${l} ${g} ${p} ${u} ${f.x.toFixed(3)} ${f.y.toFixed(3)} ${f.z.toFixed(3)}`;return 0===n?I:`${n} ${I}`}updateHotspotAttachment(e){const t=null!=e.modelIndex&&e.modelIndex>0&&this._models[e.modelIndex]?this._models[e.modelIndex]:this.target;e.parent!==t&&(t.add(e),e.updatePosition(e.position.toArray().join(" ")+"m"),e.updateMatrixWorld(!0))}addHotspot(e){this.updateHotspotAttachment(e),this.annotationRenderer.domElement.appendChild(e.element),this.updateSurfaceHotspot(e)}removeHotspot(e){e.parent&&e.parent.remove(e)}forHotspots(e){const t=[...this.target.children];for(let i=0,s=t.length;i<s;i++){const s=t[i];s instanceof Zl&&e(s)}for(const t of this._models)if(t&&t!==this.target){const i=[...t.children];for(let t=0,s=i.length;t<s;t++){const s=i[t];s instanceof Zl&&e(s)}}}updateSurfaceHotspot(e){var i,s;if(null==e.surface)return;const a=Ga(e.surface)[0].terms;if(8!==a.length&&9!==a.length)return void console.warn(e.surface+" does not have exactly 8 or 9 numbers. Did you use an outdated string?");const n=8===a.length,r=n?0:a[0].number,o=n?0:1,A=null!==(i=e.modelIndex)&&void 0!==i?i:r;e.modelIndex=A,this.updateHotspotAttachment(e);const l=0===A?this.element.model:null===(s=this.element.extraModels)||void 0===s?void 0:s[A-1];if(null==l)return;const c=l[Dl](a[0+o].number,a[1+o].number);if(null==c)return void console.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const h=c.mesh.geometry.attributes.position.count,d=new t.Vector3(a[2+o].number,a[3+o].number,a[4+o].number);if(d.x>=h||d.y>=h||d.z>=h)return void console.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const g=new t.Vector3(a[5+o].number,a[6+o].number,a[7+o].number);e.mesh=c.mesh,e.tri=d,e.bary=g,e.updateSurface()}animateSurfaceHotspots(){this.element.paused||this.forHotspots(e=>{e.updateSurface()})}updateHotspotsVisibility(e){this.forHotspots(t=>{ac.copy(e),nc.setFromMatrixPosition(t.matrixWorld),ac.sub(nc),rc.copy(t.normal).transformDirection(this.target.matrixWorld),ac.dot(rc)<0?t.hide():t.show()})}orientHotspots(e){this.forHotspots(t=>{t.orient(e)})}setHotspotsVisibility(e){this.forHotspots(t=>{t.visible=e})}updateSchema(e){var t;const{schemaElement:i,element:s}=this,{alt:a,poster:n,iosSrc:r}=s;if(null!=e){const s=[{"@type":"MediaObject",contentUrl:e,encodingFormat:"gltf"===(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];r&&s.push({"@type":"MediaObject",contentUrl:r,encodingFormat:"model/vnd.usdz+zip"});const o={"@context":"http://schema.org/","@type":"3DModel",image:null!=n?n:void 0,name:null!=a?a:void 0,encoding:s};i.textContent=JSON.stringify(o),document.head.appendChild(i)}else null!=i.parentElement&&i.parentElement.removeChild(i)}}
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/class hc extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){const t={progress:0,completed:!1};return this.ongoingActivities.add(t),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0,e),i=>{let s;return s=Math.max(De(i,0,1),t.progress),s!==t.progress&&this.announceTotalProgress(t,s,e),t.progress}}announceTotalProgress(e,t,i){let s=0,a=0;1==t&&(e.completed=!0);for(const e of this.ongoingActivities){const{progress:t}=e;s+=1-t,e.completed&&a++}const n=e.progress;e.progress=t,this.totalProgress+=(t-n)*(1-this.totalProgress)/s;const r=a===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:r,reason:i}})),a===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var dc,gc,pc,uc,mc,bc,fc,Ic,Cc,Ec,yc,Bc,wc,xc,vc,Sc=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const Qc=document.createElement("canvas"),Mc=Symbol("fallbackResizeHandler"),Rc=Symbol("defaultAriaLabel"),Tc=Symbol("resizeObserver"),Dc=Symbol("clearModelTimeout"),Fc=Symbol("onContextLost"),kc=Symbol("loaded"),Lc=Symbol("status"),Pc=Symbol("onFocus"),_c=Symbol("onBlur"),Uc=Symbol("onSlotChange"),Gc=Symbol("onExtraModelChanged"),Nc=Symbol("updateSize"),Oc=Symbol("intersectionObserver"),qc=Symbol("isElementInViewport"),Hc=Symbol("announceModelVisibility"),jc=Symbol("ariaLabel"),zc=Symbol("altDefaulted"),Kc=Symbol("statusElement"),Vc=Symbol("updateStatus"),Jc=Symbol("loadedTime"),Wc=Symbol("updateSource"),Yc=Symbol("markLoaded"),Xc=Symbol("container"),$c=Symbol("input"),Zc=Symbol("canvas"),eh=Symbol("scene"),th=Symbol("needsRender"),ih=Symbol("tick"),sh=Symbol("onModelLoad"),ah=Symbol("onResize"),nh=Symbol("renderer"),rh=Symbol("progressTracker"),oh=Symbol("getLoaded"),Ah=Symbol("getModelIsVisible"),lh=Symbol("shouldAttemptPreload"),ch=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),hh=e=>({u:e.x,v:e.y,toString(){return`${this.u} ${this.v}`}});class dh extends y{static get is(){return"model-viewer"}static set modelCacheSize(e){Es[Is].evictionThreshold=e}static get modelCacheSize(){return Es[Is].evictionThreshold}static set minimumRenderScale(e){e>1&&console.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&console.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),aA.singleton.minScale=e}static get minimumRenderScale(){return aA.singleton.minScale}get loaded(){return this[oh]()}get[(dc=qc,gc=kc,pc=Jc,uc=Lc,mc=Dc,bc=Uc,fc=Gc,Ic=Mc,Cc=Hc,Ec=Tc,yc=Oc,Bc=rh,nh)](){return aA.singleton}get modelIsVisible(){return this[Ah]()}constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[dc]=!1,this[gc]=!1,this[pc]=0,this[uc]="",this[mc]=null,this[bc]=()=>{if(!this[eh])return;const e=Array.from(this.querySelectorAll("extra-model")),t=e.map(e=>e.src).filter(e=>null!=e),i=this[eh].extraUrls||[];t.join(",")===i.join(",")&&e.length===i.length||(null==this.src&&0===e.length?(this[kc]=!1,this[Jc]=0,this[eh].reset()):(this[kc]=!1,this[Jc]=0,this[Wc]()))},this[fc]=e=>{const t=e,i=t.target,s=Array.from(this.querySelectorAll("extra-model")).indexOf(i);if(-1===s)return;const a=this.src?s+1:s;t.detail.srcChanged?(this[kc]=!1,this[Jc]=0,this[Wc]()):this[eh]&&this[eh].updateModelTransforms(a,t.detail.offset,t.detail.orientation,t.detail.scale)},this[Ic]=Te(()=>{const e=this.getBoundingClientRect();this[Nc](e)},50),this[Cc]=Te(e=>{const t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))},0),this[Ec]=null,this[yc]=null,this[Bc]=new hc,this[wc]=()=>{this[Kc].textContent=this[Lc]},this[xc]=()=>{this[Kc].textContent=""},this[vc]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;let t,i;if((e=>{re(Ge,e)})(e),this[Xc]=e.querySelector(".container"),this[$c]=e.querySelector(".userInput"),this[Zc]=e.querySelector("canvas"),this[Kc]=e.querySelector("#status"),this[Rc]=this[$c].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();t=e.width,i=e.height}else t=300,i=150;this[eh]=new cc({canvas:this[Zc],element:this,width:t,height:i}),Promise.resolve().then(()=>{this[Nc](this.getBoundingClientRect())}),be&&(this[Tc]=new ResizeObserver(e=>{if(!this[nh].isPresenting)for(let t of e)t.target===this&&this[Nc](t.contentRect)})),fe?this[Oc]=new IntersectionObserver(e=>{for(let t of e)if(t.target===this){const e=this.modelIsVisible;this[qc]=t.isIntersecting,this[Hc](e),this[qc]&&!this.loaded&&this[Wc]()}},{root:null,rootMargin:"0px",threshold:1e-5}):this[qc]=!0}connectedCallback(){super.connectedCallback&&super.connectedCallback(),be?this[Tc].observe(this):self.addEventListener("resize",this[Mc]),fe&&this[Oc].observe(this),this.addEventListener("focus",this[Pc]),this.addEventListener("blur",this[_c]),this.addEventListener("extra-model-changed",this[Gc]);const e=this.shadowRoot.querySelector(".slot.default slot");e&&e.addEventListener("slotchange",this[Uc]);const t=this[nh];t.addEventListener("contextlost",this[Fc]),t.registerScene(this[eh]),null!=this[Dc]&&(self.clearTimeout(this[Dc]),this[Dc]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),be?this[Tc].unobserve(this):self.removeEventListener("resize",this[Mc]),fe&&this[Oc].unobserve(this),this.removeEventListener("focus",this[Pc]),this.removeEventListener("blur",this[_c]),this.removeEventListener("extra-model-changed",this[Gc]);const e=this.shadowRoot.querySelector(".slot.default slot");e&&e.removeEventListener("slotchange",this[Uc]);const t=this[nh];t.removeEventListener("contextlost",this[Fc]),t.unregisterScene(this[eh]),this[Dc]=self.setTimeout(()=>{this[eh].dispose(),this[Dc]=null},10)}updated(e){if(super.updated(e),e.has("src")){const e=Array.from(this.querySelectorAll("extra-model")),t=e.map(e=>e.src).filter(e=>null!=e),i=t.join(",")===(this[eh].extraUrls||[]).join(",");null==this.src&&0===e.length?(this[kc]=!1,this[Jc]=0,this[eh].reset()):this.src===this[eh].url&&i||(this[kc]=!1,this[Jc]=0,this[Wc]())}if(e.has("alt")&&this[$c].setAttribute("aria-label",this[jc]),e.has("generateSchema"))if(this.generateSchema){const e=Array.from(this.querySelectorAll("extra-model")).map(e=>e.src).filter(e=>null!=e),t=this.src||e[0]||null;this[eh].updateSchema(t)}else this[eh].updateSchema(null)}toDataURL(e,t){return this[nh].displayCanvas(this[eh]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,i=e?e.qualityArgument:void 0,s=e?e.idealAspect:void 0,{width:a,height:n,idealAspect:r,aspect:o}=this[eh],{dpr:A,scaleFactor:l}=this[nh];let c=a*l*A,h=n*l*A,d=0,g=0;if(!0===s)if(r>o){const e=h;h=Math.round(c/r),g=(e-h)/2}else{const e=c;c=Math.round(h*r),d=(e-c)/2}Qc.width=c,Qc.height=h;try{return new Promise(async(e,s)=>{Qc.getContext("2d").drawImage(this[nh].displayCanvas(this[eh]),d,g,c,h,0,0,c,h),Qc.toBlob(t=>{if(!t)return s(new Error("Unable to retrieve canvas blob"));e(t)},t,i)})}finally{this[Nc]({width:a,height:n})}}registerEffectComposer(e){e.setRenderer(this[nh].threeRenderer),e.setMainCamera(this[eh].getCamera()),e.setMainScene(this[eh]),this[eh].effectRenderer=e}unregisterEffectComposer(){this[eh].effectRenderer=null}registerRenderer(e){this[eh].externalRenderer=e}unregisterRenderer(){this[eh].externalRenderer=null}get[jc](){return this[zc]}get[zc](){return null==this.alt||"null"===this.alt?this[Rc]:this.alt}[oh](){return this[kc]}[Ah](){return this.loaded&&this[qc]}[lh](){const e=Array.from(this.querySelectorAll("extra-model"));return!!(this.src||e.length>0)&&this[qc]}[Nc]({width:e,height:t}){0!==e&&0!==t&&(this[Xc].style.width=`${e}px`,this[Xc].style.height=`${t}px`,this[ah]({width:e,height:t}))}[ih](e,t){var i;null===(i=this[eh].effectRenderer)||void 0===i||i.beforeRender(e,t)}[Yc](){this[kc]||(this[kc]=!0,this[Jc]=performance.now())}[th](){this[eh].queueRender()}[sh](){}[Vc](e){this[Lc]=e;const t=this.getRootNode();null!=t&&t.activeElement===this&&this[Kc].textContent!=e&&(this[Kc].textContent=e)}[(wc=Pc,xc=_c,ah)](e){this[eh].setSize(e.width,e.height)}async[(vc=Fc,Wc)](){const e=this[eh],t=Array.from(this.querySelectorAll("extra-model")).map(e=>e.src).filter(e=>null!=e),i=t.join(",")===(e.extraUrls||[]).join(",");if(this.loaded||!this[lh]()||this.src===e.url&&i)return;const s=this.src,a=s||t[0]||null;this.generateSchema&&e.updateSchema(a),this[Vc]("Loading"),e.stopAnimation();const n=this[rh].beginActivity("model-load");try{const i=e.setSource(s,t,e=>n(.95*De(e,0,1))),r=this[_e]();await Promise.all([i,r]);Array.from(this.querySelectorAll("extra-model")).forEach((e,t)=>{const i=this.src?t+1:t;this[eh].updateModelTransforms(i,e.offset,e.orientation,e.scale)}),this[Yc](),this[sh](),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("before-render"))}),await new Promise(e=>{const t=setTimeout(()=>{console.warn("rAF timed out in updateSource"),e()},500);requestAnimationFrame(()=>{requestAnimationFrame(()=>{clearTimeout(t),e()})})}),this.dispatchEvent(new CustomEvent("load",{detail:{url:a}}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{n(1)}}}Sc([de({type:String})],dh.prototype,"alt",void 0),Sc([de({type:String})],dh.prototype,"src",void 0),Sc([de({type:Boolean,attribute:"with-credentials"})],dh.prototype,"withCredentials",void 0),Sc([de({type:Boolean,attribute:"generate-schema"})],dh.prototype,"generateSchema",void 0);
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var gh=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const ph=Symbol("changeAnimation"),uh=Symbol("appendAnimation"),mh=Symbol("detachAnimation"),bh=Symbol("paused"),fh=Symbol("currentAnimationOptions"),Ih={repetitions:1/0,pingpong:!1},Ch={pingpong:!1,repetitions:null,weight:1,timeScale:1,fade:!1,warp:!1,relativeWarp:!0,time:null},Eh={fade:!0},yh=Symbol("hotspotMap"),Bh=Symbol("mutationCallback"),wh=Symbol("observer"),xh=Symbol("addHotspot"),vh=Symbol("removeHotspot");
/*!
fflate - fast JavaScript compression/decompression
<https://101arrowz.github.io/fflate>
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
version 0.8.2
*/
var Sh=Uint8Array,Qh=Uint16Array,Mh=Int32Array,Rh=new Sh([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,0,0,0]),Th=new Sh([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,0,0]),Dh=new Sh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fh=function(e,t){for(var i=new Qh(31),s=0;s<31;++s)i[s]=t+=1<<e[s-1];var a=new Mh(i[30]);for(s=1;s<30;++s)for(var n=i[s];n<i[s+1];++n)a[n]=n-i[s]<<5|s;return{b:i,r:a}},kh=Fh(Rh,2),Lh=kh.b,Ph=kh.r;Lh[28]=258,Ph[258]=28;for(var _h=Fh(Th,0).r,Uh=new Qh(32768),Gh=0;Gh<32768;++Gh){var Nh=(43690&Gh)>>1|(21845&Gh)<<1;Nh=(61680&(Nh=(52428&Nh)>>2|(13107&Nh)<<2))>>4|(3855&Nh)<<4,Uh[Gh]=((65280&Nh)>>8|(255&Nh)<<8)>>1}var Oh=function(e,t,i){for(var s=e.length,a=0,n=new Qh(t);a<s;++a)e[a]&&++n[e[a]-1];var r,o=new Qh(t);for(a=1;a<t;++a)o[a]=o[a-1]+n[a-1]<<1;if(i){r=new Qh(1<<t);var A=15-t;for(a=0;a<s;++a)if(e[a])for(var l=a<<4|e[a],c=t-e[a],h=o[e[a]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)r[Uh[h]>>A]=l}else for(r=new Qh(s),a=0;a<s;++a)e[a]&&(r[a]=Uh[o[e[a]-1]++]>>15-e[a]);return r},qh=new Sh(288);for(Gh=0;Gh<144;++Gh)qh[Gh]=8;for(Gh=144;Gh<256;++Gh)qh[Gh]=9;for(Gh=256;Gh<280;++Gh)qh[Gh]=7;for(Gh=280;Gh<288;++Gh)qh[Gh]=8;var Hh=new Sh(32);for(Gh=0;Gh<32;++Gh)Hh[Gh]=5;var jh=Oh(qh,9,0),zh=Oh(Hh,5,0),Kh=function(e){return(e+7)/8|0},Vh=function(e,t,i){return(null==i||i>e.length)&&(i=e.length),new Sh(e.subarray(t,i))},Jh=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Wh=function(e,t,i){var s=new Error(t||Jh[e]);if(s.code=e,Error.captureStackTrace&&Error.captureStackTrace(s,Wh),!i)throw s;return s},Yh=function(e,t,i){i<<=7&t;var s=t/8|0;e[s]|=i,e[s+1]|=i>>8},Xh=function(e,t,i){i<<=7&t;var s=t/8|0;e[s]|=i,e[s+1]|=i>>8,e[s+2]|=i>>16},$h=function(e,t){for(var i=[],s=0;s<e.length;++s)e[s]&&i.push({s:s,f:e[s]});var a=i.length,n=i.slice();if(!a)return{t:nd,l:0};if(1==a){var r=new Sh(i[0].s+1);return r[i[0].s]=1,{t:r,l:1}}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var o=i[0],A=i[1],l=0,c=1,h=2;for(i[0]={s:-1,f:o.f+A.f,l:o,r:A};c!=a-1;)o=i[i[l].f<i[h].f?l++:h++],A=i[l!=c&&i[l].f<i[h].f?l++:h++],i[c++]={s:-1,f:o.f+A.f,l:o,r:A};var d=n[0].s;for(s=1;s<a;++s)n[s].s>d&&(d=n[s].s);var g=new Qh(d+1),p=Zh(i[c-1],g,0);if(p>t){s=0;var u=0,m=p-t,b=1<<m;for(n.sort(function(e,t){return g[t.s]-g[e.s]||e.f-t.f});s<a;++s){var f=n[s].s;if(!(g[f]>t))break;u+=b-(1<<p-g[f]),g[f]=t}for(u>>=m;u>0;){var I=n[s].s;g[I]<t?u-=1<<t-g[I]++-1:++s}for(;s>=0&&u;--s){var C=n[s].s;g[C]==t&&(--g[C],++u)}p=t}return{t:new Sh(g),l:p}},Zh=function(e,t,i){return-1==e.s?Math.max(Zh(e.l,t,i+1),Zh(e.r,t,i+1)):t[e.s]=i},ed=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new Qh(++t),s=0,a=e[0],n=1,r=function(e){i[s++]=e},o=1;o<=t;++o)if(e[o]==a&&o!=t)++n;else{if(!a&&n>2){for(;n>138;n-=138)r(32754);n>2&&(r(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(r(a),--n;n>6;n-=6)r(8304);n>2&&(r(n-3<<5|8208),n=0)}for(;n--;)r(a);n=1,a=e[o]}return{c:i.subarray(0,s),n:t}},td=function(e,t){for(var i=0,s=0;s<t.length;++s)i+=e[s]*t[s];return i},id=function(e,t,i){var s=i.length,a=Kh(t+2);e[a]=255&s,e[a+1]=s>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var n=0;n<s;++n)e[a+n+4]=i[n];return 8*(a+4+s)},sd=function(e,t,i,s,a,n,r,o,A,l,c){Yh(t,c++,i),++a[256];for(var h=$h(a,15),d=h.t,g=h.l,p=$h(n,15),u=p.t,m=p.l,b=ed(d),f=b.c,I=b.n,C=ed(u),E=C.c,y=C.n,B=new Qh(19),w=0;w<f.length;++w)++B[31&f[w]];for(w=0;w<E.length;++w)++B[31&E[w]];for(var x=$h(B,7),v=x.t,S=x.l,Q=19;Q>4&&!v[Dh[Q-1]];--Q);var M,R,T,D,F=l+5<<3,k=td(a,qh)+td(n,Hh)+r,L=td(a,d)+td(n,u)+r+14+3*Q+td(B,v)+2*B[16]+3*B[17]+7*B[18];if(A>=0&&F<=k&&F<=L)return id(t,c,e.subarray(A,A+l));if(Yh(t,c,1+(L<k)),c+=2,L<k){M=Oh(d,g,0),R=d,T=Oh(u,m,0),D=u;var P=Oh(v,S,0);Yh(t,c,I-257),Yh(t,c+5,y-1),Yh(t,c+10,Q-4),c+=14;for(w=0;w<Q;++w)Yh(t,c+3*w,v[Dh[w]]);c+=3*Q;for(var _=[f,E],U=0;U<2;++U){var G=_[U];for(w=0;w<G.length;++w){var N=31&G[w];Yh(t,c,P[N]),c+=v[N],N>15&&(Yh(t,c,G[w]>>5&127),c+=G[w]>>12)}}}else M=jh,R=qh,T=zh,D=Hh;for(w=0;w<o;++w){var O=s[w];if(O>255){Xh(t,c,M[(N=O>>18&31)+257]),c+=R[N+257],N>7&&(Yh(t,c,O>>23&31),c+=Rh[N]);var q=31&O;Xh(t,c,T[q]),c+=D[q],q>3&&(Xh(t,c,O>>5&8191),c+=Th[q])}else Xh(t,c,M[O]),c+=R[O]}return Xh(t,c,M[256]),c+R[256]},ad=new Mh([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),nd=new Sh(0),rd=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var i=t,s=9;--s;)i=(1&i&&-306674912)^i>>>1;e[t]=i}return e}(),od=function(){var e=-1;return{p:function(t){for(var i=e,s=0;s<t.length;++s)i=rd[255&i^t[s]]^i>>>8;e=i},d:function(){return~e}}},Ad=function(e,t,i,s,a){if(!a&&(a={l:1},t.dictionary)){var n=t.dictionary.subarray(-32768),r=new Sh(n.length+e.length);r.set(n),r.set(e,n.length),e=r,a.w=n.length}return function(e,t,i,s,a,n){var r=n.z||e.length,o=new Sh(s+r+5*(1+Math.ceil(r/7e3))+a),A=o.subarray(s,o.length-a),l=n.l,c=7&(n.r||0);if(t){c&&(A[0]=n.r>>3);for(var h=ad[t-1],d=h>>13,g=8191&h,p=(1<<i)-1,u=n.p||new Qh(32768),m=n.h||new Qh(p+1),b=Math.ceil(i/3),f=2*b,I=function(t){return(e[t]^e[t+1]<<b^e[t+2]<<f)&p},C=new Mh(25e3),E=new Qh(288),y=new Qh(32),B=0,w=0,x=n.i||0,v=0,S=n.w||0,Q=0;x+2<r;++x){var M=I(x),R=32767&x,T=m[M];if(u[R]=T,m[M]=R,S<=x){var D=r-x;if((B>7e3||v>24576)&&(D>423||!l)){c=sd(e,A,0,C,E,y,w,v,Q,x-Q,c),v=B=w=0,Q=x;for(var F=0;F<286;++F)E[F]=0;for(F=0;F<30;++F)y[F]=0}var k=2,L=0,P=g,_=R-T&32767;if(D>2&&M==I(x-_))for(var U=Math.min(d,D)-1,G=Math.min(32767,x),N=Math.min(258,D);_<=G&&--P&&R!=T;){if(e[x+k]==e[x+k-_]){for(var O=0;O<N&&e[x+O]==e[x+O-_];++O);if(O>k){if(k=O,L=_,O>U)break;var q=Math.min(_,O-2),H=0;for(F=0;F<q;++F){var j=x-_+F&32767,z=j-u[j]&32767;z>H&&(H=z,T=j)}}}_+=(R=T)-(T=u[R])&32767}if(L){C[v++]=268435456|Ph[k]<<18|_h[L];var K=31&Ph[k],V=31&_h[L];w+=Rh[K]+Th[V],++E[257+K],++y[V],S=x+k,++B}else C[v++]=e[x],++E[e[x]]}}for(x=Math.max(x,S);x<r;++x)C[v++]=e[x],++E[e[x]];c=sd(e,A,l,C,E,y,w,v,Q,x-Q,c),l||(n.r=7&c|A[c/8|0]<<3,c-=7,n.h=m,n.p=u,n.i=x,n.w=S)}else{for(x=n.w||0;x<r+l;x+=65535){var J=x+65535;J>=r&&(A[c/8|0]=l,J=r),c=id(A,c+1,e.subarray(x,J))}n.i=r}return Vh(o,0,s+Kh(c)+a)}(e,null==t.level?6:t.level,null==t.mem?a.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,i,s,a)},ld=function(e,t){var i={};for(var s in e)i[s]=e[s];for(var s in t)i[s]=t[s];return i},cd=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function hd(e,t){return Ad(e,t||{},0,0)}var dd=function(e,t,i,s){for(var a in e){var n=e[a],r=t+a,o=s;Array.isArray(n)&&(o=ld(s,n[1]),n=n[0]),n instanceof Sh?i[r]=[n,o]:(i[r+="/"]=[new Sh(0),o],dd(n,r,i,s))}},gd="undefined"!=typeof TextEncoder&&new TextEncoder,pd="undefined"!=typeof TextDecoder&&new TextDecoder;try{pd.decode(nd,{stream:!0})}catch(v){}function ud(e,t){if(gd)return gd.encode(e);for(var i=e.length,s=new Sh(e.length+(e.length>>1)),a=0,n=function(e){s[a++]=e},r=0;r<i;++r){if(a+5>s.length){var o=new Sh(a+8+(i-r<<1));o.set(s),s=o}var A=e.charCodeAt(r);A<128||t?n(A):A<2048?(n(192|A>>6),n(128|63&A)):A>55295&&A<57344?(n(240|(A=65536+(1047552&A)|1023&e.charCodeAt(++r))>>18),n(128|A>>12&63),n(128|A>>6&63),n(128|63&A)):(n(224|A>>12),n(128|A>>6&63),n(128|63&A))}return Vh(s,0,a)}var md=function(e){var t=0;if(e)for(var i in e){var s=e[i].length;s>65535&&Wh(9),t+=s+4}return t},bd=function(e,t,i,s,a,n,r,o){var A=s.length,l=i.extra,c=o&&o.length,h=md(l);cd(e,t,null!=r?33639248:67324752),t+=4,null!=r&&(e[t++]=20,e[t++]=i.os),e[t]=20,t+=2,e[t++]=i.flag<<1|(n<0&&8),e[t++]=a&&8,e[t++]=255&i.compression,e[t++]=i.compression>>8;var d=new Date(null==i.mtime?Date.now():i.mtime),g=d.getFullYear()-1980;if((g<0||g>119)&&Wh(10),cd(e,t,g<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),t+=4,-1!=n&&(cd(e,t,i.crc),cd(e,t+4,n<0?-n-2:n),cd(e,t+8,i.size)),cd(e,t+12,A),cd(e,t+14,h),t+=16,null!=r&&(cd(e,t,c),cd(e,t+6,i.attrs),cd(e,t+10,r),t+=14),e.set(s,t),t+=A,h)for(var p in l){var u=l[p],m=u.length;cd(e,t,+p),cd(e,t+2,m),e.set(u,t+4),t+=4+m}return c&&(e.set(o,t),t+=c),t};function fd(e,t){t||(t={});var i={},s=[];dd(e,"",i,t);var a=0,n=0;for(var r in i){var o=i[r],A=o[0],l=o[1],c=0==l.level?0:8,h=(B=ud(r)).length,d=l.comment,g=d&&ud(d),p=g&&g.length,u=md(l.extra);h>65535&&Wh(11);var m=c?hd(A,l):A,b=m.length,f=od();f.p(A),s.push(ld(l,{size:A.length,crc:f.d(),c:m,f:B,m:g,u:h!=r.length||g&&d.length!=p,o:a,compression:c})),a+=30+h+u+b,n+=76+2*(h+u)+(p||0)+b}for(var I=new Sh(n+22),C=a,E=n-a,y=0;y<s.length;++y){var B=s[y];bd(I,B.o,B,B.f,B.u,B.c.length);var w=30+B.f.length+md(B.extra);I.set(B.c,B.o+w),bd(I,a,B,B.f,B.u,B.c.length,B.o,B.m),a+=16+w+(B.m?B.m.length:0)}return function(e,t,i,s,a){cd(e,t,101010256),cd(e,t+8,i),cd(e,t+10,i),cd(e,t+12,s),cd(e,t+16,a)}(I,a,s.length,E,C),I}class Id{constructor(e,t="",i=[],s=[]){this.name=e,this.type=t,this.metadata=i,this.properties=s,this.children=[]}addMetadata(e,t){this.metadata.push({key:e,value:t})}addProperty(e,t=[]){this.properties.push({property:e,metadata:t})}addChild(e){this.children.push(e)}toString(e=0){const t="\t".repeat(e),i=this.metadata.map(e=>{const i=e.key,s=e.value;if(Array.isArray(s)){const e=[];return e.push(`${i} = {`),s.forEach(i=>{e.push(`${t}\t\t${i}`)}),e.push(`${t}\t}`),e.join("\n")}return`${i} = ${s}`}),s=i.length?` (\n${i.map(e=>`${t}\t${e}`).join("\n")}\n${t})`:"",a=this.properties.map(e=>{const i=e.property,s=e.metadata.length?` (\n${e.metadata.map(e=>`${t}\t\t${e}`).join("\n")}\n${t}\t)`:"";return`${t}\t${i}${s}`}),n=this.children.map(t=>t.toString(e+1)),r=[];if(a.length>0&&r.push(...a),n.length>0){a.length>0&&r.push("");for(let e=0;e<n.length;e++)r.push(n[e]),e<n.length-1&&r.push("")}const o=r.join("\n"),A=this.type?this.type+" ":"";return`${t}def ${A}"${this.name}"${s}\n${t}{\n${o}\n${t}}`}}class Cd{constructor(){this.textureUtils=null}setTextureUtils(e){this.textureUtils=e}parse(e,t,i,s){this.parseAsync(e,s).then(t).catch(i)}async parseAsync(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},includeAnchoringProperties:!0,onlyVisible:!0,quickLookCompatible:!1,maxTextureSize:1024},t);const i=new Set,s={},a="model.usda";s[a]=null;const n=new Id("Root","Xform"),r=new Id("Scenes","Scope");r.addMetadata("kind",'"sceneLibrary"'),n.addChild(r);const o="Scene",A=new Id(o,"Xform");let l;A.addMetadata("customData",["bool preliminary_collidesWithEnvironment = 0",`string sceneName = "${o}"`]),A.addMetadata("sceneName",`"${o}"`),t.includeAnchoringProperties&&(A.addProperty(`token preliminary:anchoring:type = "${t.ar.anchoring.type}"`),A.addProperty(`token preliminary:planeAnchoring:alignment = "${t.ar.planeAnchoring.alignment}"`)),r.addChild(A);const c={},h={};xd(e,A,c,i,s,t);const d=function(e,t,i=!1){const s=new Id("Materials");for(const a in e){const n=e[a];s.addChild(Fd(n,t,i))}return s}(c,h,t.quickLookCompatible);l=wd()+"\n"+n.toString()+"\n\n"+d.toString(),s[a]=ud(l),l=null;for(const e in h){let i=h[e];if(!0===i.isCompressedTexture){if(null===this.textureUtils)throw new Error("THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.");i=await this.textureUtils.decompress(i)}const a=yd(i.image,i.flipY,t.maxTextureSize),n=await new Promise(e=>a.toBlob(e,"image/png",1));s[`textures/Texture_${e}.png`]=new Uint8Array(await n.arrayBuffer())}let g=0;for(const e in s){const t=s[e];g+=34+e.length;const i=63&g;if(4!==i){const a=new Uint8Array(64-i);s[e]=[t,{extra:{12345:a}}]}g=t.length}return fd(s,{level:0})}}function Ed(e,t){let i=e.name;return i=i.replace(/[^A-Za-z0-9_]/g,""),/^[0-9]/.test(i)&&(i="_"+i),""===i&&(i=e.isCamera?"Camera":"Object"),t.has(i)&&(i=i+"_"+e.id),t.add(i),i}function yd(e,t,i){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const s=i/Math.max(e.width,e.height),a=document.createElement("canvas");a.width=e.width*Math.min(1,s),a.height=e.height*Math.min(1,s);const n=a.getContext("2d");return!0===t&&(n.translate(0,a.height),n.scale(1,-1)),n.drawImage(e,0,0,a.width,a.height),a}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const Bd=7;function wd(){return'#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = "Three.js USDZExporter"\n\t}\n\tdefaultPrim = "Root"\n\tmetersPerUnit = 1\n\tupAxis = "Y"\n)\n'}function xd(e,t,i,s,a,n){for(let r=0,o=e.children.length;r<o;r++){const o=e.children[r];if(!1===o.visible&&!0===n.onlyVisible)continue;let A;if(o.isMesh){const e=o.geometry,t=o.material;if(t.isMeshStandardMaterial){const n="geometries/Geometry_"+e.id+".usda";if(!(n in a)){const t=Rd(e);a[n]=ud(wd()+"\n"+t.toString())}t.uuid in i||(i[t.uuid]=t),A=Sd(o,e,i[t.uuid],s)}else console.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",o)}else A=o.isCamera?Pd(o,s):vd(o,s);A&&(t.addChild(A),xd(o,A,i,s,a,n))}}function vd(e,t){const i=Ed(e,t);e.matrix.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",e);const s=new Id(i,"Xform");if(null!==e.pivot){const t=e.position,i=e.quaternion,a=e.scale,n=e.pivot;s.addProperty(`float3 xformOp:translate = (${t.x.toPrecision(Bd)}, ${t.y.toPrecision(Bd)}, ${t.z.toPrecision(Bd)})`),s.addProperty(`float3 xformOp:translate:pivot = (${n.x.toPrecision(Bd)}, ${n.y.toPrecision(Bd)}, ${n.z.toPrecision(Bd)})`),s.addProperty(`quatf xformOp:orient = (${i.w.toPrecision(Bd)}, ${i.x.toPrecision(Bd)}, ${i.y.toPrecision(Bd)}, ${i.z.toPrecision(Bd)})`),s.addProperty(`float3 xformOp:scale = (${a.x.toPrecision(Bd)}, ${a.y.toPrecision(Bd)}, ${a.z.toPrecision(Bd)})`),s.addProperty('uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:translate:pivot", "xformOp:orient", "xformOp:scale", "!invert!xformOp:translate:pivot"]')}else{const t=Qd(e.matrix);s.addProperty(`matrix4d xformOp:transform = ${t}`),s.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]')}return s}function Sd(e,t,i,s){const a=vd(e,s);return a.addMetadata("prepend references",`@./geometries/Geometry_${t.id}.usda@</Geometry>`),a.addMetadata("prepend apiSchemas",'["MaterialBindingAPI"]'),a.addProperty(`rel material:binding = </Materials/Material_${i.id}>`),a}function Qd(e){const t=e.elements;return`( ${Md(t,0)}, ${Md(t,4)}, ${Md(t,8)}, ${Md(t,12)} )`}function Md(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function Rd(e){const t=new Id("Geometry"),i=function(e){const t="Geometry",i=e.attributes,s=i.position.count,a=new Id(t,"Mesh");a.addProperty(`int[] faceVertexCounts = [${function(e){const t=null!==e.index?e.index.count:e.attributes.position.count;return Array(t/3).fill(3).join(", ")}(e)}]`),a.addProperty(`int[] faceVertexIndices = [${function(e){const t=e.index,i=[];if(null!==t)for(let e=0;e<t.count;e++)i.push(t.getX(e));else{const t=e.attributes.position.count;for(let e=0;e<t;e++)i.push(e)}return i.join(", ")}(e)}]`),a.addProperty(`normal3f[] normals = [${Td(i.normal,s)}]`,['interpolation = "vertex"']),a.addProperty(`point3f[] points = [${Td(i.position,s)}]`);for(let e=0;e<4;e++){const t=e>0?e:"",s=i["uv"+t];void 0!==s&&a.addProperty(`texCoord2f[] primvars:st${t} = [${Dd(s)}]`,['interpolation = "vertex"'])}const n=i.color;void 0!==n&&a.addProperty(`color3f[] primvars:displayColor = [${Td(n,s)}]`,['interpolation = "vertex"']);return a.addProperty('uniform token subdivisionScheme = "none"'),a}(e);return t.addChild(i),t}function Td(e,t){if(void 0===e)return console.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");const i=[];for(let t=0;t<e.count;t++){const s=e.getX(t),a=e.getY(t),n=e.getZ(t);i.push(`(${s.toPrecision(Bd)}, ${a.toPrecision(Bd)}, ${n.toPrecision(Bd)})`)}return i.join(", ")}function Dd(e){const t=[];for(let i=0;i<e.count;i++){const s=e.getX(i),a=e.getY(i);t.push(`(${s.toPrecision(Bd)}, ${1-a.toPrecision(Bd)})`)}return t.join(", ")}function Fd(e,i,s=!1){const a=new Id(`Material_${e.id}`,"Material");function n(a,n,r){const o=a.source.id+"_"+a.flipY;i[o]=a;const A=a.channel>0?"st"+a.channel:"st",l={1e3:"repeat",1001:"clamp",1002:"mirror"},c=a.repeat.clone(),h=a.offset.clone(),d=a.rotation,g=Math.sin(d),p=Math.cos(d);h.y=1-h.y-c.y,s?(h.x=h.x/c.x,h.y=h.y/c.y,h.x+=g/c.x,h.y+=p-1):(h.x+=g*c.x,h.y+=(1-p)*c.y);const u=new Id(`PrimvarReader_${n}`,"Shader");u.addProperty('uniform token info:id = "UsdPrimvarReader_float2"'),u.addProperty("float2 inputs:fallback = (0.0, 0.0)"),u.addProperty(`string inputs:varname = "${A}"`),u.addProperty("float2 outputs:result");const m=new Id(`Transform2d_${n}`,"Shader");m.addProperty('uniform token info:id = "UsdTransform2d"'),m.addProperty(`float2 inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${n}.outputs:result>`),m.addProperty(`float inputs:rotation = ${(d*(180/Math.PI)).toFixed(Bd)}`),m.addProperty(`float2 inputs:scale = ${Ld(c)}`),m.addProperty(`float2 inputs:translation = ${Ld(h)}`),m.addProperty("float2 outputs:result");const b=new Id(`Texture_${a.id}_${n}`,"Shader");return b.addProperty('uniform token info:id = "UsdUVTexture"'),b.addProperty(`asset inputs:file = @textures/Texture_${o}.png@`),b.addProperty(`float2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${n}.outputs:result>`),void 0!==r&&b.addProperty(`float4 inputs:scale = ${function(e){return`(${e.r}, ${e.g}, ${e.b}, 1.0)`}(r)}`),"normal"===n&&(b.addProperty("float4 inputs:scale = (2, 2, 2, 1)"),b.addProperty("float4 inputs:bias = (-1, -1, -1, 0)")),b.addProperty(`token inputs:sourceColorSpace = "${a.colorSpace===t.NoColorSpace?"raw":"sRGB"}"`),b.addProperty(`token inputs:wrapS = "${l[a.wrapS]}"`),b.addProperty(`token inputs:wrapT = "${l[a.wrapT]}"`),b.addProperty("float outputs:r"),b.addProperty("float outputs:g"),b.addProperty("float outputs:b"),b.addProperty("float3 outputs:rgb"),(e.transparent||e.alphaTest>0)&&b.addProperty("float outputs:a"),[u,m,b]}e.side===t.DoubleSide&&console.warn("THREE.USDZExporter: USDZ does not support double sided materials",e);const r=new Id("PreviewSurface","Shader");if(r.addProperty('uniform token info:id = "UsdPreviewSurface"'),null!==e.map){r.addProperty(`color3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?r.addProperty(`float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(r.addProperty(`float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),r.addProperty(`float inputs:opacityThreshold = ${e.alphaTest}`));n(e.map,"diffuse",e.color).forEach(e=>a.addChild(e))}else r.addProperty(`color3f inputs:diffuseColor = ${kd(e.color)}`);if(null!==e.emissiveMap){r.addProperty(`color3f inputs:emissiveColor.connect = </Materials/Material_${e.id}/Texture_${e.emissiveMap.id}_emissive.outputs:rgb>`);const i=new t.Color(e.emissive.r*e.emissiveIntensity,e.emissive.g*e.emissiveIntensity,e.emissive.b*e.emissiveIntensity);n(e.emissiveMap,"emissive",i).forEach(e=>a.addChild(e))}else e.emissive.getHex()>0&&r.addProperty(`color3f inputs:emissiveColor = ${kd(e.emissive)}`);if(null!==e.normalMap){r.addProperty(`normal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`);n(e.normalMap,"normal").forEach(e=>a.addChild(e))}if(null!==e.aoMap){r.addProperty(`float inputs:occlusion.connect = </Materials/Material_${e.id}/Texture_${e.aoMap.id}_occlusion.outputs:r>`);const i=new t.Color(e.aoMapIntensity,e.aoMapIntensity,e.aoMapIntensity);n(e.aoMap,"occlusion",i).forEach(e=>a.addChild(e))}if(null!==e.roughnessMap){r.addProperty(`float inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`);const i=new t.Color(e.roughness,e.roughness,e.roughness);n(e.roughnessMap,"roughness",i).forEach(e=>a.addChild(e))}else r.addProperty(`float inputs:roughness = ${e.roughness}`);if(null!==e.metalnessMap){r.addProperty(`float inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`);const i=new t.Color(e.metalness,e.metalness,e.metalness);n(e.metalnessMap,"metallic",i).forEach(e=>a.addChild(e))}else r.addProperty(`float inputs:metallic = ${e.metalness}`);if(null!==e.alphaMap){r.addProperty(`float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),r.addProperty("float inputs:opacityThreshold = 0.0001");n(e.alphaMap,"opacity").forEach(e=>a.addChild(e))}else r.addProperty(`float inputs:opacity = ${e.opacity}`);if(e.isMeshPhysicalMaterial){if(null!==e.clearcoatMap){r.addProperty(`float inputs:clearcoat.connect = </Materials/Material_${e.id}/Texture_${e.clearcoatMap.id}_clearcoat.outputs:r>`);const i=new t.Color(e.clearcoat,e.clearcoat,e.clearcoat);n(e.clearcoatMap,"clearcoat",i).forEach(e=>a.addChild(e))}else r.addProperty(`float inputs:clearcoat = ${e.clearcoat}`);if(null!==e.clearcoatRoughnessMap){r.addProperty(`float inputs:clearcoatRoughness.connect = </Materials/Material_${e.id}/Texture_${e.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`);const i=new t.Color(e.clearcoatRoughness,e.clearcoatRoughness,e.clearcoatRoughness);n(e.clearcoatRoughnessMap,"clearcoatRoughness",i).forEach(e=>a.addChild(e))}else r.addProperty(`float inputs:clearcoatRoughness = ${e.clearcoatRoughness}`);r.addProperty(`float inputs:ior = ${e.ior}`)}return r.addProperty("int inputs:useSpecularWorkflow = 0"),r.addProperty("token outputs:surface"),a.addChild(r),a.addProperty(`token outputs:surface.connect = </Materials/Material_${e.id}/PreviewSurface.outputs:surface>`),a}function kd(e){return`(${e.r}, ${e.g}, ${e.b})`}function Ld(e){return`(${e.x}, ${e.y})`}function Pd(e,t){const i=Ed(e,t),s=Qd(e.matrix);e.matrix.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",e);const a=new Id(i,"Camera");a.addProperty(`matrix4d xformOp:transform = ${s}`),a.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]');const n=e.isOrthographicCamera?"orthographic":"perspective";a.addProperty(`token projection = "${n}"`);const r=`(${e.near.toPrecision(Bd)}, ${e.far.toPrecision(Bd)})`;let o,A;if(a.addProperty(`float2 clippingRange = ${r}`),o=e.isOrthographicCamera?(10*(Math.abs(e.left)+Math.abs(e.right))).toPrecision(Bd):e.getFilmWidth().toPrecision(Bd),a.addProperty(`float horizontalAperture = ${o}`),A=e.isOrthographicCamera?(10*(Math.abs(e.top)+Math.abs(e.bottom))).toPrecision(Bd):e.getFilmHeight().toPrecision(Bd),a.addProperty(`float verticalAperture = ${A}`),e.isPerspectiveCamera){const t=e.getFocalLength().toPrecision(Bd);a.addProperty(`float focalLength = ${t}`);const i=e.focus.toPrecision(Bd);a.addProperty(`float focusDistance = ${i}`)}return a}
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var _d=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let Ud=!1,Gd=!1;const Nd="#model-viewer-no-ar-fallback",Od=(qd=["quick-look","scene-viewer","webxr","none"],e=>{try{const t=Ga(e),i=(t.length?t[0].terms:[]).filter(e=>e&&"ident"===e.type).map(e=>e.value).filter(e=>qd.indexOf(e)>-1);return new Set(i)}catch(e){}return new Set});var qd;const Hd="quick-look",jd="scene-viewer",zd="webxr",Kd="none",Vd=Symbol("arButtonContainer"),Jd=Symbol("enterARWithWebXR"),Wd=Symbol("openSceneViewer"),Yd=Symbol("openIOSARQuickLook"),Xd=Symbol("canActivateAR"),$d=Symbol("arMode"),Zd=Symbol("arModes"),eg=Symbol("arAnchor"),tg=Symbol("preload"),ig=Symbol("onARButtonContainerClick"),sg=Symbol("onARStatus"),ag=Symbol("onARTracking"),ng=Symbol("onARTap"),rg=Symbol("selectARMode"),og=Symbol("triggerLoad");
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Ag=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const lg="auto",cg="auto",hg="eager",dg=Symbol("defaultProgressBarElement"),gg=Symbol("posterContainerElement"),pg=Symbol("defaultPosterElement"),ug=Symbol("shouldDismissPoster"),mg=Symbol("hidePoster"),bg=Symbol("modelIsRevealed"),fg=Symbol("updateProgressBar"),Ig=Symbol("ariaLabelCallToAction"),Cg=Symbol("onProgress");
/* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Eg=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const yg=Math.PI/32,Bg={basis:[Ja(Ua(yg,"rad"))],keywords:{auto:[null]}},wg=Symbol("autoRotateStartTime"),xg=Symbol("radiansPerSecond"),vg=Symbol("syncRotationRate"),Sg=Symbol("onCameraChange"),Qg=(e=>{var i,s,a;class n extends e{constructor(){super(...arguments),this[i]=new Map,this[s]=e=>{e.forEach(e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach(e=>{this[xh](e)}),e.removedNodes.forEach(e=>{this[vh](e)}),this[th]())})},this[a]=new MutationObserver(this[Bh])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[xh](this.children[e]);const{ShadyDOM:e}=self;null==e?this[wh].observe(this,{childList:!0}):this[wh]=e.observeChildren(this,this[Bh])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:e}=self;null==e?this[wh].disconnect():e.unobserveChildren(this[wh])}[(i=yh,s=Bh,a=wh,sh)](){super[sh]();const e=this[eh];e.forHotspots(t=>{e.updateHotspotAttachment(t),e.updateSurfaceHotspot(t)})}[ih](e,t){super[ih](e,t);const i=this[eh],{annotationRenderer:s}=i,a=i.getCamera();i.shouldRender()&&(i.animateSurfaceHotspots(),i.updateHotspotsVisibility(a.position),s.domElement.style.display="",s.render(i,a))}updateHotspot(e){const t=this[yh].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,void 0!==e.modelIndex&&null!==e.modelIndex&&(t.modelIndex=e.modelIndex),this[eh].updateSurfaceHotspot(t),this[th]())}queryHotspot(e){const i=this[yh].get(e);if(null==i)return null;const s=ch(i.position),a=ch(i.normal),n=i.facingCamera,r=this[eh],o=r.getCamera(),A=new t.Vector3;A.setFromMatrixPosition(i.matrixWorld),A.project(o);const l=r.width/2,c=r.height/2;A.x=A.x*l+l,A.y=-A.y*c+c;const h=ch(new t.Vector3(A.x,A.y,A.z));return Number.isFinite(h.x)&&Number.isFinite(h.y)?{position:s,normal:a,canvasPosition:h,facingCamera:n}:null}positionAndNormalFromPoint(e,t){const i=this[eh],s=i.getNDC(e,t),a=i.positionAndNormalFromPoint(s);if(null==a)return null;const n=a.worldToModel,r=ch(a.position.applyMatrix4(n)),o=ch(a.normal.transformDirection(n));let A=null;return null!=a.uv&&(A=hh(a.uv)),{position:r,normal:o,uv:A,modelIndex:a.modelIndex}}surfaceFromPoint(e,t){const i=this[eh],s=i.getNDC(e,t);return i.surfaceFromPoint(s)}[xh](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[yh].get(e.slot);if(null!=t){t.increment();const i=e.dataset.visibilityAttribute;if(null!=i){const s=`data-${i}`;e.toggleAttribute(s,t.facingCamera)}e.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:t.facingCamera}}))}else t=new Zl({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface,modelIndex:null!=e.dataset.modelIndex?parseInt(e.dataset.modelIndex):null}),this[yh].set(e.slot,t),this[eh].addHotspot(t);this[eh].queueRender()}[vh](e){if(!(e instanceof HTMLElement))return;const t=this[yh].get(e.slot);t&&(t.decrement()&&(this[eh].removeHotspot(t),this[yh].delete(e.slot)),this[eh].queueRender())}}return n})((e=>{var i,s,a,n;class r extends e{constructor(){super(...arguments),this[i]=void 0,this[s]=[],this[a]=null,this[n]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[ql]}get extraModels(){return this[Hl]}get availableVariants(){return this.model?this.model[kl]():[]}get originalGltfJson(){return this[Ol]}[(i=ql,s=Hl,a=Nl,n=Ol,jl)](){return()=>{this[th]()}}[zl](e){return e.colorSpace=t.SRGBColorSpace,e.wrapS=t.RepeatWrapping,e.wrapT=t.RepeatWrapping,new DA(this[jl](),e)}async createTexture(e,t="image/png"){const{textureUtils:i}=this[nh],s=await i.loadImage(e,this.withCredentials,t),a="image/ktx2"===t?"image/png":t;return s.userData.mimeType=a,this[zl](s)}async createLottieTexture(e,t=1){const{textureUtils:i}=this[nh],s=await i.loadLottie(e,t,this.withCredentials);return this[zl](s)}createVideoTexture(e){const i=document.createElement("video");i.crossOrigin=this.withCredentials?"use-credentials":"anonymous",i.src=e,i.muted=!0,i.playsInline=!0,i.loop=!0,i.play();const s=new t.VideoTexture(i);return this[zl](s)}createCanvasTexture(){const e=document.createElement("canvas"),i=new t.CanvasTexture(e);return this[zl](i)}async updated(e){if(super.updated(e),e.has("variantName")){const e=this[rh].beginActivity("variant-update");e(.1);const t=this[ql],{variantName:i}=this;null!=t&&(await t[Ml](i),this[th](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;const e=this[eh];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[nh].arRenderer.onUpdateScene(),this[th]()}}[sh](){super[sh]();const{currentGLTFs:e}=this[eh],t=e.length>0?e[0]:null;if(null!=t){const{correlatedSceneGraph:e}=t;null!=e&&t!==this[Nl]&&(this[ql]=new Ul(e,this[jl]()),this[Ol]=JSON.parse(JSON.stringify(e.gltf))),"variants"in t.userData&&this.requestUpdate("variantName")}this[Hl]=[];const i=Array.from(this.querySelectorAll("extra-model"));for(let t=1;t<e.length;t++){const s=e[t];if(null!=s&&null!=s.correlatedSceneGraph){const e=new Ul(s.correlatedSceneGraph,this[jl]());this[Hl].push(e),i[t-1]&&(i[t-1].model=e)}}this[Nl]=t}async exportScene(e){const i=this[eh];return new Promise(async(s,a)=>{const n={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(n,e),n.animations=i.animations,n.truncateDrawRange=!0;const r=i.shadow;let o=!1;null!=r&&(o=r.visible,r.visible=!1),await this[ql][Ql]();const A=(new Ts).register(e=>new Ra(e));let l;if(A.setTextureUtils({decompress:(e,i)=>function(e,i=1/0,s=null){xa||(xa=new t.PlaneGeometry(2,2,1,1)),va||(va=new t.ShaderMaterial({uniforms:{blitTexture:new t.Uniform(e)},vertexShader:"\n\t\t\tvarying vec2 vUv;\n\t\t\tvoid main(){\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = vec4(position.xy * 1.0,0.,.999999);\n\t\t\t}",fragmentShader:"\n\t\t\tuniform sampler2D blitTexture; \n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main(){ \n\t\t\t\tgl_FragColor = vec4(vUv.xy, 0, 1);\n\t\t\t\t\n\t\t\t\t#ifdef IS_SRGB\n\t\t\t\tgl_FragColor = sRGBTransferOETF( texture2D( blitTexture, vUv) );\n\t\t\t\t#else\n\t\t\t\tgl_FragColor = texture2D( blitTexture, vUv);\n\t\t\t\t#endif\n\t\t\t}"})),va.uniforms.blitTexture.value=e,va.defines.IS_SRGB=e.colorSpace==t.SRGBColorSpace,va.needsUpdate=!0,Sa||(Sa=new t.Mesh(xa,va),Sa.frustumCulled=!1);const a=new t.PerspectiveCamera,n=new t.Scene;n.add(Sa),null===s&&(s=wa=new t.WebGLRenderer({antialias:!1}));const r=Math.min(e.image.width,i),o=Math.min(e.image.height,i);s.setSize(r,o),s.clear(),s.render(n,a);const A=document.createElement("canvas"),l=A.getContext("2d");A.width=r,A.height=o,l.drawImage(s.domElement,0,0,r,o);const c=new t.CanvasTexture(A);return c.minFilter=e.minFilter,c.magFilter=e.magFilter,c.wrapS=e.wrapS,c.wrapT=e.wrapT,c.colorSpace=e.colorSpace,c.name=e.name,wa&&(wa.forceContextLoss(),wa.dispose(),wa=null),c}(e,null!=i?i:1/0,void 0)}),i.models.length>1){l=new t.Object3D;for(const e of i.models)l.add(e)}else l=i.models[0];A.parse(l,e=>{if(i.models.length>1)for(const e of i.models)i.target.add(e);else i.target.add(i.models[0]);return s(new Blob([n.binary?e:JSON.stringify(e)],{type:n.binary?"application/octet-stream":"application/json"}))},()=>a("glTF export failed"),n),null!=r&&(r.visible=o)})}materialFromPoint(e,t){const i=this[eh],s=i.getNDC(e,t),a=i.hitFromPoint(s);if(null==a||null==a.face)return null;const n=this[ql];if(null!=n){const e=n[Rl](a);if(null!=e)return e}for(const e of this[Hl]){const t=e[Rl](a);if(null!=t)return t}return null}}return Gl([de({type:String,attribute:"variant-name"})],r.prototype,"variantName",void 0),Gl([de({type:String,attribute:"orientation"})],r.prototype,"orientation",void 0),Gl([de({type:String,attribute:"scale"})],r.prototype,"scale",void 0),r})((e=>{var t,i,s;class a extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[i]=0,this[s]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[wg]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[Sg]),this[wg]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[Sg]),this[wg]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[wg]=performance.now())}[(t=wg,i=xg,vg)](e){this[xg]=e[0]}[ih](e,t){if(super[ih](e,t),!this.autoRotate||!this[Ah]()||this[nh].isPresenting)return;const i=Math.min(t,e-this[wg]-this.autoRotateDelay);i>0&&(this[eh].yaw=this.turntableRotation+this[xg]*i*.001)}get turntableRotation(){return this[eh].yaw}resetTurntableRotation(e=0){this[eh].yaw=e}}return s=Sg,Eg([de({type:Boolean,attribute:"auto-rotate"})],a.prototype,"autoRotate",void 0),Eg([de({type:Number,attribute:"auto-rotate-delay"})],a.prototype,"autoRotateDelay",void 0),Eg([Ln({intrinsics:Bg,updateHandler:vg}),de({type:String,attribute:"rotation-per-second"})],a.prototype,"rotationPerSecond",void 0),a})((e=>{var i,s,a;class n extends e{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.toneMapping="auto",this.skyboxHeight="0",this[i]=null,this[s]=null,this[a]=null}updated(e){var i;if(super.updated(e),e.has("shadowIntensity")&&(this[eh].setShadowIntensity(.5*this.shadowIntensity),this[th]()),e.has("shadowSoftness")&&(this[eh].setShadowSoftness(this.shadowSoftness),this[th]()),e.has("exposure")&&(this[eh].exposure=this.exposure,this[th]()),e.has("toneMapping")){const e=new Map([["aces",t.ACESFilmicToneMapping],["agx",t.AgXToneMapping],["reinhard",t.ReinhardToneMapping],["cineon",t.CineonToneMapping],["linear",t.LinearToneMapping],["none",t.NoToneMapping]]);this[eh].toneMapping=null!==(i=e.get(this.toneMapping))&&void 0!==i?i:t.NeutralToneMapping,this[th]()}(e.has("environmentImage")||e.has("skyboxImage"))&&this[lh]()&&this[_e](),e.has("skyboxHeight")&&(this[eh].setGroundedSkybox(),this[th]())}hasBakedShadow(){return this[eh].bakedShadows.size>0}async[(i=Le,s=Pe,a=Ue,_e)](){const{skyboxImage:e,environmentImage:t}=this;null!=this[Ue]&&(this[Ue](),this[Ue]=null);const{textureUtils:i}=this[nh];if(null==i)return;const s=this[rh].beginActivity("environment-update");try{const{environmentMap:a,skybox:n}=await i.generateEnvironmentMapAndSkybox(Qe(e),t,e=>s(De(e,0,1)),this.withCredentials);this[Le]!==a&&(this[Le]=a,this.dispatchEvent(new CustomEvent("environment-change"))),this[Pe]=null!=n?n.name===a.name?a:n:null,this[eh].setEnvironmentAndSkybox(this[Le],this[Pe])}catch(e){if(e instanceof Error)throw this[eh].setEnvironmentAndSkybox(null,null),e}finally{s(1)}}}return ke([de({type:String,attribute:"environment-image"})],n.prototype,"environmentImage",void 0),ke([de({type:String,attribute:"skybox-image"})],n.prototype,"skyboxImage",void 0),ke([de({type:Number,attribute:"shadow-intensity"})],n.prototype,"shadowIntensity",void 0),ke([de({type:Number,attribute:"shadow-softness"})],n.prototype,"shadowSoftness",void 0),ke([de({type:Number})],n.prototype,"exposure",void 0),ke([de({type:String,attribute:"tone-mapping"})],n.prototype,"toneMapping",void 0),ke([de({type:String,attribute:"skybox-height"})],n.prototype,"skyboxHeight",void 0),n})((e=>{var i,s,a,n,r,o,A,l,c,h,d,g,p,u,m,b,f,I;class C extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=qn,this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPrompt=zn,this.interactionPromptStyle=Vn,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=Jn,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this.a11y=null,this[i]=this.shadowRoot.querySelector(".interaction-prompt"),this[s]=this.shadowRoot.querySelector("#prompt"),this[a]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[n]=this.shadowRoot.querySelector(".pan-target"),this[r]=0,this[o]=1/0,this[A]=!1,this[l]=!1,this[c]=Gr.AUTOMATIC,this[h]=new Nr(this[eh].camera,this[$c],this[eh]),this[d]=new t.Spherical,this[g]=!1,this[p]=!1,this[u]=!1,this[m]={},this[b]=()=>{const e=this[nr].changeSource;this[yr]=e,e===Gr.USER_INTERACTION&&(this[Ir]=!0,this[cr]())},this[f]=()=>{this[hr](),this[th]();const e=this[nr].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[I]=e=>{this[Xc].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[nr].inputSensitivity}set inputSensitivity(e){this[nr].inputSensitivity=e}getCameraOrbit(){const{theta:e,phi:t,radius:i}=this[Br];return{theta:e,phi:t,radius:i,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return ch(this[nh].isPresenting?this[nh].arRenderer.target:this[eh].getDynamicTarget())}getFieldOfView(){return this[nr].getFieldOfView()}getMinimumFieldOfView(){return this[nr].options.minimumFieldOfView}getMaximumFieldOfView(){return this[nr].options.maximumFieldOfView}getIdealAspect(){return this[eh].idealAspect}jumpCameraToGoal(){this[wr]=!0,this.requestUpdate(wr,!1)}resetInteractionPrompt(){this[Er]=0,this[Cr]=1/0,this[Ir]=!1,this[fr]=this.interactionPrompt===zn&&this.cameraControls}zoom(e){const t=new WheelEvent("wheel",{deltaY:-30*e});this[$c].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[nr].addEventListener("user-interaction",this[ur]),this[nr].addEventListener("pointer-change-start",this[br]),this[nr].addEventListener("pointer-change-end",this[br])}disconnectedCallback(){super.disconnectedCallback(),this[nr].removeEventListener("user-interaction",this[ur]),this[nr].removeEventListener("pointer-change-start",this[br]),this[nr].removeEventListener("pointer-change-end",this[br])}updated(e){super.updated(e);const t=this[nr],i=this[eh];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===zn&&(this[fr]=!0)):(t.disableInteraction(),this[cr]()),this[$c].setAttribute("aria-label",this[jc])),e.has("disableZoom")&&(t.disableZoom=this.disableZoom),e.has("disablePan")&&(t.enablePan=!this.disablePan),e.has("disableTap")&&(t.enableTap=!this.disableTap),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===zn&&this.cameraControls&&!this[Ir]?this[fr]=!0:this[cr]()),e.has("interactionPromptStyle")&&(this[Ar].style.opacity=this.interactionPromptStyle==Kn?"1":"0"),e.has("touchAction")){const e=this.touchAction;t.applyOptions({touchAction:e}),t.updateTouchActionStyle()}e.has("orbitSensitivity")&&(t.orbitSensitivity=this.orbitSensitivity),e.has("zoomSensitivity")&&(t.zoomSensitivity=this.zoomSensitivity),e.has("panSensitivity")&&(t.panSensitivity=this.panSensitivity),e.has("interpolationDecay")&&(t.setDamperDecayTime(this.interpolationDecay),i.setTargetDamperDecayTime(this.interpolationDecay)),e.has("a11y")&&this[gr](),!0===this[wr]&&Promise.resolve().then(()=>{t.jumpToGoal(),i.jumpToGoal(),this[mr](),this[wr]=!1})}async updateFraming(){const e=this[eh],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();const i=e.adjustedFoV(e.framedFoVDeg),s=this[nr].getFieldOfView()/t;this[nr].setFieldOfView(i*s),this[vr]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,i){const s=this[$c],a=this[lr];if("1"===a[0].style.opacity)return void console.warn("interact() failed because an existing interaction is running.");const n=new Array;n.push({x:Un(t.x),y:Un(t.y)});const r=[{x:n[0].x(0),y:n[0].y(0)}];null!=i&&(n.push({x:Un(i.x),y:Un(i.y)}),r.push({x:n[1].x(0),y:n[1].y(0)}));let o=performance.now();const{width:A,height:l}=this[eh],c=this.getBoundingClientRect(),h=e=>{for(const[t,i]of r.entries()){const{style:n}=a[t];n.transform=`translateX(${A*i.x}px) translateY(${l*i.y}px)`,"pointerdown"===e?n.opacity="1":"pointerup"===e&&(n.opacity="0");const r={pointerId:t-5678,pointerType:"touch",target:s,clientX:A*i.x+c.x,clientY:l*i.y+c.y,altKey:!0};s.dispatchEvent(new PointerEvent(e,r))}},d=()=>{const t=this[yr];if(t!==Gr.AUTOMATIC||!s.isConnected){for(const e of this[lr])e.style.opacity="0";return h("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),void document.removeEventListener("visibilitychange",g)}const i=Math.min(1,(performance.now()-o)/e);for(const[e,t]of r.entries())t.x=n[e].x(i),t.y=n[e].y(i);h("pointermove"),i<1?requestAnimationFrame(d):(h("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:Gr.AUTOMATIC}})),document.removeEventListener("visibilitychange",g))},g=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-o:o=performance.now()-e};document.addEventListener("visibilitychange",g),h("pointerdown"),this[yr]=Gr.AUTOMATIC,requestAnimationFrame(d)}[(i=or,s=Ar,a=lr,n=rr,r=Er,o=Cr,A=Ir,l=fr,c=yr,h=nr,d=Br,g=wr,p=xr,u=vr,m=dr,Qr)](e){const t=this[nr],i=this[eh];i.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=Gr.NONE,t.setFieldOfView(i.adjustedFoV(i.framedFoVDeg)),this[ur]()}[Sr](e){const t=this[nr];if(this[vr]){const{theta:t,phi:i}=this.getCameraOrbit();e[0]=t,e[1]=i,this[vr]=!1}t.changeSource=Gr.NONE,t.setOrbit(e[0],e[1],e[2]),this[ur]()}[Rr](e){this[nr].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[Tr](e){this[nr].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[pr](e[2]),this.jumpCameraToGoal()}[Dr](e){this[nr].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[Fr](e){const t=this[eh].adjustedFoV(180*e[0]/Math.PI);this[nr].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[Mr](e){var t;const[i,s,a]=e;this[nh].isPresenting||this[eh].setTarget(i,s,a),this[nr].changeSource=Gr.NONE,null===(t=this[nh].arRenderer)||void 0===t||t.updateTarget(),this[ur]()}[ih](e,t){if(super[ih](e,t),this[nh].isPresenting||!this[Ah]())return;const i=this[nr],s=this[eh],a=performance.now();if(this[fr]&&this.loaded&&a>this[Jc]+this.interactionPromptThreshold&&(this[fr]=!1,this[Cr]=a,this[or].classList.add("visible")),isFinite(this[Cr])&&this.interactionPromptStyle===Vn){const e=(a-this[Cr])/5e3%1,t=Nn(e),n=On(e);if(this[Ar].style.opacity=`${n}`,t!==this[Er]){const e=t*s.width*.05,a=(t-this[Er])*Math.PI/16;this[Ar].style.transform=`translateX(${e}px)`,i.changeSource=Gr.AUTOMATIC,i.adjustOrbit(a,0,0),this[Er]=t}}const n=i.update(e,t),r=s.updateTarget(t);(n||r)&&this[mr]()}[cr](){this[fr]=!1,this[or].classList.remove("visible"),this[Cr]=1/0}[pr](e){const t=Math.max(this[eh].farRadius(),e),i=Math.abs(2*t);this[nr].updateNearFar(0,i)}[hr](){const{theta:e,phi:t}=this[nr].getCameraSpherical(this[Br]),i=(4+Math.floor((e%ar+sr)/tr))%4,s=Math.floor(t/ir),a=`${jn[s]}${Hn[i]}`,n=a;n in this[dr]?this[Vc](this[dr][n]):this[Vc](`View from stage ${a}`)}get[jc](){let e=". Use mouse, touch or arrow keys to move.";return"interaction-prompt"in this[dr]&&(e=`. ${this[dr]["interaction-prompt"]}`),super[jc].replace(/\.$/,"")+(this.cameraControls?e:"")}async[ah](e){const t=this[nr],i=this[eh],s=i.adjustedFoV(i.framedFoVDeg);super[ah](e);const a=i.adjustedFoV(i.framedFoVDeg)/s,n=t.getFieldOfView()*(isFinite(a)?a:1);t.updateAspect(this[eh].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[nr].setFieldOfView(n),this.jumpCameraToGoal()}[sh](){super[sh](),this[xr]?this[vr]=!0:this[xr]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}[(b=ur,f=mr,I=br,gr)](){if("string"==typeof this.a11y)if(this.a11y.startsWith("{"))try{this[dr]=JSON.parse(this.a11y)}catch(e){console.warn("Error parsing a11y JSON:",e)}else this.a11y.length>0?console.warn("Error not supported format, should be a JSON string:",this.a11y):this[dr]={};else"object"==typeof this.a11y&&null!=this.a11y?this[dr]=Object.assign({},this.a11y):this[dr]={};this[$c].setAttribute("aria-label",this[jc])}}return Gn([de({type:Boolean,attribute:"camera-controls"})],C.prototype,"cameraControls",void 0),Gn([Ln({intrinsics:Xn,observeEffects:!0,updateHandler:Sr}),de({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],C.prototype,"cameraOrbit",void 0),Gn([Ln({intrinsics:er,observeEffects:!0,updateHandler:Mr}),de({type:String,attribute:"camera-target",hasChanged:()=>!0})],C.prototype,"cameraTarget",void 0),Gn([Ln({intrinsics:Wn,observeEffects:!0,updateHandler:Qr}),de({type:String,attribute:"field-of-view",hasChanged:()=>!0})],C.prototype,"fieldOfView",void 0),Gn([Ln({intrinsics:$n,updateHandler:Rr}),de({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],C.prototype,"minCameraOrbit",void 0),Gn([Ln({intrinsics:Zn,updateHandler:Tr}),de({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],C.prototype,"maxCameraOrbit",void 0),Gn([Ln({intrinsics:Yn,updateHandler:Dr}),de({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],C.prototype,"minFieldOfView",void 0),Gn([Ln({intrinsics:Wn,updateHandler:Fr}),de({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],C.prototype,"maxFieldOfView",void 0),Gn([de({type:Number,attribute:"interaction-prompt-threshold"})],C.prototype,"interactionPromptThreshold",void 0),Gn([de({type:String,attribute:"interaction-prompt"})],C.prototype,"interactionPrompt",void 0),Gn([de({type:String,attribute:"interaction-prompt-style"})],C.prototype,"interactionPromptStyle",void 0),Gn([de({type:Number,attribute:"orbit-sensitivity"})],C.prototype,"orbitSensitivity",void 0),Gn([de({type:Number,attribute:"zoom-sensitivity"})],C.prototype,"zoomSensitivity",void 0),Gn([de({type:Number,attribute:"pan-sensitivity"})],C.prototype,"panSensitivity",void 0),Gn([de({type:String,attribute:"touch-action"})],C.prototype,"touchAction",void 0),Gn([de({type:Boolean,attribute:"disable-zoom"})],C.prototype,"disableZoom",void 0),Gn([de({type:Boolean,attribute:"disable-pan"})],C.prototype,"disablePan",void 0),Gn([de({type:Boolean,attribute:"disable-tap"})],C.prototype,"disableTap",void 0),Gn([de({type:Number,attribute:"interpolation-decay"})],C.prototype,"interpolationDecay",void 0),Gn([de()],C.prototype,"a11y",void 0),C})((e=>{var i,s,a,n,r,o,A,l,c,h;class d extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arUsdzMaxTextureSize="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[i]=!1,this[s]=this.shadowRoot.querySelector(".ar-button"),this[a]=document.createElement("a"),this[n]=new Set,this[r]=Kd,this[o]=!1,this[A]=e=>{e.preventDefault(),this.activateAR()},this[l]=({status:e})=>{e!==to&&this[nh].arRenderer.presentedScene!==this[eh]||(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===to?this.removeAttribute("ar-tracking"):e===io&&this.setAttribute("ar-tracking",no))},this[c]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[h]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[$d]!==Kd}connectedCallback(){super.connectedCallback(),null!=this[nh].arRenderer&&(this[nh].arRenderer.addEventListener("status",this[sg]),this.setAttribute("ar-status",to),this[nh].arRenderer.addEventListener("tracking",this[ag])),this[eg].addEventListener("message",this[ng])}disconnectedCallback(){super.disconnectedCallback(),null!=this[nh].arRenderer&&(this[nh].arRenderer.removeEventListener("status",this[sg]),this[nh].arRenderer.removeEventListener("tracking",this[ag])),this[eg].removeEventListener("message",this[ng])}update(e){super.update(e),e.has("arScale")&&(this[eh].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[eh].updateShadow(),this[th]()),e.has("arModes")&&(this[Zd]=Od(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc")||e.has("arUsdzMaxTextureSize"))&&this[rg]()}async activateAR(){switch(this[$d]){case Hd:await this[Yd]();break;case zd:await this[Jd]();break;case jd:await this[Wd]();break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(i=Xd,s=Vd,a=eg,n=Zd,r=$d,o=tg,A=ig,l=sg,c=ag,h=ng,rg)](){var e;let t=Kd;if(this.ar){if(null!=this.src)for(const i of this[Zd]){if("webxr"===i&&Ie&&!Ud&&await this[nh].arRenderer.supportsPresentation()){t=zd;break}if("scene-viewer"===i&&!Gd&&(ve||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(null===(e=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)||void 0===e?void 0:e.includes("XR")))){t=jd;break}if("quick-look"===i&&Se&&!xe){t=Hd;break}}t===Kd&&null!=this.iosSrc&&Se&&!xe&&(t=Hd)}if(t!==Kd)this[Vd].classList.add("enabled"),this[Vd].addEventListener("click",this[ig]);else if(this[Vd].classList.contains("enabled")){this[Vd].removeEventListener("click",this[ig]),this[Vd].classList.remove("enabled");const e=ao;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[$d]=t}async[Jd](){await this[og]();try{this[Vd].removeEventListener("click",this[ig]);const{arRenderer:e}=this[nh];e.placeOnWall="wall"===this.arPlacement,await e.present(this[eh],this.xrEnvironment)}catch(e){console.warn("Error while trying to present in AR with WebXR"),console.error(e),await this[nh].arRenderer.stopPresenting(),Ud=!0,console.warn("Falling back to next ar-mode"),await this[rg](),this.activateAR()}finally{this[rg]()}}async[og](){this.loaded||(this[tg]=!0,this[Wc](),await((e,t,i=null)=>new Promise(s=>{e.addEventListener(t,function a(n){i&&!i(n)||(s(n),e.removeEventListener(t,a))})}))(this,"load"),this[tg]=!1)}[lh](){return super[lh]()||this[tg]}async[Wd](){const e=self.location.toString(),t=new URL(e),i=Array.from(this.querySelectorAll("extra-model")).map(e=>e.src).filter(e=>null!=e),s=this.src||i[0]||null;if(!s)return void console.warn("No src or extra-model provided for Scene Viewer fallback.");let a=new URL(s,e);a.hash&&(a.hash="");const n=new URLSearchParams(a.search);if(t.hash=Nd,n.set("mode","ar_preferred"),n.has("disable_occlusion")||n.set("disable_occlusion","true"),"fixed"===this.arScale&&n.set("resizable","false"),"wall"===this.arPlacement&&n.set("enable_vertical_placement","true"),n.has("sound")){const t=new URL(n.get("sound"),e);n.set("sound",t.toString())}if(n.has("link")){const t=new URL(n.get("link"),e);n.set("link",t.toString())}const r=`intent://arvr.google.com/scene-viewer/1.2?${n.toString()+"&file="+encodeURIComponent(a.toString())}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(t.toString())};end;`;self.addEventListener("hashchange",()=>{self.location.hash===Nd&&(Gd=!0,self.history.back(),console.warn("Error while trying to present in AR with Scene Viewer"),console.warn("Falling back to next ar-mode"),this[rg]())},{once:!0}),this[eg].setAttribute("href",r),this[eg].click()}async[Yd](){const e=!this.iosSrc;let t;this[Vd].classList.remove("enabled");try{t=e?await this.prepareUSDZ():this.iosSrc}catch(e){throw this[Vd].classList.add("enabled"),e}const i=new URL(t,self.location.toString());if(e){const e=self.location.toString(),t=new URL(e),s=Array.from(this.querySelectorAll("extra-model")).map(e=>e.src).filter(e=>null!=e),a=this.src||s[0]||null;if(a){const e=new URL(a,t);e.hash&&(i.hash=e.hash)}}"fixed"===this.arScale&&(i.hash&&(i.hash+="&"),i.hash+="allowsContentScaling=0");const s=this[eg];s.setAttribute("rel","ar");const a=document.createElement("img");s.appendChild(a),s.setAttribute("href",i.toString()),e&&s.setAttribute("download","model.usdz"),s.style.display="none",s.isConnected||this.shadowRoot.appendChild(s),s.click(),s.removeChild(a),e&&URL.revokeObjectURL(t),this[Vd].classList.add("enabled")}async prepareUSDZ(){const e=this[rh].beginActivity("usdz-conversion");await this[og]();const{models:i,shadow:s,target:a}=this[eh];if(0===i.length||null==i[0])return"";let n=!1;null!=s&&(n=s.visible,s.visible=!1),e(.2);const r="wall"===this.arPlacement?{includeAnchoringProperties:!1}:{},o=new Cd,A=new t.Object3D;A.position.copy(a.position);for(const e of i)a.remove(e),A.add(e);let l;A.updateWorldMatrix(!1,!0);try{l=await o.parseAsync(A,Object.assign(Object.assign({},r),{maxTextureSize:isNaN(this.arUsdzMaxTextureSize)?1/0:Math.max(parseInt(this.arUsdzMaxTextureSize),16)}))}finally{for(const e of i)A.remove(e),a.add(e);null!=s&&(s.visible=n),e(1)}const c=new Blob([l],{type:"model/vnd.usdz+zip"});return URL.createObjectURL(c)}}return _d([de({type:Boolean,attribute:"ar"})],d.prototype,"ar",void 0),_d([de({type:String,attribute:"ar-scale"})],d.prototype,"arScale",void 0),_d([de({type:String,attribute:"ar-usdz-max-texture-size"})],d.prototype,"arUsdzMaxTextureSize",void 0),_d([de({type:String,attribute:"ar-placement"})],d.prototype,"arPlacement",void 0),_d([de({type:String,attribute:"ar-modes"})],d.prototype,"arModes",void 0),_d([de({type:String,attribute:"ios-src"})],d.prototype,"iosSrc",void 0),_d([de({type:Boolean,attribute:"xr-environment"})],d.prototype,"xrEnvironment",void 0),d})((e=>{var i,s,a,n,r,o,A,l;class c extends e{static set dracoDecoderLocation(e){Es.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return Es.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){Es.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return Es.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){Es.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return Es.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){aA.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return aA.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){aA.singleton.loader[fs].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[mg]():(this[ug]=!0,this[Wc]())}showPoster(){const e=this[gg];if(e.classList.contains("show"))return;e.classList.add("show"),this[$c].classList.remove("show");const t=this[pg];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");const i=this.modelIsVisible;this[bg]=!1,this[Hc](i)}getDimensions(){return this[eh].updateBoundingBoxAndShadowIfDirty(),ch(this[eh].size)}getBoundingBoxCenter(){return this[eh].updateBoundingBoxAndShadowIfDirty(),ch(this[eh].boundingBox.getCenter(new t.Vector3))}constructor(...e){super(...e),this.poster=null,this.reveal=lg,this.loading=cg,this[i]=!1,this[s]=!1,this[a]=this.shadowRoot.querySelector(".slot.poster"),this[n]=this.shadowRoot.querySelector("#default-poster"),this[r]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[o]=this[pg].getAttribute("aria-label"),this[A]=((e,t)=>{let i=null;const s=(...s)=>{null==i&&(e(...s),i=self.setTimeout(()=>i=null,t))};return s.flush=()=>{null!=i&&(self.clearTimeout(i),i=null)},s})(e=>{const t=this[dg].parentNode;requestAnimationFrame(()=>{this[dg].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[dg]),t.appendChild(this[dg])),this[dg].classList.toggle("hide",1===e)})},100),this[l]=e=>{const t=e.detail.totalProgress,i=e.detail.reason;1===t&&(this[fg].flush(),this.loaded&&(this[ug]||this.reveal===lg)&&this[mg]()),this[fg](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t,reason:i}}))};const t=self.ModelViewerElement||{},c=t.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";Es.setDRACODecoderLocation(c);const h=t.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";Es.setKTX2TranscoderLocation(h),t.meshoptDecoderLocation&&Es.setMeshoptDecoderLocation(t.meshoptDecoderLocation);const d=t.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";null!=aA.singleton.textureUtils&&(aA.singleton.textureUtils.lottieLoaderUrl=d)}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[rh].addEventListener("progress",this[Cg])}disconnectedCallback(){super.disconnectedCallback(),this[rh].removeEventListener("progress",this[Cg])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[pg].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[pg].setAttribute("aria-label",this[zc]),(e.has("reveal")||e.has("loading"))&&this[Wc]()}[(i=bg,s=ug,a=gg,n=pg,r=dg,o=Ig,A=fg,l=Cg,lh)](){const e=Array.from(this.querySelectorAll("extra-model"));return!!(this.src||e.length>0)&&(this[ug]||this.loading===hg||this.reveal===lg&&this[qc])}[mg](){this[ug]=!1;const e=this[gg];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[$c].classList.add("show");const t=this.modelIsVisible;this[bg]=!0,this[Hc](t);const i=this.getRootNode();i&&i.activeElement===this&&this[$c].focus();const s=this[pg];s.setAttribute("aria-hidden","true"),s.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[Ah](){return super[Ah]()&&this[bg]}}return Ag([de({type:String})],c.prototype,"poster",void 0),Ag([de({type:String})],c.prototype,"reveal",void 0),Ag([de({type:String})],c.prototype,"loading",void 0),c})((e=>{var i,s;class a extends e{constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[i]=!0,this[s]=Ih,this[eh].subscribeMixerEvent("loop",e=>{const t=e.action._loopCount,i=e.action._clip.name,s=e.action._clip.uuid,a=this[eh].markedAnimations.find(e=>e.name===i);if(a){this[eh].updateAnimationLoop(a.name,a.loopMode,a.repetitionCount);const e=this[eh].markedAnimations.filter(e=>e.name!==i);this[eh].markedAnimations=e}this.dispatchEvent(new CustomEvent("loop",{detail:{count:t,name:i,uuid:s}}))}),this[eh].subscribeMixerEvent("finished",e=>{if(this[eh].appendedAnimations.includes(e.action._clip.name)){const t=this[eh].appendedAnimations.filter(t=>t!==e.action._clip.name);this[eh].appendedAnimations=t}else this[bh]=!0;this.dispatchEvent(new CustomEvent("finished"))})}get availableAnimations(){return this.loaded?this[eh].animationNames:[]}get duration(){return this[eh].duration}get paused(){return this[eh].isAllAnimationsPaused()}get currentTime(){return this[eh].animationTime}get appendedAnimations(){return this[eh].appendedAnimations}set currentTime(e){this[eh].animationTime=e,this[th]()}get timeScale(){return this[eh].animationTimeScale}set timeScale(e){this[eh].animationTimeScale=e}pause(e){var t;if(null==(null==e?void 0:e.modelIndex)&&this.paused)return;const i=null!==(t=null==e?void 0:e.modelIndex)&&void 0!==t?t:null;this[eh].pauseAnimation(i),this.dispatchEvent(new CustomEvent("pause"))}play(e){var t;if(this.availableAnimations.length>0){const i=null!==(t=null==e?void 0:e.modelIndex)&&void 0!==t?t:null;this[eh].unpauseAnimation(i),this[fh]=Object.assign(Object.assign({},Ih),e),this[ph](this[fh]),this.dispatchEvent(new CustomEvent("play"))}}appendAnimation(e,t){var i;this.availableAnimations.length>0&&(this[bh]=!1,this[eh].unpauseAnimation(null!==(i=null==t?void 0:t.modelIndex)&&void 0!==i?i:null),this[uh](e,t),this.dispatchEvent(new CustomEvent("append-animation")))}detachAnimation(e,t){var i;this.availableAnimations.length>0&&(this[bh]=!1,this[eh].unpauseAnimation(null!==(i=null==t?void 0:t.modelIndex)&&void 0!==i?i:null),this[mh](e,t),this.dispatchEvent(new CustomEvent("detach-animation")))}[(i=bh,s=fh,sh)](){super[sh](),this[eh].pauseAnimation(),null!=this.animationName&&this[ph](),this.autoplay&&this.play()}[ih](e,t){super[ih](e,t),this.paused||!this[Ah]()&&!this[nh].isPresenting||(this[eh].updateAnimation(t/1e3),this[th]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[ph]()}[ph](e){var i;const s=null!=e?e:this[fh],a=null!==(i=s.repetitions)&&void 0!==i?i:1/0,n=s.pingpong?t.LoopPingPong:1===a?t.LoopOnce:t.LoopRepeat;this[eh].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,n,a,s.modelIndex),this[bh]&&(this[eh].updateAnimation(0),this[th]())}[uh](e="",i={}){var s;const a=Object.assign(Object.assign({},Ch),i),n=null!==(s=a.repetitions)&&void 0!==s?s:1/0,r=a.pingpong?t.LoopPingPong:1===n?t.LoopOnce:t.LoopRepeat,o=!!i.repetitions||"pingpong"in i;this[eh].appendAnimation(e||this.animationName,r,n,a.weight,a.timeScale,a.fade,a.warp,a.relativeWarp,a.time,o,a.modelIndex),this[bh]&&(this[eh].updateAnimation(0),this[th]())}[mh](e="",t={}){const i=Object.assign(Object.assign({},Eh),t);this[eh].detachAnimation(e||this.animationName,i.fade,i.modelIndex),this[bh]&&(this[eh].updateAnimation(0),this[th]())}}return gh([de({type:Boolean})],a.prototype,"autoplay",void 0),gh([de({type:String,attribute:"animation-name"})],a.prototype,"animationName",void 0),gh([de({type:Number,attribute:"animation-crossfade-duration"})],a.prototype,"animationCrossfadeDuration",void 0),a})(dh))))))));customElements.define("model-viewer",Qg),Object.defineProperty(e,"CanvasTexture",{enumerable:!0,get:function(){return t.CanvasTexture}}),Object.defineProperty(e,"FileLoader",{enumerable:!0,get:function(){return t.FileLoader}}),Object.defineProperty(e,"Loader",{enumerable:!0,get:function(){return t.Loader}}),Object.defineProperty(e,"NearestFilter",{enumerable:!0,get:function(){return t.NearestFilter}}),e.ModelViewerElement=Qg});
//# sourceMappingURL=model-viewer-module-umd.min.js.map