1093 lines
913 KiB
JavaScript
1093 lines
913 KiB
JavaScript
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Copyright 2017 Google LLC
|
||
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
*/
|
||
|
|
const t=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};function e(e){return(i,n)=>void 0!==n?((t,e,i)=>{e.constructor.createProperty(i,t)})(e,i,n):t(e,i)
|
||
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Copyright 2021 Google LLC
|
||
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
*/}var i;null===(i=window.HTMLSlotElement)||void 0===i||i.prototype.assignedElements;
|
||
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Copyright 2010-2023 Three.js Authors
|
||
|
|
* SPDX-License-Identifier: MIT
|
||
|
|
*/
|
||
|
|
const n="163",r=1,s=2,a=3,o=0,l=1,c=2,h=100,u=101,d=102,A=200,p=201,m=202,g=203,f=204,v=205,_=206,y=207,E=208,x=209,S=210,C=211,I=212,M=213,w=214,b=0,T=1,B=2,R=0,D=1,L=2,U=3,P=4,N=5,F=6,Q=7,O="attached",k=300,G=301,H=302,z=303,V=306,W=1e3,q=1001,X=1002,j=1003,Y=1004,K=1005,J=1006,$=1007,Z=1008,tt=1009,et=1013,it=1014,nt=1015,rt=1016,st=1020,at=1023,ot=1026,lt=1027,ct=1028,ht=1030,ut=33776,dt=33777,At=33778,pt=33779,mt=35840,gt=35842,ft=36196,vt=37492,_t=37496,yt=37808,Et=37812,xt=36492,St=2201,Ct=2202,It=2300,Mt=2301,wt=2302,bt=2400,Tt=2401,Bt=2402,Rt=2500,Dt="",Lt="srgb",Ut="srgb-linear",Pt="display-p3",Nt="display-p3-linear",Ft="linear",Qt="srgb",Ot="rec709",kt="p3",Gt=7680,Ht=512,zt=513,Vt=514,Wt=515,qt=516,Xt=517,jt=518,Yt=519,Kt=35044,Jt="300 es",$t=2e3,Zt=2001;class te{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t);t.target=null}}}const ee=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let ie=1234567;const ne=Math.PI/180,re=180/Math.PI;function se(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(ee[255&t]+ee[t>>8&255]+ee[t>>16&255]+ee[t>>24&255]+"-"+ee[255&e]+ee[e>>8&255]+"-"+ee[e>>16&15|64]+ee[e>>24&255]+"-"+ee[63&i|128]+ee[i>>8&255]+"-"+ee[i>>16&255]+ee[i>>24&255]+ee[255&n]+ee[n>>8&255]+ee[n>>16&255]+ee[n>>24&255]).toLowerCase()}function ae(t,e,i){return Math.max(e,Math.min(i,t))}function oe(t,e){return(t%e+e)%e}function le(t,e,i){return(1-i)*t+i*e}function ce(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function he(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const ue={DEG2RAD:ne,RAD2DEG:re,generateUUID:se,clamp:ae,euclideanModulo:oe,mapLinear:function(t,e,i,n,r){r
|
||
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Copyright 2019 Google LLC
|
||
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
*/;const dc=window,Ac=dc.ShadowRoot&&(void 0===dc.ShadyCSS||dc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,pc=Symbol(),mc=new WeakMap;class gc{constructor(t,e,i){if(this._$cssResult$=!0,i!==pc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(Ac&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=mc.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&mc.set(e,t))}return t}toString(){return this.cssText}}const fc=Ac?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new gc("string"==typeof t?t:t+"",void 0,pc))(e)})(t):t
|
||
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Copyright 2017 Google LLC
|
||
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
*/;var vc;const _c=window,yc=_c.trustedTypes,Ec=yc?yc.emptyScript:"",xc=_c.reactiveElementPolyfillSupport,Sc={toAttribute(t,e){switch(e){case Boolean:t=t?Ec:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},Cc=(t,e)=>e!==t&&(e==e||t==t),Ic={attribute:!0,type:String,converter:Sc,reflect:!1,hasChanged:Cc},Mc="finalized";class wc extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=Ic){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||Ic}static finalize(){if(this.hasOwnProperty(Mc))return!1;this[Mc]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(fc(t))}else void 0!==t&&e.push(fc(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{Ac?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),n=dc.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=Ic){var n;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const s=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:Sc).toAttribute(e,i.type);this._$El=t,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,r=n._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=n.getPropertyOptions(r),s="function"==typeof t.converter
|
||
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Copyright 2017 Google LLC
|
||
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
*/
|
||
|
|
var bc;wc[Mc]=!0,wc.elementProperties=new Map,wc.elementStyles=[],wc.shadowRootOptions={mode:"open"},null==xc||xc({ReactiveElement:wc}),(null!==(vc=_c.reactiveElementVersions)&&void 0!==vc?vc:_c.reactiveElementVersions=[]).push("1.6.3");const Tc=window,Bc=Tc.trustedTypes,Rc=Bc?Bc.createPolicy("lit-html",{createHTML:t=>t}):void 0,Dc="$lit$",Lc=`lit$${(Math.random()+"").slice(9)}$`,Uc="?"+Lc,Pc=`<${Uc}>`,Nc=document,Fc=()=>Nc.createComment(""),Qc=t=>null===t||"object"!=typeof t&&"function"!=typeof t,Oc=Array.isArray,kc="[ \t\n\f\r]",Gc=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hc=/-->/g,zc=/>/g,Vc=RegExp(`>|${kc}(?:([^\\s"'>=/]+)(${kc}*=${kc}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Wc=/'/g,qc=/"/g,Xc=/^(?:script|style|textarea|title)$/i,jc=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),Yc=Symbol.for("lit-noChange"),Kc=Symbol.for("lit-nothing"),Jc=new WeakMap,$c=Nc.createTreeWalker(Nc,129,null,!1);function Zc(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Rc?Rc.createHTML(e):e}const th=(t,e)=>{const i=t.length-1,n=[];let r,s=2===e?"<svg>":"",a=Gc;for(let e=0;e<i;e++){const i=t[e];let o,l,c=-1,h=0;for(;h<i.length&&(a.lastIndex=h,l=a.exec(i),null!==l);)h=a.lastIndex,a===Gc?"!--"===l[1]?a=Hc:void 0!==l[1]?a=zc:void 0!==l[2]?(Xc.test(l[2])&&(r=RegExp("</"+l[2],"g")),a=Vc):void 0!==l[3]&&(a=Vc):a===Vc?">"===l[0]?(a=null!=r?r:Gc,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?Vc:'"'===l[3]?qc:Wc):a===qc||a===Wc?a=Vc:a===Hc||a===zc?a=Gc:(a=Vc,r=void 0);const u=a===Vc&&t[e+1].startsWith("/>")?" ":"";s+=a===Gc?i+Pc:c>=0?(n.push(o),i.slice(0,c)+Dc+i.slice(c)+Lc+u):i+Lc+(-2===c?(n.push(void 0),e):u)}return[Zc(t,s+(t[i]||"<?>")+(2===e?"</svg>":"")),n]};class eh{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,s=0;const a=t.length-1,o=this.parts,[l,c]=th(t,e);if(this.el=eh.createElement(l,i),$c.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=$c.nextNode())&&o.length<a;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const e of n.getAttributeNames())if(e.endsWith(Dc)||e.startsWith(Lc)){const i=c[s++];if(t.push(e),void 0!==i){const t=n.getAttribute(i.toLowerCase()+Dc).split(Lc),e=/([.?@])?(.*)/.exec(i);o.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?ah:"?"===e[1]?lh:"@"===e[1]?ch:sh})}else o.push({type:6,index:r})}for(const e of t)n.removeAttribute(e)}if(Xc.test(n.tagName)){const t=n.textContent.split(Lc),e=t.length-1;if(e>0){n.textContent=Bc?Bc.emptyScript:"";for(let i=0;i<e;i++)n.append(t[i],Fc()),$c.nextNode(),o.push({type:2,index:++r});n.append(t[e],Fc())}}}else if(8===n.nodeType)if(n.data===Uc)o.push({type:2,index:r});else{let t=-1;for(;-1!==(t=n.data.indexOf(Lc,t+1));)o.push({type:7,index:r}),t+=Lc.length-1}r++}}static createElement(t,e){const i=Nc.createElement("template");return i.innerHTML=t,i}}function ih(t,e,i=t,n){var r,s,a,o;if(e===Yc)return e;let l=void 0!==n?null===(r=i._$Co)||void 0===r?void 0:r[n]:i._$Cl;const c=Qc(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==c&&(null===(s=null==l?void 0:l._$AO)||void 0===s||s.call(l,!1),void 0===c?l=void 0:(l=new c(t),l._$AT(t,i,n)),void 0!==n?(null!==(a=(o=i)._$Co)&&void 0!==a?a:o._$Co=[])[n]=l:i._$Cl=l),void 0!==l&&(e=ih(t,l._$AS(t,e.values),l,n)),e}class nh{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var e;const{el:{content:i},parts:n}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:Nc).importNode(i,!0);$c.currentNode=r;let s=$c.nextNode(),a=0,o=0,l=n[0];for(;void 0!==l;){if(a===l.index){let e;2===l.type?e=new rh(s,s.nextSibling,this,t):1===l.type?e=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(e=new hh(s,this,t)),this._$AV.push(e),l=n[++o]}a!==(null==l?void 0:l.index)&&(s=$c.nextNode(),a++)}return $c.currentNode=Nc,r}v(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),
|
||
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Copyright 2019 Google LLC
|
||
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
*/},Ah=window,ph=Ah.ShadowRoot&&(void 0===Ah.ShadyCSS||Ah.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,mh=Symbol(),gh=new WeakMap;class fh{constructor(t,e,i){if(this._$cssResult$=!0,i!==mh)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(ph&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=gh.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&gh.set(e,t))}return t}toString(){return this.cssText}}const vh=ph?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new fh("string"==typeof t?t:t+"",void 0,mh))(e)})(t):t
|
||
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Copyright 2017 Google LLC
|
||
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
*/;var _h;const yh=window,Eh=yh.trustedTypes,xh=Eh?Eh.emptyScript:"",Sh=yh.reactiveElementPolyfillSupport,Ch={toAttribute(t,e){switch(e){case Boolean:t=t?xh:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},Ih=(t,e)=>e!==t&&(e==e||t==t),Mh={attribute:!0,type:String,converter:Ch,reflect:!1,hasChanged:Ih},wh="finalized";class bh extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=Mh){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||Mh}static finalize(){if(this.hasOwnProperty(wh))return!1;this[wh]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(vh(t))}else void 0!==t&&e.push(vh(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{ph?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),n=Ah.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=Mh){var n;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const s=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:Ch).toAttribute(e,i.type);this._$El=t,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,r=n._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=n.getPropertyOptions(r),s="function"==typeof t.converter
|
||
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Copyright 2017 Google LLC
|
||
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
*/
|
||
|
|
var Th,Bh;bh[wh]=!0,bh.elementProperties=new Map,bh.elementStyles=[],bh.shadowRootOptions={mode:"open"},null==Sh||Sh({ReactiveElement:bh}),(null!==(_h=yh.reactiveElementVersions)&&void 0!==_h?_h:yh.reactiveElementVersions=[]).push("1.6.3");class Rh extends bh{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=dh(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return Yc}}Rh.finalized=!0,Rh._$litElement$=!0,null===(Th=globalThis.litElementHydrateSupport)||void 0===Th||Th.call(globalThis,{LitElement:Rh});const Dh=globalThis.litElementPolyfillSupport;null==Dh||Dh({LitElement:Rh}),(null!==(Bh=globalThis.litElementVersions)&&void 0!==Bh?Bh: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.
|
||
|
|
*/
|
||
|
|
const Lh=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,Uh=Lh&&null!=self.XRSession.prototype.requestHitTestSource,Ph=null!=self.ResizeObserver,Nh=null!=self.IntersectionObserver,Fh=Uh;(()=>{const t=navigator.userAgent||navigator.vendor||self.opera;let e=!1;(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/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(t.substr(0,4)))&&(e=!0)})(),/\bCrOS\b/.test(navigator.userAgent);const Qh=/android/i.test(navigator.userAgent),Oh=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1;/Safari\//.test(navigator.userAgent);const kh=/firefox/i.test(navigator.userAgent),Gh=/OculusBrowser/.test(navigator.userAgent);Oh&&/CriOS\//.test(navigator.userAgent);const Hh=Qh&&!kh&&!Gh,zh=Boolean(window.webkit&&window.webkit.messageHandlers),Vh=(()=>{if(Oh){if(zh)return Boolean(/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent));{const t=document.createElement("a");return Boolean(t.relList&&t.relList.supports&&t.relList.supports("ar"))}}return!1})(),Wh=t=>t&&"null"!==t?Xh(t):null,qh=()=>{if(Fh)return;const t=[];throw Lh||t.push("WebXR Device API"),Uh||t.push("WebXR Hit Test API"),new Error(`The following APIs are required for AR, but are missing in this browser: ${t.join(", ")}`)},Xh=t=>new URL(t,window.location.toString()).toString(),jh=(t,e)=>{let i=null;return(...n)=>{null!=i&&self.clearTimeout(i),i=self.setTimeout((()=>{i=null,t(...n)}),e)}},Yh=(t,e,i)=>Math.max(e,Math.min(i,t)),Kh=(()=>{const t=(()=>{var t;if(null===(t=document.documentElement.getAttribute("itemtype"))||void 0===t?void 0:t.includes("schema.org/SearchResultsPage"))return!0;if(window.self!==window.top)return!0;const e=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[];for(const t of e)if("viewport"===t.name)return!0;return!1})();return t||console.warn('No <meta name="viewport"> detected; <model-viewer> will cap pixel density at 1.'),()=>t?window.devicePixelRatio:1})(),Jh=(()=>{const t=new RegExp("[?&]model-viewer-debug-mode(&|$)");return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(t)})();
|
||
|
|
/* @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 $h=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const Zh=Symbol("currentEnvironmentMap"),tu=Symbol("currentBackground"),eu=Symbol("updateEnvironment"),iu=Symbol("cancelEnvironmentUpdate");
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/
|
||
|
|
const nu=jc`
|
||
|
|
<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">
|
||
|
|
${jc`
|
||
|
|
<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon"
|
||
|
|
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px"
|
||
|
|
viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
|
||
|
|
<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/>
|
||
|
|
<g id="Art_layer">
|
||
|
|
<path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/>
|
||
|
|
<path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/>
|
||
|
|
<path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/>
|
||
|
|
<path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/>
|
||
|
|
<g>
|
||
|
|
<path d="M18.25,7.6l-5.5-3.18c-0.46-0.27-1.04-0.27-1.5,0L5.75,7.6C5.29,7.87,5,8.36,5,8.9v6.35c0,0.54,0.29,1.03,0.75,1.3
|
||
|
|
l5.5,3.18c0.46,0.27,1.04,0.27,1.5,0l5.5-3.18c0.46-0.27,0.75-0.76,0.75-1.3V8.9C19,8.36,18.71,7.87,18.25,7.6z M7,14.96v-4.62
|
||
|
|
l4,2.32v4.61L7,14.96z M12,10.93L8,8.61l4-2.31l4,2.31L12,10.93z M13,17.27v-4.61l4-2.32v4.62L13,17.27z"/>
|
||
|
|
</g>
|
||
|
|
</g>
|
||
|
|
</svg>`}
|
||
|
|
</a>
|
||
|
|
</slot>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="slot pan-target">
|
||
|
|
<slot name="pan-target">
|
||
|
|
<div id="default-pan-target">
|
||
|
|
</div>
|
||
|
|
</slot>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="slot interaction-prompt cover centered">
|
||
|
|
<div id="prompt" class="animated-container">
|
||
|
|
<slot name="interaction-prompt" aria-hidden="true">
|
||
|
|
${jc`
|
||
|
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36">
|
||
|
|
<defs>
|
||
|
|
<path id="A" d="M.001.232h24.997V36H.001z" />
|
||
|
|
</defs>
|
||
|
|
<g transform="translate(-11 -4)" fill="none" fill-rule="evenodd">
|
||
|
|
<path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" />
|
||
|
|
<g transform="translate(11 3)">
|
||
|
|
<path d="M8.733 11.165c.04-1.108.766-2.027 1.743-2.307a2.54 2.54 0 0 1 .628-.089c.16 0 .314.017.463.044 1.088.2 1.9 1.092 1.9 2.16v8.88h1.26c2.943-1.39 5-4.45 5-8.025a9.01 9.01 0 0 0-1.9-5.56l-.43-.5c-.765-.838-1.683-1.522-2.712-2-1.057-.49-2.226-.77-3.46-.77s-2.4.278-3.46.77c-1.03.478-1.947 1.162-2.71 2l-.43.5a9.01 9.01 0 0 0-1.9 5.56 9.04 9.04 0 0 0 .094 1.305c.03.21.088.41.13.617l.136.624c.083.286.196.56.305.832l.124.333a8.78 8.78 0 0 0 .509.953l.065.122a8.69 8.69 0 0 0 3.521 3.191l1.11.537v-9.178z" fill-opacity=".5" fill="#e4e4e4" />
|
||
|
|
<path d="M22.94 26.218l-2.76 7.74c-.172.485-.676.8-1.253.8H12.24c-1.606 0-3.092-.68-3.98-1.82-1.592-2.048-3.647-3.822-6.11-5.27-.095-.055-.15-.137-.152-.23-.004-.1.046-.196.193-.297.56-.393 1.234-.6 1.926-.6a3.43 3.43 0 0 1 .691.069l4.922.994V10.972c0-.663.615-1.203 1.37-1.203s1.373.54 1.373 1.203v9.882h2.953c.273 0 .533.073.757.21l6.257 3.874c.027.017.045.042.07.06.41.296.586.77.426 1.22M4.1 16.614c-.024-.04-.042-.083-.065-.122a8.69 8.69 0 0 1-.509-.953c-.048-.107-.08-.223-.124-.333l-.305-.832c-.058-.202-.09-.416-.136-.624l-.13-.617a9.03 9.03 0 0 1-.094-1.305c0-2.107.714-4.04 1.9-5.56l.43-.5c.764-.84 1.682-1.523 2.71-2 1.058-.49 2.226-.77 3.46-.77s2.402.28 3.46.77c1.03.477 1.947 1.16 2.712 2l.428.5a9 9 0 0 1 1.901 5.559c0 3.577-2.056 6.636-5 8.026h-1.26v-8.882c0-1.067-.822-1.96-1.9-2.16-.15-.028-.304-.044-.463-.044-.22 0-.427.037-.628.09-.977.28-1.703 1.198-1.743 2.306v9.178l-1.11-.537C6.18 19.098 4.96 18 4.1 16.614M22.97 24.09l-6.256-3.874c-.102-.063-.218-.098-.33-.144 2.683-1.8 4.354-4.855 4.354-8.243 0-.486-.037-.964-.104-1.43a9.97 9.97 0 0 0-1.57-4.128l-.295-.408-.066-.092a10.05 10.05 0 0 0-.949-1.078c-.342-.334-.708-.643-1.094-.922-1.155-.834-2.492-1.412-3.94-1.65l-.732-.088-.748-.03a9.29 9.29 0 0 0-1.482.119c-1.447.238-2.786.816-3.94 1.65a9.33 9.33 0 0 0-.813.686 9.59 9.59 0 0 0-.845.877l-.385.437-.36.5-.288.468-.418.778-.04.09c-.593 1.28-.93 2.71-.93 4.222 0 3.832 2.182 7.342 5.56 8.938l1.437.68v4.946L5 25.64a4.44 4.44 0 0 0-.888-.086c-.017 0-.034.003-.05.003-.252.004-.503.033-.75.08a5.08 5.08 0 0 0-.237.056c-.193.046-.382.107-.568.18-.075.03-.15.057-.225.1-.25.114-.494.244-.723.405a1.31 1.31 0 0 0-.566 1.122 1.28 1.28 0 0 0 .645 1.051C4 29.925 5.96 31.614 7.473 33.563a5.06 5.06 0 0 0 .434.491c1.086 1.082 2.656 1.713 4.326 1.715h6.697c.748-.001 1.43-.333 1.858-.872.142-.18.256-.38.336-.602l2.757-7.74c.094-.26.13-.53.112-.794s-.088-.52-.203-.76a2.19 2.19 0 0 0-.821-.91" fill-opacity=".6" fill="#000" />
|
||
|
|
<path d="M22.444 24.94l-6.257-3.874a1.45 1.45 0 0 0-.757-.211h-2.953v-9.88c0-.663-.616-1.203-1.373-1.203s-1.37.54-1.37 1.203v16.643l-4.922-.994a3.44 3.44 0 0 0-.692-.069 3.35 3.35 0 0 0-1.925.598c-.147.102-.198.198-.194.298.004.094.058.176.153.23 2.462 1.448 4.517 3.22 6.11 5.27.887 1.14 2.373 1.82 3.98 1.82h6.686c.577 0 1.08-.326 1.253-.8l2.76-7.74c.16-.448-.017-.923-.426-1.22-.025-.02-.043-.043-.07-.06z" fill="#fff" />
|
||
|
|
<g transform="translate(0 .769)">
|
||
|
|
<mask id="B" fill="#fff">
|
||
|
|
<use xlink:href="#A" />
|
||
|
|
</mask>
|
||
|
|
<path d="M23.993 24.992a1.96 1.96 0 0 1-.111.794l-2.758 7.74c-.08.22-.194.423-.336.602-.427.54-1.11.87-1.857.872h-6.698c-1.67-.002-3.24-.633-4.326-1.715-.154-.154-.3-.318-.434-.49C5.96 30.846 4 29.157 1.646 27.773c-.385-.225-.626-.618-.645-1.05a1.31 1.31 0 0 1 .566-1.122 4.56 4.56 0 0 1 .723-.405l.225-.1a4.3 4.3 0 0 1 .568-.18l.237-.056c.248-.046.5-.075.75-.08.018 0 .034-.003.05-.003.303-.001.597.027.89.086l3.722.752V20.68l-1.436-.68c-3.377-1.596-5.56-5.106-5.56-8.938 0-1.51.336-2.94.93-4.222.015-.03.025-.06.04-.09.127-.267.268-.525.418-.778.093-.16.186-.316.288-.468.063-.095.133-.186.2-.277L3.773 5c.118-.155.26-.29.385-.437.266-.3.544-.604.845-.877a9.33 9.33 0 0 1 .813-.686C6.97 2.167 8.31 1.59 9.757 1.35a9.27 9.27 0 0 1 1.481-.119 8.82 8.82 0 0 1 .748.031c.247.02.49.05.733.088 1.448.238 2.786.816 3.94 1.65.387.28.752.588 1.094.922a9.94 9.94 0 0 1 .949 1.078l.066.092c.102.133.203.268.295.408a9.97 9.97 0 0 1 1.571 4.128c.066.467.103.945.103 1.43 0 3.388-1.67 6.453-4.353 8.243.11.046.227.08.33.144l6.256 3.874c.37.23.645.55.82.9.115.24.185.498.203.76m.697-1.195c-.265-.55-.677-1.007-1.194-1.326l-5.323-3.297c2.255-2.037 3.564-4.97 3.564-8.114 0-2.19-.637-4.304-1.84-6.114-.126-.188-.26-.37-.4-.552-.645-.848-1.402-1.6-2.252-2.204C15.472.91 13.393.232 11.238.232A10.21 10.21 0 0 0 5.23 2.19c-.848.614-1.606 1.356-2.253 2.205-.136.18-.272.363-.398.55C1.374 6.756.737 8.87.737 11.06c0 4.218 2.407 8.08 6.133 9.842l.863.41v3.092l-2.525-.51c-.356-.07-.717-.106-1.076-.106a5.45 5.45 0 0 0-3.14.996c-.653.46-1.022 1.202-.99 1.983a2.28 2.28 0 0 0 1.138 1.872c2.24 1.318 4.106 2.923 5.543 4.772 1.26 1.62 3.333 2.59 5.55 2.592h6.698c1.42-.001 2.68-.86 3.134-2.138l2.76-7.74c.272-.757.224-1.584-.134-2.325" fill-opacity=".05" fill="#000" mask="url(#B)" />
|
||
|
|
</g>
|
||
|
|
</g>
|
||
|
|
</g>
|
||
|
|
</svg>`
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/}
|
||
|
|
</slot>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div id="finger0" class="animated-container cover">
|
||
|
|
<slot name="finger0" aria-hidden="true">
|
||
|
|
</slot>
|
||
|
|
</div>
|
||
|
|
<div id="finger1" class="animated-container cover">
|
||
|
|
<slot name="finger1" aria-hidden="true">
|
||
|
|
</slot>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="slot default">
|
||
|
|
<slot></slot>
|
||
|
|
|
||
|
|
<div class="slot progress-bar">
|
||
|
|
<slot name="progress-bar">
|
||
|
|
<div id="default-progress-bar" aria-hidden="true">
|
||
|
|
<div class="bar" part="default-progress-bar"></div>
|
||
|
|
</div>
|
||
|
|
</slot>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="slot exit-webxr-ar-button">
|
||
|
|
<slot name="exit-webxr-ar-button">
|
||
|
|
<a id="default-exit-webxr-ar-button" part="default-exit-webxr-ar-button"
|
||
|
|
tabindex="3"
|
||
|
|
aria-label="Exit AR"
|
||
|
|
aria-hidden="true">
|
||
|
|
${jc`
|
||
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">
|
||
|
|
<!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement
|
||
|
|
support for dynamic re-coloring of UI components -->
|
||
|
|
<defs>
|
||
|
|
<filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%">
|
||
|
|
<feGaussianBlur in="SourceAlpha" stdDeviation="1"/>
|
||
|
|
<feOffset dx="0" dy="0" result="offsetblur"/>
|
||
|
|
<feFlood flood-color="#000000"/>
|
||
|
|
<feComposite in2="offsetblur" operator="in"/>
|
||
|
|
<feMerge>
|
||
|
|
<feMergeNode/>
|
||
|
|
<feMergeNode in="SourceGraphic"/>
|
||
|
|
</feMerge>
|
||
|
|
</filter>
|
||
|
|
</defs>
|
||
|
|
<path filter="url(#drop-shadow)" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
||
|
|
<path d="M0 0h24v24H0z" fill="none"/>
|
||
|
|
</svg>`
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/}
|
||
|
|
</a>
|
||
|
|
</slot>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="screen-reader-only" role="region" aria-label="Live announcements">
|
||
|
|
<span id="status" role="status"></span>
|
||
|
|
</div>`,ru=new WeakMap;function su(){let t,e;function i(t,e,i,n,r,s){const a=s.num_components(),o=i.num_points()*a,l=o*r.BYTES_PER_ELEMENT,c=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}(t,r),h=t._malloc(l);e.GetAttributeDataArrayForAllPoints(i,s,c,l,h);const u=new r(t.HEAPF32.buffer,h,o).slice();return t._free(h),{name:n,array:u,itemSize:a}}onmessage=function(n){const r=n.data;switch(r.type){case"init":t=r.decoderConfig,e=new Promise((function(e){t.onModuleLoaded=function(t){e({draco:t})},DracoDecoderModule(t)}));break;case"decode":const n=r.buffer,s=r.taskConfig;e.then((t=>{const e=t.draco,a=new e.Decoder;try{const t=function(t,e,n,r){const s=r.attributeIDs,a=r.attributeTypes;let o,l;const c=e.GetEncodedGeometryType(n);if(c===t.TRIANGULAR_MESH)o=new t.Mesh,l=e.DecodeArrayToMesh(n,n.byteLength,o);else{if(c!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new t.PointCloud,l=e.DecodeArrayToPointCloud(n,n.byteLength,o)}if(!l.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const n in s){const l=self[a[n]];let c,u;if(r.useUniqueIDs)u=s[n],c=e.GetAttributeByUniqueId(o,u);else{if(u=e.GetAttributeId(o,t[s[n]]),-1===u)continue;c=e.GetAttribute(o,u)}const d=i(t,e,o,n,l,c);"color"===n&&(d.vertexColorSpace=r.vertexColorSpace),h.attributes.push(d)}c===t.TRIANGULAR_MESH&&(h.index=function(t,e,i){const n=i.num_faces(),r=3*n,s=4*r,a=t._malloc(s);e.GetTrianglesUInt32Array(i,s,a);const o=new Uint32Array(t.HEAPF32.buffer,a,r).slice();return t._free(a),{array:o,itemSize:1}}(t,e,o));return t.destroy(o),h}(e,a,new Int8Array(n),s),o=t.attributes.map((t=>t.array.buffer));t.index&&o.push(t.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:t},o)}catch(t){console.error(t),self.postMessage({type:"error",id:r.id,error:t.message})}finally{e.destroy(a)}}))}}}function au(t,e){if(0===e)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(2===e||1===e){let i=t.getIndex();if(null===i){const e=[],n=t.getAttribute("position");if(void 0===n)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(let t=0;t<n.count;t++)e.push(t);t.setIndex(e),i=t.getIndex()}const n=i.count-2,r=[];if(2===e)for(let t=1;t<=n;t++)r.push(i.getX(0)),r.push(i.getX(t)),r.push(i.getX(t+1));else for(let t=0;t<n;t++)t%2==0?(r.push(i.getX(t)),r.push(i.getX(t+1)),r.push(i.getX(t+2))):(r.push(i.getX(t+2)),r.push(i.getX(t+1)),r.push(i.getX(t)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=t.clone();return s.setIndex(r),s.clearGroups(),s}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}class ou extends Il{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(t){return new Au(t)})),this.register((function(t){return new xu(t)})),this.register((function(t){return new Su(t)})),this.register((function(t){return new Cu(t)})),this.register((function(t){return new mu(t)})),this.register((function(t){return new gu(t)})),this.register((function(t){return new fu(t)})),this.register((function(t){return new vu(t)})),this.register((function(t){return new du(t)})),this.register((function(t){return new _u(t)})),this.register((function(t){return new pu(t)})),this.register((function(t){return new Eu(t)})),this.register((function(t){return new yu(t)})),this.register((function(t){return new hu(t)})),this.register((function(t){return new Iu(t)})),this.register((function(t){return new Mu(t)}))}load(t,e,i,n){const r=this;let s;if(""!==this.resourcePath)s=this.resourcePath;else if(""!==this.path){const e=jl.
|
||
|
|
/* @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 Gd,Hd;const zd=Symbol("retainerCount"),Vd=Symbol("recentlyUsed"),Wd=Symbol("evict"),qd=Symbol("evictionThreshold"),Xd=Symbol("cache");class jd{constructor(t,e=5){this[Gd]=new Map,this[Hd]=[],this[Xd]=t,this[qd]=e}set evictionThreshold(t){this[qd]=t,this[Wd]()}get evictionThreshold(){return this[qd]}get cache(){return this[Xd]}retainerCount(t){return this[zd].get(t)||0}reset(){this[zd].clear(),this[Vd]=[]}retain(t){this[zd].has(t)||this[zd].set(t,0),this[zd].set(t,this[zd].get(t)+1);const e=this[Vd].indexOf(t);-1!==e&&this[Vd].splice(e,1),this[Vd].unshift(t),this[Wd]()}release(t){this[zd].has(t)&&this[zd].set(t,Math.max(this[zd].get(t)-1,0)),this[Wd]()}[(Gd=zd,Hd=Vd,Wd)](){if(!(this[Vd].length<this[qd]))for(let t=this[Vd].length-1;t>=this[qd];--t){const e=this[Vd][t];0===this[zd].get(e)&&(this[Xd].delete(e),this[Vd].splice(t,1))}}}
|
||
|
|
/* @license
|
||
|
|
* Copyright 2021 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/const Yd=t=>{const e=new Map;for(const i of t.mappings)for(const t of i.variants)e.set(t,{material:null,gltfMaterialIndex:i.material});return e};class Kd{constructor(t){this.parser=t,this.name="KHR_materials_variants"}afterRoot(t){const e=this.parser,i=e.json;if(void 0===i.extensions||void 0===i.extensions[this.name])return null;const n=(t=>{const e=[],i=new Set;for(const n of t){let t=n,r=0;for(;i.has(t);)t=n+"."+ ++r;i.add(t),e.push(t)}return e})((i.extensions[this.name].variants||[]).map((t=>t.name)));for(const n of t.scenes)n.traverse((t=>{const n=t;if(!n.material)return;const r=e.associations.get(n);if(null==r||null==r.meshes||null==r.primitives)return;const s=i.meshes[r.meshes].primitives[r.primitives].extensions;s&&s[this.name]&&(n.userData.variantMaterials=Yd(s[this.name]))}));return t.userData.variants=n,Promise.resolve()}}
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/var Jd,$d;Le.DEFAULT_ANISOTROPY=4;const Zd=new Map,tA=new Map;let eA;const iA=new class extends Il{constructor(t){super(t),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(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,i,n){const r=new bl(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(t=>{this.parse(t,e,n)}),i,n)}parse(t,e,i=(()=>{})){this.decodeDracoFile(t,e,null,null,Lt).catch(i)}decodeDracoFile(t,e,i,n,r=Ut,s=(()=>{})){const a={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:r};return this.decodeGeometry(t,a).then(e).catch(s)}decodeGeometry(t,e){const i=JSON.stringify(e);if(ru.has(t)){const e=ru.get(t);if(e.key===i)return e.promise;if(0===t.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n;const r=this.workerNextTaskID++,s=t.byteLength,a=this._getWorker(r,s).then((i=>(n=i,new Promise(((i,s)=>{n._callbacks[r]={resolve:i,reject:s},n.postMessage({type:"decode",id:r,taskConfig:e,buffer:t},[t])}))))).then((t=>this._createGeometry(t.geometry)));return a.catch((()=>!0)).then((()=>{n&&r&&this._releaseTask(n,r)})),ru.set(t,{key:i,promise:a}),a}_createGeometry(t){const e=new wn;t.index&&e.setIndex(new gn(t.index.array,1));for(let i=0;i<t.attributes.length;i++){const n=t.attributes[i],r=n.name,s=n.array,a=n.itemSize,o=new gn(s,a);"color"===r&&(this._assignVertexColorSpace(o,n.vertexColorSpace),o.normalized=s instanceof Float32Array==!1),e.setAttribute(r,o)}return e}_assignVertexColorSpace(t,e){if(e!==Lt)return;const i=new an;for(let e=0,n=t.count;e<n;e++)i.fromBufferAttribute(t,e).convertSRGBToLinear(),t.setXYZ(e,i.r,i.g,i.b)}_loadLibrary(t,e){const i=new bl(this.manager);return i.setPath(this.decoderPath),i.setResponseType(e),i.setWithCredentials(this.withCredentials),new Promise(((e,n)=>{i.load(t,e,void 0,n)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const t="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,e=[];return t?e.push(this._loadLibrary("draco_decoder.js","text")):(e.push(this._loadLibrary("draco_wasm_wrapper.js","text")),e.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(e).then((e=>{const i=e[0];t||(this.decoderConfig.wasmBinary=e[1]);const n=su.toString(),r=["/* draco decoder */",i,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}_getWorker(t,e){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const t=new Worker(this.workerSourceURL);t._callbacks={},t._taskCosts={},t._taskLoad=0,t.postMessage({type:"init",decoderConfig:this.decoderConfig}),t.onmessage=function(e){const i=e.data;switch(i.type){case"decode":t._callbacks[i.id].resolve(i);break;case"error":t._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(t)}else this.workerPool.sort((function(t,e){return t._taskLoad>e._taskLoad?-1:1}));const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i}))}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map((t=>t._taskLoad)))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,""!=
|
||
|
|
/* @license
|
||
|
|
* Copyright 2021 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/
|
||
|
|
const vp=t=>void 0!==t.material&&t.userData&&t.userData.variantMaterials&&!!Array.from(t.userData.variantMaterials.values()).filter((t=>_p(t.material))),_p=t=>t&&t.isMaterial&&!Array.isArray(t);class yp{constructor(t){this.writer=t,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(t){const e=new Set;for(const i of t)i.traverse((t=>{if(!vp(t))return;const i=t.userData.variantMaterials,n=t.userData.variantData;for(const[t,r]of n){const n=i.get(r.index);n&&_p(n.material)&&e.add(t)}}));e.forEach((t=>this.variantNames.push(t)))}writeMesh(t,e){if(!vp(t))return;const i=t.userData,n=i.variantMaterials,r=i.variantData,s=new Map,a=new Map,o=Array.from(r.values()).sort(((t,e)=>t.index-e.index));for(const[t,e]of o.entries())a.set(e.index,t);for(const t of r.values()){const e=n.get(t.index);if(!e||!_p(e.material))continue;const i=this.writer.processMaterial(e.material);s.has(i)||s.set(i,{material:i,variants:[]}),s.get(i).variants.push(a.get(t.index))}const l=Array.from(s.values()).map((t=>t.variants.sort(((t,e)=>t-e))&&t)).sort(((t,e)=>t.material-e.material));if(0===l.length)return;const c=_p(i.originalMaterial)?this.writer.processMaterial(i.originalMaterial):-1;for(const t of e.primitives)c>=0&&(t.material=c),t.extensions=t.extensions||{},t.extensions[this.name]={mappings:l}}afterParse(){if(0===this.variantNames.length)return;const t=this.writer.json;t.extensions=t.extensions||{};const e=this.variantNames.map((t=>({name:t})));t.extensions[this.name]={variants:e},this.writer.extensionsUsed[this.name]=!0}}class Ep{constructor(t,e,i,n,r){this.xrLight=t,this.renderer=e,this.lightProbe=i,this.xrWebGLBinding=null,this.estimationStartCallback=r,this.frameCallback=this.onXRFrame.bind(this);const s=e.xr.getSession();if(n&&"XRWebGLBinding"in window){const i=new or(16);t.environment=i.texture;const n=e.getContext();switch(s.preferredReflectionFormat){case"srgba8":n.getExtension("EXT_sRGB");break;case"rgba16f":n.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(s,n),this.lightProbe.addEventListener("reflectionchange",(()=>{this.updateReflection()}))}s.requestAnimationFrame(this.frameCallback)}updateReflection(){const t=this.renderer.properties.get(this.xrLight.environment);if(t){const e=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);e&&(t.__webglTexture=e,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(t,e){if(!this.xrLight)return;e.session.requestAnimationFrame(this.frameCallback);const i=e.getLightEstimate(this.lightProbe);if(i){this.xrLight.lightProbe.sh.fromArray(i.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const t=Math.max(1,Math.max(i.primaryLightIntensity.x,Math.max(i.primaryLightIntensity.y,i.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(i.primaryLightIntensity.x/t,i.primaryLightIntensity.y/t,i.primaryLightIntensity.z/t),this.xrLight.directionalLight.intensity=t,this.xrLight.directionalLight.position.copy(i.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class xp extends Xa{constructor(t,e=!0){super(),this.lightProbe=new Xl,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new Wl,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let i=null,n=!1;t.xr.addEventListener("sessionstart",(()=>{const r=t.xr.getSession();"requestLightProbe"in r&&r.requestLightProbe({reflectionFormat:r.preferredReflectionFormat}).then((r=>{i=new Ep(this,t,r,e,(()=>{n=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),t.xr.addEventListener("sessionend",(()=>{i&&(i.dispose(),i=null),n&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{i&&(i.dispose(),i=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}
|
||
|
|
/* @license
|
||
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/class Sp{constructor(t=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(t)}setDecayTime(t){this.naturalFrequency=1/Math.max(.001,t)}update(t,e,i,n){const r=2e-4*this.naturalFrequency;if(null==t||0===n)return e;if(t===e&&0===this.velocity)return e;if(i<0)return t;const s=t-e,a=this.velocity+this.naturalFrequency*s,o=s+i*a,l=Math.exp(-this.naturalFrequency*i),c=(a-this.naturalFrequency*o)*l,h=-this.naturalFrequency*(c+a*l);return Math.abs(c)<r*Math.abs(n)&&h*s>=0?(this.velocity=0,e):(this.velocity=c,e+o*l)}}
|
||
|
|
/* @license
|
||
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/const Cp=.2,Ip=Math.PI/24,Mp=new de,wp=(t,e,i)=>{let n=e>0?i>0?0:-Math.PI/2:i>0?Math.PI/2:Math.PI;for(let r=0;r<=12;++r)t.push(e+.17*Math.cos(n),i+.17*Math.sin(n),0,e+Cp*Math.cos(n),i+Cp*Math.sin(n),0),n+=Ip};class bp extends Wn{constructor(t,e){const i=new wn,n=[],r=[],{size:s,boundingBox:a}=t,o=s.x/2,l=("back"===e?s.y:s.z)/2;wp(r,o,l),wp(r,-o,l),wp(r,-o,-l),wp(r,o,-l);const h=r.length/3;for(let t=0;t<h-2;t+=2)n.push(t,t+1,t+3,t,t+3,t+2);const u=h-2;n.push(u,u+1,1,u,1,0),i.setAttribute("position",new _n(r,3)),i.setIndex(n),super(i),this.side=e;const d=this.material;switch(d.side=c,d.transparent=!0,d.opacity=0,this.goalOpacity=0,this.opacityDamper=new Sp,this.hitPlane=new Wn(new fr(2*(o+Cp),2*(l+Cp))),this.hitPlane.visible=!1,this.hitPlane.material.side=c,this.add(this.hitPlane),a.getCenter(this.position),e){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=a.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=a.min.z,this.position.z=this.shadowHeight}t.target.add(this),this.offsetHeight=0}getHit(t,e,i){Mp.set(e,-i),this.hitPlane.visible=!0;const n=t.positionAndNormalFromPoint(Mp,this.hitPlane);return this.hitPlane.visible=!1,null==n?null:n.position}getExpandedHit(t,e,i){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const n=this.getHit(t,e,i);return this.hitPlane.scale.set(1,1,1),n}set offsetHeight(t){t-=.001,"back"===this.side?this.position.z=this.shadowHeight+t:this.position.y=this.shadowHeight+t}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(t){this.goalOpacity=t?.75:0}updateOpacity(t){const e=this.material;e.opacity=this.opacityDamper.update(e.opacity,this.goalOpacity,t,1),this.visible=e.opacity>0}dispose(){var t;const{geometry:e,material:i}=this.hitPlane;e.dispose(),i.dispose(),this.geometry.dispose(),this.material.dispose(),null===(t=this.parent)||void 0===t||t.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.
|
||
|
|
*/const Tp=(t,e)=>({type:"number",number:t,unit:e}),Bp=(()=>{const t={};return e=>{const i=e;if(i in t)return t[i];const n=[];let r=0;for(;e;){if(++r>1e3){e="";break}const t=Rp(e),i=t.nodes[0];if(null==i||0===i.terms.length)break;n.push(i),e=t.remainingInput}return t[i]=n}})(),Rp=(()=>{const t=/^(\-\-|[a-z\u0240-\uffff])/i,e=/^([\*\+\/]|[\-]\s)/i,i=/^[\),]/;return n=>{const r=[];for(;n.length&&(n=n.trim(),!i.test(n));)if("("===n[0]){const{nodes:t,remainingInput:e}=Pp(n);n=e,r.push({type:"function",name:{type:"ident",value:"calc"},arguments:t})}else if(t.test(n)){const t=Dp(n),e=t.nodes[0];if("("===(n=t.remainingInput)[0]){const{nodes:t,remainingInput:i}=Pp(n);r.push({type:"function",name:e,arguments:t}),n=i}else r.push(e)}else if(e.test(n))r.push({type:"operator",value:n[0]}),n=n.slice(1);else{const{nodes:t,remainingInput:e}="#"===n[0]?Up(n):Lp(n);if(0===t.length)break;r.push(t[0]),n=e}return{nodes:[{type:"expression",terms:r}],remainingInput:n}}})(),Dp=(()=>{const t=/[^a-z0-9_\-\u0240-\uffff]/i;return e=>{const i=e.match(t);return{nodes:[{type:"ident",value:null==i?e:e.substr(0,i.index)}],remainingInput:null==i?"":e.substr(i.index)}}})(),Lp=(()=>{const t=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,e=/^[a-z%]+/i,i=/^(m|mm|cm|rad|deg|[%])$/;return n=>{const r=n.match(t),s=null==r?"0":r[0],a=(n=null==s?n:n.slice(s.length)).match(e);let o=null!=a&&""!==a[0]?a[0]:null;const l=null==a?n:n.slice(o.length);return null==o||i.test(o)||(o=null),{nodes:[{type:"number",number:parseFloat(s)||0,unit:o}],remainingInput:l}}})(),Up=(()=>{const t=/^[a-f0-9]*/i;return e=>{const i=(e=e.slice(1).trim()).match(t);return{nodes:null==i?[]:[{type:"hex",value:i[0]}],remainingInput:null==i?e:e.slice(i[0].length)}}})(),Pp=t=>{const e=[];for(t=t.slice(1).trim();t.length;){const i=Rp(t);if(e.push(i.nodes[0]),","===(t=i.remainingInput.trim())[0])t=t.slice(1).trim();else if(")"===t[0]){t=t.slice(1);break}}return{nodes:e,remainingInput:t}},Np=Symbol("visitedTypes");class Fp{constructor(t){this[Np]=t}walk(t,e){const i=t.slice();for(;i.length;){const t=i.shift();switch(this[Np].indexOf(t.type)>-1&&e(t),t.type){case"expression":i.unshift(...t.terms);break;case"function":i.unshift(t.name,...t.arguments)}}}}const Qp=Object.freeze({type:"number",number:0,unit:null}),Op=(t,e=0)=>{let{number:i,unit:n}=t;if(isFinite(i)){if("rad"===t.unit||null==t.unit)return t}else i=e,n="rad";return{type:"number",number:("deg"===n&&null!=i?i:0)*Math.PI/180,unit:"rad"}},kp=(t,e=0)=>{let i,{number:n,unit:r}=t;if(isFinite(n)){if("m"===t.unit)return t}else n=e,r="m";switch(r){default:i=1;break;case"cm":i=.01;break;case"mm":i=.001}return{type:"number",number:i*n,unit:"m"}},Gp=(()=>{const t=t=>t,e={rad:t,deg:Op,m:t,mm:kp,cm:kp};return(t,i=Qp)=>{isFinite(t.number)||(t.number=i.number,t.unit=i.unit);const{unit:n}=t;if(null==n)return t;const r=e[n];return null==r?i:r(t)}})();
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/
|
||
|
|
var Hp,zp,Vp;const Wp=Symbol("evaluate"),qp=Symbol("lastValue");class Xp{constructor(){this[Hp]=null}static evaluatableFor(t,e=Qp){if(t instanceof Xp)return t;if("number"===t.type)return"%"===t.unit?new Kp(t,e):t;switch(t.name.value){case"calc":return new em(t,e);case"env":return new $p(t)}return Qp}static evaluate(t){return t instanceof Xp?t.evaluate():t}static isConstant(t){return!(t instanceof Xp)||t.isConstant}static applyIntrinsics(t,e){const{basis:i,keywords:n}=e,{auto:r}=n;return i.map(((e,i)=>{const s=null==r[i]?e:r[i];let a=t[i]?t[i]:s;if("ident"===a.type){const t=a.value;t in n&&(a=n[t][i])}return null!=a&&"ident"!==a.type||(a=s),"%"===a.unit?Tp(a.number/100*e.number,e.unit):(a=Gp(a,e),a.unit!==e.unit?e:a)}))}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[qp]||(this[qp]=this[Wp]()),this[qp]}}Hp=qp;const jp=Symbol("percentage"),Yp=Symbol("basis");class Kp extends Xp{constructor(t,e){super(),this[jp]=t,this[Yp]=e}get isConstant(){return!0}[Wp](){return Tp(this[jp].number/100*this[Yp].number,this[Yp].unit)}}const Jp=Symbol("identNode");class $p extends Xp{constructor(t){super(),this[zp]=null;const e=t.arguments.length?t.arguments[0].terms[0]:null;null!=e&&"ident"===e.type&&(this[Jp]=e)}get isConstant(){return!1}[(zp=Jp,Wp)](){if(null!=this[Jp]&&"window-scroll-y"===this[Jp].value){return{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}}return Qp}}const Zp=/[\*\/]/,tm=Symbol("evaluator");class em extends Xp{constructor(t,e=Qp){if(super(),this[Vp]=null,1!==t.arguments.length)return;const i=t.arguments[0].terms.slice(),n=[];for(;i.length;){const t=i.shift();if(n.length>0){const i=n[n.length-1];if("operator"===i.type&&Zp.test(i.value)){const i=n.pop(),r=n.pop();if(null==r)return;n.push(new sm(i,Xp.evaluatableFor(r,e),Xp.evaluatableFor(t,e)));continue}}n.push("operator"===t.type?t:Xp.evaluatableFor(t,e))}for(;n.length>2;){const[t,i,r]=n.splice(0,3);if("operator"!==i.type)return;n.unshift(new sm(i,Xp.evaluatableFor(t,e),Xp.evaluatableFor(r,e)))}1===n.length&&(this[tm]=n[0])}get isConstant(){return null==this[tm]||Xp.isConstant(this[tm])}[(Vp=tm,Wp)](){return null!=this[tm]?Xp.evaluate(this[tm]):Qp}}const im=Symbol("operator"),nm=Symbol("left"),rm=Symbol("right");class sm extends Xp{constructor(t,e,i){super(),this[im]=t,this[nm]=e,this[rm]=i}get isConstant(){return Xp.isConstant(this[nm])&&Xp.isConstant(this[rm])}[Wp](){const t=Gp(Xp.evaluate(this[nm])),e=Gp(Xp.evaluate(this[rm])),{number:i,unit:n}=t,{number:r,unit:s}=e;if(null!=s&&null!=n&&s!=n)return Qp;const a=n||s;let o;switch(this[im].value){case"+":o=i+r;break;case"-":o=i-r;break;case"/":o=i/r;break;case"*":o=i*r;break;default:return Qp}return{type:"number",number:o,unit:a}}}const am=Symbol("evaluatables"),om=Symbol("intrinsics");class lm extends Xp{constructor(t,e){super(),this[om]=e;const i=t[0],n=null!=i?i.terms:[];this[am]=e.basis.map(((t,e)=>{const i=n[e];return null==i?{type:"ident",value:"auto"}:"ident"===i.type?i:Xp.evaluatableFor(i,t)}))}get isConstant(){for(const t of this[am])if(!Xp.isConstant(t))return!1;return!0}[Wp](){const t=this[am].map((t=>Xp.evaluate(t)));return Xp.applyIntrinsics(t,this[om]).map((t=>t.number))}}
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/var cm,hm,um,dm;const Am=Symbol("instances"),pm=Symbol("activateListener"),mm=Symbol("deactivateListener"),gm=Symbol("notifyInstances"),fm=Symbol("notify"),vm=Symbol("callback");class _m{constructor(t){this[vm]=t}static[gm](){for(const t of _m[Am])t[fm]()}static[(cm=Am,pm)](){window.addEventListener("scroll",this[gm],{passive:!0})}static[mm](){window.removeEventListener("scroll",this[gm])}observe(){0===_m[Am].size&&_m[pm](),_m[Am].add(this)}disconnect(){_m[Am].delete(this),0===_m[Am].size&&_m[mm]()}[fm](){this[vm]()}}_m[cm]=new Set;const ym=Symbol("computeStyleCallback"),Em=Symbol("astWalker"),xm=Symbol("dependencies"),Sm=Symbol("onScroll");class Cm{constructor(t){this[hm]={},this[um]=new Fp(["function"]),this[dm]=()=>{this[ym]({relatedState:"window-scroll"})},this[ym]=t}observeEffectsFor(t){const e={},i=this[xm];this[Em].walk(t,(t=>{const{name:n}=t,r=t.arguments[0].terms[0];if("env"===n.value&&null!=r&&"ident"===r.type&&"window-scroll-y"===r.value)if(null==e["window-scroll"]){const t="window-scroll"in i?i["window-scroll"]:new _m(this[Sm]);t.observe(),delete i["window-scroll"],e["window-scroll"]=t}}));for(const t in i){i[t].disconnect()}this[xm]=e}dispose(){for(const t in this[xm]){this[xm][t].disconnect()}}}hm=xm,um=Em,dm=Sm;
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/
|
||
|
|
const Im=t=>{const e=t.observeEffects||!1,i=t.intrinsics instanceof Function?t.intrinsics:()=>t.intrinsics;return(n,r)=>{const s=n.updated,a=n.connectedCallback,o=n.disconnectedCallback,l=Symbol(`${r}StyleEffector`),c=Symbol(`${r}StyleEvaluator`),h=Symbol(`${r}UpdateEvaluator`),u=Symbol(`${r}EvaluateAndSync`);Object.defineProperties(n,{[l]:{value:null,writable:!0},[c]:{value:null,writable:!0},[h]:{value:function(){const t=Bp(this[r]);this[c]=new lm(t,i(this)),null==this[l]&&e&&(this[l]=new Cm((()=>this[u]()))),null!=this[l]&&this[l].observeEffectsFor(t)}},[u]:{value:function(){if(null==this[c])return;const e=this[c].evaluate();this[t.updateHandler](e)}},updated:{value:function(t){t.has(r)&&(this[h](),this[u]()),s.call(this,t)}},connectedCallback:{value:function(){a.call(this),this.requestUpdate(r,this[r])}},disconnectedCallback:{value:function(){o.call(this),null!=this[l]&&(this[l].dispose(),this[l]=null)}}})}},Mm=t=>t<.5?2*t*t:(4-2*t)*t-1,wm=(t,e,i=Mm)=>n=>t+(e-t)*i(n),bm=t=>{const e=[],i=[];let n=t.initialValue;for(let r=0;r<t.keyframes.length;++r){const s=t.keyframes[r],{value:a,frames:o}=s,l=s.ease||Mm,c=wm(n,a,l);e.push(c),i.push(o),n=a}return((t,e)=>{const i=e.map((n=0,t=>n+=t));var n;return e=>{e=Yh(e,0,1),e*=i[i.length-1];const n=i.findIndex((t=>t>=e)),r=n<1?0:i[n-1],s=i[n];return t[n]((e-r)/(s-r))}})(e,i)};
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/
|
||
|
|
/* @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 Tm=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const Bm=bm({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}]}),Rm=bm({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),Dm="0deg 75deg 105%",Lm=["front","right","back","left"],Um=["upper-","","lower-"],Pm="auto",Nm="basic",Fm="wiggle",Qm="none",Om=()=>({basis:[Op(Tp(30,"deg"))],keywords:{auto:[null]}}),km=()=>({basis:[Op(Tp(12,"deg"))],keywords:{auto:[null]}}),Gm=(()=>{const t=Bp(Dm)[0].terms,e=Gp(t[0]),i=Gp(t[1]);return t=>{const n=t[xy].idealCameraDistance();return{basis:[e,i,Tp(n,"m")],keywords:{auto:[null,null,Tp(105,"%")]}}}})(),Hm=t=>{const e=2.2*t[xy].boundingSphere.radius;return{basis:[Tp(-1/0,"rad"),Tp(Math.PI/8,"rad"),Tp(e,"m")],keywords:{auto:[null,null,null]}}},zm=t=>{const e=Gm(t),i=new lm([],e).evaluate()[2];return{basis:[Tp(1/0,"rad"),Tp(Math.PI-Math.PI/8,"rad"),Tp(i,"m")],keywords:{auto:[null,null,null]}}},Vm=t=>{const e=t[xy].boundingBox.getCenter(new ke);return{basis:[Tp(e.x,"m"),Tp(e.y,"m"),Tp(e.z,"m")],keywords:{auto:[null,null,null]}}},Wm=Math.PI/2,qm=Math.PI/3,Xm=Wm/2,jm=2*Math.PI,Ym=Symbol("controls"),Km=Symbol("panElement"),Jm=Symbol("promptElement"),$m=Symbol("promptAnimatedContainer"),Zm=Symbol("fingerAnimatedContainers"),tg=Symbol("deferInteractionPrompt"),eg=Symbol("updateAria"),ig=Symbol("a11y"),ng=Symbol("updateA11y"),rg=Symbol("updateCameraForRadius"),sg=Symbol("cancelPrompts"),ag=Symbol("onChange"),og=Symbol("onPointerChange"),lg=Symbol("waitingToPromptUser"),cg=Symbol("userHasInteracted"),hg=Symbol("promptElementVisibleTime"),ug=Symbol("lastPromptOffset"),dg=Symbol("cancellationSource"),Ag=Symbol("lastSpherical"),pg=Symbol("jumpCamera"),mg=Symbol("initialized"),gg=Symbol("maintainThetaPhi"),fg=Symbol("syncCameraOrbit"),vg=Symbol("syncFieldOfView"),_g=Symbol("syncCameraTarget"),yg=Symbol("syncMinCameraOrbit"),Eg=Symbol("syncMaxCameraOrbit"),xg=Symbol("syncMinFieldOfView"),Sg=Symbol("syncMaxFieldOfView"),Cg=new de,Ig=new ke,Mg=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"}),wg=Math.PI/8,bg=.04,Tg={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class Bg extends te{constructor(t,e,i){super(),this.camera=t,this.element=e,this.scene=i,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=Tg.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new Ae,this.panPerPixel=0,this.spherical=new uc,this.goalSpherical=new uc,this.thetaDamper=new Sp,this.phiDamper=new Sp,this.radiusDamper=new Sp,this.logFov=Math.log(Mg.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new Sp,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=t=>{if(this.enablePan)t.preventDefault();else for(const t of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:t.id})))},this.touchModeZoom=(t,e)=>{if(!this._disableZoom){const t=this.twoTouchDistance(this.pointers[0],this.pointers[1]),e=bg*this.zoomSensitivity*(this.lastSeparation-t)*50/this.scene.height;this.lastSeparation=t,this.userAdjustOrbit(0,0,e)}this.panPerPixel>0&&this.movePan(t,e)},this.disableScroll=t=>{t.preventDefault()},this.touchModeRotate=(t,e)=>{const{touchAction:i}=this._options;if(!this.touchDecided&&"none"!==i){this.touchDecided=!0;const n=Math.abs(t),r=Math.abs(e);if(this.changeSource===Tg.USER_INTERACTION&&("pan-y"===i&&r>n||"pan-x"===i&&n>r))return v
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/const Rg=1/1.3,Dg="not-presenting",Lg="session-started",Ug="object-placed",Pg="failed",Ng="tracking",Fg="not-tracking",Qg=new ke,Og=new gi,kg=new ke,Gg=new nr(45,1,.1,100);class Hg extends te{constructor(t){super(),this.renderer=t,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 ke,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new ke,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new ke,this.goalYaw=0,this.goalScale=1,this.xDamper=new Sp,this.yDamper=new Sp,this.zDamper=new Sp,this.yawDamper=new Sp,this.scaleDamper=new Sp,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new bp(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=t=>{const e=this.transientHitTestSource;if(null==e)return;const i=this.frame.getHitTestResultsForTransientInput(e),n=this.presentedScene,r=this.placementBox;if(1===i.length){this.inputSource=t.inputSource;const{axes:e}=this.inputSource.gamepad,i=r.getHit(this.presentedScene,e[0],e[1]);r.show=!0,null!=i?(this.isTranslating=!0,this.lastDragPosition.copy(i)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*e[0])}else if(2===i.length){r.show=!0,this.isTwoFingering=!0;const{separation:t}=this.fingerPolar(i);this.firstRatio=t/n.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=t.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){qh();const t=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(t),this.threeRenderer.xr.cameraAutoUpdate=!1,t}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return qh(),await navigator.xr.isSessionSupported("immersive-ar")}catch(t){return console.warn("Request to present in WebXR denied:"),console.warn(t),console.warn("Falling back to next ar-mode"),!1}}async present(t,e=!1){this.isPresenting&&console.warn("Cannot present while a model is already presenting");let i=new Promise(((t,e)=>{requestAnimationFrame((()=>t()))}));t.setHotspotsVisibility(!1),t.queueRender(),await i,this._presentedScene=t,this.overlay=t.element.shadowRoot.querySelector("div.default"),!0===e&&(this.xrLight=new xp(this.threeRenderer),this.xrLight.addEventListener("estimationstart",(()=>{if(!this.isPresenting||null==this.xrLight)return;const t=this.presentedScene;t.add(this.xrLight),t.environment=this.xrLight.environment})));const n=await this.resolveARSession();n.addEventListener("end",(()=>{this.postSessionCleanup()}),{once:!0});const r=t.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");r.classList.add("enabled"),r.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=r;const s=await n.requestReferenceSpace("viewer");this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=t.yaw,this.goalYaw=t.yaw,this.goalScale=1,t.setBackground(null),this.oldShadowIntensity=t.shadowIntensity,t.setShadowIntensity(.01),this.oldTarget.copy(t.getTarget()),t.element.addEventListener("load",this.onUpdateScene);const a=20*Math.PI/180,o=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(a),z:-Math.cos(a)});n.requestHitTestSource({space:s,offsetRay:
|
||
|
|
/* @license
|
||
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/const Wg=Symbol("prepared"),qg=Symbol("prepare"),Xg=Symbol("preparedGLTF"),jg=Symbol("clone");class Yg{constructor(t){this[Xg]=t}static prepare(t){if(null==t.scene)throw new Error("Model does not have a scene");if(t[Wg])return t;const e=this[qg](t);return e[Wg]=!0,e}static[qg](t){const{scene:e}=t,i=[e];return Object.assign(Object.assign({},t),{scene:e,scenes:i})}get parser(){return this[Xg].parser}get animations(){return this[Xg].animations}get scene(){return this[Xg].scene}get scenes(){return this[Xg].scenes}get cameras(){return this[Xg].cameras}get asset(){return this[Xg].asset}get userData(){return this[Xg].userData}clone(){return new(0,this.constructor)(this[jg]())}dispose(){this.scenes.forEach((t=>{t.traverse((t=>{const e=t;if(!e.material)return;(Array.isArray(e.material)?e.material:[e.material]).forEach((t=>{for(const e in t){const i=t[e];if(i instanceof Le){const t=i.source.data;null!=t.close&&t.close(),i.dispose()}}t.dispose()})),e.geometry.dispose()}))}))}[jg](){const t=this[Xg],e=zg(this.scene);Kg(e,this.scene);const i=[e],n=t.userData?Object.assign({},t.userData):{};return Object.assign(Object.assign({},t),{scene:e,scenes:i,userData:n})}}const Kg=(t,e)=>{Jg(t,e,((t,e)=>{void 0!==e.userData.variantMaterials&&(t.userData.variantMaterials=new Map(e.userData.variantMaterials)),void 0!==e.userData.variantData&&(t.userData.variantData=e.userData.variantData),void 0!==e.userData.originalMaterial&&(t.userData.originalMaterial=e.userData.originalMaterial)}))},Jg=(t,e,i)=>{i(t,e);for(let n=0;n<t.children.length;n++)Jg(t.children[n],e.children[n],i)},$g=Symbol("threeGLTF"),Zg=Symbol("gltf"),tf=Symbol("gltfElementMap"),ef=Symbol("threeObjectMap"),nf=Symbol("parallelTraverseThreeScene"),rf=Symbol("correlateOriginalThreeGLTF"),sf=Symbol("correlateCloneThreeGLTF");class af{constructor(t,e,i,n){this[$g]=t,this[Zg]=e,this[tf]=n,this[ef]=i}static from(t,e){return null!=e?this[sf](t,e):this[rf](t)}static[rf](t){const e=t.parser.json,i=t.parser.associations,n=new Map,r={name:"Default"},s={type:"materials",index:-1};for(const t of i.keys())t instanceof cn&&null==i.get(t)&&(s.index<0&&(null==e.materials&&(e.materials=[]),s.index=e.materials.length,e.materials.push(r)),t.name=r.name,i.set(t,{materials:s.index}));for(const[t,r]of i){r&&(t.userData=t.userData||{},t.userData.associations=r);for(const i in r)if(null!=i&&"primitives"!==i){const s=i,a=(e[s]||[])[r[s]];if(null==a)continue;let o=n.get(a);null==o&&(o=new Set,n.set(a,o)),o.add(t)}}return new af(t,e,i,n)}static[sf](t,e){const i=e.threeGLTF,n=e.gltf,r=JSON.parse(JSON.stringify(n)),s=new Map,a=new Map;for(let n=0;n<i.scenes.length;n++)this[nf](i.scenes[n],t.scenes[n],((t,i)=>{const n=e.threeObjectMap.get(t);if(null!=n)for(const t in n)if(null!=t&&"primitives"!==t){const e=t,o=n[e],l=r[e][o],c=s.get(i)||{};c[e]=o,s.set(i,c);const h=a.get(l)||new Set;h.add(i),a.set(l,h)}}));return new af(t,r,s,a)}static[nf](t,e,i){const n=(t,e)=>{if(i(t,e),t.isObject3D){const r=t,s=e;if(r.material)if(Array.isArray(r.material))for(let t=0;t<r.material.length;++t)i(r.material[t],s.material[t]);else i(r.material,s.material);for(let i=0;i<t.children.length;++i)n(t.children[i],e.children[i])}};n(t,e)}get threeGLTF(){return this[$g]}get gltf(){return this[Zg]}get gltfElementMap(){return this[tf]}get threeObjectMap(){return this[ef]}}
|
||
|
|
/* @license
|
||
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/const of=Symbol("correlatedSceneGraph");class lf extends Yg{static[qg](t){const e=super[qg](t);null==e[of]&&(e[of]=af.from(e));const{scene:i}=e,n=new oi(void 0,1/0);return i.traverse((t=>{t.renderOrder=1e3,t.frustumCulled=!1,t.name||(t.name=t.uuid);const i=t;if(i.material){const{geometry:t}=i;i.castShadow=!0,i.isSkinnedMesh&&(t.boundingSphere=n,t.boundingBox=null);const r=i.material;if(!0===r.isMeshBasicMaterial&&(r.toneMapped=!1),r.shadowSide=o,r.aoMap){const{gltf:i,threeObjectMap:n}=e[of],s=n.get(r);if(null!=i.materials&&null!=s&&null!=s.materials){const e=i.materials[s.materials];e.occlusionTexture&&0===e.occlusionTexture.texCoord&&null!=t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv)}}}})),e}get correlatedSceneGraph(){return this[Xg][of]}[jg](){const t=super[jg](),e=new Map;return t.scene.traverse((t=>{const i=t;if(i.material){const t=i.material;if(null!=t){if(e.has(t.uuid))return void(i.material=e.get(t.uuid));i.material=t.clone(),e.set(t.uuid,i.material)}}const n=t;void 0!==n.target&&n.add(n.target)})),t[of]=af.from(t,this.correlatedSceneGraph),t}}const cf=(t,e,i)=>{let n;switch(t){case tt:n=new Uint8ClampedArray(e*i*4);break;case rt:n=new Uint16Array(e*i*4);break;case it:n=new Uint32Array(e*i*4);break;case 1010:n=new Int8Array(e*i*4);break;case 1011:n=new Int16Array(e*i*4);break;case et:n=new Int32Array(e*i*4);break;case nt:n=new Float32Array(e*i*4);break;default:throw new Error("Unsupported data type")}return n};let hf;class uf{constructor(t){var e,i,n,r,s,a,o,l,c,h,u,d,A,p,m,g;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(t){throw this._renderer.setRenderTarget(null),t}this._renderer.setRenderTarget(null)},this._width=t.width,this._height=t.height,this._type=t.type,this._colorSpace=t.colorSpace;const f={format:at,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:void 0!==(null===(e=t.renderTargetOptions)||void 0===e?void 0:e.anisotropy)?null===(i=t.renderTargetOptions)||void 0===i?void 0:i.anisotropy:1,generateMipmaps:void 0!==(null===(n=t.renderTargetOptions)||void 0===n?void 0:n.generateMipmaps)&&(null===(r=t.renderTargetOptions)||void 0===r?void 0:r.generateMipmaps),magFilter:void 0!==(null===(s=t.renderTargetOptions)||void 0===s?void 0:s.magFilter)?null===(a=t.renderTargetOptions)||void 0===a?void 0:a.magFilter:J,minFilter:void 0!==(null===(o=t.renderTargetOptions)||void 0===o?void 0:o.minFilter)?null===(l=t.renderTargetOptions)||void 0===l?void 0:l.minFilter:J,samples:void 0!==(null===(c=t.renderTargetOptions)||void 0===c?void 0:c.samples)?null===(h=t.renderTargetOptions)||void 0===h?void 0:h.samples:void 0,wrapS:void 0!==(null===(u=t.renderTargetOptions)||void 0===u?void 0:u.wrapS)?null===(d=t.renderTargetOptions)||void 0===d?void 0:d.wrapS:q,wrapT:void 0!==(null===(A=t.renderTargetOptions)||void 0===A?void 0:A.wrapT)?null===(p=t.renderTargetOptions)||void 0===p?void 0:p.wrapT:q};if(this._material=t.material,t.renderer?this._renderer=t.renderer:(this._renderer=uf.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new no,this._camera=new Br,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(),!((t,e,i,n)=>{if(void 0!==hf)return hf;const r=new Ne(1,1,n);e.setRenderTarget(r);const s=new Wn(new fr,new hn({color:16777215}));e.render(s,i),e.setRenderTarget(null);const a=cf(t,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,a),r.dispose(),s.geometry.dispose(),s.material.dispose(),hf=0!==a[0],hf})(this._type,this._renderer,this._camera,f)){let t;if(this._type===rt)t=this._renderer.extensions.has("EXT_color_buffer_float")?nt:void 0;void 0!==t?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to 1015`),this._type=t):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods wil
|
||
|
|
/* @license
|
||
|
|
* Copyright 2021 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/const xf={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]}]},Sf={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class Cf extends no{constructor(t){super(),this.position.y=-3.5;const e=new Xn;e.deleteAttribute("uv");const i=new il({metalness:0,side:l}),n=new il({metalness:0}),r="legacy"==t?xf:Sf,s=new zl(16777215,r.topLight.intensity,28,2);s.position.set(...r.topLight.position),this.add(s);const a=new Wn(e,i);a.position.set(...r.room.position),a.scale.set(...r.room.scale),this.add(a);for(const t of r.boxes){const i=new Wn(e,n);i.position.set(...t.position),i.rotation.set(0,t.rotation,0),i.scale.set(...t.scale),this.add(i)}for(const t of r.lights){const i=new Wn(e,this.createAreaLightMaterial(t.intensity));i.position.set(...t.position),i.scale.set(...t.scale),this.add(i)}}createAreaLightMaterial(t){const e=new hn;return e.color.setScalar(t),e}}
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/const If=20,Mf=/\.hdr(\.js)?$/;class wf{constructor(t){this.threeRenderer=t,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 Rl),this._ldrLoader.setWithCredentials(this.withCredentials),this._ldrLoader}get imageLoader(){return null==this._imageLoader&&(this._imageLoader=new yf(this.threeRenderer)),this._imageLoader.setWithCredentials(this.withCredentials),this._imageLoader}get hdrLoader(){return null==this._hdrLoader&&(this._hdrLoader=new Ef,this._hdrLoader.setDataType(rt)),this._hdrLoader.setWithCredentials(this.withCredentials),this._hdrLoader}async getLottieLoader(){if(null==this._lottieLoader){const{LottieLoader:t}=await import(this.lottieLoaderUrl);this._lottieLoader=new t}return this._lottieLoader.setWithCredentials(this.withCredentials),this._lottieLoader}async loadImage(t){const e=await new Promise(((e,i)=>this.ldrLoader.load(t,e,(()=>{}),i)));return e.name=t,e.flipY=!1,e}async loadLottie(t,e){const i=await this.getLottieLoader();i.setQuality(e);const n=await new Promise(((e,n)=>i.load(t,e,(()=>{}),n)));return n.name=t,n}async loadEquirect(t,e=(()=>{})){try{const i=Mf.test(t),n=i?this.hdrLoader:this.imageLoader,r=await new Promise(((i,r)=>n.load(t,(t=>{const{renderTarget:e}=t;if(null!=e){const{texture:n}=e;t.dispose(!1),i(n)}else i(t)}),(t=>{e(t.loaded/t.total*.9)}),r)));return e(1),r.name=t,r.mapping=z,i||(r.colorSpace=Lt),r}finally{e&&e(1)}}async generateEnvironmentMapAndSkybox(t=null,e=null,i=(()=>{})){const n="legacy"!==e;"legacy"!==e&&"neutral"!==e||(e=null),e=Wh(e);let r,s=Promise.resolve(null);t&&(s=this.loadEquirectFromUrl(t,i)),r=e?this.loadEquirectFromUrl(e,i):t?this.loadEquirectFromUrl(t,i):n?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[a,o]=await Promise.all([r,s]);if(null==a)throw new Error("Failed to load environment map.");return{environmentMap:a,skybox:o}}async loadEquirectFromUrl(t,e){if(!this.skyboxCache.has(t)){const i=this.loadEquirect(t,e);this.skyboxCache.set(t,i)}return this.skyboxCache.get(t)}async GenerateEnvironmentMap(t,e){await((t=0)=>new Promise((e=>setTimeout(e,t))))();const i=this.threeRenderer,n=new or(256,{generateMipmaps:!1,type:rt,format:at,colorSpace:Ut,depthBuffer:!0}),r=new sr(.1,100,n),s=r.renderTarget.texture;s.name=e;const a=i.outputColorSpace,o=i.toneMapping;return i.toneMapping=R,i.outputColorSpace=Ut,r.update(i,t),this.blurCubemap(n,.04),i.toneMapping=o,i.outputColorSpace=a,s}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new Cf("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new Cf("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(t,e){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(If);const t=new Xn,e=new Wn(t,this.blurMaterial);this.blurScene=new no,this.blurScene.add(e)}const i=t.clone();this.halfblur(t,i,e,"latitudinal"),this.halfblur(i,t,e,"longitudinal")}halfblur(t,e,i,n){const r=t.width,s=isFinite(i)?Math.PI/(2*r):2*Math.PI/39,a=i/s,o=isFinite(i)?1+Math.floor(3*a):If;o>If&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${o} samples when the maximum is set to 20`);const l=[];let c=0;for(let t=0;t<If;++t){const e=t/a,i=Math.exp(-e*e/2);l.push(i),0==t?c+=i:t<o&&(c+=2*i)}for(let t=0;t<l.length;t++)l[t]=l[t]/c;const h=this.blurMaterial.uniforms;h.envMap.value=t.texture,h.samples.value=o,h.weights.value=l,h.latitudinal.value="latitudinal"===n,h.dTheta.value=s;new sr(.1,100,e).update(this.threeRenderer,this.blurScene)}getBlurShader(t){const e=new Float32Array(t),i=new ke(0,1,0);return new $n({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/const bf=[1,.79,.62,.5,.4,.31,.25],Tf="high-performance";class Bf extends te{constructor(t){super(),this.loader=new hA(lf),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=t=>{this.dispatchEvent({type:"contextlost",sourceEvent:t})},this.onWebGLContextRestored=()=>{var t;null===(t=this.textureUtils)||void 0===t||t.dispose(),this.textureUtils=new wf(this.threeRenderer);for(const t of this.scenes)t.element[eu]()},this.dpr=Kh(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new io({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:t.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!t.debug,onShaderError:null},this.threeRenderer.toneMapping=P}catch(t){console.warn(t)}this.arRenderer=new Hg(this),this.textureUtils=this.canRender?new wf(this.threeRenderer):null,hA.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}static get singleton(){return this._singleton||(this._singleton=new Bf({powerPreference:(self.ModelViewerElement||{}).powerPreference||Tf,debug:Jh()})),this._singleton}static resetSingleton(){const t=this._singleton.dispose();for(const e of t)e.disconnectedCallback();this._singleton=new Bf({powerPreference:(self.ModelViewerElement||{}).powerPreference||Tf,debug:Jh()});for(const e of t)e.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return bf[this.scaleStep]}set minScale(t){let e=1;for(;e<bf.length&&!(bf[e]<t);)++e;this.lastStep=e-1}registerScene(t){this.scenes.add(t),t.forceRescale();const e=new de;this.threeRenderer.getSize(e),t.canvas.width=e.x,t.canvas.height=e.y,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop(((t,e)=>this.render(t,e)))}unregisterScene(t){this.scenes.delete(t),this.canvas3D.parentElement===t.canvas.parentElement&&t.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(t){return t.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:t.element[Ey]}countVisibleScenes(){const{canvas3D:t}=this;let e=0,i=null;for(const n of this.scenes){const{element:r}=n;r.modelIsVisible&&null==n.externalRenderer&&++e,t.parentElement===n.canvas.parentElement&&(i=n)}const n=e>1;if(null!=i){const e=n&&!this.multipleScenesVisible,r=!i.element.modelIsVisible;if(e||r){const{width:e,height:n}=this.sceneSize(i);this.copyPixels(i,e,n),t.parentElement.removeChild(t)}}this.multipleScenesVisible=n}updateRendererSize(){var t;const e=Kh();if(e!==this.dpr)for(const t of this.scenes){const{element:e}=t;e[ly](e.getBoundingClientRect())}let i=0,n=0;for(const t of this.scenes)i=Math.max(i,t.width),n=Math.max(n,t.height);if(i!==this.width||n!==this.height||e!==this.dpr){this.width=i,this.height=n,this.dpr=e,i=Math.ceil(i*e),n=Math.ceil(n*e),this.canRender&&this.threeRenderer.setSize(i,n,!1);for(const e of this.scenes){const{canvas:r}=e;r.width=i,r.height=n,e.forceRescale(),null===(t=e.effectRenderer)||void 0===t||t.setSize(i,n)}}}updateRendererScale(t){const e=this.scaleStep;this.avgFrameDuration+=Yh(.2*(t-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),e!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(t){if(t.shouldRender())t.scaleStep!=this.scaleStep&&(t.scaleStep=this.scaleStep,this.rescaleCanvas(t));else{if(0==t.scaleStep)return!1;t.scaleStep=0,this.rescaleCanvas(t)}return!0}rescaleCanvas(t){const e=bf[t.scaleStep],i=Math.ceil(this.width/e),n=Math.ceil(this.height/e),{style:
|
||
|
|
/* @license
|
||
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/const Rf=Symbol("correlatedObjects"),Df=Symbol("onUpdate");class Lf{constructor(t,e=null){this[Df]=t,this[Rf]=e}}
|
||
|
|
/* @license
|
||
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/const Uf=new hn,Pf=new fr(2,2);let Nf=0;const Ff=Symbol("threeTexture"),Qf=Symbol("threeTextures");class Of extends Lf{get[Ff](){var t;return null===(t=this[Rf])||void 0===t?void 0:t.values().next().value}get[Qf](){return this[Rf]}constructor(t,e){super(t,new Set(e?[e]:[])),this[Ff].image.src||(this[Ff].image.src=e.name?e.name:"adhoc_image"+Nf++),this[Ff].image.name||(this[Ff].image.name=e&&e.image&&e.image.src?e.image.src.split("/").pop():"adhoc_image")}get name(){return this[Ff].image.name||""}get uri(){return this[Ff].image.src}get bufferView(){return this[Ff].image.bufferView}get element(){const t=this[Ff];if(t&&(t.isCanvasTexture||t.isVideoTexture))return t.image}get animation(){const t=this[Ff];if(t&&t.isCanvasTexture&&t.animation)return t.animation}get type(){return null!=this.uri?"external":"embedded"}set name(t){for(const e of this[Qf])e.image.name=t}update(){const t=this[Ff];t&&t.isCanvasTexture&&!t.animation&&(this[Ff].needsUpdate=!0,this[Df]())}async createThumbnail(t,e){const i=new no;Uf.map=this[Ff];const n=new Wn(Pf,Uf);i.add(n);const r=new Br(-1,1,1,-1,0,1),{threeRenderer:s}=Bf.singleton,a=new Ne(t,e);s.setRenderTarget(a),s.render(i,r),s.setRenderTarget(null);const o=new Uint8Array(t*e*4);s.readRenderTargetPixels(a,0,0,t,e,o),$_.width=t,$_.height=e;const l=$_.getContext("2d"),c=l.createImageData(t,e);return c.data.set(o),l.putImageData(c,0,0),new Promise((async(t,e)=>{$_.toBlob((i=>{if(!i)return e("Failed to capture thumbnail.");t(URL.createObjectURL(i))}),"image/png")}))}}var kf,Gf;!function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.NearestMipmapNearest=9984]="NearestMipmapNearest",t[t.LinearMipmapNearest=9985]="LinearMipmapNearest",t[t.NearestMipmapLinear=9986]="NearestMipmapLinear",t[t.LinearMipmapLinear=9987]="LinearMipmapLinear"}(kf||(kf={})),function(t){t[t.ClampToEdge=33071]="ClampToEdge",t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.Repeat=10497]="Repeat"}(Gf||(Gf={}));
|
||
|
|
/* @license
|
||
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/
|
||
|
|
const Hf=new Map([[Gf.Repeat,W],[Gf.ClampToEdge,q],[Gf.MirroredRepeat,X]]),zf=new Map([[W,Gf.Repeat],[q,Gf.ClampToEdge],[X,Gf.MirroredRepeat]]),Vf=new Map([[kf.Nearest,j],[kf.Linear,J],[kf.NearestMipmapNearest,Y],[kf.LinearMipmapNearest,$],[kf.NearestMipmapLinear,K],[kf.LinearMipmapLinear,Z]]),Wf=new Map([[j,kf.Nearest],[J,kf.Linear],[Y,kf.NearestMipmapNearest],[$,kf.LinearMipmapNearest],[K,kf.NearestMipmapLinear],[Z,kf.LinearMipmapLinear]]),qf=new Map([[kf.Nearest,j],[kf.Linear,J]]),Xf=new Map([[j,kf.Nearest],[J,kf.Linear]]),jf=t=>Wf.has(t),Yf=t=>Xf.has(t),Kf=t=>zf.has(t),Jf=Symbol("threeTexture"),$f=Symbol("threeTextures"),Zf=Symbol("setProperty");class tv extends Lf{get[Jf](){var t;return null===(t=this[Rf])||void 0===t?void 0:t.values().next().value}get[$f](){return this[Rf]}constructor(t,e){super(t,new Set(e?[e]:[]))}get name(){return this[Jf].name||""}get minFilter(){return Wf.get(this[Jf].minFilter)}get magFilter(){return Xf.get(this[Jf].magFilter)}get wrapS(){return zf.get(this[Jf].wrapS)}get wrapT(){return zf.get(this[Jf].wrapT)}get rotation(){return this[Jf].rotation}get scale(){return Ly(this[Jf].repeat)}get offset(){return Ly(this[Jf].offset)}setMinFilter(t){this[Zf]("minFilter",Vf.get(t))}setMagFilter(t){this[Zf]("magFilter",qf.get(t))}setWrapS(t){this[Zf]("wrapS",Hf.get(t))}setWrapT(t){this[Zf]("wrapT",Hf.get(t))}setRotation(t){null==t&&(t=0),this[Zf]("rotation",t)}setScale(t){null==t&&(t={u:1,v:1}),this[Zf]("repeat",new de(t.u,t.v))}setOffset(t){null==t&&(t={u:0,v:0}),this[Zf]("offset",new de(t.u,t.v))}[Zf](t,e){if(((t,e)=>{switch(t){case"minFilter":return jf(e);case"magFilter":return Yf(e);case"wrapS":case"wrapT":return Kf(e);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${t}" on Sampler`)}})(t,e))for(const i of this[$f])i[t]=e,i.needsUpdate=!0;this[Df]()}}
|
||
|
|
/* @license
|
||
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/const ev=Symbol("image"),iv=Symbol("sampler"),nv=Symbol("threeTexture");class rv extends Lf{constructor(t,e){super(t,new Set(e?[e]:[])),this[iv]=new tv(t,e),this[ev]=new Of(t,e)}get[nv](){var t;return null===(t=this[Rf])||void 0===t?void 0:t.values().next().value}get name(){return this[nv].name||""}set name(t){for(const e of this[Rf])e.name=t}get sampler(){return this[iv]}get source(){return this[ev]}}
|
||
|
|
/* @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 sv,av,ov;const lv=Symbol("texture"),cv=Symbol("transform"),hv=Symbol("materials"),uv=Symbol("usage"),dv=Symbol("onUpdate"),Av=Symbol("activeVideo");var pv;!function(t){t[t.Base=0]="Base",t[t.MetallicRoughness=1]="MetallicRoughness",t[t.Normal=2]="Normal",t[t.Occlusion=3]="Occlusion",t[t.Emissive=4]="Emissive",t[t.Clearcoat=5]="Clearcoat",t[t.ClearcoatRoughness=6]="ClearcoatRoughness",t[t.ClearcoatNormal=7]="ClearcoatNormal",t[t.SheenColor=8]="SheenColor",t[t.SheenRoughness=9]="SheenRoughness",t[t.Transmission=10]="Transmission",t[t.Thickness=11]="Thickness",t[t.Specular=12]="Specular",t[t.SpecularColor=13]="SpecularColor",t[t.Iridescence=14]="Iridescence",t[t.IridescenceThickness=15]="IridescenceThickness",t[t.Anisotropy=16]="Anisotropy"}(pv||(pv={}));class mv{constructor(t,e,i,n){this[sv]=null,this[av]={rotation:0,scale:new de(1,1),offset:new de(0,0)},this[ov]=!1,i&&(this[cv].rotation=i.rotation,this[cv].scale.copy(i.repeat),this[cv].offset.copy(i.offset),this[lv]=new rv(t,i)),this[dv]=t,this[hv]=n,this[uv]=e}get texture(){return this[lv]}setTexture(t){var e,i;const n=null!=t?t.source[Ff]:null,r=null===(e=this[lv])||void 0===e?void 0:e.source[Ff];if(null!=r&&r.isVideoTexture?this[Av]=!1:(null===(i=this[lv])||void 0===i?void 0:i.source.animation)&&this[lv].source.animation.removeEventListener("enterFrame",this[dv]),this[lv]=t,null!=n&&n.isVideoTexture){const t=n.image;if(this[Av]=!0,null!=t.requestVideoFrameCallback){const e=()=>{this[Av]&&(this[dv](),t.requestVideoFrameCallback(e))};t.requestVideoFrameCallback(e)}else{const t=()=>{this[Av]&&(this[dv](),requestAnimationFrame(t))};requestAnimationFrame(t)}}else null!=(null==t?void 0:t.source.animation)&&t.source.animation.addEventListener("enterFrame",this[dv]);let s=Lt;if(this[hv])for(const t of this[hv]){switch(this[uv]){case pv.Base:t.map=n;break;case pv.MetallicRoughness:s=Ut,t.metalnessMap=n,t.roughnessMap=n;break;case pv.Normal:s=Ut,t.normalMap=n;break;case pv.Occlusion:s=Ut,t.aoMap=n;break;case pv.Emissive:t.emissiveMap=n;break;case pv.Clearcoat:t.clearcoatMap=n;break;case pv.ClearcoatRoughness:t.clearcoatRoughnessMap=n;break;case pv.ClearcoatNormal:t.clearcoatNormalMap=n;break;case pv.SheenColor:t.sheenColorMap=n;break;case pv.SheenRoughness:t.sheenRoughnessMap=n;break;case pv.Transmission:t.transmissionMap=n;break;case pv.Thickness:t.thicknessMap=n;break;case pv.Specular:t.specularIntensityMap=n;break;case pv.SpecularColor:t.specularColorMap=n;break;case pv.Iridescence:t.iridescenceMap=n;break;case pv.IridescenceThickness:t.iridescenceThicknessMap=n;break;case pv.Anisotropy:t.anisotropyMap=n}t.needsUpdate=!0}n&&(n.colorSpace=s,n.rotation=this[cv].rotation,n.repeat=this[cv].scale,n.offset=this[cv].offset),this[dv]()}}sv=lv,av=cv,ov=Av;
|
||
|
|
/* @license
|
||
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/
|
||
|
|
const gv=Symbol("threeMaterial"),fv=Symbol("threeMaterials"),vv=Symbol("baseColorTexture"),_v=Symbol("metallicRoughnessTexture");class yv extends Lf{constructor(t,e){super(t,e);const{map:i,metalnessMap:n}=e.values().next().value;this[vv]=new mv(t,pv.Base,i,e),this[_v]=new mv(t,pv.MetallicRoughness,n,e)}get[fv](){return this[Rf]}get[gv](){var t;return null===(t=this[Rf])||void 0===t?void 0:t.values().next().value}get baseColorFactor(){const t=[0,0,0,this[gv].opacity];return this[gv].color.toArray(t),t}get metallicFactor(){return this[gv].metalness}get roughnessFactor(){return this[gv].roughness}get baseColorTexture(){return this[vv]}get metallicRoughnessTexture(){return this[_v]}setBaseColorFactor(t){const e=new an;t instanceof Array?e.fromArray(t):e.set(t);for(const i of this[fv])i.color.set(e),t instanceof Array&&t.length>3?i.opacity=t[3]:(t=[0,0,0,i.opacity],e.toArray(t));this[Df]()}setMetallicFactor(t){for(const e of this[fv])e.metalness=t;this[Df]()}setRoughnessFactor(t){for(const e of this[fv])e.roughness=t;this[Df]()}}
|
||
|
|
/* @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 Ev,xv;const Sv=Symbol("pbrMetallicRoughness"),Cv=Symbol("normalTexture"),Iv=Symbol("occlusionTexture"),Mv=Symbol("emissiveTexture"),wv=Symbol("backingThreeMaterial"),bv=Symbol("applyAlphaCutoff"),Tv=Symbol("getAlphaMode"),Bv=Symbol("lazyLoadGLTFInfo"),Rv=Symbol("initialize"),Dv=Symbol("getLoadedMaterial"),Lv=Symbol("ensureMaterialIsLoaded"),Uv=Symbol("gltfIndex"),Pv=Symbol("setActive"),Nv=Symbol("variantIndices"),Fv=Symbol("isActive"),Qv=Symbol("variantSet"),Ov=Symbol("modelVariants"),kv=Symbol("name"),Gv=Symbol("pbrTextures");class Hv extends Lf{constructor(t,e,i,n,r,s,a=void 0){super(t,r),this[Ev]=new Set,this[xv]=new Map,this[Uv]=e,this[Fv]=i,this[Ov]=n,this[kv]=s,null==a?this[Rv]():this[Bv]=a}get[(Ev=Qv,xv=Gv,wv)](){return this[Rf].values().next().value}[Rv](){const t=this[Df],e=this[Rf];this[Sv]=new yv(t,e);const{normalMap:i,aoMap:n,emissiveMap:r}=e.values().next().value;this[Cv]=new mv(t,pv.Normal,i,e),this[Iv]=new mv(t,pv.Occlusion,n,e),this[Mv]=new mv(t,pv.Emissive,r,e);const s=i=>{this[Gv].set(i,new mv(t,i,null,e))};s(pv.Clearcoat),s(pv.ClearcoatRoughness),s(pv.ClearcoatNormal),s(pv.SheenColor),s(pv.SheenRoughness),s(pv.Transmission),s(pv.Thickness),s(pv.Specular),s(pv.SpecularColor),s(pv.Iridescence),s(pv.IridescenceThickness),s(pv.Anisotropy)}async[Dv](){if(null!=this[Bv]){const{set:t,material:e}=await this[Bv].doLazyLoad();return this[Rf]=t,this[Rv](),this[Bv]=void 0,this.ensureLoaded=async()=>{},e}return this[Rf].values().next().value}colorFromRgb(t){const e=new an;return t instanceof Array?e.fromArray(t):e.set(t),e}[Lv](){if(null!=this[Bv])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[Dv]()}get isLoaded(){return null==this[Bv]}get isActive(){return this[Fv]}[Pv](t){this[Fv]=t}get name(){return this[kv]||""}set name(t){if(this[kv]=t,null!=this[Rf])for(const e of this[Rf])e.name=t}get pbrMetallicRoughness(){return this[Lv](),this[Sv]}get normalTexture(){return this[Lv](),this[Cv]}get occlusionTexture(){return this[Lv](),this[Iv]}get emissiveTexture(){return this[Lv](),this[Mv]}get emissiveFactor(){return this[Lv](),this[wv].emissive.toArray()}get index(){return this[Uv]}[Nv](){return this[Qv]}hasVariant(t){const e=this[Ov].get(t);return null!=e&&this[Qv].has(e.index)}setEmissiveFactor(t){this[Lv]();const e=this.colorFromRgb(t);for(const t of this[Rf])t.emissive.set(e);this[Df]()}[Tv](){return this[wv].transparent?"BLEND":this[wv].alphaTest>0?"MASK":"OPAQUE"}[bv](){this[Lv]();for(const t of this[Rf])"MASK"===this[Tv]()?null==t.alphaTest&&(t.alphaTest=.5):t.alphaTest=void 0,t.needsUpdate=!0}setAlphaCutoff(t){this[Lv]();for(const e of this[Rf])e.alphaTest=t,e.needsUpdate=!0;this[bv](),this[Df]()}getAlphaCutoff(){return this[Lv](),this[wv].alphaTest}setDoubleSided(t){this[Lv]();for(const e of this[Rf])e.side=t?c:o,e.needsUpdate=!0;this[Df]()}getDoubleSided(){return this[Lv](),this[wv].side==c}setAlphaMode(t){this[Lv]();const e=(t,e)=>{t.transparent=e,t.depthWrite=!e};for(const i of this[Rf])e(i,"BLEND"===t),i.alphaTest="MASK"===t?.5:void 0,i.needsUpdate=!0;this[Df]()}getAlphaMode(){return this[Lv](),this[Tv]()}get emissiveStrength(){return this[Lv](),this[wv].emissiveIntensity}setEmissiveStrength(t){this[Lv]();for(const e of this[Rf])e.emissiveIntensity=t;this[Df]()}get clearcoatFactor(){return this[Lv](),this[wv].clearcoat}get clearcoatRoughnessFactor(){return this[Lv](),this[wv].clearcoatRoughness}get clearcoatTexture(){return this[Lv](),this[Gv].get(pv.Clearcoat)}get clearcoatRoughnessTexture(){return this[Lv](),this[Gv].get(pv.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[Lv](),this[Gv].get(pv.ClearcoatNormal)}get clearcoatNormalScale(){return this[Lv](),this[wv].clearcoatNormalScale.x}setClearcoatFactor(t){this[Lv]();for(const e of this[Rf])e.clearcoat=t;this[Df]()}setClearcoatRoughnessFactor(t){this[Lv]();for(const e of this[Rf])e.clearcoatRoughness=t;this[Df]()}setClearcoatNormalScale(t){this[Lv]();for(const e of this[Rf])e.clearcoatNormalScale=new de(t,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.
|
||
|
|
*/var Wv,qv,Xv,jv,Yv,Kv;const Jv=Symbol("materials"),$v=Symbol("hierarchy"),Zv=Symbol("roots"),t_=Symbol("primitives"),e_=Symbol("prepareVariantsForExport"),i_=Symbol("switchVariant"),n_=Symbol("materialFromPoint"),r_=Symbol("nodeFromPoint"),s_=Symbol("nodeFromIndex"),a_=Symbol("variantData"),o_=Symbol("availableVariants"),l_=Symbol("modelOnUpdate"),c_=Symbol("cloneMaterial");class h_{constructor(t,e,i,n){this.gltf=t,this.gltfElementMap=e,this.mapKey=i,this.doLazyLoad=n}}class u_{constructor(t,e=(()=>{})){this[Wv]=new Array,this[qv]=new Array,this[Xv]=new Array,this[jv]=new Array,this[Yv]=()=>{},this[Kv]=new Map,this[l_]=e;const{gltf:i,threeGLTF:n,gltfElementMap:r}=t;for(const[t,s]of i.materials.entries()){const a=r.get(s);if(null!=a)this[Jv].push(new Hv(e,t,!0,this[a_],a,s.name));else{const o=(i.materials||[])[t],l=t,c=async()=>{const t=await n.parser.getDependency("material",l),e=new Set;return r.set(o,e),e.add(t),{set:e,material:t}};this[Jv].push(new Hv(e,t,!1,this[a_],a,s.name,new h_(i,r,o,c)))}}const s=new Map,a=new Array;for(const t of n.scene.children)a.push(t);for(;a.length>0;){const e=a.pop();let i=null;e instanceof Wn?(i=new Vv(e,this.materials,this[a_],t),this[t_].push(i)):i=new zv(e.name);const n=s.get(e);null!=n?n.children.push(i):this[Zv].push(i),this[$v].push(i);for(const t of e.children)a.push(t),s.set(e,i)}}get materials(){return this[Jv]}[(Wv=Jv,qv=$v,Xv=Zv,jv=t_,Yv=l_,Kv=a_,o_)](){const t=Array.from(this[a_].values());return t.sort(((t,e)=>t.index-e.index)),t.map((t=>t.name))}getMaterialByName(t){const e=this[Jv].filter((e=>e.name===t));return e.length>0?e[0]:null}[s_](t,e){const i=this[$v].find((i=>{if(i instanceof Vv){const{meshes:n,primitives:r}=i.mesh.userData.associations;if(n==t&&r==e)return!0}return!1}));return null==i?null:i}[r_](t){return this[$v].find((e=>{if(e instanceof Vv){if(e.mesh===t.object)return!0}return!1}))}[n_](t){return this[r_](t).getActiveMaterial()}async[i_](t){for(const e of this[t_])await e.enableVariant(t);for(const t of this.materials)t[Pv](!1);for(const t of this[t_])this.materials[t.getActiveMaterial().index][Pv](!0)}async[e_](){const t=new Array;for(const e of this[t_])t.push(e.instantiateVariants());await Promise.all(t)}[c_](t,e){const i=this.materials[t];i.isLoaded||console.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");const n=i[Rf],r=new Set;for(const[t,i]of n.entries()){const s=i.clone();s.name=e+(n.size>1?"_inst"+t:""),r.add(s)}const s=new Hv(this[l_],this[Jv].length,!1,this[a_],r,e);return this[Jv].push(s),s}createMaterialInstanceForVariant(t,e,i,n=!0){let r=null;for(const n of this[t_]){const s=this[a_].get(i);null!=s&&n.variantInfo.has(s.index)||null!=n.getMaterial(t)&&(this.hasVariant(i)||this.createVariant(i),null==r&&(r=this[c_](t,e)),n.addVariant(r,i))}if(n&&null!=r){r[Pv](!0),this.materials[t][Pv](!1);for(const t of this[t_])t.enableVariant(i)}return r}createVariant(t){this[a_].has(t)?console.warn(`Variant '${t}'' already exists`):this[a_].set(t,{name:t,index:this[a_].size})}hasVariant(t){return this[a_].has(t)}setMaterialToVariant(t,e){if(null!=this[o_]().find((t=>t===e)))if(t<0||t>=this.materials.length)console.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const i of this[t_]){const n=i.getMaterial(t);null!=n&&i.addVariant(n,e)}else console.warn(`Can't add material to '${e}', the variant does not exist.'`)}updateVariantName(t,e){const i=this[a_].get(t);null!=i&&(i.name=e,this[a_].set(e,i),this[a_].delete(t))}deleteVariant(t){const e=this[a_].get(t);if(null!=e){for(const i of this.materials)i.hasVariant(t)&&i[Qv].delete(e.index);for(const t of this[t_])t.deleteVariant(e.index);this[a_].delete(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.
|
||
|
|
*/var d_=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const A_=Symbol("currentGLTF"),p_=Symbol("originalGltfJson"),m_=Symbol("model"),g_=Symbol("getOnUpdateMethod"),f_=Symbol("buildTexture");
|
||
|
|
/* @license
|
||
|
|
* Copyright 2023 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/
|
||
|
|
class v_ extends Wn{constructor(){super(void 0,new hn({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(t){this.material.map=t}isUsable(){return this.height>0&&this.radius>0&&null!=this.geometry&&null!=this.map}updateGeometry(t=this.height,e=this.radius,i=128){t==this.height&&e==this.radius&&i==this.resolution||(this.height=t,this.radius=e,this.resolution=i,t>0&&e>0&&(this.geometry.dispose(),this.geometry=function(t,e,i){const n=new el(e,2*i,i);n.scale(1,1,-1);const r=n.getAttribute("position"),s=new ke;for(let e=0;e<r.count;++e)if(s.fromBufferAttribute(r,e),s.y<0){const i=3*-t/2,n=s.y<i?-t/s.y:1-s.y*s.y/(3*i*i);s.multiplyScalar(n),s.toArray(r.array,3*e)}return r.needsUpdate=!0,n}
|
||
|
|
/* @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.
|
||
|
|
*/(t,e,i)))}}const __=new ke,y_=new ke,E_=new ke,x_=new Ae,S_=new tn,C_=new Oe;class I_ extends uA{constructor(t){super(document.createElement("div")),this.normal=new ke(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=t.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(t.position),this.updateNormal(t.normal),this.surface=t.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(t){if(null==t)return;const e=Bp(t)[0].terms;for(let t=0;t<3;++t)this.position.setComponent(t,Gp(e[t]).number);this.updateMatrixWorld()}updateNormal(t){if(null==t)return;const e=Bp(t)[0].terms;for(let t=0;t<3;++t)this.normal.setComponent(t,e[t].number)}updateSurface(t){if(!t&&this.initialized)return;const{mesh:e,tri:i,bary:n}=this;if(null==e||null==i||null==n)return;e.getVertexPosition(i.x,__),e.getVertexPosition(i.y,y_),e.getVertexPosition(i.z,E_),__.toArray(x_.elements,0),y_.toArray(x_.elements,3),E_.toArray(x_.elements,6),this.position.copy(n).applyMatrix3(x_);const r=this.parent;r.worldToLocal(e.localToWorld(this.position)),S_.set(__,y_,E_),S_.getNormal(this.normal).transformDirection(e.matrixWorld);const s=r.parent;C_.setFromAxisAngle(__.set(0,1,0),-s.yaw),this.normal.applyQuaternion(C_)}orient(t){this.pivot.style.transform=`rotate(${t}rad)`}updateVisibility(t){this.element.classList.toggle("hide",!t),this.slot.assignedNodes().forEach((e=>{if(e.nodeType!==Node.ELEMENT_NODE)return;const i=e,n=i.dataset.visibilityAttribute;if(null!=n){const e=`data-${n}`;i.toggleAttribute(e,t)}i.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:t}}))})),this.initialized=!0}}const M_={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},w_={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += textur
|
||
|
|
/* @license
|
||
|
|
* Copyright 2022 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/class T_ extends zi{constructor(t,e,i){super(),this.camera=new Br,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new ka,this.horizontalBlurMaterial=new $n(M_),this.verticalBlurMaterial=new $n(w_),this.intensity=0,this.softness=1,this.boundingBox=new ze,this.size=new ke,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:n}=this;n.rotation.x=Math.PI/2,n.left=-.5,n.right=.5,n.bottom=-.5,n.top=.5,this.add(n);const r=new fr,s=new hn({opacity:1,transparent:!0,side:l});this.floor=new Wn(r,s),this.floor.userData.noHit=!0,n.add(this.floor),this.blurPlane=new Wn(r),this.blurPlane.visible=!1,n.add(this.blurPlane),t.target.add(this),this.depthMaterial.onBeforeCompile=function(t){t.fragmentShader=t.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(t,e,i)}setScene(t,e,i){const{boundingBox:n,size:r,rotation:s,position:a}=this;if(this.isAnimated=t.animationNames.length>0,this.boundingBox.copy(t.boundingBox),this.size.copy(t.size),this.maxDimension=Math.max(r.x,r.y,r.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(a),"back"===i){const{min:t,max:e}=n;[t.y,t.z]=[t.z,t.y],[e.y,e.z]=[e.z,e.y],[r.y,r.z]=[r.z,r.y],s.x=Math.PI/2,s.y=Math.PI}else s.x=0,s.y=0;if(this.isAnimated){const t=n.min.y,e=n.max.y;r.y=this.maxDimension,n.expandByVector(r.subScalar(this.maxDimension).multiplyScalar(-.5)),n.min.y=t,n.max.y=e,r.set(this.maxDimension,e-t,this.maxDimension)}"bottom"===i?a.y=n.min.y:a.z=n.min.y,this.setSoftness(e)}setSoftness(t){this.softness=t;const{size:e,camera:i}=this,n=this.isAnimated?2:1,r=n*Math.pow(2,9-3*t);this.setMapSize(r);const s=e.y/2,a=e.y*n;i.near=0,i.far=b_(a,s,t),this.depthMaterial.opacity=1/t,i.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(t){const{size:e}=this;this.isAnimated&&(t*=2);const i=Math.floor(e.x>e.z?t:t*e.x/e.z),n=Math.floor(e.x>e.z?t*e.z/e.x:t),r=10+i,s=10+n;if(null==this.renderTarget||this.renderTarget.width===r&&this.renderTarget.height===s||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const t={format:at};this.renderTarget=new Ne(r,s,t),this.renderTargetBlur=new Ne(r,s,t),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(e.x*(1+10/i),e.z*(1+10/n),1),this.needsUpdate=!0}setIntensity(t){this.intensity=t,t>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=t*b_(.3,1,this.softness*this.softness)):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.intensity}setOffset(t){this.floor.position.z=-t+this.gap()}gap(){return.001*this.maxDimension}render(t,e){e.overrideMaterial=this.depthMaterial;const i=t.getClearAlpha();t.setClearAlpha(0),this.floor.visible=!1;const n=t.xr.enabled;t.xr.enabled=!1;const r=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.render(e,this.camera),e.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(t),t.xr.enabled=n,t.setRenderTarget(r),t.setClearAlpha(i)}blurShadow(t){const{camera:e,horizontalBlurMaterial:i,verticalBlurMaterial:n,renderTarget:r,renderTargetBlur:s,blurPlane:a}=this;a.visible=!0,a.material=i,i.uniforms.h.value=1/this.renderTarget.width,i.uniforms.tDiffuse.value=this.renderTarget.texture,t.setRenderTarget(s),t.render(a,e),a.material=n,n.uniforms.v.value=1/this.renderTarget.height,n.uniforms.tDiffuse.value=this.renderTargetBlur.texture,t.setRenderTarget(r),t.render(a,e),a.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/const B_=new ke,R_=new ke,D_=new ke,L_=new class{constructor(t,e,i=0,n=1/0){this.ray=new mi(t,e),this.near=i,this.far=n,this.camera=null,this.layers=new wi,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return lc.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(lc),this}intersectObject(t,e=!0,i=[]){return hc(t,this,i,e),i.sort(cc),i}intersectObjects(t,e=!0,i=[]){for(let n=0,r=t.length;n<r;n++)hc(t[n],this,i,e);return i.sort(cc),i}},U_=new ke,P_=new de;class N_ extends no{constructor({canvas:t,element:e,width:i,height:n}){super(),this.annotationRenderer=new fA,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 nr(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new zi,this.animationNames=[],this.boundingBox=new ze,this.boundingSphere=new oi,this.size=new ke,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=P,this.canScale=!0,this.isDirty=!1,this.goalTarget=new ke,this.targetDamperX=new Sp,this.targetDamperY=new Sp,this.targetDamperZ=new Sp,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new v_,this.name="ModelScene",this.element=e,this.canvas=t,this.camera=new nr(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(i,n),this.target.name="Target",this.mixer=new ac(this.target);const{domElement:r}=this.annotationRenderer,{style:s}=r;s.display="none",s.pointerEvents="none",s.position="absolute",s.top="0",this.element.shadowRoot.querySelector(".default").appendChild(r),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(t){this.reset(),this._model=t,this.target.add(t),await this.setupScene()}async setSource(t,e=(()=>{})){if(!t||t===this.url)return void e(1);if(this.reset(),this.url=t,null!=this.externalRenderer){const t=await this.externalRenderer.load(e);return this.boundingSphere.radius=t.framedRadius,void(this.idealAspect=t.fieldOfViewAspect)}let i;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{i=await new Promise((async(i,n)=>{this.cancelPendingSourceChange=()=>n();try{i(await this.element[wy].loader.load(t,this.element,e))}catch(t){n(t)}}))}catch(t){if(null==t)return;throw t}this.cancelPendingSourceChange=null,this.reset(),this.url=t,this._currentGLTF=i,null!=i&&(this._model=i.scene,this.target.add(i.scene));const{animations:n}=i,r=new Map,s=[];for(const t of n)r.set(t.name,t),s.push(t.name);this.animations=n,this.animationsByName=r,this.animationNames=s,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();const{_model:t}=this;null!=t&&(t.removeFromParent(),this._model=null);const e=this._currentGLTF
|
||
|
|
/* @license
|
||
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
||
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||
|
|
* you may not use this file except in compliance with the License.
|
||
|
|
* You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
|
* See the License for the specific language governing permissions and
|
||
|
|
* limitations under the License.
|
||
|
|
*/class F_ extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(t){const e={progress:0,completed:!1};return this.ongoingActivities.add(e),1===this.ongoingActivityCount&&this.announceTotalProgress(e,0,t),i=>{let n;return n=Math.max(Yh(i,0,1),e.progress),n!==e.progress&&this.announceTotalProgress(e,n,t),e.progress}}announceTotalProgress(t,e,i){let n=0,r=0;1==e&&(t.completed=!0);for(const t of this.ongoingActivities){const{progress:e}=t;n+=1-e,t.completed&&r++}const s=t.progress;t.progress=e,this.totalProgress+=(e-s)*(1-this.totalProgress)/n;const a=r===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:a,reason:i}})),r===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 Q_,O_,k_,G_,H_,z_,V_,W_,q_,X_,j_,Y_,K_,J_=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const $_=document.createElement("canvas"),Z_=Symbol("fallbackResizeHandler"),ty=Symbol("defaultAriaLabel"),ey=Symbol("resizeObserver"),iy=Symbol("clearModelTimeout"),ny=Symbol("onContextLost"),ry=Symbol("loaded"),sy=Symbol("status"),ay=Symbol("onFocus"),oy=Symbol("onBlur"),ly=Symbol("updateSize"),cy=Symbol("intersectionObserver"),hy=Symbol("isElementInViewport"),uy=Symbol("announceModelVisibility"),dy=Symbol("ariaLabel"),Ay=Symbol("altDefaulted"),py=Symbol("statusElement"),my=Symbol("updateStatus"),gy=Symbol("loadedTime"),fy=Symbol("updateSource"),vy=Symbol("markLoaded"),_y=Symbol("container"),yy=Symbol("input"),Ey=Symbol("canvas"),xy=Symbol("scene"),Sy=Symbol("needsRender"),Cy=Symbol("tick"),Iy=Symbol("onModelLoad"),My=Symbol("onResize"),wy=Symbol("renderer"),by=Symbol("progressTracker"),Ty=Symbol("getLoaded"),By=Symbol("getModelIsVisible"),Ry=Symbol("shouldAttemptPreload"),Dy=t=>({x:t.x,y:t.y,z:t.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),Ly=t=>({u:t.x,v:t.y,toString(){return`${this.u} ${this.v}`}});class Uy extends bh{constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[Q_]=!1,this[O_]=!1,this[k_]=0,this[G_]="",this[H_]=null,this[z_]=jh((()=>{const t=this.getBoundingClientRect();this[ly](t)}),50),this[V_]=jh((t=>{const e=this.modelIsVisible;e!==t&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:e}}))}),0),this[W_]=null,this[q_]=null,this[X_]=new F_,this[j_]=()=>{this[py].textContent=this[sy]},this[Y_]=()=>{this[py].textContent=""},this[K_]=t=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:t.sourceEvent}}))},this.attachShadow({mode:"open"});const t=this.shadowRoot;let e,i;if((t=>{dh(nu,t)})(t),this[_y]=t.querySelector(".container"),this[yy]=t.querySelector(".userInput"),this[Ey]=t.querySelector("canvas"),this[py]=t.querySelector("#status"),this[ty]=this[yy].getAttribute("aria-label"),this.isConnected){const t=this.getBoundingClientRect();e=t.width,i=t.height}else e=300,i=150;this[xy]=new N_({canvas:this[Ey],element:this,width:e,height:i}),Promise.resolve().then((()=>{this[ly](this.getBoundingClientRect())})),Ph&&(this[ey]=new ResizeObserver((t=>{if(!this[wy].isPresenting)for(let e of t)e.target===this&&this[ly](e.contentRect)}))),Nh?this[cy]=new IntersectionObserver((t=>{for(let e of t)if(e.target===this){const t=this.modelIsVisible;this[hy]=e.isIntersecting,this[uy](t),this[hy]&&!this.loaded&&this[fy]()}}),{root:null,rootMargin:"0px",threshold:1e-5}):this[hy]=!0}static get is(){return"model-viewer"}static set modelCacheSize(t){hA[lA].evictionThreshold=t}static get modelCacheSize(){return hA[lA].evictionThreshold}static set minimumRenderScale(t){t>1&&console.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),t<=0&&console.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),Bf.singleton.minScale=t}static get minimumRenderScale(){return Bf.singleton.minScale}get loaded(){return this[Ty]()}get[(Q_=hy,O_=ry,k_=gy,G_=sy,H_=iy,z_=Z_,V_=uy,W_=ey,q_=cy,X_=by,wy)](){return Bf.singleton}get modelIsVisible(){return this[By]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),Ph?this[ey].observe(this):self.addEventListener("resize",this[Z_]),Nh&&this[cy].observe(this),this.addEventListener("focus",this[ay]),this.addEventListener("blur",this[oy]);const t=this[wy];t.addEventListener("contextlost",this[ny]),t.registerScene(this[xy]),null!=this[iy]&&(self.clearTimeout(this[iy]),this[iy]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),Ph?this[ey].unobserve(this):self.removeEventListener("resize",this[Z_]),Nh&&this[cy].unobserve(this),this.removeEventListener("focus",this[ay]),this.removeE
|
||
|
|
/* @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 Py=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const Ny=Symbol("changeAnimation"),Fy=Symbol("paused"),Qy={repetitions:1/0,pingpong:!1},Oy=Symbol("hotspotMap"),ky=Symbol("mutationCallback"),Gy=Symbol("observer"),Hy=Symbol("addHotspot"),zy=Symbol("removeHotspot"),Vy=new gi;
|
||
|
|
/*!
|
||
|
|
fflate - fast JavaScript compression/decompression
|
||
|
|
<https://101arrowz.github.io/fflate>
|
||
|
|
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
|
||
|
|
version 0.8.2
|
||
|
|
*/
|
||
|
|
var Wy=Uint8Array,qy=Uint16Array,Xy=Int32Array,jy=new Wy([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]),Yy=new Wy([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]),Ky=new Wy([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jy=function(t,e){for(var i=new qy(31),n=0;n<31;++n)i[n]=e+=1<<t[n-1];var r=new Xy(i[30]);for(n=1;n<30;++n)for(var s=i[n];s<i[n+1];++s)r[s]=s-i[n]<<5|n;return{b:i,r:r}},$y=Jy(jy,2),Zy=$y.b,tE=$y.r;Zy[28]=258,tE[258]=28;for(var eE=Jy(Yy,0).r,iE=new qy(32768),nE=0;nE<32768;++nE){var rE=(43690&nE)>>1|(21845&nE)<<1;rE=(61680&(rE=(52428&rE)>>2|(13107&rE)<<2))>>4|(3855&rE)<<4,iE[nE]=((65280&rE)>>8|(255&rE)<<8)>>1}var sE=function(t,e,i){for(var n=t.length,r=0,s=new qy(e);r<n;++r)t[r]&&++s[t[r]-1];var a,o=new qy(e);for(r=1;r<e;++r)o[r]=o[r-1]+s[r-1]<<1;if(i){a=new qy(1<<e);var l=15-e;for(r=0;r<n;++r)if(t[r])for(var c=r<<4|t[r],h=e-t[r],u=o[t[r]-1]++<<h,d=u|(1<<h)-1;u<=d;++u)a[iE[u]>>l]=c}else for(a=new qy(n),r=0;r<n;++r)t[r]&&(a[r]=iE[o[t[r]-1]++]>>15-t[r]);return a},aE=new Wy(288);for(nE=0;nE<144;++nE)aE[nE]=8;for(nE=144;nE<256;++nE)aE[nE]=9;for(nE=256;nE<280;++nE)aE[nE]=7;for(nE=280;nE<288;++nE)aE[nE]=8;var oE=new Wy(32);for(nE=0;nE<32;++nE)oE[nE]=5;var lE=sE(aE,9,0),cE=sE(oE,5,0),hE=function(t){return(t+7)/8|0},uE=function(t,e,i){return(null==e||e<0)&&(e=0),(null==i||i>t.length)&&(i=t.length),new Wy(t.subarray(e,i))},dE=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],AE=function(t,e,i){var n=new Error(e||dE[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,AE),!i)throw n;return n},pE=function(t,e,i){i<<=7&e;var n=e/8|0;t[n]|=i,t[n+1]|=i>>8},mE=function(t,e,i){i<<=7&e;var n=e/8|0;t[n]|=i,t[n+1]|=i>>8,t[n+2]|=i>>16},gE=function(t,e){for(var i=[],n=0;n<t.length;++n)t[n]&&i.push({s:n,f:t[n]});var r=i.length,s=i.slice();if(!r)return{t:SE,l:0};if(1==r){var a=new Wy(i[0].s+1);return a[i[0].s]=1,{t:a,l:1}}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var o=i[0],l=i[1],c=0,h=1,u=2;for(i[0]={s:-1,f:o.f+l.f,l:o,r:l};h!=r-1;)o=i[i[c].f<i[u].f?c++:u++],l=i[c!=h&&i[c].f<i[u].f?c++:u++],i[h++]={s:-1,f:o.f+l.f,l:o,r:l};var d=s[0].s;for(n=1;n<r;++n)s[n].s>d&&(d=s[n].s);var A=new qy(d+1),p=fE(i[h-1],A,0);if(p>e){n=0;var m=0,g=p-e,f=1<<g;for(s.sort((function(t,e){return A[e.s]-A[t.s]||t.f-e.f}));n<r;++n){var v=s[n].s;if(!(A[v]>e))break;m+=f-(1<<p-A[v]),A[v]=e}for(m>>=g;m>0;){var _=s[n].s;A[_]<e?m-=1<<e-A[_]++-1:++n}for(;n>=0&&m;--n){var y=s[n].s;A[y]==e&&(--A[y],++m)}p=e}return{t:new Wy(A),l:p}},fE=function(t,e,i){return-1==t.s?Math.max(fE(t.l,e,i+1),fE(t.r,e,i+1)):e[t.s]=i},vE=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new qy(++e),n=0,r=t[0],s=1,a=function(t){i[n++]=t},o=1;o<=e;++o)if(t[o]==r&&o!=e)++s;else{if(!r&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(r),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(r);s=1,r=t[o]}return{c:i.subarray(0,n),n:e}},_E=function(t,e){for(var i=0,n=0;n<e.length;++n)i+=t[n]*e[n];return i},yE=function(t,e,i){var n=i.length,r=hE(e+2);t[r]=255&n,t[r+1]=n>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var s=0;s<n;++s)t[r+s+4]=i[s];return 8*(r+4+n)},EE=function(t,e,i,n,r,s,a,o,l,c,h){pE(e,h++,i),++r[256];for(var u=gE(r,15),d=u.t,A=u.l,p=gE(s,15),m=p.t,g=p.l,f=vE(d),v=f.c,_=f.n,y=vE(m),E=y.c,x=y.n,S=new qy(19),C=0;C<v.length;++C)++S[31&v[C]];for(C=0;C<E.length;++C)++S[31&E[C]];for(var I=gE(S,7),M=I.t,w=I.l,b=19;b>4&&!M[Ky[b-1]];--b);var T,B,R,D,L=c+5<<3,U=_E(r,aE)+_E(s,oE)+a,P=_E(r,d)+_E(s,m)+a+14+3*b+_E(S,M)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&L<=U&&L<=P)return yE(e,h,t.subarray(l,l+c));if(pE(e,h,1+(P<U)),h+=2,P<U){T=sE(d,A,0),B=d,R=sE(m,g,0),D=m;var N=sE(M,w,0);pE(e,h,_-257),pE(e,h+5,x-1),pE(e,h+10,b-4),h+=14;for(C=0;C<b;++C)pE(e,h+3*C,M[Ky[C]]);h+=3*b;for(var F=[v,E],Q=0;Q<2;++Q){var O=F[Q];for(C=0;C<O.length;++C){var k=31&O[C];pE(e,h,
|
||
|
|
/* @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.
|
||
|
|
*/(t))})),r+="\n\t\t}\n\t}\n}\n\n",r+=function(t,e,i=!1){const n=[];for(const r in t){const s=t[r];n.push(WE(s,e,i))}return`def "Materials"\n{\n${n.join("")}\n}\n\n`}(s,a,e.quickLookCompatible),i[n]=LE(r),r=null;for(const t in a){let n=a[t];!0===n.isCompressedTexture&&(n=SA(n));const r=QE(n.image,n.flipY,e.maxTextureSize),s=await new Promise((t=>r.toBlob(t,"image/png",1)));i[`textures/Texture_${t}.png`]=new Uint8Array(await s.arrayBuffer())}let o=0;for(const t in i){const e=i[t];o+=34+t.length;const n=63&o;if(4!==n){const r=new Uint8Array(64-n);i[t]=[e,{extra:{12345:r}}]}o=e.length}return NE(i,{level:0})}}function QE(t,e,i){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=i/Math.max(t.width,t.height),r=document.createElement("canvas");r.width=t.width*Math.min(1,n),r.height=t.height*Math.min(1,n);const s=r.getContext("2d");return!0===e&&(s.translate(0,r.height),s.scale(1,-1)),s.drawImage(t,0,0,r.width,r.height),r}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const OE=7;function kE(){return'#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = "Three.js USDZExporter"\n\t}\n\tdefaultPrim = "Root"\n\tmetersPerUnit = 1\n\tupAxis = "Y"\n)\n\n'}function GE(t){const e=t.elements;return`( ${HE(e,0)}, ${HE(e,4)}, ${HE(e,8)}, ${HE(e,12)} )`}function HE(t,e){return`(${t[e+0]}, ${t[e+1]}, ${t[e+2]}, ${t[e+3]})`}function zE(t,e){if(void 0===t)return console.warn("USDZExporter: Normals missing."),Array(e).fill("(0, 0, 0)").join(", ");const i=[];for(let e=0;e<t.count;e++){const n=t.getX(e),r=t.getY(e),s=t.getZ(e);i.push(`(${n.toPrecision(OE)}, ${r.toPrecision(OE)}, ${s.toPrecision(OE)})`)}return i.join(", ")}function VE(t){const e=[];for(let i=0;i<t.count;i++){const n=t.getX(i),r=t.getY(i);e.push(`(${n.toPrecision(OE)}, ${1-r.toPrecision(OE)})`)}return e.join(", ")}function WE(t,e,i=!1){const n="\t\t\t",r=[],s=[];function a(n,r,s){const a=n.source.id+"_"+n.flipY;e[a]=n;const o=n.channel>0?"st"+n.channel:"st",l={1e3:"repeat",1001:"clamp",1002:"mirror"},c=n.repeat.clone(),h=n.offset.clone(),u=n.rotation,d=Math.sin(u),A=Math.cos(u);return h.y=1-h.y-c.y,i?(h.x=h.x/c.x,h.y=h.y/c.y,h.x+=d/c.x,h.y+=A-1):(h.x+=d*c.x,h.y+=(1-A)*c.y),`\n\t\tdef Shader "PrimvarReader_${r}"\n\t\t{\n\t\t\tuniform token info:id = "UsdPrimvarReader_float2"\n\t\t\tfloat2 inputs:fallback = (0.0, 0.0)\n\t\t\ttoken inputs:varname = "${o}"\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Transform2d_${r}"\n\t\t{\n\t\t\tuniform token info:id = "UsdTransform2d"\n\t\t\ttoken inputs:in.connect = </Materials/Material_${t.id}/PrimvarReader_${r}.outputs:result>\n\t\t\tfloat inputs:rotation = ${(u*(180/Math.PI)).toFixed(OE)}\n\t\t\tfloat2 inputs:scale = ${XE(c)}\n\t\t\tfloat2 inputs:translation = ${XE(h)}\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Texture_${n.id}_${r}"\n\t\t{\n\t\t\tuniform token info:id = "UsdUVTexture"\n\t\t\tasset inputs:file = @textures/Texture_${a}.png@\n\t\t\tfloat2 inputs:st.connect = </Materials/Material_${t.id}/Transform2d_${r}.outputs:result>\n\t\t\t${void 0!==s?"float4 inputs:scale = "+function(t){return`(${t.r}, ${t.g}, ${t.b}, 1.0)`}(s):""}\n\t\t\ttoken inputs:sourceColorSpace = "${n.colorSpace===Dt?"raw":"sRGB"}"\n\t\t\ttoken inputs:wrapS = "${l[n.wrapS]}"\n\t\t\ttoken inputs:wrapT = "${l[n.wrapT]}"\n\t\t\tfloat outputs:r\n\t\t\tfloat outputs:g\n\t\t\tfloat outputs:b\n\t\t\tfloat3 outputs:rgb\n\t\t\t${t.transparent||t.alphaTest>0?"float outputs:a":""}\n\t\t}`}return t.side===c&&console.warn("THREE.USDZExporter: USDZ does not support double sided materials",t),null!==t.map?(r.push(`${n}color3f inputs:diffuseColor.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:rgb>`),t.transparent?r.push(`${n}float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:a>`):t.alphaTest>0&&(r.push(`${n}float inputs
|
||
|
|
/* @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 jE=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let YE=!1,KE=!1;const JE="#model-viewer-no-ar-fallback",$E=(ZE=["quick-look","scene-viewer","webxr","none"],t=>{try{const e=Bp(t),i=(e.length?e[0].terms:[]).filter((t=>t&&"ident"===t.type)).map((t=>t.value)).filter((t=>ZE.indexOf(t)>-1));return new Set(i)}catch(t){}return new Set});var ZE;const tx="quick-look",ex="scene-viewer",ix="webxr",nx="none",rx=Symbol("arButtonContainer"),sx=Symbol("enterARWithWebXR"),ax=Symbol("openSceneViewer"),ox=Symbol("openIOSARQuickLook"),lx=Symbol("canActivateAR"),cx=Symbol("arMode"),hx=Symbol("arModes"),ux=Symbol("arAnchor"),dx=Symbol("preload"),Ax=Symbol("onARButtonContainerClick"),px=Symbol("onARStatus"),mx=Symbol("onARTracking"),gx=Symbol("onARTap"),fx=Symbol("selectARMode"),vx=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 _x=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const yx="auto",Ex="auto",xx="eager",Sx=Symbol("defaultProgressBarElement"),Cx=Symbol("posterContainerElement"),Ix=Symbol("defaultPosterElement"),Mx=Symbol("shouldDismissPoster"),wx=Symbol("hidePoster"),bx=Symbol("modelIsRevealed"),Tx=Symbol("updateProgressBar"),Bx=Symbol("ariaLabelCallToAction"),Rx=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 Dx=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const Lx=Math.PI/32,Ux={basis:[Op(Tp(Lx,"rad"))],keywords:{auto:[null]}},Px=Symbol("autoRotateStartTime"),Nx=Symbol("radiansPerSecond"),Fx=Symbol("syncRotationRate"),Qx=Symbol("onCameraChange"),Ox=(t=>{var e,i,n;class r extends t{constructor(){super(...arguments),this[e]=new Map,this[i]=t=>{t.forEach((t=>{t instanceof MutationRecord&&"childList"!==t.type||(t.addedNodes.forEach((t=>{this[Hy](t)})),t.removedNodes.forEach((t=>{this[zy](t)})),this[Sy]())}))},this[n]=new MutationObserver(this[ky])}connectedCallback(){super.connectedCallback();for(let t=0;t<this.children.length;++t)this[Hy](this.children[t]);const{ShadyDOM:t}=self;null==t?this[Gy].observe(this,{childList:!0}):this[Gy]=t.observeChildren(this,this[ky])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:t}=self;null==t?this[Gy].disconnect():t.unobserveChildren(this[Gy])}[(e=Oy,i=ky,n=Gy,Cy)](t,e){super[Cy](t,e);const i=this[xy],{annotationRenderer:n}=i,r=i.getCamera();i.shouldRender()&&(i.updateSurfaceHotspots(),i.updateHotspotsVisibility(r.position),n.domElement.style.display="",n.render(i,r))}updateHotspot(t){const e=this[Oy].get(t.name);null!=e&&(e.updatePosition(t.position),e.updateNormal(t.normal),e.surface=t.surface,this[Sy]())}queryHotspot(t){const e=this[Oy].get(t);if(null==e)return null;const i=Dy(e.position),n=Dy(e.normal),r=e.facingCamera,s=this[xy],a=s.getCamera(),o=new ke;o.setFromMatrixPosition(e.matrixWorld),o.project(a);const l=s.width/2,c=s.height/2;o.x=o.x*l+l,o.y=-o.y*c+c;const h=Dy(new ke(o.x,o.y,o.z));return Number.isFinite(h.x)&&Number.isFinite(h.y)?{position:i,normal:n,canvasPosition:h,facingCamera:r}:null}positionAndNormalFromPoint(t,e){const i=this[xy],n=i.getNDC(t,e),r=i.positionAndNormalFromPoint(n);if(null==r)return null;Vy.copy(i.target.matrixWorld).invert();const s=Dy(r.position.applyMatrix4(Vy)),a=Dy(r.normal.transformDirection(Vy));let o=null;return null!=r.uv&&(o=Ly(r.uv)),{position:s,normal:a,uv:o}}surfaceFromPoint(t,e){const i=this[xy],n=i.getNDC(t,e);return i.surfaceFromPoint(n)}[Hy](t){if(!(t instanceof HTMLElement&&0===t.slot.indexOf("hotspot")))return;let e=this[Oy].get(t.slot);null!=e?e.increment():(e=new I_({name:t.slot,position:t.dataset.position,normal:t.dataset.normal,surface:t.dataset.surface}),this[Oy].set(t.slot,e),this[xy].addHotspot(e)),this[xy].queueRender()}[zy](t){if(!(t instanceof HTMLElement))return;const e=this[Oy].get(t.slot);e&&(e.decrement()&&(this[xy].removeHotspot(e),this[Oy].delete(t.slot)),this[xy].queueRender())}}return r})((t=>{var i,n,r;class s extends t{constructor(){super(...arguments),this[i]=void 0,this[n]=null,this[r]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[m_]}get availableVariants(){return this.model?this.model[o_]():[]}get originalGltfJson(){return this[p_]}[(i=m_,n=A_,r=p_,g_)](){return()=>{this[Sy]()}}[f_](t){return t.colorSpace=Lt,t.wrapS=W,t.wrapT=W,new rv(this[g_](),t)}async createTexture(t,e="image/png"){const{textureUtils:i}=this[wy],n=await i.loadImage(t);return n.userData.mimeType=e,this[f_](n)}async createLottieTexture(t,e=1){const{textureUtils:i}=this[wy],n=await i.loadLottie(t,e);return this[f_](n)}createVideoTexture(t){const e=document.createElement("video");e.crossOrigin=this.withCredentials?"use-credentials":"anonymous",e.src=t,e.muted=!0,e.playsInline=!0,e.loop=!0,e.play();const i=new Ko(e);return this[f_](i)}createCanvasTexture(){const t=document.createElement("canvas"),e=new tl(t);return this[f_](e)}async updated(t){if(super.updated(t),t.has("variantName")){const t=this[by].beginActivity("variant-update");t(.1);const e=this[m_],{variantName:i}=this;null!=e&&(await e[i_](i),this[Sy](),this.dispatchEvent(new CustomEvent("variant-applied"))),t(1)}if(t.has("orientation")||t.has("scale")){if(!this.loaded)return;const t=this[xy];t.applyTransform(),t.updateBoundingBox(),t.updateShadow(
|
||
|
|
//# sourceMappingURL=model-viewer.min.js.map
|