mirror of
https://github.com/exogen/t2-model-skinner.git
synced 2026-01-19 19:24:44 +00:00
1097 lines
389 KiB
JavaScript
1097 lines
389 KiB
JavaScript
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[848],{5848:function(e,t,s){let o,A,l,h,c,d,g,p,m,I,f,E,C;/**
|
|
* @license
|
|
* Copyright 2017 Google LLC
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/let i=(e,t)=>"method"!==t.kind||!t.descriptor||"value"in t.descriptor?{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(s){s.createProperty(t.key,e)}}:{...t,finisher(s){s.createProperty(t.key,e)}},property_e=(e,t,s)=>{t.constructor.createProperty(s,e)};function n(e){return(t,s)=>void 0!==s?property_e(e,t,s):i(e,t)}null!=(null===(b=window.HTMLSlotElement)||void 0===b?void 0:b.prototype.assignedElements)||((e,t)=>e.assignedNodes(t).filter(e=>e.nodeType===Node.ELEMENT_NODE));var B,y,Q,x,b,T,F,_,U,G,O,q,K,J,Y,j,W,$,X,ee,et,ei,es,er,en,ea,eo,eA,el,eh,ec,eu,ed,eg,ep,em,eI,ef,eE,eC,eB,ey,ew,ev,eQ,ex,eb,eS=s(9477);/**
|
|
* @license
|
|
* Copyright 2019 Google LLC
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/let eT=window,eM=eT.ShadowRoot&&(void 0===eT.ShadyCSS||eT.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,eR=Symbol(),eD=new WeakMap;let css_tag_o=class css_tag_o{constructor(e,t,s){if(this._$cssResult$=!0,s!==eR)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(eM&&void 0===e){let s=void 0!==t&&1===t.length;s&&(e=eD.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&eD.set(t,e))}return e}toString(){return this.cssText}};let r=e=>new css_tag_o("string"==typeof e?e:e+"",void 0,eR),S=(e,t)=>{eM?e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(t=>{let s=document.createElement("style"),o=eT.litNonce;void 0!==o&&s.setAttribute("nonce",o),s.textContent=t.cssText,e.appendChild(s)})},eL=eM?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let s of e.cssRules)t+=s.cssText;return r(t)})(e):e,eF=window,e_=eF.trustedTypes,ek=e_?e_.emptyScript:"",eU=eF.reactiveElementPolyfillSupport,eG={toAttribute(e,t){switch(t){case Boolean:e=e?ek:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let s=e;switch(t){case Boolean:s=null!==e;break;case Number:s=null===e?null:Number(e);break;case Object:case Array:try{s=JSON.parse(e)}catch(e){s=null}}return s}},a=(e,t)=>t!==e&&(t==t||e==e),eN={attribute:!0,type:String,converter:eG,reflect:!1,hasChanged:a},eP="finalized";let u=class u extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,s)=>{let o=this._$Ep(s,t);void 0!==o&&(this._$Ev.set(o,s),e.push(o))}),e}static createProperty(e,t=eN){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let s="symbol"==typeof e?Symbol():"__"+e,o=this.getPropertyDescriptor(e,s,t);void 0!==o&&Object.defineProperty(this.prototype,e,o)}}static getPropertyDescriptor(e,t,s){return{get(){return this[t]},set(o){let A=this[e];this[t]=o,this.requestUpdate(e,A,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||eN}static finalize(){if(this.hasOwnProperty(eP))return!1;this[eP]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(let s of t)this.createProperty(s,e[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let s=new Set(e.flat(1/0).reverse());for(let e of s)t.unshift(eL(e))}else void 0!==e&&t.push(eL(e));return t}static _$Ep(e,t){let s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach(e=>e(this))}addController(e){var t,s;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(s=e.hostConnected)||void 0===s||s.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;let t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return S(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)})}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)})}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$EO(e,t,s=eN){var o;let A=this.constructor._$Ep(e,s);if(void 0!==A&&!0===s.reflect){let l=(void 0!==(null===(o=s.converter)||void 0===o?void 0:o.toAttribute)?s.converter:eG).toAttribute(t,s.type);this._$El=e,null==l?this.removeAttribute(A):this.setAttribute(A,l),this._$El=null}}_$AK(e,t){var s;let o=this.constructor,A=o._$Ev.get(e);if(void 0!==A&&this._$El!==A){let e=o.getPropertyOptions(A),l="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(s=e.converter)||void 0===s?void 0:s.fromAttribute)?e.converter:eG;this._$El=A,this[A]=l.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,s){let o=!0;void 0!==e&&(((s=s||this.constructor.getPropertyOptions(e)).hasChanged||a)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===s.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,s))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((e,t)=>this[t]=e),this._$Ei=void 0);let t=!1,s=this._$AL;try{(t=this.shouldUpdate(s))?(this.willUpdate(s),null===(e=this._$ES)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)}),this.update(s)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(s)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach(e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach((e,t)=>this._$EO(t,this[t],e)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};u[eP]=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==eU||eU({ReactiveElement:u}),(null!==(T=eF.reactiveElementVersions)&&void 0!==T?T:eF.reactiveElementVersions=[]).push("1.6.3");let eO=window,eH=eO.trustedTypes,eV=eH?eH.createPolicy("lit-html",{createHTML:e=>e}):void 0,eq="$lit$",eK=`lit$${(Math.random()+"").slice(9)}$`,eJ="?"+eK,ez=`<${eJ}>`,eY=document,lit_html_u=()=>eY.createComment(""),lit_html_d=e=>null===e||"object"!=typeof e&&"function"!=typeof e,ej=Array.isArray,v=e=>ej(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]),eW="[ \n\f\r]",e$=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,eX=/-->/g,eZ=/>/g,e0=RegExp(`>|${eW}(?:([^\\s"'>=/]+)(${eW}*=${eW}*(?:[^
|
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),e1=/'/g,e2=/"/g,e3=/^(?:script|style|textarea|title)$/i,w=e=>(t,...s)=>({_$litType$:e,strings:t,values:s}),e4=w(1),e8=(w(2),Symbol.for("lit-noChange")),e5=Symbol.for("lit-nothing"),e6=new WeakMap,e9=eY.createTreeWalker(eY,129,null,!1);function P(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==eV?eV.createHTML(t):t}let V=(e,t)=>{let s=e.length-1,o=[],A,l=2===t?"<svg>":"",h=e$;for(let t=0;t<s;t++){let s=e[t],c,d,g=-1,p=0;for(;p<s.length&&(h.lastIndex=p,null!==(d=h.exec(s)));)p=h.lastIndex,h===e$?"!--"===d[1]?h=eX:void 0!==d[1]?h=eZ:void 0!==d[2]?(e3.test(d[2])&&(A=RegExp("</"+d[2],"g")),h=e0):void 0!==d[3]&&(h=e0):h===e0?">"===d[0]?(h=null!=A?A:e$,g=-1):void 0===d[1]?g=-2:(g=h.lastIndex-d[2].length,c=d[1],h=void 0===d[3]?e0:'"'===d[3]?e2:e1):h===e2||h===e1?h=e0:h===eX||h===eZ?h=e$:(h=e0,A=void 0);let m=h===e0&&e[t+1].startsWith("/>")?" ":"";l+=h===e$?s+ez:g>=0?(o.push(c),s.slice(0,g)+eq+s.slice(g)+eK+m):s+eK+(-2===g?(o.push(void 0),t):m)}return[P(e,l+(e[s]||"<?>")+(2===t?"</svg>":"")),o]};let N=class N{constructor({strings:e,_$litType$:t},s){let o;this.parts=[];let A=0,l=0,h=e.length-1,c=this.parts,[d,g]=V(e,t);if(this.el=N.createElement(d,s),e9.currentNode=this.el.content,2===t){let e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(o=e9.nextNode())&&c.length<h;){if(1===o.nodeType){if(o.hasAttributes()){let e=[];for(let t of o.getAttributeNames())if(t.endsWith(eq)||t.startsWith(eK)){let s=g[l++];if(e.push(t),void 0!==s){let e=o.getAttribute(s.toLowerCase()+eq).split(eK),t=/([.?@])?(.*)/.exec(s);c.push({type:1,index:A,name:t[2],strings:e,ctor:"."===t[1]?H:"?"===t[1]?L:"@"===t[1]?z:k})}else c.push({type:6,index:A})}for(let t of e)o.removeAttribute(t)}if(e3.test(o.tagName)){let e=o.textContent.split(eK),t=e.length-1;if(t>0){o.textContent=eH?eH.emptyScript:"";for(let s=0;s<t;s++)o.append(e[s],lit_html_u()),e9.nextNode(),c.push({type:2,index:++A});o.append(e[t],lit_html_u())}}}else if(8===o.nodeType){if(o.data===eJ)c.push({type:2,index:A});else{let e=-1;for(;-1!==(e=o.data.indexOf(eK,e+1));)c.push({type:7,index:A}),e+=eK.length-1}}A++}}static createElement(e,t){let s=eY.createElement("template");return s.innerHTML=e,s}};function lit_html_S(e,t,s=e,o){var A,l,h;if(t===e8)return t;let c=void 0!==o?null===(A=s._$Co)||void 0===A?void 0:A[o]:s._$Cl,d=lit_html_d(t)?void 0:t._$litDirective$;return(null==c?void 0:c.constructor)!==d&&(null===(l=null==c?void 0:c._$AO)||void 0===l||l.call(c,!1),void 0===d?c=void 0:(c=new d(e))._$AT(e,s,o),void 0!==o?(null!==(h=s._$Co)&&void 0!==h?h:s._$Co=[])[o]=c:s._$Cl=c),void 0!==c&&(t=lit_html_S(e,c._$AS(e,t.values),c,o)),t}let M=class M{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){var t;let{el:{content:s},parts:o}=this._$AD,A=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:eY).importNode(s,!0);e9.currentNode=A;let l=e9.nextNode(),h=0,c=0,d=o[0];for(;void 0!==d;){if(h===d.index){let t;2===d.type?t=new R(l,l.nextSibling,this,e):1===d.type?t=new d.ctor(l,d.name,d.strings,this,e):6===d.type&&(t=new Z(l,this,e)),this._$AV.push(t),d=o[++c]}h!==(null==d?void 0:d.index)&&(l=e9.nextNode(),h++)}return e9.currentNode=eY,A}v(e){let t=0;for(let s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}};let R=class R{constructor(e,t,s,o){var A;this.type=2,this._$AH=e5,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=o,this._$Cp=null===(A=null==o?void 0:o.isConnected)||void 0===A||A}get _$AU(){var e,t;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===(null==e?void 0:e.nodeType)&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){lit_html_d(e=lit_html_S(this,e,t))?e===e5||null==e||""===e?(this._$AH!==e5&&this._$AR(),this._$AH=e5):e!==this._$AH&&e!==e8&&this._(e):void 0!==e._$litType$?this.g(e):void 0!==e.nodeType?this.$(e):v(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==e5&&lit_html_d(this._$AH)?this._$AA.nextSibling.data=e:this.$(eY.createTextNode(e)),this._$AH=e}g(e){var t;let{values:s,_$litType$:o}=e,A="number"==typeof o?this._$AC(e):(void 0===o.el&&(o.el=N.createElement(P(o.h,o.h[0]),this.options)),o);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===A)this._$AH.v(s);else{let e=new M(A,this),t=e.u(this.options);e.v(s),this.$(t),this._$AH=e}}_$AC(e){let t=e6.get(e.strings);return void 0===t&&e6.set(e.strings,t=new N(e)),t}T(e){ej(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,s,o=0;for(let A of e)o===t.length?t.push(s=new R(this.k(lit_html_u()),this.k(lit_html_u()),this,this.options)):s=t[o],s._$AI(A),o++;o<t.length&&(this._$AR(s&&s._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,t);e&&e!==this._$AB;){let t=e.nextSibling;e.remove(),e=t}}setConnected(e){var t;void 0===this._$AM&&(this._$Cp=e,null===(t=this._$AP)||void 0===t||t.call(this,e))}};let k=class k{constructor(e,t,s,o,A){this.type=1,this._$AH=e5,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=A,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=e5}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,s,o){let A=this.strings,l=!1;if(void 0===A)(l=!lit_html_d(e=lit_html_S(this,e,t,0))||e!==this._$AH&&e!==e8)&&(this._$AH=e);else{let o,h;let c=e;for(e=A[0],o=0;o<A.length-1;o++)(h=lit_html_S(this,c[s+o],t,o))===e8&&(h=this._$AH[o]),l||(l=!lit_html_d(h)||h!==this._$AH[o]),h===e5?e=e5:e!==e5&&(e+=(null!=h?h:"")+A[o+1]),this._$AH[o]=h}l&&!o&&this.j(e)}j(e){e===e5?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}};let H=class H extends k{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===e5?void 0:e}};let e7=eH?eH.emptyScript:"";let L=class L extends k{constructor(){super(...arguments),this.type=4}j(e){e&&e!==e5?this.element.setAttribute(this.name,e7):this.element.removeAttribute(this.name)}};let z=class z extends k{constructor(e,t,s,o,A){super(e,t,s,o,A),this.type=5}_$AI(e,t=this){var s;if((e=null!==(s=lit_html_S(this,e,t,0))&&void 0!==s?s:e5)===e8)return;let o=this._$AH,A=e===e5&&o!==e5||e.capture!==o.capture||e.once!==o.once||e.passive!==o.passive,l=e!==e5&&(o===e5||A);A&&this.element.removeEventListener(this.name,this,o),l&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(t=this.options)||void 0===t?void 0:t.host)&&void 0!==s?s:this.element,e):this._$AH.handleEvent(e)}};let Z=class Z{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){lit_html_S(this,e)}};let te=eO.litHtmlPolyfillSupport;null==te||te(N,R),(null!==(F=eO.litHtmlVersions)&&void 0!==F?F:eO.litHtmlVersions=[]).push("2.8.0");let D=(e,t,s)=>{var o,A;let l=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:t,h=l._$litPart$;if(void 0===h){let e=null!==(A=null==s?void 0:s.renderBefore)&&void 0!==A?A:null;l._$litPart$=h=new R(t.insertBefore(lit_html_u(),e),e,void 0,null!=s?s:{})}return h._$AI(e),h};let lit_element_s=class lit_element_s extends u{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let s=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=s.firstChild),s}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=D(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}render(){return e8}};lit_element_s.finalized=!0,lit_element_s._$litElement$=!0,null===(_=globalThis.litElementHydrateSupport)||void 0===_||_.call(globalThis,{LitElement:lit_element_s});let tt=globalThis.litElementPolyfillSupport;null==tt||tt({LitElement:lit_element_s}),(null!==(U=globalThis.litElementVersions)&&void 0!==U?U:globalThis.litElementVersions=[]).push("3.3.3");/* @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.
|
|
*/let ti=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,ts=ti&&null!=self.XRSession.prototype.requestHitTestSource,tr=null!=self.ResizeObserver,tn=null!=self.IntersectionObserver;(()=>{let e=navigator.userAgent||navigator.vendor||self.opera;/(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))})(),/\bCrOS\b/.test(navigator.userAgent);let ta=/android/i.test(navigator.userAgent),to=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1;/Safari\//.test(navigator.userAgent);let tA=/firefox/i.test(navigator.userAgent),tl=/OculusBrowser/.test(navigator.userAgent);to&&/CriOS\//.test(navigator.userAgent);let th=ta&&!tA&&!tl,tc=!!(window.webkit&&window.webkit.messageHandlers),tu=(()=>{if(!to)return!1;if(tc)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{let e=document.createElement("a");return!!(e.relList&&e.relList.supports&&e.relList.supports("ar"))}})(),deserializeUrl=e=>e&&"null"!==e?toFullUrl(e):null,assertIsArCandidate=()=>{if(ts)return;let e=[];throw ti||e.push("WebXR Device API"),ts||e.push("WebXR Hit Test API"),Error(`The following APIs are required for AR, but are missing in this browser: ${e.join(", ")}`)},toFullUrl=e=>{let t=new URL(e,window.location.toString());return t.toString()},throttle=(e,t)=>{let s=null,throttled=(...o)=>{null==s&&(e(...o),s=self.setTimeout(()=>s=null,t))};return throttled.flush=()=>{null!=s&&(self.clearTimeout(s),s=null)},throttled},debounce=(e,t)=>{let s=null;return(...o)=>{null!=s&&self.clearTimeout(s),s=self.setTimeout(()=>{s=null,e(...o)},t)}},clamp=(e,t,s)=>Math.max(t,Math.min(s,e)),td=(()=>{let e=(()=>{var e;if(null===(e=document.documentElement.getAttribute("itemtype"))||void 0===e?void 0:e.includes("schema.org/SearchResultsPage"))return!0;let t=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[];for(let e of t)if("viewport"===e.name)return!0;return!1})();return e||console.warn('No <meta name="viewport"> detected; <model-viewer> will cap pixel density at 1.'),()=>e?window.devicePixelRatio:1})(),tg=(()=>{let e=RegExp("[?&]model-viewer-debug-mode(&|$)");return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)})(),timePasses=(e=0)=>new Promise(t=>setTimeout(t,e)),waitForEvent=(e,t,s=null)=>new Promise(o=>{e.addEventListener(t,function handler(A){(!s||s(A))&&(o(A),e.removeEventListener(t,handler))})});/* @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 __decorate=function(e,t,s,o){var A,l=arguments.length,h=l<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(e,t,s,o);else for(var c=e.length-1;c>=0;c--)(A=e[c])&&(h=(l<3?A(h):l>3?A(t,s,h):A(t,s))||h);return l>3&&h&&Object.defineProperty(t,s,h),h};let tp=Symbol("currentEnvironmentMap"),tm=Symbol("currentBackground"),tI=Symbol("updateEnvironment"),tf=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.
|
|
*/var tE=e4`
|
|
<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>`,tC=e4`
|
|
<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>`,tB=e4`
|
|
<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>`;/* @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.
|
|
*/let ty=e4`
|
|
<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 ::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:not(.enabled) {
|
|
display: none;
|
|
}
|
|
|
|
#default-exit-webxr-ar-button {
|
|
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">
|
|
${tB}
|
|
</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">
|
|
${tC}
|
|
</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">
|
|
${tE}
|
|
</a>
|
|
</slot>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="screen-reader-only" role="region" aria-label="Live announcements">
|
|
<span id="status" role="status"></span>
|
|
</div>`,makeTemplate=e=>{D(ty,e)},tw=new WeakMap;let DRACOLoader=class DRACOLoader extends eS.aNw{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,t,s,o){let A=new eS.hH6(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,e=>{this.parse(e,t,o)},s,o)}parse(e,t,s=()=>{}){this.decodeDracoFile(e,t,null,null,eS.KI_).catch(s)}decodeDracoFile(e,t,s,o,A=eS.GUF,l=()=>{}){let h={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:o||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:A};return this.decodeGeometry(e,h).then(t).catch(l)}decodeGeometry(e,t){let s;let o=JSON.stringify(t);if(tw.has(e)){let t=tw.get(e);if(t.key===o)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let A=this.workerNextTaskID++,l=e.byteLength,h=this._getWorker(A,l).then(o=>(s=o,new Promise((o,l)=>{s._callbacks[A]={resolve:o,reject:l},s.postMessage({type:"decode",id:A,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return h.catch(()=>!0).then(()=>{s&&A&&this._releaseTask(s,A)}),tw.set(e,{key:o,promise:h}),h}_createGeometry(e){let t=new eS.u9r;e.index&&t.setIndex(new eS.TlE(e.index.array,1));for(let s=0;s<e.attributes.length;s++){let o=e.attributes[s],A=o.name,l=o.array,h=o.itemSize,c=new eS.TlE(l,h);"color"===A&&(this._assignVertexColorSpace(c,o.vertexColorSpace),c.normalized=l instanceof Float32Array==!1),t.setAttribute(A,c)}return t}_assignVertexColorSpace(e,t){if(t!==eS.KI_)return;let s=new eS.Ilk;for(let t=0,o=e.count;t<o;t++)s.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,s.r,s.g,s.b)}_loadLibrary(e,t){let s=new eS.hH6(this.manager);return s.setPath(this.decoderPath),s.setResponseType(t),s.setWithCredentials(this.withCredentials),new Promise((t,o)=>{s.load(e,t,void 0,o)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let 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=>{let s=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let o=DRACOWorker.toString(),A=["/* draco decoder */",s,"","/* worker */",o.substring(o.indexOf("{")+1,o.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){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){let s=t.data;switch(s.type){case"decode":e._callbacks[s.id].resolve(s);break;case"error":e._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});let s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=t,s._taskLoad+=t,s})}_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 DRACOWorker(){let e,t;onmessage=function(s){let o=s.data;switch(o.type){case"init":e=o.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":let A=o.buffer,l=o.taskConfig;t.then(e=>{let t=e.draco,s=new t.Decoder;try{let e=function(e,t,s,o){let A,l;let h=o.attributeIDs,c=o.attributeTypes,d=t.GetEncodedGeometryType(s);if(d===e.TRIANGULAR_MESH)A=new e.Mesh,l=t.DecodeArrayToMesh(s,s.byteLength,A);else if(d===e.POINT_CLOUD)A=new e.PointCloud,l=t.DecodeArrayToPointCloud(s,s.byteLength,A);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!l.ok()||0===A.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());let g={index:null,attributes:[]};for(let s in h){let l,d;let p=self[c[s]];if(o.useUniqueIDs)d=h[s],l=t.GetAttributeByUniqueId(A,d);else{if(-1===(d=t.GetAttributeId(A,e[h[s]])))continue;l=t.GetAttribute(A,d)}let m=function(e,t,s,o,A,l){let h=l.num_components(),c=s.num_points(),d=c*h,g=d*A.BYTES_PER_ELEMENT,p=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),m=e._malloc(g);t.GetAttributeDataArrayForAllPoints(s,l,p,g,m);let I=new A(e.HEAPF32.buffer,m,d).slice();return e._free(m),{name:o,array:I,itemSize:h}}(e,t,A,s,p,l);"color"===s&&(m.vertexColorSpace=o.vertexColorSpace),g.attributes.push(m)}return d===e.TRIANGULAR_MESH&&(g.index=function(e,t,s){let o=s.num_faces(),A=3*o,l=4*A,h=e._malloc(l);t.GetTrianglesUInt32Array(s,l,h);let c=new Uint32Array(e.HEAPF32.buffer,h,A).slice();return e._free(h),{array:c,itemSize:1}}(e,t,A)),e.destroy(A),g}(t,s,new Int8Array(A),l),h=e.attributes.map(e=>e.array.buffer);e.index&&h.push(e.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:e},h)}catch(e){console.error(e),self.postMessage({type:"error",id:o.id,error:e.message})}finally{t.destroy(s)}})}}}function toTrianglesDrawMode(e,t){if(t===eS.WwZ)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==eS.z$h&&t!==eS.UlW)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let s=e.getIndex();if(null===s){let t=[],o=e.getAttribute("position");if(void 0===o)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<o.count;e++)t.push(e);e.setIndex(t),s=e.getIndex()}let o=s.count-2,A=[];if(t===eS.z$h)for(let e=1;e<=o;e++)A.push(s.getX(0)),A.push(s.getX(e)),A.push(s.getX(e+1));else for(let e=0;e<o;e++)e%2==0?(A.push(s.getX(e)),A.push(s.getX(e+1)),A.push(s.getX(e+2))):(A.push(s.getX(e+2)),A.push(s.getX(e+1)),A.push(s.getX(e)));A.length/3!==o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let l=e.clone();return l.setIndex(A),l.clearGroups(),l}}let GLTFLoader=class GLTFLoader extends eS.aNw{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new GLTFMaterialsClearcoatExtension(e)}),this.register(function(e){return new GLTFTextureBasisUExtension(e)}),this.register(function(e){return new GLTFTextureWebPExtension(e)}),this.register(function(e){return new GLTFTextureAVIFExtension(e)}),this.register(function(e){return new GLTFMaterialsSheenExtension(e)}),this.register(function(e){return new GLTFMaterialsTransmissionExtension(e)}),this.register(function(e){return new GLTFMaterialsVolumeExtension(e)}),this.register(function(e){return new GLTFMaterialsIorExtension(e)}),this.register(function(e){return new GLTFMaterialsEmissiveStrengthExtension(e)}),this.register(function(e){return new GLTFMaterialsSpecularExtension(e)}),this.register(function(e){return new GLTFMaterialsIridescenceExtension(e)}),this.register(function(e){return new GLTFMaterialsAnisotropyExtension(e)}),this.register(function(e){return new GLTFMaterialsBumpExtension(e)}),this.register(function(e){return new GLTFLightsExtension(e)}),this.register(function(e){return new GLTFMeshoptCompression(e)}),this.register(function(e){return new GLTFMeshGpuInstancing(e)})}load(e,t,s,o){let A;let l=this;if(""!==this.resourcePath)A=this.resourcePath;else if(""!==this.path){let t=eS.Zp0.extractUrlBase(e);A=eS.Zp0.resolveURL(t,this.path)}else A=eS.Zp0.extractUrlBase(e);this.manager.itemStart(e);let _onError=function(t){o?o(t):console.error(t),l.manager.itemError(e),l.manager.itemEnd(e)},h=new eS.hH6(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,function(s){try{l.parse(s,A,function(s){t(s),l.manager.itemEnd(e)},_onError)}catch(e){_onError(e)}},s,_onError)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}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,s,o){let A;let l={},h={},c=new TextDecoder;if("string"==typeof e)A=JSON.parse(e);else if(e instanceof ArrayBuffer){let t=c.decode(new Uint8Array(e,0,4));if(t===tQ){try{l[tv.KHR_BINARY_GLTF]=new GLTFBinaryExtension(e)}catch(e){o&&o(e);return}A=JSON.parse(l[tv.KHR_BINARY_GLTF].content)}else A=JSON.parse(c.decode(e))}else A=e;if(void 0===A.asset||A.asset.version[0]<2){o&&o(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let d=new GLTFParser(A,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](d);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),h[t.name]=t,l[t.name]=!0}if(A.extensionsUsed)for(let e=0;e<A.extensionsUsed.length;++e){let t=A.extensionsUsed[e],s=A.extensionsRequired||[];switch(t){case tv.KHR_MATERIALS_UNLIT:l[t]=new GLTFMaterialsUnlitExtension;break;case tv.KHR_DRACO_MESH_COMPRESSION:l[t]=new GLTFDracoMeshCompressionExtension(A,this.dracoLoader);break;case tv.KHR_TEXTURE_TRANSFORM:l[t]=new GLTFTextureTransformExtension;break;case tv.KHR_MESH_QUANTIZATION:l[t]=new GLTFMeshQuantizationExtension;break;default:s.indexOf(t)>=0&&void 0===h[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}d.setExtensions(l),d.setPlugins(h),d.parse(s,o)}parseAsync(e,t){let s=this;return new Promise(function(o,A){s.parse(e,t,o,A)})}};function GLTFRegistry(){let e={};return{get:function(t){return e[t]},add:function(t,s){e[t]=s},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let tv={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_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",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};let GLTFLightsExtension=class GLTFLightsExtension{constructor(e){this.parser=e,this.name=tv.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let s=0,o=t.length;s<o;s++){let o=t[s];o.extensions&&o.extensions[this.name]&&void 0!==o.extensions[this.name].light&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){let t;let s=this.parser,o="light:"+e,A=s.cache.get(o);if(A)return A;let l=s.json,h=l.extensions&&l.extensions[this.name]||{},c=h.lights||[],d=c[e],g=new eS.Ilk(16777215);void 0!==d.color&&g.setRGB(d.color[0],d.color[1],d.color[2],eS.GUF);let p=void 0!==d.range?d.range:0;switch(d.type){case"directional":(t=new eS.Ox3(g)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new eS.cek(g)).distance=p;break;case"spot":(t=new eS.PMe(g)).distance=p,d.spot=d.spot||{},d.spot.innerConeAngle=void 0!==d.spot.innerConeAngle?d.spot.innerConeAngle:0,d.spot.outerConeAngle=void 0!==d.spot.outerConeAngle?d.spot.outerConeAngle:Math.PI/4,t.angle=d.spot.outerConeAngle,t.penumbra=1-d.spot.innerConeAngle/d.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+d.type)}return t.position.set(0,0,0),t.decay=2,assignExtrasToUserData(t,d),void 0!==d.intensity&&(t.intensity=d.intensity),t.name=s.createUniqueName(d.name||"light_"+e),A=Promise.resolve(t),s.cache.add(o,A),A}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){let t=this,s=this.parser,o=s.json,A=o.nodes[e],l=A.extensions&&A.extensions[this.name]||{},h=l.light;return void 0===h?null:this._loadLight(h).then(function(e){return s._getNodeRef(t.cache,h,e)})}};let GLTFMaterialsUnlitExtension=class GLTFMaterialsUnlitExtension{constructor(){this.name=tv.KHR_MATERIALS_UNLIT}getMaterialType(){return eS.vBJ}extendParams(e,t,s){let o=[];e.color=new eS.Ilk(1,1,1),e.opacity=1;let A=t.pbrMetallicRoughness;if(A){if(Array.isArray(A.baseColorFactor)){let t=A.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],eS.GUF),e.opacity=t[3]}void 0!==A.baseColorTexture&&o.push(s.assignTexture(e,"map",A.baseColorTexture,eS.KI_))}return Promise.all(o)}};let GLTFMaterialsEmissiveStrengthExtension=class GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.parser=e,this.name=tv.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let s=this.parser,o=s.json.materials[e];if(!o.extensions||!o.extensions[this.name])return Promise.resolve();let A=o.extensions[this.name].emissiveStrength;return void 0!==A&&(t.emissiveIntensity=A),Promise.resolve()}};let GLTFMaterialsClearcoatExtension=class GLTFMaterialsClearcoatExtension{constructor(e){this.parser=e,this.name=tv.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){let t=this.parser,s=t.json.materials[e];return s.extensions&&s.extensions[this.name]?eS.EJi:null}extendMaterialParams(e,t){let s=this.parser,o=s.json.materials[e];if(!o.extensions||!o.extensions[this.name])return Promise.resolve();let A=[],l=o.extensions[this.name];if(void 0!==l.clearcoatFactor&&(t.clearcoat=l.clearcoatFactor),void 0!==l.clearcoatTexture&&A.push(s.assignTexture(t,"clearcoatMap",l.clearcoatTexture)),void 0!==l.clearcoatRoughnessFactor&&(t.clearcoatRoughness=l.clearcoatRoughnessFactor),void 0!==l.clearcoatRoughnessTexture&&A.push(s.assignTexture(t,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),void 0!==l.clearcoatNormalTexture&&(A.push(s.assignTexture(t,"clearcoatNormalMap",l.clearcoatNormalTexture)),void 0!==l.clearcoatNormalTexture.scale)){let e=l.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new eS.FM8(e,e)}return Promise.all(A)}};let GLTFMaterialsIridescenceExtension=class GLTFMaterialsIridescenceExtension{constructor(e){this.parser=e,this.name=tv.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){let t=this.parser,s=t.json.materials[e];return s.extensions&&s.extensions[this.name]?eS.EJi:null}extendMaterialParams(e,t){let s=this.parser,o=s.json.materials[e];if(!o.extensions||!o.extensions[this.name])return Promise.resolve();let A=[],l=o.extensions[this.name];return void 0!==l.iridescenceFactor&&(t.iridescence=l.iridescenceFactor),void 0!==l.iridescenceTexture&&A.push(s.assignTexture(t,"iridescenceMap",l.iridescenceTexture)),void 0!==l.iridescenceIor&&(t.iridescenceIOR=l.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==l.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=l.iridescenceThicknessMinimum),void 0!==l.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=l.iridescenceThicknessMaximum),void 0!==l.iridescenceThicknessTexture&&A.push(s.assignTexture(t,"iridescenceThicknessMap",l.iridescenceThicknessTexture)),Promise.all(A)}};let GLTFMaterialsSheenExtension=class GLTFMaterialsSheenExtension{constructor(e){this.parser=e,this.name=tv.KHR_MATERIALS_SHEEN}getMaterialType(e){let t=this.parser,s=t.json.materials[e];return s.extensions&&s.extensions[this.name]?eS.EJi:null}extendMaterialParams(e,t){let s=this.parser,o=s.json.materials[e];if(!o.extensions||!o.extensions[this.name])return Promise.resolve();let A=[];t.sheenColor=new eS.Ilk(0,0,0),t.sheenRoughness=0,t.sheen=1;let l=o.extensions[this.name];if(void 0!==l.sheenColorFactor){let e=l.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],eS.GUF)}return void 0!==l.sheenRoughnessFactor&&(t.sheenRoughness=l.sheenRoughnessFactor),void 0!==l.sheenColorTexture&&A.push(s.assignTexture(t,"sheenColorMap",l.sheenColorTexture,eS.KI_)),void 0!==l.sheenRoughnessTexture&&A.push(s.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(A)}};let GLTFMaterialsTransmissionExtension=class GLTFMaterialsTransmissionExtension{constructor(e){this.parser=e,this.name=tv.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){let t=this.parser,s=t.json.materials[e];return s.extensions&&s.extensions[this.name]?eS.EJi:null}extendMaterialParams(e,t){let s=this.parser,o=s.json.materials[e];if(!o.extensions||!o.extensions[this.name])return Promise.resolve();let A=[],l=o.extensions[this.name];return void 0!==l.transmissionFactor&&(t.transmission=l.transmissionFactor),void 0!==l.transmissionTexture&&A.push(s.assignTexture(t,"transmissionMap",l.transmissionTexture)),Promise.all(A)}};let GLTFMaterialsVolumeExtension=class GLTFMaterialsVolumeExtension{constructor(e){this.parser=e,this.name=tv.KHR_MATERIALS_VOLUME}getMaterialType(e){let t=this.parser,s=t.json.materials[e];return s.extensions&&s.extensions[this.name]?eS.EJi:null}extendMaterialParams(e,t){let s=this.parser,o=s.json.materials[e];if(!o.extensions||!o.extensions[this.name])return Promise.resolve();let A=[],l=o.extensions[this.name];t.thickness=void 0!==l.thicknessFactor?l.thicknessFactor:0,void 0!==l.thicknessTexture&&A.push(s.assignTexture(t,"thicknessMap",l.thicknessTexture)),t.attenuationDistance=l.attenuationDistance||1/0;let h=l.attenuationColor||[1,1,1];return t.attenuationColor=new eS.Ilk().setRGB(h[0],h[1],h[2],eS.GUF),Promise.all(A)}};let GLTFMaterialsIorExtension=class GLTFMaterialsIorExtension{constructor(e){this.parser=e,this.name=tv.KHR_MATERIALS_IOR}getMaterialType(e){let t=this.parser,s=t.json.materials[e];return s.extensions&&s.extensions[this.name]?eS.EJi:null}extendMaterialParams(e,t){let s=this.parser,o=s.json.materials[e];if(!o.extensions||!o.extensions[this.name])return Promise.resolve();let A=o.extensions[this.name];return t.ior=void 0!==A.ior?A.ior:1.5,Promise.resolve()}};let GLTFMaterialsSpecularExtension=class GLTFMaterialsSpecularExtension{constructor(e){this.parser=e,this.name=tv.KHR_MATERIALS_SPECULAR}getMaterialType(e){let t=this.parser,s=t.json.materials[e];return s.extensions&&s.extensions[this.name]?eS.EJi:null}extendMaterialParams(e,t){let s=this.parser,o=s.json.materials[e];if(!o.extensions||!o.extensions[this.name])return Promise.resolve();let A=[],l=o.extensions[this.name];t.specularIntensity=void 0!==l.specularFactor?l.specularFactor:1,void 0!==l.specularTexture&&A.push(s.assignTexture(t,"specularIntensityMap",l.specularTexture));let h=l.specularColorFactor||[1,1,1];return t.specularColor=new eS.Ilk().setRGB(h[0],h[1],h[2],eS.GUF),void 0!==l.specularColorTexture&&A.push(s.assignTexture(t,"specularColorMap",l.specularColorTexture,eS.KI_)),Promise.all(A)}};let GLTFMaterialsBumpExtension=class GLTFMaterialsBumpExtension{constructor(e){this.parser=e,this.name=tv.EXT_MATERIALS_BUMP}getMaterialType(e){let t=this.parser,s=t.json.materials[e];return s.extensions&&s.extensions[this.name]?eS.EJi:null}extendMaterialParams(e,t){let s=this.parser,o=s.json.materials[e];if(!o.extensions||!o.extensions[this.name])return Promise.resolve();let A=[],l=o.extensions[this.name];return t.bumpScale=void 0!==l.bumpFactor?l.bumpFactor:1,void 0!==l.bumpTexture&&A.push(s.assignTexture(t,"bumpMap",l.bumpTexture)),Promise.all(A)}};let GLTFMaterialsAnisotropyExtension=class GLTFMaterialsAnisotropyExtension{constructor(e){this.parser=e,this.name=tv.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){let t=this.parser,s=t.json.materials[e];return s.extensions&&s.extensions[this.name]?eS.EJi:null}extendMaterialParams(e,t){let s=this.parser,o=s.json.materials[e];if(!o.extensions||!o.extensions[this.name])return Promise.resolve();let A=[],l=o.extensions[this.name];return void 0!==l.anisotropyStrength&&(t.anisotropy=l.anisotropyStrength),void 0!==l.anisotropyRotation&&(t.anisotropyRotation=l.anisotropyRotation),void 0!==l.anisotropyTexture&&A.push(s.assignTexture(t,"anisotropyMap",l.anisotropyTexture)),Promise.all(A)}};let GLTFTextureBasisUExtension=class GLTFTextureBasisUExtension{constructor(e){this.parser=e,this.name=tv.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,s=t.json,o=s.textures[e];if(!o.extensions||!o.extensions[this.name])return null;let A=o.extensions[this.name],l=t.options.ktx2Loader;if(!l){if(!(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0))return null;throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures")}return t.loadTextureImage(e,A.source,l)}};let GLTFTextureWebPExtension=class GLTFTextureWebPExtension{constructor(e){this.parser=e,this.name=tv.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let t=this.name,s=this.parser,o=s.json,A=o.textures[e];if(!A.extensions||!A.extensions[t])return null;let l=A.extensions[t],h=o.images[l.source],c=s.textureLoader;if(h.uri){let e=s.options.manager.getHandler(h.uri);null!==e&&(c=e)}return this.detectSupport().then(function(A){if(A)return s.loadTextureImage(e,l.source,c);if(o.extensionsRequired&&o.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}};let GLTFTextureAVIFExtension=class GLTFTextureAVIFExtension{constructor(e){this.parser=e,this.name=tv.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){let t=this.name,s=this.parser,o=s.json,A=o.textures[e];if(!A.extensions||!A.extensions[t])return null;let l=A.extensions[t],h=o.images[l.source],c=s.textureLoader;if(h.uri){let e=s.options.manager.getHandler(h.uri);null!==e&&(c=e)}return this.detectSupport().then(function(A){if(A)return s.loadTextureImage(e,l.source,c);if(o.extensionsRequired&&o.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}};let GLTFMeshoptCompression=class GLTFMeshoptCompression{constructor(e){this.name=tv.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,s=t.bufferViews[e];if(!s.extensions||!s.extensions[this.name])return null;{let e=s.extensions[this.name],o=this.parser.getDependency("buffer",e.buffer),A=this.parser.options.meshoptDecoder;if(!A||!A.supported){if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files")}return o.then(function(t){let s=e.byteOffset||0,o=e.byteLength||0,l=e.count,h=e.byteStride,c=new Uint8Array(t,s,o);return A.decodeGltfBufferAsync?A.decodeGltfBufferAsync(l,h,c,e.mode,e.filter).then(function(e){return e.buffer}):A.ready.then(function(){let t=new ArrayBuffer(l*h);return A.decodeGltfBuffer(new Uint8Array(t),l,h,c,e.mode,e.filter),t})})}}};let GLTFMeshGpuInstancing=class GLTFMeshGpuInstancing{constructor(e){this.name=tv.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||void 0===s.mesh)return null;let o=t.meshes[s.mesh];for(let e of o.primitives)if(e.mode!==tS.TRIANGLES&&e.mode!==tS.TRIANGLE_STRIP&&e.mode!==tS.TRIANGLE_FAN&&void 0!==e.mode)return null;let A=s.extensions[this.name],l=A.attributes,h=[],c={};for(let e in l)h.push(this.parser.getDependency("accessor",l[e]).then(t=>(c[e]=t,c[e])));return h.length<1?null:(h.push(this.parser.createNodeMesh(e)),Promise.all(h).then(e=>{let t=e.pop(),s=t.isGroup?t.children:[t],o=e[0].count,A=[];for(let e of s){let t=new eS.yGw,s=new eS.Pa4,l=new eS._fP,h=new eS.Pa4(1,1,1),d=new eS.SPe(e.geometry,e.material,o);for(let e=0;e<o;e++)c.TRANSLATION&&s.fromBufferAttribute(c.TRANSLATION,e),c.ROTATION&&l.fromBufferAttribute(c.ROTATION,e),c.SCALE&&h.fromBufferAttribute(c.SCALE,e),d.setMatrixAt(e,t.compose(s,l,h));for(let t in c)if("_COLOR_0"===t){let e=c[t];d.instanceColor=new eS.lb7(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,c[t]);eS.Tme.prototype.copy.call(d,e),this.parser.assignFinalMaterial(d),A.push(d)}return t.isGroup?(t.clear(),t.add(...A),t):A[0]}))}};let tQ="glTF",tx={JSON:1313821514,BIN:5130562};let GLTFBinaryExtension=class GLTFBinaryExtension{constructor(e){this.name=tv.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,12),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==tQ)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");let o=this.header.length-12,A=new DataView(e,12),l=0;for(;l<o;){let t=A.getUint32(l,!0);l+=4;let o=A.getUint32(l,!0);if(l+=4,o===tx.JSON){let o=new Uint8Array(e,12+l,t);this.content=s.decode(o)}else if(o===tx.BIN){let s=12+l;this.body=e.slice(s,s+t)}l+=t}if(null===this.content)throw Error("THREE.GLTFLoader: JSON content not found.")}};let GLTFDracoMeshCompressionExtension=class GLTFDracoMeshCompressionExtension{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=tv.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let s=this.json,o=this.dracoLoader,A=e.extensions[this.name].bufferView,l=e.extensions[this.name].attributes,h={},c={},d={};for(let e in l){let t=tL[e]||e.toLowerCase();h[t]=l[e]}for(let t in e.attributes){let o=tL[t]||t.toLowerCase();if(void 0!==l[t]){let A=s.accessors[e.attributes[t]],l=tT[A.componentType];d[o]=l.name,c[o]=!0===A.normalized}}return t.getDependency("bufferView",A).then(function(e){return new Promise(function(t,s){o.decodeDracoFile(e,function(e){for(let t in e.attributes){let s=e.attributes[t],o=c[t];void 0!==o&&(s.normalized=o)}t(e)},h,d,eS.GUF,s)})})}};let GLTFTextureTransformExtension=class GLTFTextureTransformExtension{constructor(){this.name=tv.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}};let GLTFMeshQuantizationExtension=class GLTFMeshQuantizationExtension{constructor(){this.name=tv.KHR_MESH_QUANTIZATION}};let GLTFCubicSplineInterpolant=class GLTFCubicSplineInterpolant extends eS._C8{constructor(e,t,s,o){super(e,t,s,o)}copySampleValue_(e){let t=this.resultBuffer,s=this.sampleValues,o=this.valueSize,A=e*o*3+o;for(let e=0;e!==o;e++)t[e]=s[A+e];return t}interpolate_(e,t,s,o){let A=this.resultBuffer,l=this.sampleValues,h=this.valueSize,c=2*h,d=3*h,g=o-t,p=(s-t)/g,m=p*p,I=m*p,f=e*d,E=f-d,C=-2*I+3*m,B=I-m,y=1-C,Q=B-m+p;for(let e=0;e!==h;e++){let t=l[E+e+h],s=l[E+e+c]*g,o=l[f+e+h],d=l[f+e]*g;A[e]=y*t+Q*s+C*o+B*d}return A}};let tb=new eS._fP;let GLTFCubicSplineQuaternionInterpolant=class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant{interpolate_(e,t,s,o){let A=super.interpolate_(e,t,s,o);return tb.fromArray(A).normalize().toArray(A),A}};let tS={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},tT={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},tM={9728:eS.TyD,9729:eS.wem,9984:eS.YLQ,9985:eS.qyh,9986:eS.aH4,9987:eS.D1R},tR={33071:eS.uWy,33648:eS.OoA,10497:eS.rpg},tD={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},tL={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"},tF={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},t_={CUBICSPLINE:void 0,LINEAR:eS.NMF,STEP:eS.Syv},tk={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function addUnknownExtensionsToUserData(e,t,s){for(let o in s.extensions)void 0===e[o]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[o]=s.extensions[o])}function assignExtrasToUserData(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 createAttributesKey(e){let t="",s=Object.keys(e).sort();for(let o=0,A=s.length;o<A;o++)t+=s[o]+":"+e[s[o]]+";";return t}function getNormalizedComponentScale(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 Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}let tU=new eS.yGw;let GLTFParser=class GLTFParser{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new GLTFRegistry,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,o=!1,A=-1;"undefined"!=typeof navigator&&(s=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),A=(o=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||s||o&&A<98?this.textureLoader=new eS.dpR(this.options.manager):this.textureLoader=new eS.QRU(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new eS.hH6(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){let s=this,o=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([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(t){let l={scene:t[0][o.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:o.asset,parser:s,userData:{}};return addUnknownExtensionsToUserData(A,l,o),assignExtrasToUserData(l,o),Promise.all(s._invokeAll(function(e){return e.afterRoot&&e.afterRoot(l)})).then(function(){e(l)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let s=0,o=t.length;s<o;s++){let o=t[s].joints;for(let t=0,s=o.length;t<s;t++)e[o[t]].isBone=!0}for(let t=0,o=e.length;t<o;t++){let o=e[t];void 0!==o.mesh&&(this._addNodeRef(this.meshCache,o.mesh),void 0!==o.skin&&(s[o.mesh].isSkinnedMesh=!0)),void 0!==o.camera&&this._addNodeRef(this.cameraCache,o.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,s){if(e.refs[t]<=1)return s;let o=s.clone(),updateMappings=(e,t)=>{let s=this.associations.get(e);for(let[o,A]of(null!=s&&this.associations.set(t,s),e.children.entries()))updateMappings(A,t.children[o])};return updateMappings(s,o),o.name+="_instance_"+e.uses[t]++,o}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){let o=e(t[s]);if(o)return o}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let s=[];for(let o=0;o<t.length;o++){let A=e(t[o]);A&&s.push(A)}return s}getDependency(e,t){let s=e+":"+t,o=this.cache.get(s);if(!o){switch(e){case"scene":o=this.loadScene(t);break;case"node":o=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":o=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":o=this.loadAccessor(t);break;case"bufferView":o=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":o=this.loadBuffer(t);break;case"material":o=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":o=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":o=this.loadSkin(t);break;case"animation":o=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":o=this.loadCamera(t);break;default:if(!(o=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)})))throw Error("Unknown type: "+e)}this.cache.add(s,o)}return o}getDependencies(e){let t=this.cache.get(e);if(!t){let s=this,o=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(o.map(function(t,o){return s.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],s=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[tv.KHR_BINARY_GLTF].body);let o=this.options;return new Promise(function(e,A){s.load(eS.Zp0.resolveURL(t.uri,o.path),e,void 0,function(){A(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){let s=t.byteLength||0,o=t.byteOffset||0;return e.slice(o,o+s)})}loadAccessor(e){let t=this,s=this.json,o=this.json.accessors[e];if(void 0===o.bufferView&&void 0===o.sparse){let e=tD[o.type],t=tT[o.componentType],s=!0===o.normalized,A=new t(o.count*e);return Promise.resolve(new eS.TlE(A,e,s))}let A=[];return void 0!==o.bufferView?A.push(this.getDependency("bufferView",o.bufferView)):A.push(null),void 0!==o.sparse&&(A.push(this.getDependency("bufferView",o.sparse.indices.bufferView)),A.push(this.getDependency("bufferView",o.sparse.values.bufferView))),Promise.all(A).then(function(e){let A,l;let h=e[0],c=tD[o.type],d=tT[o.componentType],g=d.BYTES_PER_ELEMENT,p=g*c,m=o.byteOffset||0,I=void 0!==o.bufferView?s.bufferViews[o.bufferView].byteStride:void 0,f=!0===o.normalized;if(I&&I!==p){let e=Math.floor(m/I),s="InterleavedBuffer:"+o.bufferView+":"+o.componentType+":"+e+":"+o.count,p=t.cache.get(s);p||(A=new d(h,e*I,o.count*I/g),p=new eS.vpT(A,I/g),t.cache.add(s,p)),l=new eS.kB5(p,c,m%I/g,f)}else A=null===h?new d(o.count*c):new d(h,m,o.count*c),l=new eS.TlE(A,c,f);if(void 0!==o.sparse){let t=tD.SCALAR,s=tT[o.sparse.indices.componentType],A=o.sparse.indices.byteOffset||0,g=o.sparse.values.byteOffset||0,p=new s(e[1],A,o.sparse.count*t),m=new d(e[2],g,o.sparse.count*c);null!==h&&(l=new eS.TlE(l.array.slice(),l.itemSize,l.normalized));for(let e=0,t=p.length;e<t;e++){let t=p[e];if(l.setX(t,m[e*c]),c>=2&&l.setY(t,m[e*c+1]),c>=3&&l.setZ(t,m[e*c+2]),c>=4&&l.setW(t,m[e*c+3]),c>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return l})}loadTexture(e){let t=this.json,s=this.options,o=t.textures[e],A=o.source,l=t.images[A],h=this.textureLoader;if(l.uri){let e=s.manager.getHandler(l.uri);null!==e&&(h=e)}return this.loadTextureImage(e,A,h)}loadTextureImage(e,t,s){let o=this,A=this.json,l=A.textures[e],h=A.images[t],c=(h.uri||h.bufferView)+":"+l.sampler;if(this.textureCache[c])return this.textureCache[c];let d=this.loadImageSource(t,s).then(function(t){t.flipY=!1,t.name=l.name||h.name||"",""===t.name&&"string"==typeof h.uri&&!1===h.uri.startsWith("data:image/")&&(t.name=h.uri);let s=A.samplers||{},c=s[l.sampler]||{};return t.magFilter=tM[c.magFilter]||eS.wem,t.minFilter=tM[c.minFilter]||eS.D1R,t.wrapS=tR[c.wrapS]||eS.rpg,t.wrapT=tR[c.wrapT]||eS.rpg,o.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[c]=d,d}loadImageSource(e,t){let s=this.json,o=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let A=s.images[e],l=self.URL||self.webkitURL,h=A.uri||"",c=!1;if(void 0!==A.bufferView)h=this.getDependency("bufferView",A.bufferView).then(function(e){c=!0;let t=new Blob([e],{type:A.mimeType});return h=l.createObjectURL(t)});else if(void 0===A.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let d=Promise.resolve(h).then(function(e){return new Promise(function(s,A){let l=s;!0===t.isImageBitmapLoader&&(l=function(e){let t=new eS.xEZ(e);t.needsUpdate=!0,s(t)}),t.load(eS.Zp0.resolveURL(e,o.path),l,void 0,A)})}).then(function(e){var t;return!0===c&&l.revokeObjectURL(h),e.userData.mimeType=A.mimeType||((t=A.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":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",h),e});return this.sourceCache[e]=d,d}assignTexture(e,t,s,o){let A=this;return this.getDependency("texture",s.index).then(function(l){if(!l)return null;if(void 0!==s.texCoord&&s.texCoord>0&&((l=l.clone()).channel=s.texCoord),A.extensions[tv.KHR_TEXTURE_TRANSFORM]){let e=void 0!==s.extensions?s.extensions[tv.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=A.associations.get(l);l=A.extensions[tv.KHR_TEXTURE_TRANSFORM].extendTexture(l,e),A.associations.set(l,t)}}return void 0!==o&&(l.colorSpace=o),e[t]=l,l})}assignFinalMaterial(e){let t=e.geometry,s=e.material,o=void 0===t.attributes.tangent,A=void 0!==t.attributes.color,l=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+s.uuid,t=this.cache.get(e);t||(t=new eS.UY4,eS.F5T.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,t.sizeAttenuation=!1,this.cache.add(e,t)),s=t}else if(e.isLine){let e="LineBasicMaterial:"+s.uuid,t=this.cache.get(e);t||(t=new eS.nls,eS.F5T.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,this.cache.add(e,t)),s=t}if(o||A||l){let e="ClonedMaterial:"+s.uuid+":";o&&(e+="derivative-tangents:"),A&&(e+="vertex-colors:"),l&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=s.clone(),A&&(t.vertexColors=!0),l&&(t.flatShading=!0),o&&(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 eS.Wid}loadMaterial(e){let t;let s=this,o=this.json,A=this.extensions,l=o.materials[e],h={},c=l.extensions||{},d=[];if(c[tv.KHR_MATERIALS_UNLIT]){let e=A[tv.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),d.push(e.extendParams(h,l,s))}else{let o=l.pbrMetallicRoughness||{};if(h.color=new eS.Ilk(1,1,1),h.opacity=1,Array.isArray(o.baseColorFactor)){let e=o.baseColorFactor;h.color.setRGB(e[0],e[1],e[2],eS.GUF),h.opacity=e[3]}void 0!==o.baseColorTexture&&d.push(s.assignTexture(h,"map",o.baseColorTexture,eS.KI_)),h.metalness=void 0!==o.metallicFactor?o.metallicFactor:1,h.roughness=void 0!==o.roughnessFactor?o.roughnessFactor:1,void 0!==o.metallicRoughnessTexture&&(d.push(s.assignTexture(h,"metalnessMap",o.metallicRoughnessTexture)),d.push(s.assignTexture(h,"roughnessMap",o.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),d.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,h)})))}!0===l.doubleSided&&(h.side=eS.ehD);let g=l.alphaMode||tk.OPAQUE;if(g===tk.BLEND?(h.transparent=!0,h.depthWrite=!1):(h.transparent=!1,g===tk.MASK&&(h.alphaTest=void 0!==l.alphaCutoff?l.alphaCutoff:.5)),void 0!==l.normalTexture&&t!==eS.vBJ&&(d.push(s.assignTexture(h,"normalMap",l.normalTexture)),h.normalScale=new eS.FM8(1,1),void 0!==l.normalTexture.scale)){let e=l.normalTexture.scale;h.normalScale.set(e,e)}if(void 0!==l.occlusionTexture&&t!==eS.vBJ&&(d.push(s.assignTexture(h,"aoMap",l.occlusionTexture)),void 0!==l.occlusionTexture.strength&&(h.aoMapIntensity=l.occlusionTexture.strength)),void 0!==l.emissiveFactor&&t!==eS.vBJ){let e=l.emissiveFactor;h.emissive=new eS.Ilk().setRGB(e[0],e[1],e[2],eS.GUF)}return void 0!==l.emissiveTexture&&t!==eS.vBJ&&d.push(s.assignTexture(h,"emissiveMap",l.emissiveTexture,eS.KI_)),Promise.all(d).then(function(){let o=new t(h);return l.name&&(o.name=l.name),assignExtrasToUserData(o,l),s.associations.set(o,{materials:e}),l.extensions&&addUnknownExtensionsToUserData(A,o,l),o})}createUniqueName(e){let t=eS.iUV.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,s=this.extensions,o=this.primitiveCache,A=[];for(let l=0,h=e.length;l<h;l++){let h=e[l],c=function(e){let t;let s=e.extensions&&e.extensions[tv.KHR_DRACO_MESH_COMPRESSION];if(t=s?"draco:"+s.bufferView+":"+s.indices+":"+createAttributesKey(s.attributes):e.indices+":"+createAttributesKey(e.attributes)+":"+e.mode,void 0!==e.targets)for(let s=0,o=e.targets.length;s<o;s++)t+=":"+createAttributesKey(e.targets[s]);return t}(h),d=o[c];if(d)A.push(d.promise);else{let e;e=h.extensions&&h.extensions[tv.KHR_DRACO_MESH_COMPRESSION]?function(e){return s[tv.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(s){return addPrimitiveAttributes(s,e,t)})}(h):addPrimitiveAttributes(new eS.u9r,h,t),o[c]={primitive:h,promise:e},A.push(e)}}return Promise.all(A)}loadMesh(e){let t=this,s=this.json,o=this.extensions,A=s.meshes[e],l=A.primitives,h=[];for(let e=0,t=l.length;e<t;e++){var c;let t=void 0===l[e].material?(void 0===(c=this.cache).DefaultMaterial&&(c.DefaultMaterial=new eS.Wid({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:eS.Wl3})),c.DefaultMaterial):this.getDependency("material",l[e].material);h.push(t)}return h.push(t.loadGeometries(l)),Promise.all(h).then(function(s){let h=s.slice(0,s.length-1),c=s[s.length-1],d=[];for(let s=0,g=c.length;s<g;s++){let g;let p=c[s],m=l[s],I=h[s];if(m.mode===tS.TRIANGLES||m.mode===tS.TRIANGLE_STRIP||m.mode===tS.TRIANGLE_FAN||void 0===m.mode)!0===(g=!0===A.isSkinnedMesh?new eS.TUv(p,I):new eS.Kj0(p,I)).isSkinnedMesh&&g.normalizeSkinWeights(),m.mode===tS.TRIANGLE_STRIP?g.geometry=toTrianglesDrawMode(g.geometry,eS.UlW):m.mode===tS.TRIANGLE_FAN&&(g.geometry=toTrianglesDrawMode(g.geometry,eS.z$h));else if(m.mode===tS.LINES)g=new eS.ejS(p,I);else if(m.mode===tS.LINE_STRIP)g=new eS.x12(p,I);else if(m.mode===tS.LINE_LOOP)g=new eS.blk(p,I);else if(m.mode===tS.POINTS)g=new eS.woe(p,I);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(g.geometry.morphAttributes).length>0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let s=0,o=t.weights.length;s<o;s++)e.morphTargetInfluences[s]=t.weights[s];if(t.extras&&Array.isArray(t.extras.targetNames)){let s=t.extras.targetNames;if(e.morphTargetInfluences.length===s.length){e.morphTargetDictionary={};for(let t=0,o=s.length;t<o;t++)e.morphTargetDictionary[s[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}(g,A),g.name=t.createUniqueName(A.name||"mesh_"+e),assignExtrasToUserData(g,A),m.extensions&&addUnknownExtensionsToUserData(o,g,m),t.assignFinalMaterial(g),d.push(g)}for(let s=0,o=d.length;s<o;s++)t.associations.set(d[s],{meshes:e,primitives:s});if(1===d.length)return A.extensions&&addUnknownExtensionsToUserData(o,d[0],A),d[0];let g=new eS.ZAu;A.extensions&&addUnknownExtensionsToUserData(o,g,A),t.associations.set(g,{meshes:e});for(let e=0,t=d.length;e<t;e++)g.add(d[e]);return g})}loadCamera(e){let t;let s=this.json.cameras[e],o=s[s.type];if(!o){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return"perspective"===s.type?t=new eS.cPb(eS.M8C.radToDeg(o.yfov),o.aspectRatio||1,o.znear||1,o.zfar||2e6):"orthographic"===s.type&&(t=new eS.iKG(-o.xmag,o.xmag,o.ymag,-o.ymag,o.znear,o.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),assignExtrasToUserData(t,s),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],s=[];for(let e=0,o=t.joints.length;e<o;e++)s.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(e){let s=e.pop(),o=[],A=[];for(let l=0,h=e.length;l<h;l++){let h=e[l];if(h){o.push(h);let e=new eS.yGw;null!==s&&e.fromArray(s.array,16*l),A.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new eS.OdW(o,A)})}loadAnimation(e){let t=this.json,s=this,o=t.animations[e],A=o.name?o.name:"animation_"+e,l=[],h=[],c=[],d=[],g=[];for(let e=0,t=o.channels.length;e<t;e++){let t=o.channels[e],s=o.samplers[t.sampler],A=t.target,p=A.node,m=void 0!==o.parameters?o.parameters[s.input]:s.input,I=void 0!==o.parameters?o.parameters[s.output]:s.output;void 0!==A.node&&(l.push(this.getDependency("node",p)),h.push(this.getDependency("accessor",m)),c.push(this.getDependency("accessor",I)),d.push(s),g.push(A))}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(c),Promise.all(d),Promise.all(g)]).then(function(e){let t=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=[];for(let e=0,A=t.length;e<A;e++){let A=t[e],g=o[e],p=l[e],m=h[e],I=c[e];if(void 0===A)continue;A.updateMatrix&&A.updateMatrix();let f=s._createAnimationTracks(A,g,p,m,I);if(f)for(let e=0;e<f.length;e++)d.push(f[e])}return new eS.m7l(A,void 0,d)})}createNodeMesh(e){let t=this.json,s=this,o=t.nodes[e];return void 0===o.mesh?null:s.getDependency("mesh",o.mesh).then(function(e){let t=s._getNodeRef(s.meshCache,o.mesh,e);return void 0!==o.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,s=o.weights.length;t<s;t++)e.morphTargetInfluences[t]=o.weights[t]}),t})}loadNode(e){let t=this.json,s=t.nodes[e],o=this._loadNodeShallow(e),A=[],l=s.children||[];for(let e=0,t=l.length;e<t;e++)A.push(this.getDependency("node",l[e]));let h=void 0===s.skin?Promise.resolve(null):this.getDependency("skin",s.skin);return Promise.all([o,Promise.all(A),h]).then(function(e){let t=e[0],s=e[1],o=e[2];null!==o&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(o,tU)});for(let e=0,o=s.length;e<o;e++)t.add(s[e]);return t})}_loadNodeShallow(e){let t=this.json,s=this.extensions,o=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];let A=t.nodes[e],l=A.name?o.createUniqueName(A.name):"",h=[],c=o._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return c&&h.push(c),void 0!==A.camera&&h.push(o.getDependency("camera",A.camera).then(function(e){return o._getNodeRef(o.cameraCache,A.camera,e)})),o._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){h.push(e)}),this.nodeCache[e]=Promise.all(h).then(function(t){let h;if((h=!0===A.isBone?new eS.N$j:t.length>1?new eS.ZAu:1===t.length?t[0]:new eS.Tme)!==t[0])for(let e=0,s=t.length;e<s;e++)h.add(t[e]);if(A.name&&(h.userData.name=A.name,h.name=l),assignExtrasToUserData(h,A),A.extensions&&addUnknownExtensionsToUserData(s,h,A),void 0!==A.matrix){let e=new eS.yGw;e.fromArray(A.matrix),h.applyMatrix4(e)}else void 0!==A.translation&&h.position.fromArray(A.translation),void 0!==A.rotation&&h.quaternion.fromArray(A.rotation),void 0!==A.scale&&h.scale.fromArray(A.scale);return o.associations.has(h)||o.associations.set(h,{}),o.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){let t=this.extensions,s=this.json.scenes[e],o=this,A=new eS.ZAu;s.name&&(A.name=o.createUniqueName(s.name)),assignExtrasToUserData(A,s),s.extensions&&addUnknownExtensionsToUserData(t,A,s);let l=s.nodes||[],h=[];for(let e=0,t=l.length;e<t;e++)h.push(o.getDependency("node",l[e]));return Promise.all(h).then(function(e){for(let t=0,s=e.length;t<s;t++)A.add(e[t]);return o.associations=(e=>{let t=new Map;for(let[e,s]of o.associations)(e instanceof eS.F5T||e instanceof eS.xEZ)&&t.set(e,s);return e.traverse(e=>{let s=o.associations.get(e);null!=s&&t.set(e,s)}),t})(A),A})}_createAnimationTracks(e,t,s,o,A){let l;let h=[],c=e.name?e.name:e.uuid,d=[];switch(tF[A.path]===tF.weights?e.traverse(function(e){e.morphTargetInfluences&&d.push(e.name?e.name:e.uuid)}):d.push(c),tF[A.path]){case tF.weights:l=eS.dUE;break;case tF.rotation:l=eS.iLg;break;case tF.position:case tF.scale:l=eS.yC1;break;default:l=1===s.itemSize?eS.dUE:eS.yC1}let g=void 0!==o.interpolation?t_[o.interpolation]:eS.NMF,p=this._getArrayFromAccessor(s);for(let e=0,s=d.length;e<s;e++){let s=new l(d[e]+"."+tF[A.path],t.array,p,g);"CUBICSPLINE"===o.interpolation&&this._createCubicSplineTrackInterpolant(s),h.push(s)}return h}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=getNormalizedComponentScale(t.constructor),s=new Float32Array(t.length);for(let o=0,A=t.length;o<A;o++)s[o]=t[o]*e;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){let t=this instanceof eS.iLg?GLTFCubicSplineQuaternionInterpolant:GLTFCubicSplineInterpolant;return new t(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}};function addPrimitiveAttributes(e,t,s){let o=t.attributes,A=[];for(let t in o){let l=tL[t]||t.toLowerCase();l in e.attributes||A.push(function(t,o){return s.getDependency("accessor",t).then(function(t){e.setAttribute(o,t)})}(o[t],l))}if(void 0!==t.indices&&!e.index){let o=s.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});A.push(o)}return eS.epp.workingColorSpace!==eS.GUF&&"COLOR_0"in o&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${eS.epp.workingColorSpace}" not supported.`),assignExtrasToUserData(e,t),!function(e,t,s){let o=t.attributes,A=new eS.ZzF;if(void 0===o.POSITION)return;{let e=s.json.accessors[o.POSITION],t=e.min,l=e.max;if(void 0!==t&&void 0!==l){if(A.set(new eS.Pa4(t[0],t[1],t[2]),new eS.Pa4(l[0],l[1],l[2])),e.normalized){let t=getNormalizedComponentScale(tT[e.componentType]);A.min.multiplyScalar(t),A.max.multiplyScalar(t)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}let l=t.targets;if(void 0!==l){let e=new eS.Pa4,t=new eS.Pa4;for(let o=0,A=l.length;o<A;o++){let A=l[o];if(void 0!==A.POSITION){let o=s.json.accessors[A.POSITION],l=o.min,h=o.max;if(void 0!==l&&void 0!==h){if(t.setX(Math.max(Math.abs(l[0]),Math.abs(h[0]))),t.setY(Math.max(Math.abs(l[1]),Math.abs(h[1]))),t.setZ(Math.max(Math.abs(l[2]),Math.abs(h[2]))),o.normalized){let e=getNormalizedComponentScale(tT[o.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}A.expandByVector(e)}e.boundingBox=A;let h=new eS.aLr;A.getCenter(h.center),h.radius=A.min.distanceTo(A.max)/2,e.boundingSphere=h}(e,t,s),Promise.all(A).then(function(){return void 0!==t.targets?function(e,t,s){let o=!1,A=!1,l=!1;for(let e=0,s=t.length;e<s;e++){let s=t[e];if(void 0!==s.POSITION&&(o=!0),void 0!==s.NORMAL&&(A=!0),void 0!==s.COLOR_0&&(l=!0),o&&A&&l)break}if(!o&&!A&&!l)return Promise.resolve(e);let h=[],c=[],d=[];for(let g=0,p=t.length;g<p;g++){let p=t[g];if(o){let t=void 0!==p.POSITION?s.getDependency("accessor",p.POSITION):e.attributes.position;h.push(t)}if(A){let t=void 0!==p.NORMAL?s.getDependency("accessor",p.NORMAL):e.attributes.normal;c.push(t)}if(l){let t=void 0!==p.COLOR_0?s.getDependency("accessor",p.COLOR_0):e.attributes.color;d.push(t)}}return Promise.all([Promise.all(h),Promise.all(c),Promise.all(d)]).then(function(t){let s=t[0],h=t[1],c=t[2];return o&&(e.morphAttributes.position=s),A&&(e.morphAttributes.normal=h),l&&(e.morphAttributes.color=c),e.morphTargetsRelative=!0,e})}(e,t.targets,s):e})}let WorkerPool=class WorkerPool{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){let 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){let s=this.workersResolve[e];if(s&&s(t),this.queue.length){let{resolve:t,msg:s,transfer:o}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(s,o)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(s=>{let o=this._getIdleWorker();-1!==o?(this._initWorker(o),this.workerStatus|=1<<o,this.workersResolve[o]=s,this.workers[o].postMessage(e,t)):this.queue.push({resolve:s,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}};var tG=s(1876).Buffer;let Si=class Si{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize: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:[]}],this.keyValue={},this.globalData=null}};let Ii=class Ii{constructor(e,t,s,o){this._dataView=new DataView(e.buffer,e.byteOffset+t,s),this._littleEndian=o,this._offset=0}_nextUint8(){let e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){let e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){let e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){let e=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){let e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){let s=this._offset,o=0;for(;this._dataView.getUint8(this._offset)!==t&&o<e;)o++,this._offset++;return o<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+s,o)}};new Uint8Array([0]);let tN=[171,75,84,88,32,50,48,187,13,10,26,10];function Ei(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):tG.from(e).toString("utf8")}var tP=s(1876).Buffer;let tO={env:{emscripten_notify_memory_growth:function(e){l=new Uint8Array(A.exports.memory.buffer)}}};let zstddec_module_Q=class zstddec_module_Q{init(){return o||(o="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+tH).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,tO)).then(this._init):WebAssembly.instantiate(tP.from(tH,"base64"),tO).then(this._init))}_init(e){A=e.instance,tO.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!A)throw Error("ZSTDDecoder: Await .init() before decoding.");let s=e.byteLength,o=A.exports.malloc(s);l.set(e,o),t=t||Number(A.exports.ZSTD_findDecompressedSize(o,s));let h=A.exports.malloc(t),c=A.exports.ZSTD_decompress(h,t,o,s),d=l.slice(h,h+c);return A.exports.free(o),A.exports.free(h),d}};let tH="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/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF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EAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgt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hqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBC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gIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQA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HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",tV=new WeakMap,tq=0;let KTX2Loader=class KTX2Loader extends eS.aNw{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new WorkerPool,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}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:!1,etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:!1,pvrtcSupported:!1}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),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")},e.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1)),this}init(){if(!this.transcoderPending){let e=new eS.hH6(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);let t=e.loadAsync("basis_transcoder.js"),s=new eS.hH6(this.manager);s.setPath(this.transcoderPath),s.setResponseType("arraybuffer"),s.setWithCredentials(this.withCredentials);let o=s.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,o]).then(([e,t])=>{let s=KTX2Loader.BasisWorker.toString(),o=["/* constants */","let _EngineFormat = "+JSON.stringify(KTX2Loader.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(KTX2Loader.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(KTX2Loader.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([o])),this.transcoderBinary=t,this.workerPool.setWorkerCreator(()=>{let e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e})}),tq>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),tq++}return this.transcoderPending}load(e,t,s,o){if(null===this.workerConfig)throw Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");let A=new eS.hH6(this.manager);A.setResponseType("arraybuffer"),A.setWithCredentials(this.withCredentials),A.load(e,e=>{if(tV.has(e)){let s=tV.get(e);return s.promise.then(t).catch(o)}this._createTexture(e).then(e=>t?t(e):null).catch(o)},s,o)}_createTextureFrom(e,t){let s;let{faces:o,width:A,height:l,format:h,type:c,error:d,dfdFlags:g}=e;if("error"===c)return Promise.reject(d);if(6===t.faceCount)s=new eS.qVC(o,h,eS.ywz);else{let e=o[0].mipmaps;s=t.layerCount>1?new eS.Z_g(e,A,l,t.layerCount,h,eS.ywz):new eS.EB7(e,A,l,h,eS.ywz)}return s.minFilter=1===o[0].mipmaps.length?eS.wem:eS.D1R,s.magFilter=eS.wem,s.generateMipmaps=!1,s.needsUpdate=!0,s.colorSpace=parseColorSpace(t),s.premultiplyAlpha=!!(1&g),s}async _createTexture(e,t={}){let s=function(e){let t=new Uint8Array(e.buffer,e.byteOffset,tN.length);if(t[0]!==tN[0]||t[1]!==tN[1]||t[2]!==tN[2]||t[3]!==tN[3]||t[4]!==tN[4]||t[5]!==tN[5]||t[6]!==tN[6]||t[7]!==tN[7]||t[8]!==tN[8]||t[9]!==tN[9]||t[10]!==tN[10]||t[11]!==tN[11])throw Error("Missing KTX 2.0 identifier.");let s=new Si,o=17*Uint32Array.BYTES_PER_ELEMENT,A=new Ii(e,tN.length,o,!0);s.vkFormat=A._nextUint32(),s.typeSize=A._nextUint32(),s.pixelWidth=A._nextUint32(),s.pixelHeight=A._nextUint32(),s.pixelDepth=A._nextUint32(),s.layerCount=A._nextUint32(),s.faceCount=A._nextUint32();let l=A._nextUint32();s.supercompressionScheme=A._nextUint32();let h=A._nextUint32(),c=A._nextUint32(),d=A._nextUint32(),g=A._nextUint32(),p=A._nextUint64(),m=A._nextUint64(),I=new Ii(e,tN.length+o,3*l*8,!0);for(let t=0;t<l;t++)s.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+I._nextUint64(),I._nextUint64()),uncompressedByteLength:I._nextUint64()});let f=new Ii(e,h,c,!0),E={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},C=(E.descriptorBlockSize/4-6)/4;for(let e=0;e<C;e++){let t={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=f._nextInt32(),t.sampleUpper=f._nextInt32()):(t.sampleLower=f._nextUint32(),t.sampleUpper=f._nextUint32()),E.samples[e]=t}s.dataFormatDescriptor.length=0,s.dataFormatDescriptor.push(E);let B=new Ii(e,d,g,!0);for(;B._offset<g;){let e=B._nextUint32(),t=B._scan(e),o=Ei(t),A=B._scan(e-t.byteLength);s.keyValue[o]=o.match(/^ktx/i)?Ei(A):A,B._offset%4&&B._skip(4-B._offset%4)}if(m<=0)return s;let y=new Ii(e,p,m,!0),Q=y._nextUint16(),x=y._nextUint16(),b=y._nextUint32(),T=y._nextUint32(),F=y._nextUint32(),_=y._nextUint32(),U=[];for(let e=0;e<l;e++)U.push({imageFlags:y._nextUint32(),rgbSliceByteOffset:y._nextUint32(),rgbSliceByteLength:y._nextUint32(),alphaSliceByteOffset:y._nextUint32(),alphaSliceByteLength:y._nextUint32()});let G=p+y._offset,O=G+b,q=O+T,K=q+F,J=new Uint8Array(e.buffer,e.byteOffset+G,b),Y=new Uint8Array(e.buffer,e.byteOffset+O,T),j=new Uint8Array(e.buffer,e.byteOffset+q,F),W=new Uint8Array(e.buffer,e.byteOffset+K,_);return s.globalData={endpointCount:Q,selectorCount:x,imageDescs:U,endpointsData:J,selectorsData:Y,tablesData:j,extendedData:W},s}(new Uint8Array(e));if(0!==s.vkFormat)return createRawTexture(s);let o=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:t},[e])).then(e=>this._createTextureFrom(e.data,s));return tV.set(e,{promise:o}),o}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),tq--,this}};KTX2Loader.BasisFormat={ETC1S:0,UASTC_4x4:1},KTX2Loader.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},KTX2Loader.EngineFormat={RGBAFormat:eS.wk1,RGBA_ASTC_4x4_Format:eS.ptH,RGBA_BPTC_Format:eS.bsb,RGBA_ETC2_EAC_Format:eS.ekQ,RGBA_PVRTC_4BPPV1_Format:eS.eaV,RGBA_S3TC_DXT5_Format:eS.ILR,RGB_ETC1_Format:eS.fto,RGB_ETC2_Format:eS.l0P,RGB_PVRTC_4BPPV1_Format:eS._AM,RGB_S3TC_DXT1_Format:eS.wuA},KTX2Loader.BasisWorker=function(){let e,t,s;let o=_EngineFormat,A=_TranscoderFormat,l=_BasisFormat;self.addEventListener("message",function(h){let g=h.data;switch(g.type){case"init":var p;e=g.config,p=g.transcoderBinary,t=new Promise(e=>{s={wasmBinary:p,onRuntimeInitialized:e},BASIS(s)}).then(()=>{s.initializeBasis(),void 0===s.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")});break;case"transcode":t.then(()=>{try{let{faces:t,buffers:h,width:p,height:m,hasAlpha:I,format:f,dfdFlags:E}=function(t){let h=new s.KTX2File(new Uint8Array(t));function cleanup(){h.close(),h.delete()}if(!h.isValid())throw cleanup(),Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");let g=h.isUASTC()?l.UASTC_4x4:l.ETC1S,p=h.getWidth(),m=h.getHeight(),I=h.getLayers()||1,f=h.getLevels(),E=h.getFaces(),C=h.getHasAlpha(),B=h.getDFDFlags(),{transcoderFormat:y,engineFormat:Q}=function(t,s,h,g){let p;let m=t===l.ETC1S?c:d;for(let o=0;o<m.length;o++){let A=m[o];if(e[A.if]&&A.basisFormat.includes(t)&&(!g||!(A.transcoderFormat.length<2))&&(!A.needsPowerOfTwo||isPowerOfTwo(s)&&isPowerOfTwo(h)))return{transcoderFormat:A.transcoderFormat[g?1:0],engineFormat:A.engineFormat[g?1:0]}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),{transcoderFormat:A.RGBA32,engineFormat:o.RGBAFormat}}(g,p,m,C);if(!p||!m||!f)throw cleanup(),Error("THREE.KTX2Loader: Invalid texture");if(!h.startTranscoding())throw cleanup(),Error("THREE.KTX2Loader: .startTranscoding failed");let x=[],b=[];for(let e=0;e<E;e++){let t=[];for(let s=0;s<f;s++){let o,A;let l=[];for(let t=0;t<I;t++){let c=h.getImageLevelInfo(s,t,e);0===e&&0===s&&0===t&&(c.origWidth%4!=0||c.origHeight%4!=0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),f>1?(o=c.origWidth,A=c.origHeight):(o=c.width,A=c.height);let d=new Uint8Array(h.getImageTranscodedSizeInBytes(s,t,0,y)),g=h.transcodeImage(d,s,t,e,y,0,-1,-1);if(!g)throw cleanup(),Error("THREE.KTX2Loader: .transcodeImage failed.");l.push(d)}let c=function(e){if(1===e.length)return e[0];let t=0;for(let s=0;s<e.length;s++){let o=e[s];t+=o.byteLength}let s=new Uint8Array(t),o=0;for(let t=0;t<e.length;t++){let A=e[t];s.set(A,o),o+=A.byteLength}return s}(l);t.push({data:c,width:o,height:A}),b.push(c.buffer)}x.push({mipmaps:t,width:p,height:m,format:Q})}return cleanup(),{faces:x,buffers:b,width:p,height:m,hasAlpha:C,format:Q,dfdFlags:B}}(g.buffer);self.postMessage({type:"transcode",id:g.id,faces:t,width:p,height:m,hasAlpha:I,format:f,dfdFlags:E},h)}catch(e){console.error(e),self.postMessage({type:"error",id:g.id,error:e.message})}})}});let h=[{if:"astcSupported",basisFormat:[l.UASTC_4x4],transcoderFormat:[A.ASTC_4x4,A.ASTC_4x4],engineFormat:[o.RGBA_ASTC_4x4_Format,o.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[A.BC7_M5,A.BC7_M5],engineFormat:[o.RGBA_BPTC_Format,o.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[A.BC1,A.BC3],engineFormat:[o.RGB_S3TC_DXT1_Format,o.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[A.ETC1,A.ETC2],engineFormat:[o.RGB_ETC2_Format,o.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[A.ETC1],engineFormat:[o.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[l.ETC1S,l.UASTC_4x4],transcoderFormat:[A.PVRTC1_4_RGB,A.PVRTC1_4_RGBA],engineFormat:[o.RGB_PVRTC_4BPPV1_Format,o.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],c=h.sort(function(e,t){return e.priorityETC1S-t.priorityETC1S}),d=h.sort(function(e,t){return e.priorityUASTC-t.priorityUASTC});function isPowerOfTwo(e){return e<=2||(e&e-1)==0&&0!==e}};let tK=new Set([eS.wk1,eS.av9,eS.hEm]),tJ={109:eS.wk1,97:eS.wk1,37:eS.wk1,43:eS.wk1,103:eS.av9,83:eS.av9,16:eS.av9,22:eS.av9,100:eS.hEm,76:eS.hEm,15:eS.hEm,9:eS.hEm,166:eS.Djp,165:eS.Djp},tz={109:eS.VzW,97:eS.cLu,37:eS.ywz,43:eS.ywz,103:eS.VzW,83:eS.cLu,16:eS.ywz,22:eS.ywz,100:eS.VzW,76:eS.cLu,15:eS.ywz,9:eS.ywz,166:eS.ywz,165:eS.ywz};async function createRawTexture(e){let t,s;let{vkFormat:o}=e;if(void 0===tJ[o])throw Error("THREE.KTX2Loader: Unsupported vkFormat.");2===e.supercompressionScheme&&(h||(h=new Promise(async e=>{let t=new zstddec_module_Q;await t.init(),e(t)})),t=await h);let A=[];for(let s=0;s<e.levels.length;s++){let l,h;let c=Math.max(1,e.pixelWidth>>s),d=Math.max(1,e.pixelHeight>>s),g=e.pixelDepth?Math.max(1,e.pixelDepth>>s):0,p=e.levels[s];if(0===e.supercompressionScheme)l=p.levelData;else if(2===e.supercompressionScheme)l=t.decode(p.levelData,p.uncompressedByteLength);else throw Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");h=tz[o]===eS.VzW?new Float32Array(l.buffer,l.byteOffset,l.byteLength/Float32Array.BYTES_PER_ELEMENT):tz[o]===eS.cLu?new Uint16Array(l.buffer,l.byteOffset,l.byteLength/Uint16Array.BYTES_PER_ELEMENT):l,A.push({data:h,width:c,height:d,depth:g})}if(tK.has(tJ[o]))s=0===e.pixelDepth?new eS.IEO(A[0].data,e.pixelWidth,e.pixelHeight):new eS.JUT(A[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw Error("THREE.KTX2Loader: Unsupported pixelDepth.");s=new eS.EB7(A,e.pixelWidth,e.pixelHeight)}return s.mipmaps=A,s.type=tz[o],s.format=tJ[o],s.colorSpace=parseColorSpace(e),s.needsUpdate=!0,Promise.resolve(s)}function parseColorSpace(e){let t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?eS.KI_:eS.GUF:10===t.colorPrimaries?2===t.transferFunction?eS.ntt:eS.AmZ:(0===t.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),eS.aCh)}let tY=Symbol("retainerCount"),tj=Symbol("recentlyUsed"),tW=Symbol("evict"),t$=Symbol("evictionThreshold"),tX=Symbol("cache");let CacheEvictionPolicy=class CacheEvictionPolicy{constructor(e,t=5){this[G]=new Map,this[O]=[],this[tX]=e,this[t$]=t}set evictionThreshold(e){this[t$]=e,this[tW]()}get evictionThreshold(){return this[t$]}get cache(){return this[tX]}retainerCount(e){return this[tY].get(e)||0}reset(){this[tY].clear(),this[tj]=[]}retain(e){this[tY].has(e)||this[tY].set(e,0),this[tY].set(e,this[tY].get(e)+1);let t=this[tj].indexOf(e);-1!==t&&this[tj].splice(t,1),this[tj].unshift(e),this[tW]()}release(e){this[tY].has(e)&&this[tY].set(e,Math.max(this[tY].get(e)-1,0)),this[tW]()}[(G=tY,O=tj,tW)](){if(!(this[tj].length<this[t$]))for(let e=this[tj].length-1;e>=this[t$];--e){let t=this[tj][e],s=this[tY].get(t);0===s&&(this[tX].delete(t),this[tj].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.
|
|
*/let ensureUniqueNames=e=>{let t=[],s=new Set;for(let o of e){let e=o,A=0;for(;s.has(e);)e=o+"."+ ++A;s.add(e),t.push(e)}return t},mappingsArrayToTable=e=>{let t=new Map;for(let s of e.mappings)for(let e of s.variants)t.set(e,{material:null,gltfMaterialIndex:s.material});return t};let GLTFMaterialsVariantsExtension=class GLTFMaterialsVariantsExtension{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){let t=this.parser,s=t.json;if(void 0===s.extensions||void 0===s.extensions[this.name])return null;let o=s.extensions[this.name],A=o.variants||[],l=ensureUniqueNames(A.map(e=>e.name));for(let o of e.scenes)o.traverse(e=>{if(!e.material)return;let o=t.associations.get(e);if(null==o||null==o.meshes||null==o.primitives)return;let A=s.meshes[o.meshes],l=A.primitives,h=l[o.primitives],c=h.extensions;c&&c[this.name]&&(e.userData.variantMaterials=mappingsArrayToTable(c[this.name]))});return e.userData.variants=l,Promise.resolve()}};eS.xEZ.DEFAULT_ANISOTROPY=4;let loadWithLoader=(e,t,s=()=>{})=>{let onProgress=e=>{let t=e.loaded/e.total;s(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise((s,o)=>{t.load(e,s,onProgress,o)})},fetchScript=e=>new Promise((t,s)=>{let o=document.createElement("script");document.body.appendChild(o),o.onload=t,o.onerror=s,o.async=!0,o.src=e}),tZ=new Map,t0=new Map,t1=new DRACOLoader,t2=new KTX2Loader,t3=Symbol("loader"),t4=Symbol("evictionPolicy"),t8=Symbol("GLTFInstance");let CachingGLTFLoader=class CachingGLTFLoader extends eS.pBf{constructor(e){super(),this[K]=new GLTFLoader().register(e=>new GLTFMaterialsVariantsExtension(e)),this[t8]=e,this[t3].setDRACOLoader(t1),this[t3].setKTX2Loader(t2)}static setDRACODecoderLocation(e){c=e,t1.setDecoderPath(e)}static getDRACODecoderLocation(){return c}static setKTX2TranscoderLocation(e){d=e,t2.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return d}static setMeshoptDecoderLocation(e){g!==e&&(g=e,p=fetchScript(e).then(()=>MeshoptDecoder.ready).then(()=>MeshoptDecoder))}static getMeshoptDecoderLocation(){return g}static initializeKTX2Loader(e){t2.detectSupport(e)}static get cache(){return tZ}static clearCache(){tZ.forEach((e,t)=>{this.delete(t)}),this[t4].reset()}static has(e){return tZ.has(e)}static async delete(e){if(!this.has(e))return;let t=tZ.get(e);t0.delete(e),tZ.delete(e);let s=await t;s.dispose()}static hasFinishedLoading(e){return!!t0.get(e)}get[(q=t4,K=t3,t4)](){return this.constructor[t4]}async preload(e,t,s=()=>{}){if(this[t3].setWithCredentials(CachingGLTFLoader.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!tZ.has(e)){null!=p&&this[t3].setMeshoptDecoder(await p);let t=loadWithLoader(e,this[t3],e=>{s(.8*e)}),o=this[t8],A=t.then(e=>o.prepare(e)).then(e=>(s(.9),new o(e))).catch(e=>(console.error(e),new o));tZ.set(e,A)}await tZ.get(e),t0.set(e,!0),s&&s(1)}async load(e,t,s=()=>{}){await this.preload(e,t,s);let o=await tZ.get(e),A=await o.clone();return this[t4].retain(e),A.dispose=()=>{this[t4].release(e)},A}};CachingGLTFLoader[q]=new CacheEvictionPolicy(CachingGLTFLoader);let CSS2DObject=class CSS2DObject extends eS.Tme{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 eS.FM8(.5,.5),this.addEventListener("removed",function(){this.traverse(function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}};let t5=new eS.Pa4,t6=new eS.yGw,t9=new eS.yGw,t7=new eS.Pa4,ie=new eS.Pa4;let CSS2DRenderer=class CSS2DRenderer{constructor(e={}){let t,s,o,A;let l=this,h={objects:new WeakMap},c=void 0!==e.element?e.element:document.createElement("div");c.style.overflow="hidden",this.domElement=c,this.getSize=function(){return{width:t,height:s}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),t6.copy(t.matrixWorldInverse),t9.multiplyMatrices(t.projectionMatrix,t6),function renderObject(e,t,s){if(e.isCSS2DObject){t5.setFromMatrixPosition(e.matrixWorld),t5.applyMatrix4(t9);let d=!0===e.visible&&t5.z>=-1&&t5.z<=1&&!0===e.layers.test(s.layers);if(e.element.style.display=!0===d?"":"none",!0===d){e.onBeforeRender(l,t,s);let h=e.element;h.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(t5.x*o+o)+"px,"+(-t5.y*A+A)+"px)",h.parentNode!==c&&c.appendChild(h),e.onAfterRender(l,t,s)}let g={distanceToCameraSquared:(t7.setFromMatrixPosition(s.matrixWorld),ie.setFromMatrixPosition(e.matrixWorld),t7.distanceToSquared(ie))};h.objects.set(e,g)}for(let o=0,A=e.children.length;o<A;o++)renderObject(e.children[o],t,s)}(e,e,t),function(e){let t=(function(e){let t=[];return e.traverse(function(e){e.isCSS2DObject&&t.push(e)}),t})(e).sort(function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;let s=h.objects.get(e).distanceToCameraSquared,o=h.objects.get(t).distanceToCameraSquared;return s-o}),s=t.length;for(let e=0,o=t.length;e<o;e++)t[e].element.style.zIndex=s-e}(e)},this.setSize=function(e,l){t=e,s=l,o=t/2,A=s/2,c.style.width=e+"px",c.style.height=l+"px"}}};function reduceVertices(e,t,s){let o=s,A=new eS.Pa4;return e.updateWorldMatrix(!0,!0),e.traverseVisible(e=>{let{geometry:s}=e;if(void 0!==s){let{position:l}=s.attributes;if(void 0!==l)for(let s=0,h=l.count;s<h;s++)e.isMesh?e.getVertexPosition(s,A):A.fromBufferAttribute(l,s),e.isSkinnedMesh||A.applyMatrix4(e.matrixWorld),o=t(o,A)}}),o}function decompress(e,t=1/0,s=null){I||(I=new eS._12(2,2,1,1)),f||(f=new eS.jyz({uniforms:{blitTexture:new eS.xWb(e)},vertexShader:`
|
|
varying vec2 vUv;
|
|
void main(){
|
|
vUv = uv;
|
|
gl_Position = vec4(position.xy * 1.0,0.,.999999);
|
|
}`,fragmentShader:`
|
|
uniform sampler2D blitTexture;
|
|
varying vec2 vUv;
|
|
|
|
void main(){
|
|
gl_FragColor = vec4(vUv.xy, 0, 1);
|
|
|
|
#ifdef IS_SRGB
|
|
gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );
|
|
#else
|
|
gl_FragColor = texture2D( blitTexture, vUv);
|
|
#endif
|
|
}`})),f.uniforms.blitTexture.value=e,f.defines.IS_SRGB=e.colorSpace==eS.KI_,f.needsUpdate=!0,E||((E=new eS.Kj0(I,f)).frustrumCulled=!1);let o=new eS.cPb,A=new eS.xsS;A.add(E),null===s&&(s=m=new eS.CP7({antialias:!1}));let l=Math.min(e.image.width,t),h=Math.min(e.image.height,t);s.setSize(l,h),s.clear(),s.render(A,o);let c=document.createElement("canvas"),d=c.getContext("2d");c.width=l,c.height=h,d.drawImage(s.domElement,0,0,l,h);let g=new eS.ROQ(c);return g.minFilter=e.minFilter,g.magFilter=e.magFilter,g.wrapS=e.wrapS,g.wrapT=e.wrapT,g.name=e.name,m&&(m.forceContextLoss(),m.dispose(),m=null),g}let it={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"]};let GLTFExporter=class GLTFExporter{constructor(){this.pluginCallbacks=[],this.register(function(e){return new GLTFLightExtension(e)}),this.register(function(e){return new GLTFExporter_GLTFMaterialsUnlitExtension(e)}),this.register(function(e){return new GLTFExporter_GLTFMaterialsTransmissionExtension(e)}),this.register(function(e){return new GLTFExporter_GLTFMaterialsVolumeExtension(e)}),this.register(function(e){return new GLTFExporter_GLTFMaterialsIorExtension(e)}),this.register(function(e){return new GLTFExporter_GLTFMaterialsSpecularExtension(e)}),this.register(function(e){return new GLTFExporter_GLTFMaterialsClearcoatExtension(e)}),this.register(function(e){return new GLTFExporter_GLTFMaterialsIridescenceExtension(e)}),this.register(function(e){return new GLTFExporter_GLTFMaterialsSheenExtension(e)}),this.register(function(e){return new GLTFExporter_GLTFMaterialsAnisotropyExtension(e)}),this.register(function(e){return new GLTFExporter_GLTFMaterialsEmissiveStrengthExtension(e)}),this.register(function(e){return new GLTFExporter_GLTFMaterialsBumpExtension(e)}),this.register(function(e){return new GLTFExporter_GLTFMeshGpuInstancing(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}parse(e,t,s,o){let A=new GLTFWriter,l=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)l.push(this.pluginCallbacks[e](A));A.setPlugins(l),A.write(e,t,o).catch(s)}parseAsync(e,t){let s=this;return new Promise(function(o,A){s.parse(e,o,A,t)})}};let ii={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},is="KHR_mesh_quantization",ir={};ir[eS.TyD]=ii.NEAREST,ir[eS.YLQ]=ii.NEAREST_MIPMAP_NEAREST,ir[eS.aH4]=ii.NEAREST_MIPMAP_LINEAR,ir[eS.wem]=ii.LINEAR,ir[eS.qyh]=ii.LINEAR_MIPMAP_NEAREST,ir[eS.D1R]=ii.LINEAR_MIPMAP_LINEAR,ir[eS.uWy]=ii.CLAMP_TO_EDGE,ir[eS.rpg]=ii.REPEAT,ir[eS.OoA]=ii.MIRRORED_REPEAT;let ia={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},io=new eS.Ilk;function equalArray(e,t){return e.length===t.length&&e.every(function(e,s){return e===t[s]})}function getPaddedBufferSize(e){return 4*Math.ceil(e/4)}function getPaddedArrayBuffer(e,t=0){let s=getPaddedBufferSize(e.byteLength);if(s!==e.byteLength){let o=new Uint8Array(s);if(o.set(new Uint8Array(e)),0!==t)for(let A=e.byteLength;A<s;A++)o[A]=t;return o.buffer}return e}function getCanvas(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function getToBlobPromise(e,t){let s;return void 0!==e.toBlob?new Promise(s=>e.toBlob(s,t)):("image/jpeg"===t?s=.92:"image/webp"===t&&(s=.8),e.convertToBlob({type:t,quality:s}))}let GLTFWriter=class GLTFWriter{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"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,s={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},s),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);let o=this.buffers,A=this.json;s=this.options;let l=this.extensionsUsed,h=this.extensionsRequired,c=new Blob(o,{type:"application/octet-stream"}),d=Object.keys(l),g=Object.keys(h);if(d.length>0&&(A.extensionsUsed=d),g.length>0&&(A.extensionsRequired=g),A.buffers&&A.buffers.length>0&&(A.buffers[0].byteLength=c.size),!0===s.binary){let e=new FileReader;e.readAsArrayBuffer(c),e.onloadend=function(){var s;let o=getPaddedArrayBuffer(e.result),l=new DataView(new ArrayBuffer(8));l.setUint32(0,o.byteLength,!0),l.setUint32(4,5130562,!0);let h=getPaddedArrayBuffer((s=JSON.stringify(A),new TextEncoder().encode(s).buffer),32),c=new DataView(new ArrayBuffer(8));c.setUint32(0,h.byteLength,!0),c.setUint32(4,1313821514,!0);let d=new ArrayBuffer(12),g=new DataView(d);g.setUint32(0,1179937895,!0),g.setUint32(4,2,!0);let p=12+c.byteLength+h.byteLength+l.byteLength+o.byteLength;g.setUint32(8,p,!0);let m=new Blob([d,c,h,l,o],{type:"application/octet-stream"}),I=new FileReader;I.readAsArrayBuffer(m),I.onloadend=function(){t(I.result)}}}else if(A.buffers&&A.buffers.length>0){let e=new FileReader;e.readAsDataURL(c),e.onloadend=function(){let s=e.result;A.buffers[0].uri=s,t(A)}}else t(A)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;let s=this.options,o=this.extensionsUsed;try{let A=JSON.parse(JSON.stringify(e.userData));if(s.includeCustomExtensions&&A.gltfExtensions){for(let e in void 0===t.extensions&&(t.extensions={}),A.gltfExtensions)t.extensions[e]=A.gltfExtensions[e],o[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)){let t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}let s=this.uids.get(e);return s.get(t)}isNormalizedNormalAttribute(e){let t=this.cache;if(t.attributesNormalized.has(e))return!1;let s=new eS.Pa4;for(let t=0,o=e.count;t<o;t++)if(Math.abs(s.fromBufferAttribute(e,t).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){let t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);let s=e.clone(),o=new eS.Pa4;for(let e=0,t=s.count;e<t;e++)o.fromBufferAttribute(s,e),0===o.x&&0===o.y&&0===o.z?o.setX(1):o.normalize(),s.setXYZ(e,o.x,o.y,o.z);return t.attributesNormalized.set(e,s),s}applyTextureTransform(e,t){let s=!1,o={};(0!==t.offset.x||0!==t.offset.y)&&(o.offset=t.offset.toArray(),s=!0),0!==t.rotation&&(o.rotation=t.rotation,s=!0),(1!==t.repeat.x||1!==t.repeat.y)&&(o.scale=t.repeat.toArray(),s=!0),s&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=o,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function getEncodingConversion(e){return e.colorSpace===eS.KI_?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof eS.EB7&&(e=decompress(e)),t instanceof eS.EB7&&(t=decompress(t));let s=e?e.image:null,o=t?t.image:null,A=Math.max(s?s.width:0,o?o.width:0),l=Math.max(s?s.height:0,o?o.height:0),h=getCanvas();h.width=A,h.height=l;let c=h.getContext("2d");c.fillStyle="#00ffff",c.fillRect(0,0,A,l);let d=c.getImageData(0,0,A,l);if(s){c.drawImage(s,0,0,A,l);let t=getEncodingConversion(e),o=c.getImageData(0,0,A,l).data;for(let e=2;e<o.length;e+=4)d.data[e]=256*t(o[e]/256)}if(o){c.drawImage(o,0,0,A,l);let e=getEncodingConversion(t),s=c.getImageData(0,0,A,l).data;for(let t=1;t<s.length;t+=4)d.data[t]=256*e(s[t]/256)}c.putImageData(d,0,0);let g=e||t,p=g.clone();return p.source=new eS.Hw6(h),p.colorSpace=eS.aCh,p.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),p}processBuffer(e){let t=this.json,s=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),s.push(e),0}processBufferView(e,t,s,o,A){let l;let h=this.json;switch(h.bufferViews||(h.bufferViews=[]),t){case ii.BYTE:case ii.UNSIGNED_BYTE:l=1;break;case ii.SHORT:case ii.UNSIGNED_SHORT:l=2;break;default:l=4}let c=getPaddedBufferSize(o*e.itemSize*l),d=new DataView(new ArrayBuffer(c)),g=0;for(let A=s;A<s+o;A++)for(let s=0;s<e.itemSize;s++){let o;e.itemSize>4?o=e.array[A*e.itemSize+s]:(0===s?o=e.getX(A):1===s?o=e.getY(A):2===s?o=e.getZ(A):3===s&&(o=e.getW(A)),!0===e.normalized&&(o=eS.M8C.normalize(o,e.array))),t===ii.FLOAT?d.setFloat32(g,o,!0):t===ii.INT?d.setInt32(g,o,!0):t===ii.UNSIGNED_INT?d.setUint32(g,o,!0):t===ii.SHORT?d.setInt16(g,o,!0):t===ii.UNSIGNED_SHORT?d.setUint16(g,o,!0):t===ii.BYTE?d.setInt8(g,o):t===ii.UNSIGNED_BYTE&&d.setUint8(g,o),g+=l}let p={buffer:this.processBuffer(d.buffer),byteOffset:this.byteOffset,byteLength:c};void 0!==A&&(p.target=A),A===ii.ARRAY_BUFFER&&(p.byteStride=e.itemSize*l),this.byteOffset+=c,h.bufferViews.push(p);let m={id:h.bufferViews.length-1,byteLength:0};return m}processBufferViewImage(e){let t=this,s=t.json;return s.bufferViews||(s.bufferViews=[]),new Promise(function(o){let A=new FileReader;A.readAsArrayBuffer(e),A.onloadend=function(){let e=getPaddedArrayBuffer(A.result),l={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,o(s.bufferViews.push(l)-1)}})}processAccessor(e,t,s,o){let A,l;let h=this.json;if(e.array.constructor===Float32Array)A=ii.FLOAT;else if(e.array.constructor===Int32Array)A=ii.INT;else if(e.array.constructor===Uint32Array)A=ii.UNSIGNED_INT;else if(e.array.constructor===Int16Array)A=ii.SHORT;else if(e.array.constructor===Uint16Array)A=ii.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)A=ii.BYTE;else if(e.array.constructor===Uint8Array)A=ii.UNSIGNED_BYTE;else throw Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(void 0===s&&(s=0),(void 0===o||o===1/0)&&(o=e.count),0===o)return null;let c=function(e,t,s){let o={min:Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let A=t;A<t+s;A++)for(let t=0;t<e.itemSize;t++){let s;e.itemSize>4?s=e.array[A*e.itemSize+t]:(0===t?s=e.getX(A):1===t?s=e.getY(A):2===t?s=e.getZ(A):3===t&&(s=e.getW(A)),!0===e.normalized&&(s=eS.M8C.normalize(s,e.array))),o.min[t]=Math.min(o.min[t],s),o.max[t]=Math.max(o.max[t],s)}return o}(e,s,o);void 0!==t&&(l=e===t.index?ii.ELEMENT_ARRAY_BUFFER:ii.ARRAY_BUFFER);let d=this.processBufferView(e,A,s,o,l),g={bufferView:d.id,byteOffset:d.byteOffset,componentType:A,count:o,max:c.max,min:c.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(g.normalized=!0),h.accessors||(h.accessors=[]),h.accessors.push(g)-1}processImage(e,t,s,o="image/png"){if(null!==e){let A=this,l=A.cache,h=A.json,c=A.options,d=A.pending;l.images.has(e)||l.images.set(e,{});let g=l.images.get(e),p=o+":flipY/"+s.toString();if(void 0!==g[p])return g[p];h.images||(h.images=[]);let m={mimeType:o},I=getCanvas();I.width=Math.min(e.width,c.maxTextureSize),I.height=Math.min(e.height,c.maxTextureSize);let f=I.getContext("2d");if(!0===s&&(f.translate(0,I.height),f.scale(1,-1)),void 0!==e.data){t!==eS.wk1&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);let 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];f.putImageData(new ImageData(s,e.width,e.height),0,0)}else f.drawImage(e,0,0,I.width,I.height);!0===c.binary?d.push(getToBlobPromise(I,o).then(e=>A.processBufferViewImage(e)).then(e=>{m.bufferView=e})):void 0!==I.toDataURL?m.uri=I.toDataURL(o):d.push(getToBlobPromise(I,o).then(e=>new FileReader().readAsDataURL(e)).then(e=>{m.uri=e}));let E=h.images.push(m)-1;return g[p]=E,E}throw Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){let t=this.json;t.samplers||(t.samplers=[]);let s={magFilter:ir[e.magFilter],minFilter:ir[e.minFilter],wrapS:ir[e.wrapS],wrapT:ir[e.wrapT]};return t.samplers.push(s)-1}processTexture(e){let t=this.options,s=this.cache,o=this.json;if(s.textures.has(e))return s.textures.get(e);o.textures||(o.textures=[]),e instanceof eS.EB7&&(e=decompress(e,t.maxTextureSize));let A=e.userData.mimeType;"image/webp"===A&&(A="image/png");let l={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,A)};e.name&&(l.name=e.name),this._invokeAll(function(t){t.writeTexture&&t.writeTexture(e,l)});let h=o.textures.push(l)-1;return s.textures.set(e,h),h}processMaterial(e){let t=this.cache,s=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;s.materials||(s.materials=[]);let o={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");let A=e.color.toArray().concat([e.opacity]);if(equalArray(A,[1,1,1,1])||(o.pbrMetallicRoughness.baseColorFactor=A),e.isMeshStandardMaterial?(o.pbrMetallicRoughness.metallicFactor=e.metalness,o.pbrMetallicRoughness.roughnessFactor=e.roughness):(o.pbrMetallicRoughness.metallicFactor=.5,o.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){let t=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),s={index:this.processTexture(t),channel:t.channel};this.applyTextureTransform(s,t),o.pbrMetallicRoughness.metallicRoughnessTexture=s}if(e.map){let t={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),o.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){let t=e.emissive,s=Math.max(t.r,t.g,t.b);if(s>0&&(o.emissiveFactor=e.emissive.toArray()),e.emissiveMap){let t={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),o.emissiveTexture=t}}if(e.normalMap){let t={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),o.normalTexture=t}if(e.aoMap){let t={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),o.occlusionTexture=t}e.transparent?o.alphaMode="BLEND":e.alphaTest>0&&(o.alphaMode="MASK",o.alphaCutoff=e.alphaTest),e.side===eS.ehD&&(o.doubleSided=!0),""!==e.name&&(o.name=e.name),this.serializeUserData(e,o),this._invokeAll(function(t){t.writeMaterial&&t.writeMaterial(e,o)});let l=s.materials.push(o)-1;return t.materials.set(e,l),l}processMesh(e){let t;let s=this.cache,o=this.json,A=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,s=e.material.length;t<s;t++)A.push(e.material[t].uuid);else A.push(e.material.uuid);let l=A.join(":");if(s.meshes.has(l))return s.meshes.get(l);let h=e.geometry;t=e.isLineSegments?ii.LINES:e.isLineLoop?ii.LINE_LOOP:e.isLine?ii.LINE_STRIP:e.isPoints?ii.POINTS:e.material.wireframe?ii.LINES:ii.TRIANGLES;let c={},d={},g=[],p=[],m={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},I=h.getAttribute("normal");void 0===I||this.isNormalizedNormalAttribute(I)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),h.setAttribute("normal",this.createNormalizedNormalAttribute(I)));let f=null;for(let e in h.attributes){if("morph"===e.slice(0,5))continue;let t=h.attributes[e];e=m[e]||e.toUpperCase();let o=/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/;if(o.test(e)||(e="_"+e),s.attributes.has(this.getUID(t))){d[e]=s.attributes.get(this.getUID(t));continue}f=null;let A=t.array;"JOINTS_0"!==e||A instanceof Uint16Array||A instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),f=new eS.TlE(new Uint16Array(A),t.itemSize,t.normalized));let l=this.processAccessor(f||t,h);null!==l&&(e.startsWith("_")||this.detectMeshQuantization(e,t),d[e]=l,s.attributes.set(this.getUID(t),l))}if(void 0!==I&&h.setAttribute("normal",I),0===Object.keys(d).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){let t=[],o=[],A={};if(void 0!==e.morphTargetDictionary)for(let t in e.morphTargetDictionary)A[e.morphTargetDictionary[t]]=t;for(let l=0;l<e.morphTargetInfluences.length;++l){let c={},d=!1;for(let e in h.morphAttributes){if("position"!==e&&"normal"!==e){d||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),d=!0);continue}let t=h.morphAttributes[e][l],o=e.toUpperCase(),A=h.attributes[e];if(s.attributes.has(this.getUID(t,!0))){c[o]=s.attributes.get(this.getUID(t,!0));continue}let g=t.clone();if(!h.morphTargetsRelative)for(let e=0,s=t.count;e<s;e++)for(let s=0;s<t.itemSize;s++)0===s&&g.setX(e,t.getX(e)-A.getX(e)),1===s&&g.setY(e,t.getY(e)-A.getY(e)),2===s&&g.setZ(e,t.getZ(e)-A.getZ(e)),3===s&&g.setW(e,t.getW(e)-A.getW(e));c[o]=this.processAccessor(g,h),s.attributes.set(this.getUID(A,!0),c[o])}p.push(c),t.push(e.morphTargetInfluences[l]),void 0!==e.morphTargetDictionary&&o.push(A[l])}c.weights=t,o.length>0&&(c.extras={},c.extras.targetNames=o)}let E=Array.isArray(e.material);if(E&&0===h.groups.length)return null;let C=!1;if(E&&null===h.index){let e=[];for(let t=0,s=h.attributes.position.count;t<s;t++)e[t]=t;h.setIndex(e),C=!0}let B=E?e.material:[e.material],y=E?h.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,o=y.length;e<o;e++){let o={mode:t,attributes:d};if(this.serializeUserData(h,o),p.length>0&&(o.targets=p),null!==h.index){let t=this.getUID(h.index);(void 0!==y[e].start||void 0!==y[e].count)&&(t+=":"+y[e].start+":"+y[e].count),s.attributes.has(t)?o.indices=s.attributes.get(t):(o.indices=this.processAccessor(h.index,h,y[e].start,y[e].count),s.attributes.set(t,o.indices)),null===o.indices&&delete o.indices}let A=this.processMaterial(B[y[e].materialIndex]);null!==A&&(o.material=A),g.push(o)}!0===C&&h.setIndex(null),c.primitives=g,o.meshes||(o.meshes=[]),this._invokeAll(function(t){t.writeMesh&&t.writeMesh(e,c)});let Q=o.meshes.push(c)-1;return s.meshes.set(l,Q),Q}detectMeshQuantization(e,t){let s;if(this.extensionsUsed[is])return;switch(t.array.constructor){case Int8Array:s="byte";break;case Uint8Array:s="unsigned byte";break;case Int16Array:s="short";break;case Uint16Array:s="unsigned short";break;default:return}t.normalized&&(s+=" normalized");let o=e.split("_",1)[0];it[o]&&it[o].includes(s)&&(this.extensionsUsed[is]=!0,this.extensionsRequired[is]=!0)}processCamera(e){let t=this.json;t.cameras||(t.cameras=[]);let s=e.isOrthographicCamera,o={type:s?"orthographic":"perspective"};return s?o.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:o.perspective={aspectRatio:e.aspect,yfov:eS.M8C.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(o.name=e.type),t.cameras.push(o)-1}processAnimation(e,t){let s=this.json,o=this.nodeMap;s.animations||(s.animations=[]),e=GLTFExporter.Utils.mergeMorphTargetTracks(e.clone(),t);let A=e.tracks,l=[],h=[];for(let e=0;e<A.length;++e){let s;let c=A[e],d=eS.iUV.parseTrackName(c.name),g=eS.iUV.findNode(t,d.nodeName),p=ia[d.propertyName];if("bones"===d.objectName&&(g=!0===g.isSkinnedMesh?g.skeleton.getBoneByName(d.objectIndex):void 0),!g||!p)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;let m=c.values.length/c.times.length;p===ia.morphTargetInfluences&&(m/=g.morphTargetInfluences.length),!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(s="CUBICSPLINE",m/=3):s=c.getInterpolation()===eS.Syv?"STEP":"LINEAR",h.push({input:this.processAccessor(new eS.TlE(c.times,1)),output:this.processAccessor(new eS.TlE(c.values,m)),interpolation:s}),l.push({sampler:h.length-1,target:{node:o.get(g),path:p}})}return s.animations.push({name:e.name||"clip_"+s.animations.length,samplers:h,channels:l}),s.animations.length-1}processSkin(e){let t=this.json,s=this.nodeMap,o=t.nodes[s.get(e)],A=e.skeleton;if(void 0===A)return null;let l=e.skeleton.bones[0];if(void 0===l)return null;let h=[],c=new Float32Array(16*A.bones.length),d=new eS.yGw;for(let t=0;t<A.bones.length;++t)h.push(s.get(A.bones[t])),d.copy(A.boneInverses[t]),d.multiply(e.bindMatrix).toArray(c,16*t);void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new eS.TlE(c,16)),joints:h,skeleton:s.get(l)});let g=o.skin=t.skins.length-1;return g}processNode(e){let t=this.json,s=this.options,o=this.nodeMap;t.nodes||(t.nodes=[]);let A={};if(s.trs){let t=e.quaternion.toArray(),s=e.position.toArray(),o=e.scale.toArray();equalArray(t,[0,0,0,1])||(A.rotation=t),equalArray(s,[0,0,0])||(A.translation=s),equalArray(o,[1,1,1])||(A.scale=o)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===equalArray(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){let t=this.processMesh(e);null!==t&&(A.mesh=t)}else e.isCamera&&(A.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){let t=[];for(let o=0,A=e.children.length;o<A;o++){let A=e.children[o];if(A.visible||!1===s.onlyVisible){let e=this.processNode(A);null!==e&&t.push(e)}}t.length>0&&(A.children=t)}this._invokeAll(function(t){t.writeNode&&t.writeNode(e,A)});let l=t.nodes.push(A)-1;return o.set(e,l),l}processScene(e){let t=this.json,s=this.options;t.scenes||(t.scenes=[],t.scene=0);let o={};""!==e.name&&(o.name=e.name),t.scenes.push(o);let A=[];for(let t=0,o=e.children.length;t<o;t++){let o=e.children[t];if(o.visible||!1===s.onlyVisible){let e=this.processNode(o);null!==e&&A.push(e)}}A.length>0&&(o.nodes=A),this.serializeUserData(e,o)}processObjects(e){let t=new eS.xsS;t.name="AuxScene";for(let s=0;s<e.length;s++)t.children.push(e[s]);this.processScene(t)}processInput(e){let t=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(t){t.beforeParse&&t.beforeParse(e)});let s=[];for(let t=0;t<e.length;t++)e[t]instanceof eS.xsS?this.processScene(e[t]):s.push(e[t]);s.length>0&&this.processObjects(s);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let s=0;s<t.animations.length;++s)this.processAnimation(t.animations[s],e[0]);this._invokeAll(function(t){t.afterParse&&t.afterParse(e)})}_invokeAll(e){for(let t=0,s=this.plugins.length;t<s;t++)e(this.plugins[t])}};let GLTFLightExtension=class GLTFLightExtension{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}let s=this.writer,o=s.json,A=s.extensionsUsed,l={};e.name&&(l.name=e.name),l.color=e.color.toArray(),l.intensity=e.intensity,e.isDirectionalLight?l.type="directional":e.isPointLight?(l.type="point",e.distance>0&&(l.range=e.distance)):e.isSpotLight&&(l.type="spot",e.distance>0&&(l.range=e.distance),l.spot={},l.spot.innerConeAngle=(1-e.penumbra)*e.angle,l.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]||(o.extensions=o.extensions||{},o.extensions[this.name]={lights:[]},A[this.name]=!0);let h=o.extensions[this.name].lights;h.push(l),t.extensions=t.extensions||{},t.extensions[this.name]={light:h.length-1}}};let GLTFExporter_GLTFMaterialsUnlitExtension=class GLTFExporter_GLTFMaterialsUnlitExtension{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;let s=this.writer,o=s.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},o[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}};let GLTFExporter_GLTFMaterialsClearcoatExtension=class GLTFExporter_GLTFMaterialsClearcoatExtension{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;let s=this.writer,o=s.extensionsUsed,A={};if(A.clearcoatFactor=e.clearcoat,e.clearcoatMap){let t={index:s.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};s.applyTextureTransform(t,e.clearcoatMap),A.clearcoatTexture=t}if(A.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){let t={index:s.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};s.applyTextureTransform(t,e.clearcoatRoughnessMap),A.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){let t={index:s.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};s.applyTextureTransform(t,e.clearcoatNormalMap),A.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=A,o[this.name]=!0}};let GLTFExporter_GLTFMaterialsIridescenceExtension=class GLTFExporter_GLTFMaterialsIridescenceExtension{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;let s=this.writer,o=s.extensionsUsed,A={};if(A.iridescenceFactor=e.iridescence,e.iridescenceMap){let t={index:s.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};s.applyTextureTransform(t,e.iridescenceMap),A.iridescenceTexture=t}if(A.iridescenceIor=e.iridescenceIOR,A.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],A.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){let t={index:s.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};s.applyTextureTransform(t,e.iridescenceThicknessMap),A.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=A,o[this.name]=!0}};let GLTFExporter_GLTFMaterialsTransmissionExtension=class GLTFExporter_GLTFMaterialsTransmissionExtension{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;let s=this.writer,o=s.extensionsUsed,A={};if(A.transmissionFactor=e.transmission,e.transmissionMap){let t={index:s.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};s.applyTextureTransform(t,e.transmissionMap),A.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=A,o[this.name]=!0}};let GLTFExporter_GLTFMaterialsVolumeExtension=class GLTFExporter_GLTFMaterialsVolumeExtension{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;let s=this.writer,o=s.extensionsUsed,A={};if(A.thicknessFactor=e.thickness,e.thicknessMap){let t={index:s.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};s.applyTextureTransform(t,e.thicknessMap),A.thicknessTexture=t}A.attenuationDistance=e.attenuationDistance,A.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=A,o[this.name]=!0}};let GLTFExporter_GLTFMaterialsIorExtension=class GLTFExporter_GLTFMaterialsIorExtension{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;let s=this.writer,o=s.extensionsUsed,A={};A.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=A,o[this.name]=!0}};let GLTFExporter_GLTFMaterialsSpecularExtension=class GLTFExporter_GLTFMaterialsSpecularExtension{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(io)&&!e.specularIntensityMap&&!e.specularColorMap)return;let s=this.writer,o=s.extensionsUsed,A={};if(e.specularIntensityMap){let t={index:s.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};s.applyTextureTransform(t,e.specularIntensityMap),A.specularTexture=t}if(e.specularColorMap){let t={index:s.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};s.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,o[this.name]=!0}};let GLTFExporter_GLTFMaterialsSheenExtension=class GLTFExporter_GLTFMaterialsSheenExtension{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;let s=this.writer,o=s.extensionsUsed,A={};if(e.sheenRoughnessMap){let t={index:s.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};s.applyTextureTransform(t,e.sheenRoughnessMap),A.sheenRoughnessTexture=t}if(e.sheenColorMap){let t={index:s.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};s.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,o[this.name]=!0}};let GLTFExporter_GLTFMaterialsAnisotropyExtension=class GLTFExporter_GLTFMaterialsAnisotropyExtension{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;let s=this.writer,o=s.extensionsUsed,A={};if(e.anisotropyMap){let t={index:s.processTexture(e.anisotropyMap)};s.applyTextureTransform(t,e.anisotropyMap),A.anisotropyTexture=t}A.anisotropyStrength=e.anisotropy,A.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=A,o[this.name]=!0}};let GLTFExporter_GLTFMaterialsEmissiveStrengthExtension=class GLTFExporter_GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;let s=this.writer,o=s.extensionsUsed,A={};A.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=A,o[this.name]=!0}};let GLTFExporter_GLTFMaterialsBumpExtension=class GLTFExporter_GLTFMaterialsBumpExtension{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;let s=this.writer,o=s.extensionsUsed,A={};if(e.bumpMap){let t={index:s.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};s.applyTextureTransform(t,e.bumpMap),A.bumpTexture=t}A.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=A,o[this.name]=!0}};let GLTFExporter_GLTFMeshGpuInstancing=class GLTFExporter_GLTFMeshGpuInstancing{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;let s=this.writer,o=new Float32Array(3*e.count),A=new Float32Array(4*e.count),l=new Float32Array(3*e.count),h=new eS.yGw,c=new eS.Pa4,d=new eS._fP,g=new eS.Pa4;for(let t=0;t<e.count;t++)e.getMatrixAt(t,h),h.decompose(c,d,g),c.toArray(o,3*t),d.toArray(A,4*t),g.toArray(l,3*t);let p={TRANSLATION:s.processAccessor(new eS.TlE(o,3)),ROTATION:s.processAccessor(new eS.TlE(A,4)),SCALE:s.processAccessor(new eS.TlE(l,3))};e.instanceColor&&(p._COLOR_0=s.processAccessor(e.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:p},s.extensionsUsed[this.name]=!0,s.extensionsRequired[this.name]=!0}};GLTFExporter.Utils={insertKeyframe:function(e,t){let s;let o=e.getValueSize(),A=new e.TimeBufferType(e.times.length+1),l=new e.ValueBufferType(e.values.length+o),h=e.createInterpolant(new e.ValueBufferType(o));if(0===e.times.length){A[0]=t;for(let e=0;e<o;e++)l[e]=0;s=0}else if(t<e.times[0]){if(.001>Math.abs(e.times[0]-t))return 0;A[0]=t,A.set(e.times,1),l.set(h.evaluate(t),0),l.set(e.values,o),s=0}else if(t>e.times[e.times.length-1]){if(.001>Math.abs(e.times[e.times.length-1]-t))return e.times.length-1;A[A.length-1]=t,A.set(e.times,0),l.set(e.values,0),l.set(h.evaluate(t),e.values.length),s=A.length-1}else for(let c=0;c<e.times.length;c++){if(.001>Math.abs(e.times[c]-t))return c;if(e.times[c]<t&&e.times[c+1]>t){A.set(e.times.slice(0,c+1),0),A[c+1]=t,A.set(e.times.slice(c+1),c+2),l.set(e.values.slice(0,(c+1)*o),0),l.set(h.evaluate(t),(c+1)*o),l.set(e.values.slice((c+1)*o),(c+2)*o),s=c+1;break}}return e.times=A,e.values=l,s},mergeMorphTargetTracks:function(e,t){let s=[],o={},A=e.tracks;for(let e=0;e<A.length;++e){let l,h=A[e],c=eS.iUV.parseTrackName(h.name),d=eS.iUV.findNode(t,c.nodeName);if("morphTargetInfluences"!==c.propertyName||void 0===c.propertyIndex){s.push(h);continue}if(h.createInterpolant!==h.InterpolantFactoryMethodDiscrete&&h.createInterpolant!==h.InterpolantFactoryMethodLinear){if(h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(h=h.clone()).setInterpolation(eS.NMF)}let g=d.morphTargetInfluences.length,p=d.morphTargetDictionary[c.propertyIndex];if(void 0===p)throw Error("THREE.GLTFExporter: Morph target name not found: "+c.propertyIndex);if(void 0===o[d.uuid]){l=h.clone();let e=new l.ValueBufferType(g*l.times.length);for(let t=0;t<l.times.length;t++)e[t*g+p]=l.values[t];l.name=(c.nodeName||"")+".morphTargetInfluences",l.values=e,o[d.uuid]=l,s.push(l);continue}let m=h.createInterpolant(new h.ValueBufferType(1));l=o[d.uuid];for(let e=0;e<l.times.length;e++)l.values[e*g+p]=m.evaluate(l.times[e]);for(let e=0;e<h.times.length;e++){let t=this.insertKeyframe(l,h.times[e]);l.values[t*g+p]=h.values[e]}}return e.tracks=s,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.
|
|
*/let compatibleObject=e=>void 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter(e=>compatibleMaterial(e.material)),compatibleMaterial=e=>e&&e.isMaterial&&!Array.isArray(e);let GLTFExporterMaterialsVariantsExtension=class GLTFExporterMaterialsVariantsExtension{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){let t=new Set;for(let s of e)s.traverse(e=>{if(!compatibleObject(e))return;let s=e.userData.variantMaterials,o=e.userData.variantData;for(let[e,A]of o){let o=s.get(A.index);o&&compatibleMaterial(o.material)&&t.add(e)}});t.forEach(e=>this.variantNames.push(e))}writeMesh(e,t){if(!compatibleObject(e))return;let s=e.userData,o=s.variantMaterials,A=s.variantData,l=new Map,h=new Map,c=Array.from(A.values()).sort((e,t)=>e.index-t.index);for(let[e,t]of c.entries())h.set(t.index,e);for(let e of A.values()){let t=o.get(e.index);if(!t||!compatibleMaterial(t.material))continue;let s=this.writer.processMaterial(t.material);l.has(s)||l.set(s,{material:s,variants:[]}),l.get(s).variants.push(h.get(e.index))}let d=Array.from(l.values()).map(e=>e.variants.sort((e,t)=>e-t)&&e).sort((e,t)=>e.material-t.material);if(0===d.length)return;let g=compatibleMaterial(s.originalMaterial)?this.writer.processMaterial(s.originalMaterial):-1;for(let e of t.primitives)g>=0&&(e.material=g),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:d}}afterParse(){if(0===this.variantNames.length)return;let e=this.writer.json;e.extensions=e.extensions||{};let t=this.variantNames.map(e=>({name:e}));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}};let SessionLightProbe=class SessionLightProbe{constructor(e,t,s,o,A){this.xrLight=e,this.renderer=t,this.lightProbe=s,this.xrWebGLBinding=null,this.estimationStartCallback=A,this.frameCallback=this.onXRFrame.bind(this);let l=t.xr.getSession();if(o&&"XRWebGLBinding"in window){let s=new eS.oAp(16);e.environment=s.texture;let o=t.getContext();switch(l.preferredReflectionFormat){case"srgba8":o.getExtension("EXT_sRGB");break;case"rgba16f":o.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(l,o),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}l.requestAnimationFrame(this.frameCallback)}updateReflection(){let e=this.renderer.properties.get(this.xrLight.environment);if(e){let t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;let s=t.session;s.requestAnimationFrame(this.frameCallback);let o=t.getLightEstimate(this.lightProbe);if(o){this.xrLight.lightProbe.sh.fromArray(o.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;let e=Math.max(1,Math.max(o.primaryLightIntensity.x,Math.max(o.primaryLightIntensity.y,o.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(o.primaryLightIntensity.x/e,o.primaryLightIntensity.y/e,o.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(o.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}};let XREstimatedLight=class XREstimatedLight extends eS.ZAu{constructor(e,t=!0){super(),this.lightProbe=new eS.lk7,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new eS.Ox3,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let s=null,o=!1;e.xr.addEventListener("sessionstart",()=>{let A=e.xr.getSession();"requestLightProbe"in A&&A.requestLightProbe({reflectionFormat:A.preferredReflectionFormat}).then(A=>{s=new SessionLightProbe(this,e,A,t,()=>{o=!0,this.dispatchEvent({type:"estimationstart"})})})}),e.xr.addEventListener("sessionend",()=>{s&&(s.dispose(),s=null),o&&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}}};let Damper=class Damper{constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,s,o){let A=2e-4*this.naturalFrequency;if(null==e||0===o||e===t&&0===this.velocity)return t;if(s<0)return e;let l=e-t,h=this.velocity+this.naturalFrequency*l,c=l+s*h,d=Math.exp(-this.naturalFrequency*s),g=(h-this.naturalFrequency*c)*d,p=-this.naturalFrequency*(g+h*d);return Math.abs(g)<A*Math.abs(o)&&p*l>=0?(this.velocity=0,t):(this.velocity=g,t+c*d)}};let iA=Math.PI/24,il=new eS.FM8,addCorner=(e,t,s)=>{let o=t>0?s>0?0:-Math.PI/2:s>0?Math.PI/2:Math.PI;for(let A=0;A<=12;++A)e.push(t+.17*Math.cos(o),s+.17*Math.sin(o),0,t+.2*Math.cos(o),s+.2*Math.sin(o),0),o+=iA};let PlacementBox=class PlacementBox extends eS.Kj0{constructor(e,t){let s=new eS.u9r,o=[],A=[],{size:l,boundingBox:h}=e,c=l.x/2,d=("back"===t?l.y:l.z)/2;addCorner(A,c,d),addCorner(A,-c,d),addCorner(A,-c,-d),addCorner(A,c,-d);let g=A.length/3;for(let e=0;e<g-2;e+=2)o.push(e,e+1,e+3,e,e+3,e+2);let p=g-2;o.push(p,p+1,1,p,1,0),s.setAttribute("position",new eS.a$l(A,3)),s.setIndex(o),super(s),this.side=t;let m=this.material;switch(m.side=eS.ehD,m.transparent=!0,m.opacity=0,this.goalOpacity=0,this.opacityDamper=new Damper,this.hitPlane=new eS.Kj0(new eS._12(2*(c+.2),2*(d+.2))),this.hitPlane.visible=!1,this.hitPlane.material.side=eS.ehD,this.add(this.hitPlane),h.getCenter(this.position),t){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=h.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=h.min.z,this.position.z=this.shadowHeight}e.target.add(this),this.offsetHeight=0}getHit(e,t,s){il.set(t,-s),this.hitPlane.visible=!0;let o=e.positionAndNormalFromPoint(il,this.hitPlane);return this.hitPlane.visible=!1,null==o?null:o.position}getExpandedHit(e,t,s){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();let o=this.getHit(e,t,s);return this.hitPlane.scale.set(1,1,1),o}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?.75:0}updateOpacity(e){let t=this.material;t.opacity=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1),this.visible=t.opacity>0}dispose(){var e;let{geometry:t,material:s}=this.hitPlane;t.dispose(),s.dispose(),this.geometry.dispose(),this.material.dispose(),null===(e=this.parent)||void 0===e||e.remove(this)}};/* @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.
|
|
*/let numberNode=(e,t)=>({type:"number",number:e,unit:t}),ih=(()=>{let e={};return t=>{let s=t;if(s in e)return e[s];let o=[],A=0;for(;t;){if(++A>1e3){t="";break}let e=ic(t),s=e.nodes[0];if(null==s||0===s.terms.length)break;o.push(s),t=e.remainingInput}return e[s]=o}})(),ic=(()=>{let e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,s=/^[\),]/;return o=>{let A=[];for(;o.length&&(o=o.trim(),!s.test(o));)if("("===o[0]){let{nodes:e,remainingInput:t}=parseFunctionArguments(o);o=t,A.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(o)){let e=iu(o),t=e.nodes[0];if("("===(o=e.remainingInput)[0]){let{nodes:e,remainingInput:s}=parseFunctionArguments(o);A.push({type:"function",name:t,arguments:e}),o=s}else A.push(t)}else if(t.test(o))A.push({type:"operator",value:o[0]}),o=o.slice(1);else{let{nodes:e,remainingInput:t}="#"===o[0]?ig(o):id(o);if(0===e.length)break;A.push(e[0]),o=t}return{nodes:[{type:"expression",terms:A}],remainingInput:o}}})(),iu=(()=>{let e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{let s=t.match(e),o=null==s?t:t.substr(0,s.index),A=null==s?"":t.substr(s.index);return{nodes:[{type:"ident",value:o}],remainingInput:A}}})(),id=(()=>{let e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,s=/^(m|mm|cm|rad|deg|[%])$/;return o=>{let A=o.match(e),l=null==A?"0":A[0];o=null==l?o:o.slice(l.length);let h=o.match(t),c=null!=h&&""!==h[0]?h[0]:null,d=null==h?o:o.slice(c.length);return null==c||s.test(c)||(c=null),{nodes:[{type:"number",number:parseFloat(l)||0,unit:c}],remainingInput:d}}})(),ig=(()=>{let e=/^[a-f0-9]*/i;return t=>{t=t.slice(1).trim();let s=t.match(e),o=null==s?[]:[{type:"hex",value:s[0]}];return{nodes:o,remainingInput:null==s?t:t.slice(s[0].length)}}})(),parseFunctionArguments=e=>{let t=[];for(e=e.slice(1).trim();e.length;){let s=ic(e);if(t.push(s.nodes[0]),","===(e=s.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},ip=Symbol("visitedTypes");let ASTWalker=class ASTWalker{constructor(e){this[ip]=e}walk(e,t){let s=e.slice();for(;s.length;){let e=s.shift();switch(this[ip].indexOf(e.type)>-1&&t(e),e.type){case"expression":s.unshift(...e.terms);break;case"function":s.unshift(e.name,...e.arguments)}}}};let im=Object.freeze({type:"number",number:0,unit:null}),degreesToRadians=(e,t=0)=>{let{number:s,unit:o}=e;if(isFinite(s)){if("rad"===e.unit||null==e.unit)return e}else s=t,o="rad";let A="deg"===o&&null!=s,l=A?s:0;return{type:"number",number:l*Math.PI/180,unit:"rad"}},lengthToBaseMeters=(e,t=0)=>{let s,{number:o,unit:A}=e;if(isFinite(o)){if("m"===e.unit)return e}else o=t,A="m";switch(A){default:s=1;break;case"cm":s=.01;break;case"mm":s=.001}let l=s*o;return{type:"number",number:l,unit:"m"}},iI=(()=>{let identity=e=>e,e={rad:identity,deg:degreesToRadians,m:identity,mm:lengthToBaseMeters,cm:lengthToBaseMeters};return(t,s=im)=>{isFinite(t.number)||(t.number=s.number,t.unit=s.unit);let{unit:o}=t;if(null==o)return t;let A=e[o];return null==A?s:A(t)}})(),iE=Symbol("evaluate"),iC=Symbol("lastValue");let Evaluator=class Evaluator{constructor(){this[J]=null}static evaluatableFor(e,t=im){if(e instanceof Evaluator)return e;if("number"===e.type)return"%"===e.unit?new PercentageEvaluator(e,t):e;switch(e.name.value){case"calc":return new CalcEvaluator(e,t);case"env":return new EnvEvaluator(e)}return im}static evaluate(e){return e instanceof Evaluator?e.evaluate():e}static isConstant(e){return!(e instanceof Evaluator)||e.isConstant}static applyIntrinsics(e,t){let{basis:s,keywords:o}=t,{auto:A}=o;return s.map((t,s)=>{let l=null==A[s]?t:A[s],h=e[s]?e[s]:l;if("ident"===h.type){let e=h.value;e in o&&(h=o[e][s])}return((null==h||"ident"===h.type)&&(h=l),"%"===h.unit)?numberNode(h.number/100*t.number,t.unit):(h=iI(h,t)).unit!==t.unit?t:h})}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[iC]||(this[iC]=this[iE]()),this[iC]}};J=iC;let iB=Symbol("percentage"),iy=Symbol("basis");let PercentageEvaluator=class PercentageEvaluator extends Evaluator{constructor(e,t){super(),this[iB]=e,this[iy]=t}get isConstant(){return!0}[iE](){return numberNode(this[iB].number/100*this[iy].number,this[iy].unit)}};let iw=Symbol("identNode");let EnvEvaluator=class EnvEvaluator extends Evaluator{constructor(e){super(),this[Y]=null;let t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[iw]=t)}get isConstant(){return!1}[(Y=iw,iE)](){if(null!=this[iw]&&"window-scroll-y"===this[iw].value){let e=window.pageYOffset,t=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight),s=e/(t-window.innerHeight)||0;return{type:"number",number:s,unit:null}}return im}};let iv=/[\*\/]/,iQ=Symbol("evaluator");let CalcEvaluator=class CalcEvaluator extends Evaluator{constructor(e,t=im){if(super(),this[j]=null,1!==e.arguments.length)return;let s=e.arguments[0].terms.slice(),o=[];for(;s.length;){let e=s.shift();if(o.length>0){let s=o[o.length-1];if("operator"===s.type&&iv.test(s.value)){let s=o.pop(),A=o.pop();if(null==A)return;o.push(new OperatorEvaluator(s,Evaluator.evaluatableFor(A,t),Evaluator.evaluatableFor(e,t)));continue}}o.push("operator"===e.type?e:Evaluator.evaluatableFor(e,t))}for(;o.length>2;){let[e,s,A]=o.splice(0,3);if("operator"!==s.type)return;o.unshift(new OperatorEvaluator(s,Evaluator.evaluatableFor(e,t),Evaluator.evaluatableFor(A,t)))}1===o.length&&(this[iQ]=o[0])}get isConstant(){return null==this[iQ]||Evaluator.isConstant(this[iQ])}[(j=iQ,iE)](){return null!=this[iQ]?Evaluator.evaluate(this[iQ]):im}};let ix=Symbol("operator"),ib=Symbol("left"),iS=Symbol("right");let OperatorEvaluator=class OperatorEvaluator extends Evaluator{constructor(e,t,s){super(),this[ix]=e,this[ib]=t,this[iS]=s}get isConstant(){return Evaluator.isConstant(this[ib])&&Evaluator.isConstant(this[iS])}[iE](){let e;let t=iI(Evaluator.evaluate(this[ib])),s=iI(Evaluator.evaluate(this[iS])),{number:o,unit:A}=t,{number:l,unit:h}=s;if(null!=h&&null!=A&&h!=A)return im;switch(this[ix].value){case"+":e=o+l;break;case"-":e=o-l;break;case"/":e=o/l;break;case"*":e=o*l;break;default:return im}return{type:"number",number:e,unit:A||h}}};let iT=Symbol("evaluatables"),iM=Symbol("intrinsics");let StyleEvaluator=class StyleEvaluator extends Evaluator{constructor(e,t){super(),this[iM]=t;let s=e[0],o=null!=s?s.terms:[];this[iT]=t.basis.map((e,t)=>{let s=o[t];return null==s?{type:"ident",value:"auto"}:"ident"===s.type?s:Evaluator.evaluatableFor(s,e)})}get isConstant(){for(let e of this[iT])if(!Evaluator.isConstant(e))return!1;return!0}[iE](){let e=this[iT].map(e=>Evaluator.evaluate(e));return Evaluator.applyIntrinsics(e,this[iM]).map(e=>e.number)}};let iR=Symbol("instances"),iD=Symbol("activateListener"),iL=Symbol("deactivateListener"),iF=Symbol("notifyInstances"),i_=Symbol("notify"),ik=Symbol("callback");let ScrollObserver=class ScrollObserver{constructor(e){this[ik]=e}static[iF](){for(let e of ScrollObserver[iR])e[i_]()}static[(W=iR,iD)](){window.addEventListener("scroll",this[iF],{passive:!0})}static[iL](){window.removeEventListener("scroll",this[iF])}observe(){0===ScrollObserver[iR].size&&ScrollObserver[iD](),ScrollObserver[iR].add(this)}disconnect(){ScrollObserver[iR].delete(this),0===ScrollObserver[iR].size&&ScrollObserver[iL]()}[i_](){this[ik]()}};ScrollObserver[W]=new Set;let iU=Symbol("computeStyleCallback"),iG=Symbol("astWalker"),iN=Symbol("dependencies"),iP=Symbol("onScroll");let StyleEffector=class StyleEffector{constructor(e){this[$]={},this[X]=new ASTWalker(["function"]),this[ee]=()=>{this[iU]({relatedState:"window-scroll"})},this[iU]=e}observeEffectsFor(e){let t={},s=this[iN];for(let o in this[iG].walk(e,e=>{let{name:o}=e,A=e.arguments[0],l=A.terms[0];if("env"===o.value&&null!=l&&"ident"===l.type&&"window-scroll-y"===l.value&&null==t["window-scroll"]){let e="window-scroll"in s?s["window-scroll"]:new ScrollObserver(this[iP]);e.observe(),delete s["window-scroll"],t["window-scroll"]=e}}),s){let e=s[o];e.disconnect()}this[iN]=t}dispose(){for(let e in this[iN]){let t=this[iN][e];t.disconnect()}}};$=iN,X=iG,ee=iP;/* @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.
|
|
*/let style=e=>{let t=e.observeEffects||!1,s=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(o,A)=>{let l=o.updated,h=o.connectedCallback,c=o.disconnectedCallback,d=Symbol(`${A}StyleEffector`),g=Symbol(`${A}StyleEvaluator`),p=Symbol(`${A}UpdateEvaluator`),m=Symbol(`${A}EvaluateAndSync`);Object.defineProperties(o,{[d]:{value:null,writable:!0},[g]:{value:null,writable:!0},[p]:{value:function(){let e=ih(this[A]);this[g]=new StyleEvaluator(e,s(this)),null==this[d]&&t&&(this[d]=new StyleEffector(()=>this[m]())),null!=this[d]&&this[d].observeEffectsFor(e)}},[m]:{value:function(){if(null==this[g])return;let t=this[g].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(A)&&(this[p](),this[m]()),l.call(this,e)}},connectedCallback:{value:function(){h.call(this),this.requestUpdate(A,this[A])}},disconnectedCallback:{value:function(){c.call(this),null!=this[d]&&(this[d].dispose(),this[d]=null)}}})}},easeInOutQuad=e=>e<.5?2*e*e:-1+(4-2*e)*e,interpolate=(e,t,s=easeInOutQuad)=>o=>e+(t-e)*s(o),sequence=(e,t)=>{var s;let o=t.map((s=0,e=>s+=e));return t=>{t=clamp(t,0,1)*o[o.length-1];let s=o.findIndex(e=>e>=t),A=s<1?0:o[s-1],l=o[s];return e[s]((t-A)/(l-A))}},timeline=e=>{let t=[],s=[],o=e.initialValue;for(let A=0;A<e.keyframes.length;++A){let l=e.keyframes[A],{value:h,frames:c}=l,d=l.ease||easeInOutQuad,g=interpolate(o,h,d);t.push(g),s.push(c),o=h}return sequence(t,s)};/* @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 controls_decorate=function(e,t,s,o){var A,l=arguments.length,h=l<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(e,t,s,o);else for(var c=e.length-1;c>=0;c--)(A=e[c])&&(h=(l<3?A(h):l>3?A(t,s,h):A(t,s))||h);return l>3&&h&&Object.defineProperty(t,s,h),h};let iO=timeline({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}]}),iH=timeline({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),iV="0deg 75deg 105%",iq=["front","right","back","left"],iK=["upper-","","lower-"],iJ={AUTO:"auto"},iz={BASIC:"basic",WIGGLE:"wiggle"},fieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(30,"deg"))],keywords:{auto:[null]}}),minFieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(12,"deg"))],keywords:{auto:[null]}}),iY=(()=>{let e=ih(iV)[0].terms,t=iI(e[0]),s=iI(e[1]);return e=>{let o=e[ny].idealCameraDistance();return{basis:[t,s,numberNode(o,"m")],keywords:{auto:[null,null,numberNode(105,"%")]}}}})(),minCameraOrbitIntrinsics=e=>{let t=2.2*e[ny].boundingSphere.radius;return{basis:[numberNode(-1/0,"rad"),numberNode(Math.PI/8,"rad"),numberNode(t,"m")],keywords:{auto:[null,null,null]}}},maxCameraOrbitIntrinsics=e=>{let t=iY(e),s=new StyleEvaluator([],t),o=s.evaluate()[2];return{basis:[numberNode(1/0,"rad"),numberNode(Math.PI-Math.PI/8,"rad"),numberNode(o,"m")],keywords:{auto:[null,null,null]}}},cameraTargetIntrinsics=e=>{let t=e[ny].boundingBox.getCenter(new eS.Pa4);return{basis:[numberNode(t.x,"m"),numberNode(t.y,"m"),numberNode(t.z,"m")],keywords:{auto:[null,null,null]}}},ij=Math.PI/2,iW=Math.PI/3,i$=ij/2,iX=2*Math.PI,iZ=Symbol("controls"),i0=Symbol("panElement"),i1=Symbol("promptElement"),i2=Symbol("promptAnimatedContainer"),i3=Symbol("fingerAnimatedContainers"),i4=Symbol("deferInteractionPrompt"),i8=Symbol("updateAria"),i5=Symbol("updateCameraForRadius"),i6=Symbol("cancelPrompts"),i9=Symbol("onChange"),i7=Symbol("onPointerChange"),se=Symbol("waitingToPromptUser"),st=Symbol("userHasInteracted"),si=Symbol("promptElementVisibleTime"),ss=Symbol("lastPromptOffset"),sr=Symbol("cancellationSource"),sn=Symbol("lastSpherical"),sa=Symbol("jumpCamera"),so=Symbol("initialized"),sA=Symbol("maintainThetaPhi"),sl=Symbol("syncCameraOrbit"),sh=Symbol("syncFieldOfView"),sc=Symbol("syncCameraTarget"),su=Symbol("syncMinCameraOrbit"),sd=Symbol("syncMaxCameraOrbit"),sg=Symbol("syncMinFieldOfView"),sp=Symbol("syncMaxFieldOfView"),sm=new eS.FM8,sI=new eS.Pa4,sf=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),sE=Math.PI/8,sC={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};let SmoothControls=class SmoothControls extends eS.pBf{constructor(e,t,s){super(),this.camera=e,this.element=t,this.scene=s,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=sC.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new eS.Vkp,this.panPerPixel=0,this.spherical=new eS.$V,this.goalSpherical=new eS.$V,this.thetaDamper=new Damper,this.phiDamper=new Damper,this.radiusDamper=new Damper,this.logFov=Math.log(sf.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new Damper,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(let 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){let e=this.twoTouchDistance(this.pointers[0],this.pointers[1]),t=.04*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)=>{let{touchAction:s}=this._options;if(!this.touchDecided&&"none"!==s){this.touchDecided=!0;let o=Math.abs(e),A=Math.abs(t);if(this.changeSource===sC.USER_INTERACTION&&("pan-y"===s&&A>o||"pan-x"===s&&o>A)){this.touchMode=null;return}this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.onPointerDown=e=>{if(this.pointers.length>2)return;let{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?sC.AUTOMATIC:sC.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=sC.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===sC.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=e=>{let t=this.pointers.find(t=>t.id===e.pointerId);if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons){this.onPointerUp(e);return}let s=this.pointers.length,o=(e.clientX-t.clientX)/s,A=(e.clientY-t.clientY)/s;(0!==o||0!==A)&&(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?sC.AUTOMATIC:sC.USER_INTERACTION,null!==this.touchMode&&this.touchMode(o,A)):(this.changeSource=sC.USER_INTERACTION,this.panPerPixel>0?this.movePan(o,A):this.handleSinglePointerMove(o,A)))},this.onPointerUp=e=>{let{element:t}=this,s=this.pointers.findIndex(t=>t.id===e.pointerId);-1!==s&&this.pointers.splice(s,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[i0].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=sC.USER_INTERACTION;let t=e.deltaY*(1==e.deltaMode?18:1)*.04*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{let{changeSource:t}=this;this.changeSource=sC.USER_INTERACTION;let s=e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e);s?(e.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=t},this._options=Object.assign({},sf),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){let{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){let{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 eS.$V){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,s=this.goalSpherical.radius){let{minimumAzimuthalAngle:o,maximumAzimuthalAngle:A,minimumPolarAngle:l,maximumPolarAngle:h,minimumRadius:c,maximumRadius:d}=this._options,{theta:g,phi:p,radius:m}=this.goalSpherical,I=clamp(e,o,A);isFinite(o)||isFinite(A)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-I)+I);let f=clamp(t,l,h),E=clamp(s,c,d);return!!((I!==g||f!==p||E!==m)&&isFinite(I)&&isFinite(f)&&isFinite(E))&&(this.goalSpherical.theta=I,this.goalSpherical.phi=f,this.goalSpherical.radius=E,this.goalSpherical.makeSafe(),!0)}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){let{minimumFieldOfView:t,maximumFieldOfView:s}=this._options;e=clamp(e,t,s),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,s){let{theta:o,phi:A,radius:l}=this.goalSpherical,{minimumRadius:h,maximumRadius:c,minimumFieldOfView:d,maximumFieldOfView:g}=this._options,p=this.spherical.theta-o,m=Math.PI-.001,I=o-clamp(e,-m-p,m-p),f=0===s?0:((s>0?c:h)-l)/(Math.log(s>0?g:d)-this.goalLogFov),E=l+s*(isFinite(f)?f:(c-h)*2);if(this.setOrbit(I,A-t,E),0!==s){let e=this.goalLogFov+s;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;let{maximumPolarAngle:s,maximumRadius:o}=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,s),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,o),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){let{style:e}=this.element;if(this._interactionEnabled){let{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 eS.USm(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,s){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,s*this.inputSensitivity)}wrapAngle(e){let 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){let{clientX:s,clientY:o}=e,{clientX:A,clientY:l}=t,h=A-s,c=l-o;return Math.sqrt(h*h+c*c)}handleSinglePointerMove(e,t){let s=this.pixelLengthToSphericalAngle(e),o=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(s,o,0)}initializePan(){let{theta:e,phi:t}=this.spherical,s=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(s),-Math.cos(t)*Math.sin(s),0,0,Math.sin(t),0,Math.sin(s),-Math.cos(t)*Math.cos(s),0)}movePan(e,t){let{scene:s}=this,o=sI.set(e,t,0).multiplyScalar(this.inputSensitivity),A=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;o.multiplyScalar(A);let l=s.getTarget();l.add(o.applyMatrix3(this.panProjection)),s.boundingSphere.clampPoint(l,l),s.setTarget(l.x,l.y,l.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;let{scene:t}=this,s=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==s){let{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(s.position),t.setTarget(s.position.x,s.position.y,s.position.z)}resetRadius(){let{scene:e}=this,t=e.positionAndNormalFromPoint(sm.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);let s=e.getTarget(),{theta:o,phi:A}=this.spherical,l=o-e.yaw,h=sI.set(Math.sin(A)*Math.sin(l),Math.cos(A),Math.sin(A)*Math.cos(l)),c=h.dot(t.position.sub(s));s.add(h.multiplyScalar(c)),e.setTarget(s.x,s.y,s.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-c)}onTouchChange(e){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom){this.touchMode=null,this.element.removeEventListener("touchmove",this.disableScroll);return}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[i0].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[i0].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,.04*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-sE,0);break;case"ArrowDown":this.userAdjustOrbit(0,sE,0);break;case"ArrowLeft":this.userAdjustOrbit(-sE,0,0);break;case"ArrowRight":this.userAdjustOrbit(sE,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}};let sB={NOT_PRESENTING:"not-presenting",SESSION_STARTED:"session-started",OBJECT_PLACED:"object-placed",FAILED:"failed"},sy={TRACKING:"tracking",NOT_TRACKING:"not-tracking"},sw=new eS.Pa4,sv=new eS.yGw,sQ=new eS.Pa4,sx=new eS.cPb(45,1,.1,100);let ARRenderer=class ARRenderer extends eS.pBf{constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=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.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new eS.Pa4,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new eS.Pa4,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new eS.Pa4,this.goalYaw=0,this.goalScale=1,this.xDamper=new Damper,this.yDamper=new Damper,this.zDamper=new Damper,this.yawDamper=new Damper,this.scaleDamper=new Damper,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new PlacementBox(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=e=>{let t=this.transientHitTestSource;if(null==t)return;let s=this.frame.getHitTestResultsForTransientInput(t),o=this.presentedScene,A=this.placementBox;if(1===s.length){this.inputSource=e.inputSource;let{axes:t}=this.inputSource.gamepad,s=A.getHit(this.presentedScene,t[0],t[1]);A.show=!0,null!=s?(this.isTranslating=!0,this.lastDragPosition.copy(s)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===s.length){A.show=!0,this.isTwoFingering=!0;let{separation:e}=this.fingerPolar(s);this.firstRatio=e/o.scale.x}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){assertIsArCandidate();let e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["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 assertIsArCandidate(),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 s=new Promise((e,t)=>{requestAnimationFrame(()=>e())});e.setHotspotsVisibility(!1),e.queueRender(),await s,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),!0===t&&(this.xrLight=new XREstimatedLight(this.threeRenderer),this.xrLight.addEventListener("estimationstart",()=>{if(!this.isPresenting||null==this.xrLight)return;let e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment}));let o=await this.resolveARSession();o.addEventListener("end",()=>{this.postSessionCleanup()},{once:!0});let A=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");A.classList.add("enabled"),A.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=A;let l=await o.requestReferenceSpace("viewer");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);let h=20*Math.PI/180,c=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(h),z:-Math.cos(h)});o.requestHitTestSource({space:l,offsetRay:c}).then(e=>{this.initialHitSource=e}),this.currentSession=o,this.placementBox=new PlacementBox(e,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:sB.SESSION_STARTED})}async stopPresenting(){if(!this.isPresenting)return;let 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(){let e=this.presentedScene;if(null!=e){let 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)}}postSessionCleanup(){let e=this.currentSession;null!=e&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);let t=this.presentedScene;if(this._presentedScene=null,null!=t){let{element:e}=t;null!=this.xrLight&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),t.position.set(0,0,0),t.scale.set(1,1,1),t.setShadowOffset(0);let s=this.turntableRotation;null!=s&&(t.yaw=s);let o=this.oldShadowIntensity;null!=o&&t.setShadowIntensity(o),t.setEnvironmentAndSkybox(e[tp],e[tm]);let A=this.oldTarget;t.setTarget(A.x,A.y,A.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0),e.requestUpdate("cameraTarget"),e.requestUpdate("maxCameraOrbit"),e[nx](e.getBoundingClientRect()),requestAnimationFrame(()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:sC.NONE}}))})}this.renderer.height=0;let s=this.exitWebXRButtonContainer;null!=s&&(s.classList.remove("enabled"),s.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);let o=this.transientHitTestSource;null!=o&&(o.cancel(),this.transientHitTestSource=null);let A=this.initialHitSource;null!=A&&(A.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:sB.NOT_PRESENTING})}updateView(e){let t=this.presentedScene,s=this.threeRenderer.xr;s.updateCamera(sx),t.xrCamera=s.getCamera();let{elements:o}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(o[1],o[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){let t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}let A=s.getBaseLayer();if(null!=A){let t=A instanceof XRWebGLLayer?A.getViewport(e):s.getBinding().getViewSubImage(A,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){let e=this.presentedScene,{position:t,element:s}=e,o=e.getCamera(),{width:A,height:l}=this.overlay.getBoundingClientRect();e.setSize(A,l),o.projectionMatrixInverse.copy(o.projectionMatrix).invert();let{theta:h,radius:c}=s.getCameraOrbit(),d=o.getWorldDirection(sw);e.yaw=Math.atan2(-d.x,-d.z)-h,this.goalYaw=e.yaw,t.copy(o.position).add(d.multiplyScalar(c)),this.updateTarget();let g=e.getTarget();t.add(g).sub(this.oldTarget),this.goalPosition.copy(t),e.setHotspotsVisibility(!0);let{session:p}=this.frame;p.addEventListener("selectstart",this.onSelectStart),p.addEventListener("selectend",this.onSelectEnd),p.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then(e=>{this.transientHitTestSource=e})}getTouchLocation(){let{axes:e}=this.inputSource.gamepad,t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return null!=t&&(sw.copy(t).sub(this.presentedScene.getCamera().position),sw.length()>10)?null:t}getHitPoint(e){let t=this.threeRenderer.xr.getReferenceSpace(),s=e.getPose(t);if(null==s)return null;let o=sv.fromArray(s.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(o.elements[4],o.elements[6])),o.elements[5]>.75!==this.placeOnWall?sQ.setFromMatrixPosition(o):null}moveToFloor(e){let t=this.initialHitSource;if(null==t)return;let s=e.getHitTestResults(t);if(0==s.length)return;let o=s[0],A=this.getHitPoint(o);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:sB.OBJECT_PLACED}))}fingerPolar(e){let t=e[0].inputSource.gamepad.axes,s=e[1].inputSource.gamepad.axes,o=s[0]-t[0],A=s[1]-t[1],l=Math.atan2(A,o),h=this.lastAngle-l;return h>Math.PI?h-=2*Math.PI:h<-Math.PI&&(h+=2*Math.PI),this.lastAngle=l,{separation:Math.sqrt(o*o+A*A),deltaYaw:h}}processInput(e){let t=this.transientHitTestSource;if(null==t||!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;let s=e.getHitTestResultsForTransientInput(t),o=this.presentedScene,A=o.scale.x;if(this.isTwoFingering){if(s.length<2)this.isTwoFingering=!1;else{let{separation:e,deltaYaw:t}=this.fingerPolar(s);if(!1===this.placeOnWall&&(this.goalYaw+=t),o.canScale){let t=e/this.firstRatio;this.goalScale=t<1.3&&t>.7692307692307692?1:t}}return}if(2===s.length){this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;let{separation:e}=this.fingerPolar(s);this.firstRatio=e/A;return}if(this.isRotating){let e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&s.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),!1===this.placeOnWall){let e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/A,this.presentedScene.setShadowOffset(e);let s=sw.copy(o.getCamera().position),l=-e/(s.y-t.y);s.multiplyScalar(l),t.multiplyScalar(1-l).add(s)}}this.goalPosition.add(t),this.lastDragPosition.copy(t)}})}moveScene(e){let t=this.presentedScene,{position:s,yaw:o}=t,A=t.boundingSphere.radius,l=this.goalPosition,h=t.scale.x,c=this.placementBox,d=sC.NONE;if(!l.equals(s)||this.goalScale!==h){d=sC.USER_INTERACTION;let{x:o,y:g,z:p}=s;o=this.xDamper.update(o,l.x,e,A),g=this.yDamper.update(g,l.y,e,A),p=this.zDamper.update(p,l.z,e,A),s.set(o,g,p);let m=this.scaleDamper.update(h,this.goalScale,e,1);if(t.scale.set(m,m,m),!this.isTranslating){let e=l.y-g;this.placementComplete&&!1===this.placeOnWall?(c.offsetHeight=e/m,t.setShadowOffset(e)):0===e&&(this.placementComplete=!0,c.show=!1,t.setShadowIntensity(.8))}}c.updateOpacity(e),t.updateTarget(e),t.yaw=this.yawDamper.update(o,this.goalYaw,e,Math.PI),t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:d}}))}onWebXRFrame(e,t){this.frame=t,++this.frames;let s=this.threeRenderer.xr.getReferenceSpace(),o=t.getViewerPose(s);null==o&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:sy.NOT_TRACKING}));let A=this.presentedScene;if(null==o||null==A||!A.element.loaded){this.threeRenderer.clear();return}!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:sy.TRACKING}));let l=!0;for(let s of o.views){if(this.updateView(s),l){this.moveToFloor(t),this.processInput(t);let s=e-this.lastTick;this.moveScene(s),this.renderer.preRender(A,e,s),this.lastTick=e,A.renderShadow(this.threeRenderer)}this.threeRenderer.render(A,A.getCamera()),l=!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.
|
|
*/let sb=Symbol("prepared"),sS=Symbol("prepare"),sT=Symbol("preparedGLTF"),sM=Symbol("clone");let GLTFInstance=class GLTFInstance{constructor(e){this[sT]=e}static prepare(e){if(null==e.scene)throw Error("Model does not have a scene");if(e[sb])return e;let t=this[sS](e);return t[sb]=!0,t}static[sS](e){let{scene:t}=e,s=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:s})}get parser(){return this[sT].parser}get animations(){return this[sT].animations}get scene(){return this[sT].scene}get scenes(){return this[sT].scenes}get cameras(){return this[sT].cameras}get asset(){return this[sT].asset}get userData(){return this[sT].userData}clone(){let e=this.constructor,t=this[sM]();return new e(t)}dispose(){this.scenes.forEach(e=>{e.traverse(e=>{if(!e.material)return;let t=Array.isArray(e.material)?e.material:[e.material];t.forEach(e=>{for(let t in e){let s=e[t];if(s instanceof eS.xEZ){let e=s.source.data;null!=e.close&&e.close(),s.dispose()}}e.dispose()}),e.geometry.dispose()})})}[sM](){let e=this[sT],t=function(e){let t=new Map,s=new Map,o=e.clone();return function parallelTraverse(e,t,s){s(e,t);for(let o=0;o<e.children.length;o++)parallelTraverse(e.children[o],t.children[o],s)}(e,o,function(e,o){t.set(o,e),s.set(e,o)}),o.traverse(function(e){if(!e.isSkinnedMesh)return;let o=t.get(e),A=o.skeleton.bones;e.skeleton=o.skeleton.clone(),e.bindMatrix.copy(o.bindMatrix),e.skeleton.bones=A.map(function(e){return s.get(e)}),e.bind(e.skeleton,e.bindMatrix)}),o}(this.scene);cloneVariantMaterials(t,this.scene);let s=[t],o=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:s,userData:o})}};let cloneVariantMaterials=(e,t)=>{traversePair(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)})},traversePair=(e,t,s)=>{s(e,t);for(let o=0;o<e.children.length;o++)traversePair(e.children[o],t.children[o],s)},sR=Symbol("threeGLTF"),sD=Symbol("gltf"),sL=Symbol("gltfElementMap"),sF=Symbol("threeObjectMap"),s_=Symbol("parallelTraverseThreeScene"),sk=Symbol("correlateOriginalThreeGLTF"),sU=Symbol("correlateCloneThreeGLTF");let CorrelatedSceneGraph=class CorrelatedSceneGraph{constructor(e,t,s,o){this[sR]=e,this[sD]=t,this[sL]=o,this[sF]=s}static from(e,t){return null!=t?this[sU](e,t):this[sk](e)}static[sk](e){let t=e.parser.json,s=e.parser.associations,o=new Map,A={name:"Default"},l={index:-1};for(let e of s.keys())e instanceof eS.F5T&&null==s.get(e)&&(l.index<0&&(null==t.materials&&(t.materials=[]),l.index=t.materials.length,t.materials.push(A)),e.name=A.name,s.set(e,{materials:l.index}));for(let[e,A]of s)for(let s in A&&(e.userData=e.userData||{},e.userData.associations=A),A)if(null!=s&&"primitives"!==s){let l=t[s]||[],h=l[A[s]];if(null==h)continue;let c=o.get(h);null==c&&(c=new Set,o.set(h,c)),c.add(e)}return new CorrelatedSceneGraph(e,t,s,o)}static[sU](e,t){let s=t.threeGLTF,o=t.gltf,A=JSON.parse(JSON.stringify(o)),l=new Map,h=new Map;for(let o=0;o<s.scenes.length;o++)this[s_](s.scenes[o],e.scenes[o],(e,s)=>{let o=t.threeObjectMap.get(e);if(null!=o){for(let e in o)if(null!=e&&"primitives"!==e){let t=o[e],c=A[e][t],d=l.get(s)||{};d[e]=t,l.set(s,d);let g=h.get(c)||new Set;g.add(s),h.set(c,g)}}});return new CorrelatedSceneGraph(e,A,l,h)}static[s_](e,t,s){let traverse=(e,t)=>{if(s(e,t),e.isObject3D){if(e.material){if(Array.isArray(e.material))for(let o=0;o<e.material.length;++o)s(e.material[o],t.material[o]);else s(e.material,t.material)}for(let s=0;s<e.children.length;++s)traverse(e.children[s],t.children[s])}};traverse(e,t)}get threeGLTF(){return this[sR]}get gltf(){return this[sD]}get gltfElementMap(){return this[sL]}get threeObjectMap(){return this[sF]}};/* @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.
|
|
*/let sG=Symbol("correlatedSceneGraph");let ModelViewerGLTFInstance=class ModelViewerGLTFInstance extends GLTFInstance{static[sS](e){let t=super[sS](e);null==t[sG]&&(t[sG]=CorrelatedSceneGraph.from(t));let{scene:s}=t,o=new eS.aLr(void 0,1/0);return s.traverse(e=>{if(e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid),e.material){let{geometry:s}=e;e.castShadow=!0,e.isSkinnedMesh&&(s.boundingSphere=o,s.boundingBox=null);let A=e.material;if(!0===A.isMeshBasicMaterial&&(A.toneMapped=!1),A.shadowSide=eS.Wl3,A.aoMap){let{gltf:e,threeObjectMap:o}=t[sG],l=o.get(A);if(null!=e.materials&&null!=l&&null!=l.materials){let t=e.materials[l.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=s.attributes.uv&&s.setAttribute("uv2",s.attributes.uv)}}}}),t}get correlatedSceneGraph(){return this[sT][sG]}[sM](){let e=super[sM](),t=new Map;return e.scene.traverse(e=>{if(e.material){let s=e.material;if(null!=s){if(t.has(s.uuid)){e.material=t.get(s.uuid);return}e.material=s.clone(),t.set(s.uuid,e.material)}}void 0!==e.target&&e.add(e.target)}),e[sG]=CorrelatedSceneGraph.from(e,this.correlatedSceneGraph),e}};let getBufferForType=(e,t,s)=>{let o;switch(e){case eS.ywz:o=new Uint8ClampedArray(t*s*4);break;case eS.cLu:o=new Uint16Array(t*s*4);break;case eS.JQ4:o=new Uint32Array(t*s*4);break;case eS.T95:o=new Int8Array(t*s*4);break;case eS.iAb:o=new Int16Array(t*s*4);break;case eS.Kz5:o=new Int32Array(t*s*4);break;case eS.VzW:o=new Float32Array(t*s*4);break;default:throw Error("Unsupported data type")}return o},canReadPixels=(e,t,s,o)=>{if(void 0!==C)return C;let A=new eS.dd2(1,1,o);t.setRenderTarget(A);let l=new eS.Kj0(new eS._12,new eS.vBJ({color:16777215}));t.render(l,s),t.setRenderTarget(null);let h=getBufferForType(e,A.width,A.height);return t.readRenderTargetPixels(A,0,0,A.width,A.height,h),A.dispose(),l.geometry.dispose(),l.material.dispose(),C=0!==h[0]};let QuadRenderer_Nn9ZcWDa_QuadRenderer=class QuadRenderer_Nn9ZcWDa_QuadRenderer{constructor(e){var t,s,o,A,l,h,c,d,g,p,m,I,f,E,C,B;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.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)},this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;let y={format:eS.wk1,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:(null===(t=e.renderTargetOptions)||void 0===t?void 0:t.anisotropy)!==void 0?null===(s=e.renderTargetOptions)||void 0===s?void 0:s.anisotropy:1,generateMipmaps:(null===(o=e.renderTargetOptions)||void 0===o?void 0:o.generateMipmaps)!==void 0&&(null===(A=e.renderTargetOptions)||void 0===A?void 0:A.generateMipmaps),magFilter:(null===(l=e.renderTargetOptions)||void 0===l?void 0:l.magFilter)!==void 0?null===(h=e.renderTargetOptions)||void 0===h?void 0:h.magFilter:eS.wem,minFilter:(null===(c=e.renderTargetOptions)||void 0===c?void 0:c.minFilter)!==void 0?null===(d=e.renderTargetOptions)||void 0===d?void 0:d.minFilter:eS.wem,samples:(null===(g=e.renderTargetOptions)||void 0===g?void 0:g.samples)!==void 0?null===(p=e.renderTargetOptions)||void 0===p?void 0:p.samples:void 0,wrapS:(null===(m=e.renderTargetOptions)||void 0===m?void 0:m.wrapS)!==void 0?null===(I=e.renderTargetOptions)||void 0===I?void 0:I.wrapS:eS.uWy,wrapT:(null===(f=e.renderTargetOptions)||void 0===f?void 0:f.wrapT)!==void 0?null===(E=e.renderTargetOptions)||void 0===E?void 0:E.wrapT:eS.uWy};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=QuadRenderer_Nn9ZcWDa_QuadRenderer.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new eS.xsS,this._camera=new eS.iKG,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(),!canReadPixels(this._type,this._renderer,this._camera,y)){let e;this._type===eS.cLu&&(e=this._renderer.extensions.has("EXT_color_buffer_float")?eS.VzW:void 0),void 0!==e?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${eS.VzW}`),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 eS.Kj0(new eS._12,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new eS.dd2(this.width,this.height,y),this._renderTarget.texture.mapping=(null===(C=e.renderTargetOptions)||void 0===C?void 0:C.mapping)!==void 0?null===(B=e.renderTargetOptions)||void 0===B?void 0:B.mapping:eS.xfE}static instantiateRenderer(){let e=new eS.CP7;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw Error("Can't read pixels in this browser");let e=getBufferForType(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){let t=new eS.IEO(this.toArray(),this.width,this.height,eS.wk1,this._type,(null==e?void 0:e.mapping)||eS.xfE,(null==e?void 0:e.wrapS)||eS.uWy,(null==e?void 0:e.wrapT)||eS.uWy,(null==e?void 0:e.magFilter)||eS.wem,(null==e?void 0:e.minFilter)||eS.wem,(null==e?void 0:e.anisotropy)||1,eS.GUF);return t.generateMipmaps=(null==e?void 0:e.generateMipmaps)!==void 0&&(null==e?void 0:e.generateMipmaps),t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof eS.jyz&&Object.values(this.material.uniforms).forEach(e=>{e.value instanceof eS.xEZ&&e.value.dispose()}),Object.values(this.material).forEach(e=>{e instanceof eS.xEZ&&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}};let sN=`
|
|
varying vec2 vUv;
|
|
|
|
void main() {
|
|
vUv = uv;
|
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
}
|
|
`,sP=`
|
|
// min half float value
|
|
#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )
|
|
// max half float value
|
|
#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )
|
|
|
|
uniform sampler2D sdr;
|
|
uniform sampler2D gainMap;
|
|
uniform vec3 gamma;
|
|
uniform vec3 offsetHdr;
|
|
uniform vec3 offsetSdr;
|
|
uniform vec3 gainMapMin;
|
|
uniform vec3 gainMapMax;
|
|
uniform float weightFactor;
|
|
|
|
varying vec2 vUv;
|
|
|
|
void main() {
|
|
vec3 rgb = texture2D( sdr, vUv ).rgb;
|
|
vec3 recovery = texture2D( gainMap, vUv ).rgb;
|
|
vec3 logRecovery = pow( recovery, gamma );
|
|
vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;
|
|
vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;
|
|
vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));
|
|
gl_FragColor = vec4( clampedHdrColor , 1.0 );
|
|
}
|
|
`;let GainMapDecoderMaterial=class GainMapDecoderMaterial extends eS.jyz{constructor({gamma:e,offsetHdr:t,offsetSdr:s,gainMapMin:o,gainMapMax:A,maxDisplayBoost:l,hdrCapacityMin:h,hdrCapacityMax:c,sdr:d,gainMap:g}){super({name:"GainMapDecoderMaterial",vertexShader:sN,fragmentShader:sP,uniforms:{sdr:{value:d},gainMap:{value:g},gamma:{value:new eS.Pa4(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new eS.Pa4().fromArray(t)},offsetSdr:{value:new eS.Pa4().fromArray(s)},gainMapMin:{value:new eS.Pa4().fromArray(o)},gainMapMax:{value:new eS.Pa4().fromArray(A)},weightFactor:{value:(Math.log2(l)-h)/(c-h)}},blending:eS.jFi,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=l,this._hdrCapacityMin=h,this._hdrCapacityMax=c,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(){let e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){let 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(){let e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}};let GainMapNotFoundError=class GainMapNotFoundError extends Error{};let XMPMetadataNotFoundError=class XMPMetadataNotFoundError extends Error{};let getAttribute=(e,t,s)=>{var o;let A;let l=null===(o=e.attributes.getNamedItem(t))||void 0===o?void 0:o.nodeValue;if(l)A=l;else{let o=e.getElementsByTagName(t)[0];if(o){let e=o.getElementsByTagName("rdf:li");if(3===e.length)A=Array.from(e).map(e=>e.innerHTML);else throw Error(`Gainmap metadata contains an array of items for ${t} but its length is not 3`)}else{if(s)return s;throw Error(`Can't find ${t} in gainmap metadata`)}}return A},extractXMP=e=>{var t,s;let o;let A=(o="undefined"!=typeof TextDecoder?new TextDecoder().decode(e):e.toString()).indexOf("<x:xmpmeta"),l=new DOMParser;for(;-1!==A;){let e=o.indexOf("x:xmpmeta>",A);o.slice(A,e+10);let h=o.slice(A,e+10);try{let e=l.parseFromString(h,"text/xml"),o=e.getElementsByTagName("rdf:Description")[0],A=getAttribute(o,"hdrgm:GainMapMin","0"),c=getAttribute(o,"hdrgm:GainMapMax"),d=getAttribute(o,"hdrgm:Gamma","1"),g=getAttribute(o,"hdrgm:OffsetSDR","0.015625"),p=getAttribute(o,"hdrgm:OffsetHDR","0.015625"),m=null===(t=o.attributes.getNamedItem("hdrgm:HDRCapacityMin"))||void 0===t?void 0:t.nodeValue;m||(m="0");let I=null===(s=o.attributes.getNamedItem("hdrgm:HDRCapacityMax"))||void 0===s?void 0:s.nodeValue;if(!I)throw Error("Incomplete gainmap metadata");return{gainMapMin:Array.isArray(A)?A.map(e=>parseFloat(e)):[parseFloat(A),parseFloat(A),parseFloat(A)],gainMapMax:Array.isArray(c)?c.map(e=>parseFloat(e)):[parseFloat(c),parseFloat(c),parseFloat(c)],gamma:Array.isArray(d)?d.map(e=>parseFloat(e)):[parseFloat(d),parseFloat(d),parseFloat(d)],offsetSdr:Array.isArray(g)?g.map(e=>parseFloat(e)):[parseFloat(g),parseFloat(g),parseFloat(g)],offsetHdr:Array.isArray(p)?p.map(e=>parseFloat(e)):[parseFloat(p),parseFloat(p),parseFloat(p)],hdrCapacityMin:parseFloat(m),hdrCapacityMax:parseFloat(I)}}catch(e){}A=o.indexOf("<x:xmpmeta",e)}};let MPFExtractor=class MPFExtractor{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,s)=>{let o;let A=this.options.debug,l=new DataView(e.buffer);if(65496!==l.getUint16(0)){s(Error("Not a valid jpeg"));return}let h=l.byteLength,c=2,d=0;for(;c<h;){if(++d>250){s(Error(`Found no marker after ${d} loops 😵`));return}if(255!==l.getUint8(c)){s(Error(`Not a valid marker at offset 0x${c.toString(16)}, found: 0x${l.getUint8(c).toString(16)}`));return}if(o=l.getUint8(c+1),A&&console.log(`Marker: ${o.toString(16)}`),226===o){A&&console.log("Found APP2 marker (0xffe2)");let e=c+4;if(1297106432===l.getUint32(e)){let o;let A=e+4;if(18761===l.getUint16(A))o=!1;else if(19789===l.getUint16(A))o=!0;else{s(Error("No valid endianness marker found in TIFF header"));return}if(42!==l.getUint16(A+2,!o)){s(Error("Not valid TIFF data! (no 0x002A marker)"));return}let h=l.getUint32(A+4,!o);if(h<8){s(Error("Not valid TIFF data! (First offset less than 8)"));return}let c=A+h,d=l.getUint16(c,!o),g=c+2,p=0;for(let e=g;e<g+12*d;e+=12)45057===l.getUint16(e,!o)&&(p=l.getUint32(e+8,!o));let m=c+2+12*d+4,I=[];for(let e=m;e<m+16*p;e+=16){let t={MPType:l.getUint32(e,!o),size:l.getUint32(e+4,!o),dataOffset:l.getUint32(e+8,!o),dependantImages:l.getUint32(e+12,!o),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=A+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,I.push(t)}if(this.options.extractNonFII&&I.length){let e=new Blob([l]),s=[];for(let t of I){if(t.isFII&&!this.options.extractFII)continue;let o=e.slice(t.start,t.end+1,"image/jpeg");s.push(o)}t(s)}}}c+=2+l.getUint16(c+2)}})}};let extractGainmapFromJPEG=async e=>{let t=extractXMP(e);if(!t)throw new XMPMetadataNotFoundError("Gain map XMP metadata not found");let s=new MPFExtractor({extractFII:!0,extractNonFII:!0}),o=await s.extract(e);if(2!==o.length)throw new GainMapNotFoundError("Gain map recovery image not found");return{sdr:new Uint8Array(await o[0].arrayBuffer()),gainMap:new Uint8Array(await o[1].arrayBuffer()),metadata:t}},getHTMLImageFromBlob=e=>new Promise((t,s)=>{let o=document.createElement("img");o.onload=()=>{t(o)},o.onerror=e=>{s(e)},o.src=URL.createObjectURL(e)});let LoaderBase=class LoaderBase extends eS.aNw{constructor(e,t){super(t),this._renderer=e,this._internalLoadingManager=new eS.lLk}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){let e=new GainMapDecoderMaterial({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 eS.xEZ,sdr:new eS.xEZ});return new QuadRenderer_Nn9ZcWDa_QuadRenderer({width:16,height:16,type:eS.cLu,colorSpace:eS.GUF,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,s,o){let A,l;let h=o?new Blob([o],{type:"image/jpeg"}):void 0,c=new Blob([s],{type:"image/jpeg"}),d=!1;if("undefined"==typeof createImageBitmap){let e=await Promise.all([h?getHTMLImageFromBlob(h):Promise.resolve(void 0),getHTMLImageFromBlob(c)]);l=e[0],A=e[1],d=!0}else{let e=await Promise.all([h?createImageBitmap(h,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(c,{imageOrientation:"flipY"})]);l=e[0],A=e[1]}let g=new eS.xEZ(l||new ImageData(2,2),eS.xfE,eS.uWy,eS.uWy,eS.wem,eS.FDw,eS.wk1,eS.ywz,1,eS.GUF);g.flipY=d,g.needsUpdate=!0;let p=new eS.xEZ(A,eS.xfE,eS.uWy,eS.uWy,eS.wem,eS.FDw,eS.wk1,eS.ywz,1,eS.KI_);p.flipY=d,p.needsUpdate=!0,e.width=A.width,e.height=A.height,e.material.gainMap=g,e.material.sdr=p,e.material.gainMapMin=t.gainMapMin,e.material.gainMapMax=t.gainMapMax,e.material.offsetHdr=t.offsetHdr,e.material.offsetSdr=t.offsetSdr,e.material.gamma=t.gamma,e.material.hdrCapacityMin=t.hdrCapacityMin,e.material.hdrCapacityMax=t.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,t.hdrCapacityMax),e.material.needsUpdate=!0,e.render()}};let HDRJPGLoader=class HDRJPGLoader extends LoaderBase{load(e,t,s,o){let A=this.prepareQuadRenderer(),l=new eS.hH6(this._internalLoadingManager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(this.withCredentials),this.manager.itemStart(e),l.load(e,async s=>{let l,h,c;if("string"==typeof s)throw Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");let d=new Uint8Array(s);try{let e=await extractGainmapFromJPEG(d);l=e.sdr,h=e.gainMap,c=e.metadata}catch(t){if(t instanceof XMPMetadataNotFoundError||t instanceof GainMapNotFoundError)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),c={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},l=d;else throw t}try{await this.render(A,c,l,h)}catch(t){this.manager.itemError(e),"function"==typeof o&&o(t),A.disposeOnDemandRenderer();return}"function"==typeof t&&t(A),this.manager.itemEnd(e),A.disposeOnDemandRenderer()},s,t=>{this.manager.itemError(e),"function"==typeof o&&o(t)}),A}};let RGBELoader=class RGBELoader extends eS.yxD{constructor(e){super(e),this.type=eS.cLu}parse(e){let t,s,o;let rgbe_error=function(e,t){switch(e){case 1:throw Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw Error("THREE.RGBELoader: Memory Error: "+(t||""))}},fgets=function(e,t,s){t=t||1024;let o=e.pos,A=-1,l=0,h="",c=String.fromCharCode.apply(null,new Uint16Array(e.subarray(o,o+128)));for(;0>(A=c.indexOf("\n"))&&l<t&&o<e.byteLength;)h+=c,l+=c.length,o+=128,c+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(o,o+128)));return -1<A&&(!1!==s&&(e.pos+=l+A+1),h+c.slice(0,A))},A=new Uint8Array(e);A.pos=0;let l=function(e){let t,s;let o=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,A=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,l=/^\s*FORMAT=(\S+)\s*$/,h=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,c={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for(!(e.pos>=e.byteLength)&&(t=fgets(e))||rgbe_error(1,"no header found"),(s=t.match(/^#\?(\S+)/))||rgbe_error(3,"bad initial token"),c.valid|=1,c.programtype=s[1],c.string+=t+"\n";!1!==(t=fgets(e));){if(c.string+=t+"\n","#"===t.charAt(0)){c.comments+=t+"\n";continue}if((s=t.match(o))&&(c.gamma=parseFloat(s[1])),(s=t.match(A))&&(c.exposure=parseFloat(s[1])),(s=t.match(l))&&(c.valid|=2,c.format=s[1]),(s=t.match(h))&&(c.valid|=4,c.height=parseInt(s[1],10),c.width=parseInt(s[2],10)),2&c.valid&&4&c.valid)break}return 2&c.valid||rgbe_error(3,"missing format specifier"),4&c.valid||rgbe_error(3,"missing image size specifier"),c}(A),h=l.width,c=l.height,d=function(e,t,s){if(t<8||t>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);t!==(e[2]<<8|e[3])&&rgbe_error(3,"wrong scanline width");let o=new Uint8Array(4*t*s);o.length||rgbe_error(4,"unable to allocate buffer space");let A=0,l=0,h=4*t,c=new Uint8Array(4),d=new Uint8Array(h),g=s;for(;g>0&&l<e.byteLength;){l+4>e.byteLength&&rgbe_error(1),c[0]=e[l++],c[1]=e[l++],c[2]=e[l++],c[3]=e[l++],(2!=c[0]||2!=c[1]||(c[2]<<8|c[3])!=t)&&rgbe_error(3,"bad rgbe scanline format");let s=0,p;for(;s<h&&l<e.byteLength;){p=e[l++];let t=p>128;if(t&&(p-=128),(0===p||s+p>h)&&rgbe_error(3,"bad scanline data"),t){let t=e[l++];for(let e=0;e<p;e++)d[s++]=t}else d.set(e.subarray(l,l+p),s),s+=p,l+=p}for(let e=0;e<t;e++){let s=0;o[A]=d[e+s],s+=t,o[A+1]=d[e+s],s+=t,o[A+2]=d[e+s],s+=t,o[A+3]=d[e+s],A+=4}g--}return o}(A.subarray(A.pos),h,c);switch(this.type){case eS.VzW:o=d.length/4;let g=new Float32Array(4*o);for(let e=0;e<o;e++)!function(e,t,s,o){let A=e[t+3],l=Math.pow(2,A-128)/255;s[o+0]=e[t+0]*l,s[o+1]=e[t+1]*l,s[o+2]=e[t+2]*l,s[o+3]=1}(d,4*e,g,4*e);t=g,s=eS.VzW;break;case eS.cLu:o=d.length/4;let p=new Uint16Array(4*o);for(let e=0;e<o;e++)!function(e,t,s,o){let A=e[t+3],l=Math.pow(2,A-128)/255;s[o+0]=eS.A5E.toHalfFloat(Math.min(e[t+0]*l,65504)),s[o+1]=eS.A5E.toHalfFloat(Math.min(e[t+1]*l,65504)),s[o+2]=eS.A5E.toHalfFloat(Math.min(e[t+2]*l,65504)),s[o+3]=eS.A5E.toHalfFloat(1)}(d,4*e,p,4*e);t=p,s=eS.cLu;break;default:throw Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:h,height:c,data:t,header:l.string,gamma:l.gamma,exposure:l.exposure,type:s}}setDataType(e){return this.type=e,this}load(e,t,s,o){return super.load(e,function(e,s){switch(e.type){case eS.VzW:case eS.cLu:e.colorSpace=eS.GUF,e.minFilter=eS.wem,e.magFilter=eS.wem,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,s)},s,o)}};/* @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.
|
|
*/let sO={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]}]},sH={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]}]};let EnvironmentScene=class EnvironmentScene extends eS.xsS{constructor(e){super(),this.position.y=-3.5;let t=new eS.DvJ;t.deleteAttribute("uv");let s=new eS.Wid({metalness:0,side:eS._Li}),o=new eS.Wid({metalness:0}),A="legacy"==e?sO:sH,l=new eS.cek(16777215,A.topLight.intensity,28,2);l.position.set(...A.topLight.position),this.add(l);let h=new eS.Kj0(t,s);for(let e of(h.position.set(...A.room.position),h.scale.set(...A.room.scale),this.add(h),A.boxes)){let s=new eS.Kj0(t,o);s.position.set(...e.position),s.rotation.set(0,e.rotation,0),s.scale.set(...e.scale),this.add(s)}for(let e of A.lights){let s=new eS.Kj0(t,this.createAreaLightMaterial(e.intensity));s.position.set(...e.position),s.scale.set(...e.scale),this.add(s)}}createAreaLightMaterial(e){let t=new eS.vBJ;return t.color.setScalar(e),t}};let sV=/\.hdr(\.js)?$/;let TextureUtils=class TextureUtils{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this.withCredentials=!1,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}get ldrLoader(){return null==this._ldrLoader&&(this._ldrLoader=new eS.dpR),this._ldrLoader.setWithCredentials(this.withCredentials),this._ldrLoader}get imageLoader(){return null==this._imageLoader&&(this._imageLoader=new HDRJPGLoader(this.threeRenderer)),this._imageLoader.setWithCredentials(this.withCredentials),this._imageLoader}get hdrLoader(){return null==this._hdrLoader&&(this._hdrLoader=new RGBELoader,this._hdrLoader.setDataType(eS.cLu)),this._hdrLoader.setWithCredentials(this.withCredentials),this._hdrLoader}async getLottieLoader(){if(null==this._lottieLoader){let{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(this.withCredentials),this._lottieLoader}async loadImage(e){let t=await new Promise((t,s)=>this.ldrLoader.load(e,t,()=>{},s));return t.name=e,t.flipY=!1,t}async loadLottie(e,t){let s=await this.getLottieLoader();s.setQuality(t);let o=await new Promise((t,o)=>s.load(e,t,()=>{},o));return o.name=e,o}async loadEquirect(e,t=()=>{}){try{let s=sV.test(e),o=s?this.hdrLoader:this.imageLoader,A=await new Promise((s,A)=>o.load(e,e=>{let{renderTarget:t}=e;if(null!=t){let{texture:o}=t;e.dispose(!1),s(o)}else s(e)},e=>{t(e.loaded/e.total*.9)},A));return t(1),A.name=e,A.mapping=eS.dSO,s||(A.colorSpace=eS.KI_),A}finally{t&&t(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,s=()=>{}){let o;let A="legacy"!==t;("legacy"===t||"neutral"===t)&&(t=null),t=deserializeUrl(t);let l=Promise.resolve(null);e&&(l=this.loadEquirectFromUrl(e,s)),o=t?this.loadEquirectFromUrl(t,s):e?this.loadEquirectFromUrl(e,s):A?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();let[h,c]=await Promise.all([o,l]);if(null==h)throw Error("Failed to load environment map.");return{environmentMap:h,skybox:c}}async loadEquirectFromUrl(e,t){if(!this.skyboxCache.has(e)){let s=this.loadEquirect(e,t);this.skyboxCache.set(e,s)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await timePasses();let s=this.threeRenderer,o=new eS.oAp(256,{generateMipmaps:!1,type:eS.cLu,format:eS.wk1,colorSpace:eS.GUF,depthBuffer:!0}),A=new eS._am(.1,100,o),l=A.renderTarget.texture;l.name=t;let h=s.outputColorSpace,c=s.toneMapping;return s.toneMapping=eS.uL9,s.outputColorSpace=eS.GUF,A.update(s,e),this.blurCubemap(o,.04),s.toneMapping=c,s.outputColorSpace=h,l}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new EnvironmentScene("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new EnvironmentScene("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(20);let e=new eS.DvJ,t=new eS.Kj0(e,this.blurMaterial);this.blurScene=new eS.xsS,this.blurScene.add(t)}let s=e.clone();this.halfblur(e,s,t,"latitudinal"),this.halfblur(s,e,t,"longitudinal")}halfblur(e,t,s,o){let A=e.width,l=isFinite(s)?Math.PI/(2*A):2*Math.PI/39,h=s/l,c=isFinite(s)?1+Math.floor(3*h):20;c>20&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${c} samples when the maximum is set to 20`);let d=[],g=0;for(let e=0;e<20;++e){let t=e/h,s=Math.exp(-t*t/2);d.push(s),0==e?g+=s:e<c&&(g+=2*s)}for(let e=0;e<d.length;e++)d[e]=d[e]/g;let p=this.blurMaterial.uniforms;p.envMap.value=e.texture,p.samples.value=c,p.weights.value=d,p.latitudinal.value="latitudinal"===o,p.dTheta.value=l;let m=new eS._am(.1,100,t);m.update(this.threeRenderer,this.blurScene)}getBlurShader(e){let t=new Float32Array(e),s=new eS.Pa4(0,1,0),o=new eS.jyz({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:s}},vertexShader:`
|
|
|
|
varying vec3 vOutputDirection;
|
|
|
|
void main() {
|
|
|
|
vOutputDirection = vec3( position );
|
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
|
|
}
|
|
`,fragmentShader:`
|
|
varying vec3 vOutputDirection;
|
|
|
|
uniform samplerCube envMap;
|
|
uniform int samples;
|
|
uniform float weights[ n ];
|
|
uniform bool latitudinal;
|
|
uniform float dTheta;
|
|
uniform vec3 poleAxis;
|
|
|
|
vec3 getSample( float theta, vec3 axis ) {
|
|
|
|
float cosTheta = cos( theta );
|
|
// Rodrigues' axis-angle rotation
|
|
vec3 sampleDirection = vOutputDirection * cosTheta
|
|
+ cross( axis, vOutputDirection ) * sin( theta )
|
|
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
|
|
|
return vec3( textureCube( envMap, sampleDirection ) );
|
|
|
|
}
|
|
|
|
void main() {
|
|
|
|
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
|
|
|
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
|
|
|
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
|
|
|
}
|
|
|
|
axis = normalize( axis );
|
|
|
|
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
|
|
|
for ( int i = 1; i < n; i++ ) {
|
|
|
|
if ( i >= samples ) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
float theta = dTheta * float( i );
|
|
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
|
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
|
|
|
}
|
|
}
|
|
`,blending:eS.jFi,depthTest:!1,depthWrite:!1,side:eS._Li});return o}async dispose(){for(let[,e]of this.skyboxCache){let t=await e;t.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()}};let sq=[1,.79,.62,.5,.4,.31,.25],sK="high-performance";let Renderer=class Renderer extends eS.pBf{constructor(e){super(),this.loader=new CachingGLTFLoader(ModelViewerGLTFInstance),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;for(let t of(null===(e=this.textureUtils)||void 0===e||e.dispose(),this.textureUtils=new TextureUtils(this.threeRenderer),this.scenes))t.element[tI]()},this.dpr=td(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show"),eS.WdD.tonemapping_pars_fragment=eS.WdD.tonemapping_pars_fragment.replace("vec3 CustomToneMapping( vec3 color ) { return color; }",`
|
|
float startCompression = 0.8 - 0.04;
|
|
float desaturation = 0.15;
|
|
vec3 CustomToneMapping( vec3 color ) {
|
|
color *= toneMappingExposure;
|
|
|
|
float x = min(color.r, min(color.g, color.b));
|
|
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
|
|
color -= offset;
|
|
|
|
float peak = max(color.r, max(color.g, color.b));
|
|
if (peak < startCompression) return color;
|
|
|
|
float d = 1. - startCompression;
|
|
float newPeak = 1. - d * d / (peak + d - startCompression);
|
|
color *= newPeak / peak;
|
|
|
|
float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);
|
|
return mix(color, vec3(1, 1, 1), g);
|
|
}`);try{this.threeRenderer=new eS.CP7({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=eS.LY2}catch(e){console.warn(e)}this.arRenderer=new ARRenderer(this),this.textureUtils=this.canRender?new TextureUtils(this.threeRenderer):null,CachingGLTFLoader.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}static get singleton(){return this._singleton}static resetSingleton(){let e=this._singleton.dispose();for(let t of e)t.disconnectedCallback();for(let t of(this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||sK,debug:tg()}),e))t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return sq[this.scaleStep]}set minScale(e){let t=1;for(;t<sq.length&&!(sq[t]<e);)++t;this.lastStep=t-1}registerScene(e){this.scenes.add(e),e.forceRescale();let t=new eS.FM8;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.canRender&&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 this.multipleScenesVisible?e.element[nB]:this.canvas3D}countVisibleScenes(){let{canvas3D:e}=this,t=0,s=null;for(let o of this.scenes){let{element:A}=o;A.modelIsVisible&&null==o.externalRenderer&&++t,e.parentElement===o.canvas.parentElement&&(s=o)}let o=t>1;if(null!=s){let t=o&&!this.multipleScenesVisible,A=!s.element.modelIsVisible;if(t||A){let{width:t,height:o}=this.sceneSize(s);this.copyPixels(s,t,o),e.parentElement.removeChild(e)}}this.multipleScenesVisible=o}updateRendererSize(){var e;let t=td();if(t!==this.dpr)for(let e of this.scenes){let{element:t}=e;t[nA](t.getBoundingClientRect())}let s=0,o=0;for(let e of this.scenes)s=Math.max(s,e.width),o=Math.max(o,e.height);if(s!==this.width||o!==this.height||t!==this.dpr)for(let A of(this.width=s,this.height=o,this.dpr=t,s=Math.ceil(s*t),o=Math.ceil(o*t),this.canRender&&this.threeRenderer.setSize(s,o,!1),this.scenes)){let{canvas:t}=A;t.width=s,t.height=o,A.forceRescale(),null===(e=A.effectRenderer)||void 0===e||e.setSize(s,o)}}updateRendererScale(e){let t=this.scaleStep;this.avgFrameDuration+=clamp(.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){let t=sq[e.scaleStep],s=Math.ceil(this.width/t),o=Math.ceil(this.height/t),{style:A}=e.canvas;A.width=`${s}px`,A.height=`${o}px`,this.canvas3D.style.width=`${s}px`,this.canvas3D.style.height=`${o}px`;let l=this.dpr*t,h=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:l,minimumDpr:this.dpr*sq[this.lastStep],pixelWidth:Math.ceil(e.width*l),pixelHeight:Math.ceil(e.height*l),reason:h}}))}sceneSize(e){let{dpr:t}=this,s=sq[e.scaleStep],o=Math.min(Math.ceil(e.width*s*t),this.canvas3D.width),A=Math.min(Math.ceil(e.height*s*t),this.canvas3D.height);return{width:o,height:A}}copyPixels(e,t,s){let o=e.context;if(null==o){console.log("could not acquire 2d context");return}o.clearRect(0,0,t,s),o.drawImage(this.canvas3D,0,0,t,s,0,0,t,s),e.canvas.classList.add("show")}orderedScenes(){let e=[];for(let t of[!1,!0])for(let s of this.scenes)s.element.modelIsVisible===t&&e.push(s);return e}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,s){let{element:o,exposure:A,toneMapping:l}=e;o[nv](t,s);let h="number"==typeof A&&!Number.isNaN(A),c=o.environmentImage,d=o.skyboxImage,g=l===eS.dZ3&&("neutral"===c||"legacy"===c||!c&&!d);this.threeRenderer.toneMappingExposure=(h?A:1)*(g?1.3:1)}render(e,t){if(null!=t){this.arRenderer.onWebXRFrame(e,t);return}let s=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(s),this.renderedLastFrame=!1);let{canvas3D:o}=this;for(let t of this.orderedScenes()){let{element:A}=t;if(!A.loaded||!A.modelIsVisible&&t.renderCount>0||(this.preRender(t,e,s),!this.shouldRender(t)))continue;if(null!=t.externalRenderer){let e=t.getCamera();e.updateMatrix();let{matrix:s,projectionMatrix:o}=e,A=s.elements.slice(),l=t.getTarget();A[12]+=l.x,A[13]+=l.y,A[14]+=l.z,t.externalRenderer.render({viewMatrix:A,projectionMatrix:o.elements});continue}if(!A.modelIsVisible&&!this.multipleScenesVisible)for(let e of this.scenes)e.element.modelIsVisible&&e.queueRender();let{width:l,height:h}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-h,l,h),null!=t.effectRenderer?t.effectRenderer.render(s):(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,l,h):o.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(o),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;let e=[];for(let t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}};Renderer._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||sK,debug:tg()});/* @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.
|
|
*/let sJ=Symbol("correlatedObjects"),sz=Symbol("onUpdate");let ThreeDOMElement=class ThreeDOMElement{constructor(e,t=null){this[sz]=e,this[sJ]=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.
|
|
*/let sY=new eS.vBJ,sj=new eS._12(2,2),sW=0,s$=Symbol("threeTexture"),sX=Symbol("threeTextures");Symbol("applyTexture");let image_Image=class image_Image extends ThreeDOMElement{get[s$](){var e;return null===(e=this[sJ])||void 0===e?void 0:e.values().next().value}get[sX](){return this[sJ]}constructor(e,t){super(e,new Set(t?[t]:[])),this[s$].image.src||(this[s$].image.src=t.name?t.name:"adhoc_image"+sW++),this[s$].image.name||(this[s$].image.name=t&&t.image&&t.image.src?t.image.src.split("/").pop():"adhoc_image")}get name(){return this[s$].image.name||""}get uri(){return this[s$].image.src}get bufferView(){return this[s$].image.bufferView}get element(){let e=this[s$];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){let e=this[s$];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return null!=this.uri?"external":"embedded"}set name(e){for(let t of this[sX])t.image.name=e}update(){let e=this[s$];e&&e.isCanvasTexture&&!e.animation&&(this[s$].needsUpdate=!0,this[sz]())}async createThumbnail(e,t){let s=new eS.xsS;sY.map=this[s$];let o=new eS.Kj0(sj,sY);s.add(o);let A=new eS.iKG(-1,1,1,-1,0,1),{threeRenderer:l}=Renderer.singleton,h=new eS.dd2(e,t);l.setRenderTarget(h),l.render(s,A),l.setRenderTarget(null);let c=new Uint8Array(e*t*4);l.readRenderTargetPixels(h,0,0,e,t,c),r9.width=e,r9.height=t;let d=r9.getContext("2d"),g=d.createImageData(e,t);return g.data.set(c),d.putImageData(g,0,0),new Promise(async(e,t)=>{r9.toBlob(s=>{if(!s)return t("Failed to capture thumbnail.");e(URL.createObjectURL(s))},"image/png")})}};(B=et||(et={}))[B.Nearest=9728]="Nearest",B[B.Linear=9729]="Linear",B[B.NearestMipmapNearest=9984]="NearestMipmapNearest",B[B.LinearMipmapNearest=9985]="LinearMipmapNearest",B[B.NearestMipmapLinear=9986]="NearestMipmapLinear",B[B.LinearMipmapLinear=9987]="LinearMipmapLinear",(y=ei||(ei={}))[y.ClampToEdge=33071]="ClampToEdge",y[y.MirroredRepeat=33648]="MirroredRepeat",y[y.Repeat=10497]="Repeat";/* @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.
|
|
*/let sZ=new Map([[ei.Repeat,eS.rpg],[ei.ClampToEdge,eS.uWy],[ei.MirroredRepeat,eS.OoA]]),s0=new Map([[eS.rpg,ei.Repeat],[eS.uWy,ei.ClampToEdge],[eS.OoA,ei.MirroredRepeat]]),s1=new Map([[et.Nearest,eS.TyD],[et.Linear,eS.wem],[et.NearestMipmapNearest,eS.YLQ],[et.LinearMipmapNearest,eS.qyh],[et.NearestMipmapLinear,eS.aH4],[et.LinearMipmapLinear,eS.D1R]]),s2=new Map([[eS.TyD,et.Nearest],[eS.wem,et.Linear],[eS.YLQ,et.NearestMipmapNearest],[eS.qyh,et.LinearMipmapNearest],[eS.aH4,et.NearestMipmapLinear],[eS.D1R,et.LinearMipmapLinear]]),s3=new Map([[et.Nearest,eS.TyD],[et.Linear,eS.wem]]),s4=new Map([[eS.TyD,et.Nearest],[eS.wem,et.Linear]]),isMinFilter=e=>s2.has(e),isMagFilter=e=>s4.has(e),isWrapping=e=>s0.has(e),isValidSamplerValue=(e,t)=>{switch(e){case"minFilter":return isMinFilter(t);case"magFilter":return isMagFilter(t);case"wrapS":case"wrapT":return isWrapping(t);case"rotation":case"repeat":case"offset":return!0;default:throw Error(`Cannot configure property "${e}" on Sampler`)}},s8=Symbol("threeTexture"),s5=Symbol("threeTextures"),s6=Symbol("setProperty");let Sampler=class Sampler extends ThreeDOMElement{get[s8](){var e;return null===(e=this[sJ])||void 0===e?void 0:e.values().next().value}get[s5](){return this[sJ]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[s8].name||""}get minFilter(){return s2.get(this[s8].minFilter)}get magFilter(){return s4.get(this[s8].magFilter)}get wrapS(){return s0.get(this[s8].wrapS)}get wrapT(){return s0.get(this[s8].wrapT)}get rotation(){return this[s8].rotation}get scale(){return toVector2D(this[s8].repeat)}get offset(){return toVector2D(this[s8].offset)}setMinFilter(e){this[s6]("minFilter",s1.get(e))}setMagFilter(e){this[s6]("magFilter",s3.get(e))}setWrapS(e){this[s6]("wrapS",sZ.get(e))}setWrapT(e){this[s6]("wrapT",sZ.get(e))}setRotation(e){null==e&&(e=0),this[s6]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[s6]("repeat",new eS.FM8(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[s6]("offset",new eS.FM8(e.u,e.v))}[s6](e,t){if(isValidSamplerValue(e,t))for(let s of this[s5])s[e]=t,s.needsUpdate=!0;this[sz]()}};/* @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.
|
|
*/let s9=Symbol("image"),s7=Symbol("sampler"),re=Symbol("threeTexture");let Texture=class Texture extends ThreeDOMElement{constructor(e,t){super(e,new Set(t?[t]:[])),this[s7]=new Sampler(e,t),this[s9]=new image_Image(e,t)}get[re](){var e;return null===(e=this[sJ])||void 0===e?void 0:e.values().next().value}get name(){return this[re].name||""}set name(e){for(let t of this[sJ])t.name=e}get sampler(){return this[s7]}get source(){return this[s9]}};let rt=Symbol("texture"),ri=Symbol("transform"),rs=Symbol("materials"),rr=Symbol("usage"),rn=Symbol("onUpdate"),ra=Symbol("activeVideo");(Q=ea||(ea={}))[Q.Base=0]="Base",Q[Q.MetallicRoughness=1]="MetallicRoughness",Q[Q.Normal=2]="Normal",Q[Q.Occlusion=3]="Occlusion",Q[Q.Emissive=4]="Emissive",Q[Q.Clearcoat=5]="Clearcoat",Q[Q.ClearcoatRoughness=6]="ClearcoatRoughness",Q[Q.ClearcoatNormal=7]="ClearcoatNormal",Q[Q.SheenColor=8]="SheenColor",Q[Q.SheenRoughness=9]="SheenRoughness",Q[Q.Transmission=10]="Transmission",Q[Q.Thickness=11]="Thickness",Q[Q.Specular=12]="Specular",Q[Q.SpecularColor=13]="SpecularColor",Q[Q.Iridescence=14]="Iridescence",Q[Q.IridescenceThickness=15]="IridescenceThickness",Q[Q.Anisotropy=16]="Anisotropy";let TextureInfo=class TextureInfo{constructor(e,t,s,o){this[es]=null,this[er]={rotation:0,scale:new eS.FM8(1,1),offset:new eS.FM8(0,0)},this[en]=!1,s&&(this[ri].rotation=s.rotation,this[ri].scale.copy(s.repeat),this[ri].offset.copy(s.offset),this[rt]=new Texture(e,s)),this[rn]=e,this[rs]=o,this[rr]=t}get texture(){return this[rt]}setTexture(e){var t,s;let o=null!=e?e.source[s$]:null,A=null===(t=this[rt])||void 0===t?void 0:t.source[s$];if(null!=A&&A.isVideoTexture?this[ra]=!1:(null===(s=this[rt])||void 0===s?void 0:s.source.animation)&&this[rt].source.animation.removeEventListener("enterFrame",this[rn]),this[rt]=e,null!=o&&o.isVideoTexture){let e=o.image;if(this[ra]=!0,null!=e.requestVideoFrameCallback){let update=()=>{this[ra]&&(this[rn](),e.requestVideoFrameCallback(update))};e.requestVideoFrameCallback(update)}else{let update=()=>{this[ra]&&(this[rn](),requestAnimationFrame(update))};requestAnimationFrame(update)}}else(null==e?void 0:e.source.animation)!=null&&e.source.animation.addEventListener("enterFrame",this[rn]);let l=eS.KI_;if(this[rs])for(let e of this[rs]){switch(this[rr]){case ea.Base:e.map=o;break;case ea.MetallicRoughness:l=eS.GUF,e.metalnessMap=o,e.roughnessMap=o;break;case ea.Normal:l=eS.GUF,e.normalMap=o;break;case ea.Occlusion:l=eS.GUF,e.aoMap=o;break;case ea.Emissive:e.emissiveMap=o;break;case ea.Clearcoat:e.clearcoatMap=o;break;case ea.ClearcoatRoughness:e.clearcoatRoughnessMap=o;break;case ea.ClearcoatNormal:e.clearcoatNormalMap=o;break;case ea.SheenColor:e.sheenColorMap=o;break;case ea.SheenRoughness:e.sheenRoughnessMap=o;break;case ea.Transmission:e.transmissionMap=o;break;case ea.Thickness:e.thicknessMap=o;break;case ea.Specular:e.specularIntensityMap=o;break;case ea.SpecularColor:e.specularColorMap=o;break;case ea.Iridescence:e.iridescenceMap=o;break;case ea.IridescenceThickness:e.iridescenceThicknessMap=o;break;case ea.Anisotropy:e.anisotropyMap=o}e.needsUpdate=!0}o&&(o.colorSpace=l,o.rotation=this[ri].rotation,o.repeat=this[ri].scale,o.offset=this[ri].offset),this[rn]()}};es=rt,er=ri,en=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.
|
|
*/let ro=Symbol("threeMaterial"),rA=Symbol("threeMaterials"),rl=Symbol("baseColorTexture"),rh=Symbol("metallicRoughnessTexture");let PBRMetallicRoughness=class PBRMetallicRoughness extends ThreeDOMElement{constructor(e,t){super(e,t);let{map:s,metalnessMap:o}=t.values().next().value;this[rl]=new TextureInfo(e,ea.Base,s,t),this[rh]=new TextureInfo(e,ea.MetallicRoughness,o,t)}get[rA](){return this[sJ]}get[ro](){var e;return null===(e=this[sJ])||void 0===e?void 0:e.values().next().value}get baseColorFactor(){let e=[0,0,0,this[ro].opacity];return this[ro].color.toArray(e),e}get metallicFactor(){return this[ro].metalness}get roughnessFactor(){return this[ro].roughness}get baseColorTexture(){return this[rl]}get metallicRoughnessTexture(){return this[rh]}setBaseColorFactor(e){let t=new eS.Ilk;for(let s of(e instanceof Array?t.fromArray(e):t.set(e),this[rA]))s.color.set(t),e instanceof Array?s.opacity=e[3]:(e=[0,0,0,s.opacity],t.toArray(e));this[sz]()}setMetallicFactor(e){for(let t of this[rA])t.metalness=e;this[sz]()}setRoughnessFactor(e){for(let t of this[rA])t.roughness=e;this[sz]()}};let rc=Symbol("pbrMetallicRoughness"),ru=Symbol("normalTexture"),rd=Symbol("occlusionTexture"),rg=Symbol("emissiveTexture"),rp=Symbol("backingThreeMaterial"),rm=Symbol("applyAlphaCutoff"),rI=Symbol("getAlphaMode"),rf=Symbol("lazyLoadGLTFInfo"),rE=Symbol("initialize"),rC=Symbol("getLoadedMaterial"),rB=Symbol("ensureMaterialIsLoaded"),ry=Symbol("gltfIndex"),rw=Symbol("setActive"),rv=Symbol("variantIndices"),rQ=Symbol("isActive"),rx=Symbol("variantSet"),rb=Symbol("modelVariants"),rS=Symbol("name"),rT=Symbol("pbrTextures");let Material=class Material extends ThreeDOMElement{constructor(e,t,s,o,A,l,h){super(e,A),this[eo]=new Set,this[eA]=new Map,this[ry]=t,this[rQ]=s,this[rb]=o,this[rS]=l,null==h?this[rE]():this[rf]=h}get[(eo=rx,eA=rT,rp)](){return this[sJ].values().next().value}[rE](){let e=this[sz],t=this[sJ];this[rc]=new PBRMetallicRoughness(e,t);let{normalMap:s,aoMap:o,emissiveMap:A}=t.values().next().value;this[ru]=new TextureInfo(e,ea.Normal,s,t),this[rd]=new TextureInfo(e,ea.Occlusion,o,t),this[rg]=new TextureInfo(e,ea.Emissive,A,t);let createTextureInfo=s=>{this[rT].set(s,new TextureInfo(e,s,null,t))};createTextureInfo(ea.Clearcoat),createTextureInfo(ea.ClearcoatRoughness),createTextureInfo(ea.ClearcoatNormal),createTextureInfo(ea.SheenColor),createTextureInfo(ea.SheenRoughness),createTextureInfo(ea.Transmission),createTextureInfo(ea.Thickness),createTextureInfo(ea.Specular),createTextureInfo(ea.SpecularColor),createTextureInfo(ea.Iridescence),createTextureInfo(ea.IridescenceThickness),createTextureInfo(ea.Anisotropy)}async [rC](){if(null!=this[rf]){let{set:e,material:t}=await this[rf].doLazyLoad();return this[sJ]=e,this[rE](),this[rf]=void 0,this.ensureLoaded=async()=>{},t}return this[sJ].values().next().value}colorFromRgb(e){let t=new eS.Ilk;return e instanceof Array?t.fromArray(e):t.set(e),t}[rB](){if(null!=this[rf])throw Error(`Material "${this.name}" has not been loaded, call 'await
|
|
myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[rC]()}get isLoaded(){return null==this[rf]}get isActive(){return this[rQ]}[rw](e){this[rQ]=e}get name(){return this[rS]||""}set name(e){if(this[rS]=e,null!=this[sJ])for(let t of this[sJ])t.name=e}get pbrMetallicRoughness(){return this[rB](),this[rc]}get normalTexture(){return this[rB](),this[ru]}get occlusionTexture(){return this[rB](),this[rd]}get emissiveTexture(){return this[rB](),this[rg]}get emissiveFactor(){return this[rB](),this[rp].emissive.toArray()}get index(){return this[ry]}[rv](){return this[rx]}hasVariant(e){let t=this[rb].get(e);return null!=t&&this[rx].has(t.index)}setEmissiveFactor(e){this[rB]();let t=this.colorFromRgb(e);for(let e of this[sJ])e.emissive.set(t);this[sz]()}[rI](){return this[rp].transparent?"BLEND":this[rp].alphaTest>0?"MASK":"OPAQUE"}[rm](){for(let e of(this[rB](),this[sJ]))"MASK"===this[rI]()?void 0==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){for(let t of(this[rB](),this[sJ]))t.alphaTest=e,t.needsUpdate=!0;this[rm](),this[sz]()}getAlphaCutoff(){return this[rB](),this[rp].alphaTest}setDoubleSided(e){for(let t of(this[rB](),this[sJ]))t.side=e?eS.ehD:eS.Wl3,t.needsUpdate=!0;this[sz]()}getDoubleSided(){return this[rB](),this[rp].side==eS.ehD}setAlphaMode(e){this[rB]();let enableTransparency=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(let t of this[sJ])enableTransparency(t,"BLEND"===e),"MASK"===e?t.alphaTest=.5:t.alphaTest=void 0,t.needsUpdate=!0;this[sz]()}getAlphaMode(){return this[rB](),this[rI]()}get emissiveStrength(){return this[rB](),this[rp].emissiveIntensity}setEmissiveStrength(e){for(let t of(this[rB](),this[sJ]))t.emissiveIntensity=e;this[sz]()}get clearcoatFactor(){return this[rB](),this[rp].clearcoat}get clearcoatRoughnessFactor(){return this[rB](),this[rp].clearcoatRoughness}get clearcoatTexture(){return this[rB](),this[rT].get(ea.Clearcoat)}get clearcoatRoughnessTexture(){return this[rB](),this[rT].get(ea.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[rB](),this[rT].get(ea.ClearcoatNormal)}get clearcoatNormalScale(){return this[rB](),this[rp].clearcoatNormalScale.x}setClearcoatFactor(e){for(let t of(this[rB](),this[sJ]))t.clearcoat=e;this[sz]()}setClearcoatRoughnessFactor(e){for(let t of(this[rB](),this[sJ]))t.clearcoatRoughness=e;this[sz]()}setClearcoatNormalScale(e){for(let t of(this[rB](),this[sJ]))t.clearcoatNormalScale=new eS.FM8(e,e);this[sz]()}get ior(){return this[rB](),this[rp].ior}setIor(e){for(let t of(this[rB](),this[sJ]))t.ior=e;this[sz]()}get sheenColorFactor(){return this[rB](),this[rp].sheenColor.toArray()}get sheenColorTexture(){return this[rB](),this[rT].get(ea.SheenColor)}get sheenRoughnessFactor(){return this[rB](),this[rp].sheenRoughness}get sheenRoughnessTexture(){return this[rB](),this[rT].get(ea.SheenRoughness)}setSheenColorFactor(e){this[rB]();let t=this.colorFromRgb(e);for(let e of this[sJ])e.sheenColor.set(t),e.sheen=1;this[sz]()}setSheenRoughnessFactor(e){for(let t of(this[rB](),this[sJ]))t.sheenRoughness=e,t.sheen=1;this[sz]()}get transmissionFactor(){return this[rB](),this[rp].transmission}get transmissionTexture(){return this[rB](),this[rT].get(ea.Transmission)}setTransmissionFactor(e){for(let t of(this[rB](),this[sJ]))t.transmission=e;this[sz]()}get thicknessFactor(){return this[rB](),this[rp].thickness}get thicknessTexture(){return this[rB](),this[rT].get(ea.Thickness)}get attenuationDistance(){return this[rB](),this[rp].attenuationDistance}get attenuationColor(){return this[rB](),this[rp].attenuationColor.toArray()}setThicknessFactor(e){for(let t of(this[rB](),this[sJ]))t.thickness=e;this[sz]()}setAttenuationDistance(e){for(let t of(this[rB](),this[sJ]))t.attenuationDistance=e;this[sz]()}setAttenuationColor(e){this[rB]();let t=this.colorFromRgb(e);for(let e of this[sJ])e.attenuationColor.set(t);this[sz]()}get specularFactor(){return this[rB](),this[rp].specularIntensity}get specularTexture(){return this[rB](),this[rT].get(ea.Specular)}get specularColorFactor(){return this[rB](),this[rp].specularColor.toArray()}get specularColorTexture(){return this[rB](),this[rT].get(ea.SheenColor)}setSpecularFactor(e){for(let t of(this[rB](),this[sJ]))t.specularIntensity=e;this[sz]()}setSpecularColorFactor(e){this[rB]();let t=this.colorFromRgb(e);for(let e of this[sJ])e.specularColor.set(t);this[sz]()}get iridescenceFactor(){return this[rB](),this[rp].iridescence}get iridescenceTexture(){return this[rB](),this[rT].get(ea.Iridescence)}get iridescenceIor(){return this[rB](),this[rp].iridescenceIOR}get iridescenceThicknessMinimum(){return this[rB](),this[rp].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[rB](),this[rp].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[rB](),this[rT].get(ea.IridescenceThickness)}setIridescenceFactor(e){for(let t of(this[rB](),this[sJ]))t.iridescence=e;this[sz]()}setIridescenceIor(e){for(let t of(this[rB](),this[sJ]))t.iridescenceIOR=e;this[sz]()}setIridescenceThicknessMinimum(e){for(let t of(this[rB](),this[sJ]))t.iridescenceThicknessRange[0]=e;this[sz]()}setIridescenceThicknessMaximum(e){for(let t of(this[rB](),this[sJ]))t.iridescenceThicknessRange[1]=e;this[sz]()}get anisotropyStrength(){return this[rB](),this[rp].anisotropy}get anisotropyRotation(){return this[rB](),this[rp].anisotropyRotation}get anisotropyTexture(){return this[rB](),this[rT].get(ea.Anisotropy)}setAnisotropyStrength(e){for(let t of(this[rB](),this[sJ]))t.anisotropy=e;this[sz]()}setAnisotropyRotation(e){for(let t of(this[rB](),this[sJ]))t.anisotropyRotation=e;this[sz]()}};let primitive_node_Node=class primitive_node_Node{constructor(e){this.name="",this.children=[],this.name=e}};let PrimitiveNode=class PrimitiveNode extends primitive_node_Node{constructor(e,t,s,o){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;let{gltf:A,threeGLTF:l,threeObjectMap:h}=o;this.parser=l.parser,this.modelVariants=s,this.mesh.userData.variantData=s;let c=h.get(e.material);null!=c.materials?this.initialMaterialIdx=this.activeMaterialIdx=c.materials:console.error(`Primitive (${e.name}) missing initial material reference.`);let d=e.userData.associations||{};if(null==d.meshes){console.error("Mesh is missing primitive index association");return}let g=A.meshes||[],p=g[d.meshes].primitives||[],m=p[d.primitives];if(null==m){console.error("Mesh primitive definition is missing.");return}if(null!=m.material)this.materials.set(m.material,t[m.material]);else{let e=t.findIndex(e=>"Default"===e.name);e>=0?this.materials.set(e,t[e]):console.warn("gltfPrimitive has no material!")}if(m.extensions&&m.extensions.KHR_materials_variants){let e=m.extensions.KHR_materials_variants,o=l.parser.json.extensions,A=o.KHR_materials_variants.variants;for(let o of e.mappings){let e=t[o.material];for(let t of(this.materials.set(o.material,e),o.variants)){let{name:o}=A[t];this.variantToMaterialMap.set(t,e),e[rv]().add(t),s.has(o)||s.set(o,{name:o,index:t})}}}}async setActiveMaterial(e){let t=this.materials.get(e);if(null!=t&&e!==this.activeMaterialIdx){this.mesh.material=await t[rC]();let{normalScale:s}=this.mesh.material;null!=s&&s.y*s.x<0!=(null==this.mesh.geometry.attributes.tangent)&&this.parser.assignFinalMaterial(this.mesh),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)){let t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(null!=this.variantToMaterialMap&&null!=e){let t=this.variantToMaterialMap.get(e);if(null!=t)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(let e of this.variantToMaterialMap.keys()){let t=this.mesh.userData.variantMaterials.get(e);if(null!=t.material)continue;let s=await this.enableVariantHelper(e);null!=s&&(t.material=s)}}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});let s=this.modelVariants.get(t),o=s.index;return e[rv]().add(o),this.variantToMaterialMap.set(o,e),this.materials.set(e.index,e),this.updateVariantUserData(o,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);let t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[rv]().add(e),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map;let s=this.mesh.userData.variantMaterials;s.set(e,{material:t[sJ].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){let 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)}};let rM=Symbol("materials"),rR=Symbol("hierarchy"),rD=Symbol("roots"),rL=Symbol("primitives");Symbol("loadVariant");let rF=Symbol("prepareVariantsForExport"),r_=Symbol("switchVariant"),rk=Symbol("materialFromPoint"),rU=Symbol("nodeFromPoint"),rG=Symbol("nodeFromIndex"),rN=Symbol("variantData"),rP=Symbol("availableVariants"),rO=Symbol("modelOnUpdate"),rH=Symbol("cloneMaterial");let LazyLoader=class LazyLoader{constructor(e,t,s,o){this.gltf=e,this.gltfElementMap=t,this.mapKey=s,this.doLazyLoad=o}};let Model=class Model{constructor(e,t=()=>{}){this[el]=[],this[eh]=[],this[ec]=[],this[eu]=[],this[ed]=()=>{},this[eg]=new Map,this[rO]=t;let{gltf:s,threeGLTF:o,gltfElementMap:A}=e;for(let[e,l]of s.materials.entries()){let h=A.get(l);if(null!=h)this[rM].push(new Material(t,e,!0,this[rN],h,l.name));else{let c=s.materials||[],d=c[e],g=e,materialLoadCallback=async()=>{let e=await o.parser.getDependency("material",g),t=new Set;return A.set(d,t),t.add(e),{set:t,material:e}};this[rM].push(new Material(t,e,!1,this[rN],h,l.name,new LazyLoader(s,A,d,materialLoadCallback)))}}let l=new Map,h=[];for(let e of o.scene.children)h.push(e);for(;h.length>0;){let t=h.pop(),s=null;t instanceof eS.Kj0?(s=new PrimitiveNode(t,this.materials,this[rN],e),this[rL].push(s)):s=new primitive_node_Node(t.name);let o=l.get(t);for(let e of(null!=o?o.children.push(s):this[rD].push(s),this[rR].push(s),t.children))h.push(e),l.set(t,s)}}get materials(){return this[rM]}[(el=rM,eh=rR,ec=rD,eu=rL,ed=rO,eg=rN,rP)](){let e=Array.from(this[rN].values());return e.sort((e,t)=>e.index-t.index),e.map(e=>e.name)}getMaterialByName(e){let t=this[rM].filter(t=>t.name===e);return t.length>0?t[0]:null}[rG](e,t){let s=this[rR].find(s=>{if(s instanceof PrimitiveNode){let{meshes:o,primitives:A}=s.mesh.userData.associations;if(o==e&&A==t)return!0}return!1});return null==s?null:s}[rU](e){return this[rR].find(t=>t instanceof PrimitiveNode&&t.mesh===e.object)}[rk](e){return this[rU](e).getActiveMaterial()}async [r_](e){for(let t of this[rL])await t.enableVariant(e);for(let e of this.materials)e[rw](!1);for(let e of this[rL])this.materials[e.getActiveMaterial().index][rw](!0)}async [rF](){let e=[];for(let t of this[rL])e.push(t.instantiateVariants());await Promise.all(e)}[rH](e,t){let s=this.materials[e];s.isLoaded||console.error(`Cloning an unloaded material,
|
|
call 'material.ensureLoaded() before cloning the material.`);let o=s[sJ],A=new Set;for(let[e,s]of o.entries()){let l=s.clone();l.name=t+(o.size>1?"_inst"+e:""),A.add(l)}let l=new Material(this[rO],this[rM].length,!1,this[rN],A,t);return this[rM].push(l),l}createMaterialInstanceForVariant(e,t,s,o=!0){let A=null;for(let o of this[rL]){let l=this[rN].get(s);null!=l&&o.variantInfo.has(l.index)||null==o.getMaterial(e)||(this.hasVariant(s)||this.createVariant(s),null==A&&(A=this[rH](e,t)),o.addVariant(A,s))}if(o&&null!=A)for(let t of(A[rw](!0),this.materials[e][rw](!1),this[rL]))t.enableVariant(s);return A}createVariant(e){this[rN].has(e)?console.warn(`Variant '${e}'' already exists`):this[rN].set(e,{name:e,index:this[rN].size})}hasVariant(e){return this[rN].has(e)}setMaterialToVariant(e,t){if(null==this[rP]().find(e=>e===t)){console.warn(`Can't add material to '${t}', the variant does not exist.'`);return}if(e<0||e>=this.materials.length){console.error("setMaterialToVariant(): materialIndex is out of bounds.");return}for(let s of this[rL]){let o=s.getMaterial(e);null!=o&&s.addVariant(o,t)}}updateVariantName(e,t){let s=this[rN].get(e);null!=s&&(s.name=t,this[rN].set(t,s),this[rN].delete(e))}deleteVariant(e){let t=this[rN].get(e);if(null!=t){for(let s of this.materials)s.hasVariant(e)&&s[rx].delete(t.index);for(let e of this[rL])e.deleteVariant(t.index);this[rN].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 scene_graph_decorate=function(e,t,s,o){var A,l=arguments.length,h=l<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(e,t,s,o);else for(var c=e.length-1;c>=0;c--)(A=e[c])&&(h=(l<3?A(h):l>3?A(t,s,h):A(t,s))||h);return l>3&&h&&Object.defineProperty(t,s,h),h};let rV=Symbol("currentGLTF"),rq=Symbol("originalGltfJson"),rK=Symbol("model"),rJ=Symbol("getOnUpdateMethod"),rz=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.
|
|
*/let GroundedSkybox=class GroundedSkybox extends eS.Kj0{constructor(){super(void 0,new eS.vBJ({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,t=this.radius,s=128){(e!=this.height||t!=this.radius||s!=this.resolution)&&(this.height=e,this.radius=t,this.resolution=s,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function(e,t,s){let o=new eS.xo$(t,2*s,s);o.scale(1,1,-1);let A=o.getAttribute("position"),l=new eS.Pa4;for(let t=0;t<A.count;++t)if(l.fromBufferAttribute(A,t),l.y<0){let s=-(3*e)/2,o=l.y<s?-e/l.y:1-l.y*l.y/(3*s*s);l.multiplyScalar(o),l.toArray(A.array,3*t)}return A.needsUpdate=!0,o}(e,t,s)))}};/* @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.
|
|
*/let rY=new eS.Pa4,rj=new eS.Pa4,rW=new eS.Pa4,r$=new eS.Vkp,rX=new eS.CJI,rZ=new eS._fP;let Hotspot=class Hotspot extends CSS2DObject{constructor(e){super(document.createElement("div")),this.normal=new eS.Pa4(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface}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;let t=ih(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,iI(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;let t=ih(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(e){if(!e&&this.initialized)return;let{mesh:t,tri:s,bary:o}=this;if(null==t||null==s||null==o)return;t.getVertexPosition(s.x,rY),t.getVertexPosition(s.y,rj),t.getVertexPosition(s.z,rW),rY.toArray(r$.elements,0),rj.toArray(r$.elements,3),rW.toArray(r$.elements,6),this.position.copy(o).applyMatrix3(r$);let A=this.parent;A.worldToLocal(t.localToWorld(this.position)),rX.set(rY,rj,rW),rX.getNormal(this.normal).transformDirection(t.matrixWorld);let l=A.parent;rZ.setFromAxisAngle(rY.set(0,1,0),-l.yaw),this.normal.applyQuaternion(rZ)}orient(e){this.pivot.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;let s=t.dataset.visibilityAttribute;if(null!=s){let o=`data-${s}`;t.toggleAttribute(o,e)}t.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))}),this.initialized=!0}};let r0={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
|
|
|
|
varying vec2 vUv;
|
|
|
|
void main() {
|
|
|
|
vUv = uv;
|
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
|
|
}`,fragmentShader:`
|
|
|
|
uniform sampler2D tDiffuse;
|
|
uniform float h;
|
|
|
|
varying vec2 vUv;
|
|
|
|
void main() {
|
|
|
|
vec4 sum = vec4( 0.0 );
|
|
|
|
sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;
|
|
|
|
gl_FragColor = sum;
|
|
|
|
}`},r1={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:`
|
|
|
|
varying vec2 vUv;
|
|
|
|
void main() {
|
|
|
|
vUv = uv;
|
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
|
|
}`,fragmentShader:`
|
|
|
|
uniform sampler2D tDiffuse;
|
|
uniform float v;
|
|
|
|
varying vec2 vUv;
|
|
|
|
void main() {
|
|
|
|
vec4 sum = vec4( 0.0 );
|
|
|
|
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;
|
|
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;
|
|
|
|
gl_FragColor = sum;
|
|
|
|
}`};let Shadow=class Shadow extends eS.Tme{constructor(e,t,s){super(),this.camera=new eS.iKG,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new eS.lRF,this.horizontalBlurMaterial=new eS.jyz(r0),this.verticalBlurMaterial=new eS.jyz(r1),this.intensity=0,this.softness=1,this.boundingBox=new eS.ZzF,this.size=new eS.Pa4,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;let{camera:o}=this;o.rotation.x=Math.PI/2,o.left=-.5,o.right=.5,o.bottom=-.5,o.top=.5,this.add(o);let A=new eS._12,l=new eS.vBJ({opacity:1,transparent:!0,side:eS._Li});this.floor=new eS.Kj0(A,l),this.floor.userData.noHit=!0,o.add(this.floor),this.blurPlane=new eS.Kj0(A),this.blurPlane.visible=!1,o.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,s)}setScene(e,t,s){let{boundingBox:o,size:A,rotation:l,position:h}=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(h),"back"===s){let{min:e,max:t}=o;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[A.y,A.z]=[A.z,A.y],l.x=Math.PI/2,l.y=Math.PI}else l.x=0,l.y=0;if(this.isAnimated){let e=o.min.y,t=o.max.y;A.y=this.maxDimension,o.expandByVector(A.subScalar(this.maxDimension).multiplyScalar(-.5)),o.min.y=e,o.max.y=t,A.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===s?h.y=o.min.y:h.z=o.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;let{size:t,camera:s}=this,o=this.isAnimated?2:1;this.setMapSize(o*Math.pow(2,9-3*e));let A=t.y/2,l=t.y*o;s.near=0,s.far=(1-e)*l+e*A,this.depthMaterial.opacity=1/e,s.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){let{size:t}=this;this.isAnimated&&(e*=2);let s=Math.floor(t.x>t.z?e:e*t.x/t.z),o=Math.floor(t.x>t.z?e*t.z/t.x:e),A=10+s,l=10+o;if(null!=this.renderTarget&&(this.renderTarget.width!==A||this.renderTarget.height!==l)&&(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){let e={format:eS.wk1};this.renderTarget=new eS.dd2(A,l,e),this.renderTargetBlur=new eS.dd2(A,l,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/s),t.z*(1+10/o),1),this.needsUpdate=!0}setIntensity(e){if(this.intensity=e,e>0){var t;this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*((1-(t=this.softness*this.softness))*.3+1*t)}else 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;let s=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;let o=e.xr.enabled;e.xr.enabled=!1;let A=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=o,e.setRenderTarget(A),e.setClearAlpha(s)}blurShadow(e){let{camera:t,horizontalBlurMaterial:s,verticalBlurMaterial:o,renderTarget:A,renderTargetBlur:l,blurPlane:h}=this;h.visible=!0,h.material=s,s.uniforms.h.value=1/this.renderTarget.width,s.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(l),e.render(h,t),h.material=o,o.uniforms.v.value=1/this.renderTarget.height,o.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(A),e.render(h,t),h.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()}};let r2=new eS.Pa4,r3=new eS.Pa4,r4=new eS.Pa4,r8=new eS.iMs,r5=new eS.Pa4,r6=new eS.FM8;let ModelScene=class ModelScene extends eS.xsS{constructor({canvas:e,element:t,width:s,height:o}){super(),this.annotationRenderer=new CSS2DRenderer,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.camera=new eS.cPb(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new eS.Tme,this.animationNames=[],this.boundingBox=new eS.ZzF,this.boundingSphere=new eS.aLr,this.size=new eS.Pa4,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=eS.LY2,this.canScale=!0,this.isDirty=!1,this.goalTarget=new eS.Pa4,this.targetDamperX=new Damper,this.targetDamperY=new Damper,this.targetDamperZ=new Damper,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new GroundedSkybox,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new eS.cPb(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(s,o),this.target.name="Target",this.mixer=new eS.Xcj(this.target);let{domElement:A}=this.annotationRenderer,{style:l}=A;l.display="none",l.pointerEvents="none",l.position="absolute",l.top="0",this.element.shadowRoot.querySelector(".default").appendChild(A),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._model=e,this.target.add(e),await this.setupScene()}async setSource(e,t=()=>{}){let s;if(!e||e===this.url){t(1);return}if(this.reset(),this.url=e,null!=this.externalRenderer){let e=await this.externalRenderer.load(t);this.boundingSphere.radius=e.framedRadius,this.idealAspect=e.fieldOfViewAspect;return}null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{s=await new Promise(async(s,o)=>{this.cancelPendingSourceChange=()=>o();try{let o=await this.element[nb].loader.load(e,this.element,t);s(o)}catch(e){o(e)}})}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=s,null!=s&&(this._model=s.scene,this.target.add(s.scene));let{animations:o}=s,A=new Map,l=[];for(let e of o)A.set(e.name,e),l.push(e.name);this.animations=o,this.animationsByName=A,this.animationNames=l,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}reset(){this.url=null,this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();let{_model:e}=this;null!=e&&(e.removeFromParent(),this._model=null);let t=this._currentGLTF;null!=t&&(t.dispose(),this._currentGLTF=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[rV]=null,this.element[rq]=null,this.element[rK]=null}get currentGLTF(){return this._currentGLTF}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){let s=td();this.externalRenderer.resize(e*s,t*s)}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){let t=new eS.ZzF;e.traverse(e=>{if(!e.material)return;let s=e.material;if(!s.transparent)return;t.setFromObject(e);let o=t.getSize(r5),A=Math.min(o.x,o.y,o.z),l=Math.max(o.x,o.y,o.z);l<100*A||this.markBakedShadow(e)})}checkBakedShadows(){let{min:e,max:t}=this.boundingBox,s=new eS.ZzF;for(let o of(this.boundingBox.getSize(this.size),this.bakedShadows))s.setFromObject(o),s.min.y<e.y+this.size.y/100&&s.min.x<=e.x&&s.max.x>=t.x&&s.min.z<=e.z&&s.max.z>=t.z||s.min.z<e.z+this.size.z/100&&s.min.x<=e.x&&s.max.x>=t.x&&s.min.y<=e.y&&s.max.y>=t.y||this.unmarkBakedShadow(o)}applyTransform(){let{model:e}=this;if(null==e)return;let t=ih(this.element.orientation)[0].terms,s=iI(t[0]).number,o=iI(t[1]).number,A=iI(t[2]).number;e.quaternion.setFromEuler(new eS.USm(o,A,s,"YXZ"));let l=ih(this.element.scale)[0].terms;e.scale.set(l[0].number,l[1].number,l[2].number)}updateBoundingBox(){let{model:e}=this;if(null==e)return;this.target.remove(e),this.findBakedShadows(e);let bound=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1),this.boundingBox=reduceVertices(e,bound,new eS.ZzF),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach(e=>this.unmarkBakedShadow(e)),this.boundingBox=reduceVertices(e,bound,new eS.ZzF)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){let{model:e}=this;if(null==e)return;this.target.remove(e),this.setBakedShadowVisibility(!1);let{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget()),this.boundingSphere.radius=Math.sqrt(reduceVertices(e,(e,s)=>Math.max(e,t.distanceToSquared(s)),0)),this.idealAspect=reduceVertices(e,(e,s)=>{s.sub(t);let o=Math.sqrt(s.x*s.x+s.z*s.z);return Math.max(e,o/(this.idealCameraDistance()-Math.abs(s.y)))},0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(e)}setBakedShadowVisibility(e=this.shadowIntensity<=0){for(let t of this.bakedShadows)t.visible=e}idealCameraDistance(){let e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){let 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)r6.set(e/window.screen.width,t/window.screen.height);else{let s=this.element.getBoundingClientRect();r6.set((e-s.x)/this.width,(t-s.y)/this.height)}return r6.multiplyScalar(2).subScalar(1),r6.y*=-1,r6}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[nb].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(){let e=ih(this.element.skyboxHeight)[0].terms[0],t=iI(e).number,s=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,s),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,s){this.goalTarget.set(-e,-t,-s)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){let t=this.goalTarget,s=this.target.position;if(t.equals(s))return!1;{let o=this.boundingSphere.radius/10,{x:A,y:l,z:h}=s;return A=this.targetDamperX.update(A,t.x,e,o),l=this.targetDamperY.update(l,t.y,e,o),h=this.targetDamperZ.update(h,t.z,e,o),this.target.position.set(A,l,h),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){let{x:s,z:o}=this.position;this.yaw=Math.atan2(e-s,t-o)}get model(){return this._model}set yaw(e){this.rotation.y=e,this.queueRender()}get yaw(){return this.rotation.y}set animationTime(e){this.mixer.setTime(e),this.queueShadowRender()}get animationTime(){if(null!=this.currentAnimationAction){let e=Math.max(this.currentAnimationAction._loopCount,0);return this.currentAnimationAction.loop===eS.uEv&&(1&e)==1?this.duration-this.currentAnimationAction.time:this.currentAnimationAction.time}return 0}set animationTimeScale(e){this.mixer.timeScale=e}get animationTimeScale(){return this.mixer.timeScale}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(e=null,t=0,s=eS.YKA,o=1/0){if(null==this._currentGLTF)return;let{animations:A}=this;if(null==A||0===A.length)return;let l=null;if(null!=e&&null==(l=this.animationsByName.get(e))){let t=parseInt(e);!isNaN(t)&&t>=0&&t<A.length&&(l=A[t])}null==l&&(l=A[0]);try{let{currentAnimationAction:e}=this,A=this.mixer.clipAction(l,this);this.currentAnimationAction=A,this.element.paused?this.mixer.stopAllAction():(A.paused=!1,null!=e&&A!==e?A.crossFadeFrom(e,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),A.setLoop(s,o),A.enabled=!0,A.clampWhenFinished=!0,A.play()}catch(e){console.error(e)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e),this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixer.addEventListener(e,t)}updateShadow(){let e=this.shadow;if(null!=e){let t="wall"===this.element.arPlacement?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){let t=this.shadow;null!=t&&!0==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){let e="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new Shadow(this,this.shadowSoftness,e)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;let t=this.shadow;null!=t&&t.setSoftness(e)}setShadowOffset(e){let t=this.shadow;null!=t&&t.setOffset(e)}hitFromPoint(e,t=this){r8.setFromCamera(e,this.getCamera());let s=r8.intersectObject(t,!0);return s.find(e=>e.object.visible&&!e.object.userData.noHit)}positionAndNormalFromPoint(e,t=this){var s;let o=this.hitFromPoint(e,t);if(null==o)return null;let A=o.point,l=null!=o.face?o.face.normal.clone().applyNormalMatrix(new eS.Vkp().getNormalMatrix(o.object.matrixWorld)):r8.ray.direction.clone().multiplyScalar(-1),h=null!==(s=o.uv)&&void 0!==s?s:null;return{position:A,normal:l,uv:h}}surfaceFromPoint(e,t=this){let s=this.element.model;if(null==s)return null;let o=this.hitFromPoint(e,t);if(null==o||null==o.face)return null;let A=s[rU](o),{meshes:l,primitives:h}=A.mesh.userData.associations,c=new eS.Pa4,d=new eS.Pa4,g=new eS.Pa4,{a:p,b:m,c:I}=o.face,f=o.object;f.getVertexPosition(p,c),f.getVertexPosition(m,d),f.getVertexPosition(I,g);let E=new eS.CJI(c,d,g),C=new eS.Pa4;return E.getBarycoord(f.worldToLocal(o.point),C),`${l} ${h} ${p} ${m} ${I} ${C.x.toFixed(3)} ${C.y.toFixed(3)} ${C.z.toFixed(3)}`}addHotspot(e){this.target.add(e),this.annotationRenderer.domElement.appendChild(e.element)}removeHotspot(e){this.target.remove(e)}forHotspots(e){let{children:t}=this.target;for(let s=0,o=t.length;s<o;s++){let o=t[s];o instanceof Hotspot&&e(o)}}initializeSurface(e){if(null!=e.surface&&null==e.mesh){let t=ih(e.surface)[0].terms;if(8!=t.length){console.warn(e.surface+" does not have exactly 8 numbers.");return}let s=this.element.model[rG](t[0].number,t[1].number),o=new eS.Pa4(t[2].number,t[3].number,t[4].number);if(null==s){console.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");return}let A=s.mesh.geometry.attributes.position.count;if(o.x>=A||o.y>=A||o.z>=A){console.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");return}let l=new eS.Pa4(t[5].number,t[6].number,t[7].number);e.mesh=s.mesh,e.tri=o,e.bary=l}}updateSurfaceHotspots(){let e=!this.element.paused;this.forHotspots(t=>{this.initializeSurface(t),t.updateSurface(e)})}updateHotspotsVisibility(e){this.forHotspots(t=>{r2.copy(e),r3.setFromMatrixPosition(t.matrixWorld),r2.sub(r3),r4.copy(t.normal).transformDirection(this.target.matrixWorld),0>r2.dot(r4)?t.hide():t.show()})}orientHotspots(e){this.forHotspots(t=>{t.orient(e)})}setHotspotsVisibility(e){this.forHotspots(t=>{t.visible=e})}updateSchema(e){var t;let{schemaElement:s,element:o}=this,{alt:A,poster:l,iosSrc:h}=o;if(null!=e){let o=[{"@type":"MediaObject",contentUrl:e,encodingFormat:(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())==="gltf"?"model/gltf+json":"model/gltf-binary"}];h&&o.push({"@type":"MediaObject",contentUrl:h,encodingFormat:"model/vnd.usdz+zip"}),s.textContent=JSON.stringify({"@context":"http://schema.org/","@type":"3DModel",image:null!=l?l:void 0,name:null!=A?A:void 0,encoding:o}),document.head.appendChild(s)}else null!=s.parentElement&&s.parentElement.removeChild(s)}};/* @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.
|
|
*/let ProgressTracker=class ProgressTracker extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){let t={progress:0,completed:!1};return this.ongoingActivities.add(t),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0,e),s=>{let o;return(o=Math.max(clamp(s,0,1),t.progress))!==t.progress&&this.announceTotalProgress(t,o,e),t.progress}}announceTotalProgress(e,t,s){let o=0,A=0;for(let s of(1==t&&(e.completed=!0),this.ongoingActivities)){let{progress:e}=s;o+=1-e,s.completed&&A++}let l=e.progress;e.progress=t,this.totalProgress+=(t-l)*(1-this.totalProgress)/o;let h=A===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:h,reason:s}})),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 model_viewer_base_decorate=function(e,t,s,o){var A,l=arguments.length,h=l<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(e,t,s,o);else for(var c=e.length-1;c>=0;c--)(A=e[c])&&(h=(l<3?A(h):l>3?A(t,s,h):A(t,s))||h);return l>3&&h&&Object.defineProperty(t,s,h),h};let r9=document.createElement("canvas"),r7=Symbol("fallbackResizeHandler"),ne=Symbol("defaultAriaLabel"),nt=Symbol("resizeObserver"),ni=Symbol("clearModelTimeout"),ns=Symbol("onContextLost"),nr=Symbol("loaded"),nn=Symbol("status"),na=Symbol("onFocus"),no=Symbol("onBlur"),nA=Symbol("updateSize"),nl=Symbol("intersectionObserver"),nh=Symbol("isElementInViewport"),nc=Symbol("announceModelVisibility"),nu=Symbol("ariaLabel"),nd=Symbol("altDefaulted"),ng=Symbol("statusElement"),np=Symbol("updateStatus"),nm=Symbol("loadedTime"),nI=Symbol("updateSource"),nf=Symbol("markLoaded"),nE=Symbol("container"),nC=Symbol("input"),nB=Symbol("canvas"),ny=Symbol("scene"),nw=Symbol("needsRender"),nv=Symbol("tick"),nQ=Symbol("onModelLoad"),nx=Symbol("onResize"),nb=Symbol("renderer"),nS=Symbol("progressTracker"),nT=Symbol("getLoaded"),nM=Symbol("getModelIsVisible"),nR=Symbol("shouldAttemptPreload"),toVector3D=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),toVector2D=e=>({u:e.x,v:e.y,toString(){return`${this.u} ${this.v}`}});let ModelViewerElementBase=class ModelViewerElementBase extends u{constructor(){let e,t;super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[ep]=!1,this[em]=!1,this[eI]=0,this[ef]="",this[eE]=null,this[eC]=debounce(()=>{let e=this.getBoundingClientRect();this[nA](e)},50),this[eB]=debounce(e=>{let t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))},0),this[ey]=null,this[ew]=null,this[ev]=new ProgressTracker,this[eQ]=()=>{this[ng].textContent=this[nn]},this[ex]=()=>{this[ng].textContent=""},this[eb]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});let s=this.shadowRoot;if(makeTemplate(s),this[nE]=s.querySelector(".container"),this[nC]=s.querySelector(".userInput"),this[nB]=s.querySelector("canvas"),this[ng]=s.querySelector("#status"),this[ne]=this[nC].getAttribute("aria-label"),this.isConnected){let s=this.getBoundingClientRect();e=s.width,t=s.height}else e=300,t=150;this[ny]=new ModelScene({canvas:this[nB],element:this,width:e,height:t}),Promise.resolve().then(()=>{this[nA](this.getBoundingClientRect())}),tr&&(this[nt]=new ResizeObserver(e=>{if(!this[nb].isPresenting)for(let t of e)t.target===this&&this[nA](t.contentRect)})),tn?this[nl]=new IntersectionObserver(e=>{for(let t of e)if(t.target===this){let e=this.modelIsVisible;this[nh]=t.isIntersecting,this[nc](e),this[nh]&&!this.loaded&&this[nI]()}},{root:null,rootMargin:"0px",threshold:1e-5}):this[nh]=!0}static get is(){return"model-viewer"}static set modelCacheSize(e){CachingGLTFLoader[t4].evictionThreshold=e}static get modelCacheSize(){return CachingGLTFLoader[t4].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."),Renderer.singleton.minScale=e}static get minimumRenderScale(){return Renderer.singleton.minScale}get loaded(){return this[nT]()}get[(ep=nh,em=nr,eI=nm,ef=nn,eE=ni,eC=r7,eB=nc,ey=nt,ew=nl,ev=nS,nb)](){return Renderer.singleton}get modelIsVisible(){return this[nM]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),tr?this[nt].observe(this):self.addEventListener("resize",this[r7]),tn&&this[nl].observe(this),this.addEventListener("focus",this[na]),this.addEventListener("blur",this[no]);let e=this[nb];e.addEventListener("contextlost",this[ns]),e.registerScene(this[ny]),null!=this[ni]&&(self.clearTimeout(this[ni]),this[ni]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),tr?this[nt].unobserve(this):self.removeEventListener("resize",this[r7]),tn&&this[nl].unobserve(this),this.removeEventListener("focus",this[na]),this.removeEventListener("blur",this[no]);let e=this[nb];e.removeEventListener("contextlost",this[ns]),e.unregisterScene(this[ny]),this[ni]=self.setTimeout(()=>{this[ny].dispose(),this[ni]=null},10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[nr]=!1,this[nm]=0,this[ny].reset()):this.src!==this[ny].url&&(this[nr]=!1,this[nm]=0,this[nI]())),e.has("alt")&&this[nC].setAttribute("aria-label",this[nu]),e.has("withCredentials")&&(CachingGLTFLoader.withCredentials=this.withCredentials,this[nb].textureUtils.withCredentials=this.withCredentials),e.has("generateSchema")&&(this.generateSchema?this[ny].updateSchema(this.src):this[ny].updateSchema(null))}toDataURL(e,t){return this[nb].displayCanvas(this[ny]).toDataURL(e,t)}async toBlob(e){let t=e?e.mimeType:void 0,s=e?e.qualityArgument:void 0,o=e?e.idealAspect:void 0,{width:A,height:l,idealAspect:h,aspect:c}=this[ny],{dpr:d,scaleFactor:g}=this[nb],p=A*g*d,m=l*g*d,I=0,f=0;if(!0===o){if(h>c){let e=m;f=(e-(m=Math.round(p/h)))/2}else{let e=p;I=(e-(p=Math.round(m*h)))/2}}r9.width=p,r9.height=m;try{return new Promise(async(e,o)=>{r9.getContext("2d").drawImage(this[nb].displayCanvas(this[ny]),I,f,p,m,0,0,p,m),r9.toBlob(t=>{if(!t)return o(Error("Unable to retrieve canvas blob"));e(t)},t,s)})}finally{this[nA]({width:A,height:l})}}registerEffectComposer(e){e.setRenderer(this[nb].threeRenderer),e.setMainCamera(this[ny].getCamera()),e.setMainScene(this[ny]),this[ny].effectRenderer=e}unregisterEffectComposer(){this[ny].effectRenderer=null}registerRenderer(e){this[ny].externalRenderer=e}unregisterRenderer(){this[ny].externalRenderer=null}get[nu](){return this[nd]}get[nd](){return null==this.alt||"null"===this.alt?this[ne]:this.alt}[nT](){return this[nr]}[nM](){return this.loaded&&this[nh]}[nR](){return!!this.src&&this[nh]}[nA]({width:e,height:t}){0!==e&&0!==t&&(this[nE].style.width=`${e}px`,this[nE].style.height=`${t}px`,this[nx]({width:e,height:t}))}[nv](e,t){var s;null===(s=this[ny].effectRenderer)||void 0===s||s.beforeRender(e,t)}[nf](){this[nr]||(this[nr]=!0,this[nm]=performance.now())}[nw](){this[ny].queueRender()}[nQ](){}[np](e){this[nn]=e;let t=this.getRootNode();null!=t&&t.activeElement===this&&this[ng].textContent!=e&&(this[ng].textContent=e)}[(eQ=na,ex=no,nx)](e){this[ny].setSize(e.width,e.height)}async [(eb=ns,nI)](){let e=this[ny];if(this.loaded||!this[nR]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[np]("Loading"),e.stopAnimation();let t=this[nS].beginActivity("model-load"),s=this.src;try{let o=e.setSource(s,e=>t(.95*clamp(e,0,1))),A=this[tI]();await Promise.all([o,A]),this[nf](),this[nQ](),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("before-render"))}),await new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:s}})),e()})})})}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{t(1)}}};model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"alt",void 0),model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"src",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"with-credentials"})],ModelViewerElementBase.prototype,"withCredentials",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"generate-schema"})],ModelViewerElementBase.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 animation_decorate=function(e,t,s,o){var A,l=arguments.length,h=l<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(e,t,s,o);else for(var c=e.length-1;c>=0;c--)(A=e[c])&&(h=(l<3?A(h):l>3?A(t,s,h):A(t,s))||h);return l>3&&h&&Object.defineProperty(t,s,h),h};let nD=Symbol("changeAnimation"),nL=Symbol("paused"),nF={repetitions:1/0,pingpong:!1},n_=Symbol("hotspotMap"),nk=Symbol("mutationCallback"),nU=Symbol("observer"),nG=Symbol("addHotspot"),nN=Symbol("removeHotspot"),nP=new eS.yGw;/*!
|
|
fflate - fast JavaScript compression/decompression
|
|
<https://101arrowz.github.io/fflate>
|
|
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
|
|
version 0.6.9
|
|
*/var nO={},durl=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},cwk=function(e){return new Worker(e)};try{URL.revokeObjectURL(durl(""))}catch(e){durl=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},cwk=function(e){return new Worker(e,{type:"module"})}}var nH=Uint8Array,nV=Uint16Array,nq=Uint32Array,nK=new nH([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]),nJ=new nH([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]),nz=new nH([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(e,t){for(var s=new nV(31),o=0;o<31;++o)s[o]=t+=1<<e[o-1];for(var A=new nq(s[30]),o=1;o<30;++o)for(var l=s[o];l<s[o+1];++l)A[l]=l-s[o]<<5|o;return[s,A]},nY=freb(nK,2),nj=nY[0],nW=nY[1];nj[28]=258,nW[258]=28;for(var n$=freb(nJ,0),nX=n$[0],nZ=n$[1],n0=new nV(32768),n1=0;n1<32768;++n1){var n2=(43690&n1)>>>1|(21845&n1)<<1;n2=(61680&(n2=(52428&n2)>>>2|(13107&n2)<<2))>>>4|(3855&n2)<<4,n0[n1]=((65280&n2)>>>8|(255&n2)<<8)>>>1}for(var hMap=function(e,t,s){for(var o,A=e.length,l=0,h=new nV(t);l<A;++l)++h[e[l]-1];var c=new nV(t);for(l=0;l<t;++l)c[l]=c[l-1]+h[l-1]<<1;if(s){o=new nV(1<<t);var d=15-t;for(l=0;l<A;++l)if(e[l])for(var g=l<<4|e[l],p=t-e[l],m=c[e[l]-1]++<<p,I=m|(1<<p)-1;m<=I;++m)o[n0[m]>>>d]=g}else for(l=0,o=new nV(A);l<A;++l)e[l]&&(o[l]=n0[c[e[l]-1]++]>>>15-e[l]);return o},n3=new nH(288),n1=0;n1<144;++n1)n3[n1]=8;for(var n1=144;n1<256;++n1)n3[n1]=9;for(var n1=256;n1<280;++n1)n3[n1]=7;for(var n1=280;n1<288;++n1)n3[n1]=8;for(var n4=new nH(32),n1=0;n1<32;++n1)n4[n1]=5;var n8=hMap(n3,9,0),n5=hMap(n4,5,0),max=function(e){for(var t=e[0],s=1;s<e.length;++s)e[s]>t&&(t=e[s]);return t},bits=function(e,t,s){var o=t/8|0;return(e[o]|e[o+1]<<8)>>(7&t)&s},bits16=function(e,t){var s=t/8|0;return(e[s]|e[s+1]<<8|e[s+2]<<16)>>(7&t)},shft=function(e){return(e/8|0)+(7&e&&1)},slc=function(e,t,s){(null==t||t<0)&&(t=0),(null==s||s>e.length)&&(s=e.length);var o=new(e instanceof nV?nV:e instanceof nq?nq:nH)(s-t);return o.set(e.subarray(t,s)),o},wbits=function(e,t,s){s<<=7&t;var o=t/8|0;e[o]|=s,e[o+1]|=s>>>8},wbits16=function(e,t,s){s<<=7&t;var o=t/8|0;e[o]|=s,e[o+1]|=s>>>8,e[o+2]|=s>>>16},hTree=function(e,t){for(var s=[],o=0;o<e.length;++o)e[o]&&s.push({s:o,f:e[o]});var A=s.length,l=s.slice();if(!A)return[n9,0];if(1==A){var h=new nH(s[0].s+1);return h[s[0].s]=1,[h,1]}s.sort(function(e,t){return e.f-t.f}),s.push({s:-1,f:25001});var c=s[0],d=s[1],g=0,p=1,m=2;for(s[0]={s:-1,f:c.f+d.f,l:c,r:d};p!=A-1;)c=s[s[g].f<s[m].f?g++:m++],d=s[g!=p&&s[g].f<s[m].f?g++:m++],s[p++]={s:-1,f:c.f+d.f,l:c,r:d};for(var I=l[0].s,o=1;o<A;++o)l[o].s>I&&(I=l[o].s);var f=new nV(I+1),E=fflate_module_ln(s[p-1],f,0);if(E>t){var o=0,C=0,B=E-t,y=1<<B;for(l.sort(function(e,t){return f[t.s]-f[e.s]||e.f-t.f});o<A;++o){var Q=l[o].s;if(f[Q]>t)C+=y-(1<<E-f[Q]),f[Q]=t;else break}for(C>>>=B;C>0;){var x=l[o].s;f[x]<t?C-=1<<t-f[x]++-1:++o}for(;o>=0&&C;--o){var b=l[o].s;f[b]==t&&(--f[b],++C)}E=t}return[new nH(f),E]},fflate_module_ln=function(e,t,s){return -1==e.s?Math.max(fflate_module_ln(e.l,t,s+1),fflate_module_ln(e.r,t,s+1)):t[e.s]=s},lc=function(e){for(var t=e.length;t&&!e[--t];);for(var s=new nV(++t),o=0,A=e[0],l=1,w=function(e){s[o++]=e},h=1;h<=t;++h)if(e[h]==A&&h!=t)++l;else{if(!A&&l>2){for(;l>138;l-=138)w(32754);l>2&&(w(l>10?l-11<<5|28690:l-3<<5|12305),l=0)}else if(l>3){for(w(A),--l;l>6;l-=6)w(8304);l>2&&(w(l-3<<5|8208),l=0)}for(;l--;)w(A);l=1,A=e[h]}return[s.subarray(0,o),t]},clen=function(e,t){for(var s=0,o=0;o<t.length;++o)s+=e[o]*t[o];return s},wfblk=function(e,t,s){var o=s.length,A=shft(t+2);e[A]=255&o,e[A+1]=o>>>8,e[A+2]=255^e[A],e[A+3]=255^e[A+1];for(var l=0;l<o;++l)e[A+l+4]=s[l];return(A+4+o)*8},wblk=function(e,t,s,o,A,l,h,c,d,g,p){wbits(t,p++,s),++A[256];for(var m,I,f,E,C=hTree(A,15),B=C[0],y=C[1],Q=hTree(l,15),x=Q[0],b=Q[1],T=lc(B),F=T[0],_=T[1],U=lc(x),G=U[0],O=U[1],q=new nV(19),K=0;K<F.length;++K)q[31&F[K]]++;for(var K=0;K<G.length;++K)q[31&G[K]]++;for(var J=hTree(q,7),Y=J[0],j=J[1],W=19;W>4&&!Y[nz[W-1]];--W);var $=g+5<<3,X=clen(A,n3)+clen(l,n4)+h,ee=clen(A,B)+clen(l,x)+h+14+3*W+clen(q,Y)+(2*q[16]+3*q[17]+7*q[18]);if($<=X&&$<=ee)return wfblk(t,p,e.subarray(d,d+g));if(wbits(t,p,1+(ee<X)),p+=2,ee<X){m=hMap(B,y,0),I=B,f=hMap(x,b,0),E=x;var et=hMap(Y,j,0);wbits(t,p,_-257),wbits(t,p+5,O-1),wbits(t,p+10,W-4),p+=14;for(var K=0;K<W;++K)wbits(t,p+3*K,Y[nz[K]]);p+=3*W;for(var ei=[F,G],es=0;es<2;++es)for(var er=ei[es],K=0;K<er.length;++K){var en=31&er[K];wbits(t,p,et[en]),p+=Y[en],en>15&&(wbits(t,p,er[K]>>>5&127),p+=er[K]>>>12)}}else m=n8,I=n3,f=n5,E=n4;for(var K=0;K<c;++K)if(o[K]>255){var en=o[K]>>>18&31;wbits16(t,p,m[en+257]),p+=I[en+257],en>7&&(wbits(t,p,o[K]>>>23&31),p+=nK[en]);var ea=31&o[K];wbits16(t,p,f[ea]),p+=E[ea],ea>3&&(wbits16(t,p,o[K]>>>5&8191),p+=nJ[ea])}else wbits16(t,p,m[o[K]]),p+=I[o[K]];return wbits16(t,p,m[256]),p+I[256]},n6=new nq([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),n9=new nH(0),dflt=function(e,t,s,o,A,l){var h=e.length,c=new nH(o+h+5*(1+Math.ceil(h/7e3))+A),d=c.subarray(o,c.length-A),g=0;if(!t||h<8)for(var p=0;p<=h;p+=65535){var m=p+65535;m<h?g=wfblk(d,g,e.subarray(p,m)):(d[p]=l,g=wfblk(d,g,e.subarray(p,h)))}else{for(var I=n6[t-1],f=I>>>13,E=8191&I,C=(1<<s)-1,B=new nV(32768),y=new nV(C+1),Q=Math.ceil(s/3),x=2*Q,hsh=function(t){return(e[t]^e[t+1]<<Q^e[t+2]<<x)&C},b=new nq(25e3),T=new nV(288),F=new nV(32),_=0,U=0,p=0,G=0,O=0,q=0;p<h;++p){var K=hsh(p),J=32767&p,Y=y[K];if(B[J]=Y,y[K]=J,O<=p){var j=h-p;if((_>7e3||G>24576)&&j>423){g=wblk(e,d,0,b,T,F,U,G,q,p-q,g),G=_=U=0,q=p;for(var W=0;W<286;++W)T[W]=0;for(var W=0;W<30;++W)F[W]=0}var $=2,X=0,ee=E,et=J-Y&32767;if(j>2&&K==hsh(p-et))for(var ei=Math.min(f,j)-1,es=Math.min(32767,p),er=Math.min(258,j);et<=es&&--ee&&J!=Y;){if(e[p+$]==e[p+$-et]){for(var en=0;en<er&&e[p+en]==e[p+en-et];++en);if(en>$){if($=en,X=et,en>ei)break;for(var ea=Math.min(et,en-2),eo=0,W=0;W<ea;++W){var eA=p-et+W+32768&32767,el=B[eA],eh=eA-el+32768&32767;eh>eo&&(eo=eh,Y=eA)}}}Y=B[J=Y],et+=J-Y+32768&32767}if(X){b[G++]=268435456|nW[$]<<18|nZ[X];var ec=31&nW[$],eu=31&nZ[X];U+=nK[ec]+nJ[eu],++T[257+ec],++F[eu],O=p+$,++_}else b[G++]=e[p],++T[e[p]]}}g=wblk(e,d,l,b,T,F,U,G,q,p-q,g),!l&&7&g&&(g=wfblk(d,g+1,n9))}return slc(c,0,o+shft(g)+A)},n7=function(){for(var e=new nq(256),t=0;t<256;++t){for(var s=t,o=9;--o;)s=(1&s&&3988292384)^s>>>1;e[t]=s}return e}(),crc=function(){var e=-1;return{p:function(t){for(var s=e,o=0;o<t.length;++o)s=n7[255&s^t[o]]^s>>>8;e=s},d:function(){return~e}}},mrg=function(e,t){var s={};for(var o in e)s[o]=e[o];for(var o in t)s[o]=t[o];return s},wbytes=function(e,t,s){for(;s;++t)e[t]=s,s>>>=8},fltn=function(e,t,s,o){for(var A in e){var l=e[A],h=t+A;l instanceof nH?s[h]=[l,o]:Array.isArray(l)?s[h]=[l[0],mrg(o,l[1])]:fltn(l,h+"/",s,o)}},ae="undefined"!=typeof TextEncoder&&new TextEncoder,at="undefined"!=typeof TextDecoder&&new TextDecoder;try{at.decode(n9,{stream:!0})}catch(e){}function strToU8(e,t){if(t){for(var s=new nH(e.length),o=0;o<e.length;++o)s[o]=e.charCodeAt(o);return s}if(ae)return ae.encode(e);for(var A=e.length,l=new nH(e.length+(e.length>>1)),h=0,w=function(e){l[h++]=e},o=0;o<A;++o){if(h+5>l.length){var c=new nH(h+8+(A-o<<1));c.set(l),l=c}var d=e.charCodeAt(o);d<128||t?w(d):(d<2048?w(192|d>>6):(d>55295&&d<57344?(w(240|(d=65536+(1047552&d)|1023&e.charCodeAt(++o))>>18),w(128|d>>12&63)):w(224|d>>12),w(128|d>>6&63)),w(128|63&d))}return slc(l,0,h)}var exfl=function(e){var t=0;if(e)for(var s in e){var o=e[s].length;if(o>65535)throw"extra field too long";t+=o+4}return t},wzh=function(e,t,s,o,A,l,h,c){var d=o.length,g=s.extra,p=c&&c.length,m=exfl(g);wbytes(e,t,null!=h?33639248:67324752),t+=4,null!=h&&(e[t++]=20,e[t++]=s.os),e[t]=20,t+=2,e[t++]=s.flag<<1|(null==l&&8),e[t++]=A&&8,e[t++]=255&s.compression,e[t++]=s.compression>>8;var I=new Date(null==s.mtime?Date.now():s.mtime),f=I.getFullYear()-1980;if(f<0||f>119)throw"date not in range 1980-2099";if(wbytes(e,t,f<<25|I.getMonth()+1<<21|I.getDate()<<16|I.getHours()<<11|I.getMinutes()<<5|I.getSeconds()>>>1),t+=4,null!=l&&(wbytes(e,t,s.crc),wbytes(e,t+4,l),wbytes(e,t+8,s.size)),wbytes(e,t+12,d),wbytes(e,t+14,m),t+=16,null!=h&&(wbytes(e,t,p),wbytes(e,t+6,s.attrs),wbytes(e,t+10,h),t+=14),e.set(o,t),t+=d,m)for(var E in g){var C=g[E],B=C.length;wbytes(e,t,+E),wbytes(e,t+2,B),e.set(C,t+4),t+=4+B}return p&&(e.set(c,t),t+=p),t},wzf=function(e,t,s,o,A){wbytes(e,t,101010256),wbytes(e,t+8,s),wbytes(e,t+10,s),wbytes(e,t+12,o),wbytes(e,t+16,A)};let USDZExporter=class USDZExporter{async parse(e,t={}){var s;t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},quickLookCompatible:!1},t);let o={},A="model.usda";o[A]=null;let l=buildHeader();l+=(s=t,`def Xform "Root"
|
|
{
|
|
def Scope "Scenes" (
|
|
kind = "sceneLibrary"
|
|
)
|
|
{
|
|
def Xform "Scene" (
|
|
customData = {
|
|
bool preliminary_collidesWithEnvironment = 0
|
|
string sceneName = "Scene"
|
|
}
|
|
sceneName = "Scene"
|
|
)
|
|
{
|
|
token preliminary:anchoring:type = "${s.ar.anchoring.type}"
|
|
token preliminary:planeAnchoring:alignment = "${s.ar.planeAnchoring.alignment}"
|
|
|
|
`);let h={},c={};for(let s in e.traverseVisible(e=>{if(e.isMesh){let s=e.geometry,A=e.material;if(A.isMeshStandardMaterial){let c="geometries/Geometry_"+s.id+".usda";if(!(c in o)){var t;let e;let A=function(e){let t=function(e){let t=e.attributes,s=t.position.count;return`
|
|
def Mesh "Geometry"
|
|
{
|
|
int[] faceVertexCounts = [${function(e){let t=null!==e.index?e.index.count:e.attributes.position.count;return Array(t/3).fill(3).join(", ")}(e)}]
|
|
int[] faceVertexIndices = [${function(e){let t=e.index,s=[];if(null!==t)for(let e=0;e<t.count;e++)s.push(t.getX(e));else{let t=e.attributes.position.count;for(let e=0;e<t;e++)s.push(e)}return s.join(", ")}(e)}]
|
|
normal3f[] normals = [${buildVector3Array(t.normal,s)}] (
|
|
interpolation = "vertex"
|
|
)
|
|
point3f[] points = [${buildVector3Array(t.position,s)}]
|
|
${function(e){let t="";for(let s=0;s<4;s++){let o=s>0?s:"",A=e["uv"+o];void 0!==A&&(t+=`
|
|
texCoord2f[] primvars:st${o} = [${function(e){let t=[];for(let s=0;s<e.count;s++){let o=e.getX(s),A=e.getY(s);t.push(`(${o.toPrecision(7)}, ${1-A.toPrecision(7)})`)}return t.join(", ")}(A)}] (
|
|
interpolation = "vertex"
|
|
)`)}return t}(t)}
|
|
uniform token subdivisionScheme = "none"
|
|
}
|
|
`}(e);return`
|
|
def "Geometry"
|
|
{
|
|
${t}
|
|
}
|
|
`}(s);o[c]=(t=A,strToU8(buildHeader()+t))}A.uuid in h||(h[A.uuid]=A),l+=function(e,t,s){let o="Object_"+e.id,A=buildMatrix(e.matrixWorld);return 0>e.matrixWorld.determinant()&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",e),`def Xform "${o}" (
|
|
prepend references = @./geometries/Geometry_${t.id}.usda@</Geometry>
|
|
prepend apiSchemas = ["MaterialBindingAPI"]
|
|
)
|
|
{
|
|
matrix4d xformOp:transform = ${A}
|
|
uniform token[] xformOpOrder = ["xformOp:transform"]
|
|
|
|
rel material:binding = </Materials/Material_${s.id}>
|
|
}
|
|
|
|
`}(e,s,A)}else console.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",e)}else e.isCamera&&(l+=function(e){let t=e.name?e.name:"Camera_"+e.id,s=buildMatrix(e.matrixWorld);return(0>e.matrixWorld.determinant()&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",e),e.isOrthographicCamera)?`def Camera "${t}"
|
|
{
|
|
matrix4d xformOp:transform = ${s}
|
|
uniform token[] xformOpOrder = ["xformOp:transform"]
|
|
|
|
float2 clippingRange = (${e.near.toPrecision(7)}, ${e.far.toPrecision(7)})
|
|
float horizontalAperture = ${((Math.abs(e.left)+Math.abs(e.right))*10).toPrecision(7)}
|
|
float verticalAperture = ${((Math.abs(e.top)+Math.abs(e.bottom))*10).toPrecision(7)}
|
|
token projection = "orthographic"
|
|
}
|
|
|
|
`:`def Camera "${t}"
|
|
{
|
|
matrix4d xformOp:transform = ${s}
|
|
uniform token[] xformOpOrder = ["xformOp:transform"]
|
|
|
|
float2 clippingRange = (${e.near.toPrecision(7)}, ${e.far.toPrecision(7)})
|
|
float focalLength = ${e.getFocalLength().toPrecision(7)}
|
|
float focusDistance = ${e.focus.toPrecision(7)}
|
|
float horizontalAperture = ${e.getFilmWidth().toPrecision(7)}
|
|
token projection = "perspective"
|
|
float verticalAperture = ${e.getFilmHeight().toPrecision(7)}
|
|
}
|
|
|
|
`}(e))}),l+=`
|
|
}
|
|
}
|
|
}
|
|
|
|
`+function(e,t,s=!1){let o=[];for(let A in e){let l=e[A];o.push(function(e,t,s=!1){let o=[],A=[];function buildTexture(o,A,l){var h;let c=o.source.id+"_"+o.flipY;t[c]=o;let d=o.channel>0?"st"+o.channel:"st",g={1e3:"repeat",1001:"clamp",1002:"mirror"},p=o.repeat.clone(),m=o.offset.clone(),I=o.rotation,f=Math.sin(I),E=Math.cos(I);return m.y=1-m.y-p.y,s?(m.x=m.x/p.x,m.y=m.y/p.y,m.x+=f/p.x,m.y+=E-1):(m.x+=f*p.x,m.y+=(1-E)*p.y),`
|
|
def Shader "PrimvarReader_${A}"
|
|
{
|
|
uniform token info:id = "UsdPrimvarReader_float2"
|
|
float2 inputs:fallback = (0.0, 0.0)
|
|
token inputs:varname = "${d}"
|
|
float2 outputs:result
|
|
}
|
|
|
|
def Shader "Transform2d_${A}"
|
|
{
|
|
uniform token info:id = "UsdTransform2d"
|
|
token inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${A}.outputs:result>
|
|
float inputs:rotation = ${(I*(180/Math.PI)).toFixed(7)}
|
|
float2 inputs:scale = ${buildVector2(p)}
|
|
float2 inputs:translation = ${buildVector2(m)}
|
|
float2 outputs:result
|
|
}
|
|
|
|
def Shader "Texture_${o.id}_${A}"
|
|
{
|
|
uniform token info:id = "UsdUVTexture"
|
|
asset inputs:file = @textures/Texture_${c}.png@
|
|
float2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${A}.outputs:result>
|
|
${void 0!==l?"float4 inputs:scale = "+(h=l,`(${h.r}, ${h.g}, ${h.b}, 1.0)`):""}
|
|
token inputs:sourceColorSpace = "${o.colorSpace===eS.aCh?"raw":"sRGB"}"
|
|
token inputs:wrapS = "${g[o.wrapS]}"
|
|
token inputs:wrapT = "${g[o.wrapT]}"
|
|
float outputs:r
|
|
float outputs:g
|
|
float outputs:b
|
|
float3 outputs:rgb
|
|
${e.transparent||e.alphaTest>0?"float outputs:a":""}
|
|
}`}return e.side===eS.ehD&&console.warn("THREE.USDZExporter: USDZ does not support double sided materials",e),null!==e.map?(o.push(` color3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?o.push(` float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(o.push(` float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),o.push(` float inputs:opacityThreshold = ${e.alphaTest}`)),A.push(buildTexture(e.map,"diffuse",e.color))):o.push(` color3f inputs:diffuseColor = ${buildColor(e.color)}`),null!==e.emissiveMap?(o.push(` color3f inputs:emissiveColor.connect = </Materials/Material_${e.id}/Texture_${e.emissiveMap.id}_emissive.outputs:rgb>`),A.push(buildTexture(e.emissiveMap,"emissive"))):e.emissive.getHex()>0&&o.push(` color3f inputs:emissiveColor = ${buildColor(e.emissive)}`),null!==e.normalMap&&(o.push(` normal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`),A.push(buildTexture(e.normalMap,"normal"))),null!==e.aoMap&&(o.push(` float inputs:occlusion.connect = </Materials/Material_${e.id}/Texture_${e.aoMap.id}_occlusion.outputs:r>`),A.push(buildTexture(e.aoMap,"occlusion"))),null!==e.roughnessMap&&1===e.roughness?(o.push(` float inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`),A.push(buildTexture(e.roughnessMap,"roughness"))):o.push(` float inputs:roughness = ${e.roughness}`),null!==e.metalnessMap&&1===e.metalness?(o.push(` float inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`),A.push(buildTexture(e.metalnessMap,"metallic"))):o.push(` float inputs:metallic = ${e.metalness}`),null!==e.alphaMap?(o.push(` float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),o.push(` float inputs:opacityThreshold = 0.0001`),A.push(buildTexture(e.alphaMap,"opacity"))):o.push(` float inputs:opacity = ${e.opacity}`),e.isMeshPhysicalMaterial&&(o.push(` float inputs:clearcoat = ${e.clearcoat}`),o.push(` float inputs:clearcoatRoughness = ${e.clearcoatRoughness}`),o.push(` float inputs:ior = ${e.ior}`)),`
|
|
def Material "Material_${e.id}"
|
|
{
|
|
def Shader "PreviewSurface"
|
|
{
|
|
uniform token info:id = "UsdPreviewSurface"
|
|
${o.join("\n")}
|
|
int inputs:useSpecularWorkflow = 0
|
|
token outputs:surface
|
|
}
|
|
|
|
token outputs:surface.connect = </Materials/Material_${e.id}/PreviewSurface.outputs:surface>
|
|
|
|
${A.join("\n")}
|
|
|
|
}
|
|
`}(l,t,s))}return`def "Materials"
|
|
{
|
|
${o.join("")}
|
|
}
|
|
|
|
`}(h,c,t.quickLookCompatible),o[A]=strToU8(l),l=null,c){let e=c[s];!0===e.isCompressedTexture&&(e=decompress(e));let t=function(e,t){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){let s=1024/Math.max(e.width,e.height),o=document.createElement("canvas");o.width=e.width*Math.min(1,s),o.height=e.height*Math.min(1,s);let A=o.getContext("2d");return!0===t&&(A.translate(0,o.height),A.scale(1,-1)),A.drawImage(e,0,0,o.width,o.height),o}throw Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}(e.image,e.flipY),A=await new Promise(e=>t.toBlob(e,"image/png",1));o[`textures/Texture_${s}.png`]=new Uint8Array(await A.arrayBuffer())}let d=0;for(let e in o){let t=o[e],s=34+e.length;d+=s;let A=63&d;if(4!==A){let s=64-A,l=new Uint8Array(s);o[e]=[t,{extra:{12345:l}}]}d=t.length}return function(e,t){t||(t={});var s={},o=[];fltn(e,"",s,t);var A=0,l=0;for(var h in s){var c=s[h],d=c[0],g=c[1],p=0==g.level?0:8,m=strToU8(h),I=m.length,f=g.comment,E=f&&strToU8(f),C=E&&E.length,B=exfl(g.extra);if(I>65535)throw"filename too long";var y=p?function(e,t){var s;return dflt(e,null==(s=t||{}).level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+s.mem,0,0,!0)}(d,g):d,Q=y.length,x=crc();x.p(d),o.push(mrg(g,{size:d.length,crc:x.d(),c:y,f:m,m:E,u:I!=h.length||E&&f.length!=C,o:A,compression:p})),A+=30+I+B+Q,l+=76+2*(I+B)+(C||0)+Q}for(var b=new nH(l+22),T=A,F=l-A,_=0;_<o.length;++_){var m=o[_];wzh(b,m.o,m,m.f,m.u,m.c.length);var U=30+m.f.length+exfl(m.extra);b.set(m.c,m.o+U),wzh(b,A,m,m.f,m.u,m.c.length,m.o,m.m),A+=16+U+(m.m?m.m.length:0)}return wzf(b,A,o.length,F,T),b}(o,{level:0})}};function buildHeader(){return`#usda 1.0
|
|
(
|
|
customLayerData = {
|
|
string creator = "Three.js USDZExporter"
|
|
}
|
|
defaultPrim = "Root"
|
|
metersPerUnit = 1
|
|
upAxis = "Y"
|
|
)
|
|
|
|
`}function buildMatrix(e){let t=e.elements;return`( ${buildMatrixRow(t,0)}, ${buildMatrixRow(t,4)}, ${buildMatrixRow(t,8)}, ${buildMatrixRow(t,12)} )`}function buildMatrixRow(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function buildVector3Array(e,t){if(void 0===e)return console.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");let s=[];for(let t=0;t<e.count;t++){let o=e.getX(t),A=e.getY(t),l=e.getZ(t);s.push(`(${o.toPrecision(7)}, ${A.toPrecision(7)}, ${l.toPrecision(7)})`)}return s.join(", ")}function buildColor(e){return`(${e.r}, ${e.g}, ${e.b})`}function buildVector2(e){return`(${e.x}, ${e.y})`}/* @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 ar_decorate=function(e,t,s,o){var A,l=arguments.length,h=l<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(e,t,s,o);else for(var c=e.length-1;c>=0;c--)(A=e[c])&&(h=(l<3?A(h):l>3?A(t,s,h):A(t,s))||h);return l>3&&h&&Object.defineProperty(t,s,h),h};let ai=!1,as=!1,ar="#model-viewer-no-ar-fallback",an=(x=["quick-look","scene-viewer","webxr","none"],e=>{try{let t=ih(e),s=(t.length?t[0].terms:[]).filter(e=>e&&"ident"===e.type).map(e=>e.value).filter(e=>x.indexOf(e)>-1);return new Set(s)}catch(e){}return new Set}),aa={QUICK_LOOK:"quick-look",SCENE_VIEWER:"scene-viewer",WEBXR:"webxr",NONE:"none"},ao=Symbol("arButtonContainer"),aA=Symbol("enterARWithWebXR"),al=Symbol("openSceneViewer"),ah=Symbol("openIOSARQuickLook"),ac=Symbol("canActivateAR"),au=Symbol("arMode"),ad=Symbol("arModes"),ag=Symbol("arAnchor"),ap=Symbol("preload"),am=Symbol("onARButtonContainerClick"),aI=Symbol("onARStatus"),af=Symbol("onARTracking"),aE=Symbol("onARTap"),aC=Symbol("selectARMode"),aB=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 loading_decorate=function(e,t,s,o){var A,l=arguments.length,h=l<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(e,t,s,o);else for(var c=e.length-1;c>=0;c--)(A=e[c])&&(h=(l<3?A(h):l>3?A(t,s,h):A(t,s))||h);return l>3&&h&&Object.defineProperty(t,s,h),h};let ay={AUTO:"auto"},aw={AUTO:"auto",EAGER:"eager"},av=Symbol("defaultProgressBarElement"),aQ=Symbol("posterContainerElement"),ax=Symbol("defaultPosterElement"),ab=Symbol("shouldDismissPoster"),aS=Symbol("hidePoster"),aT=Symbol("modelIsRevealed"),aM=Symbol("updateProgressBar"),aR=Symbol("ariaLabelCallToAction"),aD=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 staging_decorate=function(e,t,s,o){var A,l=arguments.length,h=l<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(e,t,s,o);else for(var c=e.length-1;c>=0;c--)(A=e[c])&&(h=(l<3?A(h):l>3?A(t,s,h):A(t,s))||h);return l>3&&h&&Object.defineProperty(t,s,h),h};let aL={basis:[degreesToRadians(numberNode(Math.PI/32,"rad"))],keywords:{auto:[null]}},aF=Symbol("autoRotateStartTime"),a_=Symbol("radiansPerSecond"),ak=Symbol("syncRotationRate"),aU=Symbol("onCameraChange"),aG=(e=>{var t,s,o;let AnnotationModelViewerElement=class AnnotationModelViewerElement extends e{constructor(){super(...arguments),this[t]=new Map,this[s]=e=>{e.forEach(e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach(e=>{this[nG](e)}),e.removedNodes.forEach(e=>{this[nN](e)}),this[nw]())})},this[o]=new MutationObserver(this[nk])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[nG](this.children[e]);let{ShadyDOM:e}=self;null==e?this[nU].observe(this,{childList:!0}):this[nU]=e.observeChildren(this,this[nk])}disconnectedCallback(){super.disconnectedCallback();let{ShadyDOM:e}=self;null==e?this[nU].disconnect():e.unobserveChildren(this[nU])}[(t=n_,s=nk,o=nU,nv)](e,t){super[nv](e,t);let s=this[ny],{annotationRenderer:o}=s,A=s.getCamera();s.shouldRender()&&(s.updateSurfaceHotspots(),s.updateHotspotsVisibility(A.position),o.domElement.style.display="",o.render(s,A))}updateHotspot(e){let t=this[n_].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[nw]())}queryHotspot(e){let t=this[n_].get(e);if(null==t)return null;let s=toVector3D(t.position),o=toVector3D(t.normal),A=t.facingCamera,l=this[ny],h=l.getCamera(),c=new eS.Pa4;c.setFromMatrixPosition(t.matrixWorld),c.project(h);let d=l.width/2,g=l.height/2;c.x=c.x*d+d,c.y=-(c.y*g)+g;let p=toVector3D(new eS.Pa4(c.x,c.y,c.z));return Number.isFinite(p.x)&&Number.isFinite(p.y)?{position:s,normal:o,canvasPosition:p,facingCamera:A}:null}positionAndNormalFromPoint(e,t){let s=this[ny],o=s.getNDC(e,t),A=s.positionAndNormalFromPoint(o);if(null==A)return null;nP.copy(s.target.matrixWorld).invert();let l=toVector3D(A.position.applyMatrix4(nP)),h=toVector3D(A.normal.transformDirection(nP)),c=null;return null!=A.uv&&(c=toVector2D(A.uv)),{position:l,normal:h,uv:c}}surfaceFromPoint(e,t){let s=this[ny],o=s.getNDC(e,t);return s.surfaceFromPoint(o)}[nG](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[n_].get(e.slot);null!=t?t.increment():(t=new Hotspot({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface}),this[n_].set(e.slot,t),this[ny].addHotspot(t)),this[ny].queueRender()}[nN](e){if(!(e instanceof HTMLElement))return;let t=this[n_].get(e.slot);t&&(t.decrement()&&(this[ny].removeHotspot(t),this[n_].delete(e.slot)),this[ny].queueRender())}};return AnnotationModelViewerElement})((e=>{var t,s,o;let SceneGraphModelViewerElement=class SceneGraphModelViewerElement extends e{constructor(){super(...arguments),this[t]=void 0,this[s]=null,this[o]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[rK]}get availableVariants(){return this.model?this.model[rP]():[]}get originalGltfJson(){return this[rq]}[(t=rK,s=rV,o=rq,rJ)](){return()=>{this[nw]()}}[rz](e){return e.colorSpace=eS.KI_,e.wrapS=eS.rpg,e.wrapT=eS.rpg,new Texture(this[rJ](),e)}async createTexture(e,t="image/png"){let{textureUtils:s}=this[nb],o=await s.loadImage(e);return o.userData.mimeType=t,this[rz](o)}async createLottieTexture(e,t=1){let{textureUtils:s}=this[nb],o=await s.loadLottie(e,t);return this[rz](o)}createVideoTexture(e){let t=document.createElement("video");t.crossOrigin=this.withCredentials?"use-credentials":"anonymous",t.src=e,t.muted=!0,t.playsInline=!0,t.loop=!0,t.play();let s=new eS.fO1(t);return this[rz](s)}createCanvasTexture(){let e=document.createElement("canvas"),t=new eS.ROQ(e);return this[rz](t)}async updated(e){if(super.updated(e),e.has("variantName")){let e=this[nS].beginActivity("variant-update");e(.1);let t=this[rK],{variantName:s}=this;null!=t&&(await t[r_](s),this[nw](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;let e=this[ny];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[nb].arRenderer.onUpdateScene(),this[nw]()}}[nQ](){super[nQ]();let{currentGLTF:e}=this[ny];if(null!=e){let{correlatedSceneGraph:t}=e;null!=t&&e!==this[rV]&&(this[rK]=new Model(t,this[rJ]()),this[rq]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[rV]=e}async exportScene(e){let t=this[ny];return new Promise(async(s,o)=>{let A={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(A,e),A.animations=t.animations,A.truncateDrawRange=!0;let l=t.shadow,h=!1;null!=l&&(h=l.visible,l.visible=!1),await this[rK][rF]();let c=new GLTFExporter().register(e=>new GLTFExporterMaterialsVariantsExtension(e));c.parse(t.model,e=>s(new Blob([A.binary?e:JSON.stringify(e)],{type:A.binary?"application/octet-stream":"application/json"})),()=>o("glTF export failed"),A),null!=l&&(l.visible=h)})}materialFromPoint(e,t){let s=this[rK];if(null==s)return null;let o=this[ny],A=o.getNDC(e,t),l=o.hitFromPoint(A);return null==l||null==l.face?null:s[rk](l)}};return scene_graph_decorate([n({type:String,attribute:"variant-name"})],SceneGraphModelViewerElement.prototype,"variantName",void 0),scene_graph_decorate([n({type:String,attribute:"orientation"})],SceneGraphModelViewerElement.prototype,"orientation",void 0),scene_graph_decorate([n({type:String,attribute:"scale"})],SceneGraphModelViewerElement.prototype,"scale",void 0),SceneGraphModelViewerElement})((e=>{var t,s,o;let StagingModelViewerElement=class StagingModelViewerElement extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[s]=0,this[o]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[aF]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[aU]),this[aF]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[aU]),this[aF]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[aF]=performance.now())}[(t=aF,s=a_,ak)](e){this[a_]=e[0]}[nv](e,t){if(super[nv](e,t),!this.autoRotate||!this[nM]()||this[nb].isPresenting)return;let s=Math.min(t,e-this[aF]-this.autoRotateDelay);s>0&&(this[ny].yaw=this.turntableRotation+this[a_]*s*.001)}get turntableRotation(){return this[ny].yaw}resetTurntableRotation(e=0){this[ny].yaw=e}};return o=aU,staging_decorate([n({type:Boolean,attribute:"auto-rotate"})],StagingModelViewerElement.prototype,"autoRotate",void 0),staging_decorate([n({type:Number,attribute:"auto-rotate-delay"})],StagingModelViewerElement.prototype,"autoRotateDelay",void 0),staging_decorate([style({intrinsics:aL,updateHandler:ak}),n({type:String,attribute:"rotation-per-second"})],StagingModelViewerElement.prototype,"rotationPerSecond",void 0),StagingModelViewerElement})((e=>{var t,s,o;let EnvironmentModelViewerElement=class EnvironmentModelViewerElement 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[t]=null,this[s]=null,this[o]=null}updated(e){super.updated(e),e.has("shadowIntensity")&&(this[ny].setShadowIntensity(.5*this.shadowIntensity),this[nw]()),e.has("shadowSoftness")&&(this[ny].setShadowSoftness(this.shadowSoftness),this[nw]()),e.has("exposure")&&(this[ny].exposure=this.exposure,this[nw]()),e.has("toneMapping")&&(this[ny].toneMapping="commerce"===this.toneMapping?eS.dZ3:"agx"===this.toneMapping?eS.Bgp:eS.LY2,this[nw]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[nR]()&&this[tI](),e.has("skyboxHeight")&&(this[ny].setGroundedSkybox(),this[nw]())}hasBakedShadow(){return this[ny].bakedShadows.size>0}async [(t=tp,s=tm,o=tf,tI)](){let{skyboxImage:e,environmentImage:t}=this;null!=this[tf]&&(this[tf](),this[tf]=null);let{textureUtils:s}=this[nb];if(null==s)return;let o=this[nS].beginActivity("environment-update");try{let{environmentMap:A,skybox:l}=await s.generateEnvironmentMapAndSkybox(deserializeUrl(e),t,e=>o(clamp(e,0,1)));this[tp]!==A&&(this[tp]=A,this.dispatchEvent(new CustomEvent("environment-change"))),null!=l?this[tm]=l.name===A.name?A:l:this[tm]=null,this[ny].setEnvironmentAndSkybox(this[tp],this[tm])}catch(e){if(e instanceof Error)throw this[ny].setEnvironmentAndSkybox(null,null),e}finally{o(1)}}};return __decorate([n({type:String,attribute:"environment-image"})],EnvironmentModelViewerElement.prototype,"environmentImage",void 0),__decorate([n({type:String,attribute:"skybox-image"})],EnvironmentModelViewerElement.prototype,"skyboxImage",void 0),__decorate([n({type:Number,attribute:"shadow-intensity"})],EnvironmentModelViewerElement.prototype,"shadowIntensity",void 0),__decorate([n({type:Number,attribute:"shadow-softness"})],EnvironmentModelViewerElement.prototype,"shadowSoftness",void 0),__decorate([n({type:Number})],EnvironmentModelViewerElement.prototype,"exposure",void 0),__decorate([n({type:String,attribute:"tone-mapping"})],EnvironmentModelViewerElement.prototype,"toneMapping",void 0),__decorate([n({type:String,attribute:"skybox-height"})],EnvironmentModelViewerElement.prototype,"skyboxHeight",void 0),EnvironmentModelViewerElement})((e=>{var t,s,o,A,l,h,c,d,g,p,m,I,f,E,C,B,y;let ControlsModelViewerElement=class ControlsModelViewerElement extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=iV,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=iJ.AUTO,this.interactionPromptStyle=iz.WIGGLE,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction="none",this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[s]=this.shadowRoot.querySelector("#prompt"),this[o]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[A]=this.shadowRoot.querySelector(".pan-target"),this[l]=0,this[h]=1/0,this[c]=!1,this[d]=!1,this[g]=sC.AUTOMATIC,this[p]=new SmoothControls(this[ny].camera,this[nC],this[ny]),this[m]=new eS.$V,this[I]=!1,this[f]=!1,this[E]=!1,this[C]=()=>{let e=this[iZ].changeSource;this[sr]=e,e===sC.USER_INTERACTION&&(this[st]=!0,this[i4]())},this[B]=()=>{this[i8](),this[nw]();let e=this[iZ].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[y]=e=>{this[nE].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[iZ].inputSensitivity}set inputSensitivity(e){this[iZ].inputSensitivity=e}getCameraOrbit(){let{theta:e,phi:t,radius:s}=this[sn];return{theta:e,phi:t,radius:s,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return toVector3D(this[nb].isPresenting?this[nb].arRenderer.target:this[ny].getTarget())}getFieldOfView(){return this[iZ].getFieldOfView()}getMinimumFieldOfView(){return this[iZ].options.minimumFieldOfView}getMaximumFieldOfView(){return this[iZ].options.maximumFieldOfView}getIdealAspect(){return this[ny].idealAspect}jumpCameraToGoal(){this[sa]=!0,this.requestUpdate(sa,!1)}resetInteractionPrompt(){this[ss]=0,this[si]=1/0,this[st]=!1,this[se]=this.interactionPrompt===iJ.AUTO&&this.cameraControls}zoom(e){let t=new WheelEvent("wheel",{deltaY:-30*e});this[nC].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[iZ].addEventListener("user-interaction",this[i6]),this[iZ].addEventListener("pointer-change-start",this[i7]),this[iZ].addEventListener("pointer-change-end",this[i7])}disconnectedCallback(){super.disconnectedCallback(),this[iZ].removeEventListener("user-interaction",this[i6]),this[iZ].removeEventListener("pointer-change-start",this[i7]),this[iZ].removeEventListener("pointer-change-end",this[i7])}updated(e){super.updated(e);let t=this[iZ],s=this[ny];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===iJ.AUTO&&(this[se]=!0)):(t.disableInteraction(),this[i4]()),this[nC].setAttribute("aria-label",this[nu])),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===iJ.AUTO&&this.cameraControls&&!this[st]?this[se]=!0:this[i4]()),e.has("interactionPromptStyle")&&(this[i2].style.opacity=this.interactionPromptStyle==iz.BASIC?"1":"0"),e.has("touchAction")){let 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),s.setTargetDamperDecayTime(this.interpolationDecay)),!0===this[sa]&&Promise.resolve().then(()=>{t.jumpToGoal(),s.jumpToGoal(),this[i9](),this[sa]=!1})}async updateFraming(){let e=this[ny],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();let s=e.adjustedFoV(e.framedFoVDeg),o=this[iZ].getFieldOfView()/t;this[iZ].setFieldOfView(s*o),this[sA]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,s){let o=this[nC],A=this[i3];if("1"===A[0].style.opacity){console.warn("interact() failed because an existing interaction is running.");return}let l=[];l.push({x:timeline(t.x),y:timeline(t.y)});let h=[{x:l[0].x(0),y:l[0].y(0)}];null!=s&&(l.push({x:timeline(s.x),y:timeline(s.y)}),h.push({x:l[1].x(0),y:l[1].y(0)}));let c=performance.now(),{width:d,height:g}=this[ny],p=this.getBoundingClientRect(),dispatchTouches=e=>{for(let[t,s]of h.entries()){let{style:l}=A[t];l.transform=`translateX(${d*s.x}px) translateY(${g*s.y}px)`,"pointerdown"===e?l.opacity="1":"pointerup"===e&&(l.opacity="0");let h={pointerId:t-5678,pointerType:"touch",target:o,clientX:d*s.x+p.x,clientY:g*s.y+p.y,altKey:!0};o.dispatchEvent(new PointerEvent(e,h))}},moveTouches=()=>{let t=this[sr];if(t!==sC.AUTOMATIC||!o.isConnected){for(let e of this[i3])e.style.opacity="0";dispatchTouches("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),document.removeEventListener("visibilitychange",onVisibilityChange);return}let s=Math.min(1,(performance.now()-c)/e);for(let[e,t]of h.entries())t.x=l[e].x(s),t.y=l[e].y(s);dispatchTouches("pointermove"),s<1?requestAnimationFrame(moveTouches):(dispatchTouches("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:sC.AUTOMATIC}})),document.removeEventListener("visibilitychange",onVisibilityChange))},onVisibilityChange=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-c:c=performance.now()-e};document.addEventListener("visibilitychange",onVisibilityChange),dispatchTouches("pointerdown"),this[sr]=sC.AUTOMATIC,requestAnimationFrame(moveTouches)}[(t=i1,s=i2,o=i3,A=i0,l=ss,h=si,c=st,d=se,g=sr,p=iZ,m=sn,I=sa,f=so,E=sA,sh)](e){let t=this[iZ],s=this[ny];s.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=sC.NONE,t.setFieldOfView(s.adjustedFoV(s.framedFoVDeg)),this[i6]()}[sl](e){let t=this[iZ];if(this[sA]){let{theta:t,phi:s}=this.getCameraOrbit();e[0]=t,e[1]=s,this[sA]=!1}t.changeSource=sC.NONE,t.setOrbit(e[0],e[1],e[2]),this[i6]()}[su](e){this[iZ].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[sd](e){this[iZ].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[i5](e[2]),this.jumpCameraToGoal()}[sg](e){this[iZ].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[sp](e){let t=this[ny].adjustedFoV(180*e[0]/Math.PI);this[iZ].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[sc](e){let[t,s,o]=e;this[nb].arRenderer.isPresenting||this[ny].setTarget(t,s,o),this[iZ].changeSource=sC.NONE,this[nb].arRenderer.updateTarget(),this[i6]()}[nv](e,t){if(super[nv](e,t),this[nb].isPresenting||!this[nM]())return;let s=this[iZ],o=this[ny],A=performance.now();if(this[se]&&this.loaded&&A>this[nm]+this.interactionPromptThreshold&&(this[se]=!1,this[si]=A,this[i1].classList.add("visible")),isFinite(this[si])&&this.interactionPromptStyle===iz.WIGGLE){let e=(A-this[si])/5e3%1,t=iO(e),l=iH(e);if(this[i2].style.opacity=`${l}`,t!==this[ss]){let e=t*o.width*.05,A=(t-this[ss])*Math.PI/16;this[i2].style.transform=`translateX(${e}px)`,s.changeSource=sC.AUTOMATIC,s.adjustOrbit(A,0,0),this[ss]=t}}let l=s.update(e,t),h=o.updateTarget(t);(l||h)&&this[i9]()}[i4](){this[se]=!1,this[i1].classList.remove("visible"),this[si]=1/0}[i5](e){let t=Math.max(this[ny].farRadius(),e);this[iZ].updateNearFar(0,Math.abs(2*t))}[i8](){let{theta:e,phi:t}=this[iZ].getCameraSpherical(this[sn]),s=iq[(4+Math.floor((e%iX+i$)/ij))%4],o=iK[Math.floor(t/iW)];this[np](`View from stage ${o}${s}`)}get[nu](){return super[nu].replace(/\.$/,"")+(this.cameraControls?". Use mouse, touch or arrow keys to move.":"")}async [nx](e){let t=this[iZ],s=this[ny],o=s.adjustedFoV(s.framedFoVDeg);super[nx](e);let A=s.adjustedFoV(s.framedFoVDeg)/o,l=t.getFieldOfView()*(isFinite(A)?A:1);t.updateAspect(this[ny].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[iZ].setFieldOfView(l),this.jumpCameraToGoal()}[nQ](){super[nQ](),this[so]?this[sA]=!0:this[so]=!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()}};return C=i6,B=i9,y=i7,controls_decorate([n({type:Boolean,attribute:"camera-controls"})],ControlsModelViewerElement.prototype,"cameraControls",void 0),controls_decorate([style({intrinsics:iY,observeEffects:!0,updateHandler:sl}),n({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraOrbit",void 0),controls_decorate([style({intrinsics:cameraTargetIntrinsics,observeEffects:!0,updateHandler:sc}),n({type:String,attribute:"camera-target",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraTarget",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,observeEffects:!0,updateHandler:sh}),n({type:String,attribute:"field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"fieldOfView",void 0),controls_decorate([style({intrinsics:minCameraOrbitIntrinsics,updateHandler:su}),n({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minCameraOrbit",void 0),controls_decorate([style({intrinsics:maxCameraOrbitIntrinsics,updateHandler:sd}),n({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxCameraOrbit",void 0),controls_decorate([style({intrinsics:minFieldOfViewIntrinsics,updateHandler:sg}),n({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minFieldOfView",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,updateHandler:sp}),n({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxFieldOfView",void 0),controls_decorate([n({type:Number,attribute:"interaction-prompt-threshold"})],ControlsModelViewerElement.prototype,"interactionPromptThreshold",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt"})],ControlsModelViewerElement.prototype,"interactionPrompt",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt-style"})],ControlsModelViewerElement.prototype,"interactionPromptStyle",void 0),controls_decorate([n({type:Number,attribute:"orbit-sensitivity"})],ControlsModelViewerElement.prototype,"orbitSensitivity",void 0),controls_decorate([n({type:Number,attribute:"zoom-sensitivity"})],ControlsModelViewerElement.prototype,"zoomSensitivity",void 0),controls_decorate([n({type:Number,attribute:"pan-sensitivity"})],ControlsModelViewerElement.prototype,"panSensitivity",void 0),controls_decorate([n({type:String,attribute:"touch-action"})],ControlsModelViewerElement.prototype,"touchAction",void 0),controls_decorate([n({type:Boolean,attribute:"disable-zoom"})],ControlsModelViewerElement.prototype,"disableZoom",void 0),controls_decorate([n({type:Boolean,attribute:"disable-pan"})],ControlsModelViewerElement.prototype,"disablePan",void 0),controls_decorate([n({type:Boolean,attribute:"disable-tap"})],ControlsModelViewerElement.prototype,"disableTap",void 0),controls_decorate([n({type:Number,attribute:"interpolation-decay"})],ControlsModelViewerElement.prototype,"interpolationDecay",void 0),ControlsModelViewerElement})((e=>{var t,s,o,A,l,h,c,d,g,p;let ARModelViewerElement=class ARModelViewerElement extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[t]=!1,this[s]=this.shadowRoot.querySelector(".ar-button"),this[o]=document.createElement("a"),this[A]=new Set,this[l]=aa.NONE,this[h]=!1,this[c]=e=>{e.preventDefault(),this.activateAR()},this[d]=({status:e})=>{(e===sB.NOT_PRESENTING||this[nb].arRenderer.presentedScene===this[ny])&&(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===sB.NOT_PRESENTING?this.removeAttribute("ar-tracking"):e===sB.SESSION_STARTED&&this.setAttribute("ar-tracking",sy.TRACKING))},this[g]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[p]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[au]!==aa.NONE}connectedCallback(){super.connectedCallback(),this[nb].arRenderer.addEventListener("status",this[aI]),this.setAttribute("ar-status",sB.NOT_PRESENTING),this[nb].arRenderer.addEventListener("tracking",this[af]),this[ag].addEventListener("message",this[aE])}disconnectedCallback(){super.disconnectedCallback(),this[nb].arRenderer.removeEventListener("status",this[aI]),this[nb].arRenderer.removeEventListener("tracking",this[af]),this[ag].removeEventListener("message",this[aE])}update(e){super.update(e),e.has("arScale")&&(this[ny].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[ny].updateShadow(),this[nw]()),e.has("arModes")&&(this[ad]=an(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc"))&&this[aC]()}async activateAR(){switch(this[au]){case aa.QUICK_LOOK:await this[ah]();break;case aa.WEBXR:await this[aA]();break;case aa.SCENE_VIEWER:this[al]();break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async [(t=ac,s=ao,o=ag,A=ad,l=au,h=ap,c=am,d=aI,g=af,p=aE,aC)](){let e=aa.NONE;if(this.ar){if(null!=this.src)for(let t of this[ad]){if("webxr"===t&&ts&&!ai&&await this[nb].arRenderer.supportsPresentation()){e=aa.WEBXR;break}if("scene-viewer"===t&&th&&!as){e=aa.SCENE_VIEWER;break}if("quick-look"===t&&tu){e=aa.QUICK_LOOK;break}}e===aa.NONE&&null!=this.iosSrc&&tu&&(e=aa.QUICK_LOOK)}if(e!==aa.NONE)this[ao].classList.add("enabled"),this[ao].addEventListener("click",this[am]);else if(this[ao].classList.contains("enabled")){this[ao].removeEventListener("click",this[am]),this[ao].classList.remove("enabled");let e=sB.FAILED;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[au]=e}async [aA](){console.log("Attempting to present in AR with WebXR..."),await this[aB]();try{this[ao].removeEventListener("click",this[am]);let{arRenderer:e}=this[nb];e.placeOnWall="wall"===this.arPlacement,await e.present(this[ny],this.xrEnvironment)}catch(e){console.warn("Error while trying to present in AR with WebXR"),console.error(e),await this[nb].arRenderer.stopPresenting(),ai=!0,console.warn("Falling back to next ar-mode"),await this[aC](),this.activateAR()}finally{this[aC]()}}async [aB](){this.loaded||(this[ap]=!0,this[nI](),await waitForEvent(this,"load"),this[ap]=!1)}[nR](){return super[nR]()||this[ap]}[al](){let e=self.location.toString(),t=new URL(e),s=new URL(this.src,e);s.hash&&(s.hash="");let o=new URLSearchParams(s.search);if(t.hash=ar,o.set("mode","ar_preferred"),o.has("disable_occlusion")||o.set("disable_occlusion","true"),"fixed"===this.arScale&&o.set("resizable","false"),"wall"===this.arPlacement&&o.set("enable_vertical_placement","true"),o.has("sound")){let t=new URL(o.get("sound"),e);o.set("sound",t.toString())}if(o.has("link")){let t=new URL(o.get("link"),e);o.set("link",t.toString())}let A=`intent://arvr.google.com/scene-viewer/1.0?${o.toString()+"&file="+encodeURIComponent(s.toString())}#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(t.toString())};end;`;self.addEventListener("hashchange",()=>{self.location.hash===ar&&(as=!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[aC]())},{once:!0}),this[ag].setAttribute("href",A),console.log("Attempting to present in AR with Scene Viewer..."),this[ag].click()}async [ah](){let e=!this.iosSrc;this[ao].classList.remove("enabled");let t=e?await this.prepareUSDZ():this.iosSrc,s=new URL(t,self.location.toString());if(e){let e=self.location.toString(),t=new URL(e),o=new URL(this.src,t);o.hash&&(s.hash=o.hash)}"fixed"===this.arScale&&(s.hash&&(s.hash+="&"),s.hash+="allowsContentScaling=0");let o=this[ag];o.setAttribute("rel","ar");let A=document.createElement("img");o.appendChild(A),o.setAttribute("href",s.toString()),e&&o.setAttribute("download","model.usdz"),o.style.display="none",o.isConnected||this.shadowRoot.appendChild(o),console.log("Attempting to present in AR with Quick Look..."),o.click(),o.removeChild(A),e&&URL.revokeObjectURL(t),this[ao].classList.add("enabled")}async prepareUSDZ(){let e=this[nS].beginActivity("usdz-conversion");await this[aB]();let{model:t,shadow:s}=this[ny];if(null==t)return"";let o=!1;null!=s&&(o=s.visible,s.visible=!1),e(.2);let A=new USDZExporter,l=await A.parse(t),h=new Blob([l],{type:"model/vnd.usdz+zip"}),c=URL.createObjectURL(h);return e(1),null!=s&&(s.visible=o),c}};return ar_decorate([n({type:Boolean,attribute:"ar"})],ARModelViewerElement.prototype,"ar",void 0),ar_decorate([n({type:String,attribute:"ar-scale"})],ARModelViewerElement.prototype,"arScale",void 0),ar_decorate([n({type:String,attribute:"ar-placement"})],ARModelViewerElement.prototype,"arPlacement",void 0),ar_decorate([n({type:String,attribute:"ar-modes"})],ARModelViewerElement.prototype,"arModes",void 0),ar_decorate([n({type:String,attribute:"ios-src"})],ARModelViewerElement.prototype,"iosSrc",void 0),ar_decorate([n({type:Boolean,attribute:"xr-environment"})],ARModelViewerElement.prototype,"xrEnvironment",void 0),ARModelViewerElement})((e=>{var t,s,o,A,l,h,c,d;let LoadingModelViewerElement=class LoadingModelViewerElement extends e{constructor(...e){super(...e),this.poster=null,this.reveal=ay.AUTO,this.loading=aw.AUTO,this[t]=!1,this[s]=!1,this[o]=this.shadowRoot.querySelector(".slot.poster"),this[A]=this.shadowRoot.querySelector("#default-poster"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[h]=this[ax].getAttribute("aria-label"),this[c]=throttle(e=>{let t=this[av].parentNode;requestAnimationFrame(()=>{this[av].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[av]),t.appendChild(this[av])),this[av].classList.toggle("hide",1===e)})},100),this[d]=e=>{let t=e.detail.totalProgress;1===t&&(this[aM].flush(),this.loaded&&(this[ab]||this.reveal===ay.AUTO)&&this[aS]()),this[aM](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t}}))};let g=self.ModelViewerElement||{},p=g.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";CachingGLTFLoader.setDRACODecoderLocation(p);let m=g.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";CachingGLTFLoader.setKTX2TranscoderLocation(m),g.meshoptDecoderLocation&&CachingGLTFLoader.setMeshoptDecoderLocation(g.meshoptDecoderLocation);let I=g.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";Renderer.singleton.textureUtils.lottieLoaderUrl=I}static set dracoDecoderLocation(e){CachingGLTFLoader.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return CachingGLTFLoader.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){CachingGLTFLoader.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return CachingGLTFLoader.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){CachingGLTFLoader.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return CachingGLTFLoader.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){Renderer.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return Renderer.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){Renderer.singleton.loader[t3].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[aS]():(this[ab]=!0,this[nI]())}showPoster(){let e=this[aQ];if(e.classList.contains("show"))return;e.classList.add("show"),this[nC].classList.remove("show");let t=this[ax];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");let s=this.modelIsVisible;this[aT]=!1,this[nc](s)}getDimensions(){return toVector3D(this[ny].size)}getBoundingBoxCenter(){return toVector3D(this[ny].boundingBox.getCenter(new eS.Pa4))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[nS].addEventListener("progress",this[aD])}disconnectedCallback(){super.disconnectedCallback(),this[nS].removeEventListener("progress",this[aD])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[ax].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[ax].setAttribute("aria-label",this[nd]),(e.has("reveal")||e.has("loading"))&&this[nI]()}[(t=aT,s=ab,o=aQ,A=ax,l=av,h=aR,c=aM,d=aD,nR)](){return!!this.src&&(this[ab]||this.loading===aw.EAGER||this.reveal===ay.AUTO&&this[nh])}[aS](){this[ab]=!1;let e=this[aQ];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[nC].classList.add("show");let t=this.modelIsVisible;this[aT]=!0,this[nc](t);let s=this.getRootNode();s&&s.activeElement===this&&this[nC].focus();let o=this[ax];o.setAttribute("aria-hidden","true"),o.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[nM](){return super[nM]()&&this[aT]}};return loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"poster",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"reveal",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"loading",void 0),LoadingModelViewerElement})((e=>{var t;let AnimationModelViewerElement=class AnimationModelViewerElement extends e{constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0,this[ny].subscribeMixerEvent("loop",e=>{let t=e.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:t}}))}),this[ny].subscribeMixerEvent("finished",()=>{this[nL]=!0,this.dispatchEvent(new CustomEvent("finished"))})}get availableAnimations(){return this.loaded?this[ny].animationNames:[]}get duration(){return this[ny].duration}get paused(){return this[nL]}get currentTime(){return this[ny].animationTime}set currentTime(e){this[ny].animationTime=e,this[nw]()}get timeScale(){return this[ny].animationTimeScale}set timeScale(e){this[ny].animationTimeScale=e}pause(){this[nL]||(this[nL]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[nL]=!1,this[nD](e),this.dispatchEvent(new CustomEvent("play")))}[(t=nL,nQ)](){super[nQ](),this[nL]=!0,null!=this.animationName&&this[nD](),this.autoplay&&this.play()}[nv](e,t){super[nv](e,t),!this[nL]&&(this[nM]()||this[nb].isPresenting)&&(this[ny].updateAnimation(t/1e3),this[nw]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[nD]()}[nD](e=nF){var t;let s=null!==(t=e.repetitions)&&void 0!==t?t:1/0,o=e.pingpong?eS.uEv:1===s?eS.jAl:eS.YKA;this[ny].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,o,s),this[nL]&&(this[ny].updateAnimation(0),this[nw]())}};return animation_decorate([n({type:Boolean})],AnimationModelViewerElement.prototype,"autoplay",void 0),animation_decorate([n({type:String,attribute:"animation-name"})],AnimationModelViewerElement.prototype,"animationName",void 0),animation_decorate([n({type:Number,attribute:"animation-crossfade-duration"})],AnimationModelViewerElement.prototype,"animationCrossfadeDuration",void 0),AnimationModelViewerElement})(ModelViewerElementBase))))))));customElements.define("model-viewer",aG)}}]);
|
|
//# sourceMappingURL=848.fc0fe21cdc2e6431.js.map
|