shop-components 0.0.25 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/Color-RQJUDNI5-leAiB7jg.js +1 -0
- package/dist/assets/Configure-OUhXg2g0.js +173 -0
- package/dist/assets/DRACOLoader-FOpiHRUS.js +2 -0
- package/dist/assets/DocsRenderer-K4EAMTCU-wTc0yUaa.js +7 -0
- package/dist/assets/Header-Yyx952jD.css +1 -0
- package/dist/assets/Header.stories-8tnkOwSt.js +31 -0
- package/dist/assets/Page-fZ7a-HXz.css +1 -0
- package/dist/assets/Page.stories-53Crpe03.js +61 -0
- package/dist/assets/RGBELoader-re-MEsjP.js +5 -0
- package/dist/assets/SFL-CDD14-9UY62fbR.glb +0 -0
- package/dist/assets/WithTooltip-Y7J54OF7-e8Yh5ASp.js +1 -0
- package/dist/assets/_commonjsHelpers-4gQjN7DL.js +1 -0
- package/dist/assets/accessibility-Fv4dmnDm.png +0 -0
- package/dist/assets/addon-library-VlAgJsjc.png +0 -0
- package/dist/assets/bg-circle-d8WfpvaX.png +0 -0
- package/dist/assets/context-tKiKnkuP.png +0 -0
- package/dist/assets/docs-Pvr7BWzI.png +0 -0
- package/dist/assets/entry-preview-TptA_luc.js +8 -0
- package/dist/assets/entry-preview-docs-AhrJ3R4Z.js +2 -0
- package/dist/assets/figma-plugin-h9oRC4jr.png +0 -0
- package/dist/assets/formatter-B5HCVTEV-DKi3GmSv.js +58 -0
- package/dist/assets/generateMeshBVH.worker-NFSCTTDt.js +5 -0
- package/dist/assets/iframe-tlQuLR4E.js +7 -0
- package/dist/assets/img-radar-kufDNNXQ.png +0 -0
- package/dist/assets/img-radar2-1cPZO_cj.png +0 -0
- package/dist/assets/index-CXFn8OGe.js +513 -0
- package/dist/assets/index-C_uo8BdM.js +1 -0
- package/dist/assets/index-PPLHz8o0.js +6 -0
- package/dist/assets/index-jFdhmKfM.js +3 -0
- package/dist/assets/index-jtEywAqJ.js +1 -0
- package/dist/assets/index-ogXoivrg.js +1 -0
- package/dist/assets/index.stories-TVZrSYZv.js +20 -0
- package/dist/assets/index.stories-Uq0Yg-kp.js +896 -0
- package/dist/assets/index.stories-VJP6Jo4U.js +22 -0
- package/dist/assets/index.stories-VoNcNCFd.js +27 -0
- package/dist/assets/index.stories-YIFSciWI.js +1174 -0
- package/dist/assets/index.stories-iMKoZNyH.js +46 -0
- package/dist/assets/lightroom_14b-MJkJLVlP.hdr +0 -0
- package/dist/assets/lightroom_14b_512-e_XJNpR6.js +3981 -0
- package/dist/assets/lightroom_14b_512-nMVn659Q.hdr +0 -0
- package/dist/assets/lit-element-P_wTzRvl.js +19 -0
- package/dist/assets/parallelMeshBVH.worker-TP6qJGKX.js +5 -0
- package/dist/assets/preview-1q4RDNOi.js +1 -0
- package/dist/assets/preview-6iG64ELu.js +20 -0
- package/dist/assets/preview-7nNmfNVr.js +7 -0
- package/dist/assets/preview-9bpQVOkQ.js +1 -0
- package/dist/assets/preview-FnnPJHgu.js +1 -0
- package/dist/assets/preview-VI2eoWmp.js +1 -0
- package/dist/assets/preview-bEa2SesL.js +7 -0
- package/dist/assets/preview-u8M_OEO2.js +396 -0
- package/dist/assets/preview-zZA4w0lH.js +1 -0
- package/dist/assets/property-EQZXZ3dt.js +5 -0
- package/dist/assets/query-7eORIRsG.js +13 -0
- package/dist/assets/roller-8Vy8W3X_.glb +0 -0
- package/dist/assets/roller-hopper-Heae_wy5.glb +0 -0
- package/dist/assets/share-xgPlHEHy.png +0 -0
- package/dist/assets/styling-ZOs40c1G.png +0 -0
- package/dist/assets/syntaxhighlighter-JOJW2KGS-uBo08tOF.js +1 -0
- package/dist/assets/testing-HG80fZfa.png +0 -0
- package/dist/assets/theming--liSzaFj.png +0 -0
- package/dist/assets/three.module-9MfFqitO.js +3825 -0
- package/dist/assets/tiny-invariant-VyoA2Os1.js +1 -0
- package/dist/assets/worker-h5IcTUxB.js +1 -0
- package/dist/device-viewer/amr.d.ts +75 -0
- package/dist/device-viewer/assembly.d.ts +11 -0
- package/dist/device-viewer/dimension/index.d.ts +31 -0
- package/dist/device-viewer/dimension/line3.d.ts +21 -0
- package/dist/device-viewer/dimension/size-box.d.ts +39 -0
- package/dist/device-viewer/group-roller.d.ts +20 -0
- package/dist/device-viewer/index.d.ts +12 -0
- package/dist/device-viewer/mechanism/mechanism.d.ts +29 -0
- package/dist/device-viewer/outerline.d.ts +16 -0
- package/dist/device-viewer/roller.d.ts +31 -0
- package/dist/device-viewer/row.d.ts +18 -0
- package/dist/device-viewer/scene.d.ts +14 -28
- package/dist/device-viewer/slot.d.ts +10 -2
- package/dist/device-viewer/text2.d.ts +4 -0
- package/dist/device-viewer/text3.d.ts +4 -0
- package/dist/device-viewer/utils/index.d.ts +26 -1
- package/dist/favicon.svg +7 -0
- package/dist/iframe.html +495 -0
- package/dist/index.html +155 -0
- package/dist/index.json +1 -0
- package/dist/package.json +60 -0
- package/dist/project.json +1 -0
- package/dist/sb-addons/essentials-actions-3/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-actions-3/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-backgrounds-4/manager-bundle.js +12 -0
- package/dist/sb-addons/essentials-backgrounds-4/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-controls-2/manager-bundle.js +60 -0
- package/dist/sb-addons/essentials-controls-2/manager-bundle.js.LEGAL.txt +18 -0
- package/dist/sb-addons/essentials-measure-7/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-measure-7/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-outline-8/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-outline-8/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-toolbars-6/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-toolbars-6/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-viewport-5/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-viewport-5/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/links-1/manager-bundle.js +3 -0
- package/dist/sb-addons/links-1/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +3 -0
- package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-common-assets/fonts.css +31 -0
- package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/sb-manager/WithTooltip-Y7J54OF7-3AIPQNGM.js +1 -0
- package/dist/sb-manager/chunk-I53COLQ6.js +183 -0
- package/dist/sb-manager/chunk-L35575BZ.js +234 -0
- package/dist/sb-manager/chunk-TZAR34JC.js +6 -0
- package/dist/sb-manager/chunk-UOBNU442.js +347 -0
- package/dist/sb-manager/chunk-VMGB76WP.js +9 -0
- package/dist/sb-manager/chunk-XP3HGWTR.js +1 -0
- package/dist/sb-manager/formatter-B5HCVTEV-7DCBOGO6.js +58 -0
- package/dist/sb-manager/globals-module-info.js +1 -0
- package/dist/sb-manager/globals-runtime.js +1 -0
- package/dist/sb-manager/globals.js +1 -0
- package/dist/sb-manager/index.js +1 -0
- package/dist/sb-manager/runtime.js +1 -0
- package/dist/sb-manager/syntaxhighlighter-JOJW2KGS-7BF26SBB.js +1 -0
- package/dist/sb-preview/globals.js +1 -0
- package/dist/sb-preview/runtime.js +128 -0
- package/dist/stories/cropper/index.d.ts +18 -0
- package/dist/stories/cropper/index.js +118 -0
- package/dist/stories/cropper/index.js.map +1 -0
- package/dist/stories/cropper/index.stories.d.ts +11 -0
- package/dist/stories/cropper/index.stories.js +14 -0
- package/dist/stories/cropper/index.stories.js.map +1 -0
- package/dist/stories/device-viewer/amr.d.ts +75 -0
- package/dist/stories/device-viewer/amr.js +554 -0
- package/dist/stories/device-viewer/amr.js.map +1 -0
- package/dist/stories/device-viewer/assembly.d.ts +11 -0
- package/dist/stories/device-viewer/assembly.js +47 -0
- package/dist/stories/device-viewer/assembly.js.map +1 -0
- package/dist/stories/device-viewer/asserts/fonts/type.json +1281 -0
- package/dist/stories/device-viewer/dimension/index.d.ts +31 -0
- package/dist/stories/device-viewer/dimension/index.js +131 -0
- package/dist/stories/device-viewer/dimension/index.js.map +1 -0
- package/dist/stories/device-viewer/dimension/line3.d.ts +21 -0
- package/dist/stories/device-viewer/dimension/line3.js +98 -0
- package/dist/stories/device-viewer/dimension/line3.js.map +1 -0
- package/dist/stories/device-viewer/dimension/size-box.d.ts +39 -0
- package/dist/stories/device-viewer/dimension/size-box.js +176 -0
- package/dist/stories/device-viewer/dimension/size-box.js.map +1 -0
- package/dist/stories/device-viewer/group-roller.d.ts +20 -0
- package/dist/stories/device-viewer/group-roller.js +65 -0
- package/dist/stories/device-viewer/group-roller.js.map +1 -0
- package/dist/stories/device-viewer/index.d.ts +47 -0
- package/dist/stories/device-viewer/index.js +530 -0
- package/dist/stories/device-viewer/index.js.map +1 -0
- package/dist/stories/device-viewer/index.stories.d.ts +27 -0
- package/dist/stories/device-viewer/index.stories.js +37 -0
- package/dist/stories/device-viewer/index.stories.js.map +1 -0
- package/dist/stories/device-viewer/lines.d.ts +36 -0
- package/dist/stories/device-viewer/lines.js +171 -0
- package/dist/stories/device-viewer/lines.js.map +1 -0
- package/dist/stories/device-viewer/main.d.ts +1 -0
- package/dist/stories/device-viewer/main.js +2 -0
- package/dist/stories/device-viewer/main.js.map +1 -0
- package/dist/stories/device-viewer/mechanism/mechanism.d.ts +29 -0
- package/dist/stories/device-viewer/mechanism/mechanism.js +164 -0
- package/dist/stories/device-viewer/mechanism/mechanism.js.map +1 -0
- package/dist/stories/device-viewer/outerline.d.ts +16 -0
- package/dist/stories/device-viewer/outerline.js +63 -0
- package/dist/stories/device-viewer/outerline.js.map +1 -0
- package/dist/stories/device-viewer/roller.d.ts +31 -0
- package/dist/stories/device-viewer/roller.js +121 -0
- package/dist/stories/device-viewer/roller.js.map +1 -0
- package/dist/stories/device-viewer/row.d.ts +18 -0
- package/dist/stories/device-viewer/row.js +58 -0
- package/dist/stories/device-viewer/row.js.map +1 -0
- package/dist/stories/device-viewer/scene.d.ts +101 -0
- package/dist/stories/device-viewer/scene.js +535 -0
- package/dist/stories/device-viewer/scene.js.map +1 -0
- package/dist/stories/device-viewer/slot/slot-item.d.ts +20 -0
- package/dist/stories/device-viewer/slot/slot-item.js +82 -0
- package/dist/stories/device-viewer/slot/slot-item.js.map +1 -0
- package/dist/stories/device-viewer/slot.d.ts +71 -0
- package/dist/stories/device-viewer/slot.js +272 -0
- package/dist/stories/device-viewer/slot.js.map +1 -0
- package/dist/stories/device-viewer/sound.d.ts +5 -0
- package/dist/stories/device-viewer/sound.js +13 -0
- package/dist/stories/device-viewer/sound.js.map +1 -0
- package/dist/stories/device-viewer/text2.d.ts +4 -0
- package/dist/stories/device-viewer/text2.js +12 -0
- package/dist/stories/device-viewer/text2.js.map +1 -0
- package/dist/stories/device-viewer/text3.d.ts +4 -0
- package/dist/stories/device-viewer/text3.js +14 -0
- package/dist/stories/device-viewer/text3.js.map +1 -0
- package/dist/stories/device-viewer/utils/index.d.ts +36 -0
- package/dist/stories/device-viewer/utils/index.js +166 -0
- package/dist/stories/device-viewer/utils/index.js.map +1 -0
- package/dist/stories/device-viewer/worker/generate-mesh-bvh-worker.d.ts +8 -0
- package/dist/stories/device-viewer/worker/generate-mesh-bvh-worker.js +88 -0
- package/dist/stories/device-viewer/worker/generate-mesh-bvh-worker.js.map +1 -0
- package/dist/stories/device-viewer/worker/generateAsync.worker.d.ts +1 -0
- package/dist/stories/device-viewer/worker/generateAsync.worker.js +57 -0
- package/dist/stories/device-viewer/worker/generateAsync.worker.js.map +1 -0
- package/dist/stories/device-viewer/worker/path-tracing-scene-worker.d.ts +16 -0
- package/dist/stories/device-viewer/worker/path-tracing-scene-worker.js +29 -0
- package/dist/stories/device-viewer/worker/path-tracing-scene-worker.js.map +1 -0
- package/dist/stories/main/index.d.ts +1 -0
- package/dist/stories/main/index.js +2 -0
- package/dist/stories/main/index.js.map +1 -0
- package/dist/stories/main.d.ts +4 -0
- package/dist/stories/main.js +5 -0
- package/dist/stories/main.js.map +1 -0
- package/dist/stories/plugin.d.ts +5 -0
- package/dist/stories/plugin.js +6 -0
- package/dist/stories/plugin.js.map +1 -0
- package/dist/stories/plugins/change-slot/index.d.ts +0 -0
- package/dist/stories/plugins/change-slot/index.js +2 -0
- package/dist/stories/plugins/change-slot/index.js.map +1 -0
- package/dist/stories/sglb/index.d.ts +27 -0
- package/dist/stories/sglb/index.js +151 -0
- package/dist/stories/sglb/index.js.map +1 -0
- package/dist/stories/smap-viewer/index.d.ts +14 -0
- package/dist/stories/smap-viewer/index.js +59 -0
- package/dist/stories/smap-viewer/index.js.map +1 -0
- package/dist/stories/smap-viewer/index.stories.d.ts +22 -0
- package/dist/stories/smap-viewer/index.stories.js +27 -0
- package/dist/stories/smap-viewer/index.stories.js.map +1 -0
- package/dist/stories/step-viewer/index.d.ts +17 -0
- package/dist/stories/step-viewer/index.js +109 -0
- package/dist/stories/step-viewer/index.js.map +1 -0
- package/dist/stories/step-viewer/index.stories.d.ts +20 -0
- package/dist/stories/step-viewer/index.stories.js +24 -0
- package/dist/stories/step-viewer/index.stories.js.map +1 -0
- package/dist/stories/test/index.d.ts +25 -0
- package/dist/stories/test/index.js +99 -0
- package/dist/stories/test/index.js.map +1 -0
- package/dist/stories/test/index.stories.d.ts +14 -0
- package/dist/stories/test/index.stories.js +16 -0
- package/dist/stories/test/index.stories.js.map +1 -0
- package/dist/stories/test/scene.d.ts +20 -0
- package/dist/stories/test/scene.js +86 -0
- package/dist/stories/test/scene.js.map +1 -0
- package/dist/stories/utils/index.d.ts +4 -0
- package/dist/stories/utils/index.js +28 -0
- package/dist/stories/utils/index.js.map +1 -0
- package/dist/test/index.d.ts +25 -0
- package/dist/test/index.stories.d.ts +14 -0
- package/dist/test/scene.d.ts +20 -0
- package/package.json +9 -6
- package/dist/shop-components.mjs +0 -55938
- package/dist/shop-components.umd.js +0 -9232
|
@@ -0,0 +1,896 @@
|
|
|
1
|
+
import{i as cs,s as us,x as st,b as bn,r as Sn}from"./lit-element-P_wTzRvl.js";import{a as Ar,t as fs,e as Ne}from"./query-7eORIRsG.js";import{n as le}from"./property-EQZXZ3dt.js";import{P as lt,F as cn,r as Ue,E as Li,M as _r,O as xr,W as yr,H as wr}from"./lightroom_14b_512-e_XJNpR6.js";import{C as G,k as N,v as Ce,w as vr,u as ot,x as Tr,N as Qs,H as Fe,U as un,y as Le,i as V,V as S,z as Er,I as br,J as Ws,K as Sr,O as Mr,T as Ir,X as Cr,A as Pi,Y as Br,Z as Rr,_ as Lr,$ as ye,Q as hs,M as fe,m as Q,a0 as Pr,a1 as js,a2 as Di,c as Dr,a3 as Et,d as Ni,L as _e,a4 as Nr,a5 as Or,a6 as Fr,a7 as ke,S as ee,a8 as de,a9 as kr,aa as Ur,ab as Oi,ac as zr,e as K,ad as Hr,b as Ct,ae as fn,af as ns,ag as Vr,ah as ys,q as hn,t as ds,ai as Bt,B as ps,aj as Gr,ak as dn,r as Fi,al as Qr,am as Wr,G as he,P as pn,l as Rt,an as jr,ao as Kr,ap as Yr,aq as Xr,ar as gn,as as ki,at as Ui,au as zi,av as Hi,aw as Vi,ax as Gi,ay as Qi,az as Ks,aA as qr,aB as Mn,aC as In,aD as Cn,aE as Bn,n as Wi,aF as Zr,aG as ji,aH as Jr,f as is,W as Ki,aI as $r,aJ as eo,aK as ws,aL as to,aM as so,aN as no,aO as Rn,g as io,aP as ro,aQ as gs,aR as z,aS as nt,aT as oo,aU as ao,R as lo,s as Ln,h as co,E as uo}from"./three.module-9MfFqitO.js";import{R as fo}from"./RGBELoader-re-MEsjP.js";import{D as ho,T as mn,e as bt}from"./DRACOLoader-FOpiHRUS.js";import{g as po,c as ht}from"./_commonjsHelpers-4gQjN7DL.js";/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/let go;function mo(u){return(e,t)=>Ar(e,t,{get(){return(this.renderRoot??go??(go=document.createDocumentFragment())).querySelectorAll(u)}})}class Ao extends lt{constructor(e,t,n=null,s=null,o=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=s,this.clearAlpha=o,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new G}render(e,t,n){const s=e.autoClear;e.autoClear=!1;let o,r;this.overrideMaterial!==null&&(r=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor)),this.clearAlpha!==null&&(o=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(o),this.overrideMaterial!==null&&(this.scene.overrideMaterial=r),e.autoClear=s}}const Yi={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
|
|
6
|
+
|
|
7
|
+
varying vec2 vUv;
|
|
8
|
+
|
|
9
|
+
void main() {
|
|
10
|
+
|
|
11
|
+
vUv = uv;
|
|
12
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
13
|
+
|
|
14
|
+
}`,fragmentShader:`
|
|
15
|
+
|
|
16
|
+
uniform float opacity;
|
|
17
|
+
|
|
18
|
+
uniform sampler2D tDiffuse;
|
|
19
|
+
|
|
20
|
+
varying vec2 vUv;
|
|
21
|
+
|
|
22
|
+
void main() {
|
|
23
|
+
|
|
24
|
+
vec4 texel = texture2D( tDiffuse, vUv );
|
|
25
|
+
gl_FragColor = opacity * texel;
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
}`};class me extends lt{constructor(e,t,n,s){super(),this.renderScene=t,this.renderCamera=n,this.selectedObjects=s!==void 0?s:[],this.visibleEdgeColor=new G(1,1,1),this.hiddenEdgeColor=new G(.1,.04,.02),this.edgeGlow=0,this.usePatternTexture=!1,this.edgeThickness=1,this.edgeStrength=3,this.downSampleRatio=2,this.pulsePeriod=0,this._visibilityCache=new Map,this.resolution=e!==void 0?new N(e.x,e.y):new N(256,256);const o=Math.round(this.resolution.x/this.downSampleRatio),r=Math.round(this.resolution.y/this.downSampleRatio);this.renderTargetMaskBuffer=new Ce(this.resolution.x,this.resolution.y),this.renderTargetMaskBuffer.texture.name="OutlinePass.mask",this.renderTargetMaskBuffer.texture.generateMipmaps=!1,this.depthMaterial=new vr,this.depthMaterial.side=ot,this.depthMaterial.depthPacking=Tr,this.depthMaterial.blending=Qs,this.prepareMaskMaterial=this.getPrepareMaskMaterial(),this.prepareMaskMaterial.side=ot,this.prepareMaskMaterial.fragmentShader=d(this.prepareMaskMaterial.fragmentShader,this.renderCamera),this.renderTargetDepthBuffer=new Ce(this.resolution.x,this.resolution.y,{type:Fe}),this.renderTargetDepthBuffer.texture.name="OutlinePass.depth",this.renderTargetDepthBuffer.texture.generateMipmaps=!1,this.renderTargetMaskDownSampleBuffer=new Ce(o,r,{type:Fe}),this.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,this.renderTargetBlurBuffer1=new Ce(o,r,{type:Fe}),this.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",this.renderTargetBlurBuffer1.texture.generateMipmaps=!1,this.renderTargetBlurBuffer2=new Ce(Math.round(o/2),Math.round(r/2),{type:Fe}),this.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",this.renderTargetBlurBuffer2.texture.generateMipmaps=!1,this.edgeDetectionMaterial=this.getEdgeDetectionMaterial(),this.renderTargetEdgeBuffer1=new Ce(o,r,{type:Fe}),this.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",this.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,this.renderTargetEdgeBuffer2=new Ce(Math.round(o/2),Math.round(r/2),{type:Fe}),this.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",this.renderTargetEdgeBuffer2.texture.generateMipmaps=!1;const l=4,c=4;this.separableBlurMaterial1=this.getSeperableBlurMaterial(l),this.separableBlurMaterial1.uniforms.texSize.value.set(o,r),this.separableBlurMaterial1.uniforms.kernelRadius.value=1,this.separableBlurMaterial2=this.getSeperableBlurMaterial(c),this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(o/2),Math.round(r/2)),this.separableBlurMaterial2.uniforms.kernelRadius.value=c,this.overlayMaterial=this.getOverlayMaterial();const h=Yi;this.copyUniforms=un.clone(h.uniforms),this.materialCopy=new Le({uniforms:this.copyUniforms,vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,blending:Qs,depthTest:!1,depthWrite:!1}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new G,this.oldClearAlpha=1,this.fsQuad=new cn(null),this.tempPulseColor1=new G,this.tempPulseColor2=new G,this.textureMatrix=new V;function d(i,a){const f=a.isPerspectiveCamera?"perspective":"orthographic";return i.replace(/DEPTH_TO_VIEW_Z/g,f+"DepthToViewZ")}}dispose(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose(),this.depthMaterial.dispose(),this.prepareMaskMaterial.dispose(),this.edgeDetectionMaterial.dispose(),this.separableBlurMaterial1.dispose(),this.separableBlurMaterial2.dispose(),this.overlayMaterial.dispose(),this.materialCopy.dispose(),this.fsQuad.dispose()}setSize(e,t){this.renderTargetMaskBuffer.setSize(e,t),this.renderTargetDepthBuffer.setSize(e,t);let n=Math.round(e/this.downSampleRatio),s=Math.round(t/this.downSampleRatio);this.renderTargetMaskDownSampleBuffer.setSize(n,s),this.renderTargetBlurBuffer1.setSize(n,s),this.renderTargetEdgeBuffer1.setSize(n,s),this.separableBlurMaterial1.uniforms.texSize.value.set(n,s),n=Math.round(n/2),s=Math.round(s/2),this.renderTargetBlurBuffer2.setSize(n,s),this.renderTargetEdgeBuffer2.setSize(n,s),this.separableBlurMaterial2.uniforms.texSize.value.set(n,s)}changeVisibilityOfSelectedObjects(e){const t=this._visibilityCache;function n(s){s.isMesh&&(e===!0?s.visible=t.get(s):(t.set(s,s.visible),s.visible=e))}for(let s=0;s<this.selectedObjects.length;s++)this.selectedObjects[s].traverse(n)}changeVisibilityOfNonSelectedObjects(e){const t=this._visibilityCache,n=[];function s(r){r.isMesh&&n.push(r)}for(let r=0;r<this.selectedObjects.length;r++)this.selectedObjects[r].traverse(s);function o(r){if(r.isMesh||r.isSprite){let l=!1;for(let c=0;c<n.length;c++)if(n[c].id===r.id){l=!0;break}if(l===!1){const c=r.visible;(e===!1||t.get(r)===!0)&&(r.visible=e),t.set(r,c)}}else(r.isPoints||r.isLine)&&(e===!0?r.visible=t.get(r):(t.set(r,r.visible),r.visible=e))}this.renderScene.traverse(o)}updateTextureMatrix(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}render(e,t,n,s,o){if(this.selectedObjects.length>0){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const r=e.autoClear;e.autoClear=!1,o&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1);const l=this.renderScene.background;if(this.renderScene.background=null,this.renderScene.overrideMaterial=this.depthMaterial,e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.changeVisibilityOfSelectedObjects(!0),this._visibilityCache.clear(),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.renderTargetDepthBuffer.texture,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this.changeVisibilityOfNonSelectedObjects(!0),this._visibilityCache.clear(),this.renderScene.background=l,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),this.pulsePeriod>0){const c=.625+Math.cos(performance.now()*.01/this.pulsePeriod)*.75/2;this.tempPulseColor1.multiplyScalar(c),this.tempPulseColor2.multiplyScalar(c)}this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=me.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=me.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=me.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=me.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,o&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(n),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=r}this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=n.texture,e.setRenderTarget(null),this.fsQuad.render(e))}getPrepareMaskMaterial(){return new Le({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new N(.5,.5)},textureMatrix:{value:null}},vertexShader:`#include <morphtarget_pars_vertex>
|
|
29
|
+
#include <skinning_pars_vertex>
|
|
30
|
+
|
|
31
|
+
varying vec4 projTexCoord;
|
|
32
|
+
varying vec4 vPosition;
|
|
33
|
+
uniform mat4 textureMatrix;
|
|
34
|
+
|
|
35
|
+
void main() {
|
|
36
|
+
|
|
37
|
+
#include <skinbase_vertex>
|
|
38
|
+
#include <begin_vertex>
|
|
39
|
+
#include <morphtarget_vertex>
|
|
40
|
+
#include <skinning_vertex>
|
|
41
|
+
#include <project_vertex>
|
|
42
|
+
|
|
43
|
+
vPosition = mvPosition;
|
|
44
|
+
|
|
45
|
+
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
46
|
+
|
|
47
|
+
#ifdef USE_INSTANCING
|
|
48
|
+
|
|
49
|
+
worldPosition = instanceMatrix * worldPosition;
|
|
50
|
+
|
|
51
|
+
#endif
|
|
52
|
+
|
|
53
|
+
worldPosition = modelMatrix * worldPosition;
|
|
54
|
+
|
|
55
|
+
projTexCoord = textureMatrix * worldPosition;
|
|
56
|
+
|
|
57
|
+
}`,fragmentShader:`#include <packing>
|
|
58
|
+
varying vec4 vPosition;
|
|
59
|
+
varying vec4 projTexCoord;
|
|
60
|
+
uniform sampler2D depthTexture;
|
|
61
|
+
uniform vec2 cameraNearFar;
|
|
62
|
+
|
|
63
|
+
void main() {
|
|
64
|
+
|
|
65
|
+
float depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));
|
|
66
|
+
float viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );
|
|
67
|
+
float depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;
|
|
68
|
+
gl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);
|
|
69
|
+
|
|
70
|
+
}`})}getEdgeDetectionMaterial(){return new Le({uniforms:{maskTexture:{value:null},texSize:{value:new N(.5,.5)},visibleEdgeColor:{value:new S(1,1,1)},hiddenEdgeColor:{value:new S(1,1,1)}},vertexShader:`varying vec2 vUv;
|
|
71
|
+
|
|
72
|
+
void main() {
|
|
73
|
+
vUv = uv;
|
|
74
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
75
|
+
}`,fragmentShader:`varying vec2 vUv;
|
|
76
|
+
|
|
77
|
+
uniform sampler2D maskTexture;
|
|
78
|
+
uniform vec2 texSize;
|
|
79
|
+
uniform vec3 visibleEdgeColor;
|
|
80
|
+
uniform vec3 hiddenEdgeColor;
|
|
81
|
+
|
|
82
|
+
void main() {
|
|
83
|
+
vec2 invSize = 1.0 / texSize;
|
|
84
|
+
vec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);
|
|
85
|
+
vec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);
|
|
86
|
+
vec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);
|
|
87
|
+
vec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);
|
|
88
|
+
vec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);
|
|
89
|
+
float diff1 = (c1.r - c2.r)*0.5;
|
|
90
|
+
float diff2 = (c3.r - c4.r)*0.5;
|
|
91
|
+
float d = length( vec2(diff1, diff2) );
|
|
92
|
+
float a1 = min(c1.g, c2.g);
|
|
93
|
+
float a2 = min(c3.g, c4.g);
|
|
94
|
+
float visibilityFactor = min(a1, a2);
|
|
95
|
+
vec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;
|
|
96
|
+
gl_FragColor = vec4(edgeColor, 1.0) * vec4(d);
|
|
97
|
+
}`})}getSeperableBlurMaterial(e){return new Le({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new N(.5,.5)},direction:{value:new N(.5,.5)},kernelRadius:{value:1}},vertexShader:`varying vec2 vUv;
|
|
98
|
+
|
|
99
|
+
void main() {
|
|
100
|
+
vUv = uv;
|
|
101
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
102
|
+
}`,fragmentShader:`#include <common>
|
|
103
|
+
varying vec2 vUv;
|
|
104
|
+
uniform sampler2D colorTexture;
|
|
105
|
+
uniform vec2 texSize;
|
|
106
|
+
uniform vec2 direction;
|
|
107
|
+
uniform float kernelRadius;
|
|
108
|
+
|
|
109
|
+
float gaussianPdf(in float x, in float sigma) {
|
|
110
|
+
return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
void main() {
|
|
114
|
+
vec2 invSize = 1.0 / texSize;
|
|
115
|
+
float sigma = kernelRadius/2.0;
|
|
116
|
+
float weightSum = gaussianPdf(0.0, sigma);
|
|
117
|
+
vec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;
|
|
118
|
+
vec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);
|
|
119
|
+
vec2 uvOffset = delta;
|
|
120
|
+
for( int i = 1; i <= MAX_RADIUS; i ++ ) {
|
|
121
|
+
float x = kernelRadius * float(i) / float(MAX_RADIUS);
|
|
122
|
+
float w = gaussianPdf(x, sigma);
|
|
123
|
+
vec4 sample1 = texture2D( colorTexture, vUv + uvOffset);
|
|
124
|
+
vec4 sample2 = texture2D( colorTexture, vUv - uvOffset);
|
|
125
|
+
diffuseSum += ((sample1 + sample2) * w);
|
|
126
|
+
weightSum += (2.0 * w);
|
|
127
|
+
uvOffset += delta;
|
|
128
|
+
}
|
|
129
|
+
gl_FragColor = diffuseSum/weightSum;
|
|
130
|
+
}`})}getOverlayMaterial(){return new Le({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:`varying vec2 vUv;
|
|
131
|
+
|
|
132
|
+
void main() {
|
|
133
|
+
vUv = uv;
|
|
134
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
135
|
+
}`,fragmentShader:`varying vec2 vUv;
|
|
136
|
+
|
|
137
|
+
uniform sampler2D maskTexture;
|
|
138
|
+
uniform sampler2D edgeTexture1;
|
|
139
|
+
uniform sampler2D edgeTexture2;
|
|
140
|
+
uniform sampler2D patternTexture;
|
|
141
|
+
uniform float edgeStrength;
|
|
142
|
+
uniform float edgeGlow;
|
|
143
|
+
uniform bool usePatternTexture;
|
|
144
|
+
|
|
145
|
+
void main() {
|
|
146
|
+
vec4 edgeValue1 = texture2D(edgeTexture1, vUv);
|
|
147
|
+
vec4 edgeValue2 = texture2D(edgeTexture2, vUv);
|
|
148
|
+
vec4 maskColor = texture2D(maskTexture, vUv);
|
|
149
|
+
vec4 patternColor = texture2D(patternTexture, 6.0 * vUv);
|
|
150
|
+
float visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;
|
|
151
|
+
vec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;
|
|
152
|
+
vec4 finalColor = edgeStrength * maskColor.r * edgeValue;
|
|
153
|
+
if(usePatternTexture)
|
|
154
|
+
finalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);
|
|
155
|
+
gl_FragColor = finalColor;
|
|
156
|
+
}`,blending:Er,depthTest:!1,depthWrite:!1,transparent:!0})}}me.BlurDirectionX=new N(1,0);me.BlurDirectionY=new N(0,1);class Xi extends lt{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof Le?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=un.clone(e.uniforms),this.material=new Le({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new cn(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}const _o={name:"FXAAShader",uniforms:{tDiffuse:{value:null},resolution:{value:new N(1/1024,1/512)}},vertexShader:`
|
|
157
|
+
|
|
158
|
+
varying vec2 vUv;
|
|
159
|
+
|
|
160
|
+
void main() {
|
|
161
|
+
|
|
162
|
+
vUv = uv;
|
|
163
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
164
|
+
|
|
165
|
+
}`,fragmentShader:`
|
|
166
|
+
precision highp float;
|
|
167
|
+
|
|
168
|
+
uniform sampler2D tDiffuse;
|
|
169
|
+
|
|
170
|
+
uniform vec2 resolution;
|
|
171
|
+
|
|
172
|
+
varying vec2 vUv;
|
|
173
|
+
|
|
174
|
+
// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)
|
|
175
|
+
|
|
176
|
+
//----------------------------------------------------------------------------------
|
|
177
|
+
// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag
|
|
178
|
+
// SDK Version: v3.00
|
|
179
|
+
// Email: gameworks@nvidia.com
|
|
180
|
+
// Site: http://developer.nvidia.com/
|
|
181
|
+
//
|
|
182
|
+
// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
|
|
183
|
+
//
|
|
184
|
+
// Redistribution and use in source and binary forms, with or without
|
|
185
|
+
// modification, are permitted provided that the following conditions
|
|
186
|
+
// are met:
|
|
187
|
+
// * Redistributions of source code must retain the above copyright
|
|
188
|
+
// notice, this list of conditions and the following disclaimer.
|
|
189
|
+
// * Redistributions in binary form must reproduce the above copyright
|
|
190
|
+
// notice, this list of conditions and the following disclaimer in the
|
|
191
|
+
// documentation and/or other materials provided with the distribution.
|
|
192
|
+
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
|
193
|
+
// contributors may be used to endorse or promote products derived
|
|
194
|
+
// from this software without specific prior written permission.
|
|
195
|
+
//
|
|
196
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
|
197
|
+
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
198
|
+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
199
|
+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
200
|
+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
201
|
+
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
202
|
+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
203
|
+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
204
|
+
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
205
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
206
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
207
|
+
//
|
|
208
|
+
//----------------------------------------------------------------------------------
|
|
209
|
+
|
|
210
|
+
#ifndef FXAA_DISCARD
|
|
211
|
+
//
|
|
212
|
+
// Only valid for PC OpenGL currently.
|
|
213
|
+
// Probably will not work when FXAA_GREEN_AS_LUMA = 1.
|
|
214
|
+
//
|
|
215
|
+
// 1 = Use discard on pixels which don't need AA.
|
|
216
|
+
// For APIs which enable concurrent TEX+ROP from same surface.
|
|
217
|
+
// 0 = Return unchanged color on pixels which don't need AA.
|
|
218
|
+
//
|
|
219
|
+
#define FXAA_DISCARD 0
|
|
220
|
+
#endif
|
|
221
|
+
|
|
222
|
+
/*--------------------------------------------------------------------------*/
|
|
223
|
+
#define FxaaTexTop(t, p) texture2D(t, p, -100.0)
|
|
224
|
+
#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)
|
|
225
|
+
/*--------------------------------------------------------------------------*/
|
|
226
|
+
|
|
227
|
+
#define NUM_SAMPLES 5
|
|
228
|
+
|
|
229
|
+
// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha
|
|
230
|
+
float contrast( vec4 a, vec4 b ) {
|
|
231
|
+
vec4 diff = abs( a - b );
|
|
232
|
+
return max( max( max( diff.r, diff.g ), diff.b ), diff.a );
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/*============================================================================
|
|
236
|
+
|
|
237
|
+
FXAA3 QUALITY - PC
|
|
238
|
+
|
|
239
|
+
============================================================================*/
|
|
240
|
+
|
|
241
|
+
/*--------------------------------------------------------------------------*/
|
|
242
|
+
vec4 FxaaPixelShader(
|
|
243
|
+
vec2 posM,
|
|
244
|
+
sampler2D tex,
|
|
245
|
+
vec2 fxaaQualityRcpFrame,
|
|
246
|
+
float fxaaQualityEdgeThreshold,
|
|
247
|
+
float fxaaQualityinvEdgeThreshold
|
|
248
|
+
) {
|
|
249
|
+
vec4 rgbaM = FxaaTexTop(tex, posM);
|
|
250
|
+
vec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);
|
|
251
|
+
vec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);
|
|
252
|
+
vec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);
|
|
253
|
+
vec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);
|
|
254
|
+
// . S .
|
|
255
|
+
// W M E
|
|
256
|
+
// . N .
|
|
257
|
+
|
|
258
|
+
bool earlyExit = max( max( max(
|
|
259
|
+
contrast( rgbaM, rgbaN ),
|
|
260
|
+
contrast( rgbaM, rgbaS ) ),
|
|
261
|
+
contrast( rgbaM, rgbaE ) ),
|
|
262
|
+
contrast( rgbaM, rgbaW ) )
|
|
263
|
+
< fxaaQualityEdgeThreshold;
|
|
264
|
+
// . 0 .
|
|
265
|
+
// 0 0 0
|
|
266
|
+
// . 0 .
|
|
267
|
+
|
|
268
|
+
#if (FXAA_DISCARD == 1)
|
|
269
|
+
if(earlyExit) FxaaDiscard;
|
|
270
|
+
#else
|
|
271
|
+
if(earlyExit) return rgbaM;
|
|
272
|
+
#endif
|
|
273
|
+
|
|
274
|
+
float contrastN = contrast( rgbaM, rgbaN );
|
|
275
|
+
float contrastS = contrast( rgbaM, rgbaS );
|
|
276
|
+
float contrastE = contrast( rgbaM, rgbaE );
|
|
277
|
+
float contrastW = contrast( rgbaM, rgbaW );
|
|
278
|
+
|
|
279
|
+
float relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );
|
|
280
|
+
relativeVContrast *= fxaaQualityinvEdgeThreshold;
|
|
281
|
+
|
|
282
|
+
bool horzSpan = relativeVContrast > 0.;
|
|
283
|
+
// . 1 .
|
|
284
|
+
// 0 0 0
|
|
285
|
+
// . 1 .
|
|
286
|
+
|
|
287
|
+
// 45 deg edge detection and corners of objects, aka V/H contrast is too similar
|
|
288
|
+
if( abs( relativeVContrast ) < .3 ) {
|
|
289
|
+
// locate the edge
|
|
290
|
+
vec2 dirToEdge;
|
|
291
|
+
dirToEdge.x = contrastE > contrastW ? 1. : -1.;
|
|
292
|
+
dirToEdge.y = contrastS > contrastN ? 1. : -1.;
|
|
293
|
+
// . 2 . . 1 .
|
|
294
|
+
// 1 0 2 ~= 0 0 1
|
|
295
|
+
// . 1 . . 0 .
|
|
296
|
+
|
|
297
|
+
// tap 2 pixels and see which ones are "outside" the edge, to
|
|
298
|
+
// determine if the edge is vertical or horizontal
|
|
299
|
+
|
|
300
|
+
vec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);
|
|
301
|
+
float matchAlongH = contrast( rgbaM, rgbaAlongH );
|
|
302
|
+
// . 1 .
|
|
303
|
+
// 0 0 1
|
|
304
|
+
// . 0 H
|
|
305
|
+
|
|
306
|
+
vec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);
|
|
307
|
+
float matchAlongV = contrast( rgbaM, rgbaAlongV );
|
|
308
|
+
// V 1 .
|
|
309
|
+
// 0 0 1
|
|
310
|
+
// . 0 .
|
|
311
|
+
|
|
312
|
+
relativeVContrast = matchAlongV - matchAlongH;
|
|
313
|
+
relativeVContrast *= fxaaQualityinvEdgeThreshold;
|
|
314
|
+
|
|
315
|
+
if( abs( relativeVContrast ) < .3 ) { // 45 deg edge
|
|
316
|
+
// 1 1 .
|
|
317
|
+
// 0 0 1
|
|
318
|
+
// . 0 1
|
|
319
|
+
|
|
320
|
+
// do a simple blur
|
|
321
|
+
return mix(
|
|
322
|
+
rgbaM,
|
|
323
|
+
(rgbaN + rgbaS + rgbaE + rgbaW) * .25,
|
|
324
|
+
.4
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
horzSpan = relativeVContrast > 0.;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if(!horzSpan) rgbaN = rgbaW;
|
|
332
|
+
if(!horzSpan) rgbaS = rgbaE;
|
|
333
|
+
// . 0 . 1
|
|
334
|
+
// 1 0 1 -> 0
|
|
335
|
+
// . 0 . 1
|
|
336
|
+
|
|
337
|
+
bool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );
|
|
338
|
+
if(!pairN) rgbaN = rgbaS;
|
|
339
|
+
|
|
340
|
+
vec2 offNP;
|
|
341
|
+
offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
|
|
342
|
+
offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
|
|
343
|
+
|
|
344
|
+
bool doneN = false;
|
|
345
|
+
bool doneP = false;
|
|
346
|
+
|
|
347
|
+
float nDist = 0.;
|
|
348
|
+
float pDist = 0.;
|
|
349
|
+
|
|
350
|
+
vec2 posN = posM;
|
|
351
|
+
vec2 posP = posM;
|
|
352
|
+
|
|
353
|
+
int iterationsUsed = 0;
|
|
354
|
+
int iterationsUsedN = 0;
|
|
355
|
+
int iterationsUsedP = 0;
|
|
356
|
+
for( int i = 0; i < NUM_SAMPLES; i++ ) {
|
|
357
|
+
iterationsUsed = i;
|
|
358
|
+
|
|
359
|
+
float increment = float(i + 1);
|
|
360
|
+
|
|
361
|
+
if(!doneN) {
|
|
362
|
+
nDist += increment;
|
|
363
|
+
posN = posM + offNP * nDist;
|
|
364
|
+
vec4 rgbaEndN = FxaaTexTop(tex, posN.xy);
|
|
365
|
+
doneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );
|
|
366
|
+
iterationsUsedN = i;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if(!doneP) {
|
|
370
|
+
pDist += increment;
|
|
371
|
+
posP = posM - offNP * pDist;
|
|
372
|
+
vec4 rgbaEndP = FxaaTexTop(tex, posP.xy);
|
|
373
|
+
doneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );
|
|
374
|
+
iterationsUsedP = i;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if(doneN || doneP) break;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
if ( !doneP && !doneN ) return rgbaM; // failed to find end of edge
|
|
382
|
+
|
|
383
|
+
float dist = min(
|
|
384
|
+
doneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,
|
|
385
|
+
doneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
// hacky way of reduces blurriness of mostly diagonal edges
|
|
389
|
+
// but reduces AA quality
|
|
390
|
+
dist = pow(dist, .5);
|
|
391
|
+
|
|
392
|
+
dist = 1. - dist;
|
|
393
|
+
|
|
394
|
+
return mix(
|
|
395
|
+
rgbaM,
|
|
396
|
+
rgbaN,
|
|
397
|
+
dist * .5
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
void main() {
|
|
402
|
+
const float edgeDetectionQuality = .2;
|
|
403
|
+
const float invEdgeDetectionQuality = 1. / edgeDetectionQuality;
|
|
404
|
+
|
|
405
|
+
gl_FragColor = FxaaPixelShader(
|
|
406
|
+
vUv,
|
|
407
|
+
tDiffuse,
|
|
408
|
+
resolution,
|
|
409
|
+
edgeDetectionQuality, // [0,1] contrast needed, otherwise early discard
|
|
410
|
+
invEdgeDetectionQuality
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
}
|
|
414
|
+
`},xo={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:`
|
|
415
|
+
precision highp float;
|
|
416
|
+
|
|
417
|
+
uniform mat4 modelViewMatrix;
|
|
418
|
+
uniform mat4 projectionMatrix;
|
|
419
|
+
|
|
420
|
+
attribute vec3 position;
|
|
421
|
+
attribute vec2 uv;
|
|
422
|
+
|
|
423
|
+
varying vec2 vUv;
|
|
424
|
+
|
|
425
|
+
void main() {
|
|
426
|
+
|
|
427
|
+
vUv = uv;
|
|
428
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
429
|
+
|
|
430
|
+
}`,fragmentShader:`
|
|
431
|
+
|
|
432
|
+
precision highp float;
|
|
433
|
+
|
|
434
|
+
uniform sampler2D tDiffuse;
|
|
435
|
+
|
|
436
|
+
#include <tonemapping_pars_fragment>
|
|
437
|
+
#include <colorspace_pars_fragment>
|
|
438
|
+
|
|
439
|
+
varying vec2 vUv;
|
|
440
|
+
|
|
441
|
+
void main() {
|
|
442
|
+
|
|
443
|
+
gl_FragColor = texture2D( tDiffuse, vUv );
|
|
444
|
+
|
|
445
|
+
// tone mapping
|
|
446
|
+
|
|
447
|
+
#ifdef LINEAR_TONE_MAPPING
|
|
448
|
+
|
|
449
|
+
gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
|
|
450
|
+
|
|
451
|
+
#elif defined( REINHARD_TONE_MAPPING )
|
|
452
|
+
|
|
453
|
+
gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
|
|
454
|
+
|
|
455
|
+
#elif defined( CINEON_TONE_MAPPING )
|
|
456
|
+
|
|
457
|
+
gl_FragColor.rgb = OptimizedCineonToneMapping( gl_FragColor.rgb );
|
|
458
|
+
|
|
459
|
+
#elif defined( ACES_FILMIC_TONE_MAPPING )
|
|
460
|
+
|
|
461
|
+
gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
|
|
462
|
+
|
|
463
|
+
#elif defined( AGX_TONE_MAPPING )
|
|
464
|
+
|
|
465
|
+
gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
|
|
466
|
+
|
|
467
|
+
#elif defined( NEUTRAL_TONE_MAPPING )
|
|
468
|
+
|
|
469
|
+
gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
|
|
470
|
+
|
|
471
|
+
#endif
|
|
472
|
+
|
|
473
|
+
// color space
|
|
474
|
+
|
|
475
|
+
#ifdef SRGB_TRANSFER
|
|
476
|
+
|
|
477
|
+
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
|
478
|
+
|
|
479
|
+
#endif
|
|
480
|
+
|
|
481
|
+
}`};class yo extends lt{constructor(){super();const e=xo;this.uniforms=un.clone(e.uniforms),this.material=new br({name:e.name,uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader}),this.fsQuad=new cn(this.material),this._outputColorSpace=null,this._toneMapping=null}render(e,t,n){this.uniforms.tDiffuse.value=n.texture,this.uniforms.toneMappingExposure.value=e.toneMappingExposure,(this._outputColorSpace!==e.outputColorSpace||this._toneMapping!==e.toneMapping)&&(this._outputColorSpace=e.outputColorSpace,this._toneMapping=e.toneMapping,this.material.defines={},Ws.getTransfer(this._outputColorSpace)===Sr&&(this.material.defines.SRGB_TRANSFER=""),this._toneMapping===Mr?this.material.defines.LINEAR_TONE_MAPPING="":this._toneMapping===Ir?this.material.defines.REINHARD_TONE_MAPPING="":this._toneMapping===Cr?this.material.defines.CINEON_TONE_MAPPING="":this._toneMapping===Pi?this.material.defines.ACES_FILMIC_TONE_MAPPING="":this._toneMapping===Br?this.material.defines.AGX_TONE_MAPPING="":this._toneMapping===Rr&&(this.material.defines.NEUTRAL_TONE_MAPPING=""),this.material.needsUpdate=!0),this.renderToScreen===!0?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class Pn extends lt{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const s=e.getContext(),o=e.state;o.buffers.color.setMask(!1),o.buffers.depth.setMask(!1),o.buffers.color.setLocked(!0),o.buffers.depth.setLocked(!0);let r,l;this.inverse?(r=0,l=1):(r=1,l=0),o.buffers.stencil.setTest(!0),o.buffers.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),o.buffers.stencil.setFunc(s.ALWAYS,r,4294967295),o.buffers.stencil.setClear(l),o.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),o.buffers.color.setLocked(!1),o.buffers.depth.setLocked(!1),o.buffers.color.setMask(!0),o.buffers.depth.setMask(!0),o.buffers.stencil.setLocked(!1),o.buffers.stencil.setFunc(s.EQUAL,1,4294967295),o.buffers.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),o.buffers.stencil.setLocked(!0)}}class wo extends lt{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class vo{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const n=e.getSize(new N);this._width=n.width,this._height=n.height,t=new Ce(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Fe}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Xi(Yi),this.copyPass.material.blending=Qs,this.clock=new Lr}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let s=0,o=this.passes.length;s<o;s++){const r=this.passes[s];if(r.enabled!==!1){if(r.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(s),r.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),r.needsSwap){if(n){const l=this.renderer.getContext(),c=this.renderer.state.buffers.stencil;c.setFunc(l.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),c.setFunc(l.EQUAL,1,4294967295)}this.swapBuffers()}Pn!==void 0&&(r instanceof Pn?n=!0:r instanceof wo&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new N);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,s=this._height*this._pixelRatio;this.renderTarget1.setSize(n,s),this.renderTarget2.setSize(n,s);for(let o=0;o<this.passes.length;o++)this.passes[o].setSize(n,s)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class An extends ye{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new N(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&t.element.parentNode!==null&&t.element.parentNode.removeChild(t.element)})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const He=new S,Dn=new V,Nn=new V,On=new S,Fn=new S;class To{constructor(e={}){const t=this;let n,s,o,r;const l={objects:new WeakMap},c=e.element!==void 0?e.element:document.createElement("div");c.style.overflow="hidden",this.domElement=c,this.getSize=function(){return{width:n,height:s}},this.render=function(f,g){f.matrixWorldAutoUpdate===!0&&f.updateMatrixWorld(),g.parent===null&&g.matrixWorldAutoUpdate===!0&&g.updateMatrixWorld(),Dn.copy(g.matrixWorldInverse),Nn.multiplyMatrices(g.projectionMatrix,Dn),h(f,f,g),a(f)},this.setSize=function(f,g){n=f,s=g,o=n/2,r=s/2,c.style.width=f+"px",c.style.height=g+"px"};function h(f,g,A){if(f.isCSS2DObject){He.setFromMatrixPosition(f.matrixWorld),He.applyMatrix4(Nn);const p=f.visible===!0&&He.z>=-1&&He.z<=1&&f.layers.test(A.layers)===!0;if(f.element.style.display=p===!0?"":"none",p===!0){f.onBeforeRender(t,g,A);const _=f.element;_.style.transform="translate("+-100*f.center.x+"%,"+-100*f.center.y+"%)translate("+(He.x*o+o)+"px,"+(-He.y*r+r)+"px)",_.parentNode!==c&&c.appendChild(_),f.onAfterRender(t,g,A)}const m={distanceToCameraSquared:d(A,f)};l.objects.set(f,m)}for(let p=0,m=f.children.length;p<m;p++)h(f.children[p],g,A)}function d(f,g){return On.setFromMatrixPosition(f.matrixWorld),Fn.setFromMatrixPosition(g.matrixWorld),On.distanceToSquared(Fn)}function i(f){const g=[];return f.traverse(function(A){A.isCSS2DObject&&g.push(A)}),g}function a(f){const g=i(f).sort(function(p,m){if(p.renderOrder!==m.renderOrder)return m.renderOrder-p.renderOrder;const _=l.objects.get(p).distanceToCameraSquared,x=l.objects.get(m).distanceToCameraSquared;return _-x}),A=g.length;for(let p=0,m=g.length;p<m;p++)g[p].element.style.zIndex=A-p}}}const kn=new S,Eo=new hs,Un=new S;class _n extends ye{constructor(e=document.createElement("div")){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&t.element.parentNode!==null&&t.element.parentNode.removeChild(t.element)})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}const ce=new V,bo=new V;class So{constructor(e={}){const t=this;let n,s,o,r;const l={camera:{style:""},objects:new WeakMap},c=e.element!==void 0?e.element:document.createElement("div");c.style.overflow="hidden",this.domElement=c;const h=document.createElement("div");h.style.transformOrigin="0 0",h.style.pointerEvents="none",c.appendChild(h);const d=document.createElement("div");d.style.transformStyle="preserve-3d",h.appendChild(d),this.getSize=function(){return{width:n,height:s}},this.render=function(A,p){const m=p.projectionMatrix.elements[5]*r;p.view&&p.view.enabled?(h.style.transform=`translate( ${-p.view.offsetX*(n/p.view.width)}px, ${-p.view.offsetY*(s/p.view.height)}px )`,h.style.transform+=`scale( ${p.view.fullWidth/p.view.width}, ${p.view.fullHeight/p.view.height} )`):h.style.transform="",A.matrixWorldAutoUpdate===!0&&A.updateMatrixWorld(),p.parent===null&&p.matrixWorldAutoUpdate===!0&&p.updateMatrixWorld();let _,x;p.isOrthographicCamera&&(_=-(p.right+p.left)/2,x=(p.top+p.bottom)/2);const y=p.view&&p.view.enabled?p.view.height/p.view.fullHeight:1,w=p.isOrthographicCamera?`scale( ${y} )scale(`+m+")translate("+i(_)+"px,"+i(x)+"px)"+a(p.matrixWorldInverse):`scale( ${y} )translateZ(`+m+"px)"+a(p.matrixWorldInverse),T=(p.isPerspectiveCamera?"perspective("+m+"px) ":"")+w+"translate("+o+"px,"+r+"px)";l.camera.style!==T&&(d.style.transform=T,l.camera.style=T),g(A,A,p)},this.setSize=function(A,p){n=A,s=p,o=n/2,r=s/2,c.style.width=A+"px",c.style.height=p+"px",h.style.width=A+"px",h.style.height=p+"px",d.style.width=A+"px",d.style.height=p+"px"};function i(A){return Math.abs(A)<1e-10?0:A}function a(A){const p=A.elements;return"matrix3d("+i(p[0])+","+i(-p[1])+","+i(p[2])+","+i(p[3])+","+i(p[4])+","+i(-p[5])+","+i(p[6])+","+i(p[7])+","+i(p[8])+","+i(-p[9])+","+i(p[10])+","+i(p[11])+","+i(p[12])+","+i(-p[13])+","+i(p[14])+","+i(p[15])+")"}function f(A){const p=A.elements;return"translate(-50%,-50%)"+("matrix3d("+i(p[0])+","+i(p[1])+","+i(p[2])+","+i(p[3])+","+i(-p[4])+","+i(-p[5])+","+i(-p[6])+","+i(-p[7])+","+i(p[8])+","+i(p[9])+","+i(p[10])+","+i(p[11])+","+i(p[12])+","+i(p[13])+","+i(p[14])+","+i(p[15])+")")}function g(A,p,m,_){if(A.isCSS3DObject){const x=A.visible===!0&&A.layers.test(m.layers)===!0;if(A.element.style.display=x===!0?"":"none",x===!0){A.onBeforeRender(t,p,m);let y;A.isCSS3DSprite?(ce.copy(m.matrixWorldInverse),ce.transpose(),A.rotation2D!==0&&ce.multiply(bo.makeRotationZ(A.rotation2D)),A.matrixWorld.decompose(kn,Eo,Un),ce.setPosition(kn),ce.scale(Un),ce.elements[3]=0,ce.elements[7]=0,ce.elements[11]=0,ce.elements[15]=1,y=f(ce)):y=f(A.matrixWorld);const w=A.element,v=l.objects.get(A);if(v===void 0||v.style!==y){w.style.transform=y;const T={style:y};l.objects.set(A,T)}w.parentNode!==d&&d.appendChild(w),A.onAfterRender(t,p,m)}}for(let x=0,y=A.children.length;x<y;x++)g(A.children[x],p,m)}}}var qi={exports:{}};(function(u){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function s(c,h,d){this.fn=c,this.context=h,this.once=d||!1}function o(c,h,d,i,a){if(typeof d!="function")throw new TypeError("The listener must be a function");var f=new s(d,i||c,a),g=t?t+h:h;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],f]:c._events[g].push(f):(c._events[g]=f,c._eventsCount++),c}function r(c,h){--c._eventsCount===0?c._events=new n:delete c._events[h]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var h=[],d,i;if(this._eventsCount===0)return h;for(i in d=this._events)e.call(d,i)&&h.push(t?i.slice(1):i);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(d)):h},l.prototype.listeners=function(h){var d=t?t+h:h,i=this._events[d];if(!i)return[];if(i.fn)return[i.fn];for(var a=0,f=i.length,g=new Array(f);a<f;a++)g[a]=i[a].fn;return g},l.prototype.listenerCount=function(h){var d=t?t+h:h,i=this._events[d];return i?i.fn?1:i.length:0},l.prototype.emit=function(h,d,i,a,f,g){var A=t?t+h:h;if(!this._events[A])return!1;var p=this._events[A],m=arguments.length,_,x;if(p.fn){switch(p.once&&this.removeListener(h,p.fn,void 0,!0),m){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,d),!0;case 3:return p.fn.call(p.context,d,i),!0;case 4:return p.fn.call(p.context,d,i,a),!0;case 5:return p.fn.call(p.context,d,i,a,f),!0;case 6:return p.fn.call(p.context,d,i,a,f,g),!0}for(x=1,_=new Array(m-1);x<m;x++)_[x-1]=arguments[x];p.fn.apply(p.context,_)}else{var y=p.length,w;for(x=0;x<y;x++)switch(p[x].once&&this.removeListener(h,p[x].fn,void 0,!0),m){case 1:p[x].fn.call(p[x].context);break;case 2:p[x].fn.call(p[x].context,d);break;case 3:p[x].fn.call(p[x].context,d,i);break;case 4:p[x].fn.call(p[x].context,d,i,a);break;default:if(!_)for(w=1,_=new Array(m-1);w<m;w++)_[w-1]=arguments[w];p[x].fn.apply(p[x].context,_)}}return!0},l.prototype.on=function(h,d,i){return o(this,h,d,i,!1)},l.prototype.once=function(h,d,i){return o(this,h,d,i,!0)},l.prototype.removeListener=function(h,d,i,a){var f=t?t+h:h;if(!this._events[f])return this;if(!d)return r(this,f),this;var g=this._events[f];if(g.fn)g.fn===d&&(!a||g.once)&&(!i||g.context===i)&&r(this,f);else{for(var A=0,p=[],m=g.length;A<m;A++)(g[A].fn!==d||a&&!g[A].once||i&&g[A].context!==i)&&p.push(g[A]);p.length?this._events[f]=p.length===1?p[0]:p:r(this,f)}return this},l.prototype.removeAllListeners=function(h){var d;return h?(d=t?t+h:h,this._events[d]&&r(this,d)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=t,l.EventEmitter=l,u.exports=l})(qi);var Mo=qi.exports;const ze=po(Mo);var St=function(){var u=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(i){i.preventDefault(),n(++u%e.children.length)},!1);function t(i){return e.appendChild(i.dom),i}function n(i){for(var a=0;a<e.children.length;a++)e.children[a].style.display=a===i?"block":"none";u=i}var s=(performance||Date).now(),o=s,r=0,l=t(new St.Panel("FPS","#0ff","#002")),c=t(new St.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var h=t(new St.Panel("MB","#f08","#201"));n(0);var d=0;return{REVISION:16,dom:e,fps:function(){return d&&parseInt(d.toFixed(0))},addPanel:t,showPanel:n,begin:function(){s=(performance||Date).now()},end:function(){r++;var i=(performance||Date).now();if(c.update(i-s,200),i>=o+1e3&&(d=r*1e3/(i-o),l.update(d,100),o=i,r=0,h)){var a=performance.memory;h.update(a.usedJSHeapSize/1048576,a.jsHeapSizeLimit/1048576)}return i},update:function(){s=this.end()},domElement:e,setMode:n}};St.Panel=function(u,e,t){var n=1/0,s=0,o=Math.round,r=o(window.devicePixelRatio||1),l=80*r,c=48*r,h=3*r,d=2*r,i=3*r,a=15*r,f=74*r,g=30*r,A=document.createElement("canvas");A.width=l,A.height=c,A.style.cssText="width:80px;height:48px";var p=A.getContext("2d");return p.font="bold "+9*r+"px Helvetica,Arial,sans-serif",p.textBaseline="top",p.fillStyle=t,p.fillRect(0,0,l,c),p.fillStyle=e,p.fillText(u,h,d),p.fillRect(i,a,f,g),p.fillStyle=t,p.globalAlpha=.9,p.fillRect(i,a,f,g),{dom:A,update:function(m,_){n=Math.min(n,m),s=Math.max(s,m),p.fillStyle=t,p.globalAlpha=1,p.fillRect(0,0,l,a),p.fillStyle=e,p.fillText(o(m)+" "+u+" ("+o(n)+"-"+o(s)+")",h,d),p.drawImage(A,i+r,a,f-r,g,i,a,f-r,g),p.fillRect(i+f-r,a,r,g),p.fillStyle=t,p.globalAlpha=.9,p.fillRect(i+f-r,a,r,o((1-m/_)*g))}}};function Io(u,e){const t=URL.createObjectURL(u),n=document.createElement("a");n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}function Co(u){return u.length===0?0:u.reduce((t,n)=>t+n,0)/u.length}function zn(u,e){const t=new Blob([u],{type:e});return URL.createObjectURL(t)}function Bo(){return/Mac|iPod|iPhone|iPad/.test(navigator.platform)||/Mac OS|iOS/.test(navigator.userAgent)}var Zi={};/*!
|
|
482
|
+
* howler.js v2.2.4
|
|
483
|
+
* howlerjs.com
|
|
484
|
+
*
|
|
485
|
+
* (c) 2013-2020, James Simpson of GoldFire Studios
|
|
486
|
+
* goldfirestudios.com
|
|
487
|
+
*
|
|
488
|
+
* MIT License
|
|
489
|
+
*/(function(u){(function(){var e=function(){this.init()};e.prototype={init:function(){var i=this||t;return i._counter=1e3,i._html5AudioPool=[],i.html5PoolSize=10,i._codecs={},i._howls=[],i._muted=!1,i._volume=1,i._canPlayEvent="canplaythrough",i._navigator=typeof window<"u"&&window.navigator?window.navigator:null,i.masterGain=null,i.noAudio=!1,i.usingWebAudio=!0,i.autoSuspend=!0,i.ctx=null,i.autoUnlock=!0,i._setup(),i},volume:function(i){var a=this||t;if(i=parseFloat(i),a.ctx||d(),typeof i<"u"&&i>=0&&i<=1){if(a._volume=i,a._muted)return a;a.usingWebAudio&&a.masterGain.gain.setValueAtTime(i,t.ctx.currentTime);for(var f=0;f<a._howls.length;f++)if(!a._howls[f]._webAudio)for(var g=a._howls[f]._getSoundIds(),A=0;A<g.length;A++){var p=a._howls[f]._soundById(g[A]);p&&p._node&&(p._node.volume=p._volume*i)}return a}return a._volume},mute:function(i){var a=this||t;a.ctx||d(),a._muted=i,a.usingWebAudio&&a.masterGain.gain.setValueAtTime(i?0:a._volume,t.ctx.currentTime);for(var f=0;f<a._howls.length;f++)if(!a._howls[f]._webAudio)for(var g=a._howls[f]._getSoundIds(),A=0;A<g.length;A++){var p=a._howls[f]._soundById(g[A]);p&&p._node&&(p._node.muted=i?!0:p._muted)}return a},stop:function(){for(var i=this||t,a=0;a<i._howls.length;a++)i._howls[a].stop();return i},unload:function(){for(var i=this||t,a=i._howls.length-1;a>=0;a--)i._howls[a].unload();return i.usingWebAudio&&i.ctx&&typeof i.ctx.close<"u"&&(i.ctx.close(),i.ctx=null,d()),i},codecs:function(i){return(this||t)._codecs[i.replace(/^x-/,"")]},_setup:function(){var i=this||t;if(i.state=i.ctx&&i.ctx.state||"suspended",i._autoSuspend(),!i.usingWebAudio)if(typeof Audio<"u")try{var a=new Audio;typeof a.oncanplaythrough>"u"&&(i._canPlayEvent="canplay")}catch{i.noAudio=!0}else i.noAudio=!0;try{var a=new Audio;a.muted&&(i.noAudio=!0)}catch{}return i.noAudio||i._setupCodecs(),i},_setupCodecs:function(){var i=this||t,a=null;try{a=typeof Audio<"u"?new Audio:null}catch{return i}if(!a||typeof a.canPlayType!="function")return i;var f=a.canPlayType("audio/mpeg;").replace(/^no$/,""),g=i._navigator?i._navigator.userAgent:"",A=g.match(/OPR\/(\d+)/g),p=A&&parseInt(A[0].split("/")[1],10)<33,m=g.indexOf("Safari")!==-1&&g.indexOf("Chrome")===-1,_=g.match(/Version\/(.*?) /),x=m&&_&&parseInt(_[1],10)<15;return i._codecs={mp3:!!(!p&&(f||a.canPlayType("audio/mp3;").replace(/^no$/,""))),mpeg:!!f,opus:!!a.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(a.canPlayType('audio/wav; codecs="1"')||a.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!a.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!a.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(a.canPlayType("audio/x-m4b;")||a.canPlayType("audio/m4b;")||a.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(a.canPlayType("audio/x-mp4;")||a.canPlayType("audio/mp4;")||a.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!(!x&&a.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!!(!x&&a.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!a.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(a.canPlayType("audio/x-flac;")||a.canPlayType("audio/flac;")).replace(/^no$/,"")},i},_unlockAudio:function(){var i=this||t;if(!(i._audioUnlocked||!i.ctx)){i._audioUnlocked=!1,i.autoUnlock=!1,!i._mobileUnloaded&&i.ctx.sampleRate!==44100&&(i._mobileUnloaded=!0,i.unload()),i._scratchBuffer=i.ctx.createBuffer(1,1,22050);var a=function(f){for(;i._html5AudioPool.length<i.html5PoolSize;)try{var g=new Audio;g._unlocked=!0,i._releaseHtml5Audio(g)}catch{i.noAudio=!0;break}for(var A=0;A<i._howls.length;A++)if(!i._howls[A]._webAudio)for(var p=i._howls[A]._getSoundIds(),m=0;m<p.length;m++){var _=i._howls[A]._soundById(p[m]);_&&_._node&&!_._node._unlocked&&(_._node._unlocked=!0,_._node.load())}i._autoResume();var x=i.ctx.createBufferSource();x.buffer=i._scratchBuffer,x.connect(i.ctx.destination),typeof x.start>"u"?x.noteOn(0):x.start(0),typeof i.ctx.resume=="function"&&i.ctx.resume(),x.onended=function(){x.disconnect(0),i._audioUnlocked=!0,document.removeEventListener("touchstart",a,!0),document.removeEventListener("touchend",a,!0),document.removeEventListener("click",a,!0),document.removeEventListener("keydown",a,!0);for(var y=0;y<i._howls.length;y++)i._howls[y]._emit("unlock")}};return document.addEventListener("touchstart",a,!0),document.addEventListener("touchend",a,!0),document.addEventListener("click",a,!0),document.addEventListener("keydown",a,!0),i}},_obtainHtml5Audio:function(){var i=this||t;if(i._html5AudioPool.length)return i._html5AudioPool.pop();var a=new Audio().play();return a&&typeof Promise<"u"&&(a instanceof Promise||typeof a.then=="function")&&a.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio},_releaseHtml5Audio:function(i){var a=this||t;return i._unlocked&&a._html5AudioPool.push(i),a},_autoSuspend:function(){var i=this;if(!(!i.autoSuspend||!i.ctx||typeof i.ctx.suspend>"u"||!t.usingWebAudio)){for(var a=0;a<i._howls.length;a++)if(i._howls[a]._webAudio){for(var f=0;f<i._howls[a]._sounds.length;f++)if(!i._howls[a]._sounds[f]._paused)return i}return i._suspendTimer&&clearTimeout(i._suspendTimer),i._suspendTimer=setTimeout(function(){if(i.autoSuspend){i._suspendTimer=null,i.state="suspending";var g=function(){i.state="suspended",i._resumeAfterSuspend&&(delete i._resumeAfterSuspend,i._autoResume())};i.ctx.suspend().then(g,g)}},3e4),i}},_autoResume:function(){var i=this;if(!(!i.ctx||typeof i.ctx.resume>"u"||!t.usingWebAudio))return i.state==="running"&&i.ctx.state!=="interrupted"&&i._suspendTimer?(clearTimeout(i._suspendTimer),i._suspendTimer=null):i.state==="suspended"||i.state==="running"&&i.ctx.state==="interrupted"?(i.ctx.resume().then(function(){i.state="running";for(var a=0;a<i._howls.length;a++)i._howls[a]._emit("resume")}),i._suspendTimer&&(clearTimeout(i._suspendTimer),i._suspendTimer=null)):i.state==="suspending"&&(i._resumeAfterSuspend=!0),i}};var t=new e,n=function(i){var a=this;if(!i.src||i.src.length===0){console.error("An array of source files must be passed with any new Howl.");return}a.init(i)};n.prototype={init:function(i){var a=this;return t.ctx||d(),a._autoplay=i.autoplay||!1,a._format=typeof i.format!="string"?i.format:[i.format],a._html5=i.html5||!1,a._muted=i.mute||!1,a._loop=i.loop||!1,a._pool=i.pool||5,a._preload=typeof i.preload=="boolean"||i.preload==="metadata"?i.preload:!0,a._rate=i.rate||1,a._sprite=i.sprite||{},a._src=typeof i.src!="string"?i.src:[i.src],a._volume=i.volume!==void 0?i.volume:1,a._xhr={method:i.xhr&&i.xhr.method?i.xhr.method:"GET",headers:i.xhr&&i.xhr.headers?i.xhr.headers:null,withCredentials:i.xhr&&i.xhr.withCredentials?i.xhr.withCredentials:!1},a._duration=0,a._state="unloaded",a._sounds=[],a._endTimers={},a._queue=[],a._playLock=!1,a._onend=i.onend?[{fn:i.onend}]:[],a._onfade=i.onfade?[{fn:i.onfade}]:[],a._onload=i.onload?[{fn:i.onload}]:[],a._onloaderror=i.onloaderror?[{fn:i.onloaderror}]:[],a._onplayerror=i.onplayerror?[{fn:i.onplayerror}]:[],a._onpause=i.onpause?[{fn:i.onpause}]:[],a._onplay=i.onplay?[{fn:i.onplay}]:[],a._onstop=i.onstop?[{fn:i.onstop}]:[],a._onmute=i.onmute?[{fn:i.onmute}]:[],a._onvolume=i.onvolume?[{fn:i.onvolume}]:[],a._onrate=i.onrate?[{fn:i.onrate}]:[],a._onseek=i.onseek?[{fn:i.onseek}]:[],a._onunlock=i.onunlock?[{fn:i.onunlock}]:[],a._onresume=[],a._webAudio=t.usingWebAudio&&!a._html5,typeof t.ctx<"u"&&t.ctx&&t.autoUnlock&&t._unlockAudio(),t._howls.push(a),a._autoplay&&a._queue.push({event:"play",action:function(){a.play()}}),a._preload&&a._preload!=="none"&&a.load(),a},load:function(){var i=this,a=null;if(t.noAudio){i._emit("loaderror",null,"No audio support.");return}typeof i._src=="string"&&(i._src=[i._src]);for(var f=0;f<i._src.length;f++){var g,A;if(i._format&&i._format[f])g=i._format[f];else{if(A=i._src[f],typeof A!="string"){i._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}g=/^data:audio\/([^;,]+);/i.exec(A),g||(g=/\.([^.]+)$/.exec(A.split("?",1)[0])),g&&(g=g[1].toLowerCase())}if(g||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),g&&t.codecs(g)){a=i._src[f];break}}if(!a){i._emit("loaderror",null,"No codec support for selected audio sources.");return}return i._src=a,i._state="loading",window.location.protocol==="https:"&&a.slice(0,5)==="http:"&&(i._html5=!0,i._webAudio=!1),new s(i),i._webAudio&&r(i),i},play:function(i,a){var f=this,g=null;if(typeof i=="number")g=i,i=null;else{if(typeof i=="string"&&f._state==="loaded"&&!f._sprite[i])return null;if(typeof i>"u"&&(i="__default",!f._playLock)){for(var A=0,p=0;p<f._sounds.length;p++)f._sounds[p]._paused&&!f._sounds[p]._ended&&(A++,g=f._sounds[p]._id);A===1?i=null:g=null}}var m=g?f._soundById(g):f._inactiveSound();if(!m)return null;if(g&&!i&&(i=m._sprite||"__default"),f._state!=="loaded"){m._sprite=i,m._ended=!1;var _=m._id;return f._queue.push({event:"play",action:function(){f.play(_)}}),_}if(g&&!m._paused)return a||f._loadQueue("play"),m._id;f._webAudio&&t._autoResume();var x=Math.max(0,m._seek>0?m._seek:f._sprite[i][0]/1e3),y=Math.max(0,(f._sprite[i][0]+f._sprite[i][1])/1e3-x),w=y*1e3/Math.abs(m._rate),v=f._sprite[i][0]/1e3,T=(f._sprite[i][0]+f._sprite[i][1])/1e3;m._sprite=i,m._ended=!1;var b=function(){m._paused=!1,m._seek=x,m._start=v,m._stop=T,m._loop=!!(m._loop||f._sprite[i][2])};if(x>=T){f._ended(m);return}var E=m._node;if(f._webAudio){var M=function(){f._playLock=!1,b(),f._refreshBuffer(m);var R=m._muted||f._muted?0:m._volume;E.gain.setValueAtTime(R,t.ctx.currentTime),m._playStart=t.ctx.currentTime,typeof E.bufferSource.start>"u"?m._loop?E.bufferSource.noteGrainOn(0,x,86400):E.bufferSource.noteGrainOn(0,x,y):m._loop?E.bufferSource.start(0,x,86400):E.bufferSource.start(0,x,y),w!==1/0&&(f._endTimers[m._id]=setTimeout(f._ended.bind(f,m),w)),a||setTimeout(function(){f._emit("play",m._id),f._loadQueue()},0)};t.state==="running"&&t.ctx.state!=="interrupted"?M():(f._playLock=!0,f.once("resume",M),f._clearTimer(m._id))}else{var C=function(){E.currentTime=x,E.muted=m._muted||f._muted||t._muted||E.muted,E.volume=m._volume*t.volume(),E.playbackRate=m._rate;try{var R=E.play();if(R&&typeof Promise<"u"&&(R instanceof Promise||typeof R.then=="function")?(f._playLock=!0,b(),R.then(function(){f._playLock=!1,E._unlocked=!0,a?f._loadQueue():f._emit("play",m._id)}).catch(function(){f._playLock=!1,f._emit("playerror",m._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),m._ended=!0,m._paused=!0})):a||(f._playLock=!1,b(),f._emit("play",m._id)),E.playbackRate=m._rate,E.paused){f._emit("playerror",m._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");return}i!=="__default"||m._loop?f._endTimers[m._id]=setTimeout(f._ended.bind(f,m),w):(f._endTimers[m._id]=function(){f._ended(m),E.removeEventListener("ended",f._endTimers[m._id],!1)},E.addEventListener("ended",f._endTimers[m._id],!1))}catch(L){f._emit("playerror",m._id,L)}};E.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(E.src=f._src,E.load());var I=window&&window.ejecta||!E.readyState&&t._navigator.isCocoonJS;if(E.readyState>=3||I)C();else{f._playLock=!0,f._state="loading";var B=function(){f._state="loaded",C(),E.removeEventListener(t._canPlayEvent,B,!1)};E.addEventListener(t._canPlayEvent,B,!1),f._clearTimer(m._id)}}return m._id},pause:function(i){var a=this;if(a._state!=="loaded"||a._playLock)return a._queue.push({event:"pause",action:function(){a.pause(i)}}),a;for(var f=a._getSoundIds(i),g=0;g<f.length;g++){a._clearTimer(f[g]);var A=a._soundById(f[g]);if(A&&!A._paused&&(A._seek=a.seek(f[g]),A._rateSeek=0,A._paused=!0,a._stopFade(f[g]),A._node))if(a._webAudio){if(!A._node.bufferSource)continue;typeof A._node.bufferSource.stop>"u"?A._node.bufferSource.noteOff(0):A._node.bufferSource.stop(0),a._cleanBuffer(A._node)}else(!isNaN(A._node.duration)||A._node.duration===1/0)&&A._node.pause();arguments[1]||a._emit("pause",A?A._id:null)}return a},stop:function(i,a){var f=this;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"stop",action:function(){f.stop(i)}}),f;for(var g=f._getSoundIds(i),A=0;A<g.length;A++){f._clearTimer(g[A]);var p=f._soundById(g[A]);p&&(p._seek=p._start||0,p._rateSeek=0,p._paused=!0,p._ended=!0,f._stopFade(g[A]),p._node&&(f._webAudio?p._node.bufferSource&&(typeof p._node.bufferSource.stop>"u"?p._node.bufferSource.noteOff(0):p._node.bufferSource.stop(0),f._cleanBuffer(p._node)):(!isNaN(p._node.duration)||p._node.duration===1/0)&&(p._node.currentTime=p._start||0,p._node.pause(),p._node.duration===1/0&&f._clearSound(p._node))),a||f._emit("stop",p._id))}return f},mute:function(i,a){var f=this;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"mute",action:function(){f.mute(i,a)}}),f;if(typeof a>"u")if(typeof i=="boolean")f._muted=i;else return f._muted;for(var g=f._getSoundIds(a),A=0;A<g.length;A++){var p=f._soundById(g[A]);p&&(p._muted=i,p._interval&&f._stopFade(p._id),f._webAudio&&p._node?p._node.gain.setValueAtTime(i?0:p._volume,t.ctx.currentTime):p._node&&(p._node.muted=t._muted?!0:i),f._emit("mute",p._id))}return f},volume:function(){var i=this,a=arguments,f,g;if(a.length===0)return i._volume;if(a.length===1||a.length===2&&typeof a[1]>"u"){var A=i._getSoundIds(),p=A.indexOf(a[0]);p>=0?g=parseInt(a[0],10):f=parseFloat(a[0])}else a.length>=2&&(f=parseFloat(a[0]),g=parseInt(a[1],10));var m;if(typeof f<"u"&&f>=0&&f<=1){if(i._state!=="loaded"||i._playLock)return i._queue.push({event:"volume",action:function(){i.volume.apply(i,a)}}),i;typeof g>"u"&&(i._volume=f),g=i._getSoundIds(g);for(var _=0;_<g.length;_++)m=i._soundById(g[_]),m&&(m._volume=f,a[2]||i._stopFade(g[_]),i._webAudio&&m._node&&!m._muted?m._node.gain.setValueAtTime(f,t.ctx.currentTime):m._node&&!m._muted&&(m._node.volume=f*t.volume()),i._emit("volume",m._id))}else return m=g?i._soundById(g):i._sounds[0],m?m._volume:0;return i},fade:function(i,a,f,g){var A=this;if(A._state!=="loaded"||A._playLock)return A._queue.push({event:"fade",action:function(){A.fade(i,a,f,g)}}),A;i=Math.min(Math.max(0,parseFloat(i)),1),a=Math.min(Math.max(0,parseFloat(a)),1),f=parseFloat(f),A.volume(i,g);for(var p=A._getSoundIds(g),m=0;m<p.length;m++){var _=A._soundById(p[m]);if(_){if(g||A._stopFade(p[m]),A._webAudio&&!_._muted){var x=t.ctx.currentTime,y=x+f/1e3;_._volume=i,_._node.gain.setValueAtTime(i,x),_._node.gain.linearRampToValueAtTime(a,y)}A._startFadeInterval(_,i,a,f,p[m],typeof g>"u")}}return A},_startFadeInterval:function(i,a,f,g,A,p){var m=this,_=a,x=f-a,y=Math.abs(x/.01),w=Math.max(4,y>0?g/y:g),v=Date.now();i._fadeTo=f,i._interval=setInterval(function(){var T=(Date.now()-v)/g;v=Date.now(),_+=x*T,_=Math.round(_*100)/100,x<0?_=Math.max(f,_):_=Math.min(f,_),m._webAudio?i._volume=_:m.volume(_,i._id,!0),p&&(m._volume=_),(f<a&&_<=f||f>a&&_>=f)&&(clearInterval(i._interval),i._interval=null,i._fadeTo=null,m.volume(f,i._id),m._emit("fade",i._id))},w)},_stopFade:function(i){var a=this,f=a._soundById(i);return f&&f._interval&&(a._webAudio&&f._node.gain.cancelScheduledValues(t.ctx.currentTime),clearInterval(f._interval),f._interval=null,a.volume(f._fadeTo,i),f._fadeTo=null,a._emit("fade",i)),a},loop:function(){var i=this,a=arguments,f,g,A;if(a.length===0)return i._loop;if(a.length===1)if(typeof a[0]=="boolean")f=a[0],i._loop=f;else return A=i._soundById(parseInt(a[0],10)),A?A._loop:!1;else a.length===2&&(f=a[0],g=parseInt(a[1],10));for(var p=i._getSoundIds(g),m=0;m<p.length;m++)A=i._soundById(p[m]),A&&(A._loop=f,i._webAudio&&A._node&&A._node.bufferSource&&(A._node.bufferSource.loop=f,f&&(A._node.bufferSource.loopStart=A._start||0,A._node.bufferSource.loopEnd=A._stop,i.playing(p[m])&&(i.pause(p[m],!0),i.play(p[m],!0)))));return i},rate:function(){var i=this,a=arguments,f,g;if(a.length===0)g=i._sounds[0]._id;else if(a.length===1){var A=i._getSoundIds(),p=A.indexOf(a[0]);p>=0?g=parseInt(a[0],10):f=parseFloat(a[0])}else a.length===2&&(f=parseFloat(a[0]),g=parseInt(a[1],10));var m;if(typeof f=="number"){if(i._state!=="loaded"||i._playLock)return i._queue.push({event:"rate",action:function(){i.rate.apply(i,a)}}),i;typeof g>"u"&&(i._rate=f),g=i._getSoundIds(g);for(var _=0;_<g.length;_++)if(m=i._soundById(g[_]),m){i.playing(g[_])&&(m._rateSeek=i.seek(g[_]),m._playStart=i._webAudio?t.ctx.currentTime:m._playStart),m._rate=f,i._webAudio&&m._node&&m._node.bufferSource?m._node.bufferSource.playbackRate.setValueAtTime(f,t.ctx.currentTime):m._node&&(m._node.playbackRate=f);var x=i.seek(g[_]),y=(i._sprite[m._sprite][0]+i._sprite[m._sprite][1])/1e3-x,w=y*1e3/Math.abs(m._rate);(i._endTimers[g[_]]||!m._paused)&&(i._clearTimer(g[_]),i._endTimers[g[_]]=setTimeout(i._ended.bind(i,m),w)),i._emit("rate",m._id)}}else return m=i._soundById(g),m?m._rate:i._rate;return i},seek:function(){var i=this,a=arguments,f,g;if(a.length===0)i._sounds.length&&(g=i._sounds[0]._id);else if(a.length===1){var A=i._getSoundIds(),p=A.indexOf(a[0]);p>=0?g=parseInt(a[0],10):i._sounds.length&&(g=i._sounds[0]._id,f=parseFloat(a[0]))}else a.length===2&&(f=parseFloat(a[0]),g=parseInt(a[1],10));if(typeof g>"u")return 0;if(typeof f=="number"&&(i._state!=="loaded"||i._playLock))return i._queue.push({event:"seek",action:function(){i.seek.apply(i,a)}}),i;var m=i._soundById(g);if(m)if(typeof f=="number"&&f>=0){var _=i.playing(g);_&&i.pause(g,!0),m._seek=f,m._ended=!1,i._clearTimer(g),!i._webAudio&&m._node&&!isNaN(m._node.duration)&&(m._node.currentTime=f);var x=function(){_&&i.play(g,!0),i._emit("seek",g)};if(_&&!i._webAudio){var y=function(){i._playLock?setTimeout(y,0):x()};setTimeout(y,0)}else x()}else if(i._webAudio){var w=i.playing(g)?t.ctx.currentTime-m._playStart:0,v=m._rateSeek?m._rateSeek-m._seek:0;return m._seek+(v+w*Math.abs(m._rate))}else return m._node.currentTime;return i},playing:function(i){var a=this;if(typeof i=="number"){var f=a._soundById(i);return f?!f._paused:!1}for(var g=0;g<a._sounds.length;g++)if(!a._sounds[g]._paused)return!0;return!1},duration:function(i){var a=this,f=a._duration,g=a._soundById(i);return g&&(f=a._sprite[g._sprite][1]/1e3),f},state:function(){return this._state},unload:function(){for(var i=this,a=i._sounds,f=0;f<a.length;f++)a[f]._paused||i.stop(a[f]._id),i._webAudio||(i._clearSound(a[f]._node),a[f]._node.removeEventListener("error",a[f]._errorFn,!1),a[f]._node.removeEventListener(t._canPlayEvent,a[f]._loadFn,!1),a[f]._node.removeEventListener("ended",a[f]._endFn,!1),t._releaseHtml5Audio(a[f]._node)),delete a[f]._node,i._clearTimer(a[f]._id);var g=t._howls.indexOf(i);g>=0&&t._howls.splice(g,1);var A=!0;for(f=0;f<t._howls.length;f++)if(t._howls[f]._src===i._src||i._src.indexOf(t._howls[f]._src)>=0){A=!1;break}return o&&A&&delete o[i._src],t.noAudio=!1,i._state="unloaded",i._sounds=[],i=null,null},on:function(i,a,f,g){var A=this,p=A["_on"+i];return typeof a=="function"&&p.push(g?{id:f,fn:a,once:g}:{id:f,fn:a}),A},off:function(i,a,f){var g=this,A=g["_on"+i],p=0;if(typeof a=="number"&&(f=a,a=null),a||f)for(p=0;p<A.length;p++){var m=f===A[p].id;if(a===A[p].fn&&m||!a&&m){A.splice(p,1);break}}else if(i)g["_on"+i]=[];else{var _=Object.keys(g);for(p=0;p<_.length;p++)_[p].indexOf("_on")===0&&Array.isArray(g[_[p]])&&(g[_[p]]=[])}return g},once:function(i,a,f){var g=this;return g.on(i,a,f,1),g},_emit:function(i,a,f){for(var g=this,A=g["_on"+i],p=A.length-1;p>=0;p--)(!A[p].id||A[p].id===a||i==="load")&&(setTimeout((function(m){m.call(this,a,f)}).bind(g,A[p].fn),0),A[p].once&&g.off(i,A[p].fn,A[p].id));return g._loadQueue(i),g},_loadQueue:function(i){var a=this;if(a._queue.length>0){var f=a._queue[0];f.event===i&&(a._queue.shift(),a._loadQueue()),i||f.action()}return a},_ended:function(i){var a=this,f=i._sprite;if(!a._webAudio&&i._node&&!i._node.paused&&!i._node.ended&&i._node.currentTime<i._stop)return setTimeout(a._ended.bind(a,i),100),a;var g=!!(i._loop||a._sprite[f][2]);if(a._emit("end",i._id),!a._webAudio&&g&&a.stop(i._id,!0).play(i._id),a._webAudio&&g){a._emit("play",i._id),i._seek=i._start||0,i._rateSeek=0,i._playStart=t.ctx.currentTime;var A=(i._stop-i._start)*1e3/Math.abs(i._rate);a._endTimers[i._id]=setTimeout(a._ended.bind(a,i),A)}return a._webAudio&&!g&&(i._paused=!0,i._ended=!0,i._seek=i._start||0,i._rateSeek=0,a._clearTimer(i._id),a._cleanBuffer(i._node),t._autoSuspend()),!a._webAudio&&!g&&a.stop(i._id,!0),a},_clearTimer:function(i){var a=this;if(a._endTimers[i]){if(typeof a._endTimers[i]!="function")clearTimeout(a._endTimers[i]);else{var f=a._soundById(i);f&&f._node&&f._node.removeEventListener("ended",a._endTimers[i],!1)}delete a._endTimers[i]}return a},_soundById:function(i){for(var a=this,f=0;f<a._sounds.length;f++)if(i===a._sounds[f]._id)return a._sounds[f];return null},_inactiveSound:function(){var i=this;i._drain();for(var a=0;a<i._sounds.length;a++)if(i._sounds[a]._ended)return i._sounds[a].reset();return new s(i)},_drain:function(){var i=this,a=i._pool,f=0,g=0;if(!(i._sounds.length<a)){for(g=0;g<i._sounds.length;g++)i._sounds[g]._ended&&f++;for(g=i._sounds.length-1;g>=0;g--){if(f<=a)return;i._sounds[g]._ended&&(i._webAudio&&i._sounds[g]._node&&i._sounds[g]._node.disconnect(0),i._sounds.splice(g,1),f--)}}},_getSoundIds:function(i){var a=this;if(typeof i>"u"){for(var f=[],g=0;g<a._sounds.length;g++)f.push(a._sounds[g]._id);return f}else return[i]},_refreshBuffer:function(i){var a=this;return i._node.bufferSource=t.ctx.createBufferSource(),i._node.bufferSource.buffer=o[a._src],i._panner?i._node.bufferSource.connect(i._panner):i._node.bufferSource.connect(i._node),i._node.bufferSource.loop=i._loop,i._loop&&(i._node.bufferSource.loopStart=i._start||0,i._node.bufferSource.loopEnd=i._stop||0),i._node.bufferSource.playbackRate.setValueAtTime(i._rate,t.ctx.currentTime),a},_cleanBuffer:function(i){var a=this,f=t._navigator&&t._navigator.vendor.indexOf("Apple")>=0;if(!i.bufferSource)return a;if(t._scratchBuffer&&i.bufferSource&&(i.bufferSource.onended=null,i.bufferSource.disconnect(0),f))try{i.bufferSource.buffer=t._scratchBuffer}catch{}return i.bufferSource=null,a},_clearSound:function(i){var a=/MSIE |Trident\//.test(t._navigator&&t._navigator.userAgent);a||(i.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var s=function(i){this._parent=i,this.init()};s.prototype={init:function(){var i=this,a=i._parent;return i._muted=a._muted,i._loop=a._loop,i._volume=a._volume,i._rate=a._rate,i._seek=0,i._paused=!0,i._ended=!0,i._sprite="__default",i._id=++t._counter,a._sounds.push(i),i.create(),i},create:function(){var i=this,a=i._parent,f=t._muted||i._muted||i._parent._muted?0:i._volume;return a._webAudio?(i._node=typeof t.ctx.createGain>"u"?t.ctx.createGainNode():t.ctx.createGain(),i._node.gain.setValueAtTime(f,t.ctx.currentTime),i._node.paused=!0,i._node.connect(t.masterGain)):t.noAudio||(i._node=t._obtainHtml5Audio(),i._errorFn=i._errorListener.bind(i),i._node.addEventListener("error",i._errorFn,!1),i._loadFn=i._loadListener.bind(i),i._node.addEventListener(t._canPlayEvent,i._loadFn,!1),i._endFn=i._endListener.bind(i),i._node.addEventListener("ended",i._endFn,!1),i._node.src=a._src,i._node.preload=a._preload===!0?"auto":a._preload,i._node.volume=f*t.volume(),i._node.load()),i},reset:function(){var i=this,a=i._parent;return i._muted=a._muted,i._loop=a._loop,i._volume=a._volume,i._rate=a._rate,i._seek=0,i._rateSeek=0,i._paused=!0,i._ended=!0,i._sprite="__default",i._id=++t._counter,i},_errorListener:function(){var i=this;i._parent._emit("loaderror",i._id,i._node.error?i._node.error.code:0),i._node.removeEventListener("error",i._errorFn,!1)},_loadListener:function(){var i=this,a=i._parent;a._duration=Math.ceil(i._node.duration*10)/10,Object.keys(a._sprite).length===0&&(a._sprite={__default:[0,a._duration*1e3]}),a._state!=="loaded"&&(a._state="loaded",a._emit("load"),a._loadQueue()),i._node.removeEventListener(t._canPlayEvent,i._loadFn,!1)},_endListener:function(){var i=this,a=i._parent;a._duration===1/0&&(a._duration=Math.ceil(i._node.duration*10)/10,a._sprite.__default[1]===1/0&&(a._sprite.__default[1]=a._duration*1e3),a._ended(i)),i._node.removeEventListener("ended",i._endFn,!1)}};var o={},r=function(i){var a=i._src;if(o[a]){i._duration=o[a].duration,h(i);return}if(/^data:[^;]+;base64,/.test(a)){for(var f=atob(a.split(",")[1]),g=new Uint8Array(f.length),A=0;A<f.length;++A)g[A]=f.charCodeAt(A);c(g.buffer,i)}else{var p=new XMLHttpRequest;p.open(i._xhr.method,a,!0),p.withCredentials=i._xhr.withCredentials,p.responseType="arraybuffer",i._xhr.headers&&Object.keys(i._xhr.headers).forEach(function(m){p.setRequestHeader(m,i._xhr.headers[m])}),p.onload=function(){var m=(p.status+"")[0];if(m!=="0"&&m!=="2"&&m!=="3"){i._emit("loaderror",null,"Failed loading audio file with status: "+p.status+".");return}c(p.response,i)},p.onerror=function(){i._webAudio&&(i._html5=!0,i._webAudio=!1,i._sounds=[],delete o[a],i.load())},l(p)}},l=function(i){try{i.send()}catch{i.onerror()}},c=function(i,a){var f=function(){a._emit("loaderror",null,"Decoding audio data failed.")},g=function(A){A&&a._sounds.length>0?(o[a._src]=A,h(a,A)):f()};typeof Promise<"u"&&t.ctx.decodeAudioData.length===1?t.ctx.decodeAudioData(i).then(g).catch(f):t.ctx.decodeAudioData(i,g,f)},h=function(i,a){a&&!i._duration&&(i._duration=a.duration),Object.keys(i._sprite).length===0&&(i._sprite={__default:[0,i._duration*1e3]}),i._state!=="loaded"&&(i._state="loaded",i._emit("load"),i._loadQueue())},d=function(){if(t.usingWebAudio){try{typeof AudioContext<"u"?t.ctx=new AudioContext:typeof webkitAudioContext<"u"?t.ctx=new webkitAudioContext:t.usingWebAudio=!1}catch{t.usingWebAudio=!1}t.ctx||(t.usingWebAudio=!1);var i=/iP(hone|od|ad)/.test(t._navigator&&t._navigator.platform),a=t._navigator&&t._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),f=a?parseInt(a[1],10):null;if(i&&f&&f<9){var g=/safari/.test(t._navigator&&t._navigator.userAgent.toLowerCase());t._navigator&&!g&&(t.usingWebAudio=!1)}t.usingWebAudio&&(t.masterGain=typeof t.ctx.createGain>"u"?t.ctx.createGainNode():t.ctx.createGain(),t.masterGain.gain.setValueAtTime(t._muted?0:t._volume,t.ctx.currentTime),t.masterGain.connect(t.ctx.destination)),t._setup()}};u.Howler=t,u.Howl=n,typeof ht<"u"?(ht.HowlerGlobal=e,ht.Howler=t,ht.Howl=n,ht.Sound=s):typeof window<"u"&&(window.HowlerGlobal=e,window.Howler=t,window.Howl=n,window.Sound=s)})();/*!
|
|
490
|
+
* Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
|
|
491
|
+
*
|
|
492
|
+
* howler.js v2.2.4
|
|
493
|
+
* howlerjs.com
|
|
494
|
+
*
|
|
495
|
+
* (c) 2013-2020, James Simpson of GoldFire Studios
|
|
496
|
+
* goldfirestudios.com
|
|
497
|
+
*
|
|
498
|
+
* MIT License
|
|
499
|
+
*/(function(){HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var s=n._howls.length-1;s>=0;s--)n._howls[s].stereo(t);return n},HowlerGlobal.prototype.pos=function(t,n,s){var o=this;if(!o.ctx||!o.ctx.listener)return o;if(n=typeof n!="number"?o._pos[1]:n,s=typeof s!="number"?o._pos[2]:s,typeof t=="number")o._pos=[t,n,s],typeof o.ctx.listener.positionX<"u"?(o.ctx.listener.positionX.setTargetAtTime(o._pos[0],Howler.ctx.currentTime,.1),o.ctx.listener.positionY.setTargetAtTime(o._pos[1],Howler.ctx.currentTime,.1),o.ctx.listener.positionZ.setTargetAtTime(o._pos[2],Howler.ctx.currentTime,.1)):o.ctx.listener.setPosition(o._pos[0],o._pos[1],o._pos[2]);else return o._pos;return o},HowlerGlobal.prototype.orientation=function(t,n,s,o,r,l){var c=this;if(!c.ctx||!c.ctx.listener)return c;var h=c._orientation;if(n=typeof n!="number"?h[1]:n,s=typeof s!="number"?h[2]:s,o=typeof o!="number"?h[3]:o,r=typeof r!="number"?h[4]:r,l=typeof l!="number"?h[5]:l,typeof t=="number")c._orientation=[t,n,s,o,r,l],typeof c.ctx.listener.forwardX<"u"?(c.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),c.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),c.ctx.listener.forwardZ.setTargetAtTime(s,Howler.ctx.currentTime,.1),c.ctx.listener.upX.setTargetAtTime(o,Howler.ctx.currentTime,.1),c.ctx.listener.upY.setTargetAtTime(r,Howler.ctx.currentTime,.1),c.ctx.listener.upZ.setTargetAtTime(l,Howler.ctx.currentTime,.1)):c.ctx.listener.setOrientation(t,n,s,o,r,l);else return h;return c},Howl.prototype.init=function(t){return function(n){var s=this;return s._orientation=n.orientation||[1,0,0],s._stereo=n.stereo||null,s._pos=n.pos||null,s._pannerAttr={coneInnerAngle:typeof n.coneInnerAngle<"u"?n.coneInnerAngle:360,coneOuterAngle:typeof n.coneOuterAngle<"u"?n.coneOuterAngle:360,coneOuterGain:typeof n.coneOuterGain<"u"?n.coneOuterGain:0,distanceModel:typeof n.distanceModel<"u"?n.distanceModel:"inverse",maxDistance:typeof n.maxDistance<"u"?n.maxDistance:1e4,panningModel:typeof n.panningModel<"u"?n.panningModel:"HRTF",refDistance:typeof n.refDistance<"u"?n.refDistance:1,rolloffFactor:typeof n.rolloffFactor<"u"?n.rolloffFactor:1},s._onstereo=n.onstereo?[{fn:n.onstereo}]:[],s._onpos=n.onpos?[{fn:n.onpos}]:[],s._onorientation=n.onorientation?[{fn:n.onorientation}]:[],t.call(this,n)}}(Howl.prototype.init),Howl.prototype.stereo=function(t,n){var s=this;if(!s._webAudio)return s;if(s._state!=="loaded")return s._queue.push({event:"stereo",action:function(){s.stereo(t,n)}}),s;var o=typeof Howler.ctx.createStereoPanner>"u"?"spatial":"stereo";if(typeof n>"u")if(typeof t=="number")s._stereo=t,s._pos=[t,0,0];else return s._stereo;for(var r=s._getSoundIds(n),l=0;l<r.length;l++){var c=s._soundById(r[l]);if(c)if(typeof t=="number")c._stereo=t,c._pos=[t,0,0],c._node&&(c._pannerAttr.panningModel="equalpower",(!c._panner||!c._panner.pan)&&e(c,o),o==="spatial"?typeof c._panner.positionX<"u"?(c._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),c._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),c._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):c._panner.setPosition(t,0,0):c._panner.pan.setValueAtTime(t,Howler.ctx.currentTime)),s._emit("stereo",c._id);else return c._stereo}return s},Howl.prototype.pos=function(t,n,s,o){var r=this;if(!r._webAudio)return r;if(r._state!=="loaded")return r._queue.push({event:"pos",action:function(){r.pos(t,n,s,o)}}),r;if(n=typeof n!="number"?0:n,s=typeof s!="number"?-.5:s,typeof o>"u")if(typeof t=="number")r._pos=[t,n,s];else return r._pos;for(var l=r._getSoundIds(o),c=0;c<l.length;c++){var h=r._soundById(l[c]);if(h)if(typeof t=="number")h._pos=[t,n,s],h._node&&((!h._panner||h._panner.pan)&&e(h,"spatial"),typeof h._panner.positionX<"u"?(h._panner.positionX.setValueAtTime(t,Howler.ctx.currentTime),h._panner.positionY.setValueAtTime(n,Howler.ctx.currentTime),h._panner.positionZ.setValueAtTime(s,Howler.ctx.currentTime)):h._panner.setPosition(t,n,s)),r._emit("pos",h._id);else return h._pos}return r},Howl.prototype.orientation=function(t,n,s,o){var r=this;if(!r._webAudio)return r;if(r._state!=="loaded")return r._queue.push({event:"orientation",action:function(){r.orientation(t,n,s,o)}}),r;if(n=typeof n!="number"?r._orientation[1]:n,s=typeof s!="number"?r._orientation[2]:s,typeof o>"u")if(typeof t=="number")r._orientation=[t,n,s];else return r._orientation;for(var l=r._getSoundIds(o),c=0;c<l.length;c++){var h=r._soundById(l[c]);if(h)if(typeof t=="number")h._orientation=[t,n,s],h._node&&(h._panner||(h._pos||(h._pos=r._pos||[0,0,-.5]),e(h,"spatial")),typeof h._panner.orientationX<"u"?(h._panner.orientationX.setValueAtTime(t,Howler.ctx.currentTime),h._panner.orientationY.setValueAtTime(n,Howler.ctx.currentTime),h._panner.orientationZ.setValueAtTime(s,Howler.ctx.currentTime)):h._panner.setOrientation(t,n,s)),r._emit("orientation",h._id);else return h._orientation}return r},Howl.prototype.pannerAttr=function(){var t=this,n=arguments,s,o,r;if(!t._webAudio)return t;if(n.length===0)return t._pannerAttr;if(n.length===1)if(typeof n[0]=="object")s=n[0],typeof o>"u"&&(s.pannerAttr||(s.pannerAttr={coneInnerAngle:s.coneInnerAngle,coneOuterAngle:s.coneOuterAngle,coneOuterGain:s.coneOuterGain,distanceModel:s.distanceModel,maxDistance:s.maxDistance,refDistance:s.refDistance,rolloffFactor:s.rolloffFactor,panningModel:s.panningModel}),t._pannerAttr={coneInnerAngle:typeof s.pannerAttr.coneInnerAngle<"u"?s.pannerAttr.coneInnerAngle:t._coneInnerAngle,coneOuterAngle:typeof s.pannerAttr.coneOuterAngle<"u"?s.pannerAttr.coneOuterAngle:t._coneOuterAngle,coneOuterGain:typeof s.pannerAttr.coneOuterGain<"u"?s.pannerAttr.coneOuterGain:t._coneOuterGain,distanceModel:typeof s.pannerAttr.distanceModel<"u"?s.pannerAttr.distanceModel:t._distanceModel,maxDistance:typeof s.pannerAttr.maxDistance<"u"?s.pannerAttr.maxDistance:t._maxDistance,refDistance:typeof s.pannerAttr.refDistance<"u"?s.pannerAttr.refDistance:t._refDistance,rolloffFactor:typeof s.pannerAttr.rolloffFactor<"u"?s.pannerAttr.rolloffFactor:t._rolloffFactor,panningModel:typeof s.pannerAttr.panningModel<"u"?s.pannerAttr.panningModel:t._panningModel});else return r=t._soundById(parseInt(n[0],10)),r?r._pannerAttr:t._pannerAttr;else n.length===2&&(s=n[0],o=parseInt(n[1],10));for(var l=t._getSoundIds(o),c=0;c<l.length;c++)if(r=t._soundById(l[c]),r){var h=r._pannerAttr;h={coneInnerAngle:typeof s.coneInnerAngle<"u"?s.coneInnerAngle:h.coneInnerAngle,coneOuterAngle:typeof s.coneOuterAngle<"u"?s.coneOuterAngle:h.coneOuterAngle,coneOuterGain:typeof s.coneOuterGain<"u"?s.coneOuterGain:h.coneOuterGain,distanceModel:typeof s.distanceModel<"u"?s.distanceModel:h.distanceModel,maxDistance:typeof s.maxDistance<"u"?s.maxDistance:h.maxDistance,refDistance:typeof s.refDistance<"u"?s.refDistance:h.refDistance,rolloffFactor:typeof s.rolloffFactor<"u"?s.rolloffFactor:h.rolloffFactor,panningModel:typeof s.panningModel<"u"?s.panningModel:h.panningModel};var d=r._panner;d||(r._pos||(r._pos=t._pos||[0,0,-.5]),e(r,"spatial"),d=r._panner),d.coneInnerAngle=h.coneInnerAngle,d.coneOuterAngle=h.coneOuterAngle,d.coneOuterGain=h.coneOuterGain,d.distanceModel=h.distanceModel,d.maxDistance=h.maxDistance,d.refDistance=h.refDistance,d.rolloffFactor=h.rolloffFactor,d.panningModel=h.panningModel}return t},Sound.prototype.init=function(t){return function(){var n=this,s=n._parent;n._orientation=s._orientation,n._stereo=s._stereo,n._pos=s._pos,n._pannerAttr=s._pannerAttr,t.call(this),n._stereo?s.stereo(n._stereo):n._pos&&s.pos(n._pos[0],n._pos[1],n._pos[2],n._id)}}(Sound.prototype.init),Sound.prototype.reset=function(t){return function(){var n=this,s=n._parent;return n._orientation=s._orientation,n._stereo=s._stereo,n._pos=s._pos,n._pannerAttr=s._pannerAttr,n._stereo?s.stereo(n._stereo):n._pos?s.pos(n._pos[0],n._pos[1],n._pos[2],n._id):n._panner&&(n._panner.disconnect(0),n._panner=void 0,s._refreshBuffer(n)),t.call(this)}}(Sound.prototype.reset);var e=function(t,n){n=n||"spatial",n==="spatial"?(t._panner=Howler.ctx.createPanner(),t._panner.coneInnerAngle=t._pannerAttr.coneInnerAngle,t._panner.coneOuterAngle=t._pannerAttr.coneOuterAngle,t._panner.coneOuterGain=t._pannerAttr.coneOuterGain,t._panner.distanceModel=t._pannerAttr.distanceModel,t._panner.maxDistance=t._pannerAttr.maxDistance,t._panner.refDistance=t._pannerAttr.refDistance,t._panner.rolloffFactor=t._pannerAttr.rolloffFactor,t._panner.panningModel=t._pannerAttr.panningModel,typeof t._panner.positionX<"u"?(t._panner.positionX.setValueAtTime(t._pos[0],Howler.ctx.currentTime),t._panner.positionY.setValueAtTime(t._pos[1],Howler.ctx.currentTime),t._panner.positionZ.setValueAtTime(t._pos[2],Howler.ctx.currentTime)):t._panner.setPosition(t._pos[0],t._pos[1],t._pos[2]),typeof t._panner.orientationX<"u"?(t._panner.orientationX.setValueAtTime(t._orientation[0],Howler.ctx.currentTime),t._panner.orientationY.setValueAtTime(t._orientation[1],Howler.ctx.currentTime),t._panner.orientationZ.setValueAtTime(t._orientation[2],Howler.ctx.currentTime)):t._panner.setOrientation(t._orientation[0],t._orientation[1],t._orientation[2])):(t._panner=Howler.ctx.createStereoPanner(),t._panner.pan.setValueAtTime(t._stereo,Howler.ctx.currentTime)),t._panner.connect(t._node),t._paused||t._parent.pause(t._id,!0).play(t._id,!0)}})()})(Zi);const Ro="data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjQxLjEwMAAAAAAAAAAAAAAA//NwwAAAAAAAAAAAAEluZm8AAAAPAAAAFAAACOAAICAgICwsLCwsNzc3NzdDQ0NDQ09PT09PW1tbW1tmZmZmZnJycnJyfn5+fn6KioqKipWVlZWVoaGhoaGtra2trbm5ubm5xcXFxcXQ0NDQ0Nzc3Nzc6Ojo6Oj09PT09P//////AAAAAExhdmM1OC43NQAAAAAAAAAAAAAAACQCwAAAAAAAAAjgTZykiAAAAAAAAAAAAAAAAAD/80DEABJhFmQCwwYUIDsKrsHAWBMRyeJYliQJBg5RYsWU/W3z/8OLc/3AAAQiIAIjv+7vUCJXd4jucQABAE3lwffiDBD+JC58oCH8H/1h/WH//1HPwTUMFrULH9ELKxULyTodFKYbO//zQsQRFFkScKDSRhyGWpIFpG91I7Fi/F6D2RWwN6TN/t9CiVSG5wMw74ogYcHoEwTFyMmTf4KkxEwmRfjXIYv1tpIOZRv/3O9ibtjR6gYmbGCgQ+Fk0mfSmybOX1cf78g7D6nP6qxCgf/zQMQbF+EacktaSABfy+3JKszHdMgcwwcl/kNFIuAo0I0DD1fWVs/crTSTTRInof3cmIwyLBwGQqCSLq7hyvtRPBB4aFyyXHov9X///7UXKqoIIcgcHict89/0y+n+nf/C0DIjB/+P//NCxBYZU9q0AYpoAHNyXSLn/+EjEbJclC4eJT//8e5aMAWeE4////wvAyAvYjZLjAD0Lg9D0kCU/////zwwBdJcYAehKBIwtYyx6FyXC4XP//////x7l83NDpfqd6gAcA/+wu9A2FGg//NAxAwXCnsq/5M4AhQKAOwmRvQRhjhOe5S8UkAmVHpU8IVU3lwejjIcayXOOceGwjf+D05I8oAu2x382o1ZHHV//31NU4441lmqcv///+RNGrUJKImnTf//iVYK1UZquoZESSy3egH/80LEChchBtMfyzAAk191v20qimbuNqavb211BthJKSJAG2aucbdLeVFVmRjZEVvzOggIwuUFDgvEZA7UeuUqNMLOraDQ5CVCk5m9BsmT3kbNrBdolcFSsqXGwQTWyYUX2wEDEgKkvZb/80DECRYRUpWsikYY1HXLbDZksYxtCHBShdHt/DgYCOM6r8AmUSpfGZYzH7ARMBCj1JtmY/hmwoGio0XBUShoklC5GsNeDR38RQ6d01DyrENtqp6mCJ5GJUckmpUBaIgYK6C0fPjmUf/zQsQLFil+cajTBhydxPRO4mLMWWSGQF2qa1f3PPlHQDJdzCxnwgkzB1SQohrpNRYRgtobv07tBLUFc27jQdWoQY0JNpiMJy654enBVoqnQR571uq/i9rpL1oAqAupJATLLk5L+QT3Kf/zQMQOE9D2bWFaGACZyWQZdt1rd3OVY8s/y2dBlg0m12PFzdFSlYrboY6gMOE1hJp7iFqmDcopF8F2OKEPnktdThRLoy9iuyj//0vD4+qf///++38OsIIFFhpEFZMC4s+gZmilJz1X//NCxBkaW8allZI4AWPWKBoLFWrwfuYvukbk4Rt9tBuJYOBoWpfzfjQaNMp//+OGEzzzDIif3+n/4PBIEt5hjDc9zxv/////nseeNDHGg0MQwxBEFn//////4TpB9d/s9thcHddpssFg//NAxAsVCT8GX5BAAigUAPBBdOBaKEIpaajR1VyCNH/gAwAfjRX8G7B4zfx0HANA8BpjQ6FhfqKxRBQURleGbrufzJywVGVfRdOzp5///ERCxhb//8wqijBAwUYMBCjVWZsv26uwYU3/80LEERRTIuTLwxABmdQgEBGKFNo9amfRWcpnayOUsKJ/UpWo/qyL////sj1b+pc3oarStSWpf/VP+hlotDN/0MVjKMKDAZGL/Ar8QWpCR0msAoVgrMoeT3xHIZd3qARkQge7hzlejQD/80DEGxPQ5sryeYYUBCI58AEvohe5nAMDcPxAbUxN6VCB4xCid97iaTyonF0l4upInmIpD//V0f/OllFls0vEBipVlYYRWhuzlHgpEiJSRmYJQaiptezfqvKm1PBRJKiq7M3s1yoqKv/zQsQmFBEGuojBkAQdCzTSpHY0FSwdboEQKi7pZN986g7UVOkf5ZR6VdbbQwZ+79PW6VoWdwZqA4VT2QGoxuuO0VZgbATjSNkSqqresUZ4lDGM5tfbuZzGHYfri5YKg0eDjgQjhm0Wpf/zQMQxE1jyoqhoxFD16D4jzQUUULEB1QXZhRIdIbHFtSlSvX5anFh11QTHaABkiBXOXoXxGW9galRr4fRiew3yOag/4HjxOydOM9ZyyokPlRKdFBa0CjY1luBiKXXwLw6oeMWEhjoS//NCxD4TUNKKIJpMJNTRh7nf/3kekmjdSWypy9UZXQgZMDh3pnAWB4O2M6nAaelR4r1OmVPFSwoksiWRUE1zc+f1lPc0ZudtdFDr4LLpoSwwGkpVO+oD6Tlb3HsYL7d+R1//td2LQMNF//NAxEwTaP5xYqJMCFlqIwAbEoCJNDEp9/3itYVbV6Yx/v0nuLdzyy50qHQw3cafmKlb6zBo0yXeRMnQG5J4jE7j4PFAkTSpQ9pexojMMsL0PIqP/Z1Xp/TpnVZZ27eWtNWRSSSyWyz/80LEWRSo1nDhWhgAlsstlkskgADyNOHqG5rlhLnSyI0a5oClU7uw0JnJQq2kTMBUYADEskGQ9wdHohh2xMKnCubKTIdyRgT83NEIrcfJpJOL3fV7l9cyXXJwJRDGpJLTZJF1+3OPUX3/80DEYiVyorJfmlgDRVRdYm21rHJXTVH0+ajd35ouiSF1tVcmLGnFummxbrhsXfHNzcf/2qgd/7XhppiSaYkmmQGRpnCsAMAEB4tQrXVA0VOiINSMWfljtMTHsRdZ3iL/V1neW6zvLf/zQsQnDSAiMFXMGADWd4i6zvEX+W/yzud5ZUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQ==";let Lo=class{constructor(){this.sound=new Zi.Howl({src:[Ro]})}play(){this.sound.play()}};const Ae=u=>{var e,t;for(;u.children.length>0;)Ae(u.children[0]),(e=u.children[0])==null||e.removeFromParent();if(u instanceof fe)try{(t=u.geometry)==null||t.dispose()}catch{}else u.dispose&&u.dispose()};function Po(u){return new S(u[0],u[1],u[2])}function Do(){let u=3,e=Math.max(1/window.devicePixelRatio,.5);return window.innerWidth/window.innerHeight<.65&&(u=4,e=1/window.devicePixelRatio),{tiles:u,renderScale:e}}function No(u){try{const e=u.geometry.attributes.position.array,t=new S(...e);return Oo(t,u.geometry.morphAttributes.position,u.morphTargetInfluences||[])}catch{return new S}}function Oo(u,e,t){const n=u.clone();return e.map(o=>{const r=new S;for(let l=0;l<o.count;l++)r.set(o.getX(l),o.getY(l),o.getZ(l));return r}).forEach((o,r)=>{const l=t[r]||0;n.add(o.clone().multiplyScalar(l))}),n}function Ji(u){let e=!1,t=!1,n=!1,s=1/0,o=1/0,r=1/0,l=-1/0,c=-1/0,h=-1/0,d=0,i=0;return u.traverse(f=>{if(f.isMesh&&f.geometry){const g=f;g.geometry.computeBoundingBox();let A=g.geometry.attributes.position;const p=g.geometry.morphAttributes.position;let m=g.morphTargetInfluences;const _=Object.keys(g.morphTargetDictionary||{});_.includes("width")&&(t=!0),_.includes("length")&&(e=!0),_.includes("height")&&(n=!0);for(let x=0;x<A.count;x++){let y=A.getX(x),w=A.getY(x),v=A.getZ(x);i=Math.max(w,i),p&&m&&p.forEach((b,E)=>{const M=m&&m[E]||0;y+=b.getX(x)*M,w+=b.getY(x)*M,v+=b.getZ(x)*M}),y<s&&(s=y),w<o&&(o=w),v<r&&(r=v),y>l&&(l=y),w>c&&(c=w),v>h&&(h=v);const T=Math.sqrt(y*y+v*v);T>d&&(d=T)}}}),{box:new Q(new S(s,o,r),new S(l,c,h)),maxRadius:d,height:i,hasWidth:t,hasLength:e,hasHeight:n}}function Fo(u,e,t=null){let n=0;return function(){let s=t||this,o=arguments;clearTimeout(n),n=window.setTimeout(function(){u.apply(s,o)},e)}}class ms{constructor(e,t,n){this.length=e,this.width=t,this.height=n}}function Hn(u,e){if(e===Pr)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),u;if(e===js||e===Di){let t=u.getIndex();if(t===null){const r=[],l=u.getAttribute("position");if(l!==void 0){for(let c=0;c<l.count;c++)r.push(c);u.setIndex(r),t=u.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),u}const n=t.count-2,s=[];if(e===js)for(let r=1;r<=n;r++)s.push(t.getX(0)),s.push(t.getX(r)),s.push(t.getX(r+1));else for(let r=0;r<n;r++)r%2===0?(s.push(t.getX(r)),s.push(t.getX(r+1)),s.push(t.getX(r+2))):(s.push(t.getX(r+2)),s.push(t.getX(r+1)),s.push(t.getX(r)));s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=u.clone();return o.setIndex(s),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),u}class ko extends Dr{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Go(t)}),this.register(function(t){return new Qo(t)}),this.register(function(t){return new $o(t)}),this.register(function(t){return new ea(t)}),this.register(function(t){return new ta(t)}),this.register(function(t){return new jo(t)}),this.register(function(t){return new Ko(t)}),this.register(function(t){return new Yo(t)}),this.register(function(t){return new Xo(t)}),this.register(function(t){return new Vo(t)}),this.register(function(t){return new qo(t)}),this.register(function(t){return new Wo(t)}),this.register(function(t){return new Jo(t)}),this.register(function(t){return new Zo(t)}),this.register(function(t){return new zo(t)}),this.register(function(t){return new sa(t)}),this.register(function(t){return new na(t)})}load(e,t,n,s){const o=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const h=Et.extractUrlBase(e);r=Et.resolveURL(h,this.path)}else r=Et.extractUrlBase(e);this.manager.itemStart(e);const l=function(h){s?s(h):console.error(h),o.manager.itemError(e),o.manager.itemEnd(e)},c=new Ni(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(h){try{o.parse(h,r,function(d){t(d),o.manager.itemEnd(e)},l)}catch(d){l(d)}},n,l)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,s){let o;const r={},l={},c=new TextDecoder;if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===$i){try{r[D.KHR_BINARY_GLTF]=new ia(e)}catch(i){s&&s(i);return}o=JSON.parse(r[D.KHR_BINARY_GLTF].content)}else o=JSON.parse(c.decode(e));else o=e;if(o.asset===void 0||o.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const h=new Aa(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const i=this.pluginCallbacks[d](h);i.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),l[i.name]=i,r[i.name]=!0}if(o.extensionsUsed)for(let d=0;d<o.extensionsUsed.length;++d){const i=o.extensionsUsed[d],a=o.extensionsRequired||[];switch(i){case D.KHR_MATERIALS_UNLIT:r[i]=new Ho;break;case D.KHR_DRACO_MESH_COMPRESSION:r[i]=new ra(o,this.dracoLoader);break;case D.KHR_TEXTURE_TRANSFORM:r[i]=new oa;break;case D.KHR_MESH_QUANTIZATION:r[i]=new aa;break;default:a.indexOf(i)>=0&&l[i]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+i+'".')}}h.setExtensions(r),h.setPlugins(l),h.parse(n,s)}parseAsync(e,t){const n=this;return new Promise(function(s,o){n.parse(e,t,s,o)})}}function Uo(){let u={};return{get:function(e){return u[e]},add:function(e,t){u[e]=t},remove:function(e){delete u[e]},removeAll:function(){u={}}}}const D={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class zo{constructor(e){this.parser=e,this.name=D.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,s=t.length;n<s;n++){const o=t[n];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let s=t.cache.get(n);if(s)return s;const o=t.json,c=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let h;const d=new G(16777215);c.color!==void 0&&d.setRGB(c.color[0],c.color[1],c.color[2],_e);const i=c.range!==void 0?c.range:0;switch(c.type){case"directional":h=new Fr(d),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new Or(d),h.distance=i;break;case"spot":h=new Nr(d),h.distance=i,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,h.angle=c.spot.outerConeAngle,h.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return h.position.set(0,0,0),h.decay=2,Be(h,c),c.intensity!==void 0&&(h.intensity=c.intensity),h.name=t.createUniqueName(c.name||"light_"+e),s=Promise.resolve(h),t.cache.add(n,s),s}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,o=n.json.nodes[e],l=(o.extensions&&o.extensions[this.name]||{}).light;return l===void 0?null:this._loadLight(l).then(function(c){return n._getNodeRef(t.cache,l,c)})}}let Ho=class{constructor(){this.name=D.KHR_MATERIALS_UNLIT}getMaterialType(){return ke}extendParams(e,t,n){const s=[];e.color=new G(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const r=o.baseColorFactor;e.color.setRGB(r[0],r[1],r[2],_e),e.opacity=r[3]}o.baseColorTexture!==void 0&&s.push(n.assignTexture(e,"map",o.baseColorTexture,ee))}return Promise.all(s)}},Vo=class{constructor(e){this.parser=e,this.name=D.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=s.extensions[this.name].emissiveStrength;return o!==void 0&&(t.emissiveIntensity=o),Promise.resolve()}},Go=class{constructor(e){this.parser=e,this.name=D.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:de}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],r=s.extensions[this.name];if(r.clearcoatFactor!==void 0&&(t.clearcoat=r.clearcoatFactor),r.clearcoatTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatMap",r.clearcoatTexture)),r.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=r.clearcoatRoughnessFactor),r.clearcoatRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),r.clearcoatNormalTexture!==void 0&&(o.push(n.assignTexture(t,"clearcoatNormalMap",r.clearcoatNormalTexture)),r.clearcoatNormalTexture.scale!==void 0)){const l=r.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new N(l,l)}return Promise.all(o)}},Qo=class{constructor(e){this.parser=e,this.name=D.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:de}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=s.extensions[this.name];return t.dispersion=o.dispersion!==void 0?o.dispersion:0,Promise.resolve()}},Wo=class{constructor(e){this.parser=e,this.name=D.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:de}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],r=s.extensions[this.name];return r.iridescenceFactor!==void 0&&(t.iridescence=r.iridescenceFactor),r.iridescenceTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceMap",r.iridescenceTexture)),r.iridescenceIor!==void 0&&(t.iridescenceIOR=r.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),r.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=r.iridescenceThicknessMinimum),r.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=r.iridescenceThicknessMaximum),r.iridescenceThicknessTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceThicknessMap",r.iridescenceThicknessTexture)),Promise.all(o)}},jo=class{constructor(e){this.parser=e,this.name=D.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:de}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new G(0,0,0),t.sheenRoughness=0,t.sheen=1;const r=s.extensions[this.name];if(r.sheenColorFactor!==void 0){const l=r.sheenColorFactor;t.sheenColor.setRGB(l[0],l[1],l[2],_e)}return r.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=r.sheenRoughnessFactor),r.sheenColorTexture!==void 0&&o.push(n.assignTexture(t,"sheenColorMap",r.sheenColorTexture,ee)),r.sheenRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"sheenRoughnessMap",r.sheenRoughnessTexture)),Promise.all(o)}},Ko=class{constructor(e){this.parser=e,this.name=D.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:de}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],r=s.extensions[this.name];return r.transmissionFactor!==void 0&&(t.transmission=r.transmissionFactor),r.transmissionTexture!==void 0&&o.push(n.assignTexture(t,"transmissionMap",r.transmissionTexture)),Promise.all(o)}},Yo=class{constructor(e){this.parser=e,this.name=D.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:de}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],r=s.extensions[this.name];t.thickness=r.thicknessFactor!==void 0?r.thicknessFactor:0,r.thicknessTexture!==void 0&&o.push(n.assignTexture(t,"thicknessMap",r.thicknessTexture)),t.attenuationDistance=r.attenuationDistance||1/0;const l=r.attenuationColor||[1,1,1];return t.attenuationColor=new G().setRGB(l[0],l[1],l[2],_e),Promise.all(o)}},Xo=class{constructor(e){this.parser=e,this.name=D.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:de}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=s.extensions[this.name];return t.ior=o.ior!==void 0?o.ior:1.5,Promise.resolve()}},qo=class{constructor(e){this.parser=e,this.name=D.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:de}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],r=s.extensions[this.name];t.specularIntensity=r.specularFactor!==void 0?r.specularFactor:1,r.specularTexture!==void 0&&o.push(n.assignTexture(t,"specularIntensityMap",r.specularTexture));const l=r.specularColorFactor||[1,1,1];return t.specularColor=new G().setRGB(l[0],l[1],l[2],_e),r.specularColorTexture!==void 0&&o.push(n.assignTexture(t,"specularColorMap",r.specularColorTexture,ee)),Promise.all(o)}},Zo=class{constructor(e){this.parser=e,this.name=D.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:de}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],r=s.extensions[this.name];return t.bumpScale=r.bumpFactor!==void 0?r.bumpFactor:1,r.bumpTexture!==void 0&&o.push(n.assignTexture(t,"bumpMap",r.bumpTexture)),Promise.all(o)}},Jo=class{constructor(e){this.parser=e,this.name=D.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:de}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],r=s.extensions[this.name];return r.anisotropyStrength!==void 0&&(t.anisotropy=r.anisotropyStrength),r.anisotropyRotation!==void 0&&(t.anisotropyRotation=r.anisotropyRotation),r.anisotropyTexture!==void 0&&o.push(n.assignTexture(t,"anisotropyMap",r.anisotropyTexture)),Promise.all(o)}};class $o{constructor(e){this.parser=e,this.name=D.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,s=n.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const o=s.extensions[this.name],r=t.options.ktx2Loader;if(!r){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,r)}}class ea{constructor(e){this.parser=e,this.name=D.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,s=n.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const r=o.extensions[t],l=s.images[r.source];let c=n.textureLoader;if(l.uri){const h=n.options.manager.getHandler(l.uri);h!==null&&(c=h)}return this.detectSupport().then(function(h){if(h)return n.loadTextureImage(e,r.source,c);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class ta{constructor(e){this.parser=e,this.name=D.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,s=n.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const r=o.extensions[t],l=s.images[r.source];let c=n.textureLoader;if(l.uri){const h=n.options.manager.getHandler(l.uri);h!==null&&(c=h)}return this.detectSupport().then(function(h){if(h)return n.loadTextureImage(e,r.source,c);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class sa{constructor(e){this.name=D.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const s=n.extensions[this.name],o=this.parser.getDependency("buffer",s.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(l){const c=s.byteOffset||0,h=s.byteLength||0,d=s.count,i=s.byteStride,a=new Uint8Array(l,c,h);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(d,i,a,s.mode,s.filter).then(function(f){return f.buffer}):r.ready.then(function(){const f=new ArrayBuffer(d*i);return r.decodeGltfBuffer(new Uint8Array(f),d,i,a,s.mode,s.filter),f})})}else return null}}let na=class{constructor(e){this.name=D.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const s=t.meshes[n.mesh];for(const h of s.primitives)if(h.mode!==$.TRIANGLES&&h.mode!==$.TRIANGLE_STRIP&&h.mode!==$.TRIANGLE_FAN&&h.mode!==void 0)return null;const r=n.extensions[this.name].attributes,l=[],c={};for(const h in r)l.push(this.parser.getDependency("accessor",r[h]).then(d=>(c[h]=d,c[h])));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then(h=>{const d=h.pop(),i=d.isGroup?d.children:[d],a=h[0].count,f=[];for(const g of i){const A=new V,p=new S,m=new hs,_=new S(1,1,1),x=new kr(g.geometry,g.material,a);for(let y=0;y<a;y++)c.TRANSLATION&&p.fromBufferAttribute(c.TRANSLATION,y),c.ROTATION&&m.fromBufferAttribute(c.ROTATION,y),c.SCALE&&_.fromBufferAttribute(c.SCALE,y),x.setMatrixAt(y,A.compose(p,m,_));for(const y in c)if(y==="_COLOR_0"){const w=c[y];x.instanceColor=new Ur(w.array,w.itemSize,w.normalized)}else y!=="TRANSLATION"&&y!=="ROTATION"&&y!=="SCALE"&&g.geometry.setAttribute(y,c[y]);ye.prototype.copy.call(x,g),this.parser.assignFinalMaterial(x),f.push(x)}return d.isGroup?(d.clear(),d.add(...f),d):f[0]}))}};const $i="glTF",dt=12,Vn={JSON:1313821514,BIN:5130562};class ia{constructor(e){this.name=D.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,dt),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==$i)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-dt,o=new DataView(e,dt);let r=0;for(;r<s;){const l=o.getUint32(r,!0);r+=4;const c=o.getUint32(r,!0);if(r+=4,c===Vn.JSON){const h=new Uint8Array(e,dt+r,l);this.content=n.decode(h)}else if(c===Vn.BIN){const h=dt+r;this.body=e.slice(h,h+l)}r+=l}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class ra{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=D.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,s=this.dracoLoader,o=e.extensions[this.name].bufferView,r=e.extensions[this.name].attributes,l={},c={},h={};for(const d in r){const i=Ys[d]||d.toLowerCase();l[i]=r[d]}for(const d in e.attributes){const i=Ys[d]||d.toLowerCase();if(r[d]!==void 0){const a=n.accessors[e.attributes[d]],f=rt[a.componentType];h[i]=f.name,c[i]=a.normalized===!0}}return t.getDependency("bufferView",o).then(function(d){return new Promise(function(i,a){s.decodeDracoFile(d,function(f){for(const g in f.attributes){const A=f.attributes[g],p=c[g];p!==void 0&&(A.normalized=p)}i(f)},l,h,_e,a)})})}}class oa{constructor(){this.name=D.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class aa{constructor(){this.name=D.KHR_MESH_QUANTIZATION}}class er extends Zr{constructor(e,t,n,s){super(e,t,n,s)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,o=e*s*3+s;for(let r=0;r!==s;r++)t[r]=n[o+r];return t}interpolate_(e,t,n,s){const o=this.resultBuffer,r=this.sampleValues,l=this.valueSize,c=l*2,h=l*3,d=s-t,i=(n-t)/d,a=i*i,f=a*i,g=e*h,A=g-h,p=-2*f+3*a,m=f-a,_=1-p,x=m-a+i;for(let y=0;y!==l;y++){const w=r[A+y+l],v=r[A+y+c]*d,T=r[g+y+l],b=r[g+y]*d;o[y]=_*w+x*v+p*T+m*b}return o}}const la=new hs;class ca extends er{interpolate_(e,t,n,s){const o=super.interpolate_(e,t,n,s);return la.fromArray(o).normalize().toArray(o),o}}const $={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},rt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Gn={9728:ki,9729:Ct,9984:Ui,9985:zi,9986:Hi,9987:fn},Qn={33071:Vi,33648:Gi,10497:ns},vs={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ys={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},ve={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},ua={CUBICSPLINE:void 0,LINEAR:gn,STEP:Qi},Ts={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function fa(u){return u.DefaultMaterial===void 0&&(u.DefaultMaterial=new ds({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Ks})),u.DefaultMaterial}function Oe(u,e,t){for(const n in t.extensions)u[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function Be(u,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(u.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function ha(u,e,t){let n=!1,s=!1,o=!1;for(let h=0,d=e.length;h<d;h++){const i=e[h];if(i.POSITION!==void 0&&(n=!0),i.NORMAL!==void 0&&(s=!0),i.COLOR_0!==void 0&&(o=!0),n&&s&&o)break}if(!n&&!s&&!o)return Promise.resolve(u);const r=[],l=[],c=[];for(let h=0,d=e.length;h<d;h++){const i=e[h];if(n){const a=i.POSITION!==void 0?t.getDependency("accessor",i.POSITION):u.attributes.position;r.push(a)}if(s){const a=i.NORMAL!==void 0?t.getDependency("accessor",i.NORMAL):u.attributes.normal;l.push(a)}if(o){const a=i.COLOR_0!==void 0?t.getDependency("accessor",i.COLOR_0):u.attributes.color;c.push(a)}}return Promise.all([Promise.all(r),Promise.all(l),Promise.all(c)]).then(function(h){const d=h[0],i=h[1],a=h[2];return n&&(u.morphAttributes.position=d),s&&(u.morphAttributes.normal=i),o&&(u.morphAttributes.color=a),u.morphTargetsRelative=!0,u})}function da(u,e){if(u.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)u.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(u.morphTargetInfluences.length===t.length){u.morphTargetDictionary={};for(let n=0,s=t.length;n<s;n++)u.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function pa(u){let e;const t=u.extensions&&u.extensions[D.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Es(t.attributes):e=u.indices+":"+Es(u.attributes)+":"+u.mode,u.targets!==void 0)for(let n=0,s=u.targets.length;n<s;n++)e+=":"+Es(u.targets[n]);return e}function Es(u){let e="";const t=Object.keys(u).sort();for(let n=0,s=t.length;n<s;n++)e+=t[n]+":"+u[t[n]]+";";return e}function Xs(u){switch(u){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function ga(u){return u.search(/\.jpe?g($|\?)/i)>0||u.search(/^data\:image\/jpeg/)===0?"image/jpeg":u.search(/\.webp($|\?)/i)>0||u.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const ma=new V;class Aa{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Uo,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,s=!1,o=-1;typeof navigator<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,s=navigator.userAgent.indexOf("Firefox")>-1,o=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||s&&o<98?this.textureLoader=new Oi(this.options.manager):this.textureLoader=new zr(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Ni(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,s=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(r){const l={scene:r[0][s.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:s.asset,parser:n,userData:{}};return Oe(o,l,s),Be(l,s),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(l)})).then(function(){for(const c of l.scenes)c.updateMatrixWorld();e(l)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let s=0,o=t.length;s<o;s++){const r=t[s].joints;for(let l=0,c=r.length;l<c;l++)e[r[l]].isBone=!0}for(let s=0,o=e.length;s<o;s++){const r=e[s];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const s=n.clone(),o=(r,l)=>{const c=this.associations.get(r);c!=null&&this.associations.set(l,c);for(const[h,d]of r.children.entries())o(d,l.children[h])};return o(n,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const s=e(t[n]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let s=0;s<t.length;s++){const o=e(t[s]);o&&n.push(o)}return n}getDependency(e,t){const n=e+":"+t;let s=this.cache.get(n);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":s=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!s)throw new Error("Unknown type: "+e);break}this.cache.add(n,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,s=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(s.map(function(o,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[D.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(o,r){n.load(Et.resolveURL(t.uri,s.path),o,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const s=t.byteLength||0,o=t.byteOffset||0;return n.slice(o,o+s)})}loadAccessor(e){const t=this,n=this.json,s=this.json.accessors[e];if(s.bufferView===void 0&&s.sparse===void 0){const r=vs[s.type],l=rt[s.componentType],c=s.normalized===!0,h=new l(s.count*r);return Promise.resolve(new K(h,r,c))}const o=[];return s.bufferView!==void 0?o.push(this.getDependency("bufferView",s.bufferView)):o.push(null),s.sparse!==void 0&&(o.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(o).then(function(r){const l=r[0],c=vs[s.type],h=rt[s.componentType],d=h.BYTES_PER_ELEMENT,i=d*c,a=s.byteOffset||0,f=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,g=s.normalized===!0;let A,p;if(f&&f!==i){const m=Math.floor(a/f),_="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+m+":"+s.count;let x=t.cache.get(_);x||(A=new h(l,m*f,s.count*f/d),x=new Hr(A,f/d),t.cache.add(_,x)),p=new qr(x,c,a%f/d,g)}else l===null?A=new h(s.count*c):A=new h(l,a,s.count*c),p=new K(A,c,g);if(s.sparse!==void 0){const m=vs.SCALAR,_=rt[s.sparse.indices.componentType],x=s.sparse.indices.byteOffset||0,y=s.sparse.values.byteOffset||0,w=new _(r[1],x,s.sparse.count*m),v=new h(r[2],y,s.sparse.count*c);l!==null&&(p=new K(p.array.slice(),p.itemSize,p.normalized));for(let T=0,b=w.length;T<b;T++){const E=w[T];if(p.setX(E,v[T*c]),c>=2&&p.setY(E,v[T*c+1]),c>=3&&p.setZ(E,v[T*c+2]),c>=4&&p.setW(E,v[T*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p})}loadTexture(e){const t=this.json,n=this.options,o=t.textures[e].source,r=t.images[o];let l=this.textureLoader;if(r.uri){const c=n.manager.getHandler(r.uri);c!==null&&(l=c)}return this.loadTextureImage(e,o,l)}loadTextureImage(e,t,n){const s=this,o=this.json,r=o.textures[e],l=o.images[t],c=(l.uri||l.bufferView)+":"+r.sampler;if(this.textureCache[c])return this.textureCache[c];const h=this.loadImageSource(t,n).then(function(d){d.flipY=!1,d.name=r.name||l.name||"",d.name===""&&typeof l.uri=="string"&&l.uri.startsWith("data:image/")===!1&&(d.name=l.uri);const a=(o.samplers||{})[r.sampler]||{};return d.magFilter=Gn[a.magFilter]||Ct,d.minFilter=Gn[a.minFilter]||fn,d.wrapS=Qn[a.wrapS]||ns,d.wrapT=Qn[a.wrapT]||ns,s.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[c]=h,h}loadImageSource(e,t){const n=this,s=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(i=>i.clone());const r=s.images[e],l=self.URL||self.webkitURL;let c=r.uri||"",h=!1;if(r.bufferView!==void 0)c=n.getDependency("bufferView",r.bufferView).then(function(i){h=!0;const a=new Blob([i],{type:r.mimeType});return c=l.createObjectURL(a),c});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(c).then(function(i){return new Promise(function(a,f){let g=a;t.isImageBitmapLoader===!0&&(g=function(A){const p=new Mn(A);p.needsUpdate=!0,a(p)}),t.load(Et.resolveURL(i,o.path),g,void 0,f)})}).then(function(i){return h===!0&&l.revokeObjectURL(c),i.userData.mimeType=r.mimeType||ga(r.uri),i}).catch(function(i){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),i});return this.sourceCache[e]=d,d}assignTexture(e,t,n,s){const o=this;return this.getDependency("texture",n.index).then(function(r){if(!r)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(r=r.clone(),r.channel=n.texCoord),o.extensions[D.KHR_TEXTURE_TRANSFORM]){const l=n.extensions!==void 0?n.extensions[D.KHR_TEXTURE_TRANSFORM]:void 0;if(l){const c=o.associations.get(r);r=o.extensions[D.KHR_TEXTURE_TRANSFORM].extendTexture(r,l),o.associations.set(r,c)}}return s!==void 0&&(r.colorSpace=s),e[t]=r,r})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const s=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,r=t.attributes.normal===void 0;if(e.isPoints){const l="PointsMaterial:"+n.uuid;let c=this.cache.get(l);c||(c=new Vr,ys.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(l,c)),n=c}else if(e.isLine){const l="LineBasicMaterial:"+n.uuid;let c=this.cache.get(l);c||(c=new hn,ys.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(l,c)),n=c}if(s||o||r){let l="ClonedMaterial:"+n.uuid+":";s&&(l+="derivative-tangents:"),o&&(l+="vertex-colors:"),r&&(l+="flat-shading:");let c=this.cache.get(l);c||(c=n.clone(),o&&(c.vertexColors=!0),r&&(c.flatShading=!0),s&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(l,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return ds}loadMaterial(e){const t=this,n=this.json,s=this.extensions,o=n.materials[e];let r;const l={},c=o.extensions||{},h=[];if(c[D.KHR_MATERIALS_UNLIT]){const i=s[D.KHR_MATERIALS_UNLIT];r=i.getMaterialType(),h.push(i.extendParams(l,o,t))}else{const i=o.pbrMetallicRoughness||{};if(l.color=new G(1,1,1),l.opacity=1,Array.isArray(i.baseColorFactor)){const a=i.baseColorFactor;l.color.setRGB(a[0],a[1],a[2],_e),l.opacity=a[3]}i.baseColorTexture!==void 0&&h.push(t.assignTexture(l,"map",i.baseColorTexture,ee)),l.metalness=i.metallicFactor!==void 0?i.metallicFactor:1,l.roughness=i.roughnessFactor!==void 0?i.roughnessFactor:1,i.metallicRoughnessTexture!==void 0&&(h.push(t.assignTexture(l,"metalnessMap",i.metallicRoughnessTexture)),h.push(t.assignTexture(l,"roughnessMap",i.metallicRoughnessTexture))),r=this._invokeOne(function(a){return a.getMaterialType&&a.getMaterialType(e)}),h.push(Promise.all(this._invokeAll(function(a){return a.extendMaterialParams&&a.extendMaterialParams(e,l)})))}o.doubleSided===!0&&(l.side=ot);const d=o.alphaMode||Ts.OPAQUE;if(d===Ts.BLEND?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,d===Ts.MASK&&(l.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&r!==ke&&(h.push(t.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new N(1,1),o.normalTexture.scale!==void 0)){const i=o.normalTexture.scale;l.normalScale.set(i,i)}if(o.occlusionTexture!==void 0&&r!==ke&&(h.push(t.assignTexture(l,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(l.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&r!==ke){const i=o.emissiveFactor;l.emissive=new G().setRGB(i[0],i[1],i[2],_e)}return o.emissiveTexture!==void 0&&r!==ke&&h.push(t.assignTexture(l,"emissiveMap",o.emissiveTexture,ee)),Promise.all(h).then(function(){const i=new r(l);return o.name&&(i.name=o.name),Be(i,o),t.associations.set(i,{materials:e}),o.extensions&&Oe(s,i,o),i})}createUniqueName(e){const t=Bt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,s=this.primitiveCache;function o(l){return n[D.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(l,t).then(function(c){return Wn(c,l,t)})}const r=[];for(let l=0,c=e.length;l<c;l++){const h=e[l],d=pa(h),i=s[d];if(i)r.push(i.promise);else{let a;h.extensions&&h.extensions[D.KHR_DRACO_MESH_COMPRESSION]?a=o(h):a=Wn(new ps,h,t),s[d]={primitive:h,promise:a},r.push(a)}}return Promise.all(r)}loadMesh(e){const t=this,n=this.json,s=this.extensions,o=n.meshes[e],r=o.primitives,l=[];for(let c=0,h=r.length;c<h;c++){const d=r[c].material===void 0?fa(this.cache):this.getDependency("material",r[c].material);l.push(d)}return l.push(t.loadGeometries(r)),Promise.all(l).then(function(c){const h=c.slice(0,c.length-1),d=c[c.length-1],i=[];for(let f=0,g=d.length;f<g;f++){const A=d[f],p=r[f];let m;const _=h[f];if(p.mode===$.TRIANGLES||p.mode===$.TRIANGLE_STRIP||p.mode===$.TRIANGLE_FAN||p.mode===void 0)m=o.isSkinnedMesh===!0?new Gr(A,_):new fe(A,_),m.isSkinnedMesh===!0&&m.normalizeSkinWeights(),p.mode===$.TRIANGLE_STRIP?m.geometry=Hn(m.geometry,Di):p.mode===$.TRIANGLE_FAN&&(m.geometry=Hn(m.geometry,js));else if(p.mode===$.LINES)m=new dn(A,_);else if(p.mode===$.LINE_STRIP)m=new Fi(A,_);else if(p.mode===$.LINE_LOOP)m=new Qr(A,_);else if(p.mode===$.POINTS)m=new Wr(A,_);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);Object.keys(m.geometry.morphAttributes).length>0&&da(m,o),m.name=t.createUniqueName(o.name||"mesh_"+e),Be(m,o),p.extensions&&Oe(s,m,p),t.assignFinalMaterial(m),i.push(m)}for(let f=0,g=i.length;f<g;f++)t.associations.set(i[f],{meshes:e,primitives:f});if(i.length===1)return o.extensions&&Oe(s,i[0],o),i[0];const a=new he;o.extensions&&Oe(s,a,o),t.associations.set(a,{meshes:e});for(let f=0,g=i.length;f<g;f++)a.add(i[f]);return a})}loadCamera(e){let t;const n=this.json.cameras[e],s=n[n.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new pn(Rt.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(t=new jr(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Be(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let s=0,o=t.joints.length;s<o;s++)n.push(this._loadNodeShallow(t.joints[s]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(s){const o=s.pop(),r=s,l=[],c=[];for(let h=0,d=r.length;h<d;h++){const i=r[h];if(i){l.push(i);const a=new V;o!==null&&a.fromArray(o.array,h*16),c.push(a)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[h])}return new Kr(l,c)})}loadAnimation(e){const t=this.json,n=this,s=t.animations[e],o=s.name?s.name:"animation_"+e,r=[],l=[],c=[],h=[],d=[];for(let i=0,a=s.channels.length;i<a;i++){const f=s.channels[i],g=s.samplers[f.sampler],A=f.target,p=A.node,m=s.parameters!==void 0?s.parameters[g.input]:g.input,_=s.parameters!==void 0?s.parameters[g.output]:g.output;A.node!==void 0&&(r.push(this.getDependency("node",p)),l.push(this.getDependency("accessor",m)),c.push(this.getDependency("accessor",_)),h.push(g),d.push(A))}return Promise.all([Promise.all(r),Promise.all(l),Promise.all(c),Promise.all(h),Promise.all(d)]).then(function(i){const a=i[0],f=i[1],g=i[2],A=i[3],p=i[4],m=[];for(let _=0,x=a.length;_<x;_++){const y=a[_],w=f[_],v=g[_],T=A[_],b=p[_];if(y===void 0)continue;y.updateMatrix&&y.updateMatrix();const E=n._createAnimationTracks(y,w,v,T,b);if(E)for(let M=0;M<E.length;M++)m.push(E[M])}return new Yr(o,void 0,m)})}createNodeMesh(e){const t=this.json,n=this,s=t.nodes[e];return s.mesh===void 0?null:n.getDependency("mesh",s.mesh).then(function(o){const r=n._getNodeRef(n.meshCache,s.mesh,o);return s.weights!==void 0&&r.traverse(function(l){if(l.isMesh)for(let c=0,h=s.weights.length;c<h;c++)l.morphTargetInfluences[c]=s.weights[c]}),r})}loadNode(e){const t=this.json,n=this,s=t.nodes[e],o=n._loadNodeShallow(e),r=[],l=s.children||[];for(let h=0,d=l.length;h<d;h++)r.push(n.getDependency("node",l[h]));const c=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([o,Promise.all(r),c]).then(function(h){const d=h[0],i=h[1],a=h[2];a!==null&&d.traverse(function(f){f.isSkinnedMesh&&f.bind(a,ma)});for(let f=0,g=i.length;f<g;f++)d.add(i[f]);return d})}_loadNodeShallow(e){const t=this.json,n=this.extensions,s=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],r=o.name?s.createUniqueName(o.name):"",l=[],c=s._invokeOne(function(h){return h.createNodeMesh&&h.createNodeMesh(e)});return c&&l.push(c),o.camera!==void 0&&l.push(s.getDependency("camera",o.camera).then(function(h){return s._getNodeRef(s.cameraCache,o.camera,h)})),s._invokeAll(function(h){return h.createNodeAttachment&&h.createNodeAttachment(e)}).forEach(function(h){l.push(h)}),this.nodeCache[e]=Promise.all(l).then(function(h){let d;if(o.isBone===!0?d=new Xr:h.length>1?d=new he:h.length===1?d=h[0]:d=new ye,d!==h[0])for(let i=0,a=h.length;i<a;i++)d.add(h[i]);if(o.name&&(d.userData.name=o.name,d.name=r),Be(d,o),o.extensions&&Oe(n,d,o),o.matrix!==void 0){const i=new V;i.fromArray(o.matrix),d.applyMatrix4(i)}else o.translation!==void 0&&d.position.fromArray(o.translation),o.rotation!==void 0&&d.quaternion.fromArray(o.rotation),o.scale!==void 0&&d.scale.fromArray(o.scale);return s.associations.has(d)||s.associations.set(d,{}),s.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],s=this,o=new he;n.name&&(o.name=s.createUniqueName(n.name)),Be(o,n),n.extensions&&Oe(t,o,n);const r=n.nodes||[],l=[];for(let c=0,h=r.length;c<h;c++)l.push(s.getDependency("node",r[c]));return Promise.all(l).then(function(c){for(let d=0,i=c.length;d<i;d++)o.add(c[d]);const h=d=>{const i=new Map;for(const[a,f]of s.associations)(a instanceof ys||a instanceof Mn)&&i.set(a,f);return d.traverse(a=>{const f=s.associations.get(a);f!=null&&i.set(a,f)}),i};return s.associations=h(o),o})}_createAnimationTracks(e,t,n,s,o){const r=[],l=e.name?e.name:e.uuid,c=[];ve[o.path]===ve.weights?e.traverse(function(a){a.morphTargetInfluences&&c.push(a.name?a.name:a.uuid)}):c.push(l);let h;switch(ve[o.path]){case ve.weights:h=Cn;break;case ve.rotation:h=Bn;break;case ve.position:case ve.scale:h=In;break;default:switch(n.itemSize){case 1:h=Cn;break;case 2:case 3:default:h=In;break}break}const d=s.interpolation!==void 0?ua[s.interpolation]:gn,i=this._getArrayFromAccessor(n);for(let a=0,f=c.length;a<f;a++){const g=new h(c[a]+"."+ve[o.path],t.array,i,d);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),r.push(g)}return r}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=Xs(t.constructor),s=new Float32Array(t.length);for(let o=0,r=t.length;o<r;o++)s[o]=t[o]*n;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const s=this instanceof Bn?ca:er;return new s(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function _a(u,e,t){const n=e.attributes,s=new Q;if(n.POSITION!==void 0){const l=t.json.accessors[n.POSITION],c=l.min,h=l.max;if(c!==void 0&&h!==void 0){if(s.set(new S(c[0],c[1],c[2]),new S(h[0],h[1],h[2])),l.normalized){const d=Xs(rt[l.componentType]);s.min.multiplyScalar(d),s.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const l=new S,c=new S;for(let h=0,d=o.length;h<d;h++){const i=o[h];if(i.POSITION!==void 0){const a=t.json.accessors[i.POSITION],f=a.min,g=a.max;if(f!==void 0&&g!==void 0){if(c.setX(Math.max(Math.abs(f[0]),Math.abs(g[0]))),c.setY(Math.max(Math.abs(f[1]),Math.abs(g[1]))),c.setZ(Math.max(Math.abs(f[2]),Math.abs(g[2]))),a.normalized){const A=Xs(rt[a.componentType]);c.multiplyScalar(A)}l.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(l)}u.boundingBox=s;const r=new Wi;s.getCenter(r.center),r.radius=s.min.distanceTo(s.max)/2,u.boundingSphere=r}function Wn(u,e,t){const n=e.attributes,s=[];function o(r,l){return t.getDependency("accessor",r).then(function(c){u.setAttribute(l,c)})}for(const r in n){const l=Ys[r]||r.toLowerCase();l in u.attributes||s.push(o(n[r],l))}if(e.indices!==void 0&&!u.index){const r=t.getDependency("accessor",e.indices).then(function(l){u.setIndex(l)});s.push(r)}return Ws.workingColorSpace!==_e&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ws.workingColorSpace}" not supported.`),Be(u,e),_a(u,e,t),Promise.all(s).then(function(){return e.targets!==void 0?ha(u,e.targets,t):u})}let pt,bs,Ve,Dt;function Ss(u,e=1/0,t=null){bs||(bs=new ji(2,2,1,1)),Ve||(Ve=new Le({uniforms:{blitTexture:new Jr(u)},vertexShader:`
|
|
500
|
+
varying vec2 vUv;
|
|
501
|
+
void main(){
|
|
502
|
+
vUv = uv;
|
|
503
|
+
gl_Position = vec4(position.xy * 1.0,0.,.999999);
|
|
504
|
+
}`,fragmentShader:`
|
|
505
|
+
uniform sampler2D blitTexture;
|
|
506
|
+
varying vec2 vUv;
|
|
507
|
+
|
|
508
|
+
void main(){
|
|
509
|
+
gl_FragColor = vec4(vUv.xy, 0, 1);
|
|
510
|
+
|
|
511
|
+
#ifdef IS_SRGB
|
|
512
|
+
gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );
|
|
513
|
+
#else
|
|
514
|
+
gl_FragColor = texture2D( blitTexture, vUv);
|
|
515
|
+
#endif
|
|
516
|
+
}`})),Ve.uniforms.blitTexture.value=u,Ve.defines.IS_SRGB=u.colorSpace==ee,Ve.needsUpdate=!0,Dt||(Dt=new fe(bs,Ve),Dt.frustumCulled=!1);const n=new pn,s=new is;s.add(Dt),t===null&&(t=pt=new Ki({antialias:!1}));const o=Math.min(u.image.width,e),r=Math.min(u.image.height,e);t.setSize(o,r),t.clear(),t.render(s,n);const l=document.createElement("canvas"),c=l.getContext("2d");l.width=o,l.height=r,c.drawImage(t.domElement,0,0,o,r);const h=new $r(l);return h.minFilter=u.minFilter,h.magFilter=u.magFilter,h.wrapS=u.wrapS,h.wrapT=u.wrapT,h.name=u.name,pt&&(pt.forceContextLoss(),pt.dispose(),pt=null),h}const jn={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class xn{constructor(){this.pluginCallbacks=[],this.register(function(e){return new Ia(e)}),this.register(function(e){return new Ca(e)}),this.register(function(e){return new Pa(e)}),this.register(function(e){return new Da(e)}),this.register(function(e){return new Na(e)}),this.register(function(e){return new Oa(e)}),this.register(function(e){return new Ba(e)}),this.register(function(e){return new Ra(e)}),this.register(function(e){return new La(e)}),this.register(function(e){return new Fa(e)}),this.register(function(e){return new ka(e)}),this.register(function(e){return new Ua(e)}),this.register(function(e){return new za(e)}),this.register(function(e){return new Ha(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,s){const o=new Ma,r=[];for(let l=0,c=this.pluginCallbacks.length;l<c;l++)r.push(this.pluginCallbacks[l](o));o.setPlugins(r),o.write(e,t,s).catch(n)}parseAsync(e,t){const n=this;return new Promise(function(s,o){n.parse(e,s,o,t)})}}const P={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},Ms="KHR_mesh_quantization",q={};q[ki]=P.NEAREST;q[Ui]=P.NEAREST_MIPMAP_NEAREST;q[Hi]=P.NEAREST_MIPMAP_LINEAR;q[Ct]=P.LINEAR;q[zi]=P.LINEAR_MIPMAP_NEAREST;q[fn]=P.LINEAR_MIPMAP_LINEAR;q[Vi]=P.CLAMP_TO_EDGE;q[ns]=P.REPEAT;q[Gi]=P.MIRRORED_REPEAT;const Kn={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},xa=new G,Yn=12,ya=1179937895,wa=2,Xn=8,va=1313821514,Ta=5130562;function vt(u,e){return u.length===e.length&&u.every(function(t,n){return t===e[n]})}function Ea(u){return new TextEncoder().encode(u).buffer}function ba(u){return vt(u.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function Sa(u,e,t){const n={min:new Array(u.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(u.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let s=e;s<e+t;s++)for(let o=0;o<u.itemSize;o++){let r;u.itemSize>4?r=u.array[s*u.itemSize+o]:(o===0?r=u.getX(s):o===1?r=u.getY(s):o===2?r=u.getZ(s):o===3&&(r=u.getW(s)),u.normalized===!0&&(r=Rt.normalize(r,u.array))),n.min[o]=Math.min(n.min[o],r),n.max[o]=Math.max(n.max[o],r)}return n}function tr(u){return Math.ceil(u/4)*4}function Is(u,e=0){const t=tr(u.byteLength);if(t!==u.byteLength){const n=new Uint8Array(t);if(n.set(new Uint8Array(u)),e!==0)for(let s=u.byteLength;s<t;s++)n[s]=e;return n.buffer}return u}function qn(){return typeof document>"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function Zn(u,e){if(u.toBlob!==void 0)return new Promise(n=>u.toBlob(n,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),u.convertToBlob({type:e,quality:t})}class Ma{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter r"+eo}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,n={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const s=this,o=s.buffers,r=s.json;n=s.options;const l=s.extensionsUsed,c=s.extensionsRequired,h=new Blob(o,{type:"application/octet-stream"}),d=Object.keys(l),i=Object.keys(c);if(d.length>0&&(r.extensionsUsed=d),i.length>0&&(r.extensionsRequired=i),r.buffers&&r.buffers.length>0&&(r.buffers[0].byteLength=h.size),n.binary===!0){const a=new FileReader;a.readAsArrayBuffer(h),a.onloadend=function(){const f=Is(a.result),g=new DataView(new ArrayBuffer(Xn));g.setUint32(0,f.byteLength,!0),g.setUint32(4,Ta,!0);const A=Is(Ea(JSON.stringify(r)),32),p=new DataView(new ArrayBuffer(Xn));p.setUint32(0,A.byteLength,!0),p.setUint32(4,va,!0);const m=new ArrayBuffer(Yn),_=new DataView(m);_.setUint32(0,ya,!0),_.setUint32(4,wa,!0);const x=Yn+p.byteLength+A.byteLength+g.byteLength+f.byteLength;_.setUint32(8,x,!0);const y=new Blob([m,p,A,g,f],{type:"application/octet-stream"}),w=new FileReader;w.readAsArrayBuffer(y),w.onloadend=function(){t(w.result)}}}else if(r.buffers&&r.buffers.length>0){const a=new FileReader;a.readAsDataURL(h),a.onloadend=function(){const f=a.result;r.buffers[0].uri=f,t(r)}}else t(r)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const n=this.options,s=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&o.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const r in o.gltfExtensions)t.extensions[r]=o.gltfExtensions[r],s[r]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(t.extras=o)}catch(o){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+o.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const s=new Map;s.set(!0,this.uid++),s.set(!1,this.uid++),this.uids.set(e,s)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const n=new S;for(let s=0,o=e.count;s<o;s++)if(Math.abs(n.fromBufferAttribute(e,s).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const n=e.clone(),s=new S;for(let o=0,r=n.count;o<r;o++)s.fromBufferAttribute(n,o),s.x===0&&s.y===0&&s.z===0?s.setX(1):s.normalize(),n.setXYZ(o,s.x,s.y,s.z);return t.attributesNormalized.set(e,n),n}applyTextureTransform(e,t){let n=!1;const s={};(t.offset.x!==0||t.offset.y!==0)&&(s.offset=t.offset.toArray(),n=!0),t.rotation!==0&&(s.rotation=t.rotation,n=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(s.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=s,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function n(f){return f.colorSpace===ee?function(A){return A<.04045?A*.0773993808:Math.pow(A*.9478672986+.0521327014,2.4)}:function(A){return A}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof ws&&(e=Ss(e)),t instanceof ws&&(t=Ss(t));const s=e?e.image:null,o=t?t.image:null,r=Math.max(s?s.width:0,o?o.width:0),l=Math.max(s?s.height:0,o?o.height:0),c=qn();c.width=r,c.height=l;const h=c.getContext("2d");h.fillStyle="#00ffff",h.fillRect(0,0,r,l);const d=h.getImageData(0,0,r,l);if(s){h.drawImage(s,0,0,r,l);const f=n(e),g=h.getImageData(0,0,r,l).data;for(let A=2;A<g.length;A+=4)d.data[A]=f(g[A]/256)*256}if(o){h.drawImage(o,0,0,r,l);const f=n(t),g=h.getImageData(0,0,r,l).data;for(let A=1;A<g.length;A+=4)d.data[A]=f(g[A]/256)*256}h.putImageData(d,0,0);const a=(e||t).clone();return a.source=new to(c),a.colorSpace=so,a.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),a}processBuffer(e){const t=this.json,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}processBufferView(e,t,n,s,o){const r=this.json;r.bufferViews||(r.bufferViews=[]);let l;switch(t){case P.BYTE:case P.UNSIGNED_BYTE:l=1;break;case P.SHORT:case P.UNSIGNED_SHORT:l=2;break;default:l=4}let c=e.itemSize*l;o===P.ARRAY_BUFFER&&(c=Math.ceil(c/4)*4);const h=tr(s*c),d=new DataView(new ArrayBuffer(h));let i=0;for(let g=n;g<n+s;g++){for(let A=0;A<e.itemSize;A++){let p;e.itemSize>4?p=e.array[g*e.itemSize+A]:(A===0?p=e.getX(g):A===1?p=e.getY(g):A===2?p=e.getZ(g):A===3&&(p=e.getW(g)),e.normalized===!0&&(p=Rt.normalize(p,e.array))),t===P.FLOAT?d.setFloat32(i,p,!0):t===P.INT?d.setInt32(i,p,!0):t===P.UNSIGNED_INT?d.setUint32(i,p,!0):t===P.SHORT?d.setInt16(i,p,!0):t===P.UNSIGNED_SHORT?d.setUint16(i,p,!0):t===P.BYTE?d.setInt8(i,p):t===P.UNSIGNED_BYTE&&d.setUint8(i,p),i+=l}i%c!==0&&(i+=c-i%c)}const a={buffer:this.processBuffer(d.buffer),byteOffset:this.byteOffset,byteLength:h};return o!==void 0&&(a.target=o),o===P.ARRAY_BUFFER&&(a.byteStride=c),this.byteOffset+=h,r.bufferViews.push(a),{id:r.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise(function(s){const o=new FileReader;o.readAsArrayBuffer(e),o.onloadend=function(){const r=Is(o.result),l={buffer:t.processBuffer(r),byteOffset:t.byteOffset,byteLength:r.byteLength};t.byteOffset+=r.byteLength,s(n.bufferViews.push(l)-1)}})}processAccessor(e,t,n,s){const o=this.json,r={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let l;if(e.array.constructor===Float32Array)l=P.FLOAT;else if(e.array.constructor===Int32Array)l=P.INT;else if(e.array.constructor===Uint32Array)l=P.UNSIGNED_INT;else if(e.array.constructor===Int16Array)l=P.SHORT;else if(e.array.constructor===Uint16Array)l=P.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)l=P.BYTE;else if(e.array.constructor===Uint8Array)l=P.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(n===void 0&&(n=0),(s===void 0||s===1/0)&&(s=e.count),s===0)return null;const c=Sa(e,n,s);let h;t!==void 0&&(h=e===t.index?P.ELEMENT_ARRAY_BUFFER:P.ARRAY_BUFFER);const d=this.processBufferView(e,l,n,s,h),i={bufferView:d.id,byteOffset:d.byteOffset,componentType:l,count:s,max:c.max,min:c.min,type:r[e.itemSize]};return e.normalized===!0&&(i.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(i)-1}processImage(e,t,n,s="image/png"){if(e!==null){const o=this,r=o.cache,l=o.json,c=o.options,h=o.pending;r.images.has(e)||r.images.set(e,{});const d=r.images.get(e),i=s+":flipY/"+n.toString();if(d[i]!==void 0)return d[i];l.images||(l.images=[]);const a={mimeType:s},f=qn();f.width=Math.min(e.width,c.maxTextureSize),f.height=Math.min(e.height,c.maxTextureSize);const g=f.getContext("2d");if(n===!0&&(g.translate(0,f.height),g.scale(1,-1)),e.data!==void 0){t!==no&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const p=new Uint8ClampedArray(e.height*e.width*4);for(let m=0;m<p.length;m+=4)p[m+0]=e.data[m+0],p[m+1]=e.data[m+1],p[m+2]=e.data[m+2],p[m+3]=e.data[m+3];g.putImageData(new ImageData(p,e.width,e.height),0,0)}else if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)g.drawImage(e,0,0,f.width,f.height);else throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");c.binary===!0?h.push(Zn(f,s).then(p=>o.processBufferViewImage(p)).then(p=>{a.bufferView=p})):f.toDataURL!==void 0?a.uri=f.toDataURL(s):h.push(Zn(f,s).then(p=>new FileReader().readAsDataURL(p)).then(p=>{a.uri=p}));const A=l.images.push(a)-1;return d[i]=A,A}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const n={magFilter:q[e.magFilter],minFilter:q[e.minFilter],wrapS:q[e.wrapS],wrapT:q[e.wrapT]};return t.samplers.push(n)-1}processTexture(e){const n=this.options,s=this.cache,o=this.json;if(s.textures.has(e))return s.textures.get(e);o.textures||(o.textures=[]),e instanceof ws&&(e=Ss(e,n.maxTextureSize));let r=e.userData.mimeType;r==="image/webp"&&(r="image/png");const l={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,r)};e.name&&(l.name=e.name),this._invokeAll(function(h){h.writeTexture&&h.writeTexture(e,l)});const c=o.textures.push(l)-1;return s.textures.set(e,c),c}processMaterial(e){const t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);const s={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const o=e.color.toArray().concat([e.opacity]);if(vt(o,[1,1,1,1])||(s.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(s.pbrMetallicRoughness.metallicFactor=e.metalness,s.pbrMetallicRoughness.roughnessFactor=e.roughness):(s.pbrMetallicRoughness.metallicFactor=.5,s.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const l=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),c={index:this.processTexture(l),channel:l.channel};this.applyTextureTransform(c,l),s.pbrMetallicRoughness.metallicRoughnessTexture=c}if(e.map){const l={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(l,e.map),s.pbrMetallicRoughness.baseColorTexture=l}if(e.emissive){const l=e.emissive;if(Math.max(l.r,l.g,l.b)>0&&(s.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const h={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(h,e.emissiveMap),s.emissiveTexture=h}}if(e.normalMap){const l={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(l.scale=e.normalScale.x),this.applyTextureTransform(l,e.normalMap),s.normalTexture=l}if(e.aoMap){const l={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(l.strength=e.aoMapIntensity),this.applyTextureTransform(l,e.aoMap),s.occlusionTexture=l}e.transparent?s.alphaMode="BLEND":e.alphaTest>0&&(s.alphaMode="MASK",s.alphaCutoff=e.alphaTest),e.side===ot&&(s.doubleSided=!0),e.name!==""&&(s.name=e.name),this.serializeUserData(e,s),this._invokeAll(function(l){l.writeMaterial&&l.writeMaterial(e,s)});const r=n.materials.push(s)-1;return t.materials.set(e,r),r}processMesh(e){const t=this.cache,n=this.json,s=[e.geometry.uuid];if(Array.isArray(e.material))for(let y=0,w=e.material.length;y<w;y++)s.push(e.material[y].uuid);else s.push(e.material.uuid);const o=s.join(":");if(t.meshes.has(o))return t.meshes.get(o);const r=e.geometry;let l;e.isLineSegments?l=P.LINES:e.isLineLoop?l=P.LINE_LOOP:e.isLine?l=P.LINE_STRIP:e.isPoints?l=P.POINTS:l=e.material.wireframe?P.LINES:P.TRIANGLES;const c={},h={},d=[],i=[],a={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=r.getAttribute("normal");f!==void 0&&!this.isNormalizedNormalAttribute(f)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),r.setAttribute("normal",this.createNormalizedNormalAttribute(f)));let g=null;for(let y in r.attributes){if(y.slice(0,5)==="morph")continue;const w=r.attributes[y];if(y=a[y]||y.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(y)||(y="_"+y),t.attributes.has(this.getUID(w))){h[y]=t.attributes.get(this.getUID(w));continue}g=null;const T=w.array;y==="JOINTS_0"&&!(T instanceof Uint16Array)&&!(T instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),g=new K(new Uint16Array(T),w.itemSize,w.normalized));const b=this.processAccessor(g||w,r);b!==null&&(y.startsWith("_")||this.detectMeshQuantization(y,w),h[y]=b,t.attributes.set(this.getUID(w),b))}if(f!==void 0&&r.setAttribute("normal",f),Object.keys(h).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const y=[],w=[],v={};if(e.morphTargetDictionary!==void 0)for(const T in e.morphTargetDictionary)v[e.morphTargetDictionary[T]]=T;for(let T=0;T<e.morphTargetInfluences.length;++T){const b={};let E=!1;for(const M in r.morphAttributes){if(M!=="position"&&M!=="normal"){E||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),E=!0);continue}const C=r.morphAttributes[M][T],I=M.toUpperCase(),B=r.attributes[M];if(t.attributes.has(this.getUID(C,!0))){b[I]=t.attributes.get(this.getUID(C,!0));continue}const R=C.clone();if(!r.morphTargetsRelative)for(let L=0,F=C.count;L<F;L++)for(let j=0;j<C.itemSize;j++)j===0&&R.setX(L,C.getX(L)-B.getX(L)),j===1&&R.setY(L,C.getY(L)-B.getY(L)),j===2&&R.setZ(L,C.getZ(L)-B.getZ(L)),j===3&&R.setW(L,C.getW(L)-B.getW(L));b[I]=this.processAccessor(R,r),t.attributes.set(this.getUID(B,!0),b[I])}i.push(b),y.push(e.morphTargetInfluences[T]),e.morphTargetDictionary!==void 0&&w.push(v[T])}c.weights=y,w.length>0&&(c.extras={},c.extras.targetNames=w)}const A=Array.isArray(e.material);if(A&&r.groups.length===0)return null;let p=!1;if(A&&r.index===null){const y=[];for(let w=0,v=r.attributes.position.count;w<v;w++)y[w]=w;r.setIndex(y),p=!0}const m=A?e.material:[e.material],_=A?r.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let y=0,w=_.length;y<w;y++){const v={mode:l,attributes:h};if(this.serializeUserData(r,v),i.length>0&&(v.targets=i),r.index!==null){let b=this.getUID(r.index);(_[y].start!==void 0||_[y].count!==void 0)&&(b+=":"+_[y].start+":"+_[y].count),t.attributes.has(b)?v.indices=t.attributes.get(b):(v.indices=this.processAccessor(r.index,r,_[y].start,_[y].count),t.attributes.set(b,v.indices)),v.indices===null&&delete v.indices}const T=this.processMaterial(m[_[y].materialIndex]);T!==null&&(v.material=T),d.push(v)}p===!0&&r.setIndex(null),c.primitives=d,n.meshes||(n.meshes=[]),this._invokeAll(function(y){y.writeMesh&&y.writeMesh(e,c)});const x=n.meshes.push(c)-1;return t.meshes.set(o,x),x}detectMeshQuantization(e,t){if(this.extensionsUsed[Ms])return;let n;switch(t.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}t.normalized&&(n+=" normalized");const s=e.split("_",1)[0];jn[s]&&jn[s].includes(n)&&(this.extensionsUsed[Ms]=!0,this.extensionsRequired[Ms]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const n=e.isOrthographicCamera,s={type:n?"orthographic":"perspective"};return n?s.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:s.perspective={aspectRatio:e.aspect,yfov:Rt.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(s.name=e.type),t.cameras.push(s)-1}processAnimation(e,t){const n=this.json,s=this.nodeMap;n.animations||(n.animations=[]),e=xn.Utils.mergeMorphTargetTracks(e.clone(),t);const o=e.tracks,r=[],l=[];for(let c=0;c<o.length;++c){const h=o[c],d=Bt.parseTrackName(h.name);let i=Bt.findNode(t,d.nodeName);const a=Kn[d.propertyName];if(d.objectName==="bones"&&(i.isSkinnedMesh===!0?i=i.skeleton.getBoneByName(d.objectIndex):i=void 0),!i||!a)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',h.name),null;const f=1;let g=h.values.length/h.times.length;a===Kn.morphTargetInfluences&&(g/=i.morphTargetInfluences.length);let A;h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(A="CUBICSPLINE",g/=3):h.getInterpolation()===Qi?A="STEP":A="LINEAR",l.push({input:this.processAccessor(new K(h.times,f)),output:this.processAccessor(new K(h.values,g)),interpolation:A}),r.push({sampler:l.length-1,target:{node:s.get(i),path:a}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:l,channels:r}),n.animations.length-1}processSkin(e){const t=this.json,n=this.nodeMap,s=t.nodes[n.get(e)],o=e.skeleton;if(o===void 0)return null;const r=e.skeleton.bones[0];if(r===void 0)return null;const l=[],c=new Float32Array(o.bones.length*16),h=new V;for(let i=0;i<o.bones.length;++i)l.push(n.get(o.bones[i])),h.copy(o.boneInverses[i]),h.multiply(e.bindMatrix).toArray(c,i*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new K(c,16)),joints:l,skeleton:n.get(r)}),s.skin=t.skins.length-1}processNode(e){const t=this.json,n=this.options,s=this.nodeMap;t.nodes||(t.nodes=[]);const o={};if(n.trs){const l=e.quaternion.toArray(),c=e.position.toArray(),h=e.scale.toArray();vt(l,[0,0,0,1])||(o.rotation=l),vt(c,[0,0,0])||(o.translation=c),vt(h,[1,1,1])||(o.scale=h)}else e.matrixAutoUpdate&&e.updateMatrix(),ba(e.matrix)===!1&&(o.matrix=e.matrix.elements);if(e.name!==""&&(o.name=String(e.name)),this.serializeUserData(e,o),e.isMesh||e.isLine||e.isPoints){const l=this.processMesh(e);l!==null&&(o.mesh=l)}else e.isCamera&&(o.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const l=[];for(let c=0,h=e.children.length;c<h;c++){const d=e.children[c];if(d.visible||n.onlyVisible===!1){const i=this.processNode(d);i!==null&&l.push(i)}}l.length>0&&(o.children=l)}this._invokeAll(function(l){l.writeNode&&l.writeNode(e,o)});const r=t.nodes.push(o)-1;return s.set(e,r),r}processScene(e){const t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);const s={};e.name!==""&&(s.name=e.name),t.scenes.push(s);const o=[];for(let r=0,l=e.children.length;r<l;r++){const c=e.children[r];if(c.visible||n.onlyVisible===!1){const h=this.processNode(c);h!==null&&o.push(h)}}o.length>0&&(s.nodes=o),this.serializeUserData(e,s)}processObjects(e){const t=new is;t.name="AuxScene";for(let n=0;n<e.length;n++)t.children.push(e[n]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(s){s.beforeParse&&s.beforeParse(e)});const n=[];for(let s=0;s<e.length;s++)e[s]instanceof is?this.processScene(e[s]):n.push(e[s]);n.length>0&&this.processObjects(n);for(let s=0;s<this.skins.length;++s)this.processSkin(this.skins[s]);for(let s=0;s<t.animations.length;++s)this.processAnimation(t.animations[s],e[0]);this._invokeAll(function(s){s.afterParse&&s.afterParse(e)})}_invokeAll(e){for(let t=0,n=this.plugins.length;t<n;t++)e(this.plugins[t])}}class Ia{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}const n=this.writer,s=n.json,o=n.extensionsUsed,r={};e.name&&(r.name=e.name),r.color=e.color.toArray(),r.intensity=e.intensity,e.isDirectionalLight?r.type="directional":e.isPointLight?(r.type="point",e.distance>0&&(r.range=e.distance)):e.isSpotLight&&(r.type="spot",e.distance>0&&(r.range=e.distance),r.spot={},r.spot.innerConeAngle=(1-e.penumbra)*e.angle,r.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&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."),o[this.name]||(s.extensions=s.extensions||{},s.extensions[this.name]={lights:[]},o[this.name]=!0);const l=s.extensions[this.name].lights;l.push(r),t.extensions=t.extensions||{},t.extensions[this.name]={light:l.length-1}}}class Ca{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const s=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},s[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class Ba{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;const n=this.writer,s=n.extensionsUsed,o={};if(o.clearcoatFactor=e.clearcoat,e.clearcoatMap){const r={index:n.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};n.applyTextureTransform(r,e.clearcoatMap),o.clearcoatTexture=r}if(o.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const r={index:n.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};n.applyTextureTransform(r,e.clearcoatRoughnessMap),o.clearcoatRoughnessTexture=r}if(e.clearcoatNormalMap){const r={index:n.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};e.clearcoatNormalScale.x!==1&&(r.scale=e.clearcoatNormalScale.x),n.applyTextureTransform(r,e.clearcoatNormalMap),o.clearcoatNormalTexture=r}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class Ra{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.dispersion===0)return;const s=this.writer.extensionsUsed,o={};o.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class La{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;const n=this.writer,s=n.extensionsUsed,o={};if(o.iridescenceFactor=e.iridescence,e.iridescenceMap){const r={index:n.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};n.applyTextureTransform(r,e.iridescenceMap),o.iridescenceTexture=r}if(o.iridescenceIor=e.iridescenceIOR,o.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],o.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const r={index:n.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};n.applyTextureTransform(r,e.iridescenceThicknessMap),o.iridescenceThicknessTexture=r}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class Pa{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,s=n.extensionsUsed,o={};if(o.transmissionFactor=e.transmission,e.transmissionMap){const r={index:n.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};n.applyTextureTransform(r,e.transmissionMap),o.transmissionTexture=r}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class Da{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,s=n.extensionsUsed,o={};if(o.thicknessFactor=e.thickness,e.thicknessMap){const r={index:n.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};n.applyTextureTransform(r,e.thicknessMap),o.thicknessTexture=r}o.attenuationDistance=e.attenuationDistance,o.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class Na{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;const s=this.writer.extensionsUsed,o={};o.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class Oa{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(xa)&&!e.specularIntensityMap&&!e.specularColorMap)return;const n=this.writer,s=n.extensionsUsed,o={};if(e.specularIntensityMap){const r={index:n.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};n.applyTextureTransform(r,e.specularIntensityMap),o.specularTexture=r}if(e.specularColorMap){const r={index:n.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};n.applyTextureTransform(r,e.specularColorMap),o.specularColorTexture=r}o.specularFactor=e.specularIntensity,o.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class Fa{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const n=this.writer,s=n.extensionsUsed,o={};if(e.sheenRoughnessMap){const r={index:n.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};n.applyTextureTransform(r,e.sheenRoughnessMap),o.sheenRoughnessTexture=r}if(e.sheenColorMap){const r={index:n.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};n.applyTextureTransform(r,e.sheenColorMap),o.sheenColorTexture=r}o.sheenRoughnessFactor=e.sheenRoughness,o.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class ka{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;const n=this.writer,s=n.extensionsUsed,o={};if(e.anisotropyMap){const r={index:n.processTexture(e.anisotropyMap)};n.applyTextureTransform(r,e.anisotropyMap),o.anisotropyTexture=r}o.anisotropyStrength=e.anisotropy,o.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class Ua{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;const s=this.writer.extensionsUsed,o={};o.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class za{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;const n=this.writer,s=n.extensionsUsed,o={};if(e.bumpMap){const r={index:n.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};n.applyTextureTransform(r,e.bumpMap),o.bumpTexture=r}o.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class Ha{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const n=this.writer,s=e,o=new Float32Array(s.count*3),r=new Float32Array(s.count*4),l=new Float32Array(s.count*3),c=new V,h=new S,d=new hs,i=new S;for(let f=0;f<s.count;f++)s.getMatrixAt(f,c),c.decompose(h,d,i),h.toArray(o,f*3),d.toArray(r,f*4),i.toArray(l,f*3);const a={TRANSLATION:n.processAccessor(new K(o,3)),ROTATION:n.processAccessor(new K(r,4)),SCALE:n.processAccessor(new K(l,3))};s.instanceColor&&(a._COLOR_0=n.processAccessor(s.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:a},n.extensionsUsed[this.name]=!0,n.extensionsRequired[this.name]=!0}}xn.Utils={insertKeyframe:function(u,e){const n=u.getValueSize(),s=new u.TimeBufferType(u.times.length+1),o=new u.ValueBufferType(u.values.length+n),r=u.createInterpolant(new u.ValueBufferType(n));let l;if(u.times.length===0){s[0]=e;for(let c=0;c<n;c++)o[c]=0;l=0}else if(e<u.times[0]){if(Math.abs(u.times[0]-e)<.001)return 0;s[0]=e,s.set(u.times,1),o.set(r.evaluate(e),0),o.set(u.values,n),l=0}else if(e>u.times[u.times.length-1]){if(Math.abs(u.times[u.times.length-1]-e)<.001)return u.times.length-1;s[s.length-1]=e,s.set(u.times,0),o.set(u.values,0),o.set(r.evaluate(e),u.values.length),l=s.length-1}else for(let c=0;c<u.times.length;c++){if(Math.abs(u.times[c]-e)<.001)return c;if(u.times[c]<e&&u.times[c+1]>e){s.set(u.times.slice(0,c+1),0),s[c+1]=e,s.set(u.times.slice(c+1),c+2),o.set(u.values.slice(0,(c+1)*n),0),o.set(r.evaluate(e),(c+1)*n),o.set(u.values.slice((c+1)*n),(c+2)*n),l=c+1;break}}return u.times=s,u.values=o,l},mergeMorphTargetTracks:function(u,e){const t=[],n={},s=u.tracks;for(let o=0;o<s.length;++o){let r=s[o];const l=Bt.parseTrackName(r.name),c=Bt.findNode(e,l.nodeName);if(l.propertyName!=="morphTargetInfluences"||l.propertyIndex===void 0){t.push(r);continue}if(r.createInterpolant!==r.InterpolantFactoryMethodDiscrete&&r.createInterpolant!==r.InterpolantFactoryMethodLinear){if(r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),r=r.clone(),r.setInterpolation(gn)}const h=c.morphTargetInfluences.length,d=c.morphTargetDictionary[l.propertyIndex];if(d===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);let i;if(n[c.uuid]===void 0){i=r.clone();const f=new i.ValueBufferType(h*i.times.length);for(let g=0;g<i.times.length;g++)f[g*h+d]=i.values[g];i.name=(l.nodeName||"")+".morphTargetInfluences",i.values=f,n[c.uuid]=i,t.push(i);continue}const a=r.createInterpolant(new r.ValueBufferType(1));i=n[c.uuid];for(let f=0;f<i.times.length;f++)i.values[f*h+d]=a.evaluate(i.times[f]);for(let f=0;f<r.times.length;f++){const g=this.insertKeyframe(i,r.times[f]);i.values[g*h+d]=r.values[f]}}return u.tracks=t,u}};const Va=new xn,Lt=new ko,rs=new ho;window.dracoPath?rs.setDecoderPath(window.dracoPath):rs.setDecoderPath("./draco/");rs.setDecoderConfig({type:"wasm"});Lt.setDRACOLoader(rs);const Jn=[115,103,108,98];function Ga(u){const e=new Uint8Array(u.slice(0,4));let t=!0;for(let i=0;i<Jn.length;i++)if(e[i]!==Jn[i]){t=!1;break}if(!t)throw new Error("Invalid file format");const s=new DataView(u,4,2).getUint16(0,!1),r=new DataView(u,6,4).getUint32(0,!1),l=new Uint8Array(u.slice(10,10+r)),c=new TextDecoder().decode(l),h=JSON.parse(c),d=u.slice(10+r);return{version:s,jsonDescription:h,glbContent:d}}class os{constructor(e){this.props=e,this.cache=new Map}load(e,t,n,s){if(this.props.useCache&&this.cache.has(e)){t(this.cache.get(e));return}const o=this;fetch(e).then(r=>{if(!r.ok){s==null||s(new ErrorEvent("NetworkError",{message:"NetworkError for "+e+": "+r.statusText}));return}return r.arrayBuffer()}).then(async r=>{r||s==null||s(new ErrorEvent("Error",{message:"Not a valid sglb file."}));try{const l=o.parse(r);if(!l.glbContent){s==null||s(new ErrorEvent("Error",{message:"No glb content."}));return}const c=zn(l.glbContent,"model/gltf-binary"),h=await Lt.loadAsync(c);URL.revokeObjectURL(c),l.glbContent=void 0,l.glb=h.scene,r=void 0,this.cache.set(e,l),t(l)}catch(l){s==null||s(new ErrorEvent("Error",{message:l==null?void 0:l.message}))}}).catch(r=>{s==null||s(new ErrorEvent("Error",{message:r.message}))})}async loadAsync(e){if(this.props.useCache&&this.cache.has(e))return this.cache.get(e);try{const t=await fetch(e);if(!t.ok)throw new Error(`NetworkError for ${e}: ${t.statusText}`);const n=await t.arrayBuffer();if(!n)throw new Error("Not a valid sglb file.");const s=this.parse(n);if(!s.glbContent)throw new Error("No GLB content.");const o=zn(s.glbContent,"model/gltf-binary"),r=await Lt.loadAsync(o);return URL.revokeObjectURL(o),s.glbContent=void 0,s.glb=r.scene,this.cache.set(e,s),s}catch(t){throw t}}parse(e){return Ga(e)}clear(){[...this.cache.values()]}}const Qa="*{box-sizing:border-box}.slot-item-container .main{pointer-events:auto;cursor:pointer;font-size:12px;color:#fff;width:12px;height:12px;background:#fff0;border:1px solid #fff;border-radius:50%;transition:background .2s,width .14s,height .14s,border .14s}.slot-item-container .main.disable{cursor:not-allowed}.slot-item-container .main.hidden{display:none}.slot-item-container .main.drag-over{border-color:red}.slot-item-container .main.can-install{position:relative;width:34px;height:34px;background:#0066ff1a;border-color:#06f}.slot-item-container .main.filled{border-color:#00ff95}.slot-item-container .main.selected{border-width:4px}.slot-item-container .main.selected+.info{pointer-events:auto;overflow:visible;width:auto}.slot-item-container .main.has-error{border-color:red}.slot-item-container .main:after{pointer-events:none;content:attr(data-name);transition:all .2s .3s;opacity:0;position:absolute;left:50%;bottom:100%;transform:translate3d(-50%,5px,0);white-space:nowrap;font-size:12px;color:#000;padding:2px 8px;border-radius:2px;background:#fff}.slot-item-container .main:hover{background:#ffffff80}.slot-item-container .main:hover+.info{pointer-events:auto;overflow:visible;width:auto}.slot-item-container .name{margin-top:-10px;white-space:nowrap;font-size:12px;color:#000;padding:2px 8px;border-radius:2px;background:#fff}.slot-item-container .info{overflow:hidden;margin-left:-2px;margin-top:-19px;position:absolute;left:100%;top:50%;transform:translateY(-50%);width:0;display:flex;align-items:flex-start;transition:all .3s}.slot-item-container .info img{flex:0 0 auto;width:53px;height:29px}",Wa="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGsAAAA7CAYAAAB8MXT7AAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAGTSURBVHic7dxLbQNBEIThnigADGEhxAwcBoZgCIZgBoZgCIZgCIaQMIgZVC4daw/xXPLoqdX/3fbW0milUtfutMCdpCkiLhEx1U6CLkkvkt4k7atnQYekfR7US/Us6JB0yIOaqmfBA5JWks6SrhzUwCRN+TYdq2dBx+ygDtWzoEPSNg9qVz0LOmZBgsQ3sqUkvufqAf6SpFVEnCPiFhHr1tqteCR8hyBhYrY6OlTPgo5cHX1I2lbPgo6lBInFk3Rc+uroqXqAn8ogcc3H19bae+U8eIDEZ0LSJoMEZeHIWB2ZIPEZoCw0QVlogsRnYlYWsjoaGUHCRK6OOKiRfa2OMvWtqufBAwQJE5SFJmZl4aZ6FnSQ+Azk6mjxZeFv+/fycfbDWrTW1pSFgyLxmcjVEWXh6CgLTZD4DMzKwguro4ERJEywOjIhaUdZaIAgYYKy0ABloQkSnwlxKZUHcSmVBxKfgVwdnSgLB8d35iZIfCYoC01QFpog8Y3rftFWrotO+cilVKMiSJigLDSS30hQFhr4BEcKZN0LNhDxAAAAAElFTkSuQmCC";var ja=Object.defineProperty,Ka=Object.getOwnPropertyDescriptor,we=(u,e,t,n)=>{for(var s=n>1?void 0:n?Ka(e,t):e,o=u.length-1,r;o>=0;o--)(r=u[o])&&(s=(n?r(e,t,s):r(s))||s);return n&&s&&ja(e,t,s),s};let re=class extends us{constructor(u){super(),this.props=u,this._size=12,this.selected=!1,this.hasError=!1,this.canInstall=!1,this.hide=!1,this.disable=!1,this.filled=!1}onClick(u){u.preventDefault(),u.stopPropagation()}setSize(u=12){this._size=u}render(){var u;return st`
|
|
517
|
+
<div class="slot-item-container">
|
|
518
|
+
<div class="main
|
|
519
|
+
${this.selected?"selected":""}
|
|
520
|
+
${this.hasError?"has-error":""}
|
|
521
|
+
${this.canInstall?"can-install":""}
|
|
522
|
+
${this.hide?"hidden":""}
|
|
523
|
+
${this.disable?"disable":""}
|
|
524
|
+
${this.filled?"filled":""}
|
|
525
|
+
"
|
|
526
|
+
style="${`width: ${this._size+"px"}; height:${this._size+"px"}`}"
|
|
527
|
+
></div>
|
|
528
|
+
<div class="info" @click="${this.onClick}">
|
|
529
|
+
<img alt="" src="${Wa}">
|
|
530
|
+
<div class="name">
|
|
531
|
+
${(u=this.slot)==null?void 0:u.name}
|
|
532
|
+
</div>
|
|
533
|
+
</div>
|
|
534
|
+
</div>
|
|
535
|
+
`}};re.styles=cs([Qa]);we([Ue()],re.prototype,"_size",2);we([le({type:Boolean})],re.prototype,"selected",2);we([le({type:Boolean})],re.prototype,"hasError",2);we([le({type:Boolean})],re.prototype,"canInstall",2);we([le({type:Boolean})],re.prototype,"hide",2);we([le({type:Boolean})],re.prototype,"disable",2);we([le({type:Boolean})],re.prototype,"filled",2);we([le()],re.prototype,"slot",2);re=we([fs("slot-item")],re);const ue={ON_DROP:"slot-on-drop",ON_BEFORE_SELECTED:"slot-on-before-selected",ON_SELECTED:"slot-on-selected",ON_DEVICE_SELECTED:"slot-on-device-selected",ON_DROP_ERROR:"slot-on-drop-error",ON_ERROR_STATE_CHANGE:"slot-on-error-state-change"};class qs extends An{constructor(e,t){const n=document.createElement("div");super(n),this.props=e,this.target=t,this._emitter=new ze,this._slotContainer=new he,this._bracketSlots=[],this._hasError=!1,this.useBracket=!1,this.addEventListener=this._emitter.addListener.bind(this._emitter),this.removeEventListener=this._emitter.removeListener.bind(this._emitter),this._canInstall=!1,this._loading=!1,this._selected=!1,this._deviceSelected=!1,this._timer=0,this._tick=()=>{this._timer=requestAnimationFrame(this._tick),this.target&&this.props.slot.position.copy(No(this.target))},this.getWP=this._slotContainer.getWorldPosition.bind(this._slotContainer),this.name=e.name,this._slotUI=new re({name:e.name}),this._slotUI.slot=this,n.append(this._slotUI),this.add(this._slotContainer),this.props.slot.add(this),t&&this._tick(),n.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),this.selected=!this.selected}),n.addEventListener("dragover",s=>{if(s.preventDefault(),!this._canInstall){s.dataTransfer&&(s.dataTransfer.dropEffect="none");return}}),n.addEventListener("drop",async s=>{var r;if(s.preventDefault(),s.stopPropagation(),!this._canInstall)return;const o=(r=s.dataTransfer)==null?void 0:r.getData("application/json");if(o){const l=JSON.parse(o);try{await this.install(l),this._emitter.emit(ue.ON_DROP,this)}catch(c){this._emitter.emit(ue.ON_DROP_ERROR,c)}}else this._emitter.emit(ue.ON_DROP_ERROR,new Error("No device info"))})}get hasDevice(){return this._slotContainer.children.length>0}shapeKeyChanged(e,t){if(this.props.follows.has(e)){const n=this.props.follows.get(e);if(n){let s="x";e==="height"?s="y":e==="width"&&(s="z"),this.position[s]=(t-n.origin)*n.scale}}}async loadGlb(e){const n=await new os({useCache:!0}).loadAsync(e);if(n.glb)return n.glb.clone(!0)}async installBracket(e){const n=await new os({useCache:!0}).loadAsync(e);if(!n.glb)return;const s=n.glb.clone(!0);this.useBracket=!0,this._slotContainer.add(s)}async install(e){if(!this._loading){this._loading=!0;try{const t=await this.loadGlb(e.url);if(!t)throw new Error(`Fail to load device from: ${e.url}`);if(e.bracketUrl){const n=await this.loadGlb(e.bracketUrl);if(n)this.clearSlot(),n.traverse(s=>{s.name.startsWith("Slot")&&this._bracketSlots.push(s)}),this._slotContainer.add(n);else throw new Error(`Fail to load bracket from: ${e.bracketUrl}`);this._bracketSlots.forEach(s=>{s.add(t)})}else this.clearSlot(),this._slotContainer.add(t);this.deviceInfo=e,this._slotUI.filled=!0}catch(t){throw t}finally{this._loading=!1}}}get device(){return this._slotContainer.children.length?this._slotContainer.children[0]:null}changeName(e){var t;this.name=e,this.props.slot.userData.name=e,this.props.name=e,(t=this.element)==null||t.setAttribute("data-name",this.props.name)}clearSlot(){this._bracketSlots=[],this._slotContainer.children.forEach(e=>{e.removeFromParent(),Ae(e)}),this._slotUI.filled=!1,this.deviceInfo=void 0}enable(){this._slotUI.disable=!1}disable(){this._slotUI.disable=!0}hide(){this._slotUI.hide=!0}show(){this._slotUI.hide=!1}get selected(){return this._selected}set selected(e){e&&this._emitter.emit(ue.ON_BEFORE_SELECTED,e),this._selected=e,this._slotUI.selected=e,this._emitter.emit(ue.ON_SELECTED,e)}get deviceSelected(){return this._deviceSelected}set deviceSelected(e){this._deviceSelected=e,this._emitter.emit(ue.ON_DEVICE_SELECTED,e)}get error(){return this._hasError}set error(e){this._loading&&setTimeout(()=>{this.error=e},100),this._hasError=e,this._slotUI.hasError=e,this._emitter.emit(ue.ON_ERROR_STATE_CHANGE,e)}getCanInstall(){return this._canInstall}canInstall(e){this._canInstall=e,this._slotUI.canInstall=e}dispose(){cancelAnimationFrame(this._timer),this.clearSlot(),this._emitter.removeAllListeners(),Ae(this._slotContainer),this.element.remove()}render(e){const t=this.element.style.transform,n=/translate\(-?\d*\.?\d*%?,?\s-?\d*\.?\d*%?\)\s*translate\((-?\d*\.?\d*)px,\s*(-?\d*\.?\d*)px\)/.exec(t);if(!n)return;const s=new N(parseFloat(n[1]),parseFloat(n[2])),o=e.mousePos.distanceTo(s);let r=12,l=24,c=30;if(this._canInstall&&(r=34,l=60,c=60),o<c){let h=(c-o)*1+r;o<20&&(h=l),h>l&&(h=l),this._slotUI.setSize(h)}else this._slotUI.setSize(r)}clone(e){return new he}}var Ya=Object.defineProperty,Xa=Object.getOwnPropertyDescriptor,yn=(u,e,t,n)=>{for(var s=n>1?void 0:n?Xa(e,t):e,o=u.length-1,r;o>=0;o--)(r=u[o])&&(s=(n?r(e,t,s):r(s))||s);return n&&s&&Ya(e,t,s),s};let at=class extends us{constructor(u,e=0){super(),this.offset=u,this.heightOffset=e,this.lines=new Map,this.setOffset(this.offset.x,this.offset.y)}setOffset(u,e){this.offset.set(u,e),this.style.setProperty("--left",this.offset.x+"px"),this.style.setProperty("--top",this.offset.y+"px")}setHeightOffset(u){this.heightOffset=u,this.style.setProperty("--heightOffset",this.heightOffset+"px")}hide(){var u;(u=this.container)==null||u.classList.add("hidden")}show(){var u;(u=this.container)==null||u.classList.remove("hidden")}addLine(u){this.lines.has(u.uuid)||this.lines.set(u.uuid,u)}clear(){this.lines.clear()}removeLine(u){this.lines.delete(u.uuid)}getLineByName(u){const e=[];return this.lines.forEach((t,n)=>{t.name===u&&e.push(t)}),e}getLineBySlot(u){const e=[];return this.lines.forEach((t,n)=>{t.slot===u&&e.push(t)}),e}getPath(u){const e=u.end.clone();e.set(e.x-this.offset.x,e.y-this.offset.y);const t=u.start.clone().add(e).multiplyScalar(.5),n=u.start.clone().add(e).multiplyScalar(.7);return`M${u.start.x} ${u.start.y}
|
|
536
|
+
C${t.x} ${u.start.y}
|
|
537
|
+
${n.x} ${u.end.y}
|
|
538
|
+
${e.x} ${e.y}
|
|
539
|
+
`}updateLine(u){this.lines.set(u.uuid,u)}forceUpdate(){this.requestUpdate()}render(){return bn`
|
|
540
|
+
<svg class="container">
|
|
541
|
+
<g>
|
|
542
|
+
${[...this.lines.values()].map(u=>bn`<path
|
|
543
|
+
class="${u.valid?"valid":""} ${u.editable?"editable":""} ${u.highlight?"highlight":""}"
|
|
544
|
+
d="${this.getPath(u)}"></path>`)}
|
|
545
|
+
</g>
|
|
546
|
+
</svg>`}};at.styles=cs`
|
|
547
|
+
:host {
|
|
548
|
+
--left: 0px;
|
|
549
|
+
--top: 0px;
|
|
550
|
+
position: absolute;
|
|
551
|
+
left: var(--left);
|
|
552
|
+
top: var(--top);
|
|
553
|
+
pointer-events: none;
|
|
554
|
+
width: calc(100% - var(--left));
|
|
555
|
+
height: calc(100% - var(--top));
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
svg {
|
|
559
|
+
width: 100%;
|
|
560
|
+
height: calc(100% + var(--heightOffset));
|
|
561
|
+
&.hidden {
|
|
562
|
+
display: none;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
path {
|
|
567
|
+
stroke: #787878;
|
|
568
|
+
fill: transparent;
|
|
569
|
+
stroke-width: 0.5px;
|
|
570
|
+
stroke-dasharray: 4 4;
|
|
571
|
+
|
|
572
|
+
&.valid {
|
|
573
|
+
stroke-width: 1px;
|
|
574
|
+
stroke: #00FF95;
|
|
575
|
+
stroke-dasharray: none;
|
|
576
|
+
&:hover {
|
|
577
|
+
cursor: pointer;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
&.highlight {
|
|
582
|
+
stroke: #0066FF;
|
|
583
|
+
cursor: pointer;
|
|
584
|
+
stroke-width: 2px;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
&.editable {
|
|
588
|
+
pointer-events: auto;
|
|
589
|
+
&:hover {
|
|
590
|
+
cursor: pointer;
|
|
591
|
+
stroke: #0066FF;
|
|
592
|
+
stroke-width: 2px;
|
|
593
|
+
stroke-dasharray: none;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
`;yn([Ue()],at.prototype,"lines",2);yn([Ne(".container")],at.prototype,"container",2);at=yn([fs("device-lines")],at);class sr extends ye{constructor(e,t){super(),this.radius=e,this._text=new qa(""),this._line=new Fi(new ps,new hn({color:"#888"})),this._box=new fe,this._box.geometry=new Rn(e,e+.003,128),this._box.material=new ke({color:"#898989",side:ot}),this.position.y=t,this._box.rotateX(-Math.PI/2),this.add(this._box),this.add(this._line),this.add(this._text)}update(e){var t;this.radius=e,(t=this._box.geometry)==null||t.dispose(),this._box.geometry=new Rn(e,e+.003,128),this._text.update((e*1e3).toFixed(0))}change(e){const t=e.clone();t.setY(0),t.normalize().multiplyScalar(this.radius),this._text.position.set(t.x,t.y,t.z),this._line.geometry.dispose(),this._line.geometry.setFromPoints([t,new S]),this._line.computeLineDistances()}}class qa extends An{constructor(e){const t=document.createElement("div");super(t),this._wrapper=document.createElement("div"),this._wrapper.style.fontSize="10px",this._wrapper.style.color="#898989",this._wrapper.style.whiteSpace="nowrap",this._wrapper.style.position="absolute",this._wrapper.style.transform="translateX(-50%)",this._wrapper.style.bottom="4px";const n=document.createElement("div");n.style.position="relative",n.style.zIndex="10",n.style.width=n.style.height="5px",n.style.borderRadius="50%",n.style.background="#ff6666",t.append(this._wrapper,n),this.update(e)}update(e){this._wrapper.innerText="旋转半径:"+e+" mm"}}const Cs="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAAAXNSR0IArs4c6QAADOlJREFUeF7t3Wt6GzcSQNGmNxZ7M5nZhZNd2N5MlI0N56NpWpJNif0oPAo4+ht0AbhVuN0NtJnT4g8BBKYlcJp25iaOAAILASgCBCYmQAATJ9/UESAANYDAxAQIYOLkmzoCBKAGEJiYAAFMnHxTR4AA1AACExMggImTb+oIEIAaQGBiAgQwcfJNHQECUAMITEyAACZOvqkjQABqAIGJCRDAxMk3dQQIQA0gMDEBApg4+aaOAAGoAQQmJkAAEyff1BEgADWAwMQECGDi5Js6AgSgBhCYmAABTJx8U0eAANQAAhMTIICJk2/qCBCAGkBgYgIEMHHyTR0BAlADCExMgAAmTr6pI0AAagCBiQkQwMTJN3UECEANIDAxAQKYOPmmjgABqAEEJiZAABMn39QRIAA1gMDEBAhg4uSbOgIEoAYQmJgAAUycfFNHgADUAAITEyCAiZNv6ggQgBpAYGICBDBx8k0dAQJQAwhMTIAAJk6+qSNAAGoAgYkJEMDEyTd1BAhADSAwMQECmDj5po4AAagBBCYmQAATJ9/UESAANYDAxAQIYOLkmzoCBKAGEJiYAAFMnHxTR4AA1MBjAv89f1z+t3z82fDb6a/HF2mRgQABZMhSqzFeFv55+bycXyz+57H8vRBBq8yE9UsAYSgHC3S96//z7qxOy9Py9fRpsJlPNR0CmCrdKye7ZvHfQpHASqh9NiOAPvPSdlT/Of/zxmP//XGRQNt8HeidAA7AG/LSP8+XDb7PO+ZmT2AHtNaXEEDrDPTU//7Ff5sFCfSUzxVjIYAVkKZocnzxXzF9WD4tX05PUzAbYJIEMEASD09hy6bfms5IYA2lLtoQQBdpaDyIP8/n0BHYFAzFWTIYAZSkmyH21h3/tXMigbWkmrYjgKb4G3deavE/T8umYOMUP+qeAB4RGvW/R236PeZDAo8ZNWtBAM3QN+y43uK/TZIEGqb7va4JoNPEFBtW/cV/nYqTgWIpPRKYAI7Qy3Zt9HHf1vmTwFZixdsTQHHEnXTQevFfMDgZ6KQYnodBAN2lpNCAos/69w6TBPaSK3IdARTB2lnQ8sd9WydsU3ArsULtCaAQ2G7Cttr0ewyABB4zKt6CAIojbthBv4v/BoUEGpbHdVvG35gE+l/8V+5OBprWHwE0xV+o8yyL/zZ9EihUCI/DEsBjRrla9HDct5WYk4GtxMLaE0AYyk4C9XLctxUHCWwlFtKeAEIwdhKkv+O+rWBsCm4ldrA9ARwE2M3l2d773wZHAhWLigAqwi7W1TiL/4aIBIoVy+vABFAJdLFuxlv8V1ROBoqVzMvABFAFc6FORl38N1wkUKhwnsMSQHHEhTrIeNy3B8W3kxrdw23lNeCuBNVds6zHfVtBOh7cSmxTewLYhKuTxvmP+7aBJIFtvDa0JoANsLpoOvp7/9uQnQwUKEACKAC1WMh5F/8NKQkEFxcBBAMtFs7iv6J1MhBaYgQQirNQMIv/NVgSCCs0AghDWSjQLMd9W/E5HtxK7G57AgjBWCiIxf82WCcDIUVHACEYCwWZ7bhvK0YS2Erst/YEcBhhoQAW/1qwTgbWkrrTjgAOwCt2qU2/rWhJYCuxH+0JYCe4YpdZ/PvQOhnYxY0AdmErdJHFfwwsCWzmRwCbkRW6wOKPAUsCmzgSwCZchRo77osD62RgE0sC2ISrUONZ/mlvIXx3zraelq+nT7W6y9wPAbTOnuO+UhlwMrCCLAGsgFSsiff+Ymh/BCaBB4QJoHQJvhXf4q9FngTeIU0AtcrwZT8Wf13qTgbe5E0AdUtxWSz+2sSv/ZHAXe4EULMcHffVpP26L8eDBNCu+n707LivbQpI4M6JaduUzNO7475ecm1T8EUmvALUKEvv/TUob+mDBH7QIoAtZbOnrcW/h1r5a2wKfmdMAKVLzaN/acL74tsPIIB9lbPhKnf/DbAaNPUU4AmgaNkRQFG8AcGn3wvwChBQRW+G8Phfkm5EbAKIoCjGGwQIoPfSIIDeM5R6fL786z19BNB7htKPz1NArymcfvE7BqxVmjYDa5Fe24/F/4OUTcC1JRPR7iqCy9cXf0SE+xnjvHwMjdc62OWMPuLvvPz7KsyH5Wn5coqJHTG+DmIQQAdJODyE8V4z3KEPF8W6AASwjlPfrUbbbPSBTrV6I4BqqAt2RAAF4Y4dmgBGye9IvzXw7aQuK9Ul0JVAF+9mpH0AAiheLrcOCKAa6sIdjXLU6F/pFS6U1+EJoCrugp2Nsg9AAAWL5PfQBFAVd+HOxtgHcARYuExehieAirCLdzXGPgABFC+U5w4IoCLs4l2NIADfABQvE08AVRFX7GyEjUAnABULxm8CVoVdvLPsArABWLxEfu3AK0B15AU7zC6AZfH+X7A87oUmgMrAi3ZHAEXxjhicAEbKavZvAWwAVq9GAqiOvGCH2QVgA7BgcdwPTQDVkRfsMLcAvP8XLI23QhNAA+jFuiSAYmhHDUwAI2U28yag9/8mlUgATbAX6jSzALz/FyqK98MSQBPshTrNKwDv/4VK4lFYAnhEKNN/z/tvAQigUZ0RQCPwRbrNKgCP/0XKYU1QAlhDKUubjL8H4Pv/ptVFAE3xB3eeUQC+/w8ugm3hCGAbr35bZ/0GwON/05oigKb4AzvPeALg8T+wAPaFIoB93Pq7yuN/fzlJMCICSJCkh0P0+P8QkQb3CRDACJWR8fHf5l8XlUcAXaTh4CBynv/7+Odg2iMuJ4AIiq1jZHz/t/vfumq+908AXaThwCA8/h+A51ICyF4D7v7ZM9h0/ATQFP/Bzt39DwJ0OQFkrgF3/8zZ62LsBNBFGnYMwt1/BzSX/EqAALLWRMa7v7P/7qqNALpLyYoBufuvgKTJGgIEsIZSb23c/XvLSNrxEEC21Ln7Z8tY1+MlgK7T88vgci7+ZfHVX7dVRgDdpubOwDz6Z8pWirESQIo0Lcvi7p8lU6nGSQAZ0pV18Tv26766CKD3FGX9sQ+Lv/fK+j4+Aug5TXkX/7L4f/31XFk/x0YAPacp56bfhagf++i5rl6MjQB6TVTOX/m5PFM+LV9Pn3rFalyvCRBAjxWRd9PPmX+P9fTOmAigt4RlXvwe/XurpofjIYCHiCo2yPrYf0Xkvb9iqUR1RQBRJI/Gybz4vfcfzX6z6wmgGfoXHWde/Jdp+Na/hyraNQYC2IUt6KLLOf95+bycl49BEeuHcd5fn3lgjwQQCHNTqMwf+TxP1Hv/pqT315gAWuQk907/jZjF36J2gvskgGCgD8Nlf9+34/8wxZkaEECtbI3wvm/x16qWav0QQA3UYzzyX0h57K9RLxX7IICSsMe561v8JeukYWwCKAV/nLu+f9pbqkY6iEsA0UkY6a5/+cLvtPy9fDk9RWMSrw8CBBCVh5EW/oWJz3ujKqPrOAQQkZ6RHvft9EdURJoYBHAkVSPe9T3yH6mIdNcSwJ6Ujbbw3fX3VMEQ1xDAljSOuPBt9G2pgOHaEsCalI648N3112R++DYE8F6Kx9vcu83WF33DL+11EySAXzmNe7e/zNTCX7cupmlFALdUX+72p+WP1D/Oca9sL+/45+Xf5dvpr2mq2kRXEyCAMX6Y4/eE29xbvQhmbkgAIwngtugvFe3z3ZnX9eq5E8AFVebNPnf61cWu4b0HRVSeCVyfBq4/0NnjfsBlsV/+Lu/0H5Ynd3nFe5SAJ4A1BF+K4SaH60Is82u+t4Vusa/JjjYHCBDAAXg/L70I4vZ3e4JYG/dyJ7/9eW9fS027IAIEEARSGAQyEiCAjFkzZgSCCBBAEEhhEMhIgAAyZs2YEQgiQABBIIVBICMBAsiYNWNGIIgAAQSBFAaBjAQIIGPWjBmBIAIEEARSGAQyEiCAjFkzZgSCCBBAEEhhEMhIgAAyZs2YEQgiQABBIIVBICMBAsiYNWNGIIgAAQSBFAaBjAQIIGPWjBmBIAIEEARSGAQyEiCAjFkzZgSCCBBAEEhhEMhIgAAyZs2YEQgiQABBIIVBICMBAsiYNWNGIIgAAQSBFAaBjAQIIGPWjBmBIAIEEARSGAQyEiCAjFkzZgSCCBBAEEhhEMhIgAAyZs2YEQgiQABBIIVBICMBAsiYNWNGIIgAAQSBFAaBjAQIIGPWjBmBIAIEEARSGAQyEiCAjFkzZgSCCBBAEEhhEMhIgAAyZs2YEQgiQABBIIVBICMBAsiYNWNGIIgAAQSBFAaBjAQIIGPWjBmBIAIEEARSGAQyEiCAjFkzZgSCCBBAEEhhEMhIgAAyZs2YEQgiQABBIIVBICMBAsiYNWNGIIgAAQSBFAaBjAQIIGPWjBmBIAIEEARSGAQyEiCAjFkzZgSCCBBAEEhhEMhIgAAyZs2YEQgiQABBIIVBICMBAsiYNWNGIIgAAQSBFAaBjAQIIGPWjBmBIAL/B0Vnkh9MONioAAAAAElFTkSuQmCC",Za="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAAAXNSR0IArs4c6QAADOhJREFUeF7t3WFy3DYSQGHO5mC2r2NXzuDkDFvJdaIcbK2tkWdiWZE0JKcbQBOf/wZsAK8bjyRATU6LfwggMC2B07QzN3EEEFgIQBEgMDEBApg4+aaOAAGoAQQmJkAAEyff1BEgADWAwMQECGDi5Js6AgSgBhCYmAABTJx8U0eAANQAAhMTIICJk2/qCBCAGkBgYgIEMHHyTR0BAlADCExMgAAmTr6pI0AAagCBiQkQwMTJN3UECEANIDAxAQKYOPmmjgABqAEEJiZAABMn39QRIAA1gMDEBAhg4uSbOgIEoAYQmJgAAUycfFNHgADUAAITEyCAiZNv6ggQgBpAYGICBDBx8k0dAQJQAwhMTIAAJk6+qSNAAGoAgYkJEMDEyTd1BAhADSAwMQECmDj5po4AAagBBCYmQAATJ9/UESAANYDAxAQIYOLkmzoCBKAGEJiYAAFMnHxTR4AA1AACExMggImTb+oIEIAaQGBiAgQwcfJNHQECUAMITEyAACZOvqkjQABqAIGJCRDAxMk3dQQIQA0gMDEBApg4+aaOAAGoAQQmJkAAEyff1BEgADWAwMQECGDi5Js6AgSgBm4TePzvx2X5z8d/Gp6+/Hb7Ii0qECCAClnqNcanhf/L12V5/LH4f4zl94UIemUmrF8CCEN5sEDf7/p/vT+r08Ny+vzpYDOfajoEMFW6V0521eK/xiKBlVSHbEYAQ6al86Ae//zrjcf+NwZGAp0ztrt7AtiN7qAXPv5x3uD7umN29gR2QOt9CQH0zsBI/e9f/NdZkMBI+VwxFgJYAWmKJvcv/gumb5+W068PUzA7wCQJ4ABJvHsKmzb91vRGAmsojdCGAEbIQu8xPP7xGDsEm4KxPPOiEUAe2xqRN+/4r50WCawl1bMdAfSk37vvtMX/z8RsCvbO8Y3+CWDwBKUNL2zT7+YISeAmon4NCKAf+349t1v81zmSQL9sv9szAQyamLRhtV/8l6k4GUjL6R2BCeAOeOUuDT/u20qABLYSy25PANmER4nfffGfQTgZGKUcruMggNEykjWe8LP+vQMlgb3kMq4jgAyqo8XMP+7bOmObgluJJbUngCSww4Tttul3kwAJ3ESU34AA8hn362HcxX9lQgL9quOpZwLonIC07sdf/JepOxlIq4EVgQlgBaRyTcos/itZEuhVYwTQi3xWv0Mc922dnJOBrcSi2hNAFMlR4gxz3LcVCAlsJRbRngAiKI4SY7zjvq1kbApuJXZnewK4E+Awl5d773+THAk0LCoCaAg7ravjLP4rIhJIK5afAxNAI9Bp3Rxv8V9QORlIq5lngQmgBeWsPg67+K/ASCCrdK5xCSCbcFb8ksd9O2CcvqjRHdjWXgLuWlKjtSt73LcVpOPBrcS2tCeALbRGaVv/uG8jSRLYCGx1cwJYjWqQhod/73+Ts5OBhBIkgASoaSHnXfxXpCQQXFwEEAw0LZzFf0HrZCCyxgggkmZWLIv/BVkSiCo1AogimRVnluO+rfwcD24l9mp7AgjBmBTE4n8HrJOBiKojgAiKWTGmO+7bCpIEthJ72Z4A7iWYdb3Fv5ask4G1pF5pRwB3wEu71KbfVrQksJXYpT0B7ASXdpnFvxOtk4E94AhgD7Wsayz+O8mSwFaABLCVWFZ7iz+ILAlsAUkAW2hltXXcF0jWycAWmASwhVZW22n+tDcL4L8Otx6W0+dPrXqr3A8B9M6e476sDDgZWEGWAFZASmvivT8N7SUwCdwgTADZJfhWfIu/FXkSeIc0AbQqw+f9WPyNqTsZeAs4ATQuxcXib0380h8JvAaeAFqWo+O+lrRf9OV4kAA6lt9T1477OmeABP51YNo5I/N077hvlFzbFHyWCa8ALcrSe38Lylv6IIELLQLYUjZ72lr8e6g1uMam4BkyAWSXmkf/bMI749sPIICdpbP6Mnf/1aj6NPQU4Akgs/IIIJNuROzp9wIIIKKM3orh8T+TbkRsAoigKMYbBAhg9NIggNEzVHp8vvwbPX0EMHqGyo/PU8CoKZx+8TsFaFWaNgNbkV7bj8V/IWUTcG3JRLT7LoLz5xcfIsL9iPH4MTZe72inh5gRPP79c5xvD8vp16DYMSPsHYUAemcgov/jvWa4Q0fUxYoYBLAC0vBNDrfZ6AOdVjVHAK1IZ/ZDAJl0Dx2bAI6S3iP91sDpi7psVJdANwKd3s2R9gEIIL1crh0QQDPUyR0d5qjRX+klV8pP4QmgJe3Mvg6zD0AAmWXyMjYBtKSd3dcx9gEcAWbXybP4BNAQdnpXx9gHIID0QvnRAQE0hJ3e1SEE4BuA9DrxBNASccO+jrAR6ASgYcH4TcCmsNM7Ky8AG4DpNfKiA68ArYln9ldeAIv3/8z6eCU2ATQGntodAaTiPWJwAjhSVst/C2ADsHU5EkBr4pn9VReADcDM6ng1NgE0R57YYW0BeP9PLI23QhNAB+hpXRJAGtqjBiaAI2W29Cag9/8epUgAPahn9VlZAN7/s6ri3bgE0AV7Uqd1BeD9P6kkboUlgFuEKv33un8LQACd6owAOoFP6baqADz+p5TDmqAEsIZSlTYlfw/A9/89y4sAetKP7rukAHz/H10GW+IRwBZaI7et+g2Ax/+uVUUAXfEHdl7yBMDjf2AF7ApFALuwDXiRx/8BkzL+kAhg/BzdHqHH/9uMtHiVAAEcoTBKPv7b/Buh9AhghCzcO4aa5/8+/rk37wHXE0AAxO4hKr7/2/3vXjbnARDAEGm4YxAe/++A51ICqF4D7v7VM9h1/ATQFf+dnbv73wnQ5QRQuQbc/Stnb4ixE8AQadgxCHf/HdBc8pIAAVStiYp3/8XZ/2jlRgCjZWTNeNz911DSZgUBAlgBabgm7v7DpaTqgAigWubc/atlbOjxEsDQ6XkxuJqLf1l89TdslRHAsKl5ZWAe/Stlq8RYCaBEmpZlcfevkqlS4ySACumquvgd+w1fXQQweoqq/tiHxT96ZT2NjwBGTlPdxb8si//X38ildR0bAYycpZqbfmeifuxj5Lp6NjYCGDVRNX/l5/xQ+bCcPn8aFatx/UyAAEasiLqbfs78R6ynd8ZEAKMlrPLi9+g/WjXdHA8B3ETUsEHZx/4nRt77G5ZKVFcEEEXy3jilF7/3/nvT3+t6AuhF/nm/pRf/ed/vizoaoY52jEHidkALu+TpnP+Xr8vy+DEsZvNAzvubIw/skAACYW4KVfojn39m6r1/U9LHa0wAPXJSe6f/Sszi71E7wX0SQDDQm+Gqv+9/n6DFfzPRNRoQQKs8HeJ93+JvVS6t+iGAFqSP8cjvzt+iVhr3QQCZwI9z17f4M+ukY2wCyIJ/nLu+P+3NqpEB4hJAdBIOddc/PSzL/35fTr8+RGMSbwwCBBCVh0Mt/DMUn/dGlcbIcQggIjuHety30x9RElViEMA9mTriXd8j/z0VUe5aAtiTssMtfHf9PWVwhGsIYEsWD7nwbfRtKYGjtSWANRk95MJ311+T+qO3IYD3Mny8zb3rbH3Lf/SVvXJ+BPAS1HHv9ueZWvgrF8YszQjgmumnu/3pQ+0f53itbM/v+I9/L6cvv81S1Oa5ngABHOOHOV7JuM299ctg3pYEcCgBXBb9uZ59vjvvqt4wcwI4wyq92edOv6HeNX1BgACeA/n+NHD5gc4R9wPOi/3JWH8vy7cHd3nr+V4CBLCG4E9ieHq+/nBZiEm/5ntd6Bb7mvRos58AAexn9+PKJ0Fc/12fINYG/vbjT229t6+Fpl0QAQIIAikMAhUJEEDFrBkzAkEECCAIpDAIVCRAABWzZswIBBEggCCQwiBQkQABVMyaMSMQRIAAgkAKg0BFAgRQMWvGjEAQAQIIAikMAhUJEEDFrBkzAkEECCAIpDAIVCRAABWzZswIBBEggCCQwiBQkQABVMyaMSMQRIAAgkAKg0BFAgRQMWvGjEAQAQIIAikMAhUJEEDFrBkzAkEECCAIpDAIVCRAABWzZswIBBEggCCQwiBQkQABVMyaMSMQRIAAgkAKg0BFAgRQMWvGjEAQAQIIAikMAhUJEEDFrBkzAkEECCAIpDAIVCRAABWzZswIBBEggCCQwiBQkQABVMyaMSMQRIAAgkAKg0BFAgRQMWvGjEAQAQIIAikMAhUJEEDFrBkzAkEECCAIpDAIVCRAABWzZswIBBEggCCQwiBQkQABVMyaMSMQRIAAgkAKg0BFAgRQMWvGjEAQAQIIAikMAhUJEEDFrBkzAkEECCAIpDAIVCRAABWzZswIBBEggCCQwiBQkQABVMyaMSMQRIAAgkAKg0BFAgRQMWvGjEAQAQIIAikMAhUJEEDFrBkzAkEECCAIpDAIVCRAABWzZswIBBEggCCQwiBQkQABVMyaMSMQRIAAgkAKg0BFAgRQMWvGjEAQgf8DKv6MH/R9oFMAAAAASUVORK5CYII=";class $n extends An{constructor(e,t){const n=document.createElement("div");super(n),this.props=e,this.amr=t,this._direction=1,this._controllingRotate=!1,this._controlling=!1,this._startAt=0,this._looper=0,this._initial=0,this._canRotate=!1,this._update=()=>{if(this._looper=requestAnimationFrame(this._update),this._controlling){let r=(Date.now()-this._startAt)/200;r>4&&(r=4);let l=this._initial+.005*r*this._direction;if(l>this.props.max||l<this.props.min||(this._initial=l,!this.mechanism))return;this.mechanism.position.setY(l)}},e.userData&&e.userData.target&&t.traverse(r=>{r.name===e.userData.target.name&&(this.mechanism=r)}),n.style.fontSize="30px",n.style.color="#0066FF",n.style.cursor="pointer",n.style.pointerEvents="auto";const s=document.createElement("div");s.innerText="↑",s.style.position="absolute",s.style.left="0",s.style.transform="translateX(-50%)",s.style.marginBottom="5px",s.setAttribute("data-direction","up");const o=document.createElement("div");if(o.style.position="absolute",o.style.left="0",o.style.transform="translateX(-50%)",o.innerText="↓",s.style.bottom=o.style.top="8px",o.setAttribute("data-direction","down"),Array.from([s,o]).forEach(r=>{r.addEventListener("mousemove",()=>{r.style.color="#00FF95"}),r.addEventListener("mouseleave",()=>{r.style.color="#0066FF"}),r.addEventListener("pointerdown",()=>{this.mechanism&&(this._controlling=!0,this._startAt=Date.now(),this._initial=this.mechanism.position.y,this._direction=r.getAttribute("data-direction")==="up"?1:-1)}),r.addEventListener("pointerup",()=>{this._controlling=!1}),r.addEventListener("pointerleave",()=>{this._controlling=!1})}),e.userData&&(this._canRotate=e.userData.canRotate,this._canRotate)){const{rotateTarget:r,rotateDuration:l,rotateStep:c,rotateMax:h,rotateMin:d}=e.userData;let i;if(r&&(t.traverse(a=>{a.name===r.name&&(i=a)}),i)){const a=document.createElement("div");a.style.background=`url(${Cs}) center no-repeat`,a.style.backgroundSize="100% auto",a.style.width=a.style.height="35px",a.style.position="absolute",a.style.top="0",a.style.transform="translateY(-50%) scaleX(-100%) rotateZ(-30deg) rotateX(-40deg)",a.style.marginBottom="5px",a.setAttribute("data-direction","left"),n.append(a);const f=document.createElement("div");f.style.background=`url(${Cs}) center no-repeat`,f.style.backgroundSize="100% auto",f.style.width=f.style.height="35px",f.style.position="absolute",a.style.right=f.style.left="10px",f.style.top="0",f.style.transform="translateY(-50%) rotateZ(-30deg) rotateX(-40deg)",f.style.marginBottom="5px",f.setAttribute("data-direction","right"),n.append(f),Array.from([a,f]).forEach(g=>{g.addEventListener("mousemove",()=>{g.style.backgroundImage=`url(${Za})`}),g.addEventListener("mouseleave",()=>{g.style.backgroundImage=`url(${Cs})`}),g.addEventListener("pointerdown",()=>{if(this._timer&&this._timer.isPlaying())return;this._controllingRotate=!0,this._startAt=Date.now(),this._direction=g.getAttribute("data-direction")==="left"?-1:1;let A=c/180*Math.PI*this._direction+i.rotation.y;A>h/180*Math.PI?A=h/180*Math.PI:A<d/180*Math.PI&&(A=d/180*Math.PI),this._timer=new mn(i.rotation).to({y:A}).duration(l).start()}),g.addEventListener("pointerup",()=>{this._controllingRotate=!1}),g.addEventListener("pointerleave",()=>{this._controllingRotate=!1})})}}n.append(s,o),this.scale.set(.01,.01,.01),this.matrixAutoUpdate=!1,this.updateMatrix(),this._update()}dispose(){cancelAnimationFrame(this._looper),this.element.remove()}}class Ja extends _n{constructor(e){const t=document.createElement("div");super(t),this.props=e,this._scale=.01,this._emitter=new ze,this.addEventListener=this._emitter.on.bind(this._emitter),this.removeEventListener=this._emitter.on.bind(this._emitter),this._mouseStart=new N,this._targetSize=new N,this._caches=[],this._sizeFlag="width",this._direction=1,this._lines=[],this._pointerdown=c=>{const{pageX:h,pageY:d}=c;this.endNode.setPointerCapture(c.pointerId),this._mouseStart.set(h,d),this._targetSize.setX(parseFloat(this.endNode.parentElement.style.width)),this._targetSize.setY(parseFloat(this.endNode.parentElement.style.height))},this._pointermove=c=>{if(!this._mouseStart.x)return;const{pageX:h,pageY:d}=c;let i=h-this._mouseStart.x,a=i+this._targetSize.x;this._sizeFlag==="height"&&(i=d-this._mouseStart.y,a=i*this._direction+this._targetSize.y);const f=a%10;a=a-f,i=(a-this._targetSize.x)*this._direction,this._sizeFlag==="height"&&(i=(a-this._targetSize.y)*this._direction),this._textNode.innerText=(a/100).toFixed(2)+" m",this.endNode.parentElement.style[this._sizeFlag]=`${a}px`},this._pointercancel=c=>{this.endNode.releasePointerCapture(c.pointerId),this._mouseStart.set(0,0)};const{start:n,end:s}=e,o=s.distanceTo(n);this.props.axios==="z"?this.props.axios="y":this.props.axios==="y"&&(this.props.axios="z"),this.props.axios==="y"&&(this._sizeFlag="height");const r=document.createElement("div");r.style.position="absolute",r.style.left="0",r.style.bottom="0",t.append(r),this._textNode=document.createElement("div"),this._textNode.innerText=o.toFixed(2)+" m",r.append(this._textNode);const l=document.createElement("div");this.endNode=l,l.style.position="absolute",l.style.left="auto",l.style.right="0",l.style.width="4px",l.style.height="4px",l.style.background="#0066FF",l.style.borderRadius="50%",l.style.margin="-2px -2px 0 0",l.style.cursor="pointer",r.append(l),this.scale.set(this._scale,this._scale,this._scale),t.style.fontSize="6px",t.style.color="#fff",r.style[this._sizeFlag]=o*100+"px",r.style.textAlign="center",this._sizeFlag==="height"?(r.style.borderLeft="0.1px dashed #fff",r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="center",r.style.whiteSpace="nowrap",l.style.top="0",l.style.left="0",l.style.right="auto",l.style.margin="-2px 0 0 -2px"):r.style.borderBottom="0.1px dashed #fff",l.addEventListener("pointerdown",this._pointerdown),l.addEventListener("pointermove",this._pointermove),l.addEventListener("pointerup",this._pointercancel),s[this.props.axios]<n[this.props.axios]?this.rotateY(Math.PI):this._direction=-1}_getIndexByAxios(){return this.props.axios==="y"?1:this.props.axios==="z"?2:0}dispose(){this._lines.forEach(e=>e.dispose()),this._emitter.removeAllListeners(),this.endNode.removeEventListener("pointerdown",this._pointerdown),this.endNode.removeEventListener("pointermove",this._pointermove),this.endNode.removeEventListener("pointerup",this._pointercancel),this.element.remove(),this._caches.forEach(e=>e.clear()),this._caches=[]}}const nr="#898989";class Bs extends _n{constructor(e,t,n){const s=document.createElement("div");super(s),this._startWith=n,this._text=new $a("");const o=document.createElement("div");s.append(o);const r=new S().addVectors(e,t).multiplyScalar(.5);this.position.copy(r.multiplyScalar(1));const l=e.distanceTo(t);let c=Math.atan2(e.z-t.z,e.x-t.x);this.rotation.y=-c,e.y-t.y&&(c=Math.atan2(e.y-t.y,e.x-t.x),this.rotation.z=c),s.style.zIndex=(Math.random()*1e4).toFixed(0),s.style.pointerEvents="none",s.style.width=`${this.getV(l)}px`,s.style.borderBottom="0.1px solid #cccccd",s.style.textAlign="center",s.style.transition="all .3s",s.style.color=nr,this.add(this._text),this.update(e,t),this.scale.set(.01,.01,.01),this.rotateX(-Math.PI/2)}getV(e){return e*100}getSV(e){return e*1e3}dispose(){this.element.remove(),this.clear(),this.removeFromParent()}hide(){this.element.style.opacity="0",this._text.hide()}show(){this.element.style.opacity="1",this._text.show()}update(e,t){const n=e.distanceTo(t);this.element.style.width=`${this.getV(n)}px`,this.element.style.width=`${this.getV(n)}px`;const s=`${this.getSV(n).toFixed(0)} mm`;this._text.update(this._startWith?`${this._startWith}${s}`:s);const o=new S().addVectors(e,t).multiplyScalar(.5);this.position.copy(o.multiplyScalar(1))}updateSize(e){this._text.updateSize(e)}}class $a extends _n{constructor(e,t=nr){const n=document.createElement("div");super(n),n.style.pointerEvents="none",n.innerText=e,n.style.fontSize="5px",n.style.color=t,n.style.paddingBottom="5px",n.style.transition="all .3s",this.position.setY(1)}hide(){this.element.style.opacity="0"}show(){this.element.style.opacity="1"}update(e){this.element.innerText=e}updateSize(e){var s;const t=(s=this.parent)==null?void 0:s.position.clone();t==null||t.setY(this.position.y);let n=(t==null?void 0:t.distanceTo(e))||1;n*=1.2,n<5&&(n=5),this.element.style.fontSize=`${n}px`,this.element.style.paddingBottom=`${n}px`}}const el="*{box-sizing:border-box}.pointer-container{width:20px;height:20px;pointer-events:auto;cursor:pointer;display:flex;align-items:center;justify-content:center}.pointer-container.active .point{transform:scale(3);background:#06f}.pointer-container:hover .point{transform:scale(4);background:#00ff95}.pointer-container:hover .value{opacity:1;transform:translate3d(-50%,0,0)}.pointer-container .point{width:3px;height:3px;border-radius:50%;background:#898989;transition:all .2s}.pointer-container .value{white-space:nowrap;pointer-events:none;font-size:12px;opacity:0;position:absolute;bottom:80%;left:50%;color:#898989;transform:translate3d(-50%,-14px,0);transition:all .2s}";var tl=Object.defineProperty,sl=Object.getOwnPropertyDescriptor,wn=(u,e,t,n)=>{for(var s=n>1?void 0:n?sl(e,t):e,o=u.length-1,r;o>=0;o--)(r=u[o])&&(s=(n?r(e,t,s):r(s))||s);return n&&s&&tl(e,t,s),s};class nl extends ye{constructor(){super(),this._box3=new Q,this._outline=new sr(0,0),this._radius=0,this._hasWidthConfig=!1,this._hasLengthConfig=!1,this._hasHeightConfig=!1,this.follow="",this.followOrigin=0,this.followScale=1,this.originOffset=0,this.translateCache=0,this._changeSize=Fo(e=>{var t,n,s;(t=this._line1)==null||t.updateSize(e),(n=this._line2)==null||n.updateSize(e),(s=this._line3)==null||s.updateSize(e)},100),this._change=()=>{if(!this._app)return;const e=this._app.camera;e&&(this._outline.change(e.position),this._changeSize(e.position))},this.add(this._outline)}get hasSizeConfig(){return{length:this._hasLengthConfig,width:this._hasWidthConfig,height:this._hasHeightConfig}}get size(){return this._box3.clone()}get radius(){return this._radius}init(e){this._app=e,this._app.controls.addEventListener("change",this._change)}reset(){this.hide()}generate(e,t=0){e&&(this._object=e),this.update(t)}show(){this.visible=!0,this.traverse(e=>e.visible=!0)}hide(){this.visible=!1,this.traverse(e=>e.visible=!1)}dispose(){var e;(e=this._app)==null||e.controls.removeEventListener("change",this._change)}update(e=0){if(!this._object)return;const t=this._object,{box:n,maxRadius:s,hasLength:o,hasHeight:r,hasWidth:l}=Ji(t);this._hasWidthConfig=l,this._hasLengthConfig=o,this._hasHeightConfig=r,this._box3.copy(n),this._radius=s,this.follow&&e&&(this.originOffset=(this.followOrigin-e)*this.followScale),this._outline.update(this._radius),this._change();const c=this._box3.min.x,h=this._box3.max.x,d=this._box3.min.z,i=this._box3.max.z,a=this._box3.min.y,f=this._box3.max.y;let g=.3;const A=new S(c,0,d),p=new S(h,0,d);this._line1?this._line1.update(A.clone().sub(new S(0,0,g)),p.clone().sub(new S(0,0,g))):this._line1=new Bs(A.clone().sub(new S(0,0,g)),p.clone().sub(new S(0,0,g)),"长:");const m=new S(h,0,i);this._line2?this._line2.update(p.clone().add(new S(g,0,0)),m.clone().add(new S(g,0,0))):this._line2=new Bs(p.clone().add(new S(g,0,0)),m.clone().add(new S(g,0,0)),"宽:");const _=new S(c,a,d),x=new S(c,f,d),y=_.clone();y.z-=g/2;const w=x.clone();w.z-=g/2,this._line3?this._line3.update(y,w):this._line3=new Bs(y,w,"高:"),this.add(this._line1,this._line2,this._line3)}}let Pt=class extends us{constructor(u,e=!1){super(),this.text="",this.active=!1,this.text=(u*1e3).toFixed(0),this.active=e}render(){return st`
|
|
598
|
+
<div class="pointer-container ${this.active&&"active"}">
|
|
599
|
+
<div class="point"></div>
|
|
600
|
+
<div class="value">${this.text} mm</div>
|
|
601
|
+
</div>
|
|
602
|
+
`}};Pt.styles=cs([el]);wn([Ue()],Pt.prototype,"text",2);wn([Ue()],Pt.prototype,"active",2);Pt=wn([fs("point-element")],Pt);class ir extends ye{constructor(e){super(),this._url=e,this._size=new ms(0,0,0),this._load(e).then()}loaded(e){}get size(){return this._size}async _load(e){if(this._url=e,e){let t;if(e.endsWith(".glb"))t=(await Lt.loadAsync(e)).scene,t&&this.loaded(t);else{const s=await new os({useCache:!0}).loadAsync(e);return s.glb?(t=s.glb,t&&this.loaded(t),t):void 0}}else return;Ji(this)}destroy(){}}const il=""+new URL("roller-hopper-Heae_wy5.glb",import.meta.url).href,rl=""+new URL("roller-8Vy8W3X_.glb",import.meta.url).href;class ei extends ir{constructor(e){super(rl),this._props=e,this._goodsWidthGap=.01,this._goodsLengthGap=.005,this._emitter=new ze,this.addEventListener=this._emitter.addListener.bind(this._emitter),this._shaftInstances=[],this._length=0,this._container=new he,this._goodsSize=new ms(0,0,0),this.add(this._container)}get length(){return this._length}loaded(e){var t;this._container.add(e.clone(!0)),this._container.traverse(n=>{n.name.startsWith("Shaft")&&(this._shaft=n),n.userData.isContainer&&(this._goodsContainer=n);const s="length";if(Object.keys(n.morphTargetDictionary||{}).includes(s)){const o=n.morphTargetDictionary[s];this._length=n.morphTargetInfluences[o]}}),(t=this._shaft)==null||t.removeFromParent(),this.setGoodsSize({length:this.size.length,width:this.size.width,height:this.size.height})}setGoodsSize({length:e,width:t,height:n}){var l;this._goodsSize.length=e,this._goodsSize.width=t,this._goodsSize.height=n,this._goods&&(Ae(this._goods),this._goods.removeFromParent()),this.size.length=e+this._goodsLengthGap*2+.12,this.size.height=n+.115,this.size.width=t+this._goodsWidthGap*2+.086,this.setShapeKey("goodsWidth",t+this._goodsWidthGap*2),this.setShapeKey("goodsLength",e+this._goodsLengthGap*2),this._generateShaft(),this._emitter.emit("size-change",this.size);const s=new io(this._goodsSize.width,n,this._goodsSize.length);s.translate(0,n/2,0);const o=new ro(s);this._goods=new fe(s,new ds({color:"#22f",opacity:.2,transparent:!0}));const r=new dn(o,new ke({color:"#22f"}));this._goods.add(r),(l=this._goodsContainer)==null||l.add(this._goods)}setShapeKey(e,t){var s;e==="goodsLength"&&(this._length=t);const n=[];(s=this._shaft)==null||s.traverse(o=>n.push(o)),this._container.traverse(o=>n.push(o)),n.forEach(o=>{let r=t;if(o.userData[`origin_${e}`]&&(r-=o.userData[`origin_${e}`]),!Object.keys(o.morphTargetDictionary||{}).includes(e))return;const l=o.morphTargetDictionary[e];o.morphTargetInfluences&&(o.morphTargetInfluences[l]=r)})}_generateShaft(){if(!this._shaft)return;this._shaftInstances.length&&this._shaftInstances.forEach(l=>{Ae(l)}),this._shaftInstances=[];const e=this._length+.01,t=.05;let n=.03519;const s=t+n,o=Math.floor(e/s);n+=(e-(s*o+n))/(o+1);const r=t+n;for(let l=0;l<o;l++){const c=this._shaft.clone(!0);c.position.z+=r*l-e/2+(t/2+n),this._container.add(c),this._shaftInstances.push(c)}}destroy(){this._emitter.removeAllListeners(),this._emitter=null,Ae(this)}}class ol extends ye{constructor(e){super(),this._items=[],this._group=new he,this._gap=0,this._size=new ms(0,0,0),this._emitter=new ze,this.addEventListener=this._emitter.addListener.bind(this._emitter),this._gap=e||0,this.add(this._group)}get size(){return this._size}get items(){return this._items}addItem(e){this._items.push(e),this._group.add(e),this.updateLayout(),e.addEventListener("size-change",()=>{this.updateLayout()})}updateLayout(){const e=this._items.reduce((o,r,l)=>{const{width:c,length:h}=r.size;return o+c+(l<this._group.children.length-1?this._gap:0)},0);let t=0,n=0,s=-e/2;this._items.forEach(o=>{const r=o.size.width;o.position.x=s+r/2,s+=r+this._gap,t=o.size.length,n=o.size.height}),this.size.width=e,this.size.length=t,this.size.height=n,this._emitter.emit("size-change",this.size)}destroy(){this._items.forEach(e=>{e.destroy()}),this._items=[],this._emitter.removeAllListeners()}}class al extends ir{constructor(){super(il),this._container=new he,this._emitter=new ze,this.addEventListener=this._emitter.addListener.bind(this._emitter),this._widthGap=.01,this._lengthGap=.01,this._row=new ol(this._widthGap),this.add(this._container)}loaded(e){this._container.add(e.clone(!0));const t=this._row;t.addEventListener("size-change",({width:o,length:r,height:l})=>{this.setShapeKey("goodsWidth",o),this.setShapeKey("goodsLength",r),this.size.width=r+this._lengthGap,this.size.length=o+this._widthGap,this.size.height=l,this._emitter.emit("size-change",this.size)});const n=new ei({goodsSize:new S(1,1,1)}),s=new ei({goodsSize:new S(1,1,1)});t.addItem(n),t.addItem(s),this.add(t)}setShapeKey(e,t){["length","width"].includes(e)&&(t-=.2),this._container.traverse(n=>{if(!Object.keys(n.morphTargetDictionary||{}).includes(e))return;let s=t;n.userData[`origin_${e}`]&&(s-=n.userData[`origin_${e}`]);const o=n.morphTargetDictionary[e];n.morphTargetInfluences&&(n.morphTargetInfluences[o]=s)})}setGoodsSize(e){this._row.items.forEach(t=>t.setGoodsSize(e))}destroy(){this._emitter.removeAllListeners(),this._row.destroy(),Ae(this)}}const ll=new Oi;class cl extends ye{constructor(e){super(),this._props=e,this._emitter=new ze,this.addEventListener=this._emitter.addListener.bind(this._emitter),this._container=new he,this.sizeBox=new nl,this._goodsSize=new ms(0,0,0),this._slots=[],this._logos=[],this._skins=[],this._levels=new Map,this._bodyOpacity=1,this._breathLights=[],this._shelves=new Map,this._url="",this._shapeKeys=new Map,this._materialsCache=new Map,this.opacityCache=void 0,this._url=e.url||"",this._url&&this.load(this._url).then(),this.add(this._container),this._props.showSizeBox&&this.add(this.sizeBox)}get shapeKeys(){return this._shapeKeys}get size(){const e=this.sizeBox.size.getSize(new S);return{width:e.z,length:e.x,height:e.y}}get slots(){return this._slots}get logos(){return this._logos}get skins(){return this._skins}get bodyOpacity(){return this._bodyOpacity}get fork(){return this._fork}get jack(){return this._jack}get lift(){return this._lift}set bodyOpacity(e){this._bodyOpacity=e,e<1?this._materialsCache.forEach(t=>{t.mat.transparent=!0,t.mat.opacity=e,t.mat.metalness=0,t.mat.roughness=1,t.mat.color=new G("#3859be")}):this._materialsCache.forEach(t=>{t.mat.transparent=t.transparent,t.mat.opacity=t.opacity,t.mat.metalness=t.metalness,t.mat.roughness=t.roughness,t.mat.color=t.color})}init(e){this._app=e,this.sizeBox.init(e),this.addEventListener("shape-key-changed",(t,n)=>{this._slots.forEach(s=>s.shapeKeyChanged(t,n)),this.sizeBox.follow===t?(this.sizeBox.generate(this._container,n),this.sizeBox.originOffset&&(this._container.traverse(s=>{if(s instanceof fe&&s.geometry.translate(this.sizeBox.originOffset-this.sizeBox.translateCache,0,0),s instanceof qs){const o=new S(this.sizeBox.originOffset,0,0).applyQuaternion(s.parent.quaternion);s.position.add(o)}}),this.sizeBox.translateCache=this.sizeBox.originOffset,this.sizeBox.generate(this._container))):this.sizeBox.generate(this._container)})}async load(e){this._url=e,!e.startsWith("blob")&&e.endsWith(".sglb");let t;if(e.endsWith(".glb"))t=(await Lt.loadAsync(e)).scene;else{const s=await new os({useCache:!0}).loadAsync(e);if(!s.glb)return;t=s.glb}this._generateAmr(t.clone(!0)),t=null}changeSkin(e,t){e&&(this._app&&this._app.usePathTracing?this._app.sampleCount=0:e.target.color.set(t))}changeLogo(e,t){var o;const n=ll.load(t);n.flipY=!1,n.colorSpace=ee;const s=e.target;s.material&&(Array.isArray(s.material)?s.material.forEach(r=>{var l;(l=r.map)==null||l.dispose(),r.map=n}):((o=s.material.map)==null||o.dispose(),s.material.map=n))}setShapeKey(e,t){this._container.traverse(n=>{if(!Object.keys(n.morphTargetDictionary||{}).includes(e))return;let s=t;n.userData[`origin_${e}`]&&(s-=n.userData[`origin_${e}`]);const o=n.morphTargetDictionary[e];n.morphTargetInfluences&&(n.morphTargetInfluences[o]=s)}),this._emitter.emit("shape-key-changed",e,t)}_generateAmr(e){e.traverse(t=>{t.userData.isShelf&&(this._shelf=t),t.userData.isFork&&(this._fork=t),t.userData.isJack&&(this._jack=t),t.userData.isLift&&(this._lift=t),Object.keys(t.morphTargetDictionary||{}).forEach(n=>{let s=t.morphTargetInfluences[t.morphTargetDictionary[n]];t.userData[`origin_${n}`]&&(s+=t.userData[`origin_${n}`]),this._shapeKeys.has(n)||this._shapeKeys.set(n,s)})}),e.traverse(t=>{if(t instanceof fe){if(t.material)if(Array.isArray(t.material))t.material.forEach(s=>{s.userData.changeColor&&this._skins.push({name:s.userData.name,target:s})});else{if(t.material.userData.isBreathLight&&t.material.emissiveIntensity){t.material.emissiveIntensity=1.5;const s=new bt.Tween(t.material).to({emissiveIntensity:.1}).easing(bt.Easing.Quintic.InOut).duration(1e3).start().yoyo(!0).repeat(1/0);this._breathLights.push(s)}t.material.userData.changeColor&&this._skins.push({name:t.material.userData.name,target:t.material})}if(t.material)if(Array.isArray(t.material))t.material.forEach(o=>{o.userData.isLOGO&&(t.material.transparent=!0,this._logos.push({name:o.userData.name,target:t})),this._materialsCache.set(o.uuid,{opacity:o.opacity,transparent:o.transparent,roughness:o.roughness,metalness:o.metalness,color:o.color,mat:o})});else{const s=t.material;s.userData.isLOGO&&(t.material.transparent=!0,this._logos.push({name:s.userData.name,target:t})),this._materialsCache.set(s.uuid,{opacity:s.opacity,transparent:s.transparent,roughness:s.roughness,metalness:s.metalness,color:s.color,mat:s})}}this.generateController(t,e),this.generateDimension(t,e);const n=this.generateSlot(t);n&&(this._slots.push(n),t.add(n)),t.userData.isOrigin&&Object.keys(t.userData).forEach(o=>{if(o.startsWith("follow_")){const r=o.replace("follow_","");this.shapeKeys.has(r)&&(this.sizeBox.follow=r,this.sizeBox.followOrigin=this._shapeKeys.get(r)||0,this.sizeBox.followScale=t.userData[o])}})}),e.updateMatrixWorld(!0),this._container.add(e),this.sizeBox.generate(e),this.sizeBox.show(),this.generateShelfLevel()}setHeight(e){this.setShapeKey("height",e)}setWeight(e){this.setShapeKey("width",e)}setLength(e){this.setShapeKey("length",e)}setForkHeight(e){this._fork&&(this._fork.position.y=e)}setJackHeight(e){this._jack&&(this._jack.position.y=e)}setLevel(e){this._levels.forEach(t=>{t.destroy()}),this._levels.clear();for(let t=0;t<e;t++){const n=new al;n.position.y=.112+t*.6,n.addEventListener("size-change",s=>{setTimeout(()=>{this.setShapeKey("length",s.length),this.setShapeKey("width",s.width)},20)}),this.lift?this.lift.add(n):this.add(n),this._levels.set(t,n)}setTimeout(()=>{this.setGoodsSize(this._goodsSize)},100)}setGoodsSize(e){this._goodsSize.length=e.length,this._goodsSize.width=e.width,this._goodsSize.height=e.height,this._levels.forEach(t=>{t.setGoodsSize(e)})}generateShelfLevel(e=3){if(!this._shelf)return;const{shelfLevel:t,levelOffset:n}=this._shelf.userData||{};this._shelves.delete(t),this._shelves.forEach(s=>{Ae(s)}),this._shelves.clear(),this._shelves.set(t,this._shelf);for(let s=t;s<e;s++)setTimeout(()=>{var r;if(!this._shelf)return;const o=this._shelf.clone(!0);o.position.y+=n*s,this._shelves.set(s+t,o),(r=this._shelf.parent)==null||r.add(o),o.scale.set(.5,1,0),new mn(o.scale).to({x:1,y:1,z:1}).duration(100).start()},100+s*90)}generateOuterLine(){this.traverse(e=>{if(e.userData.isOuterObject){const t=this.sizeBox.radius;this._outline?this._outline.update(t):(this._outline=new sr(t,0),this.add(this._outline))}})}generateController(e,t){if(e.userData.isForkController&&e.userData.target){const n=e.userData.target.name,{min:s,max:o}=e.userData;let r;if(t.traverse(c=>{c.name===n&&(r=c)}),!r)return;const l=new $n({name:"",target:n,default:0,min:s,max:o},r);e.add(l)}else if(e.userData.isController&&e.userData.target){const n=e.userData.target.name;e.userData;let s;if(t.traverse(r=>{r.name===n&&(s=r)}),!s)return;const o=new $n({name:"",userData:e.userData,target:e.userData.key,default:0,min:0,max:2},s);e.add(o)}}generateDimension(e,t){if(e.userData.isDimension){const n=e.userData.divider,s=Po(e.userData.startOrigin),o=e.userData.axios;let r,l;if(o==="x"?(r=new S(e.userData.start-e.position.x,0,0),l=r.clone().setX(e.userData.end-e.position.x)):o==="z"?(r=new S(0,e.userData.start-e.position.y,0),l=r.clone().setY(e.userData.end-e.position.y)):(r=new S(0,0,e.userData.start-e.position.z),l=r.clone().setZ(e.userData.end-e.position.z)),!Object.keys(e.userData).flatMap(i=>i.startsWith("target")?e.userData[i].name:[]).length)return;const d=new Ja({start:r,end:l,startOrigin:s,axios:o,divider:n});e.add(d)}}generateSlot(e){if(e.userData.isSlot){const t=e.userData.name;if(t){let n;const s=new Map;Object.keys(e.userData).forEach(r=>{if(r.startsWith("follow_")){const l=r.split("_")[1];if(l){let c=e.userData[r];s.set(l,{scale:c,origin:this.shapeKeys.get(l)||0})}}});const o=new qs({name:t,follows:s,slot:e},n);return o.addEventListener(ue.ON_DROP,r=>{this._app&&this._app.props.useSound&&this._app.sound.play()}),o.addEventListener(ue.ON_BEFORE_SELECTED,r=>{this._slots.forEach(l=>{l.selected&&(l.selected=!1)})}),o.addEventListener(ue.ON_ERROR_STATE_CHANGE,r=>{if(this._app)if(this._app._outlinePassError.selectedObjects=this._app._outlinePassError.selectedObjects.filter(l=>!!l.parent),r){if(o.device){if(this._app._outlinePassError.selectedObjects.find(c=>{var h;return c.parent==((h=o.device)==null?void 0:h.parent)}))return;this._app._outlinePassError.selectedObjects=[o.device,...this._app._outlinePassError.selectedObjects]}}else o.device&&(this._app._outlinePassError.selectedObjects=this._app._outlinePassError.selectedObjects.filter(l=>{var c;return l.parent!=((c=o.device)==null?void 0:c.parent)}))}),o}}}clean(){this._emitter.removeAllListeners(),Ae(this._container),this._levels.forEach(e=>e.destroy()),this._levels.clear(),this._slots=[],this._logos=[],this._skins=[],this._materialsCache.clear(),this.opacityCache=void 0,this._breathLights.forEach(e=>e.stop()),this._breathLights=[],this.sizeBox.reset()}destroy(){this.clean()}}const rr=0,ul=1,fl=2,ti=2,Rs=1.25,si=1,Mt=6*4+4+4,As=65535,hl=Math.pow(2,-24),Ls=Symbol("SKIP_GENERATION");function dl(u){return u.index?u.index.count:u.attributes.position.count}function ct(u){return dl(u)/3}function pl(u,e=ArrayBuffer){return u>65535?new Uint32Array(new e(4*u)):new Uint16Array(new e(2*u))}function or(u,e){if(!u.index){const t=u.attributes.position.count,n=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s=pl(t,n);u.setIndex(new K(s,1));for(let o=0;o<t;o++)s[o]=o}}function ar(u){const e=ct(u),t=u.drawRange,n=t.start/3,s=(t.start+t.count)/3,o=Math.max(0,n),r=Math.min(e,s)-o;return[{offset:Math.floor(o),count:Math.floor(r)}]}function lr(u){if(!u.groups||!u.groups.length)return ar(u);const e=[],t=new Set,n=u.drawRange,s=n.start/3,o=(n.start+n.count)/3;for(const l of u.groups){const c=l.start/3,h=(l.start+l.count)/3;t.add(Math.max(s,c)),t.add(Math.min(o,h))}const r=Array.from(t.values()).sort((l,c)=>l-c);for(let l=0;l<r.length-1;l++){const c=r[l],h=r[l+1];e.push({offset:Math.floor(c),count:Math.floor(h-c)})}return e}function gl(u){if(u.groups.length===0)return!1;const e=ct(u),t=lr(u).sort((o,r)=>o.offset-r.offset),n=t[t.length-1];n.count=Math.min(e-n.offset,n.count);let s=0;return t.forEach(({count:o})=>s+=o),e!==s}function Ps(u,e,t,n,s){let o=1/0,r=1/0,l=1/0,c=-1/0,h=-1/0,d=-1/0,i=1/0,a=1/0,f=1/0,g=-1/0,A=-1/0,p=-1/0;for(let m=e*6,_=(e+t)*6;m<_;m+=6){const x=u[m+0],y=u[m+1],w=x-y,v=x+y;w<o&&(o=w),v>c&&(c=v),x<i&&(i=x),x>g&&(g=x);const T=u[m+2],b=u[m+3],E=T-b,M=T+b;E<r&&(r=E),M>h&&(h=M),T<a&&(a=T),T>A&&(A=T);const C=u[m+4],I=u[m+5],B=C-I,R=C+I;B<l&&(l=B),R>d&&(d=R),C<f&&(f=C),C>p&&(p=C)}n[0]=o,n[1]=r,n[2]=l,n[3]=c,n[4]=h,n[5]=d,s[0]=i,s[1]=a,s[2]=f,s[3]=g,s[4]=A,s[5]=p}function ml(u,e=null,t=null,n=null){const s=u.attributes.position,o=u.index?u.index.array:null,r=ct(u),l=s.normalized;let c;e===null?(c=new Float32Array(r*6*4),t=0,n=r):(c=e,t=t||0,n=n||r);const h=s.array,d=s.offset||0;let i=3;s.isInterleavedBufferAttribute&&(i=s.data.stride);const a=["getX","getY","getZ"];for(let f=t;f<t+n;f++){const g=f*3,A=f*6;let p=g+0,m=g+1,_=g+2;o&&(p=o[p],m=o[m],_=o[_]),l||(p=p*i+d,m=m*i+d,_=_*i+d);for(let x=0;x<3;x++){let y,w,v;l?(y=s[a[x]](p),w=s[a[x]](m),v=s[a[x]](_)):(y=h[p+x],w=h[m+x],v=h[_+x]);let T=y;w<T&&(T=w),v<T&&(T=v);let b=y;w>b&&(b=w),v>b&&(b=v);const E=(b-T)/2,M=x*2;c[A+M+0]=T+E,c[A+M+1]=E+(Math.abs(T)+E)*hl}}return c}function k(u,e,t){return t.min.x=e[u],t.min.y=e[u+1],t.min.z=e[u+2],t.max.x=e[u+3],t.max.y=e[u+4],t.max.z=e[u+5],t}function ni(u){let e=-1,t=-1/0;for(let n=0;n<3;n++){const s=u[n+3]-u[n];s>t&&(t=s,e=n)}return e}function ii(u,e){e.set(u)}function ri(u,e,t){let n,s;for(let o=0;o<3;o++){const r=o+3;n=u[o],s=e[o],t[o]=n<s?n:s,n=u[r],s=e[r],t[r]=n>s?n:s}}function Nt(u,e,t){for(let n=0;n<3;n++){const s=e[u+2*n],o=e[u+2*n+1],r=s-o,l=s+o;r<t[n]&&(t[n]=r),l>t[n+3]&&(t[n+3]=l)}}function gt(u){const e=u[3]-u[0],t=u[4]-u[1],n=u[5]-u[2];return 2*(e*t+t*n+n*e)}const ge=32,Al=(u,e)=>u.candidate-e.candidate,Te=new Array(ge).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),Ot=new Float32Array(6);function _l(u,e,t,n,s,o){let r=-1,l=0;if(o===rr)r=ni(e),r!==-1&&(l=(e[r]+e[r+3])/2);else if(o===ul)r=ni(u),r!==-1&&(l=xl(t,n,s,r));else if(o===fl){const c=gt(u);let h=Rs*s;const d=n*6,i=(n+s)*6;for(let a=0;a<3;a++){const f=e[a],p=(e[a+3]-f)/ge;if(s<ge/4){const m=[...Te];m.length=s;let _=0;for(let y=d;y<i;y+=6,_++){const w=m[_];w.candidate=t[y+2*a],w.count=0;const{bounds:v,leftCacheBounds:T,rightCacheBounds:b}=w;for(let E=0;E<3;E++)b[E]=1/0,b[E+3]=-1/0,T[E]=1/0,T[E+3]=-1/0,v[E]=1/0,v[E+3]=-1/0;Nt(y,t,v)}m.sort(Al);let x=s;for(let y=0;y<x;y++){const w=m[y];for(;y+1<x&&m[y+1].candidate===w.candidate;)m.splice(y+1,1),x--}for(let y=d;y<i;y+=6){const w=t[y+2*a];for(let v=0;v<x;v++){const T=m[v];w>=T.candidate?Nt(y,t,T.rightCacheBounds):(Nt(y,t,T.leftCacheBounds),T.count++)}}for(let y=0;y<x;y++){const w=m[y],v=w.count,T=s-w.count,b=w.leftCacheBounds,E=w.rightCacheBounds;let M=0;v!==0&&(M=gt(b)/c);let C=0;T!==0&&(C=gt(E)/c);const I=si+Rs*(M*v+C*T);I<h&&(r=a,h=I,l=w.candidate)}}else{for(let x=0;x<ge;x++){const y=Te[x];y.count=0,y.candidate=f+p+x*p;const w=y.bounds;for(let v=0;v<3;v++)w[v]=1/0,w[v+3]=-1/0}for(let x=d;x<i;x+=6){let v=~~((t[x+2*a]-f)/p);v>=ge&&(v=ge-1);const T=Te[v];T.count++,Nt(x,t,T.bounds)}const m=Te[ge-1];ii(m.bounds,m.rightCacheBounds);for(let x=ge-2;x>=0;x--){const y=Te[x],w=Te[x+1];ri(y.bounds,w.rightCacheBounds,y.rightCacheBounds)}let _=0;for(let x=0;x<ge-1;x++){const y=Te[x],w=y.count,v=y.bounds,b=Te[x+1].rightCacheBounds;w!==0&&(_===0?ii(v,Ot):ri(v,Ot,Ot)),_+=w;let E=0,M=0;_!==0&&(E=gt(Ot)/c);const C=s-_;C!==0&&(M=gt(b)/c);const I=si+Rs*(E*_+M*C);I<h&&(r=a,h=I,l=y.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${o} used.`);return{axis:r,pos:l}}function xl(u,e,t,n){let s=0;for(let o=e,r=e+t;o<r;o++)s+=u[o*6+n*2];return s/t}class Ds{constructor(){this.boundingData=new Float32Array(6)}}function yl(u,e,t,n,s,o){let r=n,l=n+s-1;const c=o.pos,h=o.axis*2;for(;;){for(;r<=l&&t[r*6+h]<c;)r++;for(;r<=l&&t[l*6+h]>=c;)l--;if(r<l){for(let d=0;d<3;d++){let i=e[r*3+d];e[r*3+d]=e[l*3+d],e[l*3+d]=i}for(let d=0;d<6;d++){let i=t[r*6+d];t[r*6+d]=t[l*6+d],t[l*6+d]=i}r++,l--}else return r}}function wl(u,e,t,n,s,o){let r=n,l=n+s-1;const c=o.pos,h=o.axis*2;for(;;){for(;r<=l&&t[r*6+h]<c;)r++;for(;r<=l&&t[l*6+h]>=c;)l--;if(r<l){let d=u[r];u[r]=u[l],u[l]=d;for(let i=0;i<6;i++){let a=t[r*6+i];t[r*6+i]=t[l*6+i],t[l*6+i]=a}r++,l--}else return r}}function X(u,e){return e[u+15]===65535}function Z(u,e){return e[u+6]}function te(u,e){return e[u+14]}function se(u){return u+8}function ne(u,e){return e[u+6]}function cr(u,e){return e[u+7]}let ur,Tt,ts,fr;const vl=Math.pow(2,32);function Zs(u){return"count"in u?1:1+Zs(u.left)+Zs(u.right)}function Tl(u,e,t){return ur=new Float32Array(t),Tt=new Uint32Array(t),ts=new Uint16Array(t),fr=new Uint8Array(t),Js(u,e)}function Js(u,e){const t=u/4,n=u/2,s="count"in e,o=e.boundingData;for(let r=0;r<6;r++)ur[t+r]=o[r];if(s)if(e.buffer){const r=e.buffer;fr.set(new Uint8Array(r),u);for(let l=u,c=u+r.byteLength;l<c;l+=Mt){const h=l/2;X(h,ts)||(Tt[l/4+6]+=t)}return u+r.byteLength}else{const r=e.offset,l=e.count;return Tt[t+6]=r,ts[n+14]=l,ts[n+15]=As,u+Mt}else{const r=e.left,l=e.right,c=e.splitAxis;let h;if(h=Js(u+Mt,r),h/4>vl)throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return Tt[t+6]=h/4,h=Js(h,l),Tt[t+7]=c,h}}function El(u,e){const t=(u.index?u.index.count:u.attributes.position.count)/3,n=t>2**16,s=n?4:2,o=e?new SharedArrayBuffer(t*s):new ArrayBuffer(t*s),r=n?new Uint32Array(o):new Uint16Array(o);for(let l=0,c=r.length;l<c;l++)r[l]=l;return r}function bl(u,e,t,n,s){const{maxDepth:o,verbose:r,maxLeafTris:l,strategy:c,onProgress:h,indirect:d}=s,i=u._indirectBuffer,a=u.geometry,f=a.index?a.index.array:null,g=d?wl:yl,A=ct(a),p=new Float32Array(6);let m=!1;const _=new Ds;return Ps(e,t,n,_.boundingData,p),y(_,t,n,p),_;function x(w){h&&h(w/A)}function y(w,v,T,b=null,E=0){if(!m&&E>=o&&(m=!0,r&&(console.warn(`MeshBVH: Max depth of ${o} reached when generating BVH. Consider increasing maxDepth.`),console.warn(a))),T<=l||E>=o)return x(v+T),w.offset=v,w.count=T,w;const M=_l(w.boundingData,b,e,v,T,c);if(M.axis===-1)return x(v+T),w.offset=v,w.count=T,w;const C=g(i,f,e,v,T,M);if(C===v||C===v+T)x(v+T),w.offset=v,w.count=T;else{w.splitAxis=M.axis;const I=new Ds,B=v,R=C-v;w.left=I,Ps(e,B,R,I.boundingData,p),y(I,B,R,p,E+1);const L=new Ds,F=C,j=T-R;w.right=L,Ps(e,F,j,L.boundingData,p),y(L,F,j,p,E+1)}return w}}function Sl(u,e){const t=u.geometry;e.indirect&&(u._indirectBuffer=El(t,e.useSharedArrayBuffer),gl(t)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),u._indirectBuffer||or(t,e);const n=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s=ml(t),o=e.indirect?ar(t):lr(t);u._roots=o.map(r=>{const l=bl(u,s,r.offset,r.count,e),c=Zs(l),h=new n(Mt*c);return Tl(0,l,h),h})}class xe{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let n=1/0,s=-1/0;for(let o=0,r=e.length;o<r;o++){const c=e[o][t];n=c<n?c:n,s=c>s?c:s}this.min=n,this.max=s}setFromPoints(e,t){let n=1/0,s=-1/0;for(let o=0,r=t.length;o<r;o++){const l=t[o],c=e.dot(l);n=c<n?c:n,s=c>s?c:s}this.min=n,this.max=s}isSeparated(e){return this.min>e.max||e.min>this.max}}xe.prototype.setFromBox=function(){const u=new S;return function(t,n){const s=n.min,o=n.max;let r=1/0,l=-1/0;for(let c=0;c<=1;c++)for(let h=0;h<=1;h++)for(let d=0;d<=1;d++){u.x=s.x*c+o.x*(1-c),u.y=s.y*h+o.y*(1-h),u.z=s.z*d+o.z*(1-d);const i=t.dot(u);r=Math.min(i,r),l=Math.max(i,l)}this.min=r,this.max=l}}();const Ml=function(){const u=new S,e=new S,t=new S;return function(s,o,r){const l=s.start,c=u,h=o.start,d=e;t.subVectors(l,h),u.subVectors(s.end,s.start),e.subVectors(o.end,o.start);const i=t.dot(d),a=d.dot(c),f=d.dot(d),g=t.dot(c),p=c.dot(c)*f-a*a;let m,_;p!==0?m=(i*a-g*f)/p:m=0,_=(i+m*a)/f,r.x=m,r.y=_}}(),vn=function(){const u=new N,e=new S,t=new S;return function(s,o,r,l){Ml(s,o,u);let c=u.x,h=u.y;if(c>=0&&c<=1&&h>=0&&h<=1){s.at(c,r),o.at(h,l);return}else if(c>=0&&c<=1){h<0?o.at(0,l):o.at(1,l),s.closestPointToPoint(l,!0,r);return}else if(h>=0&&h<=1){c<0?s.at(0,r):s.at(1,r),o.closestPointToPoint(r,!0,l);return}else{let d;c<0?d=s.start:d=s.end;let i;h<0?i=o.start:i=o.end;const a=e,f=t;if(s.closestPointToPoint(i,!0,e),o.closestPointToPoint(d,!0,t),a.distanceToSquared(i)<=f.distanceToSquared(d)){r.copy(a),l.copy(i);return}else{r.copy(d),l.copy(f);return}}}}(),Il=function(){const u=new S,e=new S,t=new gs,n=new z;return function(o,r){const{radius:l,center:c}=o,{a:h,b:d,c:i}=r;if(n.start=h,n.end=d,n.closestPointToPoint(c,!0,u).distanceTo(c)<=l||(n.start=h,n.end=i,n.closestPointToPoint(c,!0,u).distanceTo(c)<=l)||(n.start=d,n.end=i,n.closestPointToPoint(c,!0,u).distanceTo(c)<=l))return!0;const A=r.getPlane(t);if(Math.abs(A.distanceToPoint(c))<=l){const m=A.projectPoint(c,e);if(r.containsPoint(m))return!0}return!1}}(),Cl=1e-15;function Ns(u){return Math.abs(u)<Cl}class ae extends nt{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new S),this.satBounds=new Array(4).fill().map(()=>new xe),this.points=[this.a,this.b,this.c],this.sphere=new Wi,this.plane=new gs,this.needsUpdate=!0}intersectsSphere(e){return Il(e,this)}update(){const e=this.a,t=this.b,n=this.c,s=this.points,o=this.satAxes,r=this.satBounds,l=o[0],c=r[0];this.getNormal(l),c.setFromPoints(l,s);const h=o[1],d=r[1];h.subVectors(e,t),d.setFromPoints(h,s);const i=o[2],a=r[2];i.subVectors(t,n),a.setFromPoints(i,s);const f=o[3],g=r[3];f.subVectors(n,e),g.setFromPoints(f,s),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(l,e),this.needsUpdate=!1}}ae.prototype.closestPointToSegment=function(){const u=new S,e=new S,t=new z;return function(s,o=null,r=null){const{start:l,end:c}=s,h=this.points;let d,i=1/0;for(let a=0;a<3;a++){const f=(a+1)%3;t.start.copy(h[a]),t.end.copy(h[f]),vn(t,s,u,e),d=u.distanceToSquared(e),d<i&&(i=d,o&&o.copy(u),r&&r.copy(e))}return this.closestPointToPoint(l,u),d=l.distanceToSquared(u),d<i&&(i=d,o&&o.copy(u),r&&r.copy(l)),this.closestPointToPoint(c,u),d=c.distanceToSquared(u),d<i&&(i=d,o&&o.copy(u),r&&r.copy(c)),Math.sqrt(i)}}();ae.prototype.intersectsTriangle=function(){const u=new ae,e=new Array(3),t=new Array(3),n=new xe,s=new xe,o=new S,r=new S,l=new S,c=new S,h=new S,d=new z,i=new z,a=new z,f=new S;function g(A,p,m){const _=A.points;let x=0,y=-1;for(let w=0;w<3;w++){const{start:v,end:T}=d;v.copy(_[w]),T.copy(_[(w+1)%3]),d.delta(r);const b=Ns(p.distanceToPoint(v));if(Ns(p.normal.dot(r))&&b){m.copy(d),x=2;break}const E=p.intersectLine(d,f);if(!E&&b&&f.copy(v),(E||b)&&!Ns(f.distanceTo(T))){if(x<=1)(x===1?m.start:m.end).copy(f),b&&(y=x);else if(x>=2){(y===1?m.start:m.end).copy(f),x=2;break}if(x++,x===2&&y===-1)break}}return x}return function(p,m=null,_=!1){this.needsUpdate&&this.update(),p.isExtendedTriangle?p.needsUpdate&&p.update():(u.copy(p),u.update(),p=u);const x=this.plane,y=p.plane;if(Math.abs(x.normal.dot(y.normal))>1-1e-10){const w=this.satBounds,v=this.satAxes;t[0]=p.a,t[1]=p.b,t[2]=p.c;for(let E=0;E<4;E++){const M=w[E],C=v[E];if(n.setFromPoints(C,t),M.isSeparated(n))return!1}const T=p.satBounds,b=p.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let E=0;E<4;E++){const M=T[E],C=b[E];if(n.setFromPoints(C,e),M.isSeparated(n))return!1}for(let E=0;E<4;E++){const M=v[E];for(let C=0;C<4;C++){const I=b[C];if(o.crossVectors(M,I),n.setFromPoints(o,e),s.setFromPoints(o,t),n.isSeparated(s))return!1}}return m&&(_||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),m.start.set(0,0,0),m.end.set(0,0,0)),!0}else{const w=g(this,y,i);if(w===1&&p.containsPoint(i.end))return m&&(m.start.copy(i.end),m.end.copy(i.end)),!0;if(w!==2)return!1;const v=g(p,x,a);if(v===1&&this.containsPoint(a.end))return m&&(m.start.copy(a.end),m.end.copy(a.end)),!0;if(v!==2)return!1;if(i.delta(l),a.delta(c),l.dot(c)<0){let B=a.start;a.start=a.end,a.end=B}const T=i.start.dot(l),b=i.end.dot(l),E=a.start.dot(l),M=a.end.dot(l),C=b<E,I=T<M;return T!==M&&E!==b&&C===I?!1:(m&&(h.subVectors(i.start,a.start),h.dot(l)>0?m.start.copy(i.start):m.start.copy(a.start),h.subVectors(i.end,a.end),h.dot(l)<0?m.end.copy(i.end):m.end.copy(a.end)),!0)}}}();ae.prototype.distanceToPoint=function(){const u=new S;return function(t){return this.closestPointToPoint(t,u),t.distanceTo(u)}}();ae.prototype.distanceToTriangle=function(){const u=new S,e=new S,t=["a","b","c"],n=new z,s=new z;return function(r,l=null,c=null){const h=l||c?n:null;if(this.intersectsTriangle(r,h))return(l||c)&&(l&&h.getCenter(l),c&&h.getCenter(c)),0;let d=1/0;for(let i=0;i<3;i++){let a;const f=t[i],g=r[f];this.closestPointToPoint(g,u),a=g.distanceToSquared(u),a<d&&(d=a,l&&l.copy(u),c&&c.copy(g));const A=this[f];r.closestPointToPoint(A,u),a=A.distanceToSquared(u),a<d&&(d=a,l&&l.copy(A),c&&c.copy(u))}for(let i=0;i<3;i++){const a=t[i],f=t[(i+1)%3];n.set(this[a],this[f]);for(let g=0;g<3;g++){const A=t[g],p=t[(g+1)%3];s.set(r[A],r[p]),vn(n,s,u,e);const m=u.distanceToSquared(e);m<d&&(d=m,l&&l.copy(u),c&&c.copy(e))}}return Math.sqrt(d)}}();class Y{constructor(e,t,n){this.isOrientedBox=!0,this.min=new S,this.max=new S,this.matrix=new V,this.invMatrix=new V,this.points=new Array(8).fill().map(()=>new S),this.satAxes=new Array(3).fill().map(()=>new S),this.satBounds=new Array(3).fill().map(()=>new xe),this.alignedSatBounds=new Array(3).fill().map(()=>new xe),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),n&&this.matrix.copy(n)}set(e,t,n){this.min.copy(e),this.max.copy(t),this.matrix.copy(n),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}Y.prototype.update=function(){return function(){const e=this.matrix,t=this.min,n=this.max,s=this.points;for(let h=0;h<=1;h++)for(let d=0;d<=1;d++)for(let i=0;i<=1;i++){const a=1*h|2*d|4*i,f=s[a];f.x=h?n.x:t.x,f.y=d?n.y:t.y,f.z=i?n.z:t.z,f.applyMatrix4(e)}const o=this.satBounds,r=this.satAxes,l=s[0];for(let h=0;h<3;h++){const d=r[h],i=o[h],a=1<<h,f=s[a];d.subVectors(l,f),i.setFromPoints(d,s)}const c=this.alignedSatBounds;c[0].setFromPointsField(s,"x"),c[1].setFromPointsField(s,"y"),c[2].setFromPointsField(s,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}();Y.prototype.intersectsBox=function(){const u=new xe;return function(t){this.needsUpdate&&this.update();const n=t.min,s=t.max,o=this.satBounds,r=this.satAxes,l=this.alignedSatBounds;if(u.min=n.x,u.max=s.x,l[0].isSeparated(u)||(u.min=n.y,u.max=s.y,l[1].isSeparated(u))||(u.min=n.z,u.max=s.z,l[2].isSeparated(u)))return!1;for(let c=0;c<3;c++){const h=r[c],d=o[c];if(u.setFromBox(h,t),d.isSeparated(u))return!1}return!0}}();Y.prototype.intersectsTriangle=function(){const u=new ae,e=new Array(3),t=new xe,n=new xe,s=new S;return function(r){this.needsUpdate&&this.update(),r.isExtendedTriangle?r.needsUpdate&&r.update():(u.copy(r),u.update(),r=u);const l=this.satBounds,c=this.satAxes;e[0]=r.a,e[1]=r.b,e[2]=r.c;for(let a=0;a<3;a++){const f=l[a],g=c[a];if(t.setFromPoints(g,e),f.isSeparated(t))return!1}const h=r.satBounds,d=r.satAxes,i=this.points;for(let a=0;a<3;a++){const f=h[a],g=d[a];if(t.setFromPoints(g,i),f.isSeparated(t))return!1}for(let a=0;a<3;a++){const f=c[a];for(let g=0;g<4;g++){const A=d[g];if(s.crossVectors(f,A),t.setFromPoints(s,e),n.setFromPoints(s,i),t.isSeparated(n))return!1}}return!0}}();Y.prototype.closestPointToPoint=function(){return function(e,t){return this.needsUpdate&&this.update(),t.copy(e).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t}}();Y.prototype.distanceToPoint=function(){const u=new S;return function(t){return this.closestPointToPoint(t,u),t.distanceTo(u)}}();Y.prototype.distanceToBox=function(){const u=["x","y","z"],e=new Array(12).fill().map(()=>new z),t=new Array(12).fill().map(()=>new z),n=new S,s=new S;return function(r,l=0,c=null,h=null){if(this.needsUpdate&&this.update(),this.intersectsBox(r))return(c||h)&&(r.getCenter(s),this.closestPointToPoint(s,n),r.closestPointToPoint(n,s),c&&c.copy(n),h&&h.copy(s)),0;const d=l*l,i=r.min,a=r.max,f=this.points;let g=1/0;for(let p=0;p<8;p++){const m=f[p];s.copy(m).clamp(i,a);const _=m.distanceToSquared(s);if(_<g&&(g=_,c&&c.copy(m),h&&h.copy(s),_<d))return Math.sqrt(_)}let A=0;for(let p=0;p<3;p++)for(let m=0;m<=1;m++)for(let _=0;_<=1;_++){const x=(p+1)%3,y=(p+2)%3,w=m<<x|_<<y,v=1<<p|m<<x|_<<y,T=f[w],b=f[v];e[A].set(T,b);const M=u[p],C=u[x],I=u[y],B=t[A],R=B.start,L=B.end;R[M]=i[M],R[C]=m?i[C]:a[C],R[I]=_?i[I]:a[C],L[M]=a[M],L[C]=m?i[C]:a[C],L[I]=_?i[I]:a[C],A++}for(let p=0;p<=1;p++)for(let m=0;m<=1;m++)for(let _=0;_<=1;_++){s.x=p?a.x:i.x,s.y=m?a.y:i.y,s.z=_?a.z:i.z,this.closestPointToPoint(s,n);const x=s.distanceToSquared(n);if(x<g&&(g=x,c&&c.copy(n),h&&h.copy(s),x<d))return Math.sqrt(x)}for(let p=0;p<12;p++){const m=e[p];for(let _=0;_<12;_++){const x=t[_];vn(m,x,n,s);const y=n.distanceToSquared(s);if(y<g&&(g=y,c&&c.copy(n),h&&h.copy(s),y<d))return Math.sqrt(y)}}return Math.sqrt(g)}}();class Tn{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){const e=this._primitives;return e.length===0?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}}class Bl extends Tn{constructor(){super(()=>new ae)}}const ie=new Bl;class Rl{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=n=>{t&&e.push(t),t=n,this.float32Array=new Float32Array(n),this.uint16Array=new Uint16Array(n),this.uint32Array=new Uint32Array(n)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const O=new Rl;let Pe,it;const Ge=[],Ft=new Tn(()=>new Q);function Ll(u,e,t,n,s,o){Pe=Ft.getPrimitive(),it=Ft.getPrimitive(),Ge.push(Pe,it),O.setBuffer(u._roots[e]);const r=$s(0,u.geometry,t,n,s,o);O.clearBuffer(),Ft.releasePrimitive(Pe),Ft.releasePrimitive(it),Ge.pop(),Ge.pop();const l=Ge.length;return l>0&&(it=Ge[l-1],Pe=Ge[l-2]),r}function $s(u,e,t,n,s=null,o=0,r=0){const{float32Array:l,uint16Array:c,uint32Array:h}=O;let d=u*2;if(X(d,c)){const a=Z(u,h),f=te(d,c);return k(u,l,Pe),n(a,f,!1,r,o+u,Pe)}else{let M=function(I){const{uint16Array:B,uint32Array:R}=O;let L=I*2;for(;!X(L,B);)I=se(I),L=I*2;return Z(I,R)},C=function(I){const{uint16Array:B,uint32Array:R}=O;let L=I*2;for(;!X(L,B);)I=ne(I,R),L=I*2;return Z(I,R)+te(L,B)};const a=se(u),f=ne(u,h);let g=a,A=f,p,m,_,x;if(s&&(_=Pe,x=it,k(g,l,_),k(A,l,x),p=s(_),m=s(x),m<p)){g=f,A=a;const I=p;p=m,m=I,_=x}_||(_=Pe,k(g,l,_));const y=X(g*2,c),w=t(_,y,p,r+1,o+g);let v;if(w===ti){const I=M(g),R=C(g)-I;v=n(I,R,!0,r+1,o+g,_)}else v=w&&$s(g,e,t,n,s,o,r+1);if(v)return!0;x=it,k(A,l,x);const T=X(A*2,c),b=t(x,T,m,r+1,o+A);let E;if(b===ti){const I=M(A),R=C(A)-I;E=n(I,R,!0,r+1,o+A,x)}else E=b&&$s(A,e,t,n,s,o,r+1);return!!E}}const mt=new S,Os=new S;function Pl(u,e,t={},n=0,s=1/0){const o=n*n,r=s*s;let l=1/0,c=null;if(u.shapecast({boundsTraverseOrder:d=>(mt.copy(e).clamp(d.min,d.max),mt.distanceToSquared(e)),intersectsBounds:(d,i,a)=>a<l&&a<r,intersectsTriangle:(d,i)=>{d.closestPointToPoint(e,mt);const a=e.distanceToSquared(mt);return a<l&&(Os.copy(mt),l=a,c=i),a<o}}),l===1/0)return null;const h=Math.sqrt(l);return t.point?t.point.copy(Os):t.point=Os.clone(),t.distance=h,t.faceIndex=c,t}const Qe=new S,We=new S,je=new S,kt=new N,Ut=new N,zt=new N,oi=new S,ai=new S,li=new S,Ht=new S;function Dl(u,e,t,n,s,o,r,l){let c;if(o===oo?c=u.intersectTriangle(n,t,e,!0,s):c=u.intersectTriangle(e,t,n,o!==ot,s),c===null)return null;const h=u.origin.distanceTo(s);return h<r||h>l?null:{distance:h,point:s.clone()}}function Nl(u,e,t,n,s,o,r,l,c,h,d){Qe.fromBufferAttribute(e,o),We.fromBufferAttribute(e,r),je.fromBufferAttribute(e,l);const i=Dl(u,Qe,We,je,Ht,c,h,d);if(i){n&&(kt.fromBufferAttribute(n,o),Ut.fromBufferAttribute(n,r),zt.fromBufferAttribute(n,l),i.uv=nt.getInterpolation(Ht,Qe,We,je,kt,Ut,zt,new N)),s&&(kt.fromBufferAttribute(s,o),Ut.fromBufferAttribute(s,r),zt.fromBufferAttribute(s,l),i.uv1=nt.getInterpolation(Ht,Qe,We,je,kt,Ut,zt,new N)),t&&(oi.fromBufferAttribute(t,o),ai.fromBufferAttribute(t,r),li.fromBufferAttribute(t,l),i.normal=nt.getInterpolation(Ht,Qe,We,je,oi,ai,li,new S),i.normal.dot(u.direction)>0&&i.normal.multiplyScalar(-1));const a={a:o,b:r,c:l,normal:new S,materialIndex:0};nt.getNormal(Qe,We,je,a.normal),i.face=a,i.faceIndex=o}return i}function _s(u,e,t,n,s,o,r){const l=n*3;let c=l+0,h=l+1,d=l+2;const i=u.index;u.index&&(c=i.getX(c),h=i.getX(h),d=i.getX(d));const{position:a,normal:f,uv:g,uv1:A}=u.attributes,p=Nl(t,a,f,g,A,c,h,d,e,o,r);return p?(p.faceIndex=n,s&&s.push(p),p):null}function U(u,e,t,n){const s=u.a,o=u.b,r=u.c;let l=e,c=e+1,h=e+2;t&&(l=t.getX(l),c=t.getX(c),h=t.getX(h)),s.x=n.getX(l),s.y=n.getY(l),s.z=n.getZ(l),o.x=n.getX(c),o.y=n.getY(c),o.z=n.getZ(c),r.x=n.getX(h),r.y=n.getY(h),r.z=n.getZ(h)}function Ol(u,e,t,n,s,o,r,l){const{geometry:c,_indirectBuffer:h}=u;for(let d=n,i=n+s;d<i;d++)_s(c,e,t,d,o,r,l)}function Fl(u,e,t,n,s,o,r){const{geometry:l,_indirectBuffer:c}=u;let h=1/0,d=null;for(let i=n,a=n+s;i<a;i++){let f;f=_s(l,e,t,i,null,o,r),f&&f.distance<h&&(d=f,h=f.distance)}return d}function kl(u,e,t,n,s,o,r){const{geometry:l}=t,{index:c}=l,h=l.attributes.position;for(let d=u,i=e+u;d<i;d++){let a;if(a=d,U(r,a*3,c,h),r.needsUpdate=!0,n(r,a,s,o))return!0}return!1}function Ul(u,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=u.geometry,n=t.index?t.index.array:null,s=t.attributes.position;let o,r,l,c,h=0;const d=u._roots;for(let a=0,f=d.length;a<f;a++)o=d[a],r=new Uint32Array(o),l=new Uint16Array(o),c=new Float32Array(o),i(0,h),h+=o.byteLength;function i(a,f,g=!1){const A=a*2;if(l[A+15]===As){const m=r[a+6],_=l[A+14];let x=1/0,y=1/0,w=1/0,v=-1/0,T=-1/0,b=-1/0;for(let E=3*m,M=3*(m+_);E<M;E++){let C=n[E];const I=s.getX(C),B=s.getY(C),R=s.getZ(C);I<x&&(x=I),I>v&&(v=I),B<y&&(y=B),B>T&&(T=B),R<w&&(w=R),R>b&&(b=R)}return c[a+0]!==x||c[a+1]!==y||c[a+2]!==w||c[a+3]!==v||c[a+4]!==T||c[a+5]!==b?(c[a+0]=x,c[a+1]=y,c[a+2]=w,c[a+3]=v,c[a+4]=T,c[a+5]=b,!0):!1}else{const m=a+8,_=r[a+6],x=m+f,y=_+f;let w=g,v=!1,T=!1;e?w||(v=e.has(x),T=e.has(y),w=!v&&!T):(v=!0,T=!0);const b=w||v,E=w||T;let M=!1;b&&(M=i(m,f,w));let C=!1;E&&(C=i(_,f,w));const I=M||C;if(I)for(let B=0;B<3;B++){const R=m+B,L=_+B,F=c[R],j=c[R+3],ut=c[L],ft=c[L+3];c[a+B]=F<ut?F:ut,c[a+B+3]=j>ft?j:ft}return I}}}function De(u,e,t,n,s){let o,r,l,c,h,d;const i=1/t.direction.x,a=1/t.direction.y,f=1/t.direction.z,g=t.origin.x,A=t.origin.y,p=t.origin.z;let m=e[u],_=e[u+3],x=e[u+1],y=e[u+3+1],w=e[u+2],v=e[u+3+2];return i>=0?(o=(m-g)*i,r=(_-g)*i):(o=(_-g)*i,r=(m-g)*i),a>=0?(l=(x-A)*a,c=(y-A)*a):(l=(y-A)*a,c=(x-A)*a),o>c||l>r||((l>o||isNaN(o))&&(o=l),(c<r||isNaN(r))&&(r=c),f>=0?(h=(w-p)*f,d=(v-p)*f):(h=(v-p)*f,d=(w-p)*f),o>d||h>r)?!1:((h>o||o!==o)&&(o=h),(d<r||r!==r)&&(r=d),o<=s&&r>=n)}function zl(u,e,t,n,s,o,r,l){const{geometry:c,_indirectBuffer:h}=u;for(let d=n,i=n+s;d<i;d++){let a=h?h[d]:d;_s(c,e,t,a,o,r,l)}}function Hl(u,e,t,n,s,o,r){const{geometry:l,_indirectBuffer:c}=u;let h=1/0,d=null;for(let i=n,a=n+s;i<a;i++){let f;f=_s(l,e,t,c?c[i]:i,null,o,r),f&&f.distance<h&&(d=f,h=f.distance)}return d}function Vl(u,e,t,n,s,o,r){const{geometry:l}=t,{index:c}=l,h=l.attributes.position;for(let d=u,i=e+u;d<i;d++){let a;if(a=t.resolveTriangleIndex(d),U(r,a*3,c,h),r.needsUpdate=!0,n(r,a,s,o))return!0}return!1}function Gl(u,e,t,n,s,o,r){O.setBuffer(u._roots[e]),en(0,u,t,n,s,o,r),O.clearBuffer()}function en(u,e,t,n,s,o,r){const{float32Array:l,uint16Array:c,uint32Array:h}=O,d=u*2;if(X(d,c)){const a=Z(u,h),f=te(d,c);Ol(e,t,n,a,f,s,o,r)}else{const a=se(u);De(a,l,n,o,r)&&en(a,e,t,n,s,o,r);const f=ne(u,h);De(f,l,n,o,r)&&en(f,e,t,n,s,o,r)}}const Ql=["x","y","z"];function Wl(u,e,t,n,s,o){O.setBuffer(u._roots[e]);const r=tn(0,u,t,n,s,o);return O.clearBuffer(),r}function tn(u,e,t,n,s,o){const{float32Array:r,uint16Array:l,uint32Array:c}=O;let h=u*2;if(X(h,l)){const i=Z(u,c),a=te(h,l);return Fl(e,t,n,i,a,s,o)}else{const i=cr(u,c),a=Ql[i],g=n.direction[a]>=0;let A,p;g?(A=se(u),p=ne(u,c)):(A=ne(u,c),p=se(u));const _=De(A,r,n,s,o)?tn(A,e,t,n,s,o):null;if(_){const w=_.point[a];if(g?w<=r[p+i]:w>=r[p+i+3])return _}const y=De(p,r,n,s,o)?tn(p,e,t,n,s,o):null;return _&&y?_.distance<=y.distance?_:y:_||y||null}}const Vt=new Q,Ke=new ae,Ye=new ae,At=new V,ci=new Y,Gt=new Y;function jl(u,e,t,n){O.setBuffer(u._roots[e]);const s=sn(0,u,t,n);return O.clearBuffer(),s}function sn(u,e,t,n,s=null){const{float32Array:o,uint16Array:r,uint32Array:l}=O;let c=u*2;if(s===null&&(t.boundingBox||t.computeBoundingBox(),ci.set(t.boundingBox.min,t.boundingBox.max,n),s=ci),X(c,r)){const d=e.geometry,i=d.index,a=d.attributes.position,f=t.index,g=t.attributes.position,A=Z(u,l),p=te(c,r);if(At.copy(n).invert(),t.boundsTree)return k(u,o,Gt),Gt.matrix.copy(At),Gt.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:_=>Gt.intersectsBox(_),intersectsTriangle:_=>{_.a.applyMatrix4(n),_.b.applyMatrix4(n),_.c.applyMatrix4(n),_.needsUpdate=!0;for(let x=A*3,y=(p+A)*3;x<y;x+=3)if(U(Ye,x,i,a),Ye.needsUpdate=!0,_.intersectsTriangle(Ye))return!0;return!1}});for(let m=A*3,_=(p+A)*3;m<_;m+=3){U(Ke,m,i,a),Ke.a.applyMatrix4(At),Ke.b.applyMatrix4(At),Ke.c.applyMatrix4(At),Ke.needsUpdate=!0;for(let x=0,y=f.count;x<y;x+=3)if(U(Ye,x,f,g),Ye.needsUpdate=!0,Ke.intersectsTriangle(Ye))return!0}}else{const d=u+8,i=l[u+6];return k(d,o,Vt),!!(s.intersectsBox(Vt)&&sn(d,e,t,n,s)||(k(i,o,Vt),s.intersectsBox(Vt)&&sn(i,e,t,n,s)))}}const Qt=new V,Fs=new Y,_t=new Y,Kl=new S,Yl=new S,Xl=new S,ql=new S;function Zl(u,e,t,n={},s={},o=0,r=1/0){e.boundingBox||e.computeBoundingBox(),Fs.set(e.boundingBox.min,e.boundingBox.max,t),Fs.needsUpdate=!0;const l=u.geometry,c=l.attributes.position,h=l.index,d=e.attributes.position,i=e.index,a=ie.getPrimitive(),f=ie.getPrimitive();let g=Kl,A=Yl,p=null,m=null;s&&(p=Xl,m=ql);let _=1/0,x=null,y=null;return Qt.copy(t).invert(),_t.matrix.copy(Qt),u.shapecast({boundsTraverseOrder:w=>Fs.distanceToBox(w),intersectsBounds:(w,v,T)=>T<_&&T<r?(v&&(_t.min.copy(w.min),_t.max.copy(w.max),_t.needsUpdate=!0),!0):!1,intersectsRange:(w,v)=>{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:b=>_t.distanceToBox(b),intersectsBounds:(b,E,M)=>M<_&&M<r,intersectsRange:(b,E)=>{for(let M=b,C=b+E;M<C;M++){U(f,3*M,i,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let I=w,B=w+v;I<B;I++){U(a,3*I,h,c),a.needsUpdate=!0;const R=a.distanceToTriangle(f,g,p);if(R<_&&(A.copy(g),m&&m.copy(p),_=R,x=I,y=M),R<o)return!0}}}});{const T=ct(e);for(let b=0,E=T;b<E;b++){U(f,3*b,i,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let M=w,C=w+v;M<C;M++){U(a,3*M,h,c),a.needsUpdate=!0;const I=a.distanceToTriangle(f,g,p);if(I<_&&(A.copy(g),m&&m.copy(p),_=I,x=M,y=b),I<o)return!0}}}}}),ie.releasePrimitive(a),ie.releasePrimitive(f),_===1/0?null:(n.point?n.point.copy(A):n.point=A.clone(),n.distance=_,n.faceIndex=x,s&&(s.point?s.point.copy(m):s.point=m.clone(),s.point.applyMatrix4(Qt),A.applyMatrix4(Qt),s.distance=A.sub(s.point).length(),s.faceIndex=y),n)}function Jl(u,e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=u.geometry,n=t.index?t.index.array:null,s=t.attributes.position;let o,r,l,c,h=0;const d=u._roots;for(let a=0,f=d.length;a<f;a++)o=d[a],r=new Uint32Array(o),l=new Uint16Array(o),c=new Float32Array(o),i(0,h),h+=o.byteLength;function i(a,f,g=!1){const A=a*2;if(l[A+15]===As){const m=r[a+6],_=l[A+14];let x=1/0,y=1/0,w=1/0,v=-1/0,T=-1/0,b=-1/0;for(let E=m,M=m+_;E<M;E++){const C=3*u.resolveTriangleIndex(E);for(let I=0;I<3;I++){let B=C+I;B=n?n[B]:B;const R=s.getX(B),L=s.getY(B),F=s.getZ(B);R<x&&(x=R),R>v&&(v=R),L<y&&(y=L),L>T&&(T=L),F<w&&(w=F),F>b&&(b=F)}}return c[a+0]!==x||c[a+1]!==y||c[a+2]!==w||c[a+3]!==v||c[a+4]!==T||c[a+5]!==b?(c[a+0]=x,c[a+1]=y,c[a+2]=w,c[a+3]=v,c[a+4]=T,c[a+5]=b,!0):!1}else{const m=a+8,_=r[a+6],x=m+f,y=_+f;let w=g,v=!1,T=!1;e?w||(v=e.has(x),T=e.has(y),w=!v&&!T):(v=!0,T=!0);const b=w||v,E=w||T;let M=!1;b&&(M=i(m,f,w));let C=!1;E&&(C=i(_,f,w));const I=M||C;if(I)for(let B=0;B<3;B++){const R=m+B,L=_+B,F=c[R],j=c[R+3],ut=c[L],ft=c[L+3];c[a+B]=F<ut?F:ut,c[a+B+3]=j>ft?j:ft}return I}}}function $l(u,e,t,n,s,o,r){O.setBuffer(u._roots[e]),nn(0,u,t,n,s,o,r),O.clearBuffer()}function nn(u,e,t,n,s,o,r){const{float32Array:l,uint16Array:c,uint32Array:h}=O,d=u*2;if(X(d,c)){const a=Z(u,h),f=te(d,c);zl(e,t,n,a,f,s,o,r)}else{const a=se(u);De(a,l,n,o,r)&&nn(a,e,t,n,s,o,r);const f=ne(u,h);De(f,l,n,o,r)&&nn(f,e,t,n,s,o,r)}}const ec=["x","y","z"];function tc(u,e,t,n,s,o){O.setBuffer(u._roots[e]);const r=rn(0,u,t,n,s,o);return O.clearBuffer(),r}function rn(u,e,t,n,s,o){const{float32Array:r,uint16Array:l,uint32Array:c}=O;let h=u*2;if(X(h,l)){const i=Z(u,c),a=te(h,l);return Hl(e,t,n,i,a,s,o)}else{const i=cr(u,c),a=ec[i],g=n.direction[a]>=0;let A,p;g?(A=se(u),p=ne(u,c)):(A=ne(u,c),p=se(u));const _=De(A,r,n,s,o)?rn(A,e,t,n,s,o):null;if(_){const w=_.point[a];if(g?w<=r[p+i]:w>=r[p+i+3])return _}const y=De(p,r,n,s,o)?rn(p,e,t,n,s,o):null;return _&&y?_.distance<=y.distance?_:y:_||y||null}}const Wt=new Q,Xe=new ae,qe=new ae,xt=new V,ui=new Y,jt=new Y;function sc(u,e,t,n){O.setBuffer(u._roots[e]);const s=on(0,u,t,n);return O.clearBuffer(),s}function on(u,e,t,n,s=null){const{float32Array:o,uint16Array:r,uint32Array:l}=O;let c=u*2;if(s===null&&(t.boundingBox||t.computeBoundingBox(),ui.set(t.boundingBox.min,t.boundingBox.max,n),s=ui),X(c,r)){const d=e.geometry,i=d.index,a=d.attributes.position,f=t.index,g=t.attributes.position,A=Z(u,l),p=te(c,r);if(xt.copy(n).invert(),t.boundsTree)return k(u,o,jt),jt.matrix.copy(xt),jt.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:_=>jt.intersectsBox(_),intersectsTriangle:_=>{_.a.applyMatrix4(n),_.b.applyMatrix4(n),_.c.applyMatrix4(n),_.needsUpdate=!0;for(let x=A,y=p+A;x<y;x++)if(U(qe,3*e.resolveTriangleIndex(x),i,a),qe.needsUpdate=!0,_.intersectsTriangle(qe))return!0;return!1}});for(let m=A,_=p+A;m<_;m++){const x=e.resolveTriangleIndex(m);U(Xe,3*x,i,a),Xe.a.applyMatrix4(xt),Xe.b.applyMatrix4(xt),Xe.c.applyMatrix4(xt),Xe.needsUpdate=!0;for(let y=0,w=f.count;y<w;y+=3)if(U(qe,y,f,g),qe.needsUpdate=!0,Xe.intersectsTriangle(qe))return!0}}else{const d=u+8,i=l[u+6];return k(d,o,Wt),!!(s.intersectsBox(Wt)&&on(d,e,t,n,s)||(k(i,o,Wt),s.intersectsBox(Wt)&&on(i,e,t,n,s)))}}const Kt=new V,ks=new Y,yt=new Y,nc=new S,ic=new S,rc=new S,oc=new S;function ac(u,e,t,n={},s={},o=0,r=1/0){e.boundingBox||e.computeBoundingBox(),ks.set(e.boundingBox.min,e.boundingBox.max,t),ks.needsUpdate=!0;const l=u.geometry,c=l.attributes.position,h=l.index,d=e.attributes.position,i=e.index,a=ie.getPrimitive(),f=ie.getPrimitive();let g=nc,A=ic,p=null,m=null;s&&(p=rc,m=oc);let _=1/0,x=null,y=null;return Kt.copy(t).invert(),yt.matrix.copy(Kt),u.shapecast({boundsTraverseOrder:w=>ks.distanceToBox(w),intersectsBounds:(w,v,T)=>T<_&&T<r?(v&&(yt.min.copy(w.min),yt.max.copy(w.max),yt.needsUpdate=!0),!0):!1,intersectsRange:(w,v)=>{if(e.boundsTree){const T=e.boundsTree;return T.shapecast({boundsTraverseOrder:b=>yt.distanceToBox(b),intersectsBounds:(b,E,M)=>M<_&&M<r,intersectsRange:(b,E)=>{for(let M=b,C=b+E;M<C;M++){const I=T.resolveTriangleIndex(M);U(f,3*I,i,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let B=w,R=w+v;B<R;B++){const L=u.resolveTriangleIndex(B);U(a,3*L,h,c),a.needsUpdate=!0;const F=a.distanceToTriangle(f,g,p);if(F<_&&(A.copy(g),m&&m.copy(p),_=F,x=B,y=M),F<o)return!0}}}})}else{const T=ct(e);for(let b=0,E=T;b<E;b++){U(f,3*b,i,d),f.a.applyMatrix4(t),f.b.applyMatrix4(t),f.c.applyMatrix4(t),f.needsUpdate=!0;for(let M=w,C=w+v;M<C;M++){const I=u.resolveTriangleIndex(M);U(a,3*I,h,c),a.needsUpdate=!0;const B=a.distanceToTriangle(f,g,p);if(B<_&&(A.copy(g),m&&m.copy(p),_=B,x=M,y=b),B<o)return!0}}}}}),ie.releasePrimitive(a),ie.releasePrimitive(f),_===1/0?null:(n.point?n.point.copy(A):n.point=A.clone(),n.distance=_,n.faceIndex=x,s&&(s.point?s.point.copy(m):s.point=m.clone(),s.point.applyMatrix4(Kt),A.applyMatrix4(Kt),s.distance=A.sub(s.point).length(),s.faceIndex=y),n)}function En(){return typeof SharedArrayBuffer<"u"}function fi(u,e){if(u===null)return u;if(u.buffer){const t=u.buffer;if(t.constructor===e)return u;const n=u.constructor,s=new n(new e(t.byteLength));return s.set(u),s}else{if(u.constructor===e)return u;const t=new e(u.byteLength);return new Uint8Array(t).set(new Uint8Array(u)),t}}const It=new O.constructor,as=new O.constructor,Re=new Tn(()=>new Q),Ze=new Q,Je=new Q,Us=new Q,zs=new Q;let Hs=!1;function lc(u,e,t,n){if(Hs)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");Hs=!0;const s=u._roots,o=e._roots;let r,l=0,c=0;const h=new V().copy(t).invert();for(let d=0,i=s.length;d<i;d++){It.setBuffer(s[d]),c=0;const a=Re.getPrimitive();k(0,It.float32Array,a),a.applyMatrix4(h);for(let f=0,g=o.length;f<g&&(as.setBuffer(o[d]),r=oe(0,0,t,h,n,l,c,0,0,a),as.clearBuffer(),c+=o[f].length,!r);f++);if(Re.releasePrimitive(a),It.clearBuffer(),l+=s[d].length,r)break}return Hs=!1,r}function oe(u,e,t,n,s,o=0,r=0,l=0,c=0,h=null,d=!1){let i,a;d?(i=as,a=It):(i=It,a=as);const f=i.float32Array,g=i.uint32Array,A=i.uint16Array,p=a.float32Array,m=a.uint32Array,_=a.uint16Array,x=u*2,y=e*2,w=X(x,A),v=X(y,_);let T=!1;if(v&&w)d?T=s(Z(e,m),te(e*2,_),Z(u,g),te(u*2,A),c,r+e,l,o+u):T=s(Z(u,g),te(u*2,A),Z(e,m),te(e*2,_),l,o+u,c,r+e);else if(v){const b=Re.getPrimitive();k(e,p,b),b.applyMatrix4(t);const E=se(u),M=ne(u,g);k(E,f,Ze),k(M,f,Je);const C=b.intersectsBox(Ze),I=b.intersectsBox(Je);T=C&&oe(e,E,n,t,s,r,o,c,l+1,b,!d)||I&&oe(e,M,n,t,s,r,o,c,l+1,b,!d),Re.releasePrimitive(b)}else{const b=se(e),E=ne(e,m);k(b,p,Us),k(E,p,zs);const M=h.intersectsBox(Us),C=h.intersectsBox(zs);if(M&&C)T=oe(u,b,t,n,s,o,r,l,c+1,h,d)||oe(u,E,t,n,s,o,r,l,c+1,h,d);else if(M)if(w)T=oe(u,b,t,n,s,o,r,l,c+1,h,d);else{const I=Re.getPrimitive();I.copy(Us).applyMatrix4(t);const B=se(u),R=ne(u,g);k(B,f,Ze),k(R,f,Je);const L=I.intersectsBox(Ze),F=I.intersectsBox(Je);T=L&&oe(b,B,n,t,s,r,o,c,l+1,I,!d)||F&&oe(b,R,n,t,s,r,o,c,l+1,I,!d),Re.releasePrimitive(I)}else if(C)if(w)T=oe(u,E,t,n,s,o,r,l,c+1,h,d);else{const I=Re.getPrimitive();I.copy(zs).applyMatrix4(t);const B=se(u),R=ne(u,g);k(B,f,Ze),k(R,f,Je);const L=I.intersectsBox(Ze),F=I.intersectsBox(Je);T=L&&oe(E,B,n,t,s,r,o,c,l+1,I,!d)||F&&oe(E,R,n,t,s,r,o,c,l+1,I,!d),Re.releasePrimitive(I)}}return T}const Yt=new Y,hi=new Q,cc={strategy:rr,maxDepth:40,maxLeafTris:10,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,verbose:!0};class xs{static serialize(e,t={}){t={cloneBuffers:!0,...t};const n=e.geometry,s=e._roots,o=e._indirectBuffer,r=n.getIndex();let l;return t.cloneBuffers?l={roots:s.map(c=>c.slice()),index:r?r.array.slice():null,indirectBuffer:o?o.slice():null}:l={roots:s,index:r?r.array:null,indirectBuffer:o},l}static deserialize(e,t,n={}){n={setIndex:!0,indirect:!!e.indirectBuffer,...n};const{index:s,roots:o,indirectBuffer:r}=e,l=new xs(t,{...n,[Ls]:!0});if(l._roots=o,l._indirectBuffer=r||null,n.setIndex){const c=t.getIndex();if(c===null){const h=new K(e.index,1,!1);t.setIndex(h)}else c.array!==s&&(c.array.set(s),c.needsUpdate=!0)}return l}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({...cc,[Ls]:!1},t),t.useSharedArrayBuffer&&!En())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[Ls]||(Sl(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new Q))),this.resolveTriangleIndex=t.indirect?n=>this._indirectBuffer[n]:n=>n}refit(e=null){return(this.indirect?Jl:Ul)(this,e)}traverse(e,t=0){const n=this._roots[t],s=new Uint32Array(n),o=new Uint16Array(n);r(0);function r(l,c=0){const h=l*2,d=o[h+15]===As;if(d){const i=s[l+6],a=o[h+14];e(c,d,new Float32Array(n,l*4,6),i,a)}else{const i=l+Mt/4,a=s[l+6],f=s[l+7];e(c,d,new Float32Array(n,l*4,6),f)||(r(i,c+1),r(a,c+1))}}}raycast(e,t=Ks,n=0,s=1/0){const o=this._roots,r=this.geometry,l=[],c=t.isMaterial,h=Array.isArray(t),d=r.groups,i=c?t.side:t,a=this.indirect?$l:Gl;for(let f=0,g=o.length;f<g;f++){const A=h?t[d[f].materialIndex].side:i,p=l.length;if(a(this,f,A,e,l,n,s),h){const m=d[f].materialIndex;for(let _=p,x=l.length;_<x;_++)l[_].face.materialIndex=m}}return l}raycastFirst(e,t=Ks,n=0,s=1/0){const o=this._roots,r=this.geometry,l=t.isMaterial,c=Array.isArray(t);let h=null;const d=r.groups,i=l?t.side:t,a=this.indirect?tc:Wl;for(let f=0,g=o.length;f<g;f++){const A=c?t[d[f].materialIndex].side:i,p=a(this,f,A,e,n,s);p!=null&&(h==null||p.distance<h.distance)&&(h=p,c&&(p.face.materialIndex=d[f].materialIndex))}return h}intersectsGeometry(e,t){let n=!1;const s=this._roots,o=this.indirect?sc:jl;for(let r=0,l=s.length;r<l&&(n=o(this,r,e,t),!n);r++);return n}shapecast(e){const t=ie.getPrimitive(),n=this.indirect?Vl:kl;let{boundsTraverseOrder:s,intersectsBounds:o,intersectsRange:r,intersectsTriangle:l}=e;if(r&&l){const i=r;r=(a,f,g,A,p)=>i(a,f,g,A,p)?!0:n(a,f,this,l,g,A,t)}else r||(l?r=(i,a,f,g)=>n(i,a,this,l,f,g,t):r=(i,a,f)=>f);let c=!1,h=0;const d=this._roots;for(let i=0,a=d.length;i<a;i++){const f=d[i];if(c=Ll(this,i,o,r,s,h),c)break;h+=f.byteLength}return ie.releasePrimitive(t),c}bvhcast(e,t,n){let{intersectsRanges:s,intersectsTriangles:o}=n;const r=ie.getPrimitive(),l=this.geometry.index,c=this.geometry.attributes.position,h=this.indirect?g=>{const A=this.resolveTriangleIndex(g);U(r,A*3,l,c)}:g=>{U(r,g*3,l,c)},d=ie.getPrimitive(),i=e.geometry.index,a=e.geometry.attributes.position,f=e.indirect?g=>{const A=e.resolveTriangleIndex(g);U(d,A*3,i,a)}:g=>{U(d,g*3,i,a)};if(o){const g=(A,p,m,_,x,y,w,v)=>{for(let T=m,b=m+_;T<b;T++){f(T),d.a.applyMatrix4(t),d.b.applyMatrix4(t),d.c.applyMatrix4(t),d.needsUpdate=!0;for(let E=A,M=A+p;E<M;E++)if(h(E),r.needsUpdate=!0,o(r,d,E,T,x,y,w,v))return!0}return!1};if(s){const A=s;s=function(p,m,_,x,y,w,v,T){return A(p,m,_,x,y,w,v,T)?!0:g(p,m,_,x,y,w,v,T)}}else s=g}return lc(this,e,t,s)}intersectsBox(e,t){return Yt.set(e.min,e.max,t),Yt.needsUpdate=!0,this.shapecast({intersectsBounds:n=>Yt.intersectsBox(n),intersectsTriangle:n=>Yt.intersectsTriangle(n)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,n={},s={},o=0,r=1/0){return(this.indirect?ac:Zl)(this,e,t,n,s,o,r)}closestPointToPoint(e,t={},n=0,s=1/0){return Pl(this,e,t,n,s)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(n=>{k(0,new Float32Array(n),hi),e.union(hi)}),e}}class hr{constructor(e){this.name="WorkerBase",this.running=!1,this.worker=e,this.worker.onerror=t=>{throw t.message?new Error(`${this.name}: Could not create Web Worker with error "${t.message}"`):new Error(`${this.name}: Could not create Web Worker.`)}}runTask(){}generate(...e){if(this.running)throw new Error("GenerateMeshBVHWorker: Already running job.");if(this.worker===null)throw new Error("GenerateMeshBVHWorker: Worker has been disposed.");this.running=!0;const t=this.runTask(this.worker,...e);return t.finally(()=>{this.running=!1}),t}dispose(){this.worker.terminate(),this.worker=null}}class uc extends hr{constructor(){const e=new Worker(new URL(""+new URL("generateMeshBVH.worker-NFSCTTDt.js",import.meta.url).href,import.meta.url),{type:"module"});super(e),this.name="GenerateMeshBVHWorker"}runTask(e,t,n={}){return new Promise((s,o)=>{if(t.getAttribute("position").isInterleavedBufferAttribute||t.index&&t.index.isInterleavedBufferAttribute)throw new Error("GenerateMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");e.onerror=h=>{o(new Error(`GenerateMeshBVHWorker: ${h.message}`))},e.onmessage=h=>{const{data:d}=h;if(d.error)o(new Error(d.error)),e.onmessage=null;else if(d.serialized){const{serialized:i,position:a}=d,f=xs.deserialize(i,t,{setIndex:!1}),g=Object.assign({setBoundingBox:!0},n);if(t.attributes.position.array=a,i.index)if(t.index)t.index.array=i.index;else{const A=new K(i.index,1,!1);t.setIndex(A)}g.setBoundingBox&&(t.boundingBox=f.getBoundingBox(new Q)),n.onProgress&&n.onProgress(d.progress),s(f),e.onmessage=null}else n.onProgress&&n.onProgress(d.progress)};const r=t.index?t.index.array:null,l=t.attributes.position.array,c=[l];r&&c.push(r),e.postMessage({index:r,position:l,options:{...n,onProgress:null,includedProgressCallback:!!n.onProgress,groups:[...t.groups]}},c.map(h=>h.buffer).filter(h=>typeof SharedArrayBuffer>"u"||!(h instanceof SharedArrayBuffer)))})}}const dr=typeof navigator<"u"?navigator.hardwareConcurrency:4;class fc extends hr{constructor(){const e=new Worker(new URL(""+new URL("parallelMeshBVH.worker-TP6qJGKX.js",import.meta.url).href,import.meta.url),{type:"module"});if(super(e),this.name="ParallelMeshBVHWorker",this.maxWorkerCount=Math.max(dr,4),!En())throw new Error("ParallelMeshBVHWorker: Shared Array Buffers are not supported.")}runTask(e,t,n={}){return new Promise((s,o)=>{if(!t.index&&!n.indirect&&or(t,n),t.getAttribute("position").isInterleavedBufferAttribute||t.index&&t.index.isInterleavedBufferAttribute)throw new Error("ParallelMeshBVHWorker: InterleavedBufferAttribute are not supported for the geometry attributes.");e.onerror=c=>{o(new Error(`ParallelMeshBVHWorker: ${c.message}`))},e.onmessage=c=>{const{data:h}=c;if(h.error)o(new Error(h.error)),e.onmessage=null;else if(h.serialized){const{serialized:d,position:i}=h,a=xs.deserialize(d,t,{setIndex:!1}),f={setBoundingBox:!0,...n};if(t.attributes.position.array=i,d.index)if(t.index)t.index.array=d.index;else{const g=new K(d.index,1,!1);t.setIndex(g)}f.setBoundingBox&&(t.boundingBox=a.getBoundingBox(new Q)),n.onProgress&&n.onProgress(h.progress),s(a),e.onmessage=null}else n.onProgress&&n.onProgress(h.progress)};const r=t.index?t.index.array:null,l=t.attributes.position.array;e.postMessage({operation:"BUILD_BVH",maxWorkerCount:this.maxWorkerCount,index:fi(r,SharedArrayBuffer),position:fi(l,SharedArrayBuffer),options:{...n,onProgress:null,includedProgressCallback:!!n.onProgress,groups:[...t.groups]}})})}}class hc{constructor(){if(En())return new fc;{console.warn("ParallelMeshBVHWorker: SharedArrayBuffers not supported. Falling back to single-threaded GenerateMeshBVHWorker.");const e=new uc;return e.maxWorkerCount=dr,e}}}const ls=1e-16,pr=new S(0,1,0),di=new S;function dc(u){return u.delta(di).normalize(),Math.abs(di.dot(pr))>=1-ls}function gr(u){return u.needsUpdate&&u.update(),Math.abs(u.plane.normal.dot(pr))<=ls}function an(u,e){const{start:t,end:n}=e,s=u.points;let o=!1,r=!1;for(let l=0;l<3;l++){const c=s[l];if(!o&&t.distanceToSquared(c)<=ls&&(o=!0),!r&&n.distanceToSquared(c)<=ls&&(r=!0),o&&r)return!0}return o&&r}const pi=1e-16,pc=new S(0,1,0),gi=new S,mi=new S,Xt=new S,qt=new nt;function gc(u,e=pc,t=1){const n=[],o=Math.pow(10,4),r=Math.cos(Rt.DEG2RAD*t),l=u.getIndex(),c=u.getAttribute("position"),h=l?l.count:c.count,d=[0,0,0],i=["a","b","c"],a=new Array(3),f={};for(let g=0;g<h;g+=3){l?(d[0]=l.getX(g),d[1]=l.getX(g+1),d[2]=l.getX(g+2)):(d[0]=g,d[1]=g+1,d[2]=g+2);const{a:A,b:p,c:m}=qt;if(A.fromBufferAttribute(c,d[0]),p.fromBufferAttribute(c,d[1]),m.fromBufferAttribute(c,d[2]),qt.getNormal(Xt),a[0]=`${Math.round(A.x*o)},${Math.round(A.y*o)},${Math.round(A.z*o)}`,a[1]=`${Math.round(p.x*o)},${Math.round(p.y*o)},${Math.round(p.z*o)}`,a[2]=`${Math.round(m.x*o)},${Math.round(m.y*o)},${Math.round(m.z*o)}`,!(a[0]===a[1]||a[1]===a[2]||a[2]===a[0]))for(let _=0;_<3;_++){const x=(_+1)%3,y=a[_],w=a[x],v=qt[i[_]],T=qt[i[x]],b=`${y}_${w}`,E=`${w}_${y}`;if(E in f&&f[E]){const M=f[E].normal,C=Xt.dot(M)<=r;let I=e.dot(Xt);I=Math.abs(I)<pi?0:I;let B=e.dot(M);B=Math.abs(B)<pi?0:B;const R=Math.sign(I)!==Math.sign(B);if(C||R){const L=new z;L.start.copy(v),L.end.copy(T),n.push(L)}f[E]=null}else b in f||(f[b]={index0:d[_],index1:d[x],normal:Xt.clone()})}}for(const g in f)if(f[g]){const{index0:A,index1:p}=f[g];gi.fromBufferAttribute(c,A),mi.fromBufferAttribute(c,p);const m=new z;m.start.copy(gi),m.end.copy(mi),n.push(m)}return n}const Ee=new z;function mr(u){u.sort((e,t)=>e[0]-t[0]);for(let e=1;e<u.length;e++){const t=u[e],n=u[e-1];n[1]>=t[0]&&(n[1]=Math.max(n[1],t[1]),u.splice(e,1),e--)}}function mc(u,e,t=[]){mr(e);const n=[[0,1]];for(let s=0,o=e.length;s<o;s++){const r=n[s],l=e[s];r[1]=l[0],n.push(new Float32Array([l[1],1]))}for(let s=0,o=n.length;s<o;s++){const{start:r,end:l}=u;Ee.start.lerpVectors(r,l,n[s][0]),Ee.end.lerpVectors(r,l,n[s][1]),t.push(new Float32Array([Ee.start.x,Ee.start.y,Ee.start.z,Ee.end.x,Ee.end.y,Ee.end.z]))}return t}const Vs=1e-16,Ac=new S(0,1,0),be=new gs,wt=new S,Ai=new S;function _c(u,e,t){if(gr(u))return!1;u.needsUpdate&&u.update(),be.copy(u.plane),be.normal.dot(Ac)<0&&(be.normal.multiplyScalar(-1),be.constant*=-1);const n=be.distanceToPoint(e.start),s=be.distanceToPoint(e.end),o=Math.abs(n)<Vs,r=Math.abs(s)<Vs,l=n<0,c=s<0;if(e.delta(Ai).normalize(),Math.abs(be.normal.dot(Ai))<Vs)return o||!l?!1:(t.copy(e),!0);if(l&&c)return t.copy(e),!0;if(!l&&!c)return!1;{let h=be.intersectLine(e,wt);if(h||(o&&(wt.copy(e.start),h=!0),r&&(wt.copy(e.end),h=!0)),h){if(l)return t.start.copy(e.start),t.end.copy(wt),!0;if(c)return t.end.copy(e.end),t.start.copy(wt),!0}}return!1}const xc=1e-16,_i=1e-16,Zt=new gs,$e=new z,Jt=new S,Gs=new S,Se=new Li,J=new z,pe=new z,Me=new S,xi=new S;function yc(u,e,t=new z){if(Se.copy(e),Se.a.y=0,Se.b.y=0,Se.c.y=0,Se.update(),J.copy(u),J.start.y=0,J.end.y=0,Se.getArea()<=xc)return null;J.delta(Me).normalize(),Me.cross(Se.plane.normal).normalize(),Zt.setFromNormalAndCoplanarPoint(Me,J.start);let n=0;const{points:s}=Se;for(let o=0;o<3;o++){const r=s[o],l=s[(o+1)%3];$e.start.copy(r),$e.end.copy(l);const c=Math.abs(Zt.distanceToPoint($e.start))<_i,h=Math.abs(Zt.distanceToPoint($e.end))<_i,d=Zt.intersectLine($e,Jt);if((d&&!h||c)&&(c&&!d&&Jt.copy($e.start),n===0?pe.start.copy(Jt):pe.end.copy(Jt),n++,n===2))break}if(n===2){if(J.delta(Me).normalize(),pe.delta(xi).normalize(),Me.dot(xi)<0){let i=pe.start;pe.start=pe.end,pe.end=i}const o=0,r=Gs.subVectors(J.end,J.start).dot(Me),l=Gs.subVectors(pe.start,J.start).dot(Me),c=Gs.subVectors(pe.end,J.start).dot(Me),h=r<=l,d=c<=o;return h||d?null:(u.at(Math.max(o,l)/J.distance(),t.start),u.at(Math.min(r,c)/J.distance(),t.end),t)}return null}const wc=1e-16,yi=new S,wi=new S,vi=new S;function vc(u,e,t){u.delta(yi),wi.subVectors(e.start,u.start),vi.subVectors(e.end,u.start);const n=yi.length();let s=wi.length()/n,o=vi.length()/n;return s=Math.min(Math.max(s,0),1),o=Math.min(Math.max(o,0),1),Math.abs(s-o)<=wc?!1:(t.push(new Float32Array([s,o])),!0)}const Ti=1e-6,Ie=new Li,et=new z;function*Tc(u,e=30){const t=[],n=u.geometry,s=n.index,o=n.attributes.position,r=s?s.count:o;let l=performance.now();for(let c=0;c<r;c+=3){let h=c+0,d=c+1,i=c+2;s&&(h=s.getX(h),d=s.getX(d),i=s.getX(i));const{a,b:f,c:g}=Ie;a.fromBufferAttribute(o,h),f.fromBufferAttribute(o,d),g.fromBufferAttribute(o,i),Ie.needsUpdate=!0,Ie.update(),u.shapecast({intersectsBounds:p=>p.intersectsTriangle(Ie),intersectsTriangle:p=>{if(Ie.equals(p)||(p.needsUpdate&&p.update(),Math.abs(Ie.plane.normal.dot(p.plane.normal))>1-1e-6))return!1;Ie.intersectsTriangle(p,et,!0)&&!an(Ie,et)&&!an(p,et)&&(et.start.y+=Ti,et.end.y+=Ti,t.push(et.clone()))}}),performance.now()-l>e&&(yield,l=performance.now())}return t}const Ec=1e-10,bc=new S(0,1,0),$t=new z,Ei=new ao,bi=new S,Si=new z;class Sc{constructor(){this.edges=[]}getLineGeometry(e=0){const t=this.edges,n=new Float32Array(t.length*6);let s=0;for(let l=0,c=t.length;l<c;l++){const h=t[l];n[s++]=h[0],n[s++]=e,n[s++]=h[2],n[s++]=h[3],n[s++]=e,n[s++]=h[5]}const o=new ps,r=new K(n,3,!0);return o.setAttribute("position",r),o}}class Mc{constructor(){this.sortEdges=!0,this.iterationTime=30,this.angleThreshold=50,this.includeIntersectionEdges=!0}generateAsync(e,t={}){return new Promise((n,s)=>{const{signal:o}=t,r=this.generate(e,t);l();function l(){if(o&&o.aborted){s(new Error("ProjectionGenerator: Process aborted via AbortSignal."));return}const c=r.next();c.done?n(c.value):requestAnimationFrame(l)}})}*generate(e,t={}){const{onProgress:n}=t,{sortEdges:s,iterationTime:o,angleThreshold:r,includeIntersectionEdges:l}=this;e instanceof ps&&(e=new _r(e,{maxLeafTris:1}));const c=e.geometry;let h=gc(c,bc,r);if(l){const a=yield*Tc(e,o);h=h.concat(a)}s&&h.sort((a,f)=>Math.min(a.start.y,a.end.y)-Math.min(f.start.y,f.end.y)),yield;const d=new Sc;let i=performance.now();for(let a=0,f=h.length;a<f;a++){const g=h[a];if(dc(g))continue;const A=Math.min(g.start.y,g.end.y),p=Math.max(g.start.y,g.end.y),m=[];if(e.shapecast({intersectsBounds:x=>{x.min.y=Math.min(A-1e-6,x.min.y);const{origin:y,direction:w}=Ei;return y.copy(g.start),g.delta(w).normalize(),x.containsPoint(y)?!0:Ei.intersectBox(x,bi)?y.distanceToSquared(bi)<g.distanceSq():!1},intersectsTriangle:x=>{if(Math.max(x.a.y,x.b.y,x.c.y)<=A||gr(x)||an(x,g))return!1;const w=Math.min(x.a.y,x.b.y,x.c.y);if(p<w)$t.copy(g);else if(!_c(x,g,$t))return!1;if($t.distance()<Ec)return!1;if(yc($t,x,Si)&&vc(g,Si,m)&&mr(m),m.length!==0){const[v,T]=m[m.length-1];return v===0&&T===1}return!1}}),mc(g,m,d.edges),performance.now()-i>o){if(n){const x=a/h.length;n(x,d)}yield,i=performance.now()}}return d.getLineGeometry(0)}}const Ic=new Mc,Mi=.15;let tt,ss=0,ln=0;const Cc=()=>{tt=void 0,ss=0,ln=0};class Bc{constructor(e){this.props=e,this.stats=new St,this.scene=new is,this.renderer=new Ki({antialias:!0,alpha:!0,logarithmicDepthBuffer:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.css2dRenderer=new To,this.css3dRenderer=new So,this.mousePos=new N,this.mouseCoord=new N,this.offset=new N,this.size=new N,this.amr=new cl({showSizeBox:!0}),this.camera=new pn(45,window.innerWidth/window.innerHeight,.01,1e4),this._container=new he,this._raycaster=new lo,this._selected=[],this._pointerDownTimeout=0,this.lines=new at(new N(-108,0)),this._dragging=!1,this.maxSample=1024,this.sampleCount=0,this._usePathTracing=!1,this._fpsCache=[],this._fpsCacheMax=20,this._emitter=new ze,this.sound=new Lo,this._ground=new fe(new ji(100,100),new ds({color:new G("#aaa"),metalness:.6,roughness:.3})),this.addEventListener=this._emitter.on.bind(this._emitter),this.removeEventListener=this._emitter.on.bind(this._emitter),this._drag=n=>{this._dragging=!0,this._pointermove(n)},this._dragend=n=>{this._dragging=!1},this._pointermove=n=>{if(this._pointerDownTimeout)return clearTimeout(this._pointerDownTimeout),this._pointerDownTimeout=0;const{top:s,left:o}=this.renderer.domElement.getBoundingClientRect();this.offset.set(o,s),this.mousePos.set(n.clientX-o,n.clientY-s),this.mouseCoord.set((n.clientX-o)/this.size.x*2-1,-((n.clientY-s)/this.size.y)*2+1),this._raycaster.setFromCamera(this.mouseCoord,this.camera)},this._pointerdown=n=>{const s=()=>{let o=[...this._outlinePass.selectedObjects];this._outlinePass.selectedObjects=[],this.amr.slots.forEach(c=>c.selected=!1);const l=this._raycaster.intersectObjects(this.amr.slots,!0)[0];l&&this.amr.slots.forEach(c=>{c.traverse(h=>{h==l.object?o!=null&&o.includes(c)?(o=void 0,c.deviceSelected=!1):(this._outlinePass.selectedObjects=[c],c.deviceSelected=!0):c.deviceSelected=!1})}),this._pointerDownTimeout=0};this._pointerDownTimeout=window.setTimeout(s,200)},this._detectTrackpad=()=>{tt||typeof tt<"u"||(ss===0&&(ln=performance.now()),ss++,performance.now()-ln>66&&(ss>5?tt=!0:tt=!1,tt?this.controls.zoomSpeed=.2:this.controls.zoomSpeed=1,setTimeout(Cc,2e3)))},this.fit=()=>{new Q().setFromObject(this._container);const s=this.amr.sizeBox.size.getSize(new S),o=s.clone().multiplyScalar(.5),r=Math.max(s.x,s.y,s.z)+2,l=Math.min(s.x,s.y,s.z)+1,h=this.camera.position.clone().normalize().multiplyScalar(r);h.setY(o.y*1.6),this._fitAnimation=new mn(this.camera.position).to(h,600).easing(bt.Easing.Quintic.InOut).onStart(()=>{this.controls.enabled=!1}).onComplete(()=>{this.controls.enabled=!0}).start(),this.controls.minDistance=l,this.controls.maxDistance=r*2.5,!o.equals(new S)&&(o.setZ(0),this.controls.target.setY(o.y))},this.resize=()=>{var c;const n=this.renderer.domElement.parentElement;if(!n)return;n.style.display="flex",this.renderer.domElement.style.width="100%",this.renderer.domElement.style.height="100%",this.renderer.domElement.style.flexGrow="1";const s=n.clientWidth,o=n.clientHeight;this.size.set(s,o),this.camera.aspect=s/o,this.camera.updateProjectionMatrix(),this.css2dRenderer.setSize(s,o),this.css3dRenderer.setSize(s,o);const r=this.renderer.getPixelRatio();(c=this.pathTracer)==null||c.updateCamera(),this.sampleCount=0,this.renderer.setSize(s,o),this._composer.setSize(s,o),this._composer.passes.forEach(h=>h.setSize(s,o));const l=this._fxaaPass.material.uniforms;l.resolution.value.x=1/(s*r),l.resolution.value.y=1/(o*r)},this.ticker=()=>{this.stats.begin();const n=this.stats.fps();this.usePathTracing||(this._fpsCache.length>this._fpsCacheMax&&this._fpsCache.shift(),this._fpsCache.push(n)),this.renderer.domElement.dispatchEvent(new CustomEvent("ticker")),requestAnimationFrame(this.ticker),this.renderer.clear(),this.usePathTracing?(this.sampleCount<this.maxSample?(this.pathTracer.pausePathTracing=!1,this.sampleCount++):this.pathTracer.pausePathTracing=!0,this.pathTracer.renderSample(),n>20&&(this.pathTracer.renderSample(),this.sampleCount++,n>30&&(this.pathTracer.renderSample(),this.sampleCount++))):(this.amr.slots.forEach(s=>{this._dragging?s.getCanInstall()&&s.render(this):s.render(this)}),bt.update(),this.controls.update(),this.css3dRenderer.render(this.scene,this.camera),this.css2dRenderer.render(this.scene,this.camera),this.updatePosition(),this._composer.render()),this.stats.end()},this.stats.showPanel(0),this.hideState(),this._ground.visible=!1,this.controls=new xr(this.camera,this.renderer.domElement),this.controls.enablePan=!1,this.controls.rotateSpeed=.5,this.controls.dampingFactor=Mi,this.controls.enableDamping=!0,this.controls.maxDistance=5,this.controls.minDistance=1,this.controls.zoomSpeed=Bo()?.2:1,this.renderer.setPixelRatio(window.devicePixelRatio||1),this.renderer.autoClear=!0,this.renderer.toneMapping=Pi,this.renderer.toneMappingExposure=1.2,this.renderer.outputColorSpace=ee,this.renderer.localClippingEnabled=!0,this.css2dRenderer.domElement.style.pointerEvents="none",this.css2dRenderer.domElement.style.position="absolute",this.css2dRenderer.domElement.style.top="0px",this.css3dRenderer.domElement.style.pointerEvents="none",this.css3dRenderer.domElement.style.position="absolute",this.css3dRenderer.domElement.style.top="0px",Ln.tonemapping_pars_fragment=Ln.tonemapping_pars_fragment.replace("vec3 CustomToneMapping( vec3 color ) { return color; }",`
|
|
603
|
+
float startCompression = 0.8;
|
|
604
|
+
float desaturation = 0.5;
|
|
605
|
+
vec3 CustomToneMapping( vec3 color ) {
|
|
606
|
+
color *= toneMappingExposure;
|
|
607
|
+
|
|
608
|
+
float d = 1. - startCompression;
|
|
609
|
+
|
|
610
|
+
float peak = max(color.r, max(color.g, color.b));
|
|
611
|
+
if (peak < startCompression) return color;
|
|
612
|
+
|
|
613
|
+
float newPeak = 1. - d * d / (peak + d - startCompression);
|
|
614
|
+
float invPeak = 1. / peak;
|
|
615
|
+
|
|
616
|
+
float extraBrightness = dot(color * (1. - startCompression * invPeak), vec3(1, 1, 1));
|
|
617
|
+
|
|
618
|
+
color *= newPeak * invPeak;
|
|
619
|
+
float g = 1. - 3. / (desaturation * extraBrightness + 3.);
|
|
620
|
+
return mix(color, vec3(1, 1, 1), g);
|
|
621
|
+
}`),this.camera.position.set(10,6,-10),this.camera.lookAt(new S);const{tiles:t}=Do();this.pathTracer=new yr(this.renderer),this.pathTracer.filterGlossyFactor=.6,this.pathTracer.renderScale=window.devicePixelRatio,this.pathTracer.bounces=10,this.pathTracer.transmissiveBounces=8,this.pathTracer.tiles.set(t,t),this.pathTracer.fadeDuration=0,this.pathTracer.setBVHWorker(new hc),this.controls.addEventListener("change",()=>{var n;this.sampleCount=0,(n=this.pathTracer)==null||n.updateCamera()}),this._composer=new vo(this.renderer),this._composer.setPixelRatio(window.devicePixelRatio),this._composer.addPass(new Ao(this.scene,this.camera)),this._composer.addPass(new yo),this._outlinePass=new me(new N(window.innerWidth,window.innerHeight),this.scene,this.camera),this._outlinePass.visibleEdgeColor.set(26367),this._outlinePass.edgeThickness=.5,this._outlinePass.hiddenEdgeColor.set(26367),this._outlinePass.edgeStrength=3,this._outlinePass.edgeGlow=0,this._composer.addPass(this._outlinePass),this._outlinePassError=new me(new N(window.innerWidth,window.innerHeight),this.scene,this.camera),this._outlinePassError.visibleEdgeColor.set(16711680),this._outlinePassError.edgeThickness=.5,this._outlinePassError.hiddenEdgeColor.set(16711680),this._outlinePassError.edgeStrength=3,this._outlinePassError.edgeGlow=0,this._composer.addPass(this._outlinePassError),this._composer.renderTarget1.texture.colorSpace=ee,this._composer.renderTarget2.texture.colorSpace=ee,this._fxaaPass=new Xi(_o),this._composer.addPass(this._fxaaPass),this._container.add(this.amr),this.scene.add(this._container),this.ticker(),this._loadEnv(),this._initEvents(),this._ground.rotateX(-Math.PI/2),this.scene.add(this._ground)}get usePathTracing(){return this._usePathTracing}set usePathTracing(e){e?(this.amr&&(this.amr.bodyOpacity=1),this.amr.slots.forEach(t=>t.hide()),this.lines.hide(),this.css3dRenderer.domElement.style.display="none",this.amr.sizeBox.hide(),this.pathTracer.renderToCanvas=!0):(this.amr.sizeBox.show(),this.amr.slots.forEach(t=>t.show()),this.lines.show(),this.css3dRenderer.domElement.style.display="block",this.amr&&this.amr.opacityCache!==void 0?(this.amr.bodyOpacity=this.amr.opacityCache,this.amr.opacityCache=void 0):this.amr&&(this.amr.bodyOpacity=1),this.pathTracer.reset(),this._ground.visible=!1,this.scene.background=null),this._usePathTracing=e,this.controls.dampingFactor=e?1:Mi,this.sampleCount=0}get fpsAverage(){return Co(this._fpsCache)}showState(){this.stats.dom.style.display="block"}hideState(){this.stats.dom.style.display="none"}_loadEnv(){new fo(new co).load(wr,t=>{t.mapping=uo,t.minFilter=Ct,t.magFilter=Ct,t.colorSpace=ee,t.needsUpdate=!0,this._usePathTracing||(this.scene.environment=t,this.scene.environmentIntensity=1),this.pathTracer.updateEnvironment()},()=>{},()=>{})}_initEvents(){window.addEventListener("drag",this._drag),window.addEventListener("dragend",this._dragend),document.addEventListener("wheel",this._detectTrackpad),window.addEventListener("pointermove",this._pointermove),this.renderer.domElement.addEventListener("pointerdown",this._pointerdown)}async generateBVH(){this._ground.visible=!0,this.scene.background=new G("#000"),this.amr.slots.forEach(e=>e.hide()),this.css3dRenderer.domElement.style.display="none",this.lines.hide(),this.amr&&(this.amr.opacityCache=this.amr.bodyOpacity,this.amr.bodyOpacity=1),this.pathTracer.setScene(this.scene,this.camera),this.usePathTracing=!0}download(){return this.renderer.domElement.toDataURL("image/png")}clearAMR(){this.amr.clean(),this.usePathTracing=!1,this.lines.clear()}async exportAMR(){const e=this._container.clone(!0);return e.traverse(t=>{t.dispose&&(t.dispose(),t.removeFromParent())}),await Va.parseAsync(e,{onlyVisible:!0,binary:!0})}async addAMR(e){this.amr.init(this),await this.amr.load(e)}generateEdges(){this._container.traverse(e=>{if(e instanceof fe){const t=e.geometry.clone(),n=Ic.generate(t);let s=n.next();for(;!s.done;)s=n.next();const o=new dn(s.value,new hn({color:3355443}));o.position.z=-1.4,this.add(o),t.dispose()}})}select(e){typeof e=="string"||(Array.isArray(e)?this._outlinePass.selectedObjects=[...e]:this._outlinePass.selectedObjects=[e])}appendTo(e){e.append(this.renderer.domElement),e.append(this.stats.dom),e.append(this.lines),e.append(this.css2dRenderer.domElement),e.append(this.css3dRenderer.domElement),this.stats.dom.style.bottom="0",this.stats.dom.style.top="auto",this.resize(),this._resizeObserver=new ResizeObserver(this.resize),this._resizeObserver.observe(e)}add(e){this._container.add(e)}updatePosition(){this.lines.forceUpdate()}destroy(){var t,n;this.amr.destroy(),bt.removeAll(),this.stats.dom.remove(),this._emitter.removeAllListeners(),(t=this._fitAnimation)==null||t.stop(),window.removeEventListener("drag",this._drag),document.removeEventListener("wheel",this._detectTrackpad),window.removeEventListener("pointermove",this._pointermove),this.renderer.domElement.removeEventListener("pointerdown",this._pointerdown);const e=this.renderer.domElement.parentElement;e&&((n=this._resizeObserver)==null||n.unobserve(e)),this.controls.dispose(),this.renderer.dispose(),this._composer.dispose(),this.scene.traverse(s=>{var o;s instanceof fe?(s.geometry.dispose(),Array.isArray(s.material)?s.material.forEach(r=>r.dispose()):s.material&&s.material.dispose()):s instanceof qs?s.dispose():(o=s.dispose)==null||o.call(s),s.removeFromParent()})}}const Rc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAIrSURBVHic7dWhEcQwAAPBJEW4//bsJvzwg446YLcCkRvdc8598RljjNMTeHlOD4AvEwgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUAQCASBQBAIBIFAEAgEgUC499779Aj+1lqnJ/DiQSAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIAgEgkAgCASCQCAIBIJAIPwAhCgMRcz+Nz0AAAAASUVORK5CYII=",Lc=""+new URL("bg-circle-d8WfpvaX.png",import.meta.url).href,Pc=""+new URL("img-radar-kufDNNXQ.png",import.meta.url).href,Dc=""+new URL("img-radar2-1cPZO_cj.png",import.meta.url).href,Ii=""+new URL("SFL-CDD14-9UY62fbR.glb",import.meta.url).href;var Nc=Object.defineProperty,Oc=Object.getOwnPropertyDescriptor,W=(u,e,t,n)=>{for(var s=n>1?void 0:n?Oc(e,t):e,o=u.length-1,r;o>=0;o--)(r=u[o])&&(s=(n?r(e,t,s):r(s))||s);return n&&s&&Nc(e,t,s),s};let H=class extends us{constructor(){super(),this.scene=new Bc({useSound:!0}),this.test="",this.count=4,this.usePathTracing=!1,this.shelfLevel=5,this.shapeKeys=new Map,this.fit=this.scene.fit.bind(this.scene),this.generateBVH=()=>{this.usePathTracing=!0,this.scene.generateBVH().then()},this.download=this.scene.download.bind(this.scene),this.clearAMR=this.scene.clearAMR.bind(this.scene),this.exportAMR=async()=>{const e=await this.scene.exportAMR();e&&Io(new Blob([e]),"ttt.glb")},this.addAMR=()=>{this.scene.addAMR(Ii).then(this.scene.fit.bind(this.scene)).then(()=>{this.shapeKeys=this.scene.amr.shapeKeys,console.log(this.scene.amr.shapeKeys)})},this.generateEdges=()=>{this.scene.generateEdges()},this.setShapeKey=(e,t)=>{this.scene.amr.setShapeKey(e,t)},this.cancel=()=>{this.usePathTracing=!1,this.scene.usePathTracing=!1},this.changeShelfLevel=e=>{const t=parseInt(e.target.value);t&&(this.shelfLevel=t,this.scene.amr.generateShelfLevel(this.shelfLevel))},this.changeAmrHeight=e=>{const t=parseFloat(e.target.value);t&&(this.scene.amr.setShapeKey("height",t),this.scene.amr.setForkHeight(t-1),this.scene.fit())},this.changeAmrLevel=e=>{const t=parseFloat(e.target.value);t&&(this.scene.amr.setLevel(t),this.changeGoodsSize(void 0))},this.changeGoodsSize=e=>{const t=parseFloat(this.sizeLength.value||"0"),n=parseFloat(this.sizeWidth.value||"0"),s=parseFloat(this.sizeHeight.value||"0");this.scene.amr.setGoodsSize({length:t,width:n,height:s})},this.dragstart=e=>{var l,c,h;const t=(l=e.target)==null?void 0:l.getAttribute("data-id");let n="https://cdn2-1304552240.cos.ap-shanghai.myqcloud.com/rp/devices/Livox-Mid-70.sglb",s="";t==="2"&&(n="https://cdn2-1304552240.cos.ap-shanghai.myqcloud.com/rp/devices/UB250-F77-E0-V31.sglb"),(c=this.drag)==null||c.classList.add("dragging");const o=e.target.getAttribute("data-id"),r=JSON.stringify({id:o,name:"",url:n,bracketUrl:s});(h=e.dataTransfer)==null||h.setData("application/json",r),this.scene.amr.slots.forEach((d,i)=>d.canInstall(Math.random()>.5)),this.scene.amr.bodyOpacity=.2},this.dragend=e=>{var t;(t=this.drag)==null||t.classList.remove("dragging"),this.scene.amr.slots.forEach(n=>n.canInstall(!1))},this.getShapeKeyValue=e=>{const t=this.shapeKeys.get(e).toFixed(3);return t.endsWith(".000")?t.replace(".000",""):t};const u=document.createElement("style");document.head.append(u),this.scene.renderer.domElement.addEventListener("ticker",()=>{const e=this.scene.sampleCount/this.scene.maxSample;this.progressBar&&(this.progressBar.style.width=e*100+"%")})}firstUpdated(u){var e;super.firstUpdated(u),this.container&&(this.scene.appendTo(this.container),this.scene.addAMR(Ii).then(this.scene.fit.bind(this.scene)).then(()=>{this.shapeKeys=this.scene.amr.shapeKeys,console.log(this.shapeKeys),this.scene.amr.slots.forEach(t=>{})}),this.scene.lines.setOffset(10,0),this.scene.lines.setHeightOffset(200),setTimeout(()=>{this.changeGoodsSize(void 0)},300),(e=this.lineCircles)==null||e.forEach(t=>{t.parentElement.addEventListener("pointerenter",n=>{const s=t.parentElement.innerText;this.scene.lines.getLineByName(s).forEach(r=>r.highlight=!0)}),t.parentElement.addEventListener("pointerleave",n=>{const s=t.parentElement.innerText;this.scene.lines.getLineByName(s).forEach(r=>r.highlight=!1)})}),this.lineCircles&&this.lineCircles.length&&this.lineWrapper&&this.lineWrapper)}updated(u){super.updated(u)}disconnectedCallback(){super.disconnectedCallback(),this.scene.destroy()}render(){return st`
|
|
622
|
+
<div class="container">
|
|
623
|
+
<div class="progress-bar"></div>
|
|
624
|
+
<div class="actions">
|
|
625
|
+
<button @click=${this.fit}>聚焦</button>
|
|
626
|
+
${this.usePathTracing?st`
|
|
627
|
+
<button @click=${this.cancel}>取消渲染</button>`:st`
|
|
628
|
+
<button @click=${this.generateBVH}>渲染</button>`}
|
|
629
|
+
<button @click=${this.download}>Download</button>
|
|
630
|
+
<button @click=${this.clearAMR}>CLEAR</button>
|
|
631
|
+
<button @click=${this.addAMR}>ADD</button>
|
|
632
|
+
<button @click=${this.exportAMR}>EXPORT</button>
|
|
633
|
+
<button @click=${this.generateEdges}>Generate Edges</button>
|
|
634
|
+
<div class="amr-actions">
|
|
635
|
+
<label>滚筒层数:</label>
|
|
636
|
+
<input value="1" @change=${this.changeAmrLevel}>
|
|
637
|
+
<div>
|
|
638
|
+
<label>货物尺寸:</label>
|
|
639
|
+
<input value="0.6" id="sizeLength" @change=${this.changeGoodsSize}>
|
|
640
|
+
<input value="0.9" id="sizeWidth" @change=${this.changeGoodsSize}>
|
|
641
|
+
<input value="0.35" id="sizeHeight" @change=${this.changeGoodsSize}>
|
|
642
|
+
</div>
|
|
643
|
+
</div>
|
|
644
|
+
${[...this.shapeKeys.keys()].map(u=>st`
|
|
645
|
+
<div class="shape-key">
|
|
646
|
+
<label>${u}</label>
|
|
647
|
+
<input
|
|
648
|
+
value=${this.getShapeKeyValue(u)}
|
|
649
|
+
@change=${e=>this.setShapeKey(u,e.target.value)}>
|
|
650
|
+
</div>`)}
|
|
651
|
+
<div
|
|
652
|
+
class="drag"
|
|
653
|
+
@dragstart=${this.dragstart}
|
|
654
|
+
@dragend=${this.dragend}
|
|
655
|
+
draggable="true">
|
|
656
|
+
<img alt=""
|
|
657
|
+
data-id="1"
|
|
658
|
+
src=${Pc}>
|
|
659
|
+
</div>
|
|
660
|
+
<div
|
|
661
|
+
class="drag"
|
|
662
|
+
@dragstart=${this.dragstart}
|
|
663
|
+
@dragend=${this.dragend}
|
|
664
|
+
draggable="true">
|
|
665
|
+
<img alt=""
|
|
666
|
+
data-id="2"
|
|
667
|
+
src=${Dc}>
|
|
668
|
+
</div>
|
|
669
|
+
</div>
|
|
670
|
+
|
|
671
|
+
<!-- <div class="test">-->
|
|
672
|
+
<!-- <ul>-->
|
|
673
|
+
<!-- <li>功能1</li>-->
|
|
674
|
+
<!-- <li>功能2</li>-->
|
|
675
|
+
<!-- <li>功能3<i class="line-start"></i></li>-->
|
|
676
|
+
<!-- <li>功能4<i class="line-start"></i></li>-->
|
|
677
|
+
<!-- <li>功能5<i class="line-start"></i></li>-->
|
|
678
|
+
<!-- <li>功能6</li>-->
|
|
679
|
+
<!-- <li>功能7<i class="line-start"></i></li>-->
|
|
680
|
+
<!-- <li>功能8</li>-->
|
|
681
|
+
<!-- <li>功能9</li>-->
|
|
682
|
+
<!-- <li>功能10<i class="line-start"></i></li>-->
|
|
683
|
+
<!-- <li>功能11</li>-->
|
|
684
|
+
<!-- <li>功能12<i class="line-start"></i></li>-->
|
|
685
|
+
<!-- <li>功能13<i class="line-start"></i></li>-->
|
|
686
|
+
<!-- <li>功能14<i class="line-start"></i></li>-->
|
|
687
|
+
<!-- <li>功能15</li>-->
|
|
688
|
+
<!-- <li>功能16</li>-->
|
|
689
|
+
<!-- </ul>-->
|
|
690
|
+
<!-- </div>-->
|
|
691
|
+
</div>`}};H.styles=cs`
|
|
692
|
+
:root {
|
|
693
|
+
display:block;
|
|
694
|
+
width:100%;
|
|
695
|
+
height:100%;
|
|
696
|
+
}
|
|
697
|
+
.test {
|
|
698
|
+
position: absolute;
|
|
699
|
+
z-index: 1000;
|
|
700
|
+
left: 0;
|
|
701
|
+
top: 240px;
|
|
702
|
+
overflow-y: auto;
|
|
703
|
+
overflow-x: auto;
|
|
704
|
+
width: auto;
|
|
705
|
+
height: 300px;
|
|
706
|
+
}
|
|
707
|
+
li {
|
|
708
|
+
margin: 10px 0;
|
|
709
|
+
margin-right: 20px;
|
|
710
|
+
width: 100px;
|
|
711
|
+
line-height: 30px;
|
|
712
|
+
background: #ddd;
|
|
713
|
+
}
|
|
714
|
+
.pane-container {
|
|
715
|
+
position: absolute;
|
|
716
|
+
left: auto;
|
|
717
|
+
right: 0;
|
|
718
|
+
top: 0;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
.shape-key {
|
|
722
|
+
label {
|
|
723
|
+
font-size: 12px;
|
|
724
|
+
}
|
|
725
|
+
input {
|
|
726
|
+
width: 70px;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
.amr-actions {
|
|
731
|
+
margin-top: 10px;
|
|
732
|
+
margin-bottom: 10px;
|
|
733
|
+
font-size: 12px;
|
|
734
|
+
input {
|
|
735
|
+
width: 60px;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
.container {
|
|
740
|
+
overflow: hidden;
|
|
741
|
+
border: 0;
|
|
742
|
+
position: absolute;
|
|
743
|
+
left: 0;
|
|
744
|
+
top: 0;
|
|
745
|
+
width: 100%;
|
|
746
|
+
height: 100%;
|
|
747
|
+
transform: scale3d(1, 1, 1);
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
.drag{
|
|
751
|
+
width: 100px;
|
|
752
|
+
height: 100px;
|
|
753
|
+
}
|
|
754
|
+
.drag.dragging{
|
|
755
|
+
opacity: 0.4;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
.drag img {
|
|
759
|
+
width: 100%;
|
|
760
|
+
height: 100%;
|
|
761
|
+
object-fit: contain;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
canvas {
|
|
765
|
+
width: 100%;
|
|
766
|
+
height: 100%;
|
|
767
|
+
// background: url(${Sn(Rc)}) center repeat;
|
|
768
|
+
// background: linear-gradient(to bottom, #898996 0%, #454555 60%, #111125 100%);
|
|
769
|
+
// background: #F5F7FC url(${Sn(Lc)}) 0% 50% no-repeat;
|
|
770
|
+
background: #eaf7fd;
|
|
771
|
+
background-size: auto 100%;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
.actions {
|
|
775
|
+
position: absolute;
|
|
776
|
+
left: 0;
|
|
777
|
+
top: 0;
|
|
778
|
+
padding: 10px;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
button {
|
|
782
|
+
font-size: 12px;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
.progress-bar {
|
|
786
|
+
position: absolute;
|
|
787
|
+
left: 0;
|
|
788
|
+
height: 2px;
|
|
789
|
+
background: #f00;
|
|
790
|
+
transition: width 0.3s;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
li {
|
|
794
|
+
position: relative;
|
|
795
|
+
}
|
|
796
|
+
.line-start {
|
|
797
|
+
z-index: 100;
|
|
798
|
+
position: absolute;
|
|
799
|
+
left: 100%;
|
|
800
|
+
top: 50%;
|
|
801
|
+
width: 6px;
|
|
802
|
+
height: 6px;
|
|
803
|
+
margin-top: -3px;
|
|
804
|
+
margin-left: 4px;
|
|
805
|
+
border-radius: 50%;
|
|
806
|
+
background: red;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
.slot-item {
|
|
810
|
+
pointer-events: auto;
|
|
811
|
+
cursor: pointer;
|
|
812
|
+
font-size:12px;
|
|
813
|
+
color: #fff;
|
|
814
|
+
width:12px;
|
|
815
|
+
height:12px;
|
|
816
|
+
background: rgba(255,255,255,0);
|
|
817
|
+
border: 1px solid #fff;
|
|
818
|
+
border-radius: 50%;
|
|
819
|
+
transition: background .2s, width 0.14s, height 0.14s, border 0.14s;
|
|
820
|
+
|
|
821
|
+
&.disable {
|
|
822
|
+
cursor: not-allowed;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
&.hidden {
|
|
826
|
+
display: none;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
&.drag-over {
|
|
830
|
+
border-color: red;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
&.can-install {
|
|
834
|
+
position:relative;
|
|
835
|
+
width:34px;
|
|
836
|
+
height:34px;
|
|
837
|
+
background:rgba(0,102,255,0.1);
|
|
838
|
+
border-color: #0066FF;
|
|
839
|
+
// &:before {
|
|
840
|
+
// content: "";
|
|
841
|
+
// position: absolute;
|
|
842
|
+
// left: 50%;
|
|
843
|
+
// top: 50%;
|
|
844
|
+
// width:3px;
|
|
845
|
+
// height:3px;
|
|
846
|
+
// transform: translate3d(-50%,-50%,0);
|
|
847
|
+
// border-radius: 50%;
|
|
848
|
+
// background: #00FF95;
|
|
849
|
+
// }
|
|
850
|
+
}
|
|
851
|
+
&.filled {
|
|
852
|
+
border-color: #00FF95;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
&.selected {
|
|
856
|
+
border-width: 4px;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
&.has-error {
|
|
860
|
+
border-color: #ff0000;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
&:hover {
|
|
864
|
+
background: rgba(255,255,255,0.5);
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
&:hover:after {
|
|
868
|
+
pointer-events: auto;
|
|
869
|
+
transition: all .2s ease-in-out;
|
|
870
|
+
opacity: 1;
|
|
871
|
+
transform: translate3d(-50%,-4px,0);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
&:after {
|
|
875
|
+
pointer-events: none;
|
|
876
|
+
content: attr(data-name);
|
|
877
|
+
transition: all .2s 0.3s;
|
|
878
|
+
opacity: 0;
|
|
879
|
+
position:absolute;
|
|
880
|
+
left: 50%;
|
|
881
|
+
bottom: 100%;
|
|
882
|
+
transform: translate3d(-50%,5px,0);
|
|
883
|
+
white-space: nowrap;
|
|
884
|
+
font-size: 12px;
|
|
885
|
+
color: #000;
|
|
886
|
+
padding: 2px 8px;
|
|
887
|
+
border-radius: 2px;
|
|
888
|
+
background: #fff;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
`;W([Ne(".container")],H.prototype,"container",2);W([Ne("#drag")],H.prototype,"drag",2);W([le()],H.prototype,"test",2);W([le()],H.prototype,"count",2);W([le()],H.prototype,"theme",2);W([le()],H.prototype,"onChange",2);W([Ue()],H.prototype,"usePathTracing",2);W([Ue()],H.prototype,"shelfLevel",2);W([Ue()],H.prototype,"shapeKeys",2);W([Ne(".progress-bar")],H.prototype,"progressBar",2);W([mo("li .line-start")],H.prototype,"lineCircles",2);W([Ne(".test")],H.prototype,"lineWrapper",2);W([Ne("#sizeLength")],H.prototype,"sizeLength",2);W([Ne("#sizeWidth")],H.prototype,"sizeWidth",2);W([Ne("#sizeHeight")],H.prototype,"sizeHeight",2);H=W([fs("device-viewer")],H);const ru={title:"Shop/DeviceViewer",tags:["autodocs"],render:u=>{const e=new H;return e.test=u.test,e.count=u.count,e.onChange=u.onChange,e.addEventListener("ticker",()=>{console.log("tttt")}),e},argTypes:{test:{control:"text",description:"test"},count:{control:"number"},onChange:{control:"function",description:"选择回调",value:()=>{}}}},es={args:{test:"test",count:4}};var Ci,Bi,Ri;es.parameters={...es.parameters,docs:{...(Ci=es.parameters)==null?void 0:Ci.docs,source:{originalSource:`{
|
|
892
|
+
args: {
|
|
893
|
+
test: 'test',
|
|
894
|
+
count: 4
|
|
895
|
+
}
|
|
896
|
+
}`,...(Ri=(Bi=es.parameters)==null?void 0:Bi.docs)==null?void 0:Ri.source}}};const ou=["Primary"];export{es as Primary,ou as __namedExportsOrder,ru as default};
|