odoo-ide / pycharm-odoo

PyCharm plugin for Odoo
https://plugins.jetbrains.com/plugin/13499-odoo
Other
44 stars 5 forks source link

com.intellij.psi.stubs.UpToDateStubIndexMismatch: PSI and index do not match #403

Closed jcfernandez-890825 closed 1 year ago

jcfernandez-890825 commented 1 year ago
   Error during processing of: oidc-client.js

   com.intellij.psi.stubs.UpToDateStubIndexMismatch: PSI and index do not match.
Please report the problem to JetBrains with the files attached
INDEXED VERSION IS THE CURRENT ONE file=JSFile:model-viewer.min.js, file.class=class com.intellij.lang.javascript.psi.impl.JSFileImpl, file.lang=Language: ECMAScript 6, modStamp=1
 tree consistent
 stub debugInfo=created in getStubTree(), with AST = false; with backReference
 viewProvider=com.intellij.lang.javascript.JSFileViewProviderFactory$JSFileViewProvider{vFile=file:///home/batman/Projects/Python3/odoo14e/src/OCA/web/setup/web_widget_model_viewer/odoo/addons/web_widget_model_viewer/static/lib/model-viewer.min.js, vFileId=274952, content=VirtualFileContent{size=887203}, eventSystemEnabled=true}
 viewProvider stamp: 0; file stamp: 0; file modCount: 1652455755815; file length: 887203
 doc saved: true; doc stamp: 0; doc size: 887203; committed: true
indexing info: indexing timestamp = 1652455755815, binary = false, byte size = 887203, char size = 887203
latestIndexedStub=StubTree{myDebugInfo='created from index; with backReference', myRoot=JSFileStubImpl}2037136249
   same size=true
   debugInfo=created from index; with backReference
    at com.intellij.psi.stubs.StubTreeLoader.handleUpToDateMismatch(StubTreeLoader.java:209)
    at com.intellij.psi.stubs.StubTreeLoader.access$100(StubTreeLoader.java:28)
    at com.intellij.psi.stubs.StubTreeLoader$StubTreeAndIndexUnmatchCoarseException.doCreateCompleteException(StubTreeLoader.java:201)
    at com.intellij.psi.stubs.StubTreeLoader$StubTreeAndIndexUnmatchCoarseException.lambda$createCompleteException$0(StubTreeLoader.java:177)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$4(CoreProgressManager.java:230)
    at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:64)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:230)
    at com.intellij.psi.stubs.StubTreeLoader$StubTreeAndIndexUnmatchCoarseException.createCompleteException(StubTreeLoader.java:176)
    at com.intellij.psi.impl.source.PsiFileImpl.loadTreeElement(PsiFileImpl.java:228)
    at com.intellij.psi.impl.source.PsiFileImpl.calcTreeElement(PsiFileImpl.java:727)
    at com.intellij.extapi.psi.StubBasedPsiElementBase.getNode(StubBasedPsiElementBase.java:127)
    at com.intellij.lang.javascript.psi.impl.JSVariableBaseImpl.getInitializer(JSVariableBaseImpl.java:146)
    at com.intellij.lang.javascript.psi.impl.JSParameterImpl.calculateIsOptional(JSParameterImpl.java:90)
    at com.intellij.lang.javascript.index.gist.JSParameterData.initFromPsi(JSParameterData.java:29)
    at com.intellij.lang.javascript.index.gist.JSParameterData.<init>(JSParameterData.java:25)
    at com.intellij.lang.javascript.index.gist.JSParameterGistProvider.calculate(JSParameterGistProvider.java:14)
    at com.intellij.lang.javascript.index.gist.JSParameterGistProvider.calculate(JSParameterGistProvider.java:10)
    at com.intellij.lang.javascript.index.gist.JSStubElementGist.lambda$getDataFromPsi$0(JSStubElementGist.java:188)
    at com.intellij.psi.util.CachedValuesManager$1.compute(CachedValuesManager.java:158)
    at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:37)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:27)
    at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:69)
    at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:155)
    at com.intellij.lang.javascript.index.gist.JSStubElementGist.lambda$getDataFromPsi$1(JSStubElementGist.java:188)
    at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:159)
    at com.intellij.util.AstLoadingFilter.forceAllowTreeLoading(AstLoadingFilter.java:151)
    at com.intellij.lang.javascript.index.gist.JSStubElementGist.getDataFromPsi(JSStubElementGist.java:187)
    at com.intellij.lang.javascript.index.gist.JSStubElementGist.getData(JSStubElementGist.java:155)
    at com.intellij.lang.javascript.index.gist.JSStubElementGist.getData(JSStubElementGist.java:116)
    at com.intellij.lang.javascript.psi.impl.JSCachingTypeOwner.lambda$static$0(JSCachingTypeOwner.java:32)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:31)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:21)
    at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:82)
    at com.intellij.lang.javascript.psi.impl.JSStubElementImpl.getCachedValueStubBuildOptimized(JSStubElementImpl.java:366)
    at com.intellij.lang.javascript.psi.impl.JSCachingTypeOwner.getJSType(JSCachingTypeOwner.java:92)
    at com.intellij.lang.javascript.psi.resolve.JSQualifiedNameResolver.lambda$expandElement$2(JSQualifiedNameResolver.java:266)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.lang.javascript.psi.resolve.JSQualifiedNameResolver.expandElement(JSQualifiedNameResolver.java:239)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.stream.DistinctOps$1$2.accept(DistinctOps.java:174)
    at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:720)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
    at com.intellij.lang.javascript.psi.resolve.JSQualifiedNameResolver.expandElements(JSQualifiedNameResolver.java:226)
    at com.intellij.lang.javascript.psi.resolve.JSQualifiedNameResolver.getExpandedTopLevelElements(JSQualifiedNameResolver.java:187)
    at com.intellij.lang.javascript.psi.resolve.JSQualifiedNameResolver.resolveByComponents(JSQualifiedNameResolver.java:127)
    at com.intellij.lang.javascript.psi.resolve.JSQualifiedNameResolver.resolveQualifiedName(JSQualifiedNameResolver.java:70)
    at com.intellij.lang.javascript.psi.resolve.JSImportHandler.resolveName(JSImportHandler.java:63)
    at com.intellij.lang.javascript.psi.resolve.JSImportHandler.resolveName(JSImportHandler.java:57)
    at com.intellij.lang.javascript.psi.resolve.JSImportHandler.resolveObjectOrTypeName(JSImportHandler.java:41)
    at dev.ngocta.pycharm.odoo.javascript.OdooJSImportHandler.resolveObjectOrTypeName(OdooJSImportHandler.java:25)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMemberNoCache(ES6ReferenceListImpl.java:271)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$0(ES6ReferenceListImpl.java:131)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$1(ES6ReferenceListImpl.java:131)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:31)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:21)
    at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:82)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMember(ES6ReferenceListImpl.java:262)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveMemberClasses(ES6ReferenceListImpl.java:456)
    at com.intellij.lang.javascript.psi.ecma6.impl.JSReferenceListMemberImpl.getClassesWithSubstitutors(JSReferenceListMemberImpl.java:105)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$getReferencedClassesImpl$2(ES6ReferenceListImpl.java:176)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at one.util.streamex.StreamEx.toArray(StreamEx.java:871)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.getReferencedClassesImpl(ES6ReferenceListImpl.java:178)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.getReferencedClasses(JSReferenceListImpl.java:106)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.computeExtendsClasses(JSClassBase.java:523)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:551)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:547)
    at com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil$CacheByEnforcedResolveScope.compute(JSInheritanceUtil.java:992)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getClassesFromReferenceList(JSClassBase.java:554)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSuperClasses(JSClassBase.java:467)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSupers(JSClassBase.java:287)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchyFromJSClasses(JSTypeEvaluateManager.java:148)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchy(JSTypeEvaluateManager.java:118)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addSupers(BaseJSSymbolProcessor.java:251)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addTypeHierarchy(BaseJSSymbolProcessor.java:219)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.processCandidate(BaseJSSymbolProcessor.java:805)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.processType(WalkUpResolveProcessor.java:415)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.process(WalkUpResolveProcessor.java:406)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.passToBaseProcessor(JSCompleteTypeEvaluationProcessor.java:111)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.doAddType(JSCompleteTypeEvaluationProcessor.java:55)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.process(JSCompleteTypeEvaluationProcessor.java:46)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.doResolveNamespaceElements(JSQualifiedReferenceType.java:190)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.lambda$resolveNamespaceElements$0(JSQualifiedReferenceType.java:173)
    at com.intellij.lang.javascript.psi.resolve.JSEvaluatorComplexityTracker.runTask(JSEvaluatorComplexityTracker.java:72)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.resolveNamespaceElements(JSQualifiedReferenceType.java:172)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.resolveDirectlyToClasses(JSReferenceListImpl.java:198)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMemberNoCache(ES6ReferenceListImpl.java:279)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$0(ES6ReferenceListImpl.java:131)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$1(ES6ReferenceListImpl.java:131)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:31)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:21)
    at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:82)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMember(ES6ReferenceListImpl.java:262)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveMemberClasses(ES6ReferenceListImpl.java:456)
    at com.intellij.lang.javascript.psi.ecma6.impl.JSReferenceListMemberImpl.getClassesWithSubstitutors(JSReferenceListMemberImpl.java:105)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$getReferencedClassesImpl$2(ES6ReferenceListImpl.java:176)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at one.util.streamex.StreamEx.toArray(StreamEx.java:871)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.getReferencedClassesImpl(ES6ReferenceListImpl.java:178)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.getReferencedClasses(JSReferenceListImpl.java:106)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.computeExtendsClasses(JSClassBase.java:523)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:551)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:547)
    at com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil$CacheByEnforcedResolveScope.compute(JSInheritanceUtil.java:992)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getClassesFromReferenceList(JSClassBase.java:554)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSuperClasses(JSClassBase.java:467)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSupers(JSClassBase.java:287)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchyFromJSClasses(JSTypeEvaluateManager.java:148)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchy(JSTypeEvaluateManager.java:118)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addSupers(BaseJSSymbolProcessor.java:251)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addTypeHierarchy(BaseJSSymbolProcessor.java:219)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.processCandidate(BaseJSSymbolProcessor.java:805)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.processType(WalkUpResolveProcessor.java:415)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.process(WalkUpResolveProcessor.java:406)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.passToBaseProcessor(JSCompleteTypeEvaluationProcessor.java:111)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.doAddType(JSCompleteTypeEvaluationProcessor.java:55)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.process(JSCompleteTypeEvaluationProcessor.java:46)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.doResolveNamespaceElements(JSQualifiedReferenceType.java:190)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.lambda$resolveNamespaceElements$0(JSQualifiedReferenceType.java:173)
    at com.intellij.lang.javascript.psi.resolve.JSEvaluatorComplexityTracker.runTask(JSEvaluatorComplexityTracker.java:72)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.resolveNamespaceElements(JSQualifiedReferenceType.java:172)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.resolveDirectlyToClasses(JSReferenceListImpl.java:198)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMemberNoCache(ES6ReferenceListImpl.java:279)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$0(ES6ReferenceListImpl.java:131)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$1(ES6ReferenceListImpl.java:131)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:31)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:21)
    at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:82)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMember(ES6ReferenceListImpl.java:262)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveMemberClasses(ES6ReferenceListImpl.java:456)
    at com.intellij.lang.javascript.psi.ecma6.impl.JSReferenceListMemberImpl.getClassesWithSubstitutors(JSReferenceListMemberImpl.java:105)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$getReferencedClassesImpl$2(ES6ReferenceListImpl.java:176)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at one.util.streamex.StreamEx.toArray(StreamEx.java:871)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.getReferencedClassesImpl(ES6ReferenceListImpl.java:178)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.getReferencedClasses(JSReferenceListImpl.java:106)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.computeExtendsClasses(JSClassBase.java:523)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:551)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:547)
    at com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil$CacheByEnforcedResolveScope.compute(JSInheritanceUtil.java:992)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getClassesFromReferenceList(JSClassBase.java:554)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSuperClasses(JSClassBase.java:467)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSupers(JSClassBase.java:287)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchyFromJSClasses(JSTypeEvaluateManager.java:148)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchy(JSTypeEvaluateManager.java:118)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addSupers(BaseJSSymbolProcessor.java:251)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addTypeHierarchy(BaseJSSymbolProcessor.java:219)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.processCandidate(BaseJSSymbolProcessor.java:805)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.processType(WalkUpResolveProcessor.java:415)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.process(WalkUpResolveProcessor.java:406)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.passToBaseProcessor(JSCompleteTypeEvaluationProcessor.java:111)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.doAddType(JSCompleteTypeEvaluationProcessor.java:55)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.process(JSCompleteTypeEvaluationProcessor.java:46)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.doResolveNamespaceElements(JSQualifiedReferenceType.java:190)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.lambda$resolveNamespaceElements$0(JSQualifiedReferenceType.java:173)
    at com.intellij.lang.javascript.psi.resolve.JSEvaluatorComplexityTracker.runTask(JSEvaluatorComplexityTracker.java:72)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.resolveNamespaceElements(JSQualifiedReferenceType.java:172)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.resolveDirectlyToClasses(JSReferenceListImpl.java:198)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMemberNoCache(ES6ReferenceListImpl.java:279)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$0(ES6ReferenceListImpl.java:131)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$1(ES6ReferenceListImpl.java:131)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:31)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:21)
    at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:82)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMember(ES6ReferenceListImpl.java:262)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveMemberClasses(ES6ReferenceListImpl.java:456)
    at com.intellij.lang.javascript.psi.ecma6.impl.JSReferenceListMemberImpl.getClassesWithSubstitutors(JSReferenceListMemberImpl.java:105)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$getReferencedClassesImpl$2(ES6ReferenceListImpl.java:176)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at one.util.streamex.StreamEx.toArray(StreamEx.java:871)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.getReferencedClassesImpl(ES6ReferenceListImpl.java:178)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.getReferencedClasses(JSReferenceListImpl.java:106)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.computeExtendsClasses(JSClassBase.java:523)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:551)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:547)
    at com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil$CacheByEnforcedResolveScope.compute(JSInheritanceUtil.java:992)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getClassesFromReferenceList(JSClassBase.java:554)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSuperClasses(JSClassBase.java:467)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSupers(JSClassBase.java:287)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchyFromJSClasses(JSTypeEvaluateManager.java:148)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchy(JSTypeEvaluateManager.java:118)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addSupers(BaseJSSymbolProcessor.java:251)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addTypeHierarchy(BaseJSSymbolProcessor.java:219)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.processCandidate(BaseJSSymbolProcessor.java:805)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.processType(WalkUpResolveProcessor.java:415)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.process(WalkUpResolveProcessor.java:406)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.passToBaseProcessor(JSCompleteTypeEvaluationProcessor.java:111)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.doAddType(JSCompleteTypeEvaluationProcessor.java:55)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.process(JSCompleteTypeEvaluationProcessor.java:46)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.doResolveNamespaceElements(JSQualifiedReferenceType.java:190)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.lambda$resolveNamespaceElements$0(JSQualifiedReferenceType.java:173)
    at com.intellij.lang.javascript.psi.resolve.JSEvaluatorComplexityTracker.runTask(JSEvaluatorComplexityTracker.java:72)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.resolveNamespaceElements(JSQualifiedReferenceType.java:172)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.resolveDirectlyToClasses(JSReferenceListImpl.java:198)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMemberNoCache(ES6ReferenceListImpl.java:279)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$0(ES6ReferenceListImpl.java:131)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$1(ES6ReferenceListImpl.java:131)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:31)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:21)
    at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:82)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMember(ES6ReferenceListImpl.java:262)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveMemberClasses(ES6ReferenceListImpl.java:456)
    at com.intellij.lang.javascript.psi.ecma6.impl.JSReferenceListMemberImpl.getClassesWithSubstitutors(JSReferenceListMemberImpl.java:105)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$getReferencedClassesImpl$2(ES6ReferenceListImpl.java:176)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at one.util.streamex.StreamEx.toArray(StreamEx.java:871)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.getReferencedClassesImpl(ES6ReferenceListImpl.java:178)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.getReferencedClasses(JSReferenceListImpl.java:106)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.computeExtendsClasses(JSClassBase.java:523)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:551)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:547)
    at com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil$CacheByEnforcedResolveScope.compute(JSInheritanceUtil.java:992)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getClassesFromReferenceList(JSClassBase.java:554)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSuperClasses(JSClassBase.java:467)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSupers(JSClassBase.java:287)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchyFromJSClasses(JSTypeEvaluateManager.java:148)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchy(JSTypeEvaluateManager.java:118)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addSupers(BaseJSSymbolProcessor.java:251)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addTypeHierarchy(BaseJSSymbolProcessor.java:219)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.processCandidate(BaseJSSymbolProcessor.java:805)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.processType(WalkUpResolveProcessor.java:415)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.process(WalkUpResolveProcessor.java:406)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.passToBaseProcessor(JSCompleteTypeEvaluationProcessor.java:111)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.doAddType(JSCompleteTypeEvaluationProcessor.java:55)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.process(JSCompleteTypeEvaluationProcessor.java:46)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.doResolveNamespaceElements(JSQualifiedReferenceType.java:190)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.lambda$resolveNamespaceElements$0(JSQualifiedReferenceType.java:173)
    at com.intellij.lang.javascript.psi.resolve.JSEvaluatorComplexityTracker.runTask(JSEvaluatorComplexityTracker.java:72)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.resolveNamespaceElements(JSQualifiedReferenceType.java:172)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.resolveDirectlyToClasses(JSReferenceListImpl.java:198)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMemberNoCache(ES6ReferenceListImpl.java:279)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$0(ES6ReferenceListImpl.java:131)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$1(ES6ReferenceListImpl.java:131)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:31)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:21)
    at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:82)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMember(ES6ReferenceListImpl.java:262)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveMemberClasses(ES6ReferenceListImpl.java:456)
    at com.intellij.lang.javascript.psi.ecma6.impl.JSReferenceListMemberImpl.getClassesWithSubstitutors(JSReferenceListMemberImpl.java:105)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$getReferencedClassesImpl$2(ES6ReferenceListImpl.java:176)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at one.util.streamex.StreamEx.toArray(StreamEx.java:871)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.getReferencedClassesImpl(ES6ReferenceListImpl.java:178)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.getReferencedClasses(JSReferenceListImpl.java:106)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.computeExtendsClasses(JSClassBase.java:523)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:551)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:547)
    at com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil$CacheByEnforcedResolveScope.compute(JSInheritanceUtil.java:992)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getClassesFromReferenceList(JSClassBase.java:554)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSuperClasses(JSClassBase.java:467)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSupers(JSClassBase.java:287)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchyFromJSClasses(JSTypeEvaluateManager.java:148)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchy(JSTypeEvaluateManager.java:118)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addSupers(BaseJSSymbolProcessor.java:251)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addTypeHierarchy(BaseJSSymbolProcessor.java:219)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.processCandidate(BaseJSSymbolProcessor.java:805)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.processType(WalkUpResolveProcessor.java:415)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.process(WalkUpResolveProcessor.java:406)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.passToBaseProcessor(JSCompleteTypeEvaluationProcessor.java:111)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.doAddType(JSCompleteTypeEvaluationProcessor.java:55)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.process(JSCompleteTypeEvaluationProcessor.java:46)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.doResolveNamespaceElements(JSQualifiedReferenceType.java:190)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.lambda$resolveNamespaceElements$0(JSQualifiedReferenceType.java:173)
    at com.intellij.lang.javascript.psi.resolve.JSEvaluatorComplexityTracker.runTask(JSEvaluatorComplexityTracker.java:72)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.resolveNamespaceElements(JSQualifiedReferenceType.java:172)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.resolveDirectlyToClasses(JSReferenceListImpl.java:198)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMemberNoCache(ES6ReferenceListImpl.java:279)
jcfernandez-890825 commented 1 year ago
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$0(ES6ReferenceListImpl.java:131)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$1(ES6ReferenceListImpl.java:131)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:31)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:21)
    at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:82)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMember(ES6ReferenceListImpl.java:262)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveMemberClasses(ES6ReferenceListImpl.java:456)
    at com.intellij.lang.javascript.psi.ecma6.impl.JSReferenceListMemberImpl.getClassesWithSubstitutors(JSReferenceListMemberImpl.java:105)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$getReferencedClassesImpl$2(ES6ReferenceListImpl.java:176)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at one.util.streamex.StreamEx.toArray(StreamEx.java:871)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.getReferencedClassesImpl(ES6ReferenceListImpl.java:178)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.getReferencedClasses(JSReferenceListImpl.java:106)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.computeExtendsClasses(JSClassBase.java:523)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:551)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:547)
    at com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil$CacheByEnforcedResolveScope.compute(JSInheritanceUtil.java:992)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getClassesFromReferenceList(JSClassBase.java:554)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSuperClasses(JSClassBase.java:467)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSupers(JSClassBase.java:287)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchyFromJSClasses(JSTypeEvaluateManager.java:148)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchy(JSTypeEvaluateManager.java:118)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addSupers(BaseJSSymbolProcessor.java:251)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addTypeHierarchy(BaseJSSymbolProcessor.java:219)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.processCandidate(BaseJSSymbolProcessor.java:805)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.processType(WalkUpResolveProcessor.java:415)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.process(WalkUpResolveProcessor.java:406)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.passToBaseProcessor(JSCompleteTypeEvaluationProcessor.java:111)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.doAddType(JSCompleteTypeEvaluationProcessor.java:55)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.process(JSCompleteTypeEvaluationProcessor.java:46)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.doResolveNamespaceElements(JSQualifiedReferenceType.java:190)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.lambda$resolveNamespaceElements$0(JSQualifiedReferenceType.java:173)
    at com.intellij.lang.javascript.psi.resolve.JSEvaluatorComplexityTracker.runTask(JSEvaluatorComplexityTracker.java:72)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.resolveNamespaceElements(JSQualifiedReferenceType.java:172)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.resolveDirectlyToClasses(JSReferenceListImpl.java:198)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMemberNoCache(ES6ReferenceListImpl.java:279)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$0(ES6ReferenceListImpl.java:131)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$1(ES6ReferenceListImpl.java:131)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:31)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:21)
    at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:82)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMember(ES6ReferenceListImpl.java:262)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveMemberClasses(ES6ReferenceListImpl.java:456)
    at com.intellij.lang.javascript.psi.ecma6.impl.JSReferenceListMemberImpl.getClassesWithSubstitutors(JSReferenceListMemberImpl.java:105)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$getReferencedClassesImpl$2(ES6ReferenceListImpl.java:176)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at one.util.streamex.StreamEx.toArray(StreamEx.java:871)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.getReferencedClassesImpl(ES6ReferenceListImpl.java:178)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.getReferencedClasses(JSReferenceListImpl.java:106)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.computeExtendsClasses(JSClassBase.java:523)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:551)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:547)
    at com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil$CacheByEnforcedResolveScope.compute(JSInheritanceUtil.java:992)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getClassesFromReferenceList(JSClassBase.java:554)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSuperClasses(JSClassBase.java:467)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSupers(JSClassBase.java:287)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchyFromJSClasses(JSTypeEvaluateManager.java:148)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchy(JSTypeEvaluateManager.java:118)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addSupers(BaseJSSymbolProcessor.java:251)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addTypeHierarchy(BaseJSSymbolProcessor.java:219)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.processCandidate(BaseJSSymbolProcessor.java:805)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.processType(WalkUpResolveProcessor.java:415)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.process(WalkUpResolveProcessor.java:406)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.passToBaseProcessor(JSCompleteTypeEvaluationProcessor.java:111)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.doAddType(JSCompleteTypeEvaluationProcessor.java:55)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.process(JSCompleteTypeEvaluationProcessor.java:46)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.doResolveNamespaceElements(JSQualifiedReferenceType.java:190)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.lambda$resolveNamespaceElements$0(JSQualifiedReferenceType.java:173)
    at com.intellij.lang.javascript.psi.resolve.JSEvaluatorComplexityTracker.runTask(JSEvaluatorComplexityTracker.java:72)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.resolveNamespaceElements(JSQualifiedReferenceType.java:172)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.resolveDirectlyToClasses(JSReferenceListImpl.java:198)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMemberNoCache(ES6ReferenceListImpl.java:279)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$0(ES6ReferenceListImpl.java:131)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$1(ES6ReferenceListImpl.java:131)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:31)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:21)
    at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:82)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMember(ES6ReferenceListImpl.java:262)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveMemberClasses(ES6ReferenceListImpl.java:456)
    at com.intellij.lang.javascript.psi.ecma6.impl.JSReferenceListMemberImpl.getClassesWithSubstitutors(JSReferenceListMemberImpl.java:105)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$getReferencedClassesImpl$2(ES6ReferenceListImpl.java:176)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at one.util.streamex.StreamEx.toArray(StreamEx.java:871)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.getReferencedClassesImpl(ES6ReferenceListImpl.java:178)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.getReferencedClasses(JSReferenceListImpl.java:106)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.computeExtendsClasses(JSClassBase.java:523)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:551)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:547)
    at com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil$CacheByEnforcedResolveScope.compute(JSInheritanceUtil.java:992)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getClassesFromReferenceList(JSClassBase.java:554)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSuperClasses(JSClassBase.java:467)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSupers(JSClassBase.java:287)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchyFromJSClasses(JSTypeEvaluateManager.java:148)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchy(JSTypeEvaluateManager.java:118)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addSupers(BaseJSSymbolProcessor.java:251)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addTypeHierarchy(BaseJSSymbolProcessor.java:219)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.processCandidate(BaseJSSymbolProcessor.java:805)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.processType(WalkUpResolveProcessor.java:415)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.process(WalkUpResolveProcessor.java:406)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.passToBaseProcessor(JSCompleteTypeEvaluationProcessor.java:111)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.doAddType(JSCompleteTypeEvaluationProcessor.java:55)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.process(JSCompleteTypeEvaluationProcessor.java:46)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.doResolveNamespaceElements(JSQualifiedReferenceType.java:190)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.lambda$resolveNamespaceElements$0(JSQualifiedReferenceType.java:173)
    at com.intellij.lang.javascript.psi.resolve.JSEvaluatorComplexityTracker.runTask(JSEvaluatorComplexityTracker.java:72)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.resolveNamespaceElements(JSQualifiedReferenceType.java:172)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.resolveDirectlyToClasses(JSReferenceListImpl.java:198)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMemberNoCache(ES6ReferenceListImpl.java:279)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$0(ES6ReferenceListImpl.java:131)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$1(ES6ReferenceListImpl.java:131)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:31)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:21)
    at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:82)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMember(ES6ReferenceListImpl.java:262)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveMemberClasses(ES6ReferenceListImpl.java:456)
    at com.intellij.lang.javascript.psi.ecma6.impl.JSReferenceListMemberImpl.getClassesWithSubstitutors(JSReferenceListMemberImpl.java:105)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$getReferencedClassesImpl$2(ES6ReferenceListImpl.java:176)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at one.util.streamex.StreamEx.toArray(StreamEx.java:871)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.getReferencedClassesImpl(ES6ReferenceListImpl.java:178)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.getReferencedClasses(JSReferenceListImpl.java:106)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.computeExtendsClasses(JSClassBase.java:523)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:551)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:547)
    at com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil$CacheByEnforcedResolveScope.compute(JSInheritanceUtil.java:992)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getClassesFromReferenceList(JSClassBase.java:554)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSuperClasses(JSClassBase.java:467)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSupers(JSClassBase.java:287)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchyFromJSClasses(JSTypeEvaluateManager.java:148)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchy(JSTypeEvaluateManager.java:118)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addSupers(BaseJSSymbolProcessor.java:251)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addTypeHierarchy(BaseJSSymbolProcessor.java:219)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.processCandidate(BaseJSSymbolProcessor.java:805)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.processType(WalkUpResolveProcessor.java:415)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.process(WalkUpResolveProcessor.java:406)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.passToBaseProcessor(JSCompleteTypeEvaluationProcessor.java:111)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.doAddType(JSCompleteTypeEvaluationProcessor.java:55)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.process(JSCompleteTypeEvaluationProcessor.java:46)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.doResolveNamespaceElements(JSQualifiedReferenceType.java:190)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.lambda$resolveNamespaceElements$0(JSQualifiedReferenceType.java:173)
    at com.intellij.lang.javascript.psi.resolve.JSEvaluatorComplexityTracker.runTask(JSEvaluatorComplexityTracker.java:72)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.resolveNamespaceElements(JSQualifiedReferenceType.java:172)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.resolveDirectlyToClasses(JSReferenceListImpl.java:198)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMemberNoCache(ES6ReferenceListImpl.java:279)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$0(ES6ReferenceListImpl.java:131)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$1(ES6ReferenceListImpl.java:131)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:31)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:21)
    at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:82)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMember(ES6ReferenceListImpl.java:262)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveMemberClasses(ES6ReferenceListImpl.java:456)
    at com.intellij.lang.javascript.psi.ecma6.impl.JSReferenceListMemberImpl.getClassesWithSubstitutors(JSReferenceListMemberImpl.java:105)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$getReferencedClassesImpl$2(ES6ReferenceListImpl.java:176)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at one.util.streamex.StreamEx.toArray(StreamEx.java:871)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.getReferencedClassesImpl(ES6ReferenceListImpl.java:178)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.getReferencedClasses(JSReferenceListImpl.java:106)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.computeExtendsClasses(JSClassBase.java:523)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:551)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:547)
    at com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil$CacheByEnforcedResolveScope.compute(JSInheritanceUtil.java:992)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getClassesFromReferenceList(JSClassBase.java:554)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSuperClasses(JSClassBase.java:467)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSupers(JSClassBase.java:287)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchyFromJSClasses(JSTypeEvaluateManager.java:148)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchy(JSTypeEvaluateManager.java:118)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addSupers(BaseJSSymbolProcessor.java:251)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addTypeHierarchy(BaseJSSymbolProcessor.java:219)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.processCandidate(BaseJSSymbolProcessor.java:805)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.processType(WalkUpResolveProcessor.java:415)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor$JSResolveTypeProcessor.process(WalkUpResolveProcessor.java:406)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.passToBaseProcessor(JSCompleteTypeEvaluationProcessor.java:111)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.doAddType(JSCompleteTypeEvaluationProcessor.java:55)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.process(JSCompleteTypeEvaluationProcessor.java:46)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.doResolveNamespaceElements(JSQualifiedReferenceType.java:190)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.lambda$resolveNamespaceElements$0(JSQualifiedReferenceType.java:173)
    at com.intellij.lang.javascript.psi.resolve.JSEvaluatorComplexityTracker.runTask(JSEvaluatorComplexityTracker.java:72)
    at com.intellij.lang.javascript.psi.types.evaluable.JSQualifiedReferenceType.resolveNamespaceElements(JSQualifiedReferenceType.java:172)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.resolveDirectlyToClasses(JSReferenceListImpl.java:198)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMemberNoCache(ES6ReferenceListImpl.java:279)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$0(ES6ReferenceListImpl.java:131)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$static$1(ES6ReferenceListImpl.java:131)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.doCompute(PsiParameterizedCachedValue.java:31)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
    at com.intellij.psi.impl.PsiParameterizedCachedValue.getValue(PsiParameterizedCachedValue.java:21)
    at com.intellij.psi.util.CachedValuesManager.getParameterizedCachedValue(CachedValuesManager.java:82)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveReferenceListMember(ES6ReferenceListImpl.java:262)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.resolveMemberClasses(ES6ReferenceListImpl.java:456)
    at com.intellij.lang.javascript.psi.ecma6.impl.JSReferenceListMemberImpl.getClassesWithSubstitutors(JSReferenceListMemberImpl.java:105)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.lambda$getReferencedClassesImpl$2(ES6ReferenceListImpl.java:176)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at one.util.streamex.StreamEx.toArray(StreamEx.java:871)
    at com.intellij.lang.javascript.psi.ecma6.impl.ES6ReferenceListImpl.getReferencedClassesImpl(ES6ReferenceListImpl.java:178)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSReferenceListImpl.getReferencedClasses(JSReferenceListImpl.java:106)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.computeExtendsClasses(JSClassBase.java:523)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:551)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase$2.computeForScope(JSClassBase.java:547)
    at com.intellij.lang.javascript.psi.resolve.JSInheritanceUtil$CacheByEnforcedResolveScope.compute(JSInheritanceUtil.java:992)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getClassesFromReferenceList(JSClassBase.java:554)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSuperClasses(JSClassBase.java:467)
    at com.intellij.lang.javascript.psi.ecmal4.impl.JSClassBase.getSupers(JSClassBase.java:287)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchyFromJSClasses(JSTypeEvaluateManager.java:148)
    at com.intellij.lang.javascript.index.JSTypeEvaluateManager.iterateTypeHierarchy(JSTypeEvaluateManager.java:118)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addSupers(BaseJSSymbolProcessor.java:251)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor.addTypeHierarchy(BaseJSSymbolProcessor.java:219)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.doProcessAdditionalType(BaseJSSymbolProcessor.java:773)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.lambda$processAdditionalType$0(BaseJSSymbolProcessor.java:759)
    at com.intellij.lang.javascript.psi.JSTypeUtils.processExpandedType(JSTypeUtils.java:1789)
    at com.intellij.lang.javascript.psi.JSTypeUtils.processExpandedType(JSTypeUtils.java:1689)
    at com.intellij.lang.javascript.psi.JSTypeUtils.processExpandedType(JSTypeUtils.java:1681)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.processAdditionalType(BaseJSSymbolProcessor.java:758)
    at com.intellij.lang.javascript.psi.resolve.processors.JSDelegatingTypeProcessor.processAdditionalType(JSDelegatingTypeProcessor.java:23)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.passToBaseProcessor(JSCompleteTypeEvaluationProcessor.java:108)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.processAdditionalType(JSCompleteTypeEvaluationProcessor.java:61)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.process(JSCompleteTypeEvaluationProcessor.java:37)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.evaluateTypes(JSCompleteTypeEvaluationProcessor.java:131)
    at com.intellij.lang.javascript.psi.resolve.JSCompleteTypeEvaluationProcessor.evaluateTypes(JSCompleteTypeEvaluationProcessor.java:122)
    at com.intellij.lang.javascript.psi.resolve.BaseJSSymbolProcessor$JSTypeProcessorBase.evaluateQualifier(BaseJSSymbolProcessor.java:738)
    at com.intellij.lang.javascript.psi.resolve.WalkUpResolveProcessor.<init>(WalkUpResolveProcessor.java:130)
    at com.intellij.lang.javascript.psi.resolve.JSReferenceExpressionResolver.resolveFromIndices(JSReferenceExpressionResolver.java:321)
    at com.intellij.lang.javascript.psi.resolve.JSReferenceExpressionResolver.resolve(JSReferenceExpressionResolver.java:131)
    at com.intellij.lang.javascript.psi.resolve.JSReferenceExpressionResolver.resolve(JSReferenceExpressionResolver.java:43)
    at com.intellij.lang.javascript.psi.resolve.JSResolveUtil$5.get(JSResolveUtil.java:1682)
    at com.intellij.lang.javascript.psi.resolve.JSResolveUtil$5.get(JSResolveUtil.java:1679)
    at com.intellij.lang.javascript.psi.resolve.JSEvaluatorComplexityTracker.runTask(JSEvaluatorComplexityTracker.java:72)
    at com.intellij.lang.javascript.psi.resolve.JSComplexityAwareRecursionGuard.lambda$getCachedValue$0(JSComplexityAwareRecursionGuard.java:71)
    at com.intellij.lang.javascript.psi.resolve.JSResolveUtil$4.lambda$calculateWithCaching$0(JSResolveUtil.java:1695)
    at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$resolveWithCaching$5(ResolveCache.java:268)
    at com.intellij.openapi.util.Computable.get(Computable.java:16)
    at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$loggingResolver$4(ResolveCache.java:234)
    at com.intellij.openapi.util.Computable.get(Computable.java:16)
    at com.intellij.psi.impl.source.resolve.ResolveCache.resolve(ResolveCache.java:213)
    at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:268)
    at com.intellij.lang.javascript.psi.resolve.JSResolveUtil$4.calculateWithCaching(JSResolveUtil.java:1693)
    at com.intellij.lang.javascript.psi.resolve.JSComplexityAwareRecursionGuard.getCachedValue(JSComplexityAwareRecursionGuard.java:74)
    at com.intellij.lang.javascript.psi.resolve.JSResolveUtil.resolve(JSResolveUtil.java:1677)
    at com.intellij.lang.javascript.psi.impl.JSReferenceExpressionImpl.lambda$multiResolve$0(JSReferenceExpressionImpl.java:531)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.lang.javascript.psi.resolve.JSEvaluatorComplexityTracker.runTask(JSEvaluatorComplexityTracker.java:72)
    at com.intellij.lang.javascript.psi.impl.JSReferenceExpressionImpl.multiResolve(JSReferenceExpressionImpl.java:527)
    at com.intellij.lang.javascript.psi.resolve.JSReferenceUtil.isReferenceTo(JSReferenceUtil.java:106)
    at com.intellij.lang.javascript.psi.impl.JSReferenceExpressionImpl.isReferenceTo(JSReferenceExpressionImpl.java:247)
    at com.intellij.psi.search.SingleTargetRequestResultProcessor.processTextOccurrence(SingleTargetRequestResultProcessor.java:35)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl$5.lambda$execute$0(PsiSearchHelperImpl.java:968)
    at com.intellij.psi.impl.search.LowLevelSearchUtil.processTreeUp(LowLevelSearchUtil.java:85)
    at com.intellij.psi.impl.search.LowLevelSearchUtil.lambda$processElementsAtOffsets$0(LowLevelSearchUtil.java:176)
    at com.intellij.psi.impl.search.LowLevelSearchUtil.processOffsets(LowLevelSearchUtil.java:203)
    at com.intellij.psi.impl.search.LowLevelSearchUtil.processElementsAtOffsets(LowLevelSearchUtil.java:175)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl$5.execute(PsiSearchHelperImpl.java:964)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl$2.processInReadAction(PsiSearchHelperImpl.java:289)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl$2.processInReadAction(PsiSearchHelperImpl.java:280)
    at com.intellij.openapi.application.ReadActionProcessor.lambda$process$0(ReadActionProcessor.java:11)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:923)
    at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:76)
    at com.intellij.openapi.application.ReadActionProcessor.process(ReadActionProcessor.java:11)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.lambda$processCandidates$18(PsiSearchHelperImpl.java:925)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.lambda$processVirtualFile$11(PsiSearchHelperImpl.java:561)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1133)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.processVirtualFile(PsiSearchHelperImpl.java:540)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.lambda$processPsiFileRoots$7(PsiSearchHelperImpl.java:411)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.lambda$processFilesConcurrentlyDespiteWriteActions$9(PsiSearchHelperImpl.java:482)
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:201)
    at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:207)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.lambda$processFilesConcurrentlyDespiteWriteActions$10(PsiSearchHelperImpl.java:481)
    at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:142)
    at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:155)
    at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:155)
    at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:155)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1133)
    at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:98)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
    at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:110)
    at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:88)
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:201)
    at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:207)
    at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:88)
    at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgress(JobLauncherImpl.java:62)
    at com.intellij.concurrency.JobLauncher.invokeConcurrentlyUnderProgress(JobLauncher.java:51)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.processFilesConcurrentlyDespiteWriteActions(PsiSearchHelperImpl.java:498)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.lambda$processPsiFileRoots$8(PsiSearchHelperImpl.java:408)
    at com.intellij.psi.impl.PsiManagerImpl.runInBatchFilesMode(PsiManagerImpl.java:455)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.processPsiFileRoots(PsiSearchHelperImpl.java:401)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.processCandidates(PsiSearchHelperImpl.java:920)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.processGlobalRequests(PsiSearchHelperImpl.java:904)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.processGlobalRequestsOptimized(PsiSearchHelperImpl.java:856)
    at com.intellij.psi.impl.search.PsiSearchHelperImpl.processRequests(PsiSearchHelperImpl.java:781)
    at com.intellij.psi.search.SearchRequestQuery.processResults(SearchRequestQuery.java:21)
    at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:88)
    at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:105)
    at com.intellij.util.MergeQuery.processResults(MergeQuery.java:22)
    at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:88)
    at com.intellij.util.AbstractQuery.delegateProcessResults(AbstractQuery.java:105)
    at com.intellij.util.UniqueResultsQuery.processResults(UniqueResultsQuery.java:37)
    at com.intellij.util.AbstractQuery.doProcessResults(AbstractQuery.java:88)
    at com.intellij.util.AbstractQuery.forEach(AbstractQuery.java:80)
    at com.intellij.lang.javascript.inspections.unusedsymbols.JSSymbolReferenceCache$ReferenceCachingSearcherImpl.findSomeReferences(JSSymbolReferenceCache.java:217)
    at com.intellij.lang.javascript.hints.JSReferencesCodeVisionProvider.calculateHint(JSReferencesCodeVisionProvider.kt:49)
    at com.intellij.lang.javascript.hints.JSReferencesCodeVisionProvider.getVisionInfo$lambda$0(JSReferencesCodeVisionProvider.kt:38)
    at com.intellij.lang.javascript.hints.JSCodeVisionPerformanceWatcher$Companion.computeAndCheckPerformance(JSCodeVisionPerformanceWatcher.kt:63)
    at com.intellij.lang.javascript.hints.JSReferencesCodeVisionProvider.getVisionInfo(JSReferencesCodeVisionProvider.kt:37)
    at com.intellij.lang.javascript.hints.JSReferencesCodeVisionProvider.getHint(JSReferencesCodeVisionProvider.kt:43)
    at com.intellij.codeInsight.hints.codeVision.CodeVisionProviderBase.computeForEditor(CodeVisionProviderBase.kt:68)
    at com.intellij.codeInsight.hints.codeVision.CodeVisionPass$Companion.collect$lambda$3$lambda$2(CodeVisionPass.kt:72)
    at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:142)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1133)
    at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:98)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
    at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:110)
    at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:88)
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:201)
    at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:207)
    at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:88)
    at com.intellij.concurrency.JobLauncherImpl.invokeConcurrentlyUnderProgress(JobLauncherImpl.java:62)
    at com.intellij.concurrency.JobLauncher.invokeConcurrentlyUnderProgress(JobLauncher.java:51)
    at com.intellij.codeInsight.hints.codeVision.CodeVisionPass$Companion.collect(CodeVisionPass.kt:69)
    at com.intellij.codeInsight.hints.codeVision.CodeVisionPass$Companion.access$collect(CodeVisionPass.kt:41)
    at com.intellij.codeInsight.hints.codeVision.CodeVisionPass.doCollectInformation(CodeVisionPass.kt:106)
    at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:57)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:390)
    at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.runWithSpanIgnoreThrows(trace.kt:77)
    at com.intellij.platform.diagnostic.telemetry.helpers.TraceUtil.runWithSpanThrows(TraceUtil.java:24)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:386)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1133)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$3(PassExecutorService.java:377)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:376)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:352)
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:201)
    at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:207)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:350)
    at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:185)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.lang.AssertionError: Stub count doesn't match stubbed node length
    at com.intellij.psi.impl.source.FileTrees.lambda$reconcilePsi$4(FileTrees.java:182)
    at com.intellij.psi.impl.DebugUtil.performPsiModification(DebugUtil.java:494)
    at com.intellij.psi.impl.source.FileTrees.reconcilePsi(FileTrees.java:175)
    at com.intellij.psi.impl.source.FileTrees.withAst(FileTrees.java:141)
    at com.intellij.psi.impl.source.PsiFileImpl.loadTreeElement(PsiFileImpl.java:214)
    ... 818 more
jcfernandez-890825 commented 1 year ago
class fu extends zh{constructor(t){super(document.createElement("div")),this.normal=new _t(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)}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=su(t)[0].terms;for(let t=0;t<3;++t)this.position.setComponent(t,gu(e[t]).number);this.updateMatrixWorld()}updateNormal(t){if(null==t)return;const e=su(t)[0].terms;for(let t=0;t<3;++t)this.normal.setComponent(t,gu(e[t]).number)}orient(t){this.pivot.style.transform=`rotate(${t}rad)`}updateVisibility(t){t?this.element.classList.remove("hide"):this.element.classList.add("hide"),this.slot.assignedNodes().forEach((e=>{if(e.nodeType!==Node.ELEMENT_NODE)return;const n=e,i=n.dataset.visibilityAttribute;if(null!=i){const e=`data-${i}`;t?n.setAttribute(e,""):n.removeAttribute(e)}n.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:t}}))})),this.initialized=!0}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const vu=(t,e,n)=>{let i=n;const r=new _t;return t.traverse((t=>{let n,s;t.updateWorldMatrix(!1,!1);const a=t.geometry;if(void 0!==a)if(a.isGeometry){const o=a.vertices;for(n=0,s=o.length;n<s;n++)r.copy(o[n]),r.applyMatrix4(t.matrixWorld),i=e(i,r)}else if(a.isBufferGeometry){const{position:o}=a.attributes;if(void 0!==o){const a=(t=>{if(!t.normalized)return 1;const e=t.array;return e instanceof Int8Array?1/127:e instanceof Uint8Array?1/255:e instanceof Int16Array?1/32767:e instanceof Uint16Array?1/65535:1})(o);for(n=0,s=o.count;n<s;n++)r.fromBufferAttribute(o,n),r.multiplyScalar(a),r.applyMatrix4(t.matrixWorld),i=e(i,r)}}})),i};class yu extends wl{constructor(t,e,n){super(),this.shadowMaterial=new Lo,this.boundingBox=new Mt,this.size=new _t,this.shadowScale=1,this.isAnimated=!1,this.side="bottom",this.needsUpdate=!1,this.intensity=0,this.castShadow=!0,this.frustumCulled=!1,this.floor=new Mn(new Yn,this.shadowMaterial),this.floor.rotateX(-Math.PI/2),this.floor.receiveShadow=!0,this.floor.castShadow=!1,this.floor.frustumCulled=!1,this.add(this.floor),t.target.add(this),this.target=t.target,this.setScene(t,e,n)}setScene(t,e,n){if(this.side=n,this.isAnimated=t.animationNames.length>0,this.boundingBox.copy(t.boundingBox),this.size.copy(t.size),"back"===this.side){const{min:t,max:e}=this.boundingBox;[t.y,t.z]=[t.z,t.y],[e.y,e.z]=[e.z,e.y],[this.size.y,this.size.z]=[this.size.z,this.size.y],this.rotation.x=Math.PI/2,this.rotation.y=Math.PI}const{boundingBox:i,size:r}=this;if(this.isAnimated){const t=2*Math.max(r.x,r.y,r.z);r.y=t,i.expandByVector(r.subScalar(t).multiplyScalar(-.5)),i.max.y=i.min.y+t,r.set(t,t,t)}i.getCenter(this.floor.position);const s=i.max.y+.002*r.y;"bottom"===n?(this.position.y=s,this.shadow.camera.up.set(0,0,1)):(this.position.y=0,this.position.z=s,this.shadow.camera.up.set(0,1,0)),this.setSoftness(e)}setSoftness(t){const e=Math.pow(2,9-3*t);this.setMapSize(e)}setMapSize(t){const{camera:e,mapSize:n,map:i}=this.shadow,{size:r,boundingBox:s}=this;null!=i&&(i.dispose(),this.shadow.map=null),this.isAnimated&&(t*=2);const a=Math.floor(r.x>r.z?t:t*r.x/r.z),o=Math.floor(r.x>r.z?t*r.z/r.x:t);n.set(a,o);const l=2.5*r.x/a,c=2.5*r.z/o;e.left=-s.max.x-l,e.right=-s.min.x+l,e.bottom=s.min.z-c,e.top=s.max.z+c,this.setScaleAndOffset(this.shadowScale,0),this.floor.scale.set(r.x+2*l,r.z+2*c,1),this.needsUpdate=!0}setIntensity(t){this.shadowMaterial.opacity=t,t>0?(this.visible=!0,this.floor.visible=!0):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.shadowMaterial.opacity}setRotation(t){"bottom"===this.side?(this.shadow.camera.up.set(Math.sin(t),0,Math.cos(t)),this.shadow.updateMatrices(this)):this.shadow.updateMatrices(this)}setScaleAndOffset(t,e){const n=this.size.y,{camera:i}=this.shadow;this.shadowScale=t,i.near=0,i.far=n-e/t,i.updateProjectionMatrix(),i.scale.setScalar(t);const r=.002*n;this.floor.position.y=2*r-i.far}}
/* @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 xu=22.5*Math.PI/180,wu=Math.sin(xu),Eu=Math.tan(xu),bu=new _t,_u=new _t,Iu=new _t,Cu=new class{constructor(t,e,n=0,i=1/0){this.ray=new te(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new de,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){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&&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)}intersectObject(t,e=!1,n=[]){return Hl(t,this,n,e),n.sort(Ol),n}intersectObjects(t,e=!1,n=[]){for(let i=0,r=t.length;i<r;i++)Hl(t[i],this,n,e);return n.sort(Ol),n}},Mu=new _t;class Su extends Ps{constructor({canvas:t,element:e,width:n,height:i}){super(),this.context=null,this.annotationRenderer=new Jh,this.width=1,this.height=1,this.aspect=1,this.isDirty=!1,this.renderCount=0,this.externalRenderer=null,this.camera=new Pn(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new Ce,this.modelContainer=new Ce,this.animationNames=[],this.boundingBox=new Mt,this.size=new _t,this.idealCameraDistance=0,this.fieldOfViewAspect=0,this.framedFieldOfView=45,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.canScale=!0,this.tightBounds=!1,this.goalTarget=new _t,this.targetDamperX=new iu,this.targetDamperY=new iu,this.targetDamperZ=new iu,this._currentGLTF=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.name="ModelScene",this.element=e,this.canvas=t,this.camera=new Pn(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(n,i),this.target.name="Target",this.modelContainer.name="ModelContainer",this.target.add(this.modelContainer),this.mixer=new Gl(this.modelContainer);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)}createContext(){this.context=this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}async setObject(t){this.reset(),this.modelContainer.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.idealCameraDistance=t.framedRadius/wu,this.fieldOfViewAspect=t.fieldOfViewAspect,this.frameModel(),void this.dispatchEvent({type:"model-load",url:this.url})}let n;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{n=await new Promise((async(n,i)=>{this.cancelPendingSourceChange=()=>i();try{n(await this.element[wp].loader.load(t,this.element,e))}catch(t){i(t)}}))}catch(t){if(null==t)return;throw t}this.reset(),this.url=t,this._currentGLTF=n,null!=n&&this.modelContainer.add(n.scene);const{animations:i}=n,r=new Map,s=[];for(const t of i)r.set(t.name,t),s.push(t.name);this.animations=i,this.animationsByName=r,this.animationNames=s,await this.setupScene()}async setupScene(){this.updateBoundingBox();let t=null;!0===this.tightBounds&&(await this.element.requestUpdate("cameraTarget"),t=this.getTarget()),this.updateFraming(t),this.frameModel(),this.setShadowIntensity(this.shadowIntensity),this.dispatchEvent({type:"model-load",url:this.url})}reset(){this.url=null,this.isDirty=!0,null!=this.shadow&&this.shadow.setIntensity(0);const t=this._currentGLTF;if(null!=t){for(const t of this.modelContainer.children)this.modelContainer.remove(t);t.dispose(),this._currentGLTF=null}null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}get currentGLTF(){return this._currentGLTF}setSize(t,e){if(this.width!==t||this.height!==e){if(this.width=Math.max(t,1),this.height=Math.max(e,1),this.annotationRenderer.setSize(t,e),this.aspect=this.width/this.height,this.frameModel(),null!=this.externalRenderer){const n=eu();this.externalRenderer.resize(t*n,e*n)}this.isDirty=!0}}updateBoundingBox(){if(this.target.remove(this.modelContainer),!0===this.tightBounds){const t=(t,e)=>t.expandByPoint(e);this.boundingBox=vu(this.modelContainer,t,new Mt)}else this.boundingBox.setFromObject(this.modelContainer);this.boundingBox.getSize(this.size),this.target.add(this.modelContainer)}updateFraming(t=null){this.target.remove(this.modelContainer),null==t&&(t=this.boundingBox.getCenter(new _t));const e=Math.sqrt(vu(this.modelContainer,((e,n)=>Math.max(e,t.distanceToSquared(n))),0));this.idealCameraDistance=e/wu;this.fieldOfViewAspect=vu(this.modelContainer,((e,n)=>{n.sub(t);const i=Math.sqrt(n.x*n.x+n.z*n.z);return Math.max(e,i/(this.idealCameraDistance-Math.abs(n.y)))}),0)/Eu,this.target.add(this.modelContainer)}frameModel(){const t=Eu*Math.max(1,this.fieldOfViewAspect/this.aspect);this.framedFieldOfView=2*Math.atan(t)*180/Math.PI}getSize(){return{width:this.width,height:this.height}}setTarget(t,e,n){this.goalTarget.set(-t,-e,-n)}setTargetDamperDecayTime(t){this.targetDamperX.setDecayTime(t),this.targetDamperY.setDecayTime(t),this.targetDamperZ.setDecayTime(t)}getTarget(){return Mu.copy(this.goalTarget).multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(t){const e=this.goalTarget,n=this.target.position;if(!e.equals(n)){const i=this.idealCameraDistance;let{x:r,y:s,z:a}=n;r=this.targetDamperX.update(r,e.x,t,i),s=this.targetDamperY.update(s,e.y,t,i),a=this.targetDamperZ.update(a,e.z,t,i),this.target.position.set(r,s,a),this.target.updateMatrixWorld(),this.setShadowRotation(this.yaw),this.isDirty=!0}}pointTowards(t,e){const{x:n,z:i}=this.position;this.yaw=Math.atan2(t-n,e-i)}set yaw(t){this.rotation.y=t,this.updateMatrixWorld(!0),this.setShadowRotation(t),this.isDirty=!0}get yaw(){return this.rotation.y}set animationTime(t){this.mixer.setTime(t)}get animationTime(){return null!=this.currentAnimationAction?this.currentAnimationAction.time:0}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(t=null,e=0){if(null==this._currentGLTF)return;const{animations:n}=this;if(null==n||0===n.length)return void console.warn("Cannot play animation (model does not have any animations)");let i=null;null!=t&&(i=this.animationsByName.get(t)),null==i&&(i=n[0]);try{const{currentAnimationAction:t}=this;this.currentAnimationAction=this.mixer.clipAction(i,this).play(),this.currentAnimationAction.enabled=!0,null!=t&&this.currentAnimationAction!==t&&this.currentAnimationAction.crossFadeFrom(t,e,!1)}catch(t){console.error(t)}}stopAnimation(){null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction.reset(),this.currentAnimationAction=null),this.mixer.stopAllAction()}updateAnimation(t){this.mixer.update(t)}updateShadow(){const t=this.shadow;if(null!=t){const e="wall"===this.element.arPlacement?"back":"bottom";t.setScene(this,this.shadowSoftness,e)}}setShadowIntensity(t){if(this.shadowIntensity=t,null==this._currentGLTF)return;let e=this.shadow;const n="wall"===this.element.arPlacement?"back":"bottom";null!=e?(e.setIntensity(t),e.setScene(this,this.shadowSoftness,n)):t>0&&(e=new yu(this,this.shadowSoftness,n),e.setIntensity(t),this.shadow=e)}setShadowSoftness(t){this.shadowSoftness=t;const e=this.shadow;null!=e&&e.setSoftness(t)}setShadowRotation(t){const e=this.shadow;null!=e&&e.setRotation(t)}isShadowDirty(){const t=this.shadow;if(null==t)return!1;{const{needsUpdate:e}=t;return t.needsUpdate=!1,e}}setShadowScaleAndOffset(t,e){const n=this.shadow;null!=n&&n.setScaleAndOffset(t,e)}positionAndNormalFromPoint(t,e=this){Cu.setFromCamera(t,this.getCamera());const n=Cu.intersectObject(e,!0);if(0===n.length)return null;const i=n[0];return null==i.face?null:(i.face.normal.applyNormalMatrix((new At).getNormalMatrix(i.object.matrixWorld)),{position:i.point,normal:i.face.normal})}addHotspot(t){this.target.add(t),this.annotationRenderer.domElement.appendChild(t.element)}removeHotspot(t){this.target.remove(t)}forHotspots(t){const{children:e}=this.target;for(let n=0,i=e.length;n<i;n++){const i=e[n];i instanceof fu&&t(i)}}updateHotspots(t){this.forHotspots((e=>{bu.copy(t),_u.setFromMatrixPosition(e.matrixWorld),bu.sub(_u),Iu.copy(e.normal).transformDirection(this.target.matrixWorld),bu.dot(Iu)<0?e.hide():e.show()}))}orientHotspots(t){this.forHotspots((e=>{e.orient(t)}))}setHotspotsVisibility(t){this.forHotspots((e=>{e.visible=t}))}}const Bu=function(){const t=new si({uniforms:{roughnessMap:{value:null},normalMap:{value:null},texelSize:{value:new pt(1,1)}},vertexShader:"\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tattribute vec3 position;\n\t\t\tattribute vec2 uv;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvUv = uv;\n\n\t\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t\t}\n\t\t",fragmentShader:"\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tuniform sampler2D roughnessMap;\n\t\t\tuniform sampler2D normalMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec4 envMapTexelToLinear( vec4 a ) { return a; }\n\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tfloat roughnessToVariance( float roughness ) {\n\n\t\t\t\tfloat variance = 0.0;\n\n\t\t\t\tif ( roughness >= r1 ) {\n\n\t\t\t\t\tvariance = ( r0 - roughness ) * ( v1 - v0 ) / ( r0 - r1 ) + v0;\n\n\t\t\t\t} else if ( roughness >= r4 ) {\n\n\t\t\t\t\tvariance = ( r1 - roughness ) * ( v4 - v1 ) / ( r1 - r4 ) + v1;\n\n\t\t\t\t} else if ( roughness >= r5 ) {\n\n\t\t\t\t\tvariance = ( r4 - roughness ) * ( v5 - v4 ) / ( r4 - r5 ) + v4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tfloat roughness2 = roughness * roughness;\n\n\t\t\t\t\tvariance = 1.79 * roughness2 * roughness2;\n\n\t\t\t\t}\n\n\t\t\t\treturn variance;\n\n\t\t\t}\n\n\t\t\tfloat varianceToRoughness( float variance ) {\n\n\t\t\t\tfloat roughness = 0.0;\n\n\t\t\t\tif ( variance >= v1 ) {\n\n\t\t\t\t\troughness = ( v0 - variance ) * ( r1 - r0 ) / ( v0 - v1 ) + r0;\n\n\t\t\t\t} else if ( variance >= v4 ) {\n\n\t\t\t\t\troughness = ( v1 - variance ) * ( r4 - r1 ) / ( v1 - v4 ) + r1;\n\n\t\t\t\t} else if ( variance >= v5 ) {\n\n\t\t\t\t\troughness = ( v4 - variance ) * ( r5 - r4 ) / ( v4 - v5 ) + r4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\troughness = pow( 0.559 * variance, 0.25 ); // 0.559 = 1.0 / 1.79\n\n\t\t\t\t}\n\n\t\t\t\treturn roughness;\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = texture2D( roughnessMap, vUv, - 1.0 );\n\n\t\t\t\tif ( texelSize.x == 0.0 ) return;\n\n\t\t\t\tfloat roughness = gl_FragColor.g;\n\n\t\t\t\tfloat variance = roughnessToVariance( roughness );\n\n\t\t\t\tvec3 avgNormal;\n\n\t\t\t\tfor ( float x = - 1.0; x < 2.0; x += 2.0 ) {\n\n\t\t\t\t\tfor ( float y = - 1.0; y < 2.0; y += 2.0 ) {\n\n\t\t\t\t\t\tvec2 uv = vUv + vec2( x, y ) * 0.25 * texelSize;\n\n\t\t\t\t\t\tavgNormal += normalize( texture2D( normalMap, uv, - 1.0 ).xyz - 0.5 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tvariance += 1.0 - 0.25 * length( avgNormal );\n\n\t\t\t\tgl_FragColor.g = varianceToRoughness( variance );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return t.type="RoughnessMipmapper",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.
 */(),Tu=new Mn(new Yn(2,2),Bu),Lu=new ri(0,1,0,1,0,1);let Ru=null,Du=null;class Qu{constructor(t){Du=t,Du.compile(Tu,Lu)}generateMipmaps(t){if("roughnessMap"in t==!1)return;const{roughnessMap:e,normalMap:n}=t;if(null===e||null===n||!e.generateMipmaps||t.userData.roughnessUpdated)return;t.userData.roughnessUpdated=!0;let i=Math.max(e.image.width,n.image.width),r=Math.max(e.image.height,n.image.height);if(!dt.isPowerOfTwo(i)||!dt.isPowerOfTwo(r))return;const s=Du.getRenderTarget(),a=Du.autoClear;if(Du.autoClear=!1,null!==Ru&&Ru.width===i&&Ru.height===r||(null!==Ru&&Ru.dispose(),Ru=new wt(i,r,{depthBuffer:!1}),Ru.scissorTest=!0),i!==e.image.width||r!==e.image.height){const n={wrapS:e.wrapS,wrapT:e.wrapT,magFilter:e.magFilter,minFilter:e.minFilter,depthBuffer:!1},s=new wt(i,r,n);s.texture.generateMipmaps=!0,Du.setRenderTarget(s),t.roughnessMap=s.texture,t.metalnessMap==e&&(t.metalnessMap=t.roughnessMap),t.aoMap==e&&(t.aoMap=t.roughnessMap),t.roughnessMap.offset.copy(e.offset),t.roughnessMap.repeat.copy(e.repeat),t.roughnessMap.center.copy(e.center),t.roughnessMap.rotation=e.rotation,t.roughnessMap.matrixAutoUpdate=e.matrixAutoUpdate,t.roughnessMap.matrix.copy(e.matrix)}Bu.uniforms.roughnessMap.value=e,Bu.uniforms.normalMap.value=n;const o=new pt(0,0),l=Bu.uniforms.texelSize.value;for(let e=0;i>=1&&r>=1;++e,i/=2,r/=2)l.set(1/i,1/r),0==e&&l.set(0,0),Ru.viewport.set(o.x,o.y,i,r),Ru.scissor.set(o.x,o.y,i,r),Du.setRenderTarget(Ru),Du.render(Tu,Lu),Du.copyFramebufferToTexture(o,t.roughnessMap,e),Bu.uniforms.roughnessMap.value=t.roughnessMap;e!==t.roughnessMap&&e.dispose(),Du.setRenderTarget(s),Du.autoClear=a}dispose(){Bu.dispose(),Tu.geometry.dispose(),null!=Ru&&Ru.dispose()}}var Pu=function(t,e,n,i){for(var r,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,n,a):r(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a};const Fu=Symbol("currentEnvironmentMap"),Nu=Symbol("applyEnvironmentMap"),Uu=Symbol("updateEnvironment"),ku=Symbol("cancelEnvironmentUpdate"),Gu=Symbol("onPreload");class Ou{constructor(t,e,n,i,r){this.xrLight=t,this.renderer=e,this.lightProbe=n,this.xrWebGLBinding=null,this.estimationStartCallback=r,this.frameCallback=this.onXRFrame.bind(this);const s=e.xr.getSession();if(i&&"XRWebGLBinding"in window){const n=new Un(16);t.environment=n.texture;const i=e.getContext();switch(s.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(s,i),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)}}onXRFrame(t,e){if(!this.xrLight)return;e.session.requestAnimationFrame(this.frameCallback);const n=e.getLightEstimate(this.lightProbe);if(n){this.xrLight.lightProbe.sh.fromArray(n.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const t=Math.max(1,Math.max(n.primaryLightIntensity.x,Math.max(n.primaryLightIntensity.y,n.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(n.primaryLightIntensity.x/t,n.primaryLightIntensity.y/t,n.primaryLightIntensity.z/t),this.xrLight.directionalLight.intensity=t,this.xrLight.directionalLight.position.copy(n.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class Hu extends Bs{constructor(t,e=!0){super(),this.lightProbe=new bl,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new wl,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let n=null,i=!1;t.xr.addEventListener("sessionstart",(()=>{const r=t.xr.getSession();"requestLightProbe"in r&&r.requestLightProbe({reflectionFormat:r.preferredReflectionFormat}).then((r=>{n=new Ou(this,t,r,e,(()=>{i=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),t.xr.addEventListener("sessionend",(()=>{n&&(n.dispose(),n=null),i&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{n&&(n.dispose(),n=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.
 */const zu=Math.PI/24,Vu=new pt,Wu=(t,e,n)=>{let i=e>0?n>0?0:-Math.PI/2:n>0?Math.PI/2:Math.PI;for(let r=0;r<=12;++r)t.push(e+.17*Math.cos(i),n+.17*Math.sin(i),0,e+.2*Math.cos(i),n+.2*Math.sin(i),0),i+=zu};class qu extends Mn{constructor(t,e){const n=new cn,i=[],r=[],{size:s,boundingBox:a}=t,o=s.x/2,l=("back"===e?s.y:s.z)/2;Wu(r,o,l),Wu(r,-o,l),Wu(r,-o,-l),Wu(r,o,-l);const c=r.length/3;for(let t=0;t<c-2;t+=2)i.push(t,t+1,t+3,t,t+3,t+2);const h=c-2;i.push(h,h+1,1,h,1,0),n.setAttribute("position",new $e(r,3)),n.setIndex(i),super(n),this.side=e;const u=this.material;switch(u.side=2,u.transparent=!0,u.opacity=0,this.goalOpacity=0,this.opacityDamper=new iu,this.hitPlane=new Mn(new Yn(2*(o+.2),2*(l+.2))),this.hitPlane.visible=!1,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)}getHit(t,e,n){Vu.set(e,-n),this.hitPlane.visible=!0;const i=t.positionAndNormalFromPoint(Vu,this.hitPlane);return this.hitPlane.visible=!1,null==i?null:i.position}getExpandedHit(t,e,n){this.hitPlane.scale.set(1e3,1e3,1e3);const i=this.getHit(t,e,n);return this.hitPlane.scale.set(1,1,1),i}set offsetHeight(t){"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:n}=this.hitPlane;e.dispose(),n.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 ju="not-presenting",Yu="session-started",Ju="object-placed",Xu="failed",Ku="tracking",Zu="not-tracking",$u=new _t,td=new ee,ed=new _t,nd=new Pn(45,1,.1,100);class id extends tt{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.oldBackground=null,this.oldEnvironment=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.environmentEstimation=!1,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new _t,this.oldFramedFieldOfView=45,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new _t,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new _t,this.goalYaw=0,this.goalScale=1,this.xDamper=new iu,this.yDamper=new iu,this.zDamper=new iu,this.yawDamper=new iu,this.scaleDamper=new iu,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new qu(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=t=>{const e=this.transientHitTestSource;if(null==e)return;const n=this.frame.getHitTestResultsForTransientInput(e),i=this.presentedScene,r=this.placementBox;if(1===n.length){this.inputSource=t.inputSource;const{axes:e}=this.inputSource.gamepad,n=r.getHit(this.presentedScene,e[0],e[1]);r.show=!0,null!=n?(this.isTranslating=!0,this.lastDragPosition.copy(n)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*e[0])}else if(2===n.length){r.show=!0,this.isTwoFingering=!0;const{separation:t}=this.fingerPolar(n);this.firstRatio=t/i.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,this.xrLight=new Hu(this.threeRenderer),this.xrLight.addEventListener("estimationstart",(()=>{if(!this.isPresenting||null==this.xrLight)return;const t=this.presentedScene;t.add(this.xrLight),this.environmentEstimation&&this.xrLight.environment&&(this.oldEnvironment=t.environment,t.environment=this.xrLight.environment)}))}async resolveARSession(){Kh();const t=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay","light-estimation"],domOverlay:{root:this.overlay}});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 Kh(),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 n=new Promise(((t,e)=>{requestAnimationFrame((()=>t()))}));t.setHotspotsVisibility(!1),t.isDirty=!0,await n,this._presentedScene=t,this.overlay=t.element.shadowRoot.querySelector("div.default"),this.environmentEstimation=e;const i=await this.resolveARSession();i.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 i.requestReferenceSpace("viewer");this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=t.yaw,this.goalYaw=t.yaw,this.goalScale=1,this.oldBackground=t.background,t.background=null,this.oldShadowIntensity=t.shadowIntensity,t.setShadowIntensity(0),this.oldTarget.copy(t.getTarget()),this.oldFramedFieldOfView=t.framedFieldOfView,t.addEventListener("model-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)});i.requestHitTestSource({space:s,offsetRay:o}).then((t=>{this.initialHitSource=t})),this.currentSession=i,this.placementBox=new qu(t,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:Yu})}async stopPresenting(){if(!this.isPresenting)return;const t=new Promise((t=>{this.resolveCleanup=t}));try{await this.currentSession.end(),await t}catch(t){console.warn("Error while trying to end WebXR AR session"),console.warn(t),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){const t=this.presentedScene;if(null!=t){const e=t.getTarget();this.oldTarget.copy(e),this.placeOnWall?e.z=t.boundingBox.min.z:e.y=t.boundingBox.min.y,t.setTarget(e.x,e.y,e.z)}}postSessionCleanup(){const t=this.currentSession;null!=t&&(t.removeEventListener("selectstart",this.onSelectStart),t.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const e=this.presentedScene;if(null!=e){const{element:t}=e;null!=this.xrLight&&null!=this.xrLight.parent&&(e.remove(this.xrLight),null!=this.oldEnvironment&&(e.environment=this.oldEnvironment,this.oldEnvironment=null)),e.position.set(0,0,0),e.scale.set(1,1,1),e.setShadowScaleAndOffset(1,0);const n=this.turntableRotation;null!=n&&(e.yaw=n);const i=this.oldShadowIntensity;null!=i&&e.setShadowIntensity(i);const r=this.oldBackground;null!=r&&(e.background=r);const s=this.oldTarget;e.setTarget(s.x,s.y,s.z),e.framedFieldOfView=this.oldFramedFieldOfView,e.xrCamera=null,e.removeEventListener("model-load",this.onUpdateScene),e.orientHotspots(0),t.requestUpdate("cameraTarget"),t.requestUpdate("maxCameraOrbit"),t[xp](t.getBoundingClientRect())}this.renderer.height=0;const n=this.exitWebXRButtonContainer;null!=n&&(n.classList.remove("enabled"),n.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const i=this.transientHitTestSource;null!=i&&(i.cancel(),this.transientHitTestSource=null);const r=this.initialHitSource;null!=r&&(r.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.oldBackground=null,this._presentedScene=null,this.frame=null,this.inputSource=null,this.overlay=null,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:ju})}updateView(t){const e=this.presentedScene,n=this.threeRenderer.xr;n.updateCamera(nd),e.xrCamera=n.getCamera();const{elements:i}=e.getCamera().matrixWorld;if(e.orientHotspots(Math.atan2(i[1],i[5])),this.initialized||(this.placeInitially(),this.initialized=!0),t.requestViewportScale&&t.recommendedViewportScale){const e=t.recommendedViewportScale;t.requestViewportScale(Math.max(e,.25))}const r=this.currentSession.renderState.baseLayer.getViewport(t);this.threeRenderer.setViewport(r.x,r.y,r.width,r.height)}placeInitially(){const t=this.presentedScene,{position:e,element:n}=t,i=t.getCamera(),{width:r,height:s}=this.overlay.getBoundingClientRect();t.setSize(r,s),i.projectionMatrixInverse.copy(i.projectionMatrix).invert();const{theta:a,radius:o}=n.getCameraOrbit(),l=i.getWorldDirection($u);t.yaw=Math.atan2(-l.x,-l.z)-a,this.goalYaw=t.yaw,e.copy(i.position).add(l.multiplyScalar(o)),this.updateTarget();const c=t.getTarget();e.add(c).sub(this.oldTarget),this.goalPosition.copy(e),t.setHotspotsVisibility(!0);const{session:h}=this.frame;h.addEventListener("selectstart",this.onSelectStart),h.addEventListener("selectend",this.onSelectEnd),h.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((t=>{this.transientHitTestSource=t}))}getTouchLocation(){const{axes:t}=this.inputSource.gamepad;let e=this.placementBox.getExpandedHit(this.presentedScene,t[0],t[1]);return null!=e&&($u.copy(e).sub(this.presentedScene.getCamera().position),$u.length()>10)?null:e}getHitPoint(t){const e=this.threeRenderer.xr.getReferenceSpace(),n=t.getPose(e);if(null==n)return null;const i=td.fromArray(n.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(i.elements[4],i.elements[6])),i.elements[5]>.75!==this.placeOnWall?ed.setFromMatrixPosition(i):null}moveToFloor(t){const e=this.initialHitSource;if(null==e)return;const n=t.getHitTestResults(e);if(0==n.length)return;const i=n[0],r=this.getHitPoint(i);null!=r&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(r):this.goalPosition.y=r.y),e.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:Ju}))}fingerPolar(t){const e=t[0].inputSource.gamepad.axes,n=t[1].inputSource.gamepad.axes,i=n[0]-e[0],r=n[1]-e[1],s=Math.atan2(r,i);let a=this.lastAngle-s;return a>Math.PI?a-=2*Math.PI:a<-Math.PI&&(a+=2*Math.PI),this.lastAngle=s,{separation:Math.sqrt(i*i+r*r),deltaYaw:a}}processInput(t){const e=this.transientHitTestSource;if(null==e)return;if(!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const n=t.getHitTestResultsForTransientInput(e),i=this.presentedScene,r=i.scale.x;if(this.isTwoFingering)if(n.length<2)this.isTwoFingering=!1;else{const{separation:t,deltaYaw:e}=this.fingerPolar(n);if(!1===this.placeOnWall&&(this.goalYaw+=e),i.canScale){const e=t/this.firstRatio;this.goalScale=e<1.3&&e>.7692307692307692?1:e}}else if(2!==n.length)if(this.isRotating){const t=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=t-this.lastAngle,this.lastAngle=t}else this.isTranslating&&n.forEach((t=>{if(t.inputSource!==this.inputSource)return;let e=null;if(t.results.length>0&&(e=this.getHitPoint(t.results[0])),null==e&&(e=this.getTouchLocation()),null!=e){if(this.goalPosition.sub(this.lastDragPosition),!1===this.placeOnWall){const t=e.y-this.lastDragPosition.y;if(t<0){this.placementBox.offsetHeight=t/r,this.presentedScene.setShadowScaleAndOffset(r,t);const n=$u.copy(i.getCamera().position),s=-t/(n.y-e.y);n.multiplyScalar(s),e.multiplyScalar(1-s).add(n)}}this.goalPosition.add(e),this.lastDragPosition.copy(e)}}));else{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:t}=this.fingerPolar(n);this.firstRatio=t/r}}moveScene(t){const e=this.presentedScene,{position:n,yaw:i,idealCameraDistance:r}=e,s=this.goalPosition,a=e.scale.x,o=this.placementBox;if(!s.equals(n)||this.goalScale!==a){let{x:i,y:l,z:c}=n;i=this.xDamper.update(i,s.x,t,r),l=this.yDamper.update(l,s.y,t,r),c=this.zDamper.update(c,s.z,t,r),n.set(i,l,c);const h=this.scaleDamper.update(a,this.goalScale,t,1);if(e.scale.set(h,h,h),!this.isTranslating){const t=s.y-l;this.placementComplete&&!1===this.placeOnWall?(o.offsetHeight=t/h,e.setShadowScaleAndOffset(h,t)):0===t&&(this.placementComplete=!0,o.show=!1,e.setShadowIntensity(.3))}}o.updateOpacity(t),e.updateTarget(t),e.yaw=this.yawDamper.update(i,this.goalYaw,t,Math.PI)}onWebXRFrame(t,e){this.frame=e,++this.frames;const n=this.threeRenderer.xr.getReferenceSpace(),i=e.getViewerPose(n);null==i&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:Zu}));const r=this.presentedScene;if(null==i||null==r||!r.element[Cp]())return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:Ku}));let s=!0;for(const n of i.views){if(this.updateView(n),s){this.moveToFloor(e),this.processInput(e);const n=t-this.lastTick;this.moveScene(n),this.renderer.preRender(r,t,n),this.lastTick=t}const i=this.threeRenderer.getContext();i.depthMask(!1),i.clear(i.DEPTH_BUFFER_BIT),i.depthMask(!0),this.threeRenderer.render(r,r.getCamera()),s=!1}}}
/* @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 rd{constructor(t){t.threeRenderer.debug={checkShaderErrors:!0},Promise.resolve().then((()=>{self.dispatchEvent(new CustomEvent("model-viewer-renderer-debug",{detail:{renderer:t,THREE:{ShaderMaterial:Dn,Texture:vt,Mesh:Mn,Scene:Ps,PlaneBufferGeometry:Yn,OrthographicCamera:ri,WebGLRenderTarget:wt}}}))}))}addScene(t){self.dispatchEvent(new CustomEvent("model-viewer-scene-added-debug",{detail:{scene:t}}))}removeScene(t){self.dispatchEvent(new CustomEvent("model-viewer-scene-removed-debug",{detail:{scene:t}}))}}function sd(t,e,n){n(t,e);for(let i=0;i<t.children.length;i++)sd(t.children[i],e.children[i],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.
 */const ad=Symbol("prepared"),od=Symbol("prepare"),ld=Symbol("preparedGLTF"),cd=Symbol("clone");class hd{constructor(t){this[ld]=t}static prepare(t){if(null==t.scene)throw new Error("Model does not have a scene");if(t[ad])return t;const e=this[od](t);return e[ad]=!0,e}static[od](t){const{scene:e}=t,n=[e];return Object.assign(Object.assign({},t),{scene:e,scenes:n})}get parser(){return this[ld].parser}get animations(){return this[ld].animations}get scene(){return this[ld].scene}get scenes(){return this[ld].scenes}get cameras(){return this[ld].cameras}get asset(){return this[ld].asset}get userData(){return this[ld].userData}clone(){return new(0,this.constructor)(this[cd]())}dispose(){this.scenes.forEach((t=>{t.traverse((t=>{if(!t.isMesh)return;const e=t;(Array.isArray(e.material)?e.material:[e.material]).forEach((t=>{for(const e in t){const n=t[e];n instanceof vt&&n.dispose()}t.dispose()})),e.geometry.dispose()}))}))}[cd](){const t=this[ld],e=class{static retarget(t,e,n={}){const i=new _t,r=new bt,s=new _t,a=new ee,o=new ee,l=new ee;n.preserveMatrix=void 0===n.preserveMatrix||n.preserveMatrix,n.preservePosition=void 0===n.preservePosition||n.preservePosition,n.preserveHipPosition=void 0!==n.preserveHipPosition&&n.preserveHipPosition,n.useTargetMatrix=void 0!==n.useTargetMatrix&&n.useTargetMatrix,n.hip=void 0!==n.hip?n.hip:"hip",n.names=n.names||{};const c=e.isObject3D?e.skeleton.bones:this.getBones(e),h=t.isObject3D?t.skeleton.bones:this.getBones(t);let u,d,p,A,m;if(t.isObject3D?t.skeleton.pose():(n.useTargetMatrix=!0,n.preserveMatrix=!1),n.preservePosition){m=[];for(let t=0;t<h.length;t++)m.push(h[t].position.clone())}if(n.preserveMatrix){t.updateMatrixWorld(),t.matrixWorld.identity();for(let e=0;e<t.children.length;++e)t.children[e].updateMatrixWorld(!0)}if(n.offsets){u=[];for(let t=0;t<h.length;++t)d=h[t],p=n.names[d.name]||d.name,n.offsets&&n.offsets[p]&&(d.matrix.multiply(n.offsets[p]),d.matrix.decompose(d.position,d.quaternion,d.scale),d.updateMatrixWorld()),u.push(d.matrixWorld.clone())}for(let e=0;e<h.length;++e){if(d=h[e],p=n.names[d.name]||d.name,A=this.getBoneByName(p,c),l.copy(d.matrixWorld),A){if(A.updateMatrixWorld(),n.useTargetMatrix?o.copy(A.matrixWorld):(o.copy(t.matrixWorld).invert(),o.multiply(A.matrixWorld)),s.setFromMatrixScale(o),o.scale(s.set(1/s.x,1/s.y,1/s.z)),l.makeRotationFromQuaternion(r.setFromRotationMatrix(o)),t.isObject3D){const e=h.indexOf(d),n=u?u[e]:a.copy(t.skeleton.boneInverses[e]).invert();l.multiply(n)}l.copyPosition(o)}d.parent&&d.parent.isBone?(d.matrix.copy(d.parent.matrixWorld).invert(),d.matrix.multiply(l)):d.matrix.copy(l),n.preserveHipPosition&&p===n.hip&&d.matrix.setPosition(i.set(0,d.position.y,0)),d.matrix.decompose(d.position,d.quaternion,d.scale),d.updateMatrixWorld()}if(n.preservePosition)for(let t=0;t<h.length;++t)d=h[t],p=n.names[d.name]||d.name,p!==n.hip&&d.position.copy(m[t]);n.preserveMatrix&&t.updateMatrixWorld(!0)}static retargetClip(t,e,n,i={}){i.useFirstFramePosition=void 0!==i.useFirstFramePosition&&i.useFirstFramePosition,i.fps=void 0!==i.fps?i.fps:30,i.names=i.names||[],e.isObject3D||(e=this.getHelperFromSkeleton(e));const r=Math.round(n.duration*(i.fps/1e3)*1e3),s=1/i.fps,a=[],o=new Gl(e),l=this.getBones(t.skeleton),c=[];let h,u,d,p,A;o.clipAction(n).play(),o.update(0),e.updateMatrixWorld();for(let n=0;n<r;++n){const a=n*s;this.retarget(t,e,i);for(let t=0;t<l.length;++t)A=i.names[l[t].name]||l[t].name,d=this.getBoneByName(A,e.skeleton),d&&(u=l[t],p=c[t]=c[t]||{bone:u},i.hip===A&&(p.pos||(p.pos={times:new Float32Array(r),values:new Float32Array(3*r)}),i.useFirstFramePosition&&(0===n&&(h=u.position.clone()),u.position.sub(h)),p.pos.times[n]=a,u.position.toArray(p.pos.values,3*n)),p.quat||(p.quat={times:new Float32Array(r),values:new Float32Array(4*r)}),p.quat.times[n]=a,u.quaternion.toArray(p.quat.values,4*n));o.update(s),e.updateMatrixWorld()}for(let t=0;t<c.length;++t)p=c[t],p&&(p.pos&&a.push(new qo(".bones["+p.bone.name+"].position",p.pos.times,p.pos.values)),a.push(new Vo(".bones["+p.bone.name+"].quaternion",p.quat.times,p.quat.values)));return o.uncacheAction(n),new jo(n.name,-1,a)}static getHelperFromSkeleton(t){const e=new jl(t.bones[0]);return e.skeleton=t,e}static getSkeletonOffsets(t,e,n={}){const i=new _t,r=new _t,s=new _t,a=new _t,o=new pt,l=new pt;n.hip=void 0!==n.hip?n.hip:"hip",n.names=n.names||{},e.isObject3D||(e=this.getHelperFromSkeleton(e));const c=Object.keys(n.names),h=Object.values(n.names),u=e.isObject3D?e.skeleton.bones:this.getBones(e),d=t.isObject3D?t.skeleton.bones:this.getBones(t),p=[];let A,m,g,f;for(t.skeleton.pose(),f=0;f<d.length;++f)if(A=d[f],g=n.names[A.name]||A.name,m=this.getBoneByName(g,u),m&&g!==n.hip){const t=this.getNearestBone(A.parent,c),e=this.getNearestBone(m.parent,h);t.updateMatrixWorld(),e.updateMatrixWorld(),i.setFromMatrixPosition(t.matrixWorld),r.setFromMatrixPosition(A.matrixWorld),s.setFromMatrixPosition(e.matrixWorld),a.setFromMatrixPosition(m.matrixWorld),o.subVectors(new pt(r.x,r.y),new pt(i.x,i.y)).normalize(),l.subVectors(new pt(a.x,a.y),new pt(s.x,s.y)).normalize();const n=o.angle()-l.angle(),u=(new ee).makeRotationFromEuler(new ue(0,0,n));A.matrix.multiply(u),A.matrix.decompose(A.position,A.quaternion,A.scale),A.updateMatrixWorld(),p[g]=u}return p}static renameBones(t,e){const n=this.getBones(t);for(let t=0;t<n.length;++t){const i=n[t];e[i.name]&&(i.name=e[i.name])}return this}static getBones(t){return Array.isArray(t)?t:t.bones}static getBoneByName(t,e){for(let n=0,i=this.getBones(e);n<i.length;n++)if(t===i[n].name)return i[n]}static getNearestBone(t,e){for(;t.isBone;){if(-1!==e.indexOf(t.name))return t;t=t.parent}}static findBoneTrackData(t,e){const n=/\[(.*)\]\.(.*)/,i={name:t};for(let r=0;r<e.length;++r){const s=n.exec(e[r].name);s&&t===s[1]&&(i[s[2]]=r)}return i}static getEqualsBonesNames(t,e){const n=this.getBones(t),i=this.getBones(e),r=[];t:for(let t=0;t<n.length;t++){const e=n[t].name;for(let t=0;t<i.length;t++)if(e===i[t].name){r.push(e);continue t}}return r}static clone(t){const e=new Map,n=new Map,i=t.clone();return sd(t,i,(function(t,i){e.set(i,t),n.set(t,i)})),i.traverse((function(t){if(!t.isSkinnedMesh)return;const i=t,r=e.get(t),s=r.skeleton.bones;i.skeleton=r.skeleton.clone(),i.bindMatrix.copy(r.bindMatrix),i.skeleton.bones=s.map((function(t){return n.get(t)})),i.bind(i.skeleton,i.bindMatrix)})),i}}.clone(this.scene);ud(e,this.scene);const n=[e],i=t.userData?Object.assign({},t.userData):{};return Object.assign(Object.assign({},t),{scene:e,scenes:n,userData:i})}}const ud=(t,e)=>{dd(t,e,((t,e)=>{void 0!==e.userData.variantMaterials&&(t.userData.variantMaterials=new Map(e.userData.variantMaterials)),void 0!==e.userData.originalMaterial&&(t.userData.originalMaterial=e.userData.originalMaterial)}))},dd=(t,e,n)=>{n(t,e);for(let i=0;i<t.children.length;i++)dd(t.children[i],e.children[i],n)},pd="\n#ifdef ALPHATEST\n\n    if ( diffuseColor.a < ALPHATEST ) discard;\n    diffuseColor.a = 1.0;\n\n#endif\n",Ad=Symbol("threeGLTF"),md=Symbol("gltf"),gd=Symbol("gltfElementMap"),fd=Symbol("threeObjectMap"),vd=Symbol("parallelTraverseThreeScene"),yd=Symbol("correlateOriginalThreeGLTF"),xd=Symbol("correlateCloneThreeGLTF");class wd{constructor(t,e,n,i){this[Ad]=t,this[md]=e,this[gd]=i,this[fd]=n}static from(t,e){return null!=e?this[xd](t,e):this[yd](t)}static[yd](t){const e=t.parser.json,{associations:n}=t.parser,i=new Map,r={name:"Default"},s={type:"materials",index:-1};return n.forEach(((t,n)=>{null==t&&(s.index<0&&(null==e.materials&&(e.materials=[]),s.index=e.materials.length,e.materials.push(r)),t=s);const{type:a,index:o}=t,l=(e[a]||[])[o];if(null==l)return;let c=i.get(l);null==c&&(c=new Set,i.set(l,c)),c.add(n)})),new wd(t,e,n,i)}static[xd](t,e){const n=e.threeGLTF,i=e.gltf,r=JSON.parse(JSON.stringify(i)),s=new Map,a=new Map,o={name:"Default"},l={type:"materials",index:-1};for(let i=0;i<n.scenes.length;i++)this[vd](n.scenes[i],t.scenes[i],((t,n)=>{let i=e.threeObjectMap.get(t);if((t.isMesh||t.isMaterial)&&null==i){if(r.materials&&r.materials.length){"Default"===r.materials[r.materials.length-1].name&&(l.index=r.materials.length-1)}l.index<0&&(null==r.materials&&(r.materials=[]),l.index=r.materials.length,r.materials.push(o)),i=l}if(null==i)return;const{type:c,index:h}=i,u=r[c][h];s.set(n,{type:c,index:h});const d=a.get(u)||new Set;d.add(n),a.set(u,d)}));return new wd(t,r,s,a)}static[vd](t,e,n){const i=(t,e)=>{if(n(t,e),t.isObject3D){if(t.isMesh)if(Array.isArray(t.material))for(let n=0;n<t.material.length;++n)i(t.material[n],e.material[n]);else i(t.material,e.material);for(let n=0;n<t.children.length;++n)i(t.children[n],e.children[n])}};i(t,e)}get threeGLTF(){return this[Ad]}get gltf(){return this[md]}get gltfElementMap(){return this[gd]}get threeObjectMap(){return this[fd]}async loadVariant(t){const e=new Set;return"variants"in this.threeGLTF.userData&&"functions"in this.threeGLTF.userData&&"selectVariant"in this.threeGLTF.userData.functions?(await this.threeGLTF.userData.functions.selectVariant(this.threeGLTF.scene,t,!0,((t,n,i)=>{e.add(i);const r=this.gltf.materials[i];let s=this.gltfElementMap.get(r);null==s&&(s=new Set,this.gltfElementMap.set(r,s)),s.add(t.material)})),e):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 Ed=Symbol("cloneAndPatchMaterial"),bd=Symbol("correlatedSceneGraph");class _d extends hd{static[od](t){const e=super[od](t);null==e[bd]&&(e[bd]=wd.from(e));const{scene:n}=e;return n.traverse((t=>{t.renderOrder=1e3,t.frustumCulled=!1,t.name||(t.name=t.uuid),t.isMesh&&(t.castShadow=!0)})),e}get correlatedSceneGraph(){return this[ld][bd]}[cd](){const t=super[cd](),e=new Map;return t.scene.traverse((t=>{if(t.isMesh){const n=t;Array.isArray(n.material)?n.material=n.material.map((t=>this[Ed](t,e))):null!=n.material&&(n.material=this[Ed](n.material,e))}})),t[bd]=wd.from(t,this.correlatedSceneGraph),t}[Ed](t,e){if(e.has(t.uuid))return e.get(t.uuid);const n=t.clone();null!=t.map&&(n.map=t.map.clone(),n.map.needsUpdate=!0),null!=t.normalMap&&(n.normalMap=t.normalMap.clone(),n.normalMap.needsUpdate=!0),null!=t.emissiveMap&&(n.emissiveMap=t.emissiveMap.clone(),n.emissiveMap.needsUpdate=!0);let i=null;if(null!=t.roughnessMap&&(i=t.roughnessMap.clone()),null!=i){i.needsUpdate=!0,n.roughnessMap=i;const{threeRenderer:t,roughnessMipmapper:e}=Dd.singleton,{enabled:r}=t.xr;t.xr.enabled=!1,e.generateMipmaps(n),t.xr.enabled=r}t.roughnessMap===t.metalnessMap?n.metalnessMap=i:null!=t.metalnessMap&&(n.metalnessMap=t.metalnessMap.clone(),n.metalnessMap.needsUpdate=!0),t.roughnessMap===t.aoMap?n.aoMap=i:null!=t.aoMap&&(n.aoMap=t.aoMap.clone(),n.aoMap.needsUpdate=!0);const r=t.onBeforeCompile;return n.onBeforeCompile=t.isGLTFSpecularGlossinessMaterial?t=>{r(t,void 0),t.fragmentShader=t.fragmentShader.replace("#include <alphatest_fragment>",pd)}:t=>{t.fragmentShader=t.fragmentShader.replace("#include <alphatest_fragment>",pd),r(t,void 0)},n.shadowSide=0,n.transparent&&(n.depthWrite=!1),n.alphaTest||n.transparent||(n.alphaTest=-.5),e.set(t.uuid,n),n}}
/* @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
jcfernandez-890825 commented 1 year ago
class fu extends zh{constructor(t){super(document.createElement("div")),this.normal=new _t(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)}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=su(t)[0].terms;for(let t=0;t<3;++t)this.position.setComponent(t,gu(e[t]).number);this.updateMatrixWorld()}updateNormal(t){if(null==t)return;const e=su(t)[0].terms;for(let t=0;t<3;++t)this.normal.setComponent(t,gu(e[t]).number)}orient(t){this.pivot.style.transform=`rotate(${t}rad)`}updateVisibility(t){t?this.element.classList.remove("hide"):this.element.classList.add("hide"),this.slot.assignedNodes().forEach((e=>{if(e.nodeType!==Node.ELEMENT_NODE)return;const n=e,i=n.dataset.visibilityAttribute;if(null!=i){const e=`data-${i}`;t?n.setAttribute(e,""):n.removeAttribute(e)}n.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:t}}))})),this.initialized=!0}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const vu=(t,e,n)=>{let i=n;const r=new _t;return t.traverse((t=>{let n,s;t.updateWorldMatrix(!1,!1);const a=t.geometry;if(void 0!==a)if(a.isGeometry){const o=a.vertices;for(n=0,s=o.length;n<s;n++)r.copy(o[n]),r.applyMatrix4(t.matrixWorld),i=e(i,r)}else if(a.isBufferGeometry){const{position:o}=a.attributes;if(void 0!==o){const a=(t=>{if(!t.normalized)return 1;const e=t.array;return e instanceof Int8Array?1/127:e instanceof Uint8Array?1/255:e instanceof Int16Array?1/32767:e instanceof Uint16Array?1/65535:1})(o);for(n=0,s=o.count;n<s;n++)r.fromBufferAttribute(o,n),r.multiplyScalar(a),r.applyMatrix4(t.matrixWorld),i=e(i,r)}}})),i};class yu extends wl{constructor(t,e,n){super(),this.shadowMaterial=new Lo,this.boundingBox=new Mt,this.size=new _t,this.shadowScale=1,this.isAnimated=!1,this.side="bottom",this.needsUpdate=!1,this.intensity=0,this.castShadow=!0,this.frustumCulled=!1,this.floor=new Mn(new Yn,this.shadowMaterial),this.floor.rotateX(-Math.PI/2),this.floor.receiveShadow=!0,this.floor.castShadow=!1,this.floor.frustumCulled=!1,this.add(this.floor),t.target.add(this),this.target=t.target,this.setScene(t,e,n)}setScene(t,e,n){if(this.side=n,this.isAnimated=t.animationNames.length>0,this.boundingBox.copy(t.boundingBox),this.size.copy(t.size),"back"===this.side){const{min:t,max:e}=this.boundingBox;[t.y,t.z]=[t.z,t.y],[e.y,e.z]=[e.z,e.y],[this.size.y,this.size.z]=[this.size.z,this.size.y],this.rotation.x=Math.PI/2,this.rotation.y=Math.PI}const{boundingBox:i,size:r}=this;if(this.isAnimated){const t=2*Math.max(r.x,r.y,r.z);r.y=t,i.expandByVector(r.subScalar(t).multiplyScalar(-.5)),i.max.y=i.min.y+t,r.set(t,t,t)}i.getCenter(this.floor.position);const s=i.max.y+.002*r.y;"bottom"===n?(this.position.y=s,this.shadow.camera.up.set(0,0,1)):(this.position.y=0,this.position.z=s,this.shadow.camera.up.set(0,1,0)),this.setSoftness(e)}setSoftness(t){const e=Math.pow(2,9-3*t);this.setMapSize(e)}setMapSize(t){const{camera:e,mapSize:n,map:i}=this.shadow,{size:r,boundingBox:s}=this;null!=i&&(i.dispose(),this.shadow.map=null),this.isAnimated&&(t*=2);const a=Math.floor(r.x>r.z?t:t*r.x/r.z),o=Math.floor(r.x>r.z?t*r.z/r.x:t);n.set(a,o);const l=2.5*r.x/a,c=2.5*r.z/o;e.left=-s.max.x-l,e.right=-s.min.x+l,e.bottom=s.min.z-c,e.top=s.max.z+c,this.setScaleAndOffset(this.shadowScale,0),this.floor.scale.set(r.x+2*l,r.z+2*c,1),this.needsUpdate=!0}setIntensity(t){this.shadowMaterial.opacity=t,t>0?(this.visible=!0,this.floor.visible=!0):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.shadowMaterial.opacity}setRotation(t){"bottom"===this.side?(this.shadow.camera.up.set(Math.sin(t),0,Math.cos(t)),this.shadow.updateMatrices(this)):this.shadow.updateMatrices(this)}setScaleAndOffset(t,e){const n=this.size.y,{camera:i}=this.shadow;this.shadowScale=t,i.near=0,i.far=n-e/t,i.updateProjectionMatrix(),i.scale.setScalar(t);const r=.002*n;this.floor.position.y=2*r-i.far}}
/* @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 xu=22.5*Math.PI/180,wu=Math.sin(xu),Eu=Math.tan(xu),bu=new _t,_u=new _t,Iu=new _t,Cu=new class{constructor(t,e,n=0,i=1/0){this.ray=new te(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new de,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){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&&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)}intersectObject(t,e=!1,n=[]){return Hl(t,this,n,e),n.sort(Ol),n}intersectObjects(t,e=!1,n=[]){for(let i=0,r=t.length;i<r;i++)Hl(t[i],this,n,e);return n.sort(Ol),n}},Mu=new _t;class Su extends Ps{constructor({canvas:t,element:e,width:n,height:i}){super(),this.context=null,this.annotationRenderer=new Jh,this.width=1,this.height=1,this.aspect=1,this.isDirty=!1,this.renderCount=0,this.externalRenderer=null,this.camera=new Pn(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new Ce,this.modelContainer=new Ce,this.animationNames=[],this.boundingBox=new Mt,this.size=new _t,this.idealCameraDistance=0,this.fieldOfViewAspect=0,this.framedFieldOfView=45,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.canScale=!0,this.tightBounds=!1,this.goalTarget=new _t,this.targetDamperX=new iu,this.targetDamperY=new iu,this.targetDamperZ=new iu,this._currentGLTF=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.name="ModelScene",this.element=e,this.canvas=t,this.camera=new Pn(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(n,i),this.target.name="Target",this.modelContainer.name="ModelContainer",this.target.add(this.modelContainer),this.mixer=new Gl(this.modelContainer);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)}createContext(){this.context=this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}async setObject(t){this.reset(),this.modelContainer.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.idealCameraDistance=t.framedRadius/wu,this.fieldOfViewAspect=t.fieldOfViewAspect,this.frameModel(),void this.dispatchEvent({type:"model-load",url:this.url})}let n;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{n=await new Promise((async(n,i)=>{this.cancelPendingSourceChange=()=>i();try{n(await this.element[wp].loader.load(t,this.element,e))}catch(t){i(t)}}))}catch(t){if(null==t)return;throw t}this.reset(),this.url=t,this._currentGLTF=n,null!=n&&this.modelContainer.add(n.scene);const{animations:i}=n,r=new Map,s=[];for(const t of i)r.set(t.name,t),s.push(t.name);this.animations=i,this.animationsByName=r,this.animationNames=s,await this.setupScene()}async setupScene(){this.updateBoundingBox();let t=null;!0===this.tightBounds&&(await this.element.requestUpdate("cameraTarget"),t=this.getTarget()),this.updateFraming(t),this.frameModel(),this.setShadowIntensity(this.shadowIntensity),this.dispatchEvent({type:"model-load",url:this.url})}reset(){this.url=null,this.isDirty=!0,null!=this.shadow&&this.shadow.setIntensity(0);const t=this._currentGLTF;if(null!=t){for(const t of this.modelContainer.children)this.modelContainer.remove(t);t.dispose(),this._currentGLTF=null}null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}get currentGLTF(){return this._currentGLTF}setSize(t,e){if(this.width!==t||this.height!==e){if(this.width=Math.max(t,1),this.height=Math.max(e,1),this.annotationRenderer.setSize(t,e),this.aspect=this.width/this.height,this.frameModel(),null!=this.externalRenderer){const n=eu();this.externalRenderer.resize(t*n,e*n)}this.isDirty=!0}}updateBoundingBox(){if(this.target.remove(this.modelContainer),!0===this.tightBounds){const t=(t,e)=>t.expandByPoint(e);this.boundingBox=vu(this.modelContainer,t,new Mt)}else this.boundingBox.setFromObject(this.modelContainer);this.boundingBox.getSize(this.size),this.target.add(this.modelContainer)}updateFraming(t=null){this.target.remove(this.modelContainer),null==t&&(t=this.boundingBox.getCenter(new _t));const e=Math.sqrt(vu(this.modelContainer,((e,n)=>Math.max(e,t.distanceToSquared(n))),0));this.idealCameraDistance=e/wu;this.fieldOfViewAspect=vu(this.modelContainer,((e,n)=>{n.sub(t);const i=Math.sqrt(n.x*n.x+n.z*n.z);return Math.max(e,i/(this.idealCameraDistance-Math.abs(n.y)))}),0)/Eu,this.target.add(this.modelContainer)}frameModel(){const t=Eu*Math.max(1,this.fieldOfViewAspect/this.aspect);this.framedFieldOfView=2*Math.atan(t)*180/Math.PI}getSize(){return{width:this.width,height:this.height}}setTarget(t,e,n){this.goalTarget.set(-t,-e,-n)}setTargetDamperDecayTime(t){this.targetDamperX.setDecayTime(t),this.targetDamperY.setDecayTime(t),this.targetDamperZ.setDecayTime(t)}getTarget(){return Mu.copy(this.goalTarget).multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(t){const e=this.goalTarget,n=this.target.position;if(!e.equals(n)){const i=this.idealCameraDistance;let{x:r,y:s,z:a}=n;r=this.targetDamperX.update(r,e.x,t,i),s=this.targetDamperY.update(s,e.y,t,i),a=this.targetDamperZ.update(a,e.z,t,i),this.target.position.set(r,s,a),this.target.updateMatrixWorld(),this.setShadowRotation(this.yaw),this.isDirty=!0}}pointTowards(t,e){const{x:n,z:i}=this.position;this.yaw=Math.atan2(t-n,e-i)}set yaw(t){this.rotation.y=t,this.updateMatrixWorld(!0),this.setShadowRotation(t),this.isDirty=!0}get yaw(){return this.rotation.y}set animationTime(t){this.mixer.setTime(t)}get animationTime(){return null!=this.currentAnimationAction?this.currentAnimationAction.time:0}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(t=null,e=0){if(null==this._currentGLTF)return;const{animations:n}=this;if(null==n||0===n.length)return void console.warn("Cannot play animation (model does not have any animations)");let i=null;null!=t&&(i=this.animationsByName.get(t)),null==i&&(i=n[0]);try{const{currentAnimationAction:t}=this;this.currentAnimationAction=this.mixer.clipAction(i,this).play(),this.currentAnimationAction.enabled=!0,null!=t&&this.currentAnimationAction!==t&&this.currentAnimationAction.crossFadeFrom(t,e,!1)}catch(t){console.error(t)}}stopAnimation(){null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction.reset(),this.currentAnimationAction=null),this.mixer.stopAllAction()}updateAnimation(t){this.mixer.update(t)}updateShadow(){const t=this.shadow;if(null!=t){const e="wall"===this.element.arPlacement?"back":"bottom";t.setScene(this,this.shadowSoftness,e)}}setShadowIntensity(t){if(this.shadowIntensity=t,null==this._currentGLTF)return;let e=this.shadow;const n="wall"===this.element.arPlacement?"back":"bottom";null!=e?(e.setIntensity(t),e.setScene(this,this.shadowSoftness,n)):t>0&&(e=new yu(this,this.shadowSoftness,n),e.setIntensity(t),this.shadow=e)}setShadowSoftness(t){this.shadowSoftness=t;const e=this.shadow;null!=e&&e.setSoftness(t)}setShadowRotation(t){const e=this.shadow;null!=e&&e.setRotation(t)}isShadowDirty(){const t=this.shadow;if(null==t)return!1;{const{needsUpdate:e}=t;return t.needsUpdate=!1,e}}setShadowScaleAndOffset(t,e){const n=this.shadow;null!=n&&n.setScaleAndOffset(t,e)}positionAndNormalFromPoint(t,e=this){Cu.setFromCamera(t,this.getCamera());const n=Cu.intersectObject(e,!0);if(0===n.length)return null;const i=n[0];return null==i.face?null:(i.face.normal.applyNormalMatrix((new At).getNormalMatrix(i.object.matrixWorld)),{position:i.point,normal:i.face.normal})}addHotspot(t){this.target.add(t),this.annotationRenderer.domElement.appendChild(t.element)}removeHotspot(t){this.target.remove(t)}forHotspots(t){const{children:e}=this.target;for(let n=0,i=e.length;n<i;n++){const i=e[n];i instanceof fu&&t(i)}}updateHotspots(t){this.forHotspots((e=>{bu.copy(t),_u.setFromMatrixPosition(e.matrixWorld),bu.sub(_u),Iu.copy(e.normal).transformDirection(this.target.matrixWorld),bu.dot(Iu)<0?e.hide():e.show()}))}orientHotspots(t){this.forHotspots((e=>{e.orient(t)}))}setHotspotsVisibility(t){this.forHotspots((e=>{e.visible=t}))}}const Bu=function(){const t=new si({uniforms:{roughnessMap:{value:null},normalMap:{value:null},texelSize:{value:new pt(1,1)}},vertexShader:"\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tattribute vec3 position;\n\t\t\tattribute vec2 uv;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvUv = uv;\n\n\t\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t\t}\n\t\t",fragmentShader:"\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tuniform sampler2D roughnessMap;\n\t\t\tuniform sampler2D normalMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec4 envMapTexelToLinear( vec4 a ) { return a; }\n\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tfloat roughnessToVariance( float roughness ) {\n\n\t\t\t\tfloat variance = 0.0;\n\n\t\t\t\tif ( roughness >= r1 ) {\n\n\t\t\t\t\tvariance = ( r0 - roughness ) * ( v1 - v0 ) / ( r0 - r1 ) + v0;\n\n\t\t\t\t} else if ( roughness >= r4 ) {\n\n\t\t\t\t\tvariance = ( r1 - roughness ) * ( v4 - v1 ) / ( r1 - r4 ) + v1;\n\n\t\t\t\t} else if ( roughness >= r5 ) {\n\n\t\t\t\t\tvariance = ( r4 - roughness ) * ( v5 - v4 ) / ( r4 - r5 ) + v4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tfloat roughness2 = roughness * roughness;\n\n\t\t\t\t\tvariance = 1.79 * roughness2 * roughness2;\n\n\t\t\t\t}\n\n\t\t\t\treturn variance;\n\n\t\t\t}\n\n\t\t\tfloat varianceToRoughness( float variance ) {\n\n\t\t\t\tfloat roughness = 0.0;\n\n\t\t\t\tif ( variance >= v1 ) {\n\n\t\t\t\t\troughness = ( v0 - variance ) * ( r1 - r0 ) / ( v0 - v1 ) + r0;\n\n\t\t\t\t} else if ( variance >= v4 ) {\n\n\t\t\t\t\troughness = ( v1 - variance ) * ( r4 - r1 ) / ( v1 - v4 ) + r1;\n\n\t\t\t\t} else if ( variance >= v5 ) {\n\n\t\t\t\t\troughness = ( v4 - variance ) * ( r5 - r4 ) / ( v4 - v5 ) + r4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\troughness = pow( 0.559 * variance, 0.25 ); // 0.559 = 1.0 / 1.79\n\n\t\t\t\t}\n\n\t\t\t\treturn roughness;\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = texture2D( roughnessMap, vUv, - 1.0 );\n\n\t\t\t\tif ( texelSize.x == 0.0 ) return;\n\n\t\t\t\tfloat roughness = gl_FragColor.g;\n\n\t\t\t\tfloat variance = roughnessToVariance( roughness );\n\n\t\t\t\tvec3 avgNormal;\n\n\t\t\t\tfor ( float x = - 1.0; x < 2.0; x += 2.0 ) {\n\n\t\t\t\t\tfor ( float y = - 1.0; y < 2.0; y += 2.0 ) {\n\n\t\t\t\t\t\tvec2 uv = vUv + vec2( x, y ) * 0.25 * texelSize;\n\n\t\t\t\t\t\tavgNormal += normalize( texture2D( normalMap, uv, - 1.0 ).xyz - 0.5 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tvariance += 1.0 - 0.25 * length( avgNormal );\n\n\t\t\t\tgl_FragColor.g = varianceToRoughness( variance );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return t.type="RoughnessMipmapper",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.
 */(),Tu=new Mn(new Yn(2,2),Bu),Lu=new ri(0,1,0,1,0,1);let Ru=null,Du=null;class Qu{constructor(t){Du=t,Du.compile(Tu,Lu)}generateMipmaps(t){if("roughnessMap"in t==!1)return;const{roughnessMap:e,normalMap:n}=t;if(null===e||null===n||!e.generateMipmaps||t.userData.roughnessUpdated)return;t.userData.roughnessUpdated=!0;let i=Math.max(e.image.width,n.image.width),r=Math.max(e.image.height,n.image.height);if(!dt.isPowerOfTwo(i)||!dt.isPowerOfTwo(r))return;const s=Du.getRenderTarget(),a=Du.autoClear;if(Du.autoClear=!1,null!==Ru&&Ru.width===i&&Ru.height===r||(null!==Ru&&Ru.dispose(),Ru=new wt(i,r,{depthBuffer:!1}),Ru.scissorTest=!0),i!==e.image.width||r!==e.image.height){const n={wrapS:e.wrapS,wrapT:e.wrapT,magFilter:e.magFilter,minFilter:e.minFilter,depthBuffer:!1},s=new wt(i,r,n);s.texture.generateMipmaps=!0,Du.setRenderTarget(s),t.roughnessMap=s.texture,t.metalnessMap==e&&(t.metalnessMap=t.roughnessMap),t.aoMap==e&&(t.aoMap=t.roughnessMap),t.roughnessMap.offset.copy(e.offset),t.roughnessMap.repeat.copy(e.repeat),t.roughnessMap.center.copy(e.center),t.roughnessMap.rotation=e.rotation,t.roughnessMap.matrixAutoUpdate=e.matrixAutoUpdate,t.roughnessMap.matrix.copy(e.matrix)}Bu.uniforms.roughnessMap.value=e,Bu.uniforms.normalMap.value=n;const o=new pt(0,0),l=Bu.uniforms.texelSize.value;for(let e=0;i>=1&&r>=1;++e,i/=2,r/=2)l.set(1/i,1/r),0==e&&l.set(0,0),Ru.viewport.set(o.x,o.y,i,r),Ru.scissor.set(o.x,o.y,i,r),Du.setRenderTarget(Ru),Du.render(Tu,Lu),Du.copyFramebufferToTexture(o,t.roughnessMap,e),Bu.uniforms.roughnessMap.value=t.roughnessMap;e!==t.roughnessMap&&e.dispose(),Du.setRenderTarget(s),Du.autoClear=a}dispose(){Bu.dispose(),Tu.geometry.dispose(),null!=Ru&&Ru.dispose()}}var Pu=function(t,e,n,i){for(var r,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,n,a):r(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a};const Fu=Symbol("currentEnvironmentMap"),Nu=Symbol("applyEnvironmentMap"),Uu=Symbol("updateEnvironment"),ku=Symbol("cancelEnvironmentUpdate"),Gu=Symbol("onPreload");class Ou{constructor(t,e,n,i,r){this.xrLight=t,this.renderer=e,this.lightProbe=n,this.xrWebGLBinding=null,this.estimationStartCallback=r,this.frameCallback=this.onXRFrame.bind(this);const s=e.xr.getSession();if(i&&"XRWebGLBinding"in window){const n=new Un(16);t.environment=n.texture;const i=e.getContext();switch(s.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(s,i),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)}}onXRFrame(t,e){if(!this.xrLight)return;e.session.requestAnimationFrame(this.frameCallback);const n=e.getLightEstimate(this.lightProbe);if(n){this.xrLight.lightProbe.sh.fromArray(n.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const t=Math.max(1,Math.max(n.primaryLightIntensity.x,Math.max(n.primaryLightIntensity.y,n.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(n.primaryLightIntensity.x/t,n.primaryLightIntensity.y/t,n.primaryLightIntensity.z/t),this.xrLight.directionalLight.intensity=t,this.xrLight.directionalLight.position.copy(n.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class Hu extends Bs{constructor(t,e=!0){super(),this.lightProbe=new bl,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new wl,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let n=null,i=!1;t.xr.addEventListener("sessionstart",(()=>{const r=t.xr.getSession();"requestLightProbe"in r&&r.requestLightProbe({reflectionFormat:r.preferredReflectionFormat}).then((r=>{n=new Ou(this,t,r,e,(()=>{i=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),t.xr.addEventListener("sessionend",(()=>{n&&(n.dispose(),n=null),i&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{n&&(n.dispose(),n=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.
 */const zu=Math.PI/24,Vu=new pt,Wu=(t,e,n)=>{let i=e>0?n>0?0:-Math.PI/2:n>0?Math.PI/2:Math.PI;for(let r=0;r<=12;++r)t.push(e+.17*Math.cos(i),n+.17*Math.sin(i),0,e+.2*Math.cos(i),n+.2*Math.sin(i),0),i+=zu};class qu extends Mn{constructor(t,e){const n=new cn,i=[],r=[],{size:s,boundingBox:a}=t,o=s.x/2,l=("back"===e?s.y:s.z)/2;Wu(r,o,l),Wu(r,-o,l),Wu(r,-o,-l),Wu(r,o,-l);const c=r.length/3;for(let t=0;t<c-2;t+=2)i.push(t,t+1,t+3,t,t+3,t+2);const h=c-2;i.push(h,h+1,1,h,1,0),n.setAttribute("position",new $e(r,3)),n.setIndex(i),super(n),this.side=e;const u=this.material;switch(u.side=2,u.transparent=!0,u.opacity=0,this.goalOpacity=0,this.opacityDamper=new iu,this.hitPlane=new Mn(new Yn(2*(o+.2),2*(l+.2))),this.hitPlane.visible=!1,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)}getHit(t,e,n){Vu.set(e,-n),this.hitPlane.visible=!0;const i=t.positionAndNormalFromPoint(Vu,this.hitPlane);return this.hitPlane.visible=!1,null==i?null:i.position}getExpandedHit(t,e,n){this.hitPlane.scale.set(1e3,1e3,1e3);const i=this.getHit(t,e,n);return this.hitPlane.scale.set(1,1,1),i}set offsetHeight(t){"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:n}=this.hitPlane;e.dispose(),n.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 ju="not-presenting",Yu="session-started",Ju="object-placed",Xu="failed",Ku="tracking",Zu="not-tracking",$u=new _t,td=new ee,ed=new _t,nd=new Pn(45,1,.1,100);class id extends tt{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.oldBackground=null,this.oldEnvironment=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.environmentEstimation=!1,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new _t,this.oldFramedFieldOfView=45,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new _t,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new _t,this.goalYaw=0,this.goalScale=1,this.xDamper=new iu,this.yDamper=new iu,this.zDamper=new iu,this.yawDamper=new iu,this.scaleDamper=new iu,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new qu(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=t=>{const e=this.transientHitTestSource;if(null==e)return;const n=this.frame.getHitTestResultsForTransientInput(e),i=this.presentedScene,r=this.placementBox;if(1===n.length){this.inputSource=t.inputSource;const{axes:e}=this.inputSource.gamepad,n=r.getHit(this.presentedScene,e[0],e[1]);r.show=!0,null!=n?(this.isTranslating=!0,this.lastDragPosition.copy(n)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*e[0])}else if(2===n.length){r.show=!0,this.isTwoFingering=!0;const{separation:t}=this.fingerPolar(n);this.firstRatio=t/i.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,this.xrLight=new Hu(this.threeRenderer),this.xrLight.addEventListener("estimationstart",(()=>{if(!this.isPresenting||null==this.xrLight)return;const t=this.presentedScene;t.add(this.xrLight),this.environmentEstimation&&this.xrLight.environment&&(this.oldEnvironment=t.environment,t.environment=this.xrLight.environment)}))}async resolveARSession(){Kh();const t=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay","light-estimation"],domOverlay:{root:this.overlay}});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 Kh(),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 n=new Promise(((t,e)=>{requestAnimationFrame((()=>t()))}));t.setHotspotsVisibility(!1),t.isDirty=!0,await n,this._presentedScene=t,this.overlay=t.element.shadowRoot.querySelector("div.default"),this.environmentEstimation=e;const i=await this.resolveARSession();i.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 i.requestReferenceSpace("viewer");this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=t.yaw,this.goalYaw=t.yaw,this.goalScale=1,this.oldBackground=t.background,t.background=null,this.oldShadowIntensity=t.shadowIntensity,t.setShadowIntensity(0),this.oldTarget.copy(t.getTarget()),this.oldFramedFieldOfView=t.framedFieldOfView,t.addEventListener("model-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)});i.requestHitTestSource({space:s,offsetRay:o}).then((t=>{this.initialHitSource=t})),this.currentSession=i,this.placementBox=new qu(t,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:Yu})}async stopPresenting(){if(!this.isPresenting)return;const t=new Promise((t=>{this.resolveCleanup=t}));try{await this.currentSession.end(),await t}catch(t){console.warn("Error while trying to end WebXR AR session"),console.warn(t),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){const t=this.presentedScene;if(null!=t){const e=t.getTarget();this.oldTarget.copy(e),this.placeOnWall?e.z=t.boundingBox.min.z:e.y=t.boundingBox.min.y,t.setTarget(e.x,e.y,e.z)}}postSessionCleanup(){const t=this.currentSession;null!=t&&(t.removeEventListener("selectstart",this.onSelectStart),t.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const e=this.presentedScene;if(null!=e){const{element:t}=e;null!=this.xrLight&&null!=this.xrLight.parent&&(e.remove(this.xrLight),null!=this.oldEnvironment&&(e.environment=this.oldEnvironment,this.oldEnvironment=null)),e.position.set(0,0,0),e.scale.set(1,1,1),e.setShadowScaleAndOffset(1,0);const n=this.turntableRotation;null!=n&&(e.yaw=n);const i=this.oldShadowIntensity;null!=i&&e.setShadowIntensity(i);const r=this.oldBackground;null!=r&&(e.background=r);const s=this.oldTarget;e.setTarget(s.x,s.y,s.z),e.framedFieldOfView=this.oldFramedFieldOfView,e.xrCamera=null,e.removeEventListener("model-load",this.onUpdateScene),e.orientHotspots(0),t.requestUpdate("cameraTarget"),t.requestUpdate("maxCameraOrbit"),t[xp](t.getBoundingClientRect())}this.renderer.height=0;const n=this.exitWebXRButtonContainer;null!=n&&(n.classList.remove("enabled"),n.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const i=this.transientHitTestSource;null!=i&&(i.cancel(),this.transientHitTestSource=null);const r=this.initialHitSource;null!=r&&(r.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.oldBackground=null,this._presentedScene=null,this.frame=null,this.inputSource=null,this.overlay=null,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:ju})}updateView(t){const e=this.presentedScene,n=this.threeRenderer.xr;n.updateCamera(nd),e.xrCamera=n.getCamera();const{elements:i}=e.getCamera().matrixWorld;if(e.orientHotspots(Math.atan2(i[1],i[5])),this.initialized||(this.placeInitially(),this.initialized=!0),t.requestViewportScale&&t.recommendedViewportScale){const e=t.recommendedViewportScale;t.requestViewportScale(Math.max(e,.25))}const r=this.currentSession.renderState.baseLayer.getViewport(t);this.threeRenderer.setViewport(r.x,r.y,r.width,r.height)}placeInitially(){const t=this.presentedScene,{position:e,element:n}=t,i=t.getCamera(),{width:r,height:s}=this.overlay.getBoundingClientRect();t.setSize(r,s),i.projectionMatrixInverse.copy(i.projectionMatrix).invert();const{theta:a,radius:o}=n.getCameraOrbit(),l=i.getWorldDirection($u);t.yaw=Math.atan2(-l.x,-l.z)-a,this.goalYaw=t.yaw,e.copy(i.position).add(l.multiplyScalar(o)),this.updateTarget();const c=t.getTarget();e.add(c).sub(this.oldTarget),this.goalPosition.copy(e),t.setHotspotsVisibility(!0);const{session:h}=this.frame;h.addEventListener("selectstart",this.onSelectStart),h.addEventListener("selectend",this.onSelectEnd),h.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((t=>{this.transientHitTestSource=t}))}getTouchLocation(){const{axes:t}=this.inputSource.gamepad;let e=this.placementBox.getExpandedHit(this.presentedScene,t[0],t[1]);return null!=e&&($u.copy(e).sub(this.presentedScene.getCamera().position),$u.length()>10)?null:e}getHitPoint(t){const e=this.threeRenderer.xr.getReferenceSpace(),n=t.getPose(e);if(null==n)return null;const i=td.fromArray(n.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(i.elements[4],i.elements[6])),i.elements[5]>.75!==this.placeOnWall?ed.setFromMatrixPosition(i):null}moveToFloor(t){const e=this.initialHitSource;if(null==e)return;const n=t.getHitTestResults(e);if(0==n.length)return;const i=n[0],r=this.getHitPoint(i);null!=r&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(r):this.goalPosition.y=r.y),e.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:Ju}))}fingerPolar(t){const e=t[0].inputSource.gamepad.axes,n=t[1].inputSource.gamepad.axes,i=n[0]-e[0],r=n[1]-e[1],s=Math.atan2(r,i);let a=this.lastAngle-s;return a>Math.PI?a-=2*Math.PI:a<-Math.PI&&(a+=2*Math.PI),this.lastAngle=s,{separation:Math.sqrt(i*i+r*r),deltaYaw:a}}processInput(t){const e=this.transientHitTestSource;if(null==e)return;if(!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const n=t.getHitTestResultsForTransientInput(e),i=this.presentedScene,r=i.scale.x;if(this.isTwoFingering)if(n.length<2)this.isTwoFingering=!1;else{const{separation:t,deltaYaw:e}=this.fingerPolar(n);if(!1===this.placeOnWall&&(this.goalYaw+=e),i.canScale){const e=t/this.firstRatio;this.goalScale=e<1.3&&e>.7692307692307692?1:e}}else if(2!==n.length)if(this.isRotating){const t=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=t-this.lastAngle,this.lastAngle=t}else this.isTranslating&&n.forEach((t=>{if(t.inputSource!==this.inputSource)return;let e=null;if(t.results.length>0&&(e=this.getHitPoint(t.results[0])),null==e&&(e=this.getTouchLocation()),null!=e){if(this.goalPosition.sub(this.lastDragPosition),!1===this.placeOnWall){const t=e.y-this.lastDragPosition.y;if(t<0){this.placementBox.offsetHeight=t/r,this.presentedScene.setShadowScaleAndOffset(r,t);const n=$u.copy(i.getCamera().position),s=-t/(n.y-e.y);n.multiplyScalar(s),e.multiplyScalar(1-s).add(n)}}this.goalPosition.add(e),this.lastDragPosition.copy(e)}}));else{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:t}=this.fingerPolar(n);this.firstRatio=t/r}}moveScene(t){const e=this.presentedScene,{position:n,yaw:i,idealCameraDistance:r}=e,s=this.goalPosition,a=e.scale.x,o=this.placementBox;if(!s.equals(n)||this.goalScale!==a){let{x:i,y:l,z:c}=n;i=this.xDamper.update(i,s.x,t,r),l=this.yDamper.update(l,s.y,t,r),c=this.zDamper.update(c,s.z,t,r),n.set(i,l,c);const h=this.scaleDamper.update(a,this.goalScale,t,1);if(e.scale.set(h,h,h),!this.isTranslating){const t=s.y-l;this.placementComplete&&!1===this.placeOnWall?(o.offsetHeight=t/h,e.setShadowScaleAndOffset(h,t)):0===t&&(this.placementComplete=!0,o.show=!1,e.setShadowIntensity(.3))}}o.updateOpacity(t),e.updateTarget(t),e.yaw=this.yawDamper.update(i,this.goalYaw,t,Math.PI)}onWebXRFrame(t,e){this.frame=e,++this.frames;const n=this.threeRenderer.xr.getReferenceSpace(),i=e.getViewerPose(n);null==i&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:Zu}));const r=this.presentedScene;if(null==i||null==r||!r.element[Cp]())return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:Ku}));let s=!0;for(const n of i.views){if(this.updateView(n),s){this.moveToFloor(e),this.processInput(e);const n=t-this.lastTick;this.moveScene(n),this.renderer.preRender(r,t,n),this.lastTick=t}const i=this.threeRenderer.getContext();i.depthMask(!1),i.clear(i.DEPTH_BUFFER_BIT),i.depthMask(!0),this.threeRenderer.render(r,r.getCamera()),s=!1}}}
/* @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 rd{constructor(t){t.threeRenderer.debug={checkShaderErrors:!0},Promise.resolve().then((()=>{self.dispatchEvent(new CustomEvent("model-viewer-renderer-debug",{detail:{renderer:t,THREE:{ShaderMaterial:Dn,Texture:vt,Mesh:Mn,Scene:Ps,PlaneBufferGeometry:Yn,OrthographicCamera:ri,WebGLRenderTarget:wt}}}))}))}addScene(t){self.dispatchEvent(new CustomEvent("model-viewer-scene-added-debug",{detail:{scene:t}}))}removeScene(t){self.dispatchEvent(new CustomEvent("model-viewer-scene-removed-debug",{detail:{scene:t}}))}}function sd(t,e,n){n(t,e);for(let i=0;i<t.children.length;i++)sd(t.children[i],e.children[i],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.
 */const ad=Symbol("prepared"),od=Symbol("prepare"),ld=Symbol("preparedGLTF"),cd=Symbol("clone");class hd{constructor(t){this[ld]=t}static prepare(t){if(null==t.scene)throw new Error("Model does not have a scene");if(t[ad])return t;const e=this[od](t);return e[ad]=!0,e}static[od](t){const{scene:e}=t,n=[e];return Object.assign(Object.assign({},t),{scene:e,scenes:n})}get parser(){return this[ld].parser}get animations(){return this[ld].animations}get scene(){return this[ld].scene}get scenes(){return this[ld].scenes}get cameras(){return this[ld].cameras}get asset(){return this[ld].asset}get userData(){return this[ld].userData}clone(){return new(0,this.constructor)(this[cd]())}dispose(){this.scenes.forEach((t=>{t.traverse((t=>{if(!t.isMesh)return;const e=t;(Array.isArray(e.material)?e.material:[e.material]).forEach((t=>{for(const e in t){const n=t[e];n instanceof vt&&n.dispose()}t.dispose()})),e.geometry.dispose()}))}))}[cd](){const t=this[ld],e=class{static retarget(t,e,n={}){const i=new _t,r=new bt,s=new _t,a=new ee,o=new ee,l=new ee;n.preserveMatrix=void 0===n.preserveMatrix||n.preserveMatrix,n.preservePosition=void 0===n.preservePosition||n.preservePosition,n.preserveHipPosition=void 0!==n.preserveHipPosition&&n.preserveHipPosition,n.useTargetMatrix=void 0!==n.useTargetMatrix&&n.useTargetMatrix,n.hip=void 0!==n.hip?n.hip:"hip",n.names=n.names||{};const c=e.isObject3D?e.skeleton.bones:this.getBones(e),h=t.isObject3D?t.skeleton.bones:this.getBones(t);let u,d,p,A,m;if(t.isObject3D?t.skeleton.pose():(n.useTargetMatrix=!0,n.preserveMatrix=!1),n.preservePosition){m=[];for(let t=0;t<h.length;t++)m.push(h[t].position.clone())}if(n.preserveMatrix){t.updateMatrixWorld(),t.matrixWorld.identity();for(let e=0;e<t.children.length;++e)t.children[e].updateMatrixWorld(!0)}if(n.offsets){u=[];for(let t=0;t<h.length;++t)d=h[t],p=n.names[d.name]||d.name,n.offsets&&n.offsets[p]&&(d.matrix.multiply(n.offsets[p]),d.matrix.decompose(d.position,d.quaternion,d.scale),d.updateMatrixWorld()),u.push(d.matrixWorld.clone())}for(let e=0;e<h.length;++e){if(d=h[e],p=n.names[d.name]||d.name,A=this.getBoneByName(p,c),l.copy(d.matrixWorld),A){if(A.updateMatrixWorld(),n.useTargetMatrix?o.copy(A.matrixWorld):(o.copy(t.matrixWorld).invert(),o.multiply(A.matrixWorld)),s.setFromMatrixScale(o),o.scale(s.set(1/s.x,1/s.y,1/s.z)),l.makeRotationFromQuaternion(r.setFromRotationMatrix(o)),t.isObject3D){const e=h.indexOf(d),n=u?u[e]:a.copy(t.skeleton.boneInverses[e]).invert();l.multiply(n)}l.copyPosition(o)}d.parent&&d.parent.isBone?(d.matrix.copy(d.parent.matrixWorld).invert(),d.matrix.multiply(l)):d.matrix.copy(l),n.preserveHipPosition&&p===n.hip&&d.matrix.setPosition(i.set(0,d.position.y,0)),d.matrix.decompose(d.position,d.quaternion,d.scale),d.updateMatrixWorld()}if(n.preservePosition)for(let t=0;t<h.length;++t)d=h[t],p=n.names[d.name]||d.name,p!==n.hip&&d.position.copy(m[t]);n.preserveMatrix&&t.updateMatrixWorld(!0)}static retargetClip(t,e,n,i={}){i.useFirstFramePosition=void 0!==i.useFirstFramePosition&&i.useFirstFramePosition,i.fps=void 0!==i.fps?i.fps:30,i.names=i.names||[],e.isObject3D||(e=this.getHelperFromSkeleton(e));const r=Math.round(n.duration*(i.fps/1e3)*1e3),s=1/i.fps,a=[],o=new Gl(e),l=this.getBones(t.skeleton),c=[];let h,u,d,p,A;o.clipAction(n).play(),o.update(0),e.updateMatrixWorld();for(let n=0;n<r;++n){const a=n*s;this.retarget(t,e,i);for(let t=0;t<l.length;++t)A=i.names[l[t].name]||l[t].name,d=this.getBoneByName(A,e.skeleton),d&&(u=l[t],p=c[t]=c[t]||{bone:u},i.hip===A&&(p.pos||(p.pos={times:new Float32Array(r),values:new Float32Array(3*r)}),i.useFirstFramePosition&&(0===n&&(h=u.position.clone()),u.position.sub(h)),p.pos.times[n]=a,u.position.toArray(p.pos.values,3*n)),p.quat||(p.quat={times:new Float32Array(r),values:new Float32Array(4*r)}),p.quat.times[n]=a,u.quaternion.toArray(p.quat.values,4*n));o.update(s),e.updateMatrixWorld()}for(let t=0;t<c.length;++t)p=c[t],p&&(p.pos&&a.push(new qo(".bones["+p.bone.name+"].position",p.pos.times,p.pos.values)),a.push(new Vo(".bones["+p.bone.name+"].quaternion",p.quat.times,p.quat.values)));return o.uncacheAction(n),new jo(n.name,-1,a)}static getHelperFromSkeleton(t){const e=new jl(t.bones[0]);return e.skeleton=t,e}static getSkeletonOffsets(t,e,n={}){const i=new _t,r=new _t,s=new _t,a=new _t,o=new pt,l=new pt;n.hip=void 0!==n.hip?n.hip:"hip",n.names=n.names||{},e.isObject3D||(e=this.getHelperFromSkeleton(e));const c=Object.keys(n.names),h=Object.values(n.names),u=e.isObject3D?e.skeleton.bones:this.getBones(e),d=t.isObject3D?t.skeleton.bones:this.getBones(t),p=[];let A,m,g,f;for(t.skeleton.pose(),f=0;f<d.length;++f)if(A=d[f],g=n.names[A.name]||A.name,m=this.getBoneByName(g,u),m&&g!==n.hip){const t=this.getNearestBone(A.parent,c),e=this.getNearestBone(m.parent,h);t.updateMatrixWorld(),e.updateMatrixWorld(),i.setFromMatrixPosition(t.matrixWorld),r.setFromMatrixPosition(A.matrixWorld),s.setFromMatrixPosition(e.matrixWorld),a.setFromMatrixPosition(m.matrixWorld),o.subVectors(new pt(r.x,r.y),new pt(i.x,i.y)).normalize(),l.subVectors(new pt(a.x,a.y),new pt(s.x,s.y)).normalize();const n=o.angle()-l.angle(),u=(new ee).makeRotationFromEuler(new ue(0,0,n));A.matrix.multiply(u),A.matrix.decompose(A.position,A.quaternion,A.scale),A.updateMatrixWorld(),p[g]=u}return p}static renameBones(t,e){const n=this.getBones(t);for(let t=0;t<n.length;++t){const i=n[t];e[i.name]&&(i.name=e[i.name])}return this}static getBones(t){return Array.isArray(t)?t:t.bones}static getBoneByName(t,e){for(let n=0,i=this.getBones(e);n<i.length;n++)if(t===i[n].name)return i[n]}static getNearestBone(t,e){for(;t.isBone;){if(-1!==e.indexOf(t.name))return t;t=t.parent}}static findBoneTrackData(t,e){const n=/\[(.*)\]\.(.*)/,i={name:t};for(let r=0;r<e.length;++r){const s=n.exec(e[r].name);s&&t===s[1]&&(i[s[2]]=r)}return i}static getEqualsBonesNames(t,e){const n=this.getBones(t),i=this.getBones(e),r=[];t:for(let t=0;t<n.length;t++){const e=n[t].name;for(let t=0;t<i.length;t++)if(e===i[t].name){r.push(e);continue t}}return r}static clone(t){const e=new Map,n=new Map,i=t.clone();return sd(t,i,(function(t,i){e.set(i,t),n.set(t,i)})),i.traverse((function(t){if(!t.isSkinnedMesh)return;const i=t,r=e.get(t),s=r.skeleton.bones;i.skeleton=r.skeleton.clone(),i.bindMatrix.copy(r.bindMatrix),i.skeleton.bones=s.map((function(t){return n.get(t)})),i.bind(i.skeleton,i.bindMatrix)})),i}}.clone(this.scene);ud(e,this.scene);const n=[e],i=t.userData?Object.assign({},t.userData):{};return Object.assign(Object.assign({},t),{scene:e,scenes:n,userData:i})}}const ud=(t,e)=>{dd(t,e,((t,e)=>{void 0!==e.userData.variantMaterials&&(t.userData.variantMaterials=new Map(e.userData.variantMaterials)),void 0!==e.userData.originalMaterial&&(t.userData.originalMaterial=e.userData.originalMaterial)}))},dd=(t,e,n)=>{n(t,e);for(let i=0;i<t.children.length;i++)dd(t.children[i],e.children[i],n)},pd="\n#ifdef ALPHATEST\n\n    if ( diffuseColor.a < ALPHATEST ) discard;\n    diffuseColor.a = 1.0;\n\n#endif\n",Ad=Symbol("threeGLTF"),md=Symbol("gltf"),gd=Symbol("gltfElementMap"),fd=Symbol("threeObjectMap"),vd=Symbol("parallelTraverseThreeScene"),yd=Symbol("correlateOriginalThreeGLTF"),xd=Symbol("correlateCloneThreeGLTF");class wd{constructor(t,e,n,i){this[Ad]=t,this[md]=e,this[gd]=i,this[fd]=n}static from(t,e){return null!=e?this[xd](t,e):this[yd](t)}static[yd](t){const e=t.parser.json,{associations:n}=t.parser,i=new Map,r={name:"Default"},s={type:"materials",index:-1};return n.forEach(((t,n)=>{null==t&&(s.index<0&&(null==e.materials&&(e.materials=[]),s.index=e.materials.length,e.materials.push(r)),t=s);const{type:a,index:o}=t,l=(e[a]||[])[o];if(null==l)return;let c=i.get(l);null==c&&(c=new Set,i.set(l,c)),c.add(n)})),new wd(t,e,n,i)}static[xd](t,e){const n=e.threeGLTF,i=e.gltf,r=JSON.parse(JSON.stringify(i)),s=new Map,a=new Map,o={name:"Default"},l={type:"materials",index:-1};for(let i=0;i<n.scenes.length;i++)this[vd](n.scenes[i],t.scenes[i],((t,n)=>{let i=e.threeObjectMap.get(t);if((t.isMesh||t.isMaterial)&&null==i){if(r.materials&&r.materials.length){"Default"===r.materials[r.materials.length-1].name&&(l.index=r.materials.length-1)}l.index<0&&(null==r.materials&&(r.materials=[]),l.index=r.materials.length,r.materials.push(o)),i=l}if(null==i)return;const{type:c,index:h}=i,u=r[c][h];s.set(n,{type:c,index:h});const d=a.get(u)||new Set;d.add(n),a.set(u,d)}));return new wd(t,r,s,a)}static[vd](t,e,n){const i=(t,e)=>{if(n(t,e),t.isObject3D){if(t.isMesh)if(Array.isArray(t.material))for(let n=0;n<t.material.length;++n)i(t.material[n],e.material[n]);else i(t.material,e.material);for(let n=0;n<t.children.length;++n)i(t.children[n],e.children[n])}};i(t,e)}get threeGLTF(){return this[Ad]}get gltf(){return this[md]}get gltfElementMap(){return this[gd]}get threeObjectMap(){return this[fd]}async loadVariant(t){const e=new Set;return"variants"in this.threeGLTF.userData&&"functions"in this.threeGLTF.userData&&"selectVariant"in this.threeGLTF.userData.functions?(await this.threeGLTF.userData.functions.selectVariant(this.threeGLTF.scene,t,!0,((t,n,i)=>{e.add(i);const r=this.gltf.materials[i];let s=this.gltfElementMap.get(r);null==s&&(s=new Set,this.gltfElementMap.set(r,s)),s.add(t.material)})),e):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 Ed=Symbol("cloneAndPatchMaterial"),bd=Symbol("correlatedSceneGraph");class _d extends hd{static[od](t){const e=super[od](t);null==e[bd]&&(e[bd]=wd.from(e));const{scene:n}=e;return n.traverse((t=>{t.renderOrder=1e3,t.frustumCulled=!1,t.name||(t.name=t.uuid),t.isMesh&&(t.castShadow=!0)})),e}get correlatedSceneGraph(){return this[ld][bd]}[cd](){const t=super[cd](),e=new Map;return t.scene.traverse((t=>{if(t.isMesh){const n=t;Array.isArray(n.material)?n.material=n.material.map((t=>this[Ed](t,e))):null!=n.material&&(n.material=this[Ed](n.material,e))}})),t[bd]=wd.from(t,this.correlatedSceneGraph),t}[Ed](t,e){if(e.has(t.uuid))return e.get(t.uuid);const n=t.clone();null!=t.map&&(n.map=t.map.clone(),n.map.needsUpdate=!0),null!=t.normalMap&&(n.normalMap=t.normalMap.clone(),n.normalMap.needsUpdate=!0),null!=t.emissiveMap&&(n.emissiveMap=t.emissiveMap.clone(),n.emissiveMap.needsUpdate=!0);let i=null;if(null!=t.roughnessMap&&(i=t.roughnessMap.clone()),null!=i){i.needsUpdate=!0,n.roughnessMap=i;const{threeRenderer:t,roughnessMipmapper:e}=Dd.singleton,{enabled:r}=t.xr;t.xr.enabled=!1,e.generateMipmaps(n),t.xr.enabled=r}t.roughnessMap===t.metalnessMap?n.metalnessMap=i:null!=t.metalnessMap&&(n.metalnessMap=t.metalnessMap.clone(),n.metalnessMap.needsUpdate=!0),t.roughnessMap===t.aoMap?n.aoMap=i:null!=t.aoMap&&(n.aoMap=t.aoMap.clone(),n.aoMap.needsUpdate=!0);const r=t.onBeforeCompile;return n.onBeforeCompile=t.isGLTFSpecularGlossinessMaterial?t=>{r(t,void 0),t.fragmentShader=t.fragmentShader.replace("#include <alphatest_fragment>",pd)}:t=>{t.fragmentShader=t.fragmentShader.replace("#include <alphatest_fragment>",pd),r(t,void 0)},n.shadowSide=0,n.transparent&&(n.depthWrite=!1),n.alphaTest||n.transparent||(n.alphaTest=-.5),e.set(t.uuid,n),n}}
/* @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.
 */
class Id extends Ps{constructor(){super(),this.position.y=-3.5;const t=new Bn;t.deleteAttribute("uv");const e=new Ro({metalness:0,side:1}),n=new Ro({metalness:0}),i=new yl(16777215,500,28,2);i.position.set(.418,16.199,.3),this.add(i);const r=new Mn(t,e);r.position.set(-.757,13.219,.717),r.scale.set(31.713,28.305,28.591),this.add(r);const s=new Mn(t,n);s.position.set(-10.906,2.009,1.846),s.rotation.set(0,-.195,0),s.scale.set(2.328,7.905,4.651),this.add(s);const a=new Mn(t,n);a.position.set(-5.607,-.754,-.758),a.rotation.set(0,.994,0),a.scale.set(1.97,1.534,3.955),this.add(a);const o=new Mn(t,n);o.position.set(6.167,.857,7.803),o.rotation.set(0,.561,0),o.scale.set(3.927,6.285,3.687),this.add(o);const l=new Mn(t,n);l.position.set(-2.017,.018,6.124),l.rotation.set(0,.333,0),l.scale.set(2.002,4.566,2.064),this.add(l);const c=new Mn(t,n);c.position.set(2.291,-.756,-2.621),c.rotation.set(0,-.286,0),c.scale.set(1.546,1.552,1.496),this.add(c);const h=new Mn(t,n);h.position.set(-2.193,-.369,-5.547),h.rotation.set(0,.516,0),h.scale.set(3.875,3.487,2.986),this.add(h);const u=new Mn(t,this.createAreaLightMaterial(50));u.position.set(-16.116,14.37,8.208),u.scale.set(.1,2.428,2.739),this.add(u);const d=new Mn(t,this.createAreaLightMaterial(50));d.position.set(-16.109,18.021,-8.207),d.scale.set(.1,2.425,2.751),this.add(d);const p=new Mn(t,this.createAreaLightMaterial(17));p.position.set(14.904,12.198,-1.832),p.scale.set(.15,4.265,6.331),this.add(p);const A=new Mn(t,this.createAreaLightMaterial(43));A.position.set(-.462,8.89,14.52),A.scale.set(4.38,5.441,.088),this.add(A);const m=new Mn(t,this.createAreaLightMaterial(20));m.position.set(3.235,11.486,-12.541),m.scale.set(2.5,2,.1),this.add(m);const g=new Mn(t,this.createAreaLightMaterial(100));g.position.set(0,20,0),g.scale.set(1,.1,1),this.add(g)}createAreaLightMaterial(t){const e=new je;return e.color.setScalar(t),e}}
/* @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Cd extends Ps{constructor(){super(),this.position.y=-3.5;const t=new Bn;t.deleteAttribute("uv");const e=new Ro({metalness:0,side:1}),n=new Ro({metalness:0}),i=new yl(16777215,400,28,2);i.position.set(.5,14,.5),this.add(i);const r=new Mn(t,e);r.position.set(0,13.2,0),r.scale.set(31.5,28.5,31.5),this.add(r);const s=new Mn(t,n);s.position.set(-10.906,-1,1.846),s.rotation.set(0,-.195,0),s.scale.set(2.328,7.905,4.651),this.add(s);const a=new Mn(t,n);a.position.set(-5.607,-.754,-.758),a.rotation.set(0,.994,0),a.scale.set(1.97,1.534,3.955),this.add(a);const o=new Mn(t,n);o.position.set(6.167,-.16,7.803),o.rotation.set(0,.561,0),o.scale.set(3.927,6.285,3.687),this.add(o);const l=new Mn(t,n);l.position.set(-2.017,.018,6.124),l.rotation.set(0,.333,0),l.scale.set(2.002,4.566,2.064),this.add(l);const c=new Mn(t,n);c.position.set(2.291,-.756,-2.621),c.rotation.set(0,-.286,0),c.scale.set(1.546,1.552,1.496),this.add(c);const h=new Mn(t,n);h.position.set(-2.193,-.369,-5.547),h.rotation.set(0,.516,0),h.scale.set(3.875,3.487,2.986),this.add(h);const u=new Mn(t,this.createAreaLightMaterial(80));u.position.set(-14,10,8),u.scale.set(.1,2.5,2.5),this.add(u);const d=new Mn(t,this.createAreaLightMaterial(80));d.position.set(-14,14,-4),d.scale.set(.1,2.5,2.5),this.add(d);const p=new Mn(t,this.createAreaLightMaterial(23));p.position.set(14,12,0),p.scale.set(.1,5,5),this.add(p);const A=new Mn(t,this.createAreaLightMaterial(16));A.position.set(0,9,14),A.scale.set(5,5,.1),this.add(A);const m=new Mn(t,this.createAreaLightMaterial(80));m.position.set(7,8,-14),m.scale.set(2.5,2.5,.1),this.add(m);const g=new Mn(t,this.createAreaLightMaterial(80));g.position.set(-7,16,-14),g.scale.set(2.5,2.5,.1),this.add(g);const f=new Mn(t,this.createAreaLightMaterial(1));f.position.set(0,20,0),f.scale.set(.1,.1,.1),this.add(f)}createAreaLightMaterial(t){const e=new je;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 Md=/\.hdr(\.js)?$/,Sd=new rl,Bd=new class extends il{constructor(t){super(t),this.type=1015}parse(t){const e=function(t,e){switch(t){case 1:console.error("THREE.RGBELoader Read Error: "+(e||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(e||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(e||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(e||""))}return-1},n=function(t,e,n){e=e||1024;let i=t.pos,r=-1,s=0,a="",o=String.fromCharCode.apply(null,new Uint16Array(t.subarray(i,i+128)));for(;0>(r=o.indexOf("\n"))&&s<e&&i<t.byteLength;)a+=o,s+=o.length,i+=128,o+=String.fromCharCode.apply(null,new Uint16Array(t.subarray(i,i+128)));return-1<r&&(!1!==n&&(t.pos+=s+r+1),a+o.slice(0,r))},i=function(t,e,n,i){const r=t[e+3],s=Math.pow(2,r-128)/255;n[i+0]=t[e+0]*s,n[i+1]=t[e+1]*s,n[i+2]=t[e+2]*s},r=function(t,e,n,i){const r=t[e+3],s=Math.pow(2,r-128)/255;n[i+0]=Kl.toHalfFloat(t[e+0]*s),n[i+1]=Kl.toHalfFloat(t[e+1]*s),n[i+2]=Kl.toHalfFloat(t[e+2]*s)},s=new Uint8Array(t);s.pos=0;const a=function(t){const i=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,a=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,c;if(t.pos>=t.byteLength||!(l=n(t)))return e(1,"no header found");if(!(c=l.match(/^#\?(\S+)/)))return e(3,"bad initial token");for(o.valid|=1,o.programtype=c[1],o.string+=l+"\n";l=n(t),!1!==l;)if(o.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(i))&&(o.gamma=parseFloat(c[1],10)),(c=l.match(r))&&(o.exposure=parseFloat(c[1],10)),(c=l.match(s))&&(o.valid|=2,o.format=c[1]),(c=l.match(a))&&(o.valid|=4,o.height=parseInt(c[1],10),o.width=parseInt(c[2],10)),2&o.valid&&4&o.valid)break}else o.comments+=l+"\n";return 2&o.valid?4&o.valid?o:e(3,"missing image size specifier"):e(3,"missing format specifier")}(s);if(-1!==a){const t=a.width,n=a.height,o=function(t,n,i){const r=n;if(r<8||r>32767||2!==t[0]||2!==t[1]||128&t[2])return new Uint8Array(t);if(r!==(t[2]<<8|t[3]))return e(3,"wrong scanline width");const s=new Uint8Array(4*n*i);if(!s.length)return e(4,"unable to allocate buffer space");let a=0,o=0;const l=4*r,c=new Uint8Array(4),h=new Uint8Array(l);let u=i;for(;u>0&&o<t.byteLength;){if(o+4>t.byteLength)return e(1);if(c[0]=t[o++],c[1]=t[o++],c[2]=t[o++],c[3]=t[o++],2!=c[0]||2!=c[1]||(c[2]<<8|c[3])!=r)return e(3,"bad rgbe scanline format");let n,i=0;for(;i<l&&o<t.byteLength;){n=t[o++];const r=n>128;if(r&&(n-=128),0===n||i+n>l)return e(3,"bad scanline data");if(r){const e=t[o++];for(let t=0;t<n;t++)h[i++]=e}else h.set(t.subarray(o,o+n),i),i+=n,o+=n}const d=r;for(let t=0;t<d;t++){let e=0;s[a]=h[t+e],e+=r,s[a+1]=h[t+e],e+=r,s[a+2]=h[t+e],e+=r,s[a+3]=h[t+e],a+=4}u--}return s}(s.subarray(s.pos),t,n);if(-1!==o){let e,s,l,c;switch(this.type){case 1009:e=o,s=1023,l=1009;break;case 1015:c=o.length/4*3;const t=new Float32Array(c);for(let e=0;e<c;e++)i(o,4*e,t,3*e);e=t,s=1022,l=1015;break;case 1016:c=o.length/4*3;const n=new Uint16Array(c);for(let t=0;t<c;t++)r(o,4*t,n,3*t);e=n,s=1022,l=1016;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:t,height:n,data:e,header:a.string,gamma:a.gamma,exposure:a.exposure,format:s,type:l}}}return null}setDataType(t){return this.type=t,this}load(t,e,n,i){return super.load(t,(function(t,n){switch(t.type){case 1009:t.encoding=3002,t.minFilter=1003,t.magFilter=1003,t.generateMipmaps=!1,t.flipY=!0;break;case 1015:case 1016:t.encoding=3e3,t.minFilter=1006,t.magFilter=1006,t.generateMipmaps=!1,t.flipY=!0}e&&e(t,n)}),n,i)}};Bd.setDataType(1009);const Td={url:null};class Ld extends tt{constructor(t){super(),this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.environmentMapCache=new Map,this.PMREMGenerator=new Ei(t)}async load(t,e=(()=>{})){try{const n=Md.test(t),i=n?Bd:Sd,r=await new Promise(((n,r)=>i.load(t,n,(t=>{e(t.loaded/t.total*.9)}),r)));return e(1),this.addMetadata(r,t),r.mapping=303,n||(r.encoding=3007),r}finally{e&&e(1)}}async generateEnvironmentMapAndSkybox(t=null,e=null,n={}){const{progressTracker:i}=n,r=null!=i?i.beginActivity():()=>{},s="neutral"===e;!0===s&&(e=null);const a=Xh(e);try{let e,n=Promise.resolve(null);t&&(n=this.loadSkyboxFromUrl(t,i)),e=a?this.loadEnvironmentMapFromUrl(a,i):t?this.loadEnvironmentMapFromUrl(t,i):!0===s?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();let[o,l]=await Promise.all([e,n]);if(null==o)throw new Error("Failed to load environment map.");return{environmentMap:o,skybox:l}}finally{r(1)}}addMetadata(t,e){null!=t&&(t.userData=Object.assign(Object.assign({},Td),{url:e}))}loadSkyboxFromUrl(t,e){if(!this.skyboxCache.has(t)){const n=e?e.beginActivity():()=>{},i=this.load(t,n);this.skyboxCache.set(t,i)}return this.skyboxCache.get(t)}loadEnvironmentMapFromUrl(t,e){if(!this.environmentMapCache.has(t)){const n=this.loadSkyboxFromUrl(t,e).then((e=>{const n=this.PMREMGenerator.fromEquirectangular(e);return this.addMetadata(n.texture,t),n}));this.PMREMGenerator.compileEquirectangularShader(),this.environmentMapCache.set(t,n)}return this.environmentMapCache.get(t)}loadGeneratedEnvironmentMap(){if(null==this.generatedEnvironmentMap){const t=new Id;this.generatedEnvironmentMap=this.PMREMGenerator.fromScene(t,.04),this.addMetadata(this.generatedEnvironmentMap.texture,null)}return Promise.resolve(this.generatedEnvironmentMap)}loadGeneratedEnvironmentMapAlt(){if(null==this.generatedEnvironmentMapAlt){const t=new Cd;this.generatedEnvironmentMapAlt=this.PMREMGenerator.fromScene(t,.04),this.addMetadata(this.generatedEnvironmentMapAlt.texture,null)}return Promise.resolve(this.generatedEnvironmentMapAlt)}async dispose(){const t=[];this.environmentMapCache.forEach((e=>{t.push(e)})),this.environmentMapCache.clear();for(const e of t)try{(await e).dispose()}catch(t){}null!=this.generatedEnvironmentMap&&(this.generatedEnvironmentMap.dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt.dispose(),this.generatedEnvironmentMapAlt=null)}}
/* @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 Rd=[1,.79,.62,.5,.4,.31,.25];class Dd extends tt{constructor(t){super(),this.loader=new Hh(_d),this.width=0,this.height=0,this.dpr=1,this.debugger=null,this.scenes=new Set,this.multipleScenesVisible=!1,this.scaleStep=0,this.lastStep=3,this.avgFrameDuration=22,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 Ld(this.threeRenderer),this.roughnessMipmapper=new Qu(this.threeRenderer);for(const t of this.scenes)t.element[Uu]();this.threeRenderer.shadowMap.needsUpdate=!0},this.dpr=eu(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas";try{this.threeRenderer=new Qs({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:t.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.outputEncoding=3007,this.threeRenderer.physicallyCorrectLights=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.shadowMap.enabled=!0,this.threeRenderer.shadowMap.type=2,this.threeRenderer.shadowMap.autoUpdate=!1,this.debugger=t.debug?new rd(this):null,this.threeRenderer.debug={checkShaderErrors:!!this.debugger},this.threeRenderer.toneMapping=4}catch(t){console.warn(t)}this.arRenderer=new id(this),this.textureUtils=this.canRender?new Ld(this.threeRenderer):null,this.roughnessMipmapper=new Qu(this.threeRenderer),Hh.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize(),this.lastTick=performance.now(),this.avgFrameDuration=0}static get singleton(){return this._singleton}static resetSingleton(){const t=this._singleton.dispose();for(const e of t)e.disconnectedCallback();this._singleton=new Dd({powerPreference:(self.ModelViewerElement||{}).powerPreference||"high-performance",debug:nu()});for(const e of t)e.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return Rd[this.scaleStep]}set minScale(t){let e=1;for(;e<Rd.length&&!(Rd[e]<t);)++e;this.lastStep=e-1}updateRendererSize(){const t=eu();if(t!==this.dpr)for(const t of this.scenes){const{element:e}=t;e[sp](e.getBoundingClientRect())}let e=0,n=0;for(const t of this.scenes)e=Math.max(e,t.width),n=Math.max(n,t.height);if(e===this.width&&n===this.height&&t===this.dpr)return;this.width=e,this.height=n,this.dpr=t,this.canRender&&this.threeRenderer.setSize(e*t,n*t,!1);const i=this.scaleFactor,r=e/i,s=n/i;this.canvas3D.style.width=`${r}px`,this.canvas3D.style.height=`${s}px`;for(const i of this.scenes){const{canvas:a}=i;a.width=Math.round(e*t),a.height=Math.round(n*t),a.style.width=`${r}px`,a.style.height=`${s}px`,i.isDirty=!0}}updateRendererScale(){const t=this.scaleStep;if(this.avgFrameDuration>26&&this.scaleStep<this.lastStep?++this.scaleStep:this.avgFrameDuration<18&&this.scaleStep>0&&--this.scaleStep,t==this.scaleStep)return;const e=this.scaleFactor;this.avgFrameDuration=22;const n=this.width/e,i=this.height/e;this.canvas3D.style.width=`${n}px`,this.canvas3D.style.height=`${i}px`;for(const t of this.scenes){const{style:e}=t.canvas;e.width=`${n}px`,e.height=`${i}px`,t.isDirty=!0}}registerScene(t){this.scenes.add(t);const{canvas:e}=t,n=this.scaleFactor;e.width=Math.round(this.width*this.dpr),e.height=Math.round(this.height*this.dpr),e.style.width=this.width/n+"px",e.style.height=this.height/n+"px",this.multipleScenesVisible&&e.classList.add("show"),t.isDirty=!0,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop(((t,e)=>this.render(t,e))),null!=this.debugger&&this.debugger.addScene(t)}unregisterScene(t){this.scenes.delete(t),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null),null!=this.debugger&&this.debugger.removeScene(t)}displayCanvas(t){return this.multipleScenesVisible?t.element[mp]:this.canvas3D}selectCanvas(){let t=0,e=null;for(const n of this.scenes){const{element:i}=n;i.modelIsVisible&&null==n.externalRenderer&&(++t,e=n.canvas)}if(null==e)return;const n=t>1,{canvas3D:i}=this;if(n!==this.multipleScenesVisible||!n&&i.parentElement!==e.parentElement){this.multipleScenesVisible=n,n&&i.classList.remove("show");for(const t of this.scenes){if(null!=t.externalRenderer)continue;const r=t.element[mp];n?(r.classList.add("show"),t.isDirty=!0):t.canvas===e&&(t.canvas.parentElement.appendChild(i),i.classList.add("show"),r.classList.remove("show"),t.isDirty=!0)}}}orderedScenes(){const t=[];for(const e of[!1,!0])for(const n of this.scenes)n.element.modelIsVisible===e&&t.push(n);return t}get isPresenting(){return this.arRenderer.isPresenting}preRender(t,e,n){const{element:i,exposure:r}=t;i[vp](e,n);const s="number"==typeof r&&!self.isNaN(r);this.threeRenderer.toneMappingExposure=s?r:1,t.isShadowDirty()&&(this.threeRenderer.shadowMap.needsUpdate=!0)}render(t,e){if(null!=e)return void this.arRenderer.onWebXRFrame(t,e);const n=t-this.lastTick;if(this.lastTick=t,!this.canRender||this.isPresenting)return;this.avgFrameDuration+=tu(.2*(n-this.avgFrameDuration),-2,2),this.selectCanvas(),this.updateRendererSize(),this.updateRendererScale();const{dpr:i,scaleFactor:r}=this;for(const e of this.orderedScenes()){const{element:s}=e;if(!s.modelIsVisible&&e.renderCount>0)continue;if(this.preRender(e,t,n),!e.isDirty)continue;if(null!=e.externalRenderer){const t=e.getCamera();t.updateMatrix();const{matrix:n,projectionMatrix:i}=t,r=n.elements.slice(),s=e.getTarget();r[12]+=s.x,r[13]+=s.y,r[14]+=s.z,e.externalRenderer.render({viewMatrix:r,projectionMatrix:i.elements});continue}if(!s.modelIsVisible&&!this.multipleScenesVisible)for(const t of this.scenes)t.element.modelIsVisible&&(t.isDirty=!0);const a=Math.min(Math.ceil(e.width*r*i),this.canvas3D.width),o=Math.min(Math.ceil(e.height*r*i),this.canvas3D.height);if(this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.floor(this.height*i)-o,a,o),this.threeRenderer.render(e,e.camera),this.multipleScenesVisible){null==e.context&&e.createContext();const t=e.context;t.clearRect(0,0,a,o),t.drawImage(this.canvas3D,0,0,a,o,0,0,a,o)}e.isDirty=!1,s.loaded&&++e.renderCount}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.roughnessMipmapper&&this.roughnessMipmapper.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const t=[];for(const e of this.scenes)t.push(e.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),t}}Dd._singleton=new Dd({powerPreference:(self.ModelViewerElement||{}).powerPreference||"high-performance",debug:nu()});
/* @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.
 */
jcfernandez-890825 commented 1 year ago
var Qd,Pd;const Fd=Symbol("ongoingActivities"),Nd=Symbol("announceTotalProgress"),Ud=Symbol("eventDelegate");class kd{constructor(){this[Qd]=document.createDocumentFragment(),this.addEventListener=(...t)=>this[Ud].addEventListener(...t),this.removeEventListener=(...t)=>this[Ud].removeEventListener(...t),this.dispatchEvent=(...t)=>this[Ud].dispatchEvent(...t),this[Pd]=new Set}get ongoingActivityCount(){return this[Fd].size}beginActivity(){const t={progress:0};return this[Fd].add(t),1===this.ongoingActivityCount&&this[Nd](),e=>{let n;return n=Math.max(tu(e,0,1),t.progress),n!==t.progress&&(t.progress=n,this[Nd]()),t.progress}}[(Qd=Ud,Pd=Fd,Nd)](){let t=0,e=0,n=0;for(const i of this[Fd]){const{progress:r}=i;t+=r*(.5/Math.pow(2,e++)),1===r&&n++}n===this.ongoingActivityCount&&(t=1,this[Fd].clear()),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress: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 Gd,Od,Hd,zd,Vd,Wd,qd,jd,Yd,Jd,Xd=function(t,e,n,i){for(var r,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,n,a):r(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a};const Kd=document.createElement("canvas"),Zd=Symbol("template"),$d=Symbol("fallbackResizeHandler"),tp=Symbol("defaultAriaLabel"),ep=Symbol("resizeObserver"),np=Symbol("clearModelTimeout"),ip=Symbol("onContextLost"),rp=Symbol("loaded"),sp=Symbol("updateSize"),ap=Symbol("intersectionObserver"),op=Symbol("isElementInViewport"),lp=Symbol("announceModelVisibility"),cp=Symbol("ariaLabel"),hp=Symbol("loadedTime"),up=Symbol("updateSource"),dp=Symbol("markLoaded"),pp=Symbol("container"),Ap=Symbol("input"),mp=Symbol("canvas"),gp=Symbol("scene"),fp=Symbol("needsRender"),vp=Symbol("tick"),yp=Symbol("onModelLoad"),xp=Symbol("onResize"),wp=Symbol("renderer"),Ep=Symbol("progressTracker"),bp=Symbol("getLoaded"),_p=Symbol("getModelIsVisible"),Ip=Symbol("shouldAttemptPreload"),Cp=Symbol("sceneIsReady"),Mp=Symbol("hasTransitioned"),Sp=t=>({x:t.x,y:t.y,z:t.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}});class Bp extends Q{constructor(){super(),this.alt=null,this.src=null,this[Gd]=!1,this[Od]=!1,this[Hd]=0,this[zd]=null,this[Vd]=$h((()=>{const t=this.getBoundingClientRect();this[sp](t)}),50),this[Wd]=$h((t=>{const e=this.modelIsVisible;e!==t&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:e}}))}),0),this[qd]=null,this[jd]=null,this[Yd]=new kd,this[Jd]=t=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:t.sourceEvent}}))};const t=this.constructor.template;window.ShadyCSS&&window.ShadyCSS.styleElement(this,{}),this.attachShadow({mode:"open"});const e=this.shadowRoot;let n,i;if(e.appendChild(t.content.cloneNode(!0)),this[pp]=e.querySelector(".container"),this[Ap]=e.querySelector(".userInput"),this[mp]=e.querySelector("canvas"),this[tp]=this[Ap].getAttribute("aria-label"),this.isConnected){const t=this.getBoundingClientRect();n=t.width,i=t.height}else n=300,i=150;this[gp]=new Su({canvas:this[mp],element:this,width:n,height:i}),this[gp].addEventListener("model-load",(async t=>{this[dp](),this[yp](),await((t=0)=>new Promise((e=>setTimeout(e,t))))(),this.dispatchEvent(new CustomEvent("load",{detail:{url:t.url}}))})),Promise.resolve().then((()=>{this[sp](this.getBoundingClientRect())})),V&&(this[ep]=new ResizeObserver((t=>{if(!this[wp].isPresenting)for(let e of t)e.target===this&&this[sp](e.contentRect)}))),W?this[ap]=new IntersectionObserver((t=>{for(let e of t)if(e.target===this){const t=this.modelIsVisible;this[op]=e.isIntersecting,this[lp](t),this[op]&&!this[Cp]()&&this[up]()}}),{root:null,rootMargin:"0px",threshold:0}):this[op]=!0}static get is(){return"model-viewer"}static get template(){return this.hasOwnProperty(Zd)||(this[Zd]=(t=>{const e=document.createElement("template");return e.innerHTML=$.innerHTML,window.ShadyCSS&&window.ShadyCSS.prepareTemplate(e,t),e})(this.is)),this[Zd]}static set modelCacheSize(t){Hh[Gh].evictionThreshold=t}static get modelCacheSize(){return Hh[Gh].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."),Dd.singleton.minScale=t}static get minimumRenderScale(){return Dd.singleton.minScale}get loaded(){return this[bp]()}get[(Gd=op,Od=rp,Hd=hp,zd=np,Vd=$d,Wd=lp,qd=ep,jd=ap,Yd=Ep,wp)](){return Dd.singleton}get modelIsVisible(){return this[_p]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),V?this[ep].observe(this):self.addEventListener("resize",this[$d]),W&&this[ap].observe(this);const t=this[wp];t.addEventListener("contextlost",this[ip]),t.registerScene(this[gp]),null!=this[np]&&(self.clearTimeout(this[np]),this[np]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),V?this[ep].unobserve(this):self.removeEventListener("resize",this[$d]),W&&this[ap].unobserve(this);const t=this[wp];t.removeEventListener("contextlost",this[ip]),t.unregisterScene(this[gp]),this[np]=self.setTimeout((()=>{this[gp].reset()}),1e3)}updated(t){if(super.updated(t),t.has("src")&&(null==this.src?(this[rp]=!1,this[hp]=0,this[gp].reset()):this.src!==this[gp].url&&(this[rp]=!1,this[hp]=0,this[up]())),t.has("alt")){const t=null==this.alt?this[tp]:this.alt;this[Ap].setAttribute("aria-label",t)}}toDataURL(t,e){return this[wp].displayCanvas(this[gp]).toDataURL(t,e)}async toBlob(t){const e=t?t.mimeType:void 0,n=t?t.qualityArgument:void 0,i=t?t.idealAspect:void 0,{width:r,height:s,fieldOfViewAspect:a,aspect:o}=this[gp],{dpr:l,scaleFactor:c}=this[wp];let h=r*c*l,u=s*c*l,d=0,p=0;if(!0===i)if(a>o){const t=u;u=Math.round(h/a),p=(t-u)/2}else{const t=h;h=Math.round(u*a),d=(t-h)/2}Kd.width=h,Kd.height=u;try{return new Promise((async(t,i)=>(Kd.getContext("2d").drawImage(this[wp].displayCanvas(this[gp]),d,p,h,u,0,0,h,u),!Kd.msToBlob||e&&"image/png"!==e?Kd.toBlob?void Kd.toBlob((e=>{if(!e)return i(new Error("Unable to retrieve canvas blob"));t(e)}),e,n):t(await(async t=>new Promise(((e,n)=>{const i=t.match(/data:(.*);/);if(!i)return n(new Error(`${t} is not a valid data Url`));const r=i[1],s=t.replace(/data:image\/\w+;base64,/,""),a=atob(s),o=[];for(let t=0;t<a.length;t+=512){const e=a.slice(t,t+512),n=new Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);const i=new Uint8Array(n);o.push(i)}e(new Blob(o,{type:r}))})))(Kd.toDataURL(e,n))):t(Kd.msToBlob()))))}finally{this[sp]({width:r,height:s})}}registerRenderer(t){this[gp].externalRenderer=t}unregisterRenderer(){this[gp].externalRenderer=null}get[cp](){return null==this.alt||"null"===this.alt?this[tp]:this.alt}[bp](){return this[rp]}[_p](){return this.loaded&&this[op]}[Mp](){return this.modelIsVisible}[Ip](){return!!this.src&&this[op]}[Cp](){return this[rp]}[sp]({width:t,height:e}){this[pp].style.width=`${t}px`,this[pp].style.height=`${e}px`,this[xp]({width:parseFloat(t),height:parseFloat(e)})}[vp](t,e){}[dp](){this[rp]||(this[rp]=!0,this[hp]=performance.now())}[fp](){this[gp].isDirty=!0}[yp](){}[xp](t){this[gp].setSize(t.width,t.height)}async[(Jd=ip,up)](){if(this.loaded||!this[Ip]())return;const t=this[Ep].beginActivity(),e=this.src;try{await this[gp].setSource(e,(e=>t(.8*e)));const n={url:e};this.dispatchEvent(new CustomEvent("preload",{detail:n}))}catch(t){this.dispatchEvent(new CustomEvent("error",{detail:t}))}finally{t(.9),requestAnimationFrame((()=>{requestAnimationFrame((()=>{t(1)}))}))}}}Xd([F({type:String})],Bp.prototype,"alt",void 0),Xd([F({type:String})],Bp.prototype,"src",void 0);
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var Tp=function(t,e,n,i){for(var r,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,n,a):r(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a};const Lp=Symbol("changeAnimation"),Rp=Symbol("paused"),Dp=Symbol("hotspotMap"),Qp=Symbol("mutationCallback"),Pp=Symbol("observer"),Fp=Symbol("addHotspot"),Np=Symbol("removeHotspot"),Up=new pt,kp=new ee,Gp=new At;
/*!
fflate - fast JavaScript compression/decompression
<https://101arrowz.github.io/fflate>
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
version 0.6.9
*/
var Op=function(t){return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};try{URL.revokeObjectURL(Op(""))}catch(Zc){Op=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)}}var Hp=Uint8Array,zp=Uint16Array,Vp=Uint32Array,Wp=new Hp([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]),qp=new Hp([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]),jp=new Hp([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yp=function(t,e){for(var n=new zp(31),i=0;i<31;++i)n[i]=e+=1<<t[i-1];var r=new Vp(n[30]);for(i=1;i<30;++i)for(var s=n[i];s<n[i+1];++s)r[s]=s-n[i]<<5|i;return[n,r]},Jp=Yp(Wp,2),Xp=Jp[0],Kp=Jp[1];Xp[28]=258,Kp[258]=28;for(var Zp=Yp(qp,0)[1],$p=new zp(32768),tA=0;tA<32768;++tA){var eA=(43690&tA)>>>1|(21845&tA)<<1;eA=(61680&(eA=(52428&eA)>>>2|(13107&eA)<<2))>>>4|(3855&eA)<<4,$p[tA]=((65280&eA)>>>8|(255&eA)<<8)>>>1}var nA=function(t,e,n){for(var i=t.length,r=0,s=new zp(e);r<i;++r)++s[t[r]-1];var a,o=new zp(e);for(r=0;r<e;++r)o[r]=o[r-1]+s[r-1]<<1;if(n){a=new zp(1<<e);var l=15-e;for(r=0;r<i;++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[$p[u]>>>l]=c}else for(a=new zp(i),r=0;r<i;++r)t[r]&&(a[r]=$p[o[t[r]-1]++]>>>15-t[r]);return a},iA=new Hp(288);for(tA=0;tA<144;++tA)iA[tA]=8;for(tA=144;tA<256;++tA)iA[tA]=9;for(tA=256;tA<280;++tA)iA[tA]=7;for(tA=280;tA<288;++tA)iA[tA]=8;var rA=new Hp(32);for(tA=0;tA<32;++tA)rA[tA]=5;var sA=nA(iA,9,0),aA=nA(rA,5,0),oA=function(t){return(t/8|0)+(7&t&&1)},lA=function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var i=new(t instanceof zp?zp:t instanceof Vp?Vp:Hp)(n-e);return i.set(t.subarray(e,n)),i},cA=function(t,e,n){n<<=7&e;var i=e/8|0;t[i]|=n,t[i+1]|=n>>>8},hA=function(t,e,n){n<<=7&e;var i=e/8|0;t[i]|=n,t[i+1]|=n>>>8,t[i+2]|=n>>>16},uA=function(t,e){for(var n=[],i=0;i<t.length;++i)t[i]&&n.push({s:i,f:t[i]});var r=n.length,s=n.slice();if(!r)return[vA,0];if(1==r){var a=new Hp(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort((function(t,e){return t.f-e.f})),n.push({s:-1,f:25001});var o=n[0],l=n[1],c=0,h=1,u=2;for(n[0]={s:-1,f:o.f+l.f,l:o,r:l};h!=r-1;)o=n[n[c].f<n[u].f?c++:u++],l=n[c!=h&&n[c].f<n[u].f?c++:u++],n[h++]={s:-1,f:o.f+l.f,l:o,r:l};var d=s[0].s;for(i=1;i<r;++i)s[i].s>d&&(d=s[i].s);var p=new zp(d+1),A=dA(n[h-1],p,0);if(A>e){i=0;var m=0,g=A-e,f=1<<g;for(s.sort((function(t,e){return p[e.s]-p[t.s]||t.f-e.f}));i<r;++i){var v=s[i].s;if(!(p[v]>e))break;m+=f-(1<<A-p[v]),p[v]=e}for(m>>>=g;m>0;){var y=s[i].s;p[y]<e?m-=1<<e-p[y]++-1:++i}for(;i>=0&&m;--i){var x=s[i].s;p[x]==e&&(--p[x],++m)}A=e}return[new Hp(p),A]},dA=function(t,e,n){return-1==t.s?Math.max(dA(t.l,e,n+1),dA(t.r,e,n+1)):e[t.s]=n},pA=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new zp(++e),i=0,r=t[0],s=1,a=function(t){n[i++]=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[n.subarray(0,i),e]},AA=function(t,e){for(var n=0,i=0;i<e.length;++i)n+=t[i]*e[i];return n},mA=function(t,e,n){var i=n.length,r=oA(e+2);t[r]=255&i,t[r+1]=i>>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var s=0;s<i;++s)t[r+s+4]=n[s];return 8*(r+4+i)},gA=function(t,e,n,i,r,s,a,o,l,c,h){cA(e,h++,n),++r[256];for(var u=uA(r,15),d=u[0],p=u[1],A=uA(s,15),m=A[0],g=A[1],f=pA(d),v=f[0],y=f[1],x=pA(m),w=x[0],E=x[1],b=new zp(19),_=0;_<v.length;++_)b[31&v[_]]++;for(_=0;_<w.length;++_)b[31&w[_]]++;for(var I=uA(b,7),C=I[0],M=I[1],S=19;S>4&&!C[jp[S-1]];--S);var B,T,L,R,D=c+5<<3,Q=AA(r,iA)+AA(s,rA)+a,P=AA(r,d)+AA(s,m)+a+14+3*S+AA(b,C)+(2*b[16]+3*b[17]+7*b[18]);if(D<=Q&&D<=P)return mA(e,h,t.subarray(l,l+c));if(cA(e,h,1+(P<Q)),h+=2,P<Q){B=nA(d,p,0),T=d,L=nA(m,g,0),R=m;var F=nA(C,M,0);cA(e,h,y-257),cA(e,h+5,E-1),cA(e,h+10,S-4),h+=14;for(_=0;_<S;++_)cA(e,h+3*_,C[jp[_]]);h+=3*S;for(var N=[v,w],U=0;U<2;++U){var k=N[U];for(_=0;_<k.length;++_){var G=31&k[_];cA(e,h,F[G]),h+=C[G],G>15&&(cA(e,h,k[_]>>>5&127),h+=k[_]>>>12)}}}else B=sA,T=iA,L=aA,R=rA;for(_=0;_<o;++_)if(i[_]>255){G=i[_]>>>18&31;hA(e,h,B[G+257]),h+=T[G+257],G>7&&(cA(e,h,i[_]>>>23&31),h+=Wp[G]);var O=31&i[_];hA(e,h,L[O]),h+=R[O],O>3&&(hA(e,h,i[_]>>>5&8191),h+=qp[O])}else hA(e,h,B[i[_]]),h+=T[i[_]];return hA(e,h,B[256]),h+T[256]},fA=new Vp([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),vA=new Hp(0),yA=function(){for(var t=new Vp(256),e=0;e<256;++e){for(var n=e,i=9;--i;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),xA=function(){var t=-1;return{p:function(e){for(var n=t,i=0;i<e.length;++i)n=yA[255&n^e[i]]^n>>>8;t=n},d:function(){return~t}}},wA=function(t,e,n,i,r){return function(t,e,n,i,r,s){var a=t.length,o=new Hp(i+a+5*(1+Math.ceil(a/7e3))+r),l=o.subarray(i,o.length-r),c=0;if(!e||a<8)for(var h=0;h<=a;h+=65535){var u=h+65535;u<a?c=mA(l,c,t.subarray(h,u)):(l[h]=s,c=mA(l,c,t.subarray(h,a)))}else{for(var d=fA[e-1],p=d>>>13,A=8191&d,m=(1<<n)-1,g=new zp(32768),f=new zp(m+1),v=Math.ceil(n/3),y=2*v,x=function(e){return(t[e]^t[e+1]<<v^t[e+2]<<y)&m},w=new Vp(25e3),E=new zp(288),b=new zp(32),_=0,I=0,C=(h=0,0),M=0,S=0;h<a;++h){var B=x(h),T=32767&h,L=f[B];if(g[T]=L,f[B]=T,M<=h){var R=a-h;if((_>7e3||C>24576)&&R>423){c=gA(t,l,0,w,E,b,I,C,S,h-S,c),C=_=I=0,S=h;for(var D=0;D<286;++D)E[D]=0;for(D=0;D<30;++D)b[D]=0}var Q=2,P=0,F=A,N=T-L&32767;if(R>2&&B==x(h-N))for(var U=Math.min(p,R)-1,k=Math.min(32767,h),G=Math.min(258,R);N<=k&&--F&&T!=L;){if(t[h+Q]==t[h+Q-N]){for(var O=0;O<G&&t[h+O]==t[h+O-N];++O);if(O>Q){if(Q=O,P=N,O>U)break;var H=Math.min(N,O-2),z=0;for(D=0;D<H;++D){var V=h-N+D+32768&32767,W=V-g[V]+32768&32767;W>z&&(z=W,L=V)}}}N+=(T=L)-(L=g[T])+32768&32767}if(P){w[C++]=268435456|Kp[Q]<<18|Zp[P];var q=31&Kp[Q],j=31&Zp[P];I+=Wp[q]+qp[j],++E[257+q],++b[j],M=h+Q,++_}else w[C++]=t[h],++E[t[h]]}}c=gA(t,l,s,w,E,b,I,C,S,h-S,c),!s&&7&c&&(c=mA(l,c+1,vA))}return lA(o,0,i+oA(c)+r)}(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,i,!r)},EA=function(t,e){var n={};for(var i in t)n[i]=t[i];for(var i in e)n[i]=e[i];return n},bA=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function _A(t,e){return wA(t,e||{},0,0)}var IA=function(t,e,n,i){for(var r in t){var s=t[r],a=e+r;s instanceof Hp?n[a]=[s,i]:Array.isArray(s)?n[a]=[s[0],EA(i,s[1])]:IA(s,a+"/",n,i)}},CA="undefined"!=typeof TextEncoder&&new TextEncoder,MA="undefined"!=typeof TextDecoder&&new TextDecoder;try{MA.decode(vA,{stream:!0}),1}catch(Zc){}function SA(t,e){if(e){for(var n=new Hp(t.length),i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}if(CA)return CA.encode(t);var r=t.length,s=new Hp(t.length+(t.length>>1)),a=0,o=function(t){s[a++]=t};for(i=0;i<r;++i){if(a+5>s.length){var l=new Hp(a+8+(r-i<<1));l.set(s),s=l}var c=t.charCodeAt(i);c<128||e?o(c):c<2048?(o(192|c>>6),o(128|63&c)):c>55295&&c<57344?(o(240|(c=65536+(1047552&c)|1023&t.charCodeAt(++i))>>18),o(128|c>>12&63),o(128|c>>6&63),o(128|63&c)):(o(224|c>>12),o(128|c>>6&63),o(128|63&c))}return lA(s,0,a)}var BA=function(t){var e=0;if(t)for(var n in t){var i=t[n].length;if(i>65535)throw"extra field too long";e+=i+4}return e},TA=function(t,e,n,i,r,s,a,o){var l=i.length,c=n.extra,h=o&&o.length,u=BA(c);bA(t,e,null!=a?33639248:67324752),e+=4,null!=a&&(t[e++]=20,t[e++]=n.os),t[e]=20,e+=2,t[e++]=n.flag<<1|(null==s&&8),t[e++]=r&&8,t[e++]=255&n.compression,t[e++]=n.compression>>8;var d=new Date(null==n.mtime?Date.now():n.mtime),p=d.getFullYear()-1980;if(p<0||p>119)throw"date not in range 1980-2099";if(bA(t,e,p<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>>1),e+=4,null!=s&&(bA(t,e,n.crc),bA(t,e+4,s),bA(t,e+8,n.size)),bA(t,e+12,l),bA(t,e+14,u),e+=16,null!=a&&(bA(t,e,h),bA(t,e+6,n.attrs),bA(t,e+10,a),e+=14),t.set(i,e),e+=l,u)for(var A in c){var m=c[A],g=m.length;bA(t,e,+A),bA(t,e+2,g),t.set(m,e+4),e+=4+g}return h&&(t.set(o,e),e+=h),e};function LA(t,e){e||(e={});var n={},i=[];IA(t,"",n,e);var r=0,s=0;for(var a in n){var o=n[a],l=o[0],c=o[1],h=0==c.level?0:8,u=(b=SA(a)).length,d=c.comment,p=d&&SA(d),A=p&&p.length,m=BA(c.extra);if(u>65535)throw"filename too long";var g=h?_A(l,c):l,f=g.length,v=xA();v.p(l),i.push(EA(c,{size:l.length,crc:v.d(),c:g,f:b,m:p,u:u!=a.length||p&&d.length!=A,o:r,compression:h})),r+=30+u+m+f,s+=76+2*(u+m)+(A||0)+f}for(var y=new Hp(s+22),x=r,w=s-r,E=0;E<i.length;++E){var b=i[E];TA(y,b.o,b,b.f,b.u,b.c.length);var _=30+b.f.length+BA(b.extra);y.set(b.c,b.o+_),TA(y,r,b,b.f,b.u,b.c.length,b.o,b.m),r+=16+_+(b.m?b.m.length:0)}return function(t,e,n,i,r){bA(t,e,101010256),bA(t,e+8,n),bA(t,e+10,n),bA(t,e+12,i),bA(t,e+16,r)}(y,r,i.length,w,x),y}class RA{async parse(t){const e={};e["model.usda"]=null;let n=QA();const i={},r={};t.traverseVisible((t=>{if(t.isMesh&&t.material.isMeshStandardMaterial){const r=t.geometry,s=t.material,a="geometries/Geometry_"+r.id+".usd";if(!(a in e)){const t=function(t){return`\ndef "Geometry"\n{\n  ${function(t){const e="Geometry",n=t.attributes,i=n.position.count;return`\n    def Mesh "${e}"\n    {\n        int[] faceVertexCounts = [${function(t){const e=null!==t.index?t.index.array.length:t.attributes.position.count;return Array(e/3).fill(3).join(", ")}(t)}]\n        int[] faceVertexIndices = [${function(t){if(null!==t.index)return t.index.array.join(", ");const e=[],n=t.attributes.position.count;for(let t=0;t<n;t++)e.push(t);return e.join(", ")}(t)}]\n        normal3f[] normals = [${FA(n.normal,i)}] (\n            interpolation = "vertex"\n        )\n        point3f[] points = [${FA(n.position,i)}]\n        float2[] primvars:st = [${function(t,e){if(void 0===t)return console.warn("USDZExporter: UVs missing."),Array(e).fill("(0, 0)").join(", ");const n=[],i=t.array;for(let t=0;t<i.length;t+=2)n.push(`(${i[t+0].toPrecision(7)}, ${1-i[t+1].toPrecision(7)})`);return n.join(", ")}(n.uv,i)}] (\n            interpolation = "vertex"\n        )\n        uniform token subdivisionScheme = "none"\n    }\n`}(t)}\n}\n`}(r);e[a]=function(t){let e=QA();return e+=t,SA(e)}(t)}s.uuid in i||(i[s.uuid]=s),n+=function(t,e,n){const i="Object_"+t.id,r=function(t){const e=t.elements;return`( ${PA(e,0)}, ${PA(e,4)}, ${PA(e,8)}, ${PA(e,12)} )`}(t.matrixWorld);t.matrixWorld.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",t);return`def Xform "${i}" (\n    prepend references = @./geometries/Geometry_${e.id}.usd@</Geometry>\n)\n{\n    matrix4d xformOp:transform = ${r}\n    uniform token[] xformOpOrder = ["xformOp:transform"]\n\n    rel material:binding = </Materials/Material_${n.id}>\n}\n\n`}(t,r,s)}})),n+=function(t,e){const n=[];for(const i in t){const r=t[i];n.push(NA(r,e))}return`def "Materials"\n{\n${n.join("")}\n}\n\n`}(i,r),e["model.usda"]=SA(n),n=null;for(const t in r){const n=r[t],i=t.split("_")[1],s=1023===n.format,a=DA(n.image,i),o=await new Promise((t=>a.toBlob(t,s?"image/png":"image/jpeg",1)));e[`textures/Texture_${t}.${s?"png":"jpg"}`]=new Uint8Array(await o.arrayBuffer())}let s=0;for(const t in e){const n=e[t];s+=34+t.length;const i=63&s;if(4!==i){const r=new Uint8Array(64-i);e[t]=[n,{extra:{12345:r}}]}s=n.length}return LA(e,{level:0})}}function DA(t,e){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=1024/Math.max(t.width,t.height),i=document.createElement("canvas");i.width=t.width*Math.min(1,n),i.height=t.height*Math.min(1,n);const r=i.getContext("2d");if(r.drawImage(t,0,0,i.width,i.height),void 0!==e){const t=parseInt(e,16),n=(t>>16&255)/255,s=(t>>8&255)/255,a=(255&t)/255,o=r.getImageData(0,0,i.width,i.height),l=o.data;for(let t=0;t<l.length;t+=4)l[t+0]=l[t+0]*n,l[t+1]=l[t+1]*s,l[t+2]=l[t+2]*a;r.putImageData(o,0,0)}return i}}function QA(){return'#usda 1.0\n(\n    customLayerData = {\n        string creator = "Three.js USDZExporter"\n    }\n    metersPerUnit = 1\n    upAxis = "Y"\n)\n\n'}function PA(t,e){return`(${t[e+0]}, ${t[e+1]}, ${t[e+2]}, ${t[e+3]})`}function FA(t,e){if(void 0===t)return console.warn("USDZExporter: Normals missing."),Array(e).fill("(0, 0, 0)").join(", ");const n=[],i=t.array;for(let t=0;t<i.length;t+=3)n.push(`(${i[t+0].toPrecision(7)}, ${i[t+1].toPrecision(7)}, ${i[t+2].toPrecision(7)})`);return n.join(", ")}function NA(t,e){const n="            ",i=[],r=[];function s(n,i,r){const s=n.id+(r?"_"+r.getHexString():""),a=1023===n.format;return e[s]=n,`\n        def Shader "Transform2d_${i}" (\n            sdrMetadata = {\n                string role = "math"\n            }\n        )\n        {\n            uniform token info:id = "UsdTransform2d"\n            float2 inputs:in.connect = </Materials/Material_${t.id}/uvReader_st.outputs:result>\n            float2 inputs:scale = ${kA(n.repeat)}\n            float2 inputs:translation = ${kA(n.offset)}\n            float2 outputs:result\n        }\n\n        def Shader "Texture_${n.id}_${i}"\n        {\n            uniform token info:id = "UsdUVTexture"\n            asset inputs:file = @textures/Texture_${s}.${a?"png":"jpg"}@\n            float2 inputs:st.connect = </Materials/Material_${t.id}/Transform2d_${i}.outputs:result>\n            token inputs:wrapS = "repeat"\n            token inputs:wrapT = "repeat"\n            float outputs:r\n            float outputs:g\n            float outputs:b\n            float3 outputs:rgb\n        }`}return null!==t.map?(i.push(`${n}color3f inputs:diffuseColor.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:rgb>`),r.push(s(t.map,"diffuse",t.color))):i.push(`${n}color3f inputs:diffuseColor = ${UA(t.color)}`),null!==t.emissiveMap?(i.push(`${n}color3f inputs:emissiveColor.connect = </Materials/Material_${t.id}/Texture_${t.emissiveMap.id}_emissive.outputs:rgb>`),r.push(s(t.emissiveMap,"emissive"))):t.emissive.getHex()>0&&i.push(`${n}color3f inputs:emissiveColor = ${UA(t.emissive)}`),null!==t.normalMap&&(i.push(`${n}normal3f inputs:normal.connect = </Materials/Material_${t.id}/Texture_${t.normalMap.id}_normal.outputs:rgb>`),r.push(s(t.normalMap,"normal"))),null!==t.aoMap&&(i.push(`${n}float inputs:occlusion.connect = </Materials/Material_${t.id}/Texture_${t.aoMap.id}_occlusion.outputs:r>`),r.push(s(t.aoMap,"occlusion"))),null!==t.roughnessMap&&1===t.roughness?(i.push(`${n}float inputs:roughness.connect = </Materials/Material_${t.id}/Texture_${t.roughnessMap.id}_roughness.outputs:g>`),r.push(s(t.roughnessMap,"roughness"))):i.push(`${n}float inputs:roughness = ${t.roughness}`),null!==t.metalnessMap&&1===t.metalness?(i.push(`${n}float inputs:metallic.connect = </Materials/Material_${t.id}/Texture_${t.metalnessMap.id}_metallic.outputs:b>`),r.push(s(t.metalnessMap,"metallic"))):i.push(`${n}float inputs:metallic = ${t.metalness}`),i.push(`${n}float inputs:opacity = ${t.opacity}`),t.isMeshPhysicalMaterial&&(i.push(`${n}float inputs:clearcoat = ${t.clearcoat}`),i.push(`${n}float inputs:clearcoatRoughness = ${t.clearcoatRoughness}`),i.push(`${n}float inputs:ior = ${t.ior}`)),`\n    def Material "Material_${t.id}"\n    {\n        def Shader "PreviewSurface"\n        {\n            uniform token info:id = "UsdPreviewSurface"\n${i.join("\n")}\n            int inputs:useSpecularWorkflow = 0\n            token outputs:surface\n        }\n\n        token outputs:surface.connect = </Materials/Material_${t.id}/PreviewSurface.outputs:surface>\n        token inputs:frame:stPrimvarName = "st"\n\n        def Shader "uvReader_st"\n        {\n            uniform token info:id = "UsdPrimvarReader_float2"\n            token inputs:varname.connect = </Materials/Material_${t.id}.inputs:frame:stPrimvarName>\n            float2 inputs:fallback = (0.0, 0.0)\n            float2 outputs:result\n        }\n\n${r.join("\n")}\n\n    }\n`}function UA(t){return`(${t.r}, ${t.g}, ${t.b})`}function kA(t){return`(${t.x}, ${t.y})`}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* @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 GA=function(t,e,n,i){for(var r,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,n,a):r(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a};let OA=!1,HA=!1;const zA=(VA=["quick-look","scene-viewer","webxr","none"],t=>{try{const e=su(t),n=(e.length?e[0].terms:[]).filter((t=>t&&"ident"===t.type)).map((t=>t.value)).filter((t=>VA.indexOf(t)>-1)),i=new Set;for(const t of n)i.add(t);return i}catch(t){}return new Set});var VA;const WA="quick-look",qA="scene-viewer",jA="webxr",YA="none",JA=Symbol("arButtonContainer"),XA=Symbol("enterARWithWebXR"),KA=Symbol("openSceneViewer"),ZA=Symbol("openIOSARQuickLook"),$A=Symbol("canActivateAR"),tm=Symbol("arMode"),em=Symbol("arModes"),nm=Symbol("arAnchor"),im=Symbol("preload"),rm=Symbol("onARButtonContainerClick"),sm=Symbol("onARStatus"),am=Symbol("onARTracking"),om=Symbol("onARTap"),lm=Symbol("selectARMode"),cm=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 hm,um,dm;const pm=Symbol("evaluate"),Am=Symbol("lastValue");class mm{constructor(){this[hm]=null}static evaluatableFor(t,e=pu){if(t instanceof mm)return t;if("number"===t.type)return"%"===t.unit?new vm(t,e):t;switch(t.name.value){case"calc":return new bm(t,e);case"env":return new xm(t)}return pu}static evaluate(t){return t instanceof mm?t.evaluate():t}static isConstant(t){return!(t instanceof mm)||t.isConstant}static applyIntrinsics(t,e){const{basis:n,keywords:i}=e,{auto:r}=i;return n.map(((e,n)=>{const s=null==r[n]?e:r[n];let a=t[n]?t[n]:s;if("ident"===a.type){const t=a.value;t in i&&(a=i[t][n])}return null!=a&&"ident"!==a.type||(a=s),"%"===a.unit?ru(a.number/100*e.number,e.unit):(a=gu(a,e),a.unit!==e.unit?e:a)}))}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[Am]||(this[Am]=this[pm]()),this[Am]}}hm=Am;const gm=Symbol("percentage"),fm=Symbol("basis");class vm extends mm{constructor(t,e){super(),this[gm]=t,this[fm]=e}get isConstant(){return!0}[pm](){return ru(this[gm].number/100*this[fm].number,this[fm].unit)}}const ym=Symbol("identNode");class xm extends mm{constructor(t){super(),this[um]=null;const e=t.arguments.length?t.arguments[0].terms[0]:null;null!=e&&"ident"===e.type&&(this[ym]=e)}get isConstant(){return!1}[(um=ym,pm)](){if(null!=this[ym])switch(this[ym].value){case"window-scroll-y":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 pu}}const wm=/[\*\/]/,Em=Symbol("evalutor");class bm extends mm{constructor(t,e=pu){if(super(),this[dm]=null,1!==t.arguments.length)return;const n=t.arguments[0].terms.slice(),i=[];for(;n.length;){const t=n.shift();if(i.length>0){const n=i[i.length-1];if("operator"===n.type&&wm.test(n.value)){const n=i.pop(),r=i.pop();if(null==r)return;i.push(new Mm(n,mm.evaluatableFor(r,e),mm.evaluatableFor(t,e)));continue}}i.push("operator"===t.type?t:mm.evaluatableFor(t,e))}for(;i.length>2;){const[t,n,r]=i.splice(0,3);if("operator"!==n.type)return;i.unshift(new Mm(n,mm.evaluatableFor(t,e),mm.evaluatableFor(r,e)))}1===i.length&&(this[Em]=i[0])}get isConstant(){return null==this[Em]||mm.isConstant(this[Em])}[(dm=Em,pm)](){return null!=this[Em]?mm.evaluate(this[Em]):pu}}const _m=Symbol("operator"),Im=Symbol("left"),Cm=Symbol("right");class Mm extends mm{constructor(t,e,n){super(),this[_m]=t,this[Im]=e,this[Cm]=n}get isConstant(){return mm.isConstant(this[Im])&&mm.isConstant(this[Cm])}[pm](){const t=gu(mm.evaluate(this[Im])),e=gu(mm.evaluate(this[Cm])),{number:n,unit:i}=t,{number:r,unit:s}=e;if(null!=s&&null!=i&&s!=i)return pu;const a=i||s;let o;switch(this[_m].value){case"+":o=n+r;break;case"-":o=n-r;break;case"/":o=n/r;break;case"*":o=n*r;break;default:return pu}return{type:"number",number:o,unit:a}}}const Sm=Symbol("evaluatables"),Bm=Symbol("intrinsics");class Tm extends mm{constructor(t,e){super(),this[Bm]=e;const n=t[0],i=null!=n?n.terms:[];this[Sm]=e.basis.map(((t,e)=>{const n=i[e];return null==n?{type:"ident",value:"auto"}:"ident"===n.type?n:mm.evaluatableFor(n,t)}))}get isConstant(){for(const t of this[Sm])if(!mm.isConstant(t))return!1;return!0}[pm](){const t=this[Sm].map((t=>mm.evaluate(t)));return mm.applyIntrinsics(t,this[Bm]).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 Lm,Rm,Dm,Qm;const Pm=Symbol("instances"),Fm=Symbol("activateListener"),Nm=Symbol("deactivateListener"),Um=Symbol("notifyInstances"),km=Symbol("notify"),Gm=Symbol("callback");class Om{constructor(t){this[Gm]=t}static[Um](){for(const t of Om[Pm])t[km]()}static[(Lm=Pm,Fm)](){window.addEventListener("scroll",this[Um],{passive:!0})}static[Nm](){window.removeEventListener("scroll",this[Um])}observe(){0===Om[Pm].size&&Om[Fm](),Om[Pm].add(this)}disconnect(){Om[Pm].delete(this),0===Om[Pm].size&&Om[Nm]()}[km](){this[Gm]()}}Om[Lm]=new Set;const Hm=Symbol("computeStyleCallback"),zm=Symbol("astWalker"),Vm=Symbol("dependencies"),Wm=Symbol("onScroll");class qm{constructor(t){this[Rm]={},this[Dm]=new du(["function"]),this[Qm]=()=>{this[Hm]({relatedState:"window-scroll"})},this[Hm]=t}observeEffectsFor(t){const e={},n=this[Vm];this[zm].walk(t,(t=>{const{name:i}=t,r=t.arguments[0].terms[0];if("env"===i.value&&null!=r&&"ident"===r.type)switch(r.value){case"window-scroll-y":if(null==e["window-scroll"]){const t="window-scroll"in n?n["window-scroll"]:new Om(this[Wm]);t.observe(),delete n["window-scroll"],e["window-scroll"]=t}}}));for(const t in n){n[t].disconnect()}this[Vm]=e}dispose(){for(const t in this[Vm]){this[Vm][t].disconnect()}}}Rm=Vm,Dm=zm,Qm=Wm;
/* @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 jm=t=>{const e=t.observeEffects||!1,n=t.intrinsics instanceof Function?t.intrinsics:()=>t.intrinsics;return(i,r)=>{const s=i.updated,a=i.connectedCallback,o=i.disconnectedCallback,l=Symbol(`${r}StyleEffector`),c=Symbol(`${r}StyleEvaluator`),h=Symbol(`${r}UpdateEvaluator`),u=Symbol(`${r}EvaluateAndSync`);Object.defineProperties(i,{[l]:{value:null,writable:!0},[c]:{value:null,writable:!0},[h]:{value:function(){const t=su(this[r]);this[c]=new Tm(t,n(this)),null==this[l]&&e&&(this[l]=new qm((()=>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)}}})}},Ym=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,interactionPolicy:"always-allow",touchAction:"pan-y"}),Jm=/^touch(start|end|move)$/,Xm=Math.PI/8,Km=33,Zm=34,$m=37,tg=38,eg=39,ng=40,ig="user-interaction",rg="none";
/* @license
 * 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 sg extends tt{constructor(t,e){super(),this.camera=t,this.element=e,this.sensitivity=1,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserChange=!1,this.isUserPointing=!1,this.spherical=new zl,this.goalSpherical=new zl,this.thetaDamper=new iu,this.phiDamper=new iu,this.radiusDamper=new iu,this.logFov=Math.log(Ym.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new iu,this.pointerIsDown=!1,this.lastPointerPosition={clientX:0,clientY:0},this.touchMode="rotate",this.touchDecided=!1,this.onPointerMove=t=>{if(this.pointerIsDown&&this.canInteract){if(Jm.test(t.type)){const{touches:e}=t;switch(this.touchMode){case"zoom":if(this.lastTouches.length>1&&e.length>1){const t=.04*(this.twoTouchDistance(this.lastTouches[0],this.lastTouches[1])-this.twoTouchDistance(e[0],e[1]))/10;this.userAdjustOrbit(0,0,t)}break;case"rotate":const{touchAction:t}=this._options;if(!this.touchDecided&&"none"!==t){this.touchDecided=!0;const{clientX:n,clientY:i}=e[0],r=Math.abs(n-this.lastPointerPosition.clientX),s=Math.abs(i-this.lastPointerPosition.clientY);if("pan-y"===t&&s>r||"pan-x"===t&&r>s)return void(this.touchMode="scroll")}this.handleSinglePointerMove(e[0]);break;case"scroll":return}this.lastTouches=e}else this.handleSinglePointerMove(t);t.cancelable&&t.preventDefault()}},this.onPointerDown=t=>{if(this.pointerIsDown=!0,this.isUserPointing=!1,Jm.test(t.type)){const{touches:e}=t;switch(this.touchDecided=!1,e.length){default:case 1:this.touchMode="rotate",this.handleSinglePointerDown(e[0]);break;case 2:this.touchMode=this._disableZoom?"scroll":"zoom"}this.lastTouches=e}else this.handleSinglePointerDown(t)},this.onPointerUp=t=>{this.element.style.cursor="grab",this.pointerIsDown=!1,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end",pointer:Object.assign({},this.lastPointerPosition)})},this.onWheel=t=>{if(!this.canInteract)return;const e=t.deltaY*(1==t.deltaMode?18:1)*.04/30;this.userAdjustOrbit(0,0,e),t.cancelable&&t.preventDefault()},this.onKeyDown=t=>{let e=!1;switch(t.keyCode){case Km:e=!0,this.userAdjustOrbit(0,0,.04);break;case Zm:e=!0,this.userAdjustOrbit(0,0,-.04);break;case tg:e=!0,this.userAdjustOrbit(0,-Xm,0);break;case ng:e=!0,this.userAdjustOrbit(0,Xm,0);break;case $m:e=!0,this.userAdjustOrbit(-Xm,0,0);break;case eg:e=!0,this.userAdjustOrbit(Xm,0,0)}e&&t.cancelable&&t.preventDefault()},this._options=Object.assign({},Ym),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){const{element:t}=this;t.addEventListener("mousemove",this.onPointerMove),t.addEventListener("mousedown",this.onPointerDown),this._disableZoom||t.addEventListener("wheel",this.onWheel),t.addEventListener("keydown",this.onKeyDown),t.addEventListener("touchstart",this.onPointerDown,{passive:!0}),t.addEventListener("touchmove",this.onPointerMove),self.addEventListener("mouseup",this.onPointerUp),self.addEventListener("touchend",this.onPointerUp),this.element.style.cursor="grab",this._interactionEnabled=!0}}disableInteraction(){if(!0===this._interactionEnabled){const{element:t}=this;t.removeEventListener("mousemove",this.onPointerMove),t.removeEventListener("mousedown",this.onPointerDown),this._disableZoom||t.removeEventListener("wheel",this.onWheel),t.removeEventListener("keydown",this.onKeyDown),t.removeEventListener("touchstart",this.onPointerDown),t.removeEventListener("touchmove",this.onPointerMove),self.removeEventListener("mouseup",this.onPointerUp),self.removeEventListener("touchend",this.onPointerUp),t.style.cursor="",this._interactionEnabled=!1}}get options(){return this._options}set disableZoom(t){this._disableZoom!=t&&(this._disableZoom=t,!0===t?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel))}getCameraSpherical(t=new zl){return t.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(t){Object.assign(this._options,t),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(t,e){this.camera.near=Math.max(t,e/1e3),this.camera.far=e,this.camera.updateProjectionMatrix()}updateAspect(t){this.camera.aspect=t,this.camera.updateProjectionMatrix()}setOrbit(t=this.goalSpherical.theta,e=this.goalSpherical.phi,n=this.goalSpherical.radius){const{minimumAzimuthalAngle:i,maximumAzimuthalAngle:r,minimumPolarAngle:s,maximumPolarAngle:a,minimumRadius:o,maximumRadius:l}=this._options,{theta:c,phi:h,radius:u}=this.goalSpherical,d=tu(t,i,r);isFinite(i)||isFinite(r)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-d)+d);const p=tu(e,s,a),A=tu(n,o,l);return(d!==c||p!==h||A!==u)&&(this.goalSpherical.theta=d,this.goalSpherical.phi=p,this.goalSpherical.radius=A,this.goalSpherical.makeSafe(),this.isUserChange=!1,!0)}setRadius(t){this.goalSpherical.radius=t,this.setOrbit()}setFieldOfView(t){const{minimumFieldOfView:e,maximumFieldOfView:n}=this._options;t=tu(t,e,n),this.goalLogFov=Math.log(t)}setDamperDecayTime(t){this.thetaDamper.setDecayTime(t),this.phiDamper.setDecayTime(t),this.radiusDamper.setDecayTime(t),this.fovDamper.setDecayTime(t)}adjustOrbit(t,e,n){const{theta:i,phi:r,radius:s}=this.goalSpherical,{minimumRadius:a,maximumRadius:o,minimumFieldOfView:l,maximumFieldOfView:c}=this._options,h=this.spherical.theta-i,u=Math.PI-.001,d=i-tu(t,-u-h,u-h),p=r-e,A=0===n?0:((n>0?o:a)-s)/(Math.log(n>0?c:l)-this.goalLogFov),m=s+n*Math.min(isFinite(A)?A:1/0,o-a);if(this.setOrbit(d,p,m),0!==n){const t=this.goalLogFov+n;this.setFieldOfView(Math.exp(t))}}jumpToGoal(){this.update(0,1e4)}update(t,e){if(this.isStationary())return;const{maximumPolarAngle:n,maximumRadius:i}=this._options,r=this.spherical.theta-this.goalSpherical.theta;Math.abs(r)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(r)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,e,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,e,n),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,e,i),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,e,1),this.moveCamera()}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new ue(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix());const t=this.isUserChange?ig:rg;this.dispatchEvent({type:"change",source:t})}get canInteract(){if("allow-when-focused"==this._options.interactionPolicy){return this.element.getRootNode().activeElement===this.element}return"always-allow"===this._options.interactionPolicy}userAdjustOrbit(t,e,n){this.adjustOrbit(t*this.sensitivity,e*this.sensitivity,n),this.isUserChange=!0,this.dispatchEvent({type:"change",source:ig})}wrapAngle(t){const e=(t+Math.PI)/(2*Math.PI);return 2*(e-Math.floor(e))*Math.PI-Math.PI}pixelLengthToSphericalAngle(t){return 2*Math.PI*t/this.element.clientHeight}twoTouchDistance(t,e){const{clientX:n,clientY:i}=t,{clientX:r,clientY:s}=e,a=r-n,o=s-i;return Math.sqrt(a*a+o*o)}handleSinglePointerMove(t){const{clientX:e,clientY:n}=t,i=this.pixelLengthToSphericalAngle(e-this.lastPointerPosition.clientX),r=this.pixelLengthToSphericalAngle(n-this.lastPointerPosition.clientY);this.lastPointerPosition.clientX=e,this.lastPointerPosition.clientY=n,!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start",pointer:Object.assign({},t)})),this.userAdjustOrbit(i,r,0)}handleSinglePointerDown(t){this.lastPointerPosition.clientX=t.clientX,this.lastPointerPosition.clientY=t.clientY,this.element.style.cursor="grabbing"}}
/* @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 ag=t=>t<.5?2*t*t:(4-2*t)*t-1,og=(t,e,n=ag)=>i=>t+(e-t)*n(i),lg=(t,e)=>{const n=[],i=[];let r=t;for(let t=0;t<e.length;++t){const s=e[t],{value:a,frames:o}=s,l=s.ease||ag,c=og(r,a,l);n.push(c),i.push(o),r=a}return((t,e)=>{const n=e.reduce(((t,e)=>t+e),0),i=e.map((t=>t/n));return e=>{let n=0,r=1/0,s=()=>0;for(let a=0;a<i.length&&(r=i[a],s=t[a],!(e<=n+r));++a)n+=r;return s((e-n)/r)}})(n,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.
 */
var cg=function(t,e,n,i){for(var r,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,n,a):r(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a};const hg=lg(0,[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]),ug=lg(0,[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]),dg=1.1*wu,pg=["front","right","back","left"],Ag=["upper-","","lower-"],mg="auto",gg="when-focused",fg="wiggle",vg="always-allow",yg="pan-y",xg=t=>({basis:[ru(t[qg]*Math.PI/180,"rad")],keywords:{auto:[null]}}),wg={basis:[Au(ru(25,"deg"))],keywords:{auto:[null]}},Eg=t=>{const e=t[gp];return{basis:[Au(ru(45,"deg"))],keywords:{auto:[ru(e.framedFieldOfView,"deg")]}}},bg=(()=>{const t=su("0deg 75deg 105%")[0].terms,e=gu(t[0]),n=gu(t[1]);return t=>{const i=t[gp].idealCameraDistance;return{basis:[e,n,ru(i,"m")],keywords:{auto:[null,null,ru(105,"%")]}}}})(),_g=t=>{const e=dg*t[gp].idealCameraDistance;return{basis:[ru(-1/0,"rad"),ru(Math.PI/8,"rad"),ru(e,"m")],keywords:{auto:[null,null,null]}}},Ig=t=>{const e=bg(t),n=new Tm([],e).evaluate()[2];return{basis:[ru(1/0,"rad"),ru(Math.PI-Math.PI/8,"rad"),ru(n,"m")],keywords:{auto:[null,null,null]}}},Cg=t=>{const e=t[gp].boundingBox.getCenter(new _t);return{basis:[ru(e.x,"m"),ru(e.y,"m"),ru(e.z,"m")],keywords:{auto:[null,null,null]}}},Mg=Math.PI/2,Sg=Math.PI/3,Bg=Mg/2,Tg=2*Math.PI,Lg=Symbol("controls"),Rg=Symbol("promptElement"),Dg=Symbol("promptAnimatedContainer"),Qg=Symbol("deferInteractionPrompt"),Pg=Symbol("updateAria"),Fg=Symbol("updateCameraForRadius"),Ng=Symbol("onBlur"),Ug=Symbol("onFocus"),kg=Symbol("onChange"),Gg=Symbol("onPointerChange"),Og=Symbol("waitingToPromptUser"),Hg=Symbol("userHasInteracted"),zg=Symbol("promptElementVisibleTime"),Vg=Symbol("lastPromptOffset"),Wg=Symbol("focusedTime"),qg=Symbol("zoomAdjustedFieldOfView"),jg=Symbol("lastSpherical"),Yg=Symbol("jumpCamera"),Jg=Symbol("initialized"),Xg=Symbol("maintainThetaPhi"),Kg=Symbol("syncCameraOrbit"),Zg=Symbol("syncFieldOfView"),$g=Symbol("syncCameraTarget"),tf=Symbol("syncMinCameraOrbit"),ef=Symbol("syncMaxCameraOrbit"),nf=Symbol("syncMinFieldOfView"),rf=Symbol("syncMaxFieldOfView");
/* @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 sf,af;const of=Symbol("modelViewerStatusInstance"),lf=Symbol("updateStatus");sf=of,af=lf;
/* @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 cf=function(t,e,n,i){for(var r,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,n,a):r(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a};const hf="auto",uf="manual",df="auto",pf="eager",Af="interaction",mf=new class extends tt{constructor(){super(),this[sf]=null,this.registeredInstanceStatuses=new Map,this.loadingPromises=[],this.statusElement=document.createElement("p"),this.statusUpdateInProgress=!1,this[af]=$h((()=>this.updateStatus()),100);const{statusElement:t}=this,{style:e}=t;t.setAttribute("role","status"),t.classList.add("screen-reader-only"),e.top=e.left="0",e.pointerEvents="none"}registerInstance(t){if(this.registeredInstanceStatuses.has(t))return;let e=()=>{};const n=!1===t.loaded&&!!t.src,i=new Promise((i=>{if(!n)return void i();const r=()=>{i(),t.removeEventListener("load",r),t.removeEventListener("error",r)};t.addEventListener("load",r),t.addEventListener("error",r),e=r}));this.registeredInstanceStatuses.set(t,{onUnregistered:e}),this.loadingPromises.push(i),null==this.modelViewerStatusInstance&&(this.modelViewerStatusInstance=t)}unregisterInstance(t){if(!this.registeredInstanceStatuses.has(t))return;const e=this.registeredInstanceStatuses,n=e.get(t);e.delete(t),n.onUnregistered(),this.modelViewerStatusInstance===t&&(this.modelViewerStatusInstance=e.size>0?(t=>{if(null!=t.keys)return t.keys().next().value||null;let e=null;try{t.forEach(((t,n,i)=>{throw e=n,new Error}))}catch(t){}return e})(e):null)}get modelViewerStatusInstance(){return this[of]}set modelViewerStatusInstance(t){if(this[of]===t)return;const{statusElement:e}=this;null!=t&&null!=t.shadowRoot?t.shadowRoot.appendChild(e):null!=e.parentNode&&e.parentNode.removeChild(e),this[of]=t,this[lf]()}async updateStatus(){if(!this.statusUpdateInProgress&&0!==this.loadingPromises.length){for(this.statusElement.textContent="This page includes one or more 3D models that are loading",this.statusUpdateInProgress=!0,this.dispatchEvent({type:"initial-status-announced"});this.loadingPromises.length;){const{loadingPromises:t}=this;this.loadingPromises=[],await Promise.all(t)}this.statusElement.textContent="All 3D models in the page have loaded",this.statusUpdateInProgress=!1,this.dispatchEvent({type:"finished-loading-announced"})}}},gf=Symbol("defaultProgressBarElement"),ff=Symbol("defaultProgressMaskElement"),vf=Symbol("posterContainerElement"),yf=Symbol("defaultPosterElement"),xf=Symbol("posterDismissalSource"),wf=Symbol("hidePoster"),Ef=Symbol("modelIsRevealed"),bf=Symbol("updateProgressBar"),_f=Symbol("lastReportedProgress"),If=Symbol("transitioned"),Cf=Symbol("ariaLabelCallToAction"),Mf=Symbol("onClick"),Sf=Symbol("onKeydown"),Bf=Symbol("onProgress");class Tf{constructor(){this.pluginCallbacks=[],this.register((function(t){return new rv(t)})),this.register((function(t){return new sv(t)})),this.register((function(t){return new av(t)})),this.register((function(t){return new ov(t)})),this.register((function(t){return new lv(t)}))}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,n){const i=new iv,r=[];for(let t=0,e=this.pluginCallbacks.length;t<e;t++)r.push(this.pluginCallbacks[t](i));i.setPlugins(r),i.write(t,e,n)}}const Lf=0,Rf=1,Df=2,Qf=3,Pf=4,Ff=5121,Nf=5123,Uf=5126,kf=5125,Gf=34962,Of=34963,Hf=9728,zf=9729,Vf=9984,Wf=9985,qf=9986,jf=9987,Yf=33071,Jf=33648,Xf=10497,Kf={};Kf[1003]=Hf,Kf[1004]=Vf,Kf[1005]=qf,Kf[1006]=zf,Kf[1007]=Wf,Kf[1008]=jf,Kf[1001]=Yf,Kf[1e3]=Xf,Kf[1002]=Jf;const Zf={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"};function $f(t,e){return t.length===e.length&&t.every((function(t,n){return t===e[n]}))}function tv(t){return 4*Math.ceil(t/4)}function ev(t,e=0){const n=tv(t.byteLength);if(n!==t.byteLength){const i=new Uint8Array(n);if(i.set(new Uint8Array(t)),0!==e)for(let r=t.byteLength;r<n;r++)i[r]=e;return i.buffer}return t}let nv=null;class iv{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(t){this.plugins=t}write(t,e,n){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(t);const i=this;Promise.all(this.pending).then((function(){const t=i.buffers,n=i.json,r=i.options,s=i.extensionsUsed,a=new Blob(t,{type:"application/octet-stream"}),o=Object.keys(s);if(o.length>0&&(n.extensionsUsed=o),n.buffers&&n.buffers.length>0&&(n.buffers[0].byteLength=a.size),!0===r.binary){const t=new window.FileReader;t.readAsArrayBuffer(a),t.onloadend=function(){const i=ev(t.result),r=new DataView(new ArrayBuffer(8));r.setUint32(0,i.byteLength,!0),r.setUint32(4,5130562,!0);const s=ev(function(t){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(t).buffer;const e=new Uint8Array(new ArrayBuffer(t.length));for(let n=0,i=t.length;n<i;n++){const i=t.charCodeAt(n);e[n]=i>255?32:i}return e.buffer}(JSON.stringify(n)),32),a=new DataView(new ArrayBuffer(8));a.setUint32(0,s.byteLength,!0),a.setUint32(4,1313821514,!0);const o=new ArrayBuffer(12),l=new DataView(o);l.setUint32(0,1179937895,!0),l.setUint32(4,2,!0);const c=12+a.byteLength+s.byteLength+r.byteLength+i.byteLength;l.setUint32(8,c,!0);const h=new Blob([o,a,s,r,i],{type:"application/octet-stream"}),u=new window.FileReader;u.readAsArrayBuffer(h),u.onloadend=function(){e(u.result)}}}else if(n.buffers&&n.buffers.length>0){const t=new window.FileReader;t.readAsDataURL(a),t.onloadend=function(){const i=t.result;n.buffers[0].uri=i,e(n)}}else e(n)}))}serializeUserData(t,e){if(0===Object.keys(t.userData).length)return;const n=this.options,i=this.extensionsUsed;try{const r=JSON.parse(JSON.stringify(t.userData));if(n.includeCustomExtensions&&r.gltfExtensions){void 0===e.extensions&&(e.extensions={});for(const t in r.gltfExtensions)e.extensions[t]=r.gltfExtensions[t],i[t]=!0;delete r.gltfExtensions}Object.keys(r).length>0&&(e.extras=r)}catch(e){console.warn("THREE.GLTFExporter: userData of '"+t.name+"' won't be serialized because of JSON.stringify error - "+e.message)}}getUID(t){return this.uids.has(t)||this.uids.set(t,this.uid++),this.uids.get(t)}isNormalizedNormalAttribute(t){if(this.cache.attributesNormalized.has(t))return!1;const e=new _t;for(let n=0,i=t.count;n<i;n++)if(Math.abs(e.fromBufferAttribute(t,n).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(t){const e=this.cache;if(e.attributesNormalized.has(t))return e.attributesNormalized.get(t);const n=t.clone(),i=new _t;for(let t=0,e=n.count;t<e;t++)i.fromBufferAttribute(n,t),0===i.x&&0===i.y&&0===i.z?i.setX(1):i.normalize(),n.setXYZ(t,i.x,i.y,i.z);return e.attributesNormalized.set(t,n),n}applyTextureTransform(t,e){let n=!1;const i={};0===e.offset.x&&0===e.offset.y||(i.offset=e.offset.toArray(),n=!0),0!==e.rotation&&(i.rotation=e.rotation,n=!0),1===e.repeat.x&&1===e.repeat.y||(i.scale=e.repeat.toArray(),n=!0),n&&(t.extensions=t.extensions||{},t.extensions.KHR_texture_transform=i,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(t){const e=this.json,n=this.buffers;return e.buffers||(e.buffers=[{byteLength:0}]),n.push(t),0}processBufferView(t,e,n,i,r){const s=this.json;let a;s.bufferViews||(s.bufferViews=[]),a=e===Ff?1:e===Nf?2:4;const o=tv(i*t.itemSize*a),l=new DataView(new ArrayBuffer(o));let c=0;for(let r=n;r<n+i;r++)for(let n=0;n<t.itemSize;n++){let i;t.itemSize>4?i=t.array[r*t.itemSize+n]:0===n?i=t.getX(r):1===n?i=t.getY(r):2===n?i=t.getZ(r):3===n&&(i=t.getW(r)),e===Uf?l.setFloat32(c,i,!0):e===kf?l.setUint32(c,i,!0):e===Nf?l.setUint16(c,i,!0):e===Ff&&l.setUint8(c,i),c+=a}const h={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:o};void 0!==r&&(h.target=r),r===Gf&&(h.byteStride=t.itemSize*a),this.byteOffset+=o,s.bufferViews.push(h);return{id:s.bufferViews.length-1,byteLength:0}}processBufferViewImage(t){const e=this,n=e.json;return n.bufferViews||(n.bufferViews=[]),new Promise((function(i){const r=new window.FileReader;r.readAsArrayBuffer(t),r.onloadend=function(){const t=ev(r.result),s={buffer:e.processBuffer(t),byteOffset:e.byteOffset,byteLength:t.byteLength};e.byteOffset+=t.byteLength,i(n.bufferViews.push(s)-1)}}))}processAccessor(t,e,n,i){const r=this.options,s=this.json;let a;if(t.array.constructor===Float32Array)a=Uf;else if(t.array.constructor===Uint32Array)a=kf;else if(t.array.constructor===Uint16Array)a=Nf;else{if(t.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");a=Ff}if(void 0===n&&(n=0),void 0===i&&(i=t.count),r.truncateDrawRange&&void 0!==e&&null===e.index){const r=n+i,s=e.drawRange.count===1/0?t.count:e.drawRange.start+e.drawRange.count;n=Math.max(n,e.drawRange.start),(i=Math.min(r,s)-n)<0&&(i=0)}if(0===i)return null;const o=function(t,e,n){const i={min:new Array(t.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(t.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let r=e;r<e+n;r++)for(let e=0;e<t.itemSize;e++){let n;t.itemSize>4?n=t.array[r*t.itemSize+e]:0===e?n=t.getX(r):1===e?n=t.getY(r):2===e?n=t.getZ(r):3===e&&(n=t.getW(r)),i.min[e]=Math.min(i.min[e],n),i.max[e]=Math.max(i.max[e],n)}return i}(t,n,i);let l;void 0!==e&&(l=t===e.index?Of:Gf);const c=this.processBufferView(t,a,n,i,l),h={bufferView:c.id,byteOffset:c.byteOffset,componentType:a,count:i,max:o.max,min:o.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[t.itemSize]};return!0===t.normalized&&(h.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(h)-1}processImage(t,e,n){const i=this,r=i.cache,s=i.json,a=i.options,o=i.pending;r.images.has(t)||r.images.set(t,{});const l=r.images.get(t),c=1023===e?"image/png":"image/jpeg",h=c+":flipY/"+n.toString();if(void 0!==l[h])return l[h];s.images||(s.images=[]);const u={mimeType:c};if(a.embedImages){const r=nv=nv||document.createElement("canvas");r.width=Math.min(t.width,a.maxTextureSize),r.height=Math.min(t.height,a.maxTextureSize);const s=r.getContext("2d");if(!0===n&&(s.translate(0,r.height),s.scale(1,-1)),"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap)s.drawImage(t,0,0,r.width,r.height);else{1023!==e&&1022!==e&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(t.width>a.maxTextureSize||t.height>a.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",t);const n=new Uint8ClampedArray(t.height*t.width*4);if(1023===e)for(let e=0;e<n.length;e+=4)n[e+0]=t.data[e+0],n[e+1]=t.data[e+1],n[e+2]=t.data[e+2],n[e+3]=t.data[e+3];else for(let e=0,i=0;e<n.length;e+=4,i+=3)n[e+0]=t.data[i+0],n[e+1]=t.data[i+1],n[e+2]=t.data[i+2],n[e+3]=255;s.putImageData(new ImageData(n,t.width,t.height),0,0)}!0===a.binary?o.push(new Promise((function(t){r.toBlob((function(e){i.processBufferViewImage(e).then((function(e){u.bufferView=e,t()}))}),c)}))):u.uri=r.toDataURL(c)}else u.uri=t.src;const d=s.images.push(u)-1;return l[h]=d,d}processSampler(t){const e=this.json;e.samplers||(e.samplers=[]);const n={magFilter:Kf[t.magFilter],minFilter:Kf[t.minFilter],wrapS:Kf[t.wrapS],wrapT:Kf[t.wrapT]};return e.samplers.push(n)-1}processTexture(t){const e=this.cache,n=this.json;if(e.textures.has(t))return e.textures.get(t);n.textures||(n.textures=[]);const i={sampler:this.processSampler(t),source:this.processImage(t.image,t.format,t.flipY)};t.name&&(i.name=t.name),this._invokeAll((function(e){e.writeTexture&&e.writeTexture(t,i)}));const r=n.textures.push(i)-1;return e.textures.set(t,r),r}processMaterial(t){const e=this.cache,n=this.json;if(e.materials.has(t))return e.materials.get(t);if(t.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);const i={pbrMetallicRoughness:{}};!0!==t.isMeshStandardMaterial&&!0!==t.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const r=t.color.toArray().concat([t.opacity]);if($f(r,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=r),t.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=t.metalness,i.pbrMetallicRoughness.roughnessFactor=t.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),t.metalnessMap||t.roughnessMap)if(t.metalnessMap===t.roughnessMap){const e={index:this.processTexture(t.metalnessMap)};this.applyTextureTransform(e,t.metalnessMap),i.pbrMetallicRoughness.metallicRoughnessTexture=e}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(t.map){const e={index:this.processTexture(t.map)};this.applyTextureTransform(e,t.map),i.pbrMetallicRoughness.baseColorTexture=e}if(t.emissive){const e=t.emissive.clone().multiplyScalar(t.emissiveIntensity),n=Math.max(e.r,e.g,e.b);if(n>1&&(e.multiplyScalar(1/n),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),n>0&&(i.emissiveFactor=e.toArray()),t.emissiveMap){const e={index:this.processTexture(t.emissiveMap)};this.applyTextureTransform(e,t.emissiveMap),i.emissiveTexture=e}}if(t.normalMap){const e={index:this.processTexture(t.normalMap)};t.normalScale&&1!==t.normalScale.x&&(e.scale=t.normalScale.x),this.applyTextureTransform(e,t.normalMap),i.normalTexture=e}if(t.aoMap){const e={index:this.processTexture(t.aoMap),texCoord:1};1!==t.aoMapIntensity&&(e.strength=t.aoMapIntensity),this.applyTextureTransform(e,t.aoMap),i.occlusionTexture=e}t.transparent?i.alphaMode="BLEND":t.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=t.alphaTest),2===t.side&&(i.doubleSided=!0),""!==t.name&&(i.name=t.name),this.serializeUserData(t,i),this._invokeAll((function(e){e.writeMaterial&&e.writeMaterial(t,i)}));const s=n.materials.push(i)-1;return e.materials.set(t,s),s}processMesh(t){const e=this.cache,n=this.json,i=[t.geometry.uuid];if(Array.isArray(t.material))for(let e=0,n=t.material.length;e<n;e++)i.push(t.material[e].uuid);else i.push(t.material.uuid);const r=i.join(":");if(e.meshes.has(r))return e.meshes.get(r);const s=t.geometry;let a;if(a=t.isLineSegments?Rf:t.isLineLoop?Df:t.isLine?Qf:t.isPoints?Lf:t.material.wireframe?Rf:Pf,!0!==s.isBufferGeometry)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");const o={},l={},c=[],h=[],u={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},d=s.getAttribute("normal");void 0===d||this.isNormalizedNormalAttribute(d)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",this.createNormalizedNormalAttribute(d)));let p=null;for(let t in s.attributes){if("morph"===t.substr(0,5))continue;const n=s.attributes[t];t=u[t]||t.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(t)||(t="_"+t),e.attributes.has(this.getUID(n))){l[t]=e.attributes.get(this.getUID(n));continue}p=null;const i=n.array;"JOINTS_0"!==t||i instanceof Uint16Array||i instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),p=new Xe(new Uint16Array(i),n.itemSize,n.normalized));const r=this.processAccessor(p||n,s);null!==r&&(l[t]=r,e.attributes.set(this.getUID(n),r))}if(void 0!==d&&s.setAttribute("normal",d),0===Object.keys(l).length)return null;if(void 0!==t.morphTargetInfluences&&t.morphTargetInfluences.length>0){const n=[],i=[],r={};if(void 0!==t.morphTargetDictionary)for(const e in t.morphTargetDictionary)r[t.morphTargetDictionary[e]]=e;for(let a=0;a<t.morphTargetInfluences.length;++a){const o={};let l=!1;for(const t in s.morphAttributes){if("position"!==t&&"normal"!==t){l||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),l=!0);continue}const n=s.morphAttributes[t][a],i=t.toUpperCase(),r=s.attributes[t];if(e.attributes.has(this.getUID(n))){o[i]=e.attributes.get(this.getUID(n));continue}const c=n.clone();if(!s.morphTargetsRelative)for(let t=0,e=n.count;t<e;t++)c.setXYZ(t,n.getX(t)-r.getX(t),n.getY(t)-r.getY(t),n.getZ(t)-r.getZ(t));o[i]=this.processAccessor(c,s),e.attributes.set(this.getUID(r),o[i])}h.push(o),n.push(t.morphTargetInfluences[a]),void 0!==t.morphTargetDictionary&&i.push(r[a])}o.weights=n,i.length>0&&(o.extras={},o.extras.targetNames=i)}const A=Array.isArray(t.material);if(A&&0===s.groups.length)return null;const m=A?t.material:[t.material],g=A?s.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let t=0,n=g.length;t<n;t++){const n={mode:a,attributes:l};if(this.serializeUserData(s,n),h.length>0&&(n.targets=h),null!==s.index){let i=this.getUID(s.index);void 0===g[t].start&&void 0===g[t].count||(i+=":"+g[t].start+":"+g[t].count),e.attributes.has(i)?n.indices=e.attributes.get(i):(n.indices=this.processAccessor(s.index,s,g[t].start,g[t].count),e.attributes.set(i,n.indices)),null===n.indices&&delete n.indices}const i=this.processMaterial(m[g[t].materialIndex]);null!==i&&(n.material=i),c.push(n)}o.primitives=c,n.meshes||(n.meshes=[]),this._invokeAll((function(e){e.writeMesh&&e.writeMesh(t,o)}));const f=n.meshes.push(o)-1;return e.meshes.set(r,f),f}processCamera(t){const e=this.json;e.cameras||(e.cameras=[]);const n=t.isOrthographicCamera,i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:2*t.right,ymag:2*t.top,zfar:t.far<=0?.001:t.far,znear:t.near<0?0:t.near}:i.perspective={aspectRatio:t.aspect,yfov:dt.degToRad(t.fov),zfar:t.far<=0?.001:t.far,znear:t.near<0?0:t.near},""!==t.name&&(i.name=t.type),e.cameras.push(i)-1}processAnimation(t,e){const n=this.json,i=this.nodeMap;n.animations||(n.animations=[]);const r=(t=Tf.Utils.mergeMorphTargetTracks(t.clone(),e)).tracks,s=[],a=[];for(let t=0;t<r.length;++t){const n=r[t],o=Ul.parseTrackName(n.name);let l=Ul.findNode(e,o.nodeName);const c=Zf[o.propertyName];if("bones"===o.objectName&&(l=!0===l.isSkinnedMesh?l.skeleton.getBoneByName(o.objectIndex):void 0),!l||!c)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',n.name),null;const h=1;let u,d=n.values.length/n.times.length;c===Zf.morphTargetInfluences&&(d/=l.morphTargetInfluences.length),!0===n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(u="CUBICSPLINE",d/=3):u=2300===n.getInterpolation()?"STEP":"LINEAR",a.push({input:this.processAccessor(new Xe(n.times,h)),output:this.processAccessor(new Xe(n.values,d)),interpolation:u}),s.push({sampler:a.length-1,target:{node:i.get(l),path:c}})}return n.animations.push({name:t.name||"clip_"+n.animations.length,samplers:a,channels:s}),n.animations.length-1}processSkin(t){const e=this.json,n=this.nodeMap,i=e.nodes[n.get(t)],r=t.skeleton;if(void 0===r)return null;const s=t.skeleton.bones[0];if(void 0===s)return null;const a=[],o=new Float32Array(16*r.bones.length),l=new ee;for(let e=0;e<r.bones.length;++e)a.push(n.get(r.bones[e])),l.copy(r.boneInverses[e]),l.multiply(t.bindMatrix).toArray(o,16*e);void 0===e.skins&&(e.skins=[]),e.skins.push({inverseBindMatrices:this.processAccessor(new Xe(o,16)),joints:a,skeleton:n.get(s)});return i.skin=e.skins.length-1}processNode(t){const e=this.json,n=this.options,i=this.nodeMap;e.nodes||(e.nodes=[]);const r={};if(n.trs){const e=t.quaternion.toArray(),n=t.position.toArray(),i=t.scale.toArray();$f(e,[0,0,0,1])||(r.rotation=e),$f(n,[0,0,0])||(r.translation=n),$f(i,[1,1,1])||(r.scale=i)}else t.matrixAutoUpdate&&t.updateMatrix(),!1===$f(t.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(r.matrix=t.matrix.elements);if(""!==t.name&&(r.name=String(t.name)),this.serializeUserData(t,r),t.isMesh||t.isLine||t.isPoints){const e=this.processMesh(t);null!==e&&(r.mesh=e)}else t.isCamera&&(r.camera=this.processCamera(t));if(t.isSkinnedMesh&&this.skins.push(t),t.children.length>0){const e=[];for(let i=0,r=t.children.length;i<r;i++){const r=t.children[i];if(r.visible||!1===n.onlyVisible){const t=this.processNode(r);null!==t&&e.push(t)}}e.length>0&&(r.children=e)}this._invokeAll((function(e){e.writeNode&&e.writeNode(t,r)}));const s=e.nodes.push(r)-1;return i.set(t,s),s}processScene(t){const e=this.json,n=this.options;e.scenes||(e.scenes=[],e.scene=0);const i={};""!==t.name&&(i.name=t.name),e.scenes.push(i);const r=[];for(let e=0,i=t.children.length;e<i;e++){const i=t.children[e];if(i.visible||!1===n.onlyVisible){const t=this.processNode(i);null!==t&&r.push(t)}}r.length>0&&(i.nodes=r),this.serializeUserData(t,i)}processObjects(t){const e=new Ps;e.name="AuxScene";for(let n=0;n<t.length;n++)e.children.push(t[n]);this.processScene(e)}processInput(t){const e=this.options;t=t instanceof Array?t:[t],this._invokeAll((function(e){e.beforeParse&&e.beforeParse(t)}));const n=[];for(let e=0;e<t.length;e++)t[e]instanceof Ps?this.processScene(t[e]):n.push(t[e]);n.length>0&&this.processObjects(n);for(let t=0;t<this.skins.length;++t)this.processSkin(this.skins[t]);for(let n=0;n<e.animations.length;++n)this.processAnimation(e.animations[n],t[0]);this._invokeAll((function(e){e.afterParse&&e.afterParse(t)}))}_invokeAll(t){for(let e=0,n=this.plugins.length;e<n;e++)t(this.plugins[e])}}class rv{constructor(t){this.writer=t,this.name="KHR_lights_punctual"}writeNode(t,e){if(!t.isLight)return;if(!t.isDirectionalLight&&!t.isPointLight&&!t.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",t);const n=this.writer,i=n.json,r=n.extensionsUsed,s={};t.name&&(s.name=t.name),s.color=t.color.toArray(),s.intensity=t.intensity,t.isDirectionalLight?s.type="directional":t.isPointLight?(s.type="point",t.distance>0&&(s.range=t.distance)):t.isSpotLight&&(s.type="spot",t.distance>0&&(s.range=t.distance),s.spot={},s.spot.innerConeAngle=(t.penumbra-1)*t.angle*-1,s.spot.outerConeAngle=t.angle),void 0!==t.decay&&2!==t.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!t.target||t.target.parent===t&&0===t.target.position.x&&0===t.target.position.y&&-1===t.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),r[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},r[this.name]=!0);const a=i.extensions[this.name].lights;a.push(s),e.extensions=e.extensions||{},e.extensions[this.name]={light:a.length-1}}}class sv{constructor(t){this.writer=t,this.name="KHR_materials_unlit"}writeMaterial(t,e){if(!t.isMeshBasicMaterial)return;const n=this.writer.extensionsUsed;e.extensions=e.extensions||{},e.extensions[this.name]={},n[this.name]=!0,e.pbrMetallicRoughness.metallicFactor=0,e.pbrMetallicRoughness.roughnessFactor=.9}}class av{constructor(t){this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(t,e){if(!t.isGLTFSpecularGlossinessMaterial)return;const n=this.writer,i=n.extensionsUsed,r={};e.pbrMetallicRoughness.baseColorFactor&&(r.diffuseFactor=e.pbrMetallicRoughness.baseColorFactor);const s=[1,1,1];if(t.specular.toArray(s,0),r.specularFactor=s,r.glossinessFactor=t.glossiness,e.pbrMetallicRoughness.baseColorTexture&&(r.diffuseTexture=e.pbrMetallicRoughness.baseColorTexture),t.specularMap){const e={index:n.processTexture(t.specularMap)};n.applyTextureTransform(e,t.specularMap),r.specularGlossinessTexture=e}e.extensions=e.extensions||{},e.extensions[this.name]=r,i[this.name]=!0}}class ov{constructor(t){this.writer=t,this.name="KHR_materials_transmission"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||0===t.transmission)return;const n=this.writer,i=n.extensionsUsed,r={};if(r.transmissionFactor=t.transmission,t.transmissionMap){const e={index:n.processTexture(t.transmissionMap)};n.applyTextureTransform(e,t.transmissionMap),r.transmissionTexture=e}e.extensions=e.extensions||{},e.extensions[this.name]=r,i[this.name]=!0}}class lv{constructor(t){this.writer=t,this.name="KHR_materials_volume"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||0===t.thickness)return;const n=this.writer,i=n.extensionsUsed,r={};if(r.thicknessFactor=t.thickness,t.thicknessMap){const e={index:n.processTexture(t.thicknessMap)};n.applyTextureTransform(e,t.thicknessMap),r.thicknessTexture=e}r.attenuationDistance=t.attenuationDistance,r.attenuationColor=t.attenuationTint.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=r,i[this.name]=!0}}Tf.Utils={insertKeyframe:function(t,e){const n=.001,i=t.getValueSize(),r=new t.TimeBufferType(t.times.length+1),s=new t.ValueBufferType(t.values.length+i),a=t.createInterpolant(new t.ValueBufferType(i));let o;if(0===t.times.length){r[0]=e;for(let t=0;t<i;t++)s[t]=0;o=0}else if(e<t.times[0]){if(Math.abs(t.times[0]-e)<n)return 0;r[0]=e,r.set(t.times,1),s.set(a.evaluate(e),0),s.set(t.values,i),o=0}else if(e>t.times[t.times.length-1]){if(Math.abs(t.times[t.times.length-1]-e)<n)return t.times.length-1;r[r.length-1]=e,r.set(t.times,0),s.set(t.values,0),s.set(a.evaluate(e),t.values.length),o=r.length-1}else for(let l=0;l<t.times.length;l++){if(Math.abs(t.times[l]-e)<n)return l;if(t.times[l]<e&&t.times[l+1]>e){r.set(t.times.slice(0,l+1),0),r[l+1]=e,r.set(t.times.slice(l+1),l+2),s.set(t.values.slice(0,(l+1)*i),0),s.set(a.evaluate(e),(l+1)*i),s.set(t.values.slice((l+1)*i),(l+2)*i),o=l+1;break}}return t.times=r,t.values=s,o},mergeMorphTargetTracks:function(t,e){const n=[],i={},r=t.tracks;for(let t=0;t<r.length;++t){let s=r[t];const a=Ul.parseTrackName(s.name),o=Ul.findNode(e,a.nodeName);if("morphTargetInfluences"!==a.propertyName||void 0===a.propertyIndex){n.push(s);continue}if(s.createInterpolant!==s.InterpolantFactoryMethodDiscrete&&s.createInterpolant!==s.InterpolantFactoryMethodLinear){if(s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),s=s.clone(),s.setInterpolation(2301)}const l=o.morphTargetInfluences.length,c=o.morphTargetDictionary[a.propertyIndex];if(void 0===c)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let h;if(void 0===i[o.uuid]){h=s.clone();const t=new h.ValueBufferType(l*h.times.length);for(let e=0;e<h.times.length;e++)t[e*l+c]=h.values[e];h.name=(a.nodeName||"")+".morphTargetInfluences",h.values=t,i[o.uuid]=h,n.push(h);continue}const u=s.createInterpolant(new s.ValueBufferType(1));h=i[o.uuid];for(let t=0;t<h.times.length;t++)h.values[t*l+c]=u.evaluate(h.times[t]);for(let t=0;t<s.times.length;t++){const e=this.insertKeyframe(h,s.times[t]);h.values[e*l+c]=s.values[t]}}return t.tracks=n,t}};
/* @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 cv=t=>void 0!==t.material&&t.userData&&t.userData.variantMaterials&&!!Array.from(t.userData.variantMaterials.values()).filter((t=>hv(t.material))),hv=t=>t&&t.isMaterial&&!Array.isArray(t);class uv{constructor(t){this.writer=t,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(t){const e=new Set;for(const n of t)n.traverse((t=>{if(!cv(t))return;const n=t.userData.variantMaterials;for(const t of n.keys()){const i=n.get(t);hv(i.material)&&e.add(t)}}));e.forEach((t=>this.variantNames.push(t)))}writeMesh(t,e){if(!cv(t))return;const n=t.userData,i=n.variantMaterials,r=new Map;for(const t of i.keys()){const e=i.get(t).material;if(!hv(e))continue;const n=this.variantNames.indexOf(t),s=this.writer.processMaterial(e);r.has(s)||r.set(s,{material:s,variants:[]}),r.get(s).variants.push(n)}const s=Array.from(r.values()).map((t=>t.variants.sort(((t,e)=>t-e))&&t)).sort(((t,e)=>t.material-e.material));if(0===s.length)return;const a=hv(n.originalMaterial)?this.writer.processMaterial(n.originalMaterial):-1;for(const t of e.primitives)a>=0&&(t.material=a),t.extensions=t.extensions||{},t.extensions[this.name]={mappings:s}}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}}
/* @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 dv=Symbol("correlatedObjects"),pv=Symbol("sourceObject"),Av=Symbol("onUpdate");class mv{constructor(t,e,n=null){this[Av]=t,this[pv]=e,this[dv]=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.
 */const gv=new el,fv=new je,vv=new Yn(2,2),yv=Symbol("threeTexture");class xv extends mv{get[yv](){var t;return console.assert(null!=this[dv]&&this[dv].size>0,"Image correlated object is undefined"),null===(t=this[dv])||void 0===t?void 0:t.values().next().value}constructor(t,e,n){super(t,n=null!=n?n:{name:"adhoc_image",uri:e&&e.image?e.image.src:"adhoc_image"},new Set(e?[e]:[]))}get name(){return this[pv].name||""}get uri(){return this[pv].uri}get bufferView(){return this[pv].bufferView}get type(){return null!=this.uri?"external":"embedded"}async setURI(t){this[pv].uri=t;const e=await new Promise(((e,n)=>{gv.load(t,e,void 0,n)})),n=this[yv];n.image=e,n.needsUpdate=!0,this[Av]()}async createThumbnail(t,e){const n=new Ps;fv.map=this[yv];const i=new Mn(vv,fv);n.add(i);const r=new ri(-1,1,1,-1,0,1),{threeRenderer:s}=Dd.singleton,a=new wt(t,e);s.setRenderTarget(a),s.render(n,r),s.setRenderTarget(null);const o=new Uint8Array(t*e*4);s.readRenderTargetPixels(a,0,0,t,e,o),Kd.width=t,Kd.height=e;const l=Kd.getContext("2d"),c=l.createImageData(t,e);return c.data.set(o),l.putImageData(c,0,0),new Promise((async(t,e)=>{Kd.toBlob((n=>{if(!n)return e("Failed to capture thumbnail.");t(URL.createObjectURL(n))}),"image/png")}))}}var wv,Ev;!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"}(wv||(wv={})),function(t){t[t.ClampToEdge=33071]="ClampToEdge",t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.Repeat=10497]="Repeat"}(Ev||(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.
 */
jcfernandez-890825 commented 1 year ago
const bv=(()=>{const t=[wv.Nearest,wv.Linear,wv.NearestMipmapNearest,wv.LinearMipmapLinear,wv.NearestMipmapLinear,wv.LinearMipmapLinear];return e=>t.indexOf(e)>-1})(),_v=(()=>{const t=[wv.Nearest,wv.Linear];return e=>t.indexOf(e)>-1})(),Iv=(()=>{const t=[Ev.ClampToEdge,Ev.MirroredRepeat,Ev.Repeat];return e=>t.indexOf(e)>-1})(),Cv=Symbol("threeTextures"),Mv=Symbol("setProperty"),Sv=Symbol("sourceSampler");class Bv extends mv{get[Cv](){return console.assert(null!=this[dv]&&this[dv].size>0,"Sampler correlated object is undefined"),this[dv]}get[Sv](){return console.assert(null!=this[pv],"Sampler source is undefined"),this[pv]}constructor(t,e,n){null==(n=null!=n?n:{}).minFilter&&(n.minFilter=e?e.minFilter:wv.LinearMipmapLinear),null==n.magFilter&&(n.magFilter=e?e.magFilter:wv.Linear),null==n.wrapS&&(n.wrapS=e?e.wrapS:Ev.Repeat),null==n.wrapT&&(n.wrapT=e?e.wrapT:Ev.Repeat),super(t,n,new Set(e?[e]:[]))}get name(){return this[pv].name||""}get minFilter(){return this[Sv].minFilter}get magFilter(){return this[Sv].magFilter}get wrapS(){return this[Sv].wrapS}get wrapT(){return this[Sv].wrapT}setMinFilter(t){this[Mv]("minFilter",t)}setMagFilter(t){this[Mv]("magFilter",t)}setWrapS(t){this[Mv]("wrapS",t)}setWrapT(t){this[Mv]("wrapT",t)}[Mv](t,e){const n=this[Sv];if(null!=n){if(((t,e)=>{switch(t){case"minFilter":return bv(e);case"magFilter":return _v(e);case"wrapS":case"wrapT":return Iv(e);default:throw new Error(`Cannot configure property "${t}" on Sampler`)}})(t,e)){n[t]=e;for(const n of this[Cv])n[t]=e,n.needsUpdate=!0}this[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 Tv=Symbol("image"),Lv=Symbol("sampler");class Rv extends mv{constructor(t,e,n=null,i=null,r=null){super(t,n||{},new Set(e?[e]:[])),this[Lv]=new Bv(t,e,i),this[Tv]=new xv(t,e,r)}get name(){return this[pv].name||""}get sampler(){return this[Lv]}get source(){return this[Tv]}}
/* @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 Dv;const Qv=Symbol("texture"),Pv=Symbol("materials"),Fv=Symbol("usage");var Nv;!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"}(Nv||(Nv={}));class Uv{constructor(t,e,n,i,r,s){if(this[Dv]=null,s){const e=r.textures?r.textures[s.index]:null,i=e&&r.samplers?r.samplers[e.sampler]:null,a=e&&r.images?r.images[e.source]:null;this[Qv]=new Rv(t,n,e,i,a)}this.onUpdate=t,this[Pv]=i,this[Fv]=e}get texture(){return this[Qv]}setTexture(t){const e=null!=t?t.source[yv]:null;let n=3001;if(this[Qv]=t,this[Pv])for(const t of this[Pv]){switch(this[Fv]){case Nv.Base:t.map=e;break;case Nv.MetallicRoughness:n=3e3,t.metalnessMap=e,t.roughnessMap=e;break;case Nv.Normal:n=3e3,t.normalMap=e;break;case Nv.Occlusion:n=3e3,t.aoMap=e;break;case Nv.Emissive:t.emissiveMap=e}t.needsUpdate=!0}e&&(e.encoding=n),this.onUpdate()}}Dv=Qv;
/* @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 kv=Symbol("threeMaterials"),Gv=Symbol("baseColorTexture"),Ov=Symbol("metallicRoughnessTexture");class Hv extends mv{constructor(t,e,n,i){super(t,n,i),null==n.baseColorFactor&&(n.baseColorFactor=[1,1,1,1]),null==n.roughnessFactor&&(n.roughnessFactor=1),null==n.metallicFactor&&(n.metallicFactor=1);const{baseColorTexture:r,metallicRoughnessTexture:s}=n,{map:a,metalnessMap:o}=i.values().next().value;this[Gv]=new Uv(t,Nv.Base,a,i,e,r||null),this[Ov]=new Uv(t,Nv.MetallicRoughness,o,i,e,s||null)}get[kv](){return this[dv]}get baseColorFactor(){return this[pv].baseColorFactor}get metallicFactor(){return this[pv].metallicFactor}get roughnessFactor(){return this[pv].roughnessFactor}get baseColorTexture(){return this[Gv]}get metallicRoughnessTexture(){return this[Ov]}setBaseColorFactor(t){for(const e of this[kv])e.color.fromArray(t),e.opacity=t[3];this[pv].baseColorFactor=t,this[Av]()}setMetallicFactor(t){for(const e of this[kv])e.metalness=t;this[pv].metallicFactor=t,this[Av]()}setRoughnessFactor(t){for(const e of this[kv])e.roughness=t;this[pv].roughnessFactor=t,this[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 zv=Symbol("pbrMetallicRoughness"),Vv=Symbol("normalTexture"),Wv=Symbol("occlusionTexture"),qv=Symbol("emissiveTexture"),jv=Symbol("backingThreeMaterial"),Yv=Symbol("applyAlphaCutoff");class Jv extends mv{constructor(t,e,n,i){if(super(t,n,i),null==i)return;n.extensions&&n.extensions.KHR_materials_pbrSpecularGlossiness&&console.warn(`Material ${n.name} uses a deprecated extension\n          "KHR_materials_pbrSpecularGlossiness", please use\n          "pbrMetallicRoughness" instead. Specular Glossiness materials are\n          currently supported for rendering, but not for our scene-graph API,\n          nor for auto-generation of USDZ for Quick Look.`),null==n.pbrMetallicRoughness&&(n.pbrMetallicRoughness={}),this[zv]=new Hv(t,e,n.pbrMetallicRoughness,i),null==n.emissiveFactor&&(n.emissiveFactor=[0,0,0]),null==n.doubleSided&&(n.doubleSided=!1),null==n.alphaMode&&(n.alphaMode="OPAQUE"),null==n.alphaCutoff&&(n.alphaCutoff=.5);const{normalTexture:r,occlusionTexture:s,emissiveTexture:a}=n,{normalMap:o,aoMap:l,emissiveMap:c}=i.values().next().value;this[Vv]=new Uv(t,Nv.Normal,o,i,e,r||null),this[Wv]=new Uv(t,Nv.Occlusion,l,i,e,s||null),this[qv]=new Uv(t,Nv.Emissive,c,i,e,a||null)}get[jv](){return this[dv].values().next().value}get name(){return this[pv].name||""}get pbrMetallicRoughness(){return this[zv]}get normalTexture(){return this[Vv]}get occlusionTexture(){return this[Wv]}get emissiveTexture(){return this[qv]}get emissiveFactor(){return this[pv].emissiveFactor}setEmissiveFactor(t){for(const e of this[dv])e.emissive.fromArray(t);this[pv].emissiveFactor=t,this[Av]()}[Yv](){const t=this[pv],e="OPAQUE"===t.alphaMode?-.5:"BLEND"===t.alphaMode?0:Math.max(1e-4,Math.min(1,t.alphaCutoff));for(const t of this[dv])t.alphaTest=e,t.needsUpdate=!0}setAlphaCutoff(t){this[pv].alphaCutoff=t,this[Yv](),this[Av]()}getAlphaCutoff(){return this[pv].alphaCutoff}setDoubleSided(t){for(const e of this[dv])e.side=t?2:0,e.needsUpdate=!0;this[pv].doubleSided=t,this[Av]()}getDoubleSided(){return this[pv].doubleSided}setAlphaMode(t){const e=(t,e)=>{t.transparent=e,t.depthWrite=!e};this[pv].alphaMode=t;for(const n of this[dv])e(n,"OPAQUE"!==t),this[Yv](),n.needsUpdate=!0;this[Av]()}getAlphaMode(){return this[pv].alphaMode}}
/* @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 Xv;const Kv=Symbol("materials");class Zv{constructor(t,e=(()=>{})){this[Xv]=[];const{gltf:n,gltfElementMap:i}=t;n.materials.forEach((t=>{this[Kv].push(new Jv(e,n,t,i.get(t)))}))}get materials(){return this[Kv]}}Xv=Kv;
/* @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 $v=function(t,e,n,i){for(var r,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,n,a):r(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a};const ty=Symbol("currentGLTF"),ey=Symbol("model"),ny=Symbol("variants"),iy=Symbol("getOnUpdateMethod"),ry=Symbol("textureLoader"),sy=Symbol("originalGltfJson");
/* @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 ay=function(t,e,n,i){for(var r,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,n,a):r(e,n))||a);return s>3&&a&&Object.defineProperty(e,n,a),a};const oy=Math.PI/32,ly={basis:[Au(ru(oy,"rad"))],keywords:{auto:[null]}},cy=Symbol("autoRotateStartTime"),hy=Symbol("radiansPerSecond"),uy=Symbol("syncRotationRate"),dy=Symbol("onCameraChange"),py=(t=>{var e,n,i;class r extends t{constructor(){super(...arguments),this[e]=new Map,this[n]=t=>{t.forEach((t=>{t instanceof MutationRecord&&"childList"!==t.type||(t.addedNodes.forEach((t=>{this[Fp](t)})),t.removedNodes.forEach((t=>{this[Np](t)})),this[fp]())}))},this[i]=new MutationObserver(this[Qp])}connectedCallback(){super.connectedCallback();for(let t=0;t<this.children.length;++t)this[Fp](this.children[t]);const{ShadyDOM:t}=self;null==t?this[Pp].observe(this,{childList:!0}):this[Pp]=t.observeChildren(this,this[Qp])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:t}=self;null==t?this[Pp].disconnect():t.unobserveChildren(this[Pp])}[(e=Dp,n=Qp,i=Pp,vp)](t,e){super[vp](t,e);const n=this[gp],{annotationRenderer:i}=n,r=n.getCamera();n.isDirty&&(n.updateHotspots(r.position),i.domElement.style.display="",i.render(n,r))}updateHotspot(t){const e=this[Dp].get(t.name);null!=e&&(e.updatePosition(t.position),e.updateNormal(t.normal),this[fp]())}positionAndNormalFromPoint(t,e){const n=this[gp],{width:i,height:r,target:s}=n;Up.set(t/i,e/r).multiplyScalar(2).subScalar(1),Up.y*=-1;const a=n.positionAndNormalFromPoint(Up);if(null==a)return null;kp.copy(s.matrixWorld).invert();const o=Sp(a.position.applyMatrix4(kp));Gp.getNormalMatrix(kp);return{position:o,normal:Sp(a.normal.applyNormalMatrix(Gp))}}[Fp](t){if(!(t instanceof HTMLElement&&0===t.slot.indexOf("hotspot")))return;let e=this[Dp].get(t.slot);null!=e?e.increment():(e=new fu({name:t.slot,position:t.dataset.position,normal:t.dataset.normal}),this[Dp].set(t.slot,e),this[gp].addHotspot(e)),this[gp].isDirty=!0}[Np](t){if(!(t instanceof HTMLElement))return;const e=this[Dp].get(t.slot);e&&(e.decrement()&&(this[gp].removeHotspot(e),this[Dp].delete(t.slot)),this[gp].isDirty=!0)}}return r})((t=>{var e,n,i,r,s;class a extends t{constructor(){super(...arguments),this[e]=void 0,this[n]=null,this[i]=[],this[r]=new rl,this[s]=null,this.variantName=void 0,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[ey]}get availableVariants(){return this[ny]}get originalGltfJson(){return this[sy]}[(e=ey,n=ty,i=ny,r=ry,s=sy,iy)](){return()=>{this[fp]()}}async createTexture(t,e="image/png"){const n=this[ty],i=await new Promise((e=>this[ry].load(t,e)));return n&&i?(i.encoding=3001,i.wrapS=1e3,i.wrapT=1e3,i.flipY=!1,"image/jpeg"===e&&(i.format=1022),new Rv(this[iy](),i)):null}async updated(t){if(super.updated(t),t.has("variantName")){const t=this[ty],{variantName:e}=this;if(null==t)return;const n=await t.correlatedSceneGraph.loadVariant(e),{gltf:i,gltfElementMap:r}=t.correlatedSceneGraph;for(const t of n){const e=i.materials[t];this[ey].materials[t]=new Jv(this[iy](),i,e,r.get(e))}this[fp]()}if(t.has("orientation")||t.has("scale")){const{modelContainer:t}=this[gp],e=su(this.orientation)[0].terms,n=gu(e[0]).number,i=gu(e[1]).number,r=gu(e[2]).number;t.quaternion.setFromEuler(new ue(i,r,n,"YXZ"));const s=su(this.scale)[0].terms;t.scale.set(s[0].number,s[1].number,s[2].number),this[gp].updateBoundingBox(),this[gp].updateShadow(),this[wp].arRenderer.onUpdateScene(),this[fp]()}}[yp](){super[yp](),this[ny]=[];const{currentGLTF:t}=this[gp];if(null!=t){const{correlatedSceneGraph:e}=t;null!=e&&t!==this[ty]&&(this[ey]=new Zv(e,this[iy]()),this[sy]=JSON.parse(JSON.stringify(e.gltf))),"variants"in t.userData&&(this[ny]=t.userData.variants.slice(),this.requestUpdate("variantName"))}this[ty]=t,this.dispatchEvent(new CustomEvent("scene-graph-ready"))}async exportScene(t){const e=this[gp];return new Promise((async n=>{const i={binary:!0,onlyVisible:!0,maxTextureSize:1/0,forcePowerOfTwoTextures:!1,includeCustomExtensions:!1,embedImages:!0};Object.assign(i,t),i.animations=e.animations,i.truncateDrawRange=!0;const r=e.shadow;let s=!1;null!=r&&(s=r.visible,r.visible=!1);const a=this[ty];null!=a&&"functions"in a.userData&&"ensureLoadVariants"in a.userData.functions&&await a.userData.functions.ensureLoadVariants(e);(new Tf).register((t=>new uv(t))).parse(e.modelContainer.children[0],(t=>n(new Blob([i.binary?t:JSON.stringify(t)],{type:i.binary?"application/octet-stream":"application/json"}))),i),null!=r&&(r.visible=s)}))}}return $v([F({type:String,attribute:"variant-name"})],a.prototype,"variantName",void 0),$v([F({type:String,attribute:"orientation"})],a.prototype,"orientation",void 0),$v([F({type:String,attribute:"scale"})],a.prototype,"scale",void 0),a})((t=>{var e,n,i;class r extends t{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[e]=performance.now(),this[n]=0,this[i]=t=>{this.autoRotate&&"user-interaction"===t.detail.source&&(this[cy]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[dy]),this[cy]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[dy]),this[cy]=performance.now()}updated(t){super.updated(t),t.has("autoRotate")&&(this[cy]=performance.now())}[(e=cy,n=hy,uy)](t){this[hy]=t[0]}[vp](t,e){if(super[vp](t,e),!this.autoRotate||!this[Mp]()||this[wp].isPresenting)return;const n=Math.min(e,t-this[cy]-this.autoRotateDelay);n>0&&(this[gp].yaw=this.turntableRotation+this[hy]*n*.001)}get turntableRotation(){return this[gp].yaw}resetTurntableRotation(t=0){this[gp].yaw=t}}return i=dy,ay([F({type:Boolean,attribute:"auto-rotate"})],r.prototype,"autoRotate",void 0),ay([F({type:Number,attribute:"auto-rotate-delay"})],r.prototype,"autoRotateDelay",void 0),ay([jm({intrinsics:ly,updateHandler:uy}),F({type:String,attribute:"rotation-per-second"})],r.prototype,"rotationPerSecond",void 0),r})((t=>{var e,n,i;class r extends t{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this[e]=null,this[n]=null,this[i]=t=>{t.element===this&&this[Uu]()}}connectedCallback(){super.connectedCallback(),this[wp].loader.addEventListener("preload",this[Gu])}disconnectedCallback(){super.disconnectedCallback(),this[wp].loader.removeEventListener("preload",this[Gu])}updated(t){super.updated(t),t.has("shadowIntensity")&&(this[gp].setShadowIntensity(.1*this.shadowIntensity),this[fp]()),t.has("shadowSoftness")&&(this[gp].setShadowSoftness(this.shadowSoftness),this[fp]()),t.has("exposure")&&(this[gp].exposure=this.exposure,this[fp]()),(t.has("environmentImage")||t.has("skyboxImage"))&&this[Ip]()&&this[Uu]()}[(e=Fu,n=ku,i=Gu,yp)](){super[yp](),null!=this[Fu]&&this[Nu](this[Fu])}async[Uu](){const{skyboxImage:t,environmentImage:e}=this;null!=this[ku]&&(this[ku](),this[ku]=null);const{textureUtils:n}=this[wp];if(null!=n)try{const{environmentMap:i,skybox:r}=await new Promise((async(i,r)=>{const s=n.generateEnvironmentMapAndSkybox(Xh(t),e,{progressTracker:this[Ep]});this[ku]=()=>r(s),i(await s)})),s=i.texture;this[gp].background=null!=r?r.userData.url===s.userData.url?s:r:null,this[Nu](i.texture),this[gp].dispatchEvent({type:"envmap-update"})}catch(t){if(t instanceof Error)throw this[Nu](null),t}}[Nu](t){this[Fu]=t,this[gp].environment=this[Fu],this.dispatchEvent(new CustomEvent("environment-change")),this[fp]()}}return Pu([F({type:String,attribute:"environment-image"})],r.prototype,"environmentImage",void 0),Pu([F({type:String,attribute:"skybox-image"})],r.prototype,"skyboxImage",void 0),Pu([F({type:Number,attribute:"shadow-intensity"})],r.prototype,"shadowIntensity",void 0),Pu([F({type:Number,attribute:"shadow-softness"})],r.prototype,"shadowSoftness",void 0),Pu([F({type:Number})],r.prototype,"exposure",void 0),r})((t=>{var e,n,i,r,s,a,o,l,c,h,u,d,p,A,m,g,f;class v extends t{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit="0deg 75deg 105%",this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPromptStyle=fg,this.interactionPrompt=mg,this.interactionPolicy=vg,this.orbitSensitivity=1,this.touchAction=yg,this.disableZoom=!1,this.interpolationDecay=50,this.bounds="legacy",this[e]=this.shadowRoot.querySelector(".interaction-prompt"),this[n]=this.shadowRoot.querySelector(".interaction-prompt > .animated-container"),this[i]=1/0,this[r]=0,this[s]=1/0,this[a]=!1,this[o]=!1,this[l]=new sg(this[gp].camera,this[Ap]),this[c]=0,this[h]=new zl,this[u]=!1,this[d]=!1,this[p]=!1,this[A]=()=>{const t=this[Ap];isFinite(this[Wg])||(this[Wg]=performance.now());const e=this[cp];t.getAttribute("aria-label")!==e&&t.setAttribute("aria-label",e),this.interactionPrompt!==gg||this[Hg]||(this[Og]=!0)},this[m]=()=>{this.interactionPrompt===gg&&(this[Og]=!1,this[Rg].classList.remove("visible"),this[zg]=1/0,this[Wg]=1/0)},this[g]=({source:t})=>{this[Pg](),this[fp](),t===ig&&(this[Hg]=!0,this[Qg]()),this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:t}}))},this[f]=t=>{"pointer-change-start"===t.type?this[pp].classList.add("pointer-tumbling"):this[pp].classList.remove("pointer-tumbling")}}getCameraOrbit(){const{theta:t,phi:e,radius:n}=this[jg];return{theta:t,phi:e,radius:n,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return Sp(this[wp].isPresenting?this[wp].arRenderer.target:this[gp].getTarget())}getFieldOfView(){return this[Lg].getFieldOfView()}getMinimumFieldOfView(){return this[Lg].options.minimumFieldOfView}getMaximumFieldOfView(){return this[Lg].options.maximumFieldOfView}jumpCameraToGoal(){this[Yg]=!0,this.requestUpdate(Yg,!1)}resetInteractionPrompt(){this[Vg]=0,this[zg]=1/0,this[Hg]=!1,this[Og]=this.interactionPrompt===mg&&this.cameraControls}connectedCallback(){super.connectedCallback(),this[Lg].addEventListener("change",this[kg]),this[Lg].addEventListener("pointer-change-start",this[Gg]),this[Lg].addEventListener("pointer-change-end",this[Gg])}disconnectedCallback(){super.disconnectedCallback(),this[Lg].removeEventListener("change",this[kg]),this[Lg].removeEventListener("pointer-change-start",this[Gg]),this[Lg].removeEventListener("pointer-change-end",this[Gg])}updated(t){super.updated(t);const e=this[Lg],n=this[Ap];if(t.has("cameraControls")&&(this.cameraControls?(e.enableInteraction(),this.interactionPrompt===mg&&(this[Og]=!0),n.addEventListener("focus",this[Ug]),n.addEventListener("blur",this[Ng])):(n.removeEventListener("focus",this[Ug]),n.removeEventListener("blur",this[Ng]),e.disableInteraction(),this[Qg]())),t.has("disableZoom")&&(e.disableZoom=this.disableZoom),t.has("bounds")&&(this[gp].tightBounds="tight"===this.bounds),(t.has("interactionPrompt")||t.has("cameraControls")||t.has("src"))&&(this.interactionPrompt===mg&&this.cameraControls&&!this[Hg]?this[Og]=!0:this[Qg]()),t.has("interactionPromptStyle")&&this[Rg].classList.toggle("wiggle",this.interactionPromptStyle===fg),t.has("interactionPolicy")){const t=this.interactionPolicy;e.applyOptions({interactionPolicy:t})}if(t.has("touchAction")){const t=this.touchAction;e.applyOptions({touchAction:t})}t.has("orbitSensitivity")&&(e.sensitivity=this.orbitSensitivity),t.has("interpolationDecay")&&(e.setDamperDecayTime(this.interpolationDecay),this[gp].setTargetDamperDecayTime(this.interpolationDecay)),!0===this[Yg]&&Promise.resolve().then((()=>{e.jumpToGoal(),this[gp].jumpToGoal(),this[Yg]=!1}))}async updateFraming(){const t=this[gp],e=t.framedFieldOfView;await this.requestUpdate("cameraTarget"),t.updateFraming("tight"===this.bounds?t.getTarget():void 0),t.frameModel();const n=t.framedFieldOfView,i=this[Lg].getFieldOfView()/e;this[qg]=n*i,this[Xg]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),await this.requestUpdate("cameraOrbit")}[(e=Rg,n=Dg,i=Wg,r=Vg,s=zg,a=Hg,o=Og,l=Lg,c=qg,h=jg,u=Yg,d=Jg,p=Xg,Zg)](t){this[Lg].setFieldOfView(180*t[0]/Math.PI)}[Kg](t){if(this[Xg]){const{theta:e,phi:n}=this.getCameraOrbit();t[0]=e,t[1]=n,this[Xg]=!1}this[Lg].setOrbit(t[0],t[1],t[2])}[tf](t){this[Lg].applyOptions({minimumAzimuthalAngle:t[0],minimumPolarAngle:t[1],minimumRadius:t[2]}),this.jumpCameraToGoal()}[ef](t){this[Lg].applyOptions({maximumAzimuthalAngle:t[0],maximumPolarAngle:t[1],maximumRadius:t[2]}),this[Fg](t[2]),this.jumpCameraToGoal()}[nf](t){this[Lg].applyOptions({minimumFieldOfView:180*t[0]/Math.PI}),this.jumpCameraToGoal()}[rf](t){this[Lg].applyOptions({maximumFieldOfView:180*t[0]/Math.PI}),this.jumpCameraToGoal()}[$g](t){const[e,n,i]=t;this[gp].setTarget(e,n,i),this[wp].arRenderer.updateTarget()}[vp](t,e){if(super[vp](t,e),this[wp].isPresenting||!this[Mp]())return;const n=performance.now();if(this[Og]){const t=this.interactionPrompt===mg?this[hp]:this[Wg];this.loaded&&n>t+this.interactionPromptThreshold&&(this[Ap].setAttribute("aria-label","Use mouse, touch or arrow keys to control the camera!"),this[Og]=!1,this[zg]=n,this[Rg].classList.add("visible"))}if(isFinite(this[zg])&&this.interactionPromptStyle===fg){const t=this[gp],e=(n-this[zg])/5e3%1,i=hg(e),r=ug(e);if(this[Dg].style.opacity=`${r}`,i!==this[Vg]){const e=i*t.width*.05,n=(i-this[Vg])*Math.PI/16;this[Dg].style.transform=`translateX(${e}px)`,this[Lg].adjustOrbit(n,0,0),this[Vg]=i}}this[Lg].update(t,e),this[gp].updateTarget(e)}[Qg](){this[Og]=!1,this[Rg].classList.remove("visible"),this[zg]=1/0}[Fg](t){const{idealCameraDistance:e}=this[gp],n=2*Math.max(e,t);this[Lg].updateNearFar(0,n)}[Pg](){const{theta:t,phi:e}=this[jg],{theta:n,phi:i}=this[Lg].getCameraSpherical(this[jg]),r=this.getRootNode();if(null!=r&&r.activeElement===this){const r=(4+Math.floor((t%Tg+Bg)/Mg))%4,s=(4+Math.floor((n%Tg+Bg)/Mg))%4,a=Math.floor(e/Sg),o=Math.floor(i/Sg);if(s!==r||o!==a){const t=`View from stage ${Ag[o]}${pg[s]}`;this[Ap].setAttribute("aria-label",t)}}}[xp](t){const e=this[Lg],n=this[gp].framedFieldOfView;super[xp](t);const i=this[gp].framedFieldOfView,r=e.getFieldOfView()/n;this[qg]=i*r,e.updateAspect(this[gp].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.jumpCameraToGoal()}[yp](){super[yp]();const{framedFieldOfView:t}=this[gp];this[qg]=t,this[Jg]?this[Xg]=!0:this[Jg]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}}return A=Ug,m=Ng,g=kg,f=Gg,cg([F({type:Boolean,attribute:"camera-controls"})],v.prototype,"cameraControls",void 0),cg([jm({intrinsics:bg,observeEffects:!0,updateHandler:Kg}),F({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],v.prototype,"cameraOrbit",void 0),cg([jm({intrinsics:Cg,observeEffects:!0,updateHandler:$g}),F({type:String,attribute:"camera-target",hasChanged:()=>!0})],v.prototype,"cameraTarget",void 0),cg([jm({intrinsics:xg,observeEffects:!0,updateHandler:Zg}),F({type:String,attribute:"field-of-view",hasChanged:()=>!0})],v.prototype,"fieldOfView",void 0),cg([jm({intrinsics:_g,updateHandler:tf}),F({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],v.prototype,"minCameraOrbit",void 0),cg([jm({intrinsics:Ig,updateHandler:ef}),F({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],v.prototype,"maxCameraOrbit",void 0),cg([jm({intrinsics:wg,updateHandler:nf}),F({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],v.prototype,"minFieldOfView",void 0),cg([jm({intrinsics:Eg,updateHandler:rf}),F({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],v.prototype,"maxFieldOfView",void 0),cg([F({type:Number,attribute:"interaction-prompt-threshold"})],v.prototype,"interactionPromptThreshold",void 0),cg([F({type:String,attribute:"interaction-prompt-style"})],v.prototype,"interactionPromptStyle",void 0),cg([F({type:String,attribute:"interaction-prompt"})],v.prototype,"interactionPrompt",void 0),cg([F({type:String,attribute:"interaction-policy"})],v.prototype,"interactionPolicy",void 0),cg([F({type:Number,attribute:"orbit-sensitivity"})],v.prototype,"orbitSensitivity",void 0),cg([F({type:String,attribute:"touch-action"})],v.prototype,"touchAction",void 0),cg([F({type:Boolean,attribute:"disable-zoom"})],v.prototype,"disableZoom",void 0),cg([F({type:Number,attribute:"interpolation-decay"})],v.prototype,"interpolationDecay",void 0),cg([F({type:String,attribute:"bounds"})],v.prototype,"bounds",void 0),v})((t=>{var e,n,i,r,s,a,o,l,c,h;class u extends t{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer",this.iosSrc=null,this.xrEnvironment=!1,this[e]=!1,this[n]=this.shadowRoot.querySelector(".ar-button"),this[i]=document.createElement("a"),this[r]=new Set,this[s]=YA,this[a]=!1,this[o]=t=>{t.preventDefault(),this.activateAR()},this[l]=({status:t})=>{t!==ju&&this[wp].arRenderer.presentedScene!==this[gp]||(this.setAttribute("ar-status",t),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:t}})),t===ju?this.removeAttribute("ar-tracking"):t===Yu&&this.setAttribute("ar-tracking",Ku))},this[c]=({status:t})=>{this.setAttribute("ar-tracking",t),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:t}}))},this[h]=t=>{"_apple_ar_quicklook_button_tapped"==t.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[tm]!==YA}connectedCallback(){super.connectedCallback(),this[wp].arRenderer.addEventListener("status",this[sm]),this.setAttribute("ar-status",ju),this[wp].arRenderer.addEventListener("tracking",this[am]),this[nm].addEventListener("message",this[om])}disconnectedCallback(){super.disconnectedCallback(),this[wp].arRenderer.removeEventListener("status",this[sm]),this[wp].arRenderer.removeEventListener("tracking",this[am]),this[nm].removeEventListener("message",this[om])}async update(t){super.update(t),t.has("arScale")&&(this[gp].canScale="fixed"!==this.arScale),t.has("arPlacement")&&(this[gp].setShadowIntensity(this[gp].shadowIntensity),this[fp]()),(t.has("ar")||t.has("arModes")||t.has("iosSrc"))&&(t.has("arModes")&&(this[em]=zA(this.arModes)),this[lm]())}async activateAR(){switch(this[tm]){case WA:this[ZA]();break;case jA:await this[XA]();break;case qA:this[KA]();break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(e=$A,n=JA,i=nm,r=em,s=tm,a=im,o=rm,l=sm,c=am,h=om,lm)](){if(this[tm]=YA,this.ar){if(null!=this.src)for(const t of this[em]){if("webxr"===t&&q&&!OA&&await this[wp].arRenderer.supportsPresentation()){this[tm]=jA;break}if("scene-viewer"===t&&Z&&!HA){this[tm]=qA;break}if("quick-look"===t&&J){this[tm]=WA;break}}!this.canActivateAR&&null!=this.iosSrc&&J&&(this[tm]=WA)}if(this.canActivateAR)this[JA].classList.add("enabled"),this[JA].addEventListener("click",this[rm]);else if(this[JA].classList.contains("enabled")){this[JA].removeEventListener("click",this[rm]),this[JA].classList.remove("enabled");const t=Xu;this.setAttribute("ar-status",t),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:t}}))}}async[XA](){console.log("Attempting to present in AR with WebXR..."),await this[cm]();try{this[JA].removeEventListener("click",this[rm]);const{arRenderer:t}=this[wp];t.placeOnWall="wall"===this.arPlacement,await t.present(this[gp],this.xrEnvironment)}catch(t){console.warn("Error while trying to present in AR with WebXR"),console.error(t),await this[wp].arRenderer.stopPresenting(),OA=!0,console.warn("Falling back to next ar-mode"),await this[lm](),this.activateAR()}finally{this[lm]()}}async[cm](){this.loaded||(this[im]=!0,this[up](),await((t,e,n=null)=>new Promise((i=>{t.addEventListener(e,(function r(s){n&&!n(s)||(i(s),t.removeEventListener(e,r))}))})))
/* @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.
 */(this,"load"),this[im]=!1)}[Ip](){return super[Ip]()||this[im]}[KA](){const t=self.location.toString(),e=new URL(t),n=new URL(this.src,t),i=new URLSearchParams(n.search);if(e.hash="#model-viewer-no-ar-fallback",i.set("mode","ar_preferred"),i.has("disable_occlusion")||i.set("disable_occlusion","true"),"fixed"===this.arScale&&i.set("resizable","false"),"wall"===this.arPlacement&&i.set("enable_vertical_placement","true"),i.has("sound")){const e=new URL(i.get("sound"),t);i.set("sound",e.toString())}if(i.has("link")){const e=new URL(i.get("link"),t);i.set("link",e.toString())}const r=`intent://arvr.google.com/scene-viewer/1.0?${i.toString()+"&file="+encodeURIComponent(n.toString())}#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e.toString())};end;`;self.addEventListener("hashchange",(()=>{"#model-viewer-no-ar-fallback"===self.location.hash&&(HA=!0,self.history.back(),console.warn("Error while trying to present in AR with Scene Viewer"),console.warn("Falling back to next ar-mode"),this[lm]())}),{once:!0}),this[nm].setAttribute("href",r),console.log("Attempting to present in AR with Scene Viewer..."),this[nm].click()}async[ZA](){const t=!this.iosSrc;this[JA].classList.remove("enabled");const e=t?await this.prepareUSDZ():this.iosSrc,n=new URL(e,self.location.toString());"fixed"===this.arScale&&(n.hash&&(n.hash+="&"),n.hash+="allowsContentScaling=0");const i=this[nm];i.setAttribute("rel","ar");const r=document.createElement("img");i.appendChild(r),i.setAttribute("href",n.toString()),t&&i.setAttribute("download","model.usdz"),console.log("Attempting to present in AR with Quick Look..."),i.click(),i.removeChild(r),t&&URL.revokeObjectURL(e),this[JA].classList.add("enabled")}async prepareUSDZ(){const t=this[Ep].beginActivity();await this[cm]();const e=this[gp],n=e.shadow;let i=!1;null!=n&&(i=n.visible,n.visible=!1),t(.2);const r=new RA,s=await r.parse(e.modelContainer),a=new Blob([s],{type:"model/vnd.usdz+zip"}),o=URL.createObjectURL(a);return t(1),null!=n&&(n.visible=i),o}}return GA([F({type:Boolean,attribute:"ar"})],u.prototype,"ar",void 0),GA([F({type:String,attribute:"ar-scale"})],u.prototype,"arScale",void 0),GA([F({type:String,attribute:"ar-placement"})],u.prototype,"arPlacement",void 0),GA([F({type:String,attribute:"ar-modes"})],u.prototype,"arModes",void 0),GA([F({type:String,attribute:"ios-src"})],u.prototype,"iosSrc",void 0),GA([F({type:Boolean,attribute:"xr-environment"})],u.prototype,"xrEnvironment",void 0),u})((t=>{var e,n,i,r,s,a,o,l,c,h,u,d,p;class A extends t{constructor(...t){super(...t),this.poster=null,this.reveal=hf,this.loading=df,this[e]=!1,this[n]=!1,this[i]=0,this[r]=null,this[s]=this.shadowRoot.querySelector(".slot.poster"),this[a]=this.shadowRoot.querySelector("#default-poster"),this[o]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .mask"),this[c]=this[yf].getAttribute("aria-label"),this[h]=((t,e)=>{let n=null;const i=(...i)=>{null==n&&(t(...i),n=self.setTimeout((()=>n=null),e))};return i.flush=()=>{null!=n&&(self.clearTimeout(n),n=null)},i})((t=>{const e=this[gf].parentNode;requestAnimationFrame((()=>{this[ff].style.opacity=""+.2*(1-t),this[gf].style.transform=`scaleX(${t})`,0===t&&(e.removeChild(this[gf]),e.appendChild(this[gf])),1===t?this[gf].classList.add("hide"):this[gf].classList.remove("hide")}))}),100),this[u]=()=>{this.reveal!==uf&&this.dismissPoster()},this[d]=t=>{if(this.reveal!==uf)switch(t.keyCode){case 32:case 13:this.dismissPoster()}},this[p]=t=>{const e=t.detail.totalProgress;this[_f]=Math.max(e,this[_f]),1===e&&(this[bf].flush(),!this[Cp]()||null==this[xf]&&this.reveal!==hf||this[wf]()),this[bf](e),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:e}}))};const A=self.ModelViewerElement||{},m=A.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.3.6/";Hh.setDRACODecoderLocation(m);const g=A.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";Hh.setKTX2TranscoderLocation(g)}static set dracoDecoderLocation(t){Hh.setDRACODecoderLocation(t)}static get dracoDecoderLocation(){return Hh.getDRACODecoderLocation()}static set ktx2TranscoderLocation(t){Hh.setKTX2TranscoderLocation(t)}static get ktx2TranscoderLocation(){return Hh.getKTX2TranscoderLocation()}static mapURLs(t){Dd.singleton.loader[kh].manager.setURLModifier(t)}dismissPoster(){this[Cp]()?this[wf]():(this[xf]=Af,this[up]())}showPoster(){const t=this[vf],e=this[yf];e.removeAttribute("tabindex"),e.removeAttribute("aria-hidden"),t.classList.add("show");const n=this.modelIsVisible;this[Ef]=!1,this[lp](n),this[If]=!1}getDimensions(){return Sp(this[gp].size)}connectedCallback(){super.connectedCallback(),this[vf].addEventListener("click",this[Mf]),this[vf].addEventListener("keydown",this[Sf]),this[Ep].addEventListener("progress",this[Bf]),mf.registerInstance(this)}disconnectedCallback(){super.disconnectedCallback(),this[vf].removeEventListener("click",this[Mf]),this[vf].removeEventListener("keydown",this[Sf]),this[Ep].removeEventListener("progress",this[Bf]),mf.unregisterInstance(this)}async updated(t){super.updated(t),t.has("poster")&&null!=this.poster&&(this[yf].style.backgroundImage=`url(${this.poster})`),t.has("alt")&&this[yf].setAttribute("aria-label",`${this[cp]}. ${this[Cf]}`),(t.has("reveal")||t.has("loading"))&&this[up]()}[(e=Ef,n=If,i=_f,r=xf,s=vf,a=yf,o=gf,l=ff,c=Cf,h=bf,u=Mf,d=Sf,p=Bf,Ip)](){return!!this.src&&(null!=this[xf]||this.loading===pf||this.reveal===hf&&this[op])}[Cp](){const{src:t}=this;return!!t&&super[Cp]()&&1===this[_f]}[wf](){this[xf]=null;const t=this[vf],e=this[yf];if(t.classList.contains("show")){t.classList.remove("show");const n=this.modelIsVisible;this[Ef]=!0,this[lp](n),t.addEventListener("transitionend",(()=>{requestAnimationFrame((()=>{this[If]=!0;const t=this.getRootNode();t&&t.activeElement===this&&this[Ap].focus(),e.setAttribute("aria-hidden","true"),e.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}))}),{once:!0})}}[_p](){return super[_p]()&&this[Ef]}[Mp](){return super[Mp]()&&this[If]}async[up](){this[_f]=0,null!=this[gp].currentGLTF&&null!=this.src&&this[Ip]()||this.showPoster(),await super[up]()}}return cf([F({type:String})],A.prototype,"poster",void 0),cf([F({type:String})],A.prototype,"reveal",void 0),cf([F({type:String})],A.prototype,"loading",void 0),A})((t=>{var e;class n extends t{constructor(){super(...arguments),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[e]=!0}get availableAnimations(){return this.loaded?this[gp].animationNames:[]}get duration(){return this[gp].duration}get paused(){return this[Rp]}get currentTime(){return this[gp].animationTime}set currentTime(t){this[gp].animationTime=t,this[wp].threeRenderer.shadowMap.needsUpdate=!0,this[fp]()}pause(){this[Rp]||(this[Rp]=!0,this[wp].threeRenderer.shadowMap.autoUpdate=!1,this.dispatchEvent(new CustomEvent("pause")))}play(){this[Rp]&&this.availableAnimations.length>0&&(this[Rp]=!1,this[wp].threeRenderer.shadowMap.autoUpdate=!0,this[gp].hasActiveAnimation||this[Lp](),this.dispatchEvent(new CustomEvent("play")))}[(e=Rp,yp)](){super[yp](),this[Rp]=!0,this.autoplay&&(this[Lp](),this.play())}[vp](t,e){super[vp](t,e),this[Rp]||!this[Mp]()&&!this[wp].isPresenting||(this[gp].updateAnimation(e/1e3),this[fp]())}updated(t){super.updated(t),t.has("autoplay")&&this.autoplay&&this.play(),t.has("animationName")&&this[Lp]()}async[up](){return this[gp].stopAnimation(),super[up]()}[Lp](){this[gp].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3),this[Rp]&&(this[gp].updateAnimation(0),this[fp]())}}return Tp([F({type:Boolean})],n.prototype,"autoplay",void 0),Tp([F({type:String,attribute:"animation-name"})],n.prototype,"animationName",void 0),Tp([F({type:Number,attribute:"animation-crossfade-duration"})],n.prototype,"animationCrossfadeDuration",void 0),n})((t=>{var e;const n=Symbol("endPolyfillCoordination");return e=n,class extends t{constructor(){super(...arguments),this[e]=null}connectedCallback(){super.connectedCallback&&super.connectedCallback(),null==this[n]&&(this[n]=(t=>{if(null==t.shadowRoot||t.hasAttribute("data-js-focus-visible"))return()=>{};if(!self.applyFocusVisiblePolyfill){const e=()=>{self.applyFocusVisiblePolyfill(t.shadowRoot)};return self.addEventListener("focus-visible-polyfill-ready",e,{once:!0}),()=>{self.removeEventListener("focus-visible-polyfill-ready",e)}}return self.applyFocusVisiblePolyfill(t.shadowRoot),()=>{}})(this))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),null!=this[n]&&(this[n](),this[n]=null)}}})(Bp)))))))));customElements.define("model-viewer",py);export{py as ModelViewerElement};
//# sourceMappingURL=model-viewer.min.js.map
trinhanhngoc commented 1 year ago

Hi @jcfernandez-890825 . I'm pretty sure this is an issue in PyCharm itself. If the error continues to occur, you can try Invalidate caches.