From f777b162c2820fb1392e6fa0a34c8bfba6bed990 Mon Sep 17 00:00:00 2001 From: wgf <1501723119@qq.com> Date: Fri, 27 Mar 2026 09:02:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 88 ---- CampusMap.vue | 277 ----------- HelloWorld.vue | 624 ------------------------ OOOMAP_RESOURCES.md | 101 ++++ favicon.ico | Bin 4286 -> 0 bytes index.html | 17 - logo.png | Bin 6849 -> 0 bytes main.js | 4 - package-lock.json | 84 ++-- public/js/ooomap.xcx.min.js | 7 + src/assets/gongren.jpeg | Bin 0 -> 19884 bytes src/components/CampusMap.vue | 892 +++++++++++++++++++++++++--------- src/components/HelloWorld.vue | 842 ++++++++++++++++++++++++++------ 13 files changed, 1522 insertions(+), 1414 deletions(-) delete mode 100644 App.vue delete mode 100644 CampusMap.vue delete mode 100644 HelloWorld.vue create mode 100644 OOOMAP_RESOURCES.md delete mode 100644 favicon.ico delete mode 100644 index.html delete mode 100644 logo.png delete mode 100644 main.js create mode 100644 public/js/ooomap.xcx.min.js create mode 100644 src/assets/gongren.jpeg diff --git a/App.vue b/App.vue deleted file mode 100644 index 55e9881..0000000 --- a/App.vue +++ /dev/null @@ -1,88 +0,0 @@ - - - - - diff --git a/CampusMap.vue b/CampusMap.vue deleted file mode 100644 index a827a14..0000000 --- a/CampusMap.vue +++ /dev/null @@ -1,277 +0,0 @@ - - - - - \ No newline at end of file diff --git a/HelloWorld.vue b/HelloWorld.vue deleted file mode 100644 index 4eff0e2..0000000 --- a/HelloWorld.vue +++ /dev/null @@ -1,624 +0,0 @@ - - - - - diff --git a/OOOMAP_RESOURCES.md b/OOOMAP_RESOURCES.md new file mode 100644 index 0000000..c6dfe3f --- /dev/null +++ b/OOOMAP_RESOURCES.md @@ -0,0 +1,101 @@ +# ooomap 资源文件说明 + +## 所需资源文件 + +本项目使用 ooomap 3D地图库,需要以下资源文件才能正常运行: + +### 1. ooomap 主库文件 +- **位置**: `public/lib/ooomap.min.js` +- **说明**: ooomap 核心库文件 +- **获取方式**: + - 从 ooomap 官方网站下载: https://www.ooomap.com + - 或从您的 ooomap 项目中复制 + +### 2. ooomap 日志文件 +- **位置**: `public/js/ooomapLog.js` +- **说明**: ooomap 日志记录脚本 +- **获取方式**: + - 从 ooomap 官方网站下载 + - 或从您的 ooomap 项目中复制 + +### 3. 医院模型文件 +- **位置**: `public/models/hospital/glb/` +- **说明**: 医院建筑的3D模型文件(GLB格式) +- **获取方式**: + - 从 ooomap 编辑器导出 + - 或从您的 ooomap 项目中复制 + +### 4. 模型数据配置文件 +- **位置**: `public/models/hospital/modelsData.json` +- **说明**: 模型数据的配置文件 +- **获取方式**: + - 从 ooomap 编辑器导出 + - 或从您的 ooomap 项目中复制 + +## 目录结构 + +``` +public/ +├── lib/ +│ └── ooomap.min.js # ooomap 核心库 +├── js/ +│ └── ooomapLog.js # ooomap 日志脚本 +├── models/ +│ └── hospital/ +│ ├── glb/ # 3D模型文件目录 +│ │ ├── floor1.glb +│ │ ├── floor2.glb +│ │ └── ... +│ └── modelsData.json # 模型数据配置 +├── favicon.ico +├── index.html +└── zhenggui.png +``` + +## 如何获取资源文件 + +### 方法1: 从 ooomap 官方获取 +1. 访问 ooomap 官方网站: https://www.ooomap.com +2. 注册并登录账户 +3. 创建或打开一个项目 +4. 导出所需的资源文件 + +### 方法2: 从现有项目复制 +如果您已经有使用 ooomap 的项目,可以直接从该项目中复制所需的资源文件。 + +### 方法3: 使用 CDN(如果可用) +某些 ooomap 资源可能通过 CDN 提供,您可以修改组件代码使用 CDN 链接。 + +## 注意事项 + +1. **文件路径**: 确保所有文件的路径与代码中的引用路径一致 +2. **文件大小**: 3D模型文件可能较大,请确保有足够的存储空间 +3. **跨域问题**: 如果从外部服务器加载资源,可能需要配置 CORS +4. **版本兼容**: 确保使用的 ooomap 库版本与模型文件兼容 + +## 故障排除 + +### 问题: "ooomap主库加载失败" +**解决方案**: +- 检查 `public/lib/ooomap.min.js` 文件是否存在 +- 确认文件路径正确 +- 检查文件是否损坏 + +### 问题: "模型加载失败" +**解决方案**: +- 检查 `public/models/hospital/glb/` 目录中的模型文件 +- 确认 `modelsData.json` 配置文件存在且格式正确 +- 检查模型文件路径是否与配置文件中的路径一致 + +### 问题: 地图显示空白 +**解决方案**: +- 检查浏览器控制台是否有错误信息 +- 确认所有必需的资源文件都已正确加载 +- 检查网络请求是否成功 + +## 联系支持 + +如果您在获取或配置资源文件时遇到问题,可以: +- 访问 ooomap 官方文档: https://www.ooomap.com/docs +- 联系 ooomap 技术支持 +- 查看项目 GitHub 仓库的 Issues diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index df36fcfb72584e00488330b560ebcf34a41c64c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4286 zcmds*O-Phc6o&64GDVCEQHxsW(p4>LW*W<827=Unuo8sGpRux(DN@jWP-e29Wl%wj zY84_aq9}^Am9-cWTD5GGEo#+5Fi2wX_P*bo+xO!)p*7B;iKlbFd(U~_d(U?#hLj56 zPhFkj-|A6~Qk#@g^#D^U0XT1cu=c-vu1+SElX9NR;kzAUV(q0|dl0|%h|dI$%VICy zJnu2^L*Te9JrJMGh%-P79CL0}dq92RGU6gI{v2~|)p}sG5x0U*z<8U;Ij*hB9z?ei z@g6Xq-pDoPl=MANPiR7%172VA%r)kevtV-_5H*QJKFmd;8yA$98zCxBZYXTNZ#QFk2(TX0;Y2dt&WitL#$96|gJY=3xX zpCoi|YNzgO3R`f@IiEeSmKrPSf#h#Qd<$%Ej^RIeeYfsxhPMOG`S`Pz8q``=511zm zAm)MX5AV^5xIWPyEu7u>qYs?pn$I4nL9J!=K=SGlKLXpE<5x+2cDTXq?brj?n6sp= zphe9;_JHf40^9~}9i08r{XM$7HB!`{Ys~TK0kx<}ZQng`UPvH*11|q7&l9?@FQz;8 zx!=3<4seY*%=OlbCbcae?5^V_}*K>Uo6ZWV8mTyE^B=DKy7-sdLYkR5Z?paTgK-zyIkKjIcpyO z{+uIt&YSa_$QnN_@t~L014dyK(fOOo+W*MIxbA6Ndgr=Y!f#Tokqv}n<7-9qfHkc3 z=>a|HWqcX8fzQCT=dqVbogRq!-S>H%yA{1w#2Pn;=e>JiEj7Hl;zdt-2f+j2%DeVD zsW0Ab)ZK@0cIW%W7z}H{&~yGhn~D;aiP4=;m-HCo`BEI+Kd6 z={Xwx{TKxD#iCLfl2vQGDitKtN>z|-AdCN|$jTFDg0m3O`WLD4_s#$S diff --git a/index.html b/index.html deleted file mode 100644 index 3e5a139..0000000 --- a/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - <%= htmlWebpackPlugin.options.title %> - - - -
- - - diff --git a/logo.png b/logo.png deleted file mode 100644 index f3d2503fc2a44b5053b0837ebea6e87a2d339a43..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6849 zcmaKRcUV(fvo}bjDT-7nLI_nlK}sT_69H+`qzVWDA|yaU?}j417wLi^B1KB1SLsC& zL0ag7$U(XW5YR7p&Ux?sP$d4lvMt8C^+TcQu4F zQqv!UF!I+kw)c0jhd6+g6oCr9P?7)?!qX1ui*iL{p}sKCAGuJ{{W)0z1pLF|=>h}& zt(2Lr0Z`2ig8<5i%Zk}cO5Fm=LByqGWaS`oqChZdEFmc`0hSb#gg|Aap^{+WKOYcj zHjINK)KDG%&s?Mt4CL(T=?;~U@bU2x_mLKN!#GJuK_CzbNw5SMEJorG!}_5;?R>@1 zSl)jns3WlU7^J%=(hUtfmuUCU&C3%8B5C^f5>W2Cy8jW3#{Od{lF1}|?c61##3dzA zsPlFG;l_FzBK}8>|H_Ru_H#!_7$UH4UKo3lKOA}g1(R&|e@}GINYVzX?q=_WLZCgh z)L|eJMce`D0EIwgRaNETDsr+?vQknSGAi=7H00r`QnI%oQnFxm`G2umXso9l+8*&Q z7WqF|$p49js$mdzo^BXpH#gURy=UO;=IMrYc5?@+sR4y_?d*~0^YP7d+y0{}0)zBM zIKVM(DBvICK#~7N0a+PY6)7;u=dutmNqK3AlsrUU9U`d;msiucB_|8|2kY=(7XA;G zwDA8AR)VCA#JOkxm#6oHNS^YVuOU;8p$N)2{`;oF|rQ?B~K$%rHDxXs+_G zF5|-uqHZvSzq}L;5Kcy_P+x0${33}Ofb6+TX&=y;;PkEOpz%+_bCw_{<&~ zeLV|!bP%l1qxywfVr9Z9JI+++EO^x>ZuCK);=$VIG1`kxK8F2M8AdC$iOe3cj1fo(ce4l-9 z7*zKy3={MixvUk=enQE;ED~7tv%qh&3lR<0m??@w{ILF|e#QOyPkFYK!&Up7xWNtL zOW%1QMC<3o;G9_S1;NkPB6bqbCOjeztEc6TsBM<(q9((JKiH{01+Ud=uw9B@{;(JJ z-DxI2*{pMq`q1RQc;V8@gYAY44Z!%#W~M9pRxI(R?SJ7sy7em=Z5DbuDlr@*q|25V)($-f}9c#?D%dU^RS<(wz?{P zFFHtCab*!rl(~j@0(Nadvwg8q|4!}L^>d?0al6}Rrv9$0M#^&@zjbfJy_n!%mVHK4 z6pLRIQ^Uq~dnyy$`ay51Us6WaP%&O;@49m&{G3z7xV3dLtt1VTOMYl3UW~Rm{Eq4m zF?Zl_v;?7EFx1_+#WFUXxcK78IV)FO>42@cm@}2I%pVbZqQ}3;p;sDIm&knay03a^ zn$5}Q$G!@fTwD$e(x-~aWP0h+4NRz$KlnO_H2c< z(XX#lPuW_%H#Q+c&(nRyX1-IadKR-%$4FYC0fsCmL9ky3 zKpxyjd^JFR+vg2!=HWf}2Z?@Td`0EG`kU?{8zKrvtsm)|7>pPk9nu@2^z96aU2<#` z2QhvH5w&V;wER?mopu+nqu*n8p~(%QkwSs&*0eJwa zMXR05`OSFpfyRb!Y_+H@O%Y z0=K^y6B8Gcbl?SA)qMP3Z+=C(?8zL@=74R=EVnE?vY!1BQy2@q*RUgRx4yJ$k}MnL zs!?74QciNb-LcG*&o<9=DSL>1n}ZNd)w1z3-0Pd^4ED1{qd=9|!!N?xnXjM!EuylY z5=!H>&hSofh8V?Jofyd!h`xDI1fYAuV(sZwwN~{$a}MX^=+0TH*SFp$vyxmUv7C*W zv^3Gl0+eTFgBi3FVD;$nhcp)ka*4gSskYIqQ&+M}xP9yLAkWzBI^I%zR^l1e?bW_6 zIn{mo{dD=)9@V?s^fa55jh78rP*Ze<3`tRCN4*mpO$@7a^*2B*7N_|A(Ve2VB|)_o z$=#_=aBkhe(ifX}MLT()@5?OV+~7cXC3r!%{QJxriXo9I%*3q4KT4Xxzyd{ z9;_%=W%q!Vw$Z7F3lUnY+1HZ*lO;4;VR2+i4+D(m#01OYq|L_fbnT;KN<^dkkCwtd zF7n+O7KvAw8c`JUh6LmeIrk4`F3o|AagKSMK3))_5Cv~y2Bb2!Ibg9BO7Vkz?pAYX zoI=B}+$R22&IL`NCYUYjrdhwjnMx_v=-Qcx-jmtN>!Zqf|n1^SWrHy zK|MwJ?Z#^>)rfT5YSY{qjZ&`Fjd;^vv&gF-Yj6$9-Dy$<6zeP4s+78gS2|t%Z309b z0^fp~ue_}i`U9j!<|qF92_3oB09NqgAoehQ`)<)dSfKoJl_A6Ec#*Mx9Cpd-p#$Ez z={AM*r-bQs6*z$!*VA4|QE7bf@-4vb?Q+pPKLkY2{yKsw{&udv_2v8{Dbd zm~8VAv!G~s)`O3|Q6vFUV%8%+?ZSVUa(;fhPNg#vab@J*9XE4#D%)$UU-T5`fwjz! z6&gA^`OGu6aUk{l*h9eB?opVdrHK>Q@U>&JQ_2pR%}TyOXGq_6s56_`U(WoOaAb+K zXQr#6H}>a-GYs9^bGP2Y&hSP5gEtW+GVC4=wy0wQk=~%CSXj=GH6q z-T#s!BV`xZVxm{~jr_ezYRpqqIcXC=Oq`b{lu`Rt(IYr4B91hhVC?yg{ol4WUr3v9 zOAk2LG>CIECZ-WIs0$N}F#eoIUEtZudc7DPYIjzGqDLWk_A4#(LgacooD z2K4IWs@N`Bddm-{%oy}!k0^i6Yh)uJ1S*90>|bm3TOZxcV|ywHUb(+CeX-o1|LTZM zwU>dY3R&U)T(}5#Neh?-CWT~@{6Ke@sI)uSuzoah8COy)w)B)aslJmp`WUcjdia-0 zl2Y}&L~XfA`uYQboAJ1;J{XLhYjH){cObH3FDva+^8ioOQy%Z=xyjGLmWMrzfFoH; zEi3AG`_v+%)&lDJE;iJWJDI@-X9K5O)LD~j*PBe(wu+|%ar~C+LK1+-+lK=t# z+Xc+J7qp~5q=B~rD!x78)?1+KUIbYr^5rcl&tB-cTtj+e%{gpZZ4G~6r15+d|J(ky zjg@@UzMW0k9@S#W(1H{u;Nq(7llJbq;;4t$awM;l&(2s+$l!Ay9^Ge|34CVhr7|BG z?dAR83smef^frq9V(OH+a+ki#q&-7TkWfFM=5bsGbU(8mC;>QTCWL5ydz9s6k@?+V zcjiH`VI=59P-(-DWXZ~5DH>B^_H~;4$)KUhnmGo*G!Tq8^LjfUDO)lASN*=#AY_yS zqW9UX(VOCO&p@kHdUUgsBO0KhXxn1sprK5h8}+>IhX(nSXZKwlNsjk^M|RAaqmCZB zHBolOHYBas@&{PT=R+?d8pZu zUHfyucQ`(umXSW7o?HQ3H21M`ZJal+%*)SH1B1j6rxTlG3hx1IGJN^M7{$j(9V;MZ zRKybgVuxKo#XVM+?*yTy{W+XHaU5Jbt-UG33x{u(N-2wmw;zzPH&4DE103HV@ER86 z|FZEmQb|&1s5#`$4!Cm}&`^{(4V}OP$bk`}v6q6rm;P!H)W|2i^e{7lTk2W@jo_9q z*aw|U7#+g59Fv(5qI`#O-qPj#@_P>PC#I(GSp3DLv7x-dmYK=C7lPF8a)bxb=@)B1 zUZ`EqpXV2dR}B&r`uM}N(TS99ZT0UB%IN|0H%DcVO#T%L_chrgn#m6%x4KE*IMfjX zJ%4veCEqbXZ`H`F_+fELMC@wuy_ch%t*+Z+1I}wN#C+dRrf2X{1C8=yZ_%Pt6wL_~ zZ2NN-hXOT4P4n$QFO7yYHS-4wF1Xfr-meG9Pn;uK51?hfel`d38k{W)F*|gJLT2#T z<~>spMu4(mul-8Q3*pf=N4DcI)zzjqAgbE2eOT7~&f1W3VsdD44Ffe;3mJp-V@8UC z)|qnPc12o~$X-+U@L_lWqv-RtvB~%hLF($%Ew5w>^NR82qC_0FB z)=hP1-OEx?lLi#jnLzH}a;Nvr@JDO-zQWd}#k^an$Kwml;MrD&)sC5b`s0ZkVyPkb zt}-jOq^%_9>YZe7Y}PhW{a)c39G`kg(P4@kxjcYfgB4XOOcmezdUI7j-!gs7oAo2o zx(Ph{G+YZ`a%~kzK!HTAA5NXE-7vOFRr5oqY$rH>WI6SFvWmahFav!CfRMM3%8J&c z*p+%|-fNS_@QrFr(at!JY9jCg9F-%5{nb5Bo~z@Y9m&SHYV`49GAJjA5h~h4(G!Se zZmK{Bo7ivCfvl}@A-ptkFGcWXAzj3xfl{evi-OG(TaCn1FAHxRc{}B|x+Ua1D=I6M z!C^ZIvK6aS_c&(=OQDZfm>O`Nxsw{ta&yiYPA~@e#c%N>>#rq)k6Aru-qD4(D^v)y z*>Rs;YUbD1S8^D(ps6Jbj0K3wJw>L4m)0e(6Pee3Y?gy9i0^bZO?$*sv+xKV?WBlh zAp*;v6w!a8;A7sLB*g-^<$Z4L7|5jXxxP1}hQZ<55f9<^KJ>^mKlWSGaLcO0=$jem zWyZkRwe~u{{tU63DlCaS9$Y4CP4f?+wwa(&1ou)b>72ydrFvm`Rj-0`kBJgK@nd(*Eh!(NC{F-@=FnF&Y!q`7){YsLLHf0_B6aHc# z>WIuHTyJwIH{BJ4)2RtEauC7Yq7Cytc|S)4^*t8Va3HR zg=~sN^tp9re@w=GTx$;zOWMjcg-7X3Wk^N$n;&Kf1RgVG2}2L-(0o)54C509C&77i zrjSi{X*WV=%C17((N^6R4Ya*4#6s_L99RtQ>m(%#nQ#wrRC8Y%yxkH;d!MdY+Tw@r zjpSnK`;C-U{ATcgaxoEpP0Gf+tx);buOMlK=01D|J+ROu37qc*rD(w`#O=3*O*w9?biwNoq3WN1`&Wp8TvKj3C z3HR9ssH7a&Vr<6waJrU zdLg!ieYz%U^bmpn%;(V%%ugMk92&?_XX1K@mwnVSE6!&%P%Wdi7_h`CpScvspMx?N zQUR>oadnG17#hNc$pkTp+9lW+MBKHRZ~74XWUryd)4yd zj98$%XmIL4(9OnoeO5Fnyn&fpQ9b0h4e6EHHw*l68j;>(ya`g^S&y2{O8U>1*>4zR zq*WSI_2o$CHQ?x0!wl9bpx|Cm2+kFMR)oMud1%n2=qn5nE&t@Fgr#=Zv2?}wtEz^T z9rrj=?IH*qI5{G@Rn&}^Z{+TW}mQeb9=8b<_a`&Cm#n%n~ zU47MvCBsdXFB1+adOO)03+nczfWa#vwk#r{o{dF)QWya9v2nv43Zp3%Ps}($lA02*_g25t;|T{A5snSY?3A zrRQ~(Ygh_ebltHo1VCbJb*eOAr;4cnlXLvI>*$-#AVsGg6B1r7@;g^L zFlJ_th0vxO7;-opU@WAFe;<}?!2q?RBrFK5U{*ai@NLKZ^};Ul}beukveh?TQn;$%9=R+DX07m82gP$=}Uo_%&ngV`}Hyv8g{u z3SWzTGV|cwQuFIs7ZDOqO_fGf8Q`8MwL}eUp>q?4eqCmOTcwQuXtQckPy|4F1on8l zP*h>d+cH#XQf|+6c|S{7SF(Lg>bR~l(0uY?O{OEVlaxa5@e%T&xju=o1`=OD#qc16 zSvyH*my(dcp6~VqR;o(#@m44Lug@~_qw+HA=mS#Z^4reBy8iV?H~I;{LQWk3aKK8$bLRyt$g?-{if("constructor"!==i&&"prototype"!==i&&"name"!==i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n)}})}var i=function(t){Object.defineProperty(t,"style",{get(){return{width:this.width+"px",height:this.height+"px"}}}),Object.defineProperty(t,"clientHeight",{get(){return this.height/2}}),Object.defineProperty(t,"clientWidth",{get(){return this.width/2}}),Object.defineProperty(t,"offsetHeight",{get(){return this.height}}),Object.defineProperty(t,"offsetWidth",{get(){return this.width}})},n=new Map;class r{constructor(t){this.identifier=t.identifier,this.force=void 0===t.force?1:t.force,this.pageX=t.pageX||t.x,this.pageY=t.pageY||t.y,this.clientX=t.clientX||t.x,this.clientY=t.clientY||t.y,this.screenX=this.pageX,this.screenY=this.pageY}}class a{constructor(){n.set(this,{})}addEventListener(t,e,i={}){var r=n.get(this);r||(r={},n.set(this,r)),r[t]||(r[t]=[]),r[t].push(e),i.capture,i.once,i.passive}removeEventListener(t,e){const i=n.get(this);if(i){const n=i[t];if(n&&n.length>0)for(var r=n.length;r--;r>0)if(n[r]===e){n.splice(r,1);break}}}dispatchEvent(t={}){"function"!=typeof t.preventDefault&&(t.preventDefault=()=>{}),"function"!=typeof t.stopPropagation&&(t.stopPropagation=()=>{});const e=n.get(this)[t.type];if(e)for(var i=0;inew r(t)),touches:t.touches.map(t=>new r(t)),targetTouches:Array.prototype.slice.call(t.touches.map(t=>new r(t))),timeStamp:t.timeStamp,target:e,currentTarget:e,type:t.type,cancelBubble:!1,cancelable:!1};this.dispatchEvent(i)}}var o=wx.getSystemInfoSync(),s={AudioContext:function(){},URL:{},location:{}};Object.defineProperties(s,{innerWidth:{get:function(){return o.screenWidth}},innerHeight:{get:function(){return o.screenHeight}}}),e(s,a.prototype);const h={createElementNS:(t,e)=>"canvas"===e?__tmpCanvas:"img"===e?m.createImage():void 0,createElement(t){return this.createElementNS(null,t)}};e(h,a.prototype);const l=new Map,c=new Map,u=new Map;function d(t,e={}){e.target=e.target||this,"function"==typeof this[`on${t}`]&&this[`on${t}`].call(this,e)}function p(t,e={}){this.readyState=t,e.readyState=t,d.call(this,"readystatechange",e)}class f extends a{constructor(){super(),this.onabort=null,this.onerror=null,this.onload=null,this.onloadstart=null,this.onprogress=null,this.ontimeout=null,this.onloadend=null,this.onreadystatechange=null,this.readyState=0,this.response=null,this.responseText=null,this.responseType="text",this.dataType="string",this.responseXML=null,this.status=0,this.statusText="",this.upload={},this.withCredentials=!1,l.set(this,{"content-type":"application/x-www-form-urlencoded"}),c.set(this,{})}abort(){const t=u.get(this);t&&t.abort()}getAllResponseHeaders(){const t=c.get(this);return Object.keys(t).map(e=>`${e}: ${t[e]}`).join("\n")}getResponseHeader(t){return c.get(this)[t]}open(t,e){this._method=t,this._url=e,p.call(this,f.OPENED)}overrideMimeType(){}send(t=""){if(this.readyState!==f.OPENED)throw new Error("Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.");{const i=this._url,n=l.get(this),r=this.responseType,a=this.dataType,o=function(t){return!/^(http|https|ftp|wxfile):\/\/.*/i.test(t)}(i);let s;"arraybuffer"===r||(s="utf8"),delete this.response,this.response=null;const h=({data:t,statusCode:e,header:i})=>{if(e=void 0===e?200:e,"string"!=typeof t&&!(t instanceof ArrayBuffer))try{t=JSON.stringify(t)}catch(t){}this.status=e,i&&c.set(this,i),d.call(this,"loadstart"),p.call(this,f.HEADERS_RECEIVED),p.call(this,f.LOADING),this.response=t,t instanceof ArrayBuffer?Object.defineProperty(this,"responseText",{enumerable:!0,configurable:!0,get:function(){throw"InvalidStateError : responseType is "+this.responseType}}):this.responseText=t,p.call(this,f.DONE),d.call(this,"load"),d.call(this,"loadend")},u=({errMsg:t})=>{-1!==t.indexOf("abort")?d.call(this,"abort"):d.call(this,"error",{message:t}),d.call(this,"loadend")};if(o){const t=wx.getFileSystemManager();var e={filePath:i,success:h,fail:u};return s&&(e.encoding=s),void t.readFile(e)}wx.request({data:t,url:i,method:this._method,header:n,dataType:a,responseType:r,success:h,fail:u})}}setRequestHeader(t,e){const i=l.get(this);i[t]=e,l.set(this,i)}addEventListener(t,e){"function"==typeof e&&(this["on"+t]=(t={})=>{t.target=t.target||this,e.call(this,t)})}removeEventListener(t,e){this["on"+t]===e&&(this["on"+t]=null)}}f.UNSEND=0,f.OPENED=1,f.HEADERS_RECEIVED=2,f.LOADING=3,f.DONE=4;try{s.document=h;var window=s,document=h,XMLHttpRequest=f,m=null,__tmpCanvas=null}catch(mu){}function g(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),"name"in Function.prototype==0&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i>8&255]+t[e>>16&255]+t[e>>24&255]+"-"+t[255&i]+t[i>>8&255]+"-"+t[i>>16&15|64]+t[i>>24&255]+"-"+t[63&n|128]+t[n>>8&255]+"-"+t[n>>16&255]+t[n>>24&255]+t[255&r]+t[r>>8&255]+t[r>>16&255]+t[r>>24&255]).toUpperCase()}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Mt.DEG2RAD},radToDeg:function(t){return t*Mt.RAD2DEG},isPowerOfTwo:function(t){return!(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};function St(t,e){this.x=t||0,this.y=e||0}function At(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Tt(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}function Lt(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function Ct(){this.elements=[1,0,0,0,1,0,0,0,1]}Object.defineProperties(St.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(St.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:(v=new St,y=new St,function(t,e){return v.set(t,t),y.set(e,e),this.clamp(v,y)}),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,i){return this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}}),Object.assign(At.prototype,{isMatrix4:!0,set:function(t,e,i,n,r,a,o,s,h,l,c,u,d,p,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=h,g[6]=l,g[10]=c,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new At).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:(T=new Lt,function(t){var e=this.elements,i=t.elements,n=1/T.setFromMatrixColumn(t,0).length(),r=1/T.setFromMatrixColumn(t,1).length(),a=1/T.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*a,e[9]=i[9]*a,e[10]=i[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}),makeRotationFromEuler:function(t){!t||t.isEuler;var e=this.elements,i=t.x,n=t.y,r=t.z,a=Math.cos(i),o=Math.sin(i),s=Math.cos(n),h=Math.sin(n),l=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){var u=a*l,d=a*c,p=o*l,f=o*c;e[0]=s*l,e[4]=-s*c,e[8]=h,e[1]=d+p*h,e[5]=u-f*h,e[9]=-o*s,e[2]=f-u*h,e[6]=p+d*h,e[10]=a*s}else if("YXZ"===t.order){var m=s*l,g=s*c,v=h*l,y=h*c;e[0]=m+y*o,e[4]=v*o-g,e[8]=a*h,e[1]=a*c,e[5]=a*l,e[9]=-o,e[2]=g*o-v,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order)m=s*l,g=s*c,v=h*l,y=h*c,e[0]=m-y*o,e[4]=-a*c,e[8]=v+g*o,e[1]=g+v*o,e[5]=a*l,e[9]=y-m*o,e[2]=-a*h,e[6]=o,e[10]=a*s;else if("ZYX"===t.order)u=a*l,d=a*c,p=o*l,f=o*c,e[0]=s*l,e[4]=p*h-d,e[8]=u*h+f,e[1]=s*c,e[5]=f*h+u,e[9]=d*h-p,e[2]=-h,e[6]=o*s,e[10]=a*s;else if("YZX"===t.order){var x=a*s,b=a*h,w=o*s,_=o*h;e[0]=s*l,e[4]=_-x*c,e[8]=w*c+b,e[1]=c,e[5]=a*l,e[9]=-o*l,e[2]=-h*l,e[6]=b*c+w,e[10]=x-_*c}else"XZY"===t.order&&(x=a*s,b=a*h,w=o*s,_=o*h,e[0]=s*l,e[4]=-c,e[8]=h*l,e[1]=x*c+_,e[5]=a*l,e[9]=b*c-w,e[2]=w*c-b,e[6]=o*l,e[10]=_*c+x);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:(S=new Lt(0,0,0),A=new Lt(1,1,1),function(t){return this.compose(S,t,A)}),lookAt:(w=new Lt,_=new Lt,M=new Lt,function(t,e,i){var n=this.elements;return M.subVectors(t,e),0===M.lengthSq()&&(M.z=1),M.normalize(),w.crossVectors(i,M),0===w.lengthSq()&&(1===Math.abs(i.z)?M.x+=1e-4:M.z+=1e-4,M.normalize(),w.crossVectors(i,M)),w.normalize(),_.crossVectors(M,w),n[0]=w.x,n[4]=_.x,n[8]=M.x,n[1]=w.y,n[5]=_.y,n[9]=M.y,n[2]=w.z,n[6]=_.z,n[10]=M.z,this}),multiply:function(t,e){return void 0!==e?this.multiplyMatrices(t,e):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[4],s=i[8],h=i[12],l=i[1],c=i[5],u=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],b=i[15],w=n[0],_=n[4],M=n[8],S=n[12],A=n[1],T=n[5],L=n[9],C=n[13],P=n[2],E=n[6],D=n[10],I=n[14],O=n[3],N=n[7],k=n[11],z=n[15];return r[0]=a*w+o*A+s*P+h*O,r[4]=a*_+o*T+s*E+h*N,r[8]=a*M+o*L+s*D+h*k,r[12]=a*S+o*C+s*I+h*z,r[1]=l*w+c*A+u*P+d*O,r[5]=l*_+c*T+u*E+d*N,r[9]=l*M+c*L+u*D+d*k,r[13]=l*S+c*C+u*I+d*z,r[2]=p*w+f*A+m*P+g*O,r[6]=p*_+f*T+m*E+g*N,r[10]=p*M+f*L+m*D+g*k,r[14]=p*S+f*C+m*I+g*z,r[3]=v*w+y*A+x*P+b*O,r[7]=v*_+y*T+x*E+b*N,r[11]=v*M+y*L+x*D+b*k,r[15]=v*S+y*C+x*I+b*z,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new Lt;return function(e){for(var i=0,n=e.count;i=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var w=o*v;if(s=s*m+u*w,h=h*m+d*w,l=l*m+p*w,c=c*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+h*h+l*l+c*c);s*=_,h*=_,l*=_,c*=_}}t[e]=s,t[e+1]=h,t[e+2]=l,t[e+3]=c}}),Object.defineProperties(Tt.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(Tt.prototype,{isQuaternion:!0,set:function(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=t._x,n=t._y,r=t._z,a=t.order,o=Math.cos,s=Math.sin,h=o(i/2),l=o(n/2),c=o(r/2),u=s(i/2),d=s(n/2),p=s(r/2);return"XYZ"===a?(this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p):"YXZ"===a?(this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p):"ZXY"===a?(this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p):"ZYX"===a?(this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p):"YZX"===a?(this._x=u*l*c+h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c-u*d*p):"XZY"===a&&(this._x=u*l*c-h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c+u*d*p),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,i=t.elements,n=i[0],r=i[4],a=i[8],o=i[1],s=i[5],h=i[9],l=i[2],c=i[6],u=i[10],d=n+s+u;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(c-h)*e,this._y=(a-l)*e,this._z=(o-r)*e):n>s&&n>u?(e=2*Math.sqrt(1+n-s-u),this._w=(c-h)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(a+l)/e):s>u?(e=2*Math.sqrt(1+s-n-u),this._w=(a-l)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(h+c)/e):(e=2*Math.sqrt(1+u-n-s),this._w=(o-r)/e,this._x=(a+l)/e,this._y=(h+c)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new Lt;return function(i,n){return void 0===e&&(e=new Lt),(t=i.dot(n)+1)<1e-6?(t=0,Math.abs(i.x)>Math.abs(i.z)?e.set(-i.y,i.x,0):e.set(0,-i.z,i.y)):e.crossVectors(i,n),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),angleTo:function(t){return 2*Math.acos(Math.abs(Mt.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var i=this.angleTo(t);if(0===i)return this;var n=Math.min(1,e/i);return this.slerp(t,n),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?this.multiplyQuaternions(t,e):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,n=t._y,r=t._z,a=t._w,o=e._x,s=e._y,h=e._z,l=e._w;return this._x=i*l+a*o+n*h-r*s,this._y=n*l+a*s+r*o-i*h,this._z=r*l+a*h+i*s-n*o,this._w=a*l-i*o-n*s-r*h,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,n=this._y,r=this._z,a=this._w,o=a*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var h=1-e;return this._w=h*a+e*this._w,this._x=h*i+e*this._x,this._y=h*n+e*this._y,this._z=h*r+e*this._z,this.normalize()}var l=Math.sqrt(s),c=Math.atan2(l,o),u=Math.sin((1-e)*c)/l,d=Math.sin(e*c)/l;return this._w=a*u+this._w*d,this._x=i*u+this._x*d,this._y=n*u+this._y*d,this._z=r*u+this._z*d,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(Lt.prototype,{isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?this.multiplyVectors(t,e):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:(L=new Tt,function(t){return!t||t.isEuler,this.applyQuaternion(L.setFromEuler(t))}),applyAxisAngle:function(){var t=new Tt;return function(e,i){return this.applyQuaternion(t.setFromAxisAngle(e,i))}}(),applyMatrix3:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*a,this},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,o=t.z,s=t.w,h=s*e+a*n-o*i,l=s*i+o*e-r*n,c=s*n+r*i-a*e,u=-r*e-a*i-o*n;return this.x=h*s+u*-r+l*-o-c*-a,this.y=l*s+u*-a+c*-r-h*-o,this.z=c*s+u*-o+h*-a-l*-r,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(){var t=new At;return function(e){return this.applyMatrix4(t.getInverse(e.projectionMatrix)).applyMatrix4(e.matrixWorld)}}(),transformDirection:function(t){var e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new Lt,e=new Lt;return function(i,n){return t.set(i,i,i),e.set(n,n,n),this.clamp(t,e)}}(),clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){return void 0!==e?this.crossVectors(t,e):this.crossVectors(this,t)},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,a=e.x,o=e.y,s=e.z;return this.x=n*s-r*o,this.y=r*a-i*s,this.z=i*o-n*a,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new Lt;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new Lt;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Mt.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,e,i){var n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,i){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(Ct.prototype,{isMatrix3:!0,set:function(t,e,i,n,r,a,o,s,h){var l=this.elements;return l[0]=t,l[1]=n,l[2]=o,l[3]=e,l[4]=r,l[5]=s,l[6]=i,l[7]=a,l[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t=new Lt;return function(e){for(var i=0,n=e.count;i2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}},Ot=0;function Nt(t,e,i,n,r,a,o,s,h,l){Object.defineProperty(this,"id",{value:Ot++}),this.uuid=Mt.generateUUID(),this.name="",this.image=void 0!==t?t:Nt.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:Nt.DEFAULT_MAPPING,this.wrapS=void 0!==i?i:U,this.wrapT=void 0!==n?n:U,this.magFilter=void 0!==r?r:H,this.minFilter=void 0!==a?a:q,this.anisotropy=void 0!==h?h:1,this.format=void 0!==o?o:et,this.type=void 0!==s?s:Y,this.offset=new St(0,0),this.repeat=new St(1,1),this.center=new St(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ct,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:xt,this.version=0,this.onUpdate=null}function kt(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1}function zt(t,e,i){this.width=t,this.height=e,this.scissor=new kt(0,0,t,e),this.scissorTest=!1,this.viewport=new kt(0,0,t,e),i=i||{},this.texture=new Nt(void 0,void 0,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:H,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0===i.stencilBuffer||i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}function Rt(t,e,i){zt.call(this,t,e,i),this.samples=4}function Bt(t,e,i){zt.call(this,t,e,i)}function Ft(t,e,i,n,r,a,o,s,h,l,c,u){Nt.call(this,null,a,o,s,h,l,n,r,c,u),this.image={data:t,width:e,height:i},this.magFilter=void 0!==h?h:j,this.minFilter=void 0!==l?l:j,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function Ut(t,e){this.min=void 0!==t?t:new Lt(1/0,1/0,1/0),this.max=void 0!==e?e:new Lt(-1/0,-1/0,-1/0)}function Gt(t,e){this.center=void 0!==t?t:new Lt,this.radius=void 0!==e?e:0}function jt(t,e){this.normal=void 0!==t?t:new Lt(1,0,0),this.constant=void 0!==e?e:0}function Vt(t,e,i,n,r,a){this.planes=[void 0!==t?t:new jt,void 0!==e?e:new jt,void 0!==i?i:new jt,void 0!==n?n:new jt,void 0!==r?r:new jt,void 0!==a?a:new jt]}Nt.DEFAULT_IMAGE=void 0,Nt.DEFAULT_MAPPING=O,Nt.prototype=Object.assign(Object.create(g.prototype),{constructor:Nt,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var n=this.image;if(void 0===n.uuid&&(n.uuid=Mt.generateUUID()),!e&&void 0===t.images[n.uuid]){var r;if(Array.isArray(n)){r=[];for(var a=0,o=n.length;a1)switch(this.wrapS){case F:t.x=t.x-Math.floor(t.x);break;case U:t.x=t.x<0?0:1;break;case G:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case F:t.y=t.y-Math.floor(t.y);break;case U:t.y=t.y<0?0:1;break;case G:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(Nt.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(kt.prototype,{isVector4:!0,set:function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?this.addVectors(t,e):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?this.subVectors(t,e):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,i=this.y,n=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*e+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*e+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*e+a[7]*i+a[11]*n+a[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,i,n,r,a=.01,o=.1,s=t.elements,h=s[0],l=s[4],c=s[8],u=s[1],d=s[5],p=s[9],f=s[2],m=s[6],g=s[10];if(Math.abs(l-u)y&&v>x?vx?yr&&(r=l),c>a&&(a=c),u>o&&(o=u)}return this.min.set(e,i,n),this.max.set(r,a,o),this},setFromBufferAttribute:function(t){for(var e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,h=t.count;sr&&(r=l),c>a&&(a=c),u>o&&(o=u)}return this.min.set(e,i,n),this.max.set(r,a,o),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,i=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return void 0===e&&(e=new Lt),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:(Pt=new Lt,function(t){return this.clampPoint(t.center,Pt),Pt.distanceToSquared(t.center)<=t.radius*t.radius}),intersectsPlane:function(t){var e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant},intersectsTriangle:function(){var t=new Lt,e=new Lt,i=new Lt,n=new Lt,r=new Lt,a=new Lt,o=new Lt,s=new Lt,h=new Lt,l=new Lt;function c(n){var r,a;for(r=0,a=n.length-3;r<=a;r+=3){o.fromArray(n,r);var s=h.x*Math.abs(o.x)+h.y*Math.abs(o.y)+h.z*Math.abs(o.z),l=t.dot(o),c=e.dot(o),u=i.dot(o);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>s)return!1}return!0}return function(o){if(this.isEmpty())return!1;this.getCenter(s),h.subVectors(this.max,s),t.subVectors(o.a,s),e.subVectors(o.b,s),i.subVectors(o.c,s),n.subVectors(e,t),r.subVectors(i,e),a.subVectors(t,i);var u=[0,-n.z,n.y,0,-r.z,r.y,0,-a.z,a.y,n.z,0,-n.x,r.z,0,-r.x,a.z,0,-a.x,-n.y,n.x,0,-r.y,r.x,0,-a.y,a.x,0];return!!c(u)&&!!c(u=[1,0,0,0,1,0,0,0,1])&&(l.crossVectors(n,r),c(u=[l.x,l.y,l.z]))}}(),clampPoint:function(t,e){return void 0===e&&(e=new Lt),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new Lt;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new Lt;return function(e){return void 0===e&&(e=new Gt),this.getCenter(e.center),e.radius=.5*this.getSize(t).length(),e}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new Lt,new Lt,new Lt,new Lt,new Lt,new Lt,new Lt,new Lt];return function(e){return this.isEmpty()||(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t)),this}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(Gt.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:(Et=new Ut,function(t,e){var i=this.center;void 0!==e?i.copy(e):Et.setFromPoints(t).getCenter(i);for(var n=0,r=0,a=t.length;rthis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(t=new Ut),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(jt.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new Lt,e=new Lt;return function(i,n,r){var a=t.subVectors(r,n).cross(e.subVectors(i,n)).normalize();return this.setFromNormalAndCoplanarPoint(a,i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return void 0===e&&(e=new Lt),e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(){var t=new Lt;return function(e,i){void 0===i&&(i=new Lt);var n=e.delta(t),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?i.copy(e.start):void 0;var a=-(e.start.dot(this.normal)+this.constant)/r;return a<0||a>1?void 0:i.copy(n).multiplyScalar(a).add(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return void 0===t&&(t=new Lt),t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new Lt,e=new Ct;return function(i,n){var r=n||e.getNormalMatrix(i),a=this.coplanarPoint(t).applyMatrix4(i),o=this.normal.applyMatrix3(r).normalize();return this.constant=-a.dot(o),this}}(),translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(Vt.prototype,{set:function(t,e,i,n,r,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(n),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,n=i[0],r=i[1],a=i[2],o=i[3],s=i[4],h=i[5],l=i[6],c=i[7],u=i[8],d=i[9],p=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return e[0].setComponents(o-n,c-s,f-u,y-m).normalize(),e[1].setComponents(o+n,c+s,f+u,y+m).normalize(),e[2].setComponents(o+r,c+h,f+d,y+g).normalize(),e[3].setComponents(o-r,c-h,f-d,y-g).normalize(),e[4].setComponents(o-a,c-l,f-p,y-v).normalize(),e[5].setComponents(o+a,c+l,f+p,y+v).normalize(),this},intersectsObject:(Dt=new Gt,function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Dt.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Dt)}),intersectsSprite:function(){var t=new Gt;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,i=t.center,n=-t.radius,r=0;r<6;r++)if(e[r].distanceToPoint(i)0?e.max.x:e.min.x,t.y=r.normal.y>0?e.max.y:e.min.y,t.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(t)<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}});var Wt={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick( specularColor, dotNV );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = normalMatrix * objectTangent;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent ));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif",lights_pars_begin:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#endif\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\tfloat clearCoatInv = 1.0 - clearCoatDHR;\n\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec3 singleScattering = vec3( 0.0 );\n\t\tvec3 multiScattering = vec3( 0.0 );\n\t\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\t\tvec3 diffuse = material.diffuseColor;\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering;\n\t\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\t\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#else\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#endif\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, irradiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t#endif\n#endif",normal_fragment_maps:"#ifdef USE_NORMALMAP\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t#ifdef FLIP_SIDED\n\t\t\tnormal = - normal;\n\t\t#endif\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tnormal = normalize( normalMatrix * normal );\n\t#else\n\t\t#ifdef USE_TANGENT\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy = normalScale * mapN.xy;\n\t\t\tnormal = normalize( vTBN * mapN );\n\t\t#else\n\t\t\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\t\t#endif\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tuniform mat3 normalMatrix;\n\t#else\n\t\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\t\tvec2 st0 = dFdx( vUv.st );\n\t\t\tvec2 st1 = dFdy( vUv.st );\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\t\tvec3 N = normalize( surf_norm );\n\t\t\tmat3 tsn = mat3( S, T, N );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy *= normalScale;\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\treturn normalize( tsn * mapN );\n\t\t}\n\t#endif\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#if defined( DITHERING )\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"};function Ht(t){var e={};for(var i in t)for(var n in e[i]={},t[i]){var r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}return e}function Xt(t){for(var e={},i=0;i>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(){function t(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}return function(e,i,n){if(e=Mt.euclideanModulo(e,1),i=Mt.clamp(i,0,1),n=Mt.clamp(n,0,1),0===i)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+i):n+i-n*i,a=2*n-r;this.r=t(a,r,e+1/3),this.g=t(a,r,e),this.b=t(a,r,e-1/3)}return this}}(),setStyle:function(t){function e(t){void 0!==t&&parseFloat(t)}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n,r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[5]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[5]),this;break;case"hsl":case"hsla":if(n=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(n[1])/360,s=parseInt(n[2],10)/100,h=parseInt(n[3],10)/100;return e(n[5]),this.setHSL(o,s,h)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var l,c=(l=i[1]).length;if(3===c)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===c)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return t&&t.length>0&&void 0!==(l=Kt[t])&&this.setHex(l),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this},convertGammaToLinear:function(t){return this.copyGammaToLinear(this,t),this},convertLinearToGamma:function(t){return this.copyLinearToGamma(this,t),this},copySRGBToLinear:function(){function t(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}return function(e){return this.r=t(e.r),this.g=t(e.g),this.b=t(e.b),this}}(),copyLinearToSRGB:function(){function t(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}return function(e){return this.r=t(e.r),this.g=t(e.g),this.b=t(e.b),this}}(),convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){void 0===t&&(t={h:0,s:0,l:0});var e,i,n=this.r,r=this.g,a=this.b,o=Math.max(n,r,a),s=Math.min(n,r,a),h=(s+o)/2;if(s===o)e=0,i=0;else{var l=o-s;switch(i=h<=.5?l/(o+s):l/(2-o-s),o){case n:e=(r-a)/l+(r1){for(var e=0;e1){for(var e=0;e0)for(n.children=[],s=0;s0&&(i.geometries=u),d.length>0&&(i.materials=d),p.length>0&&(i.textures=p),f.length>0&&(i.images=f),o.length>0&&(i.shapes=o)}return i.object=n,i;function m(t){var e=[];for(var i in t){var n=t[i];delete n.metadata,e.push(n)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var i=0;ie&&(e=t[i]);return e}ge.prototype=Object.assign(Object.create(g.prototype),{constructor:ge,isGeometry:!0,applyMatrix:function(t){for(var e=(new Ct).getNormalMatrix(t),i=0,n=this.vertices.length;i0)for(l=0;l0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,i;for(this.computeFaceNormals(),t=0,e=this.faces.length;t0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,i,n,r;for(i=0,n=this.faces.length;i=0;i--){var f=d[i];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o0,g=p.vertexNormals.length>0,v=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,x=0;if(x=M(x,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,g),x=M(x,6,v),x=M(x,7,y),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),f){var b=this.faceVertexUvs[0][r];o.push(T(b[0]),T(b[1]),T(b[2]))}if(m&&o.push(S(p.normal)),g){var w=p.vertexNormals;o.push(S(w[0]),S(w[1]),S(w[2]))}if(v&&o.push(A(p.color)),y){var _=p.vertexColors;o.push(A(_[0]),A(_[1]),A(_[2]))}}function M(t,e,i){return i?t|1<0&&(t.data.colors=l),u.length>0&&(t.data.uvs=[u]),t.data.faces=o,t},clone:function(){return(new ge).copy(this)},copy:function(t){var e,i,n,r,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,i=s.length;e0,o=r[1]&&r[1].length>0,s=t.morphTargets,h=s.length;if(h>0){e=[];for(var l=0;l0){for(c=[],l=0;l0&&i.length,l=0;l0?1:-1,l.push(P.x,P.y,P.z),c.push(y/m),c.push(1-x/g),L+=1}}for(x=0;x65535?Se:_e)(t,1):this.index=t},addAttribute:function(t,e){return e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(this.setIndex(e),this):(this.attributes[t]=e,this):this.addAttribute(t,new ve(arguments[1],arguments[2]))},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,i){this.groups.push({start:t,count:e,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var i=this.attributes.normal;void 0!==i&&((new Ct).getNormalMatrix(t).applyToBufferAttribute(i),i.needsUpdate=!0);var n=this.attributes.tangent;return void 0!==n&&((new Ct).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new At;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new At;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new At;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new At;return function(e,i,n){return t.makeTranslation(e,i,n),this.applyMatrix(t),this}}(),scale:function(){var t=new At;return function(e,i,n){return t.makeScale(e,i,n),this.applyMatrix(t),this}}(),lookAt:function(){var t=new de;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){var t=new Lt;return function(){return this.computeBoundingBox(),this.boundingBox.getCenter(t).negate(),this.translate(t.x,t.y,t.z),this}}(),setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var i=new Ae(3*e.vertices.length,3),n=new Ae(3*e.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(e.vertices)),this.addAttribute("color",n.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new Ae(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},setFromPoints:function(t){for(var e=[],i=0,n=t.length;i0){var i=new Float32Array(3*t.normals.length);this.addAttribute("normal",new ve(i,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var n=new Float32Array(3*t.colors.length);this.addAttribute("color",new ve(n,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new ve(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var a=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new ve(a,2).copyVector2sArray(t.uvs2))}for(var o in this.groups=t.groups,t.morphTargets){for(var s=[],h=t.morphTargets[o],l=0,c=h.length;l0){var p=new Ae(4*t.skinIndices.length,4);this.addAttribute("skinIndex",p.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var f=new Ae(4*t.skinWeights.length,4);this.addAttribute("skinWeight",f.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Ut);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)},computeBoundingSphere:function(){var t=new Ut,e=new Lt;return function(){null===this.boundingSphere&&(this.boundingSphere=new Gt);var i=this.attributes.position;if(i){var n=this.boundingSphere.center;t.setFromBufferAttribute(i),t.getCenter(n);for(var r=0,a=0,o=i.count;a0&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters;for(var i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};var n=this.index;null!==n&&(t.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});var r=this.attributes;for(var i in r){var a={itemSize:(d=r[i]).itemSize,type:d.array.constructor.name,array:Array.prototype.slice.call(d.array),normalized:d.normalized};""!==d.name&&(a.name=d.name),t.data.attributes[i]=a}var o={},s=!1;for(var i in this.morphAttributes){for(var h=this.morphAttributes[i],l=[],c=0,u=h.length;c0&&(o[i]=l,s=!0)}s&&(t.data.morphAttributes=o);var p=this.groups;p.length>0&&(t.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(t.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),t},clone:function(){return(new Ee).copy(this)},copy:function(t){var e,i,n;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var r=t.index;null!==r&&this.setIndex(r.clone());var a=t.attributes;for(e in a){var o=a[e];this.addAttribute(e,o.clone())}var s=t.morphAttributes;for(e in s){var h=[],l=s[e];for(i=0,n=l.length;i0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext,o=void 0!==i.precision?i.precision:"highp",s=r(o);s!==o&&(o=s);var h=!0===i.logarithmicDepthBuffer,l=t.getParameter(34930),c=t.getParameter(35660),u=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),g=t.getParameter(36349),v=c>0,y=a||!!e.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==n)return n;var i=e.get("EXT_texture_filter_anisotropic");return n=null!==i?t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:h,maxTextures:l,maxVertexTextures:c,maxTextureSize:u,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:a?t.getParameter(36183):0}}function ii(){var t=this,e=null,i=0,n=!1,r=!1,a=new jt,o=new Ct,s={value:null,needsUpdate:!1};function h(){s.value!==e&&(s.value=e,s.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function l(e,i,n,r){var h=null!==e?e.length:0,l=null;if(0!==h){if(l=s.value,!0!==r||null===l){var c=n+4*h,u=i.matrixWorldInverse;o.getNormalMatrix(u),(null===l||l.length65535?Se:_e)(a,1),e.update(i,34963),r[t.id]=i,i}}}function ai(t,e,i,n){var r,a,o;this.setMode=function(t){r=t},this.setIndex=function(t){a=t.type,o=t.bytesPerElement},this.render=function(e,n){t.drawElements(r,n,a,e*o),i.update(n,r)},this.renderInstances=function(s,h,l){var c;if(n.isWebGL2)c=t;else if(null===(c=e.get("ANGLE_instanced_arrays")))return;c[n.isWebGL2?"drawElementsInstanced":"drawElementsInstancedANGLE"](r,l,a,h*o,s.maxInstancedCount),i.update(l,r,s.maxInstancedCount)}}function oi(t){var e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(n=n||1,e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 5:case 6:e.triangles+=n*(t-2);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t}}}}function si(t,e){return Math.abs(e[1])-Math.abs(t[1])}function hi(t){var e={},i=new Float32Array(8);return{update:function(n,r,a,o){var s=n.morphTargetInfluences,h=s.length,l=e[r.id];if(void 0===l){l=[];for(var c=0;c0&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.skinning&&(i.skinning=!0),!1===this.visible&&(i.visible=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){var r=n(t.textures),a=n(t.images);r.length>0&&(i.textures=r),a.length>0&&(i.images=a)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.userData=JSON.parse(JSON.stringify(t.userData)),this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,i=null;if(null!==e){var n=e.length;i=new Array(n);for(var r=0;r!==n;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this.shadowSide=t.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Ye.prototype=Object.create(qe.prototype),Ye.prototype.constructor=Ye,Ye.prototype.isShaderMaterial=!0,Ye.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ht(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},Ye.prototype.toJSON=function(t){var e=qe.prototype.toJSON.call(this,t);for(var i in e.uniforms={},this.uniforms){var n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;var r={};for(var a in this.extensions)!0===this.extensions[a]&&(r[a]=!0);return Object.keys(r).length>0&&(e.extensions=r),e},Object.assign(Ze.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return void 0===e&&(e=new Lt),e.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new Lt;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){void 0===e&&(e=new Lt),e.subVectors(t,this.origin);var i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new Lt;return function(e){var i=t.subVectors(e,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(i).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:(ke=new Lt,ze=new Lt,Re=new Lt,function(t,e,i,n){ke.copy(t).add(e).multiplyScalar(.5),ze.copy(e).sub(t).normalize(),Re.copy(this.origin).sub(ke);var r,a,o,s,h=.5*t.distanceTo(e),l=-this.direction.dot(ze),c=Re.dot(this.direction),u=-Re.dot(ze),d=Re.lengthSq(),p=Math.abs(1-l*l);if(p>0)if(a=l*c-u,s=h*p,(r=l*u-c)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(r*=f)*(r+l*(a*=f)+2*c)+a*(l*r+a+2*u)+d}else a=h,o=-(r=Math.max(0,-(l*a+c)))*r+a*(a+2*u)+d;else a=-h,o=-(r=Math.max(0,-(l*a+c)))*r+a*(a+2*u)+d;else a<=-s?o=-(r=Math.max(0,-(-l*h+c)))*r+(a=r>0?-h:Math.min(Math.max(-h,-u),h))*(a+2*u)+d:a<=s?(r=0,o=(a=Math.min(Math.max(-h,-u),h))*(a+2*u)+d):o=-(r=Math.max(0,-(l*h+c)))*r+(a=r>0?h:Math.min(Math.max(-h,-u),h))*(a+2*u)+d;else a=l>0?-h:h,o=-(r=Math.max(0,-(l*a+c)))*r+a*(a+2*u)+d;return i&&i.copy(this.direction).multiplyScalar(r).add(this.origin),n&&n.copy(ze).multiplyScalar(a).add(ke),o}),intersectSphere:function(){var t=new Lt;return function(e,i){t.subVectors(e.center,this.origin);var n=t.dot(this.direction),r=t.dot(t)-n*n,a=e.radius*e.radius;if(r>a)return null;var o=Math.sqrt(a-r),s=n-o,h=n+o;return s<0&&h<0?null:s<0?this.at(h,i):this.at(s,i)}}(),intersectsSphere:function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null},intersectPlane:function(t,e){var i=this.distanceToPlane(t);return null===i?null:this.at(i,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var i,n,r,a,o,s,h=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,u=this.origin;return h>=0?(i=(t.min.x-u.x)*h,n=(t.max.x-u.x)*h):(i=(t.max.x-u.x)*h,n=(t.min.x-u.x)*h),l>=0?(r=(t.min.y-u.y)*l,a=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,a=(t.min.y-u.y)*l),i>a||r>n?null:((r>i||i!=i)&&(i=r),(a=0?(o=(t.min.z-u.z)*c,s=(t.max.z-u.z)*c):(o=(t.max.z-u.z)*c,s=(t.min.z-u.z)*c),i>s||o>n?null:((o>i||i!=i)&&(i=o),(s=0?i:n,e)))},intersectsBox:function(){var t=new Lt;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new Lt,e=new Lt,i=new Lt,n=new Lt;return function(r,a,o,s,h){e.subVectors(a,r),i.subVectors(o,r),n.crossVectors(e,i);var l,c=this.direction.dot(n);if(c>0){if(s)return null;l=1}else{if(!(c<0))return null;l=-1,c=-c}t.subVectors(this.origin,r);var u=l*this.direction.dot(i.crossVectors(t,i));if(u<0)return null;var d=l*this.direction.dot(e.cross(t));if(d<0)return null;if(u+d>c)return null;var p=-l*t.dot(n);return p<0?null:this.at(p/c,h)}}(),applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),Object.assign(Je,{getNormal:(Fe=new Lt,function(t,e,i,n){void 0===n&&(n=new Lt),n.subVectors(i,e),Fe.subVectors(t,e),n.cross(Fe);var r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}),getBarycoord:function(){var t=new Lt,e=new Lt,i=new Lt;return function(n,r,a,o,s){t.subVectors(o,r),e.subVectors(a,r),i.subVectors(n,r);var h=t.dot(t),l=t.dot(e),c=t.dot(i),u=e.dot(e),d=e.dot(i),p=h*u-l*l;if(void 0===s&&(s=new Lt),0===p)return s.set(-2,-1,-1);var f=1/p,m=(u*c-l*d)*f,g=(h*d-l*c)*f;return s.set(1-m-g,g,m)}}(),containsPoint:function(){var t=new Lt;return function(e,i,n,r){return Je.getBarycoord(e,i,n,r,t),t.x>=0&&t.y>=0&&t.x+t.y<=1}}(),getUV:(Be=new Lt,function(t,e,i,n,r,a,o,s){return this.getBarycoord(t,e,i,n,Be),s.set(0,0),s.addScaledVector(r,Be.x),s.addScaledVector(a,Be.y),s.addScaledVector(o,Be.z),s})}),Object.assign(Je.prototype,{set:function(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this},setFromPointsAndIndices:function(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:function(){var t=new Lt,e=new Lt;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),getMidpoint:function(t){return void 0===t&&(t=new Lt),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return Je.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(t=new Lt),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,e){return Je.getBarycoord(t,this.a,this.b,this.c,e)},containsPoint:function(t){return Je.containsPoint(t,this.a,this.b,this.c)},getUV:function(t,e,i,n,r){return Je.getUV(t,this.a,this.b,this.c,e,i,n,r)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:(Ue=new Lt,Ge=new Lt,je=new Lt,Ve=new Lt,We=new Lt,He=new Lt,function(t,e){void 0===e&&(e=new Lt);var i,n,r=this.a,a=this.b,o=this.c;Ue.subVectors(a,r),Ge.subVectors(o,r),Ve.subVectors(t,r);var s=Ue.dot(Ve),h=Ge.dot(Ve);if(s<=0&&h<=0)return e.copy(r);We.subVectors(t,a);var l=Ue.dot(We),c=Ge.dot(We);if(l>=0&&c<=l)return e.copy(a);var u=s*c-l*h;if(u<=0&&s>=0&&l<=0)return i=s/(s-l),e.copy(r).addScaledVector(Ue,i);He.subVectors(t,o);var d=Ue.dot(He),p=Ge.dot(He);if(p>=0&&d<=p)return e.copy(o);var f=d*h-s*p;if(f<=0&&h>=0&&p<=0)return n=h/(h-p),e.copy(r).addScaledVector(Ge,n);var m=l*p-d*c;if(m<=0&&c-l>=0&&d-p>=0)return je.subVectors(o,a),n=(c-l)/(c-l+(d-p)),e.copy(a).addScaledVector(je,n);var g=1/(m+f+u);return i=f*g,n=u*g,e.copy(r).addScaledVector(Ue,i).addScaledVector(Ge,n)}),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),Ke.prototype=Object.create(qe.prototype),Ke.prototype.constructor=Ke,Ke.prototype.isMeshBasicMaterial=!0,Ke.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},Qe.prototype=Object.assign(Object.create(de.prototype),{constructor:Qe,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return de.prototype.copy.call(this,t),this.drawMode=t.drawMode,void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this},updateMorphTargets:function(){var t,e,i,n=this.geometry;if(n.isBufferGeometry){var r=n.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,e=o.length;ti.far?null:{distance:h,point:p.clone(),object:t}}function m(t,e,i,o,s,h,p,m,g){n.fromBufferAttribute(s,p),r.fromBufferAttribute(s,m),a.fromBufferAttribute(s,g);var v=f(t,e,i,o,n,r,a,d);if(v){h&&(l.fromBufferAttribute(h,p),c.fromBufferAttribute(h,m),u.fromBufferAttribute(h,g),v.uv=Je.getUV(d,n,r,a,l,c,u,new St));var y=new re(p,m,g);Je.getNormal(n,r,a,y.normal),v.face=y}return v}return function(p,g){var v,y=this.geometry,x=this.material,b=this.matrixWorld;if(void 0!==x&&(null===y.boundingSphere&&y.computeBoundingSphere(),i.copy(y.boundingSphere),i.applyMatrix4(b),!1!==p.ray.intersectsSphere(i)&&(t.getInverse(b),e.copy(p.ray).applyMatrix4(t),null===y.boundingBox||!1!==e.intersectsBox(y.boundingBox))))if(y.isBufferGeometry){var w,_,M,S,A,T,L,C,P,E=y.index,D=y.attributes.position,I=y.attributes.uv,O=y.groups,N=y.drawRange;if(null!==E)if(Array.isArray(x))for(S=0,T=O.length;S0&&(B=j);for(var V=0,W=G.length;V0)return t;var r=e*i,a=gi[r];if(void 0===a&&(a=new Float32Array(r),gi[r]=a),0!==e){n.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=i,t[o].toArray(a,s)}return a}function _i(t,e){if(t.length!==e.length)return!1;for(var i=0,n=t.length;i/gm,function(t,e){var i=Wt[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return un(i)})}function dn(t){return t.replace(/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,i,n){for(var r="",a=parseInt(e);a0?t.gammaFactor:1,w=o.isWebGL2?"":function(t,e,i){return[(t=t||{}).derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap&&!e.objectSpaceNormalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(hn).join("\n")}(n.extensions,a,e),_=function(t){var e=[];for(var i in t){var n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(h),M=s.createProgram();if(n.isRawShaderMaterial?((m=[_].filter(hn).join("\n")).length>0&&(m+="\n"),(g=[w,_].filter(hn).join("\n")).length>0&&(g+="\n")):(m=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,_,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+b,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+p:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+u:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(hn).join("\n"),g=[w,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,_,a.alphaTest?"#define ALPHATEST "+a.alphaTest+(a.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+b,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.matcap?"#define USE_MATCAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+d:"",a.envMap?"#define "+p:"",a.envMap?"#define "+f:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+u:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||e.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&(o.isWebGL2||e.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==a.toneMapping?"#define TONE_MAPPING":"",0!==a.toneMapping?Wt.tonemapping_pars_fragment:"",0!==a.toneMapping?sn("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.matcapEncoding||a.envMapEncoding||a.emissiveMapEncoding?Wt.encodings_pars_fragment:"",a.mapEncoding?on("mapTexelToLinear",a.mapEncoding):"",a.matcapEncoding?on("matcapTexelToLinear",a.matcapEncoding):"",a.envMapEncoding?on("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?on("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?(v="linearToOutputTexel",y=a.outputEncoding,x=an(y),"vec4 "+v+"( vec4 value ) { return LinearTo"+x[0]+x[1]+"; }"):"",a.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(hn).join("\n")),l=cn(l=ln(l=un(l),a),a),c=cn(c=ln(c=un(c),a),a),l=dn(l),c=dn(c),o.isWebGL2&&!n.isRawShaderMaterial){var S=!1,A=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==l.match(A)&&null!==c.match(A)&&(S=!0,l=l.replace(A,""),c=c.replace(A,"")),m=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,g=["#version 300 es\n","#define varying in",S?"":"out highp vec4 pc_fragColor;",S?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+g}var T=g+c,L=nn(s,35633,m+l),C=nn(s,35632,T);s.attachShader(M,L),s.attachShader(M,C),void 0!==n.index0AttributeName?s.bindAttribLocation(M,0,n.index0AttributeName):!0===a.morphTargets&&s.bindAttribLocation(M,0,"position"),s.linkProgram(M);var P,E,D=s.getProgramInfoLog(M).trim(),I=s.getShaderInfoLog(L).trim(),O=s.getShaderInfoLog(C).trim(),F=!0,U=!0;return!1===s.getProgramParameter(M,35714)?F=!1:""!==D||""!==I&&""!==O||(U=!1),U&&(this.diagnostics={runnable:F,material:n,programLog:D,vertexShader:{log:I,prefix:m},fragmentShader:{log:O,prefix:g}}),s.deleteShader(L),s.deleteShader(C),this.getUniforms=function(){return void 0===P&&(P=new en(s,M,t)),P},this.getAttributes=function(){return void 0===E&&(E=function(t,e){for(var i={},n=t.getProgramParameter(e,35721),r=0;r0,maxBones:d,useVertexTexture:i.floatVertexTextures,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:n.directional.length,numPointLights:n.point.length,numSpotLights:n.spot.length,numRectAreaLights:n.rectArea.length,numHemiLights:n.hemi.length,numClippingPlanes:h,numClipIntersection:l,dithering:e.dithering,shadowMapEnabled:t.shadowMap.enabled&&c.receiveShadow&&a.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:e.premultipliedAlpha,alphaTest:e.alphaTest,doubleSided:2===e.side,flipSided:1===e.side,depthPacking:void 0!==e.depthPacking&&e.depthPacking}},this.getProgramCode=function(e,i){var n=[];if(i.shaderID?n.push(i.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)n.push(r),n.push(e.defines[r]);for(var o=0;o1&&i.sort(gn),n.length>1&&n.sort(vn)}}}function xn(){var t={};function e(i){var n=i.target;n.removeEventListener("dispose",e),delete t[n.id]}return{get:function(i,n){var r,a=t[i.id];return void 0===a?(r=new yn,t[i.id]={},t[i.id][n.id]=r,i.addEventListener("dispose",e)):void 0===(r=a[n.id])&&(r=new yn,a[n.id]=r),r},dispose:function(){t={}}}}function bn(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var i;switch(e.type){case"DirectionalLight":i={direction:new Lt,color:new Qt,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new St};break;case"SpotLight":i={position:new Lt,direction:new Lt,color:new Qt,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new St};break;case"PointLight":i={position:new Lt,color:new Qt,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new St,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":i={direction:new Lt,skyColor:new Qt,groundColor:new Qt};break;case"RectAreaLight":i={color:new Qt,position:new Lt,halfWidth:new Lt,halfHeight:new Lt}}return t[e.id]=i,i}}}var wn=0;function _n(){var t=new bn,e={id:wn++,hash:{stateID:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,shadowsLength:-1},ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},i=new Lt,n=new At,r=new At;return{setup:function(a,o,s){for(var h=0,l=0,c=0,u=0,d=0,p=0,f=0,m=0,g=s.matrixWorldInverse,v=0,y=a.length;v0:s&&s.isGeometry&&(m=s.morphTargets&&s.morphTargets.length>0)),e.isSkinnedMesh&&i.skinning;var g=0;m&&(g|=1),e.isSkinnedMesh&&i.skinning&&(g|=2),h=p[g]}if(t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var v=h.uuid,y=i.uuid,x=u[v];void 0===x&&(x={},u[v]=x);var b=x[y];void 0===b&&(b=h.clone(),x[y]=b),h=b}return h.visible=i.visible,h.wireframe=i.wireframe,h.side=null!=i.shadowSide?i.shadowSide:d[i.side],h.clipShadows=i.clipShadows,h.clippingPlanes=i.clippingPlanes,h.clipIntersection=i.clipIntersection,h.wireframeLinewidth=i.wireframeLinewidth,h.linewidth=i.linewidth,n&&h.isMeshDistanceMaterial&&(h.referencePosition.copy(r),h.nearDistance=a,h.farDistance=o),h}function M(i,r,a,o){if(!1!==i.visible){if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&i.castShadow&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,i.matrixWorld);var s=e.update(i),l=i.material;if(Array.isArray(l))for(var c=s.groups,u=0,d=c.length;u=1):-1!==I.indexOf("OpenGL ES")&&(D=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(I)[1]),P=D>=2);var O=null,N={},k=new kt,z=new kt;function R(e,i,n){var r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(var o=0;on||t.height>n)&&Math.max(t.width,t.height),t}function l(t){return Mt.isPowerOfTwo(t.width)&&Mt.isPowerOfTwo(t.height)}function c(t,e){return t.generateMipmaps&&e&&t.minFilter!==j&&t.minFilter!==H}function u(e,i,r,a){t.generateMipmap(e),n.get(i).__maxMipLevel=Math.log(Math.max(r,a))*Math.LOG2E}function d(t,i){if(!r.isWebGL2)return t;var n=t;return 6403===t&&(5126===i&&(n=33326),5131===i&&(n=33325),5121===i&&(n=33321)),6407===t&&(5126===i&&(n=34837),5131===i&&(n=34843),5121===i&&(n=32849)),6408===t&&(5126===i&&(n=34836),5131===i&&(n=34842),5121===i&&(n=32856)),33325!==n&&33326!==n&&34842!==n&&34836!==n||e.get("EXT_color_buffer_float"),n}function p(t){return t===j||t===V||t===W?9728:9729}function f(e){var i=e.target;i.removeEventListener("dispose",f),function(e){var i=n.get(e);void 0!==i.__webglInit&&(t.deleteTexture(i.__webglTexture),n.remove(e))}(i),i.isVideoTexture&&delete s[i.id],o.memory.textures--}function m(e){var i=e.target;i.removeEventListener("dispose",m),function(e){var i=n.get(e),r=n.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var a=0;a<6;a++)t.deleteFramebuffer(i.__webglFramebuffer[a]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[a]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer);n.remove(e.texture),n.remove(e)}}(i),o.memory.textures--}function g(t,e){var r=n.get(t);if(t.isVideoTexture&&function(t){var e=t.id,i=o.render.frame;s[e]!==i&&(s[e]=i,t.update())}(t),t.version>0&&r.__version!==t.version){var a=t.image;if(void 0===a);else if(!1!==a.complete)return void x(r,t,e)}i.activeTexture(33984+e),i.bindTexture(3553,r.__webglTexture)}function v(i,o,s){var h;if(s?(t.texParameteri(i,10242,a.convert(o.wrapS)),t.texParameteri(i,10243,a.convert(o.wrapT)),32879===i&&t.texParameteri(i,32882,a.convert(o.wrapR)),t.texParameteri(i,10240,a.convert(o.magFilter)),t.texParameteri(i,10241,a.convert(o.minFilter))):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879===i&&t.texParameteri(i,32882,33071),o.wrapS!==U||o.wrapT,t.texParameteri(i,10240,p(o.magFilter)),t.texParameteri(i,10241,p(o.minFilter)),o.minFilter!==j&&o.minFilter),h=e.get("EXT_texture_filter_anisotropic")){if(o.type===K&&null===e.get("OES_texture_float_linear"))return;if(o.type===Q&&null===(r.isWebGL2||e.get("OES_texture_half_float_linear")))return;(o.anisotropy>1||n.get(o).__currentAnisotropy)&&(t.texParameterf(i,h.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),n.get(o).__currentAnisotropy=o.anisotropy)}}function y(e,i){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",f),e.__webglTexture=t.createTexture(),o.memory.textures++)}function x(e,n,o){var s=n.isDataTexture3D?32879:3553;y(e,n),i.activeTexture(33984+o),i.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),function(t){return!r.isWebGL2&&(t.wrapS!==U||t.wrapT!==U||t.minFilter!==j&&t.minFilter!==H)}(n)&&l(n.image);var p=h(n.image,0,0,r.maxTextureSize),f=l(p)||r.isWebGL2,m=a.convert(n.format),g=a.convert(n.type),x=d(m,g);v(s,n,f);var b,w=n.mipmaps;if(n.isDepthTexture){if(x=6402,n.type===K){if(!r.isWebGL2)throw new Error("Float Depth Texture only supported in WebGL2.0");x=36012}else r.isWebGL2&&(x=33189);n.format===it&&6402===x&&n.type!==Z&&n.type!==J&&(n.type=Z,g=a.convert(n.type)),n.format===nt&&(x=34041,n.type!==$&&(n.type=$,g=a.convert(n.type))),i.texImage2D(3553,0,x,p.width,p.height,0,m,g,null)}else if(n.isDataTexture)if(w.length>0&&f){for(var _=0,M=w.length;_-1&&i.compressedTexImage2D(3553,_,x,b.width,b.height,0,b.data):i.texImage2D(3553,_,x,b.width,b.height,0,m,g,b.data);e.__maxMipLevel=w.length-1}else if(n.isDataTexture3D)i.texImage3D(32879,0,x,p.width,p.height,p.depth,0,m,g,p.data),e.__maxMipLevel=0;else if(w.length>0&&f){for(_=0,M=w.length;_0&&r.__version!==t.version?x(r,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,r.__webglTexture))},this.setTextureCube=function(e,o){var s=n.get(e);if(6===e.image.length)if(e.version>0&&s.__version!==e.version){y(s,e),i.activeTexture(33984+o),i.bindTexture(34067,s.__webglTexture),t.pixelStorei(37440,e.flipY);for(var p=e&&e.isCompressedTexture,f=e.image[0]&&e.image[0].isDataTexture,m=[],g=0;g<6;g++)m[g]=p||f?f?e.image[g].image:e.image[g]:h(e.image[g],0,0,r.maxCubemapSize);var x=m[0],b=l(x)||r.isWebGL2,w=a.convert(e.format),_=a.convert(e.type),M=d(w,_);for(v(34067,e,b),g=0;g<6;g++)if(p)for(var S,A=m[g].mipmaps,T=0,L=A.length;T-1&&i.compressedTexImage2D(34069+g,T,M,S.width,S.height,0,S.data):i.texImage2D(34069+g,T,M,S.width,S.height,0,w,_,S.data);else f?i.texImage2D(34069+g,0,M,m[g].width,m[g].height,0,w,_,m[g].data):i.texImage2D(34069+g,0,M,w,_,m[g]);s.__maxMipLevel=p?A.length-1:0,c(e,b)&&u(34067,e,x.width,x.height),s.__version=e.version,e.onUpdate&&e.onUpdate(e)}else i.activeTexture(33984+o),i.bindTexture(34067,s.__webglTexture)},this.setTextureCubeDynamic=function(t,e){i.activeTexture(33984+e),i.bindTexture(34067,n.get(t).__webglTexture)},this.setupRenderTarget=function(e){var s=n.get(e),h=n.get(e.texture);e.addEventListener("dispose",m),h.__webglTexture=t.createTexture(),o.memory.textures++;var p=!0===e.isWebGLRenderTargetCube,f=!0===e.isWebGLMultisampleRenderTarget,g=l(e)||r.isWebGL2;if(p){s.__webglFramebuffer=[];for(var y=0;y<6;y++)s.__webglFramebuffer[y]=t.createFramebuffer()}else if(s.__webglFramebuffer=t.createFramebuffer(),f&&r.isWebGL2){s.__webglMultisampledFramebuffer=t.createFramebuffer(),s.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,s.__webglColorRenderbuffer);var x=d(a.convert(e.texture.format),a.convert(e.texture.type)),S=M(e);t.renderbufferStorageMultisample(36161,S,x,e.width,e.height),t.bindFramebuffer(36160,s.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,s.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(s.__webglDepthRenderbuffer=t.createRenderbuffer(),w(s.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}if(p){for(i.bindTexture(34067,h.__webglTexture),v(34067,e.texture,g),y=0;y<6;y++)b(s.__webglFramebuffer[y],e,36064,34069+y);c(e.texture,g)&&u(34067,e.texture,e.width,e.height),i.bindTexture(34067,null)}else i.bindTexture(3553,h.__webglTexture),v(3553,e.texture,g),b(s.__webglFramebuffer,e,36064,3553),c(e.texture,g)&&u(3553,e.texture,e.width,e.height),i.bindTexture(3553,null);e.depthBuffer&&_(e)},this.updateRenderTargetMipmap=function(t){var e=t.texture;if(c(e,l(t)||r.isWebGL2)){var a=t.isWebGLRenderTargetCube?34067:3553,o=n.get(e).__webglTexture;i.bindTexture(a,o),u(a,e,t.width,t.height),i.bindTexture(a,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget&&r.isWebGL2){var i=n.get(e);t.bindFramebuffer(36008,i.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,i.__webglFramebuffer);var a=e.width,o=e.height,s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024),t.blitFramebuffer(0,0,a,o,0,0,a,o,s,9728)}}}function En(t,e,i){return{convert:function(t){var n;if(t===F)return 10497;if(t===U)return 33071;if(t===G)return 33648;if(t===j)return 9728;if(t===V)return 9984;if(t===W)return 9986;if(t===H)return 9729;if(t===X)return 9985;if(t===q)return 9987;if(t===Y)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(t===Z)return 5123;if(1013===t)return 5124;if(t===J)return 5125;if(t===K)return 5126;if(t===Q){if(i.isWebGL2)return 5131;if(null!==(n=e.get("OES_texture_half_float")))return n.HALF_FLOAT_OES}if(1021===t)return 6406;if(t===tt)return 6407;if(t===et)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(t===it)return 6402;if(t===nt)return 34041;if(1028===t)return 6403;if(t===E)return 32774;if(101===t)return 32778;if(102===t)return 32779;if(200===t)return 0;if(201===t)return 1;if(202===t)return 768;if(203===t)return 769;if(204===t)return 770;if(205===t)return 771;if(206===t)return 772;if(207===t)return 773;if(208===t)return 774;if(209===t)return 775;if(210===t)return 776;if((t===rt||t===at||t===ot||t===st)&&null!==(n=e.get("WEBGL_compressed_texture_s3tc"))){if(t===rt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===at)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===ot)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===st)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===ht||t===lt||t===ct||t===ut)&&null!==(n=e.get("WEBGL_compressed_texture_pvrtc"))){if(t===ht)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===lt)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===ct)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===ut)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===dt&&null!==(n=e.get("WEBGL_compressed_texture_etc1")))return n.COMPRESSED_RGB_ETC1_WEBGL;if((37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t)&&null!==(n=e.get("WEBGL_compressed_texture_astc")))return t;if(t===D||t===I){if(i.isWebGL2){if(t===D)return 32775;if(t===I)return 32776}if(null!==(n=e.get("EXT_blend_minmax"))){if(t===D)return n.MIN_EXT;if(t===I)return n.MAX_EXT}}if(t===$){if(i.isWebGL2)return 34042;if(null!==(n=e.get("WEBGL_depth_texture")))return n.UNSIGNED_INT_24_8_WEBGL}return 0}}}function Dn(){de.call(this),this.type="Group"}function In(){de.call(this),this.type="Camera",this.matrixWorldInverse=new At,this.projectionMatrix=new At,this.projectionMatrixInverse=new At}function On(t,e,i,n){In.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==n?n:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Nn(t){On.call(this),this.cameras=t||[]}An.prototype=Object.create(qe.prototype),An.prototype.constructor=An,An.prototype.isMeshDepthMaterial=!0,An.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Tn.prototype=Object.create(qe.prototype),Tn.prototype.constructor=Tn,Tn.prototype.isMeshDistanceMaterial=!0,Tn.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this},Dn.prototype=Object.assign(Object.create(de.prototype),{constructor:Dn,isGroup:!0}),In.prototype=Object.assign(Object.create(de.prototype),{constructor:In,isCamera:!0,copy:function(t,e){return de.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(t=new Lt),this.updateMatrixWorld(!0);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){de.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),On.prototype=Object.assign(Object.create(In.prototype),{constructor:On,isPerspectiveCamera:!0,copy:function(t,e){return In.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*Mt.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*Mt.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Mt.RAD2DEG*Math.atan(Math.tan(.5*Mt.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,i,n,r,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*Mt.DEG2RAD*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*n/o,e-=a.offsetY*i/s,n*=a.width/o,i*=a.height/s}var h=this.filmOffset;0!==h&&(r+=t*h/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(t){var e=de.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),Nn.prototype=Object.assign(Object.create(On.prototype),{constructor:Nn,isArrayCamera:!0});var kn,zn,Rn,Bn,Fn,Un,Gn=new Lt,jn=new Lt;function Vn(t,e,i){Gn.setFromMatrixPosition(e.matrixWorld),jn.setFromMatrixPosition(i.matrixWorld);var n=Gn.distanceTo(jn),r=e.projectionMatrix.elements,a=i.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),h=(r[9]+1)/r[5],l=(r[9]-1)/r[5],c=(r[8]-1)/r[0],u=(a[8]+1)/a[0],d=o*c,p=o*u,f=n/(-c+u),m=f*-c;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.getInverse(t.matrixWorld);var g=o+f,v=s+f,y=d-m,x=p+(n-m),b=h*s/v*g,w=l*s/v*g;t.projectionMatrix.makePerspective(y,x,b,w,g,v)}function Wn(t){var e=this,i=null,n=null,r=null,a=[],o=new At,s=new At,h=1,l="stage";void 0!==window&&"VRFrameData"in window&&(n=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",x,!1));var c=new At,u=new Tt,d=new Lt,p=new On;p.bounds=new kt(0,0,.5,1),p.layers.enable(1);var f=new On;f.bounds=new kt(.5,0,.5,1),f.layers.enable(2);var m=new Nn([p,f]);function g(){return null!==i&&!0===i.isPresenting}m.layers.enable(1),m.layers.enable(2);var v,y=new St;function x(){if(g()){var n=i.getEyeParameters("left"),r=n.renderWidth*h,a=n.renderHeight*h;v=t.getPixelRatio(),t.getSize(y),t.setDrawingBufferSize(2*r,a,1),_.start()}else e.enabled&&t.setDrawingBufferSize(y.width,y.height,v),_.stop()}var b=[];function w(t){for(var e=navigator.getGamepads&&navigator.getGamepads(),i=0,n=0,r=e.length;i=0){var h=n[o];if(void 0!==h){var l=h.normalized,c=h.itemSize,u=x.get(h);if(void 0===u)continue;var g=u.buffer,v=u.type,y=u.bytesPerElement;if(h.isInterleavedBufferAttribute){var b=h.data,w=b.stride,_=h.offset;b&&b.isInstancedInterleavedBuffer?(m.enableAttributeAndDivisor(s,b.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=b.meshPerAttribute*b.count)):m.enableAttribute(s),d.bindBuffer(34962,g),d.vertexAttribPointer(s,c,v,l,w*y,_*y)}else h.isInstancedBufferAttribute?(m.enableAttributeAndDivisor(s,h.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=h.meshPerAttribute*h.count)):m.enableAttribute(s),d.bindBuffer(34962,g),d.vertexAttribPointer(s,c,v,l,0,0)}else if(void 0!==a){var M=a[o];if(void 0!==M)switch(M.length){case 2:d.vertexAttrib2fv(s,M);break;case 3:d.vertexAttrib3fv(s,M);break;case 4:d.vertexAttrib4fv(s,M);break;default:d.vertexAttrib1fv(s,M)}}}}m.disableUnusedAttributes()}}(n,s,i),null!==c&&d.bindBuffer(34963,l.buffer));var y=1/0;null!==c?y=c.count:void 0!==u&&(y=u.count);var w=i.drawRange.start*g,_=i.drawRange.count*g,M=null!==a?a.start*g:0,S=null!==a?a.count*g:1/0,A=Math.max(w,M),P=Math.min(y,w+_,M+S)-1,E=Math.max(0,P-A+1);if(0!==E){if(r.isMesh)if(!0===n.wireframe)m.setLineWidth(n.wireframeLinewidth*at()),v.setMode(1);else switch(r.drawMode){case 0:v.setMode(4);break;case 1:v.setMode(5);break;case 2:v.setMode(6)}else if(r.isLine){var D=n.linewidth;void 0===D&&(D=1),m.setLineWidth(D*at()),r.isLineSegments?v.setMode(1):r.isLineLoop?v.setMode(2):v.setMode(3)}else r.isPoints?v.setMode(0):r.isSprite&&v.setMode(4);i&&i.isInstancedBufferGeometry?i.maxInstancedCount>0&&v.renderInstances(i,A,E):v.render(A,E)}},this.compile=function(t,e){(u=S.get(t,e)).init(),t.traverse(function(t){t.isLight&&(u.pushLight(t),t.castShadow&&u.pushShadow(t))}),u.setupLights(e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var i=0;i=0&&t.numSupportedMorphTargets++}if(t.morphNormals)for(t.numSupportedMorphNormals=0,m=0;m=0&&t.numSupportedMorphNormals++;var g=n.shader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(n.numClippingPlanes=$.numPlanes,n.numIntersection=$.numIntersection,g.clippingPlanes=$.uniform),n.fog=e,void 0===o&&(n.lightsHash=o={}),o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,t.lights&&(g.ambientLightColor.value=r.state.ambient,g.directionalLights.value=r.state.directional,g.spotLights.value=r.state.spot,g.rectAreaLights.value=r.state.rectArea,g.pointLights.value=r.state.point,g.hemisphereLights.value=r.state.hemi,g.directionalShadowMap.value=r.state.directionalShadowMap,g.directionalShadowMatrix.value=r.state.directionalShadowMatrix,g.spotShadowMap.value=r.state.spotShadowMap,g.spotShadowMatrix.value=r.state.spotShadowMatrix,g.pointShadowMap.value=r.state.pointShadowMap,g.pointShadowMatrix.value=r.state.pointShadowMatrix);var y=n.program.getUniforms(),x=en.seqWithValue(y.seq,g);n.uniformsList=x}function wt(t,e,i,n){j=0;var r=v.get(i),a=u.state.lights,o=r.lightsHash,s=a.state.hash;if(tt&&(it||t!==R)){var h=t===R&&i.id===k;$.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,t,r,h)}!1===i.needsUpdate&&(void 0===r.program||i.fog&&r.fog!==e?i.needsUpdate=!0:(!i.lights||o.stateID===s.stateID&&o.directionalLength===s.directionalLength&&o.pointLength===s.pointLength&&o.spotLength===s.spotLength&&o.rectAreaLength===s.rectAreaLength&&o.hemiLength===s.hemiLength&&o.shadowsLength===s.shadowsLength)&&(void 0===r.numClippingPlanes||r.numClippingPlanes===$.numPlanes&&r.numIntersection===$.numIntersection)||(i.needsUpdate=!0)),!i.needsUpdate&&r.program||(bt(i,e,n),i.needsUpdate=!1);var l,c,p=!1,g=!1,y=!1,x=r.program,b=x.getUniforms(),w=r.shader.uniforms;if(m.useProgram(x.program)&&(p=!0,g=!0,y=!0),i.id!==k&&(k=i.id,g=!0),p||R!==t){if(b.setValue(d,"projectionMatrix",t.projectionMatrix),f.logarithmicDepthBuffer&&b.setValue(d,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),R!==t&&(R=t,g=!0,y=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var _=b.map.cameraPosition;void 0!==_&&_.setValue(d,rt.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&b.setValue(d,"viewMatrix",t.matrixWorldInverse)}if(i.skinning){b.setOptional(d,n,"bindMatrix"),b.setOptional(d,n,"bindMatrixInverse");var M=n.skeleton;if(M){var S=M.bones;if(f.floatVertexTextures){if(void 0===M.boneTexture){var A=Math.sqrt(4*S.length);A=Mt.ceilPowerOfTwo(A),A=Math.max(A,4);var T=new Float32Array(A*A*4);T.set(M.boneMatrices);var L=new Ft(T,A,A,et,K);L.needsUpdate=!0,M.boneMatrices=T,M.boneTexture=L,M.boneTextureSize=A}b.setValue(d,"boneTexture",M.boneTexture),b.setValue(d,"boneTextureSize",M.boneTextureSize)}else b.setOptional(d,M,"boneMatrices")}}return g&&(b.setValue(d,"toneMappingExposure",E.toneMappingExposure),b.setValue(d,"toneMappingWhitePoint",E.toneMappingWhitePoint),i.lights&&(c=y,(l=w).ambientLightColor.needsUpdate=c,l.directionalLights.needsUpdate=c,l.pointLights.needsUpdate=c,l.spotLights.needsUpdate=c,l.rectAreaLights.needsUpdate=c,l.hemisphereLights.needsUpdate=c),e&&i.fog&&function(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}(w,e),i.isMeshBasicMaterial?_t(w,i):i.isMeshLambertMaterial?(_t(w,i),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(w,i)):i.isMeshPhongMaterial?(_t(w,i),i.isMeshToonMaterial?function(t,e){Tt(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(w,i):Tt(w,i)):i.isMeshStandardMaterial?(_t(w,i),i.isMeshPhysicalMaterial?function(t,e){Ct(t,e),t.reflectivity.value=e.reflectivity,t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness}(w,i):Ct(w,i)):i.isMeshMatcapMaterial?(_t(w,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(w,i)):i.isMeshDepthMaterial?(_t(w,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(w,i)):i.isMeshDistanceMaterial?(_t(w,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(w,i)):i.isMeshNormalMaterial?(_t(w,i),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(w,i)):i.isLineBasicMaterial?(function(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}(w,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(w,i)):i.isPointsMaterial?function(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*H,t.scale.value=.5*W,t.map.value=e.map,null!==e.map&&(!0===e.map.matrixAutoUpdate&&e.map.updateMatrix(),t.uvTransform.value.copy(e.map.matrix))}(w,i):i.isSpriteMaterial?function(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity,t.rotation.value=e.rotation,t.map.value=e.map,null!==e.map&&(!0===e.map.matrixAutoUpdate&&e.map.updateMatrix(),t.uvTransform.value.copy(e.map.matrix))}(w,i):i.isShadowMaterial&&(w.color.value=i.color,w.opacity.value=i.opacity),void 0!==w.ltc_1&&(w.ltc_1.value=te.LTC_1),void 0!==w.ltc_2&&(w.ltc_2.value=te.LTC_2),en.upload(d,r.uniformsList,w,E)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(en.upload(d,r.uniformsList,w,E),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&b.setValue(d,"center",n.center),b.setValue(d,"modelViewMatrix",n.modelViewMatrix),b.setValue(d,"normalMatrix",n.normalMatrix),b.setValue(d,"modelMatrix",n.matrixWorld),x}function _t(t,e){var i;t.opacity.value=e.opacity,e.color&&(t.diffuse.value=e.color),e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.specularMap&&(t.specularMap.value=e.specularMap),e.envMap&&(t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio,t.maxMipLevel.value=v.get(e.envMap).__maxMipLevel),e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity),e.map?i=e.map:e.specularMap?i=e.specularMap:e.displacementMap?i=e.displacementMap:e.normalMap?i=e.normalMap:e.bumpMap?i=e.bumpMap:e.roughnessMap?i=e.roughnessMap:e.metalnessMap?i=e.metalnessMap:e.alphaMap?i=e.alphaMap:e.emissiveMap&&(i=e.emissiveMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}function Tt(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function Ct(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}gt.setAnimationLoop(function(t){ht&&!ht.isPresenting()&&mt&&mt(t)}),void 0!==window&>.setContext(window),this.setAnimationLoop=function(t){mt=t,ht.setAnimationLoop(t),gt.start()},this.render=function(t,e){var i,n;if(void 0!==arguments[2]&&(i=arguments[2]),void 0!==arguments[3]&&(n=arguments[3]),e&&e.isCamera&&!D){z.geometry=null,z.program=null,z.wireframe=!1,k=-1,R=null,!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),ht&&ht.enabled&&(e=ht.getCamera(e)),(u=S.get(t,e)).init(),t.onBeforeRender(E,t,e,i||O),nt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),J.setFromMatrix(nt),it=this.localClippingEnabled,tt=$.init(this.clippingPlanes,it,e),(c=M.get(t,e)).init(),vt(t,e,0,E.sortObjects),c.cleanup(),!0===E.sortObjects&&c.sort(),tt&&$.beginShadows();var r=u.state.shadowsArray;lt.render(r,t,e),u.setupLights(e),tt&&$.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==i&&this.setRenderTarget(i),A.render(c,t,e,n);var a=c.opaque,o=c.transparent;if(t.overrideMaterial){var s=t.overrideMaterial;a.length&&yt(a,t,e,s),o.length&&yt(o,t,e,s)}else a.length&&yt(a,t,e),o.length&&yt(o,t,e);null!==O&&(y.updateRenderTargetMipmap(O),y.updateMultisampleRenderTarget(O)),m.buffers.depth.setTest(!0),m.buffers.depth.setMask(!0),m.buffers.color.setMask(!0),m.setPolygonOffset(!1),t.onAfterRender(E,t,e),ht&&ht.enabled&&ht.submitFrame(),c=null,u=null}},this.allocTextureUnit=function(){var t=j;return f.maxTextures,j+=1,t},this.setTexture2D=(ft=!1,function(t,e){t&&t.isWebGLRenderTarget&&(ft||(ft=!0),t=t.texture),y.setTexture2D(t,e)}),this.setTexture3D=function(t,e){y.setTexture3D(t,e)},this.setTexture=function(){var t=!1;return function(e,i){t||(t=!0),y.setTexture2D(e,i)}}(),this.setTextureCube=function(){var t=!1;return function(e,i){e&&e.isWebGLRenderTargetCube&&(t||(t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?y.setTextureCube(e,i):y.setTextureCubeDynamic(e,i)}}(),this.setFramebuffer=function(t){I=t},this.getRenderTarget=function(){return O},this.setRenderTarget=function(t,e,i){O=t,t&&void 0===v.get(t).__webglFramebuffer&&y.setupRenderTarget(t);var n=I,r=!1;if(t){var a=v.get(t).__webglFramebuffer;t.isWebGLRenderTargetCube?(n=a[e||0],r=!0):n=t.isWebGLMultisampleRenderTarget?v.get(t).__webglMultisampledFramebuffer:a,F.copy(t.viewport),U.copy(t.scissor),G=t.scissorTest}else F.copy(X).multiplyScalar(H),U.copy(q).multiplyScalar(H),G=Z;if(N!==n&&(d.bindFramebuffer(36160,n),N=n),m.viewport(F),m.scissor(U),m.setScissorTest(G),r){var o=v.get(t.texture);d.framebufferTexture2D(36160,36064,34069+e||0,o.__webglTexture,i||0)}},this.readRenderTargetPixels=function(t,e,i,n,r,a){if(t&&t.isWebGLRenderTarget){var o=v.get(t).__webglFramebuffer;if(o){var s=!1;o!==N&&(d.bindFramebuffer(36160,o),s=!0);try{var h=t.texture,l=h.format,c=h.type;if(l!==et&&P.convert(l)!==d.getParameter(35739))return;if(!(c===Y||P.convert(c)===d.getParameter(35738)||c===K&&(f.isWebGL2||p.get("OES_texture_float")||p.get("WEBGL_color_buffer_float"))||c===Q&&(f.isWebGL2?p.get("EXT_color_buffer_float"):p.get("EXT_color_buffer_half_float"))))return;36053===d.checkFramebufferStatus(36160)&&e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&d.readPixels(e,i,n,r,P.convert(l),P.convert(c),a)}finally{s&&d.bindFramebuffer(36160,N)}}}},this.copyFramebufferToTexture=function(t,e,i){var n=e.image.width,r=e.image.height,a=P.convert(e.format);this.setTexture2D(e,0),d.copyTexImage2D(3553,i||0,a,t.x,t.y,n,r,0)},this.copyTextureToTexture=function(t,e,i,n){var r=e.image.width,a=e.image.height,o=P.convert(i.format),s=P.convert(i.type);this.setTexture2D(i,0),e.isDataTexture?d.texSubImage2D(3553,n||0,t.x,t.y,r,a,o,s,e.image.data):d.texSubImage2D(3553,n||0,t.x,t.y,o,s,e.image)}}function qn(t,e){this.name="",this.color=new Qt(t),this.density=void 0!==e?e:25e-5}function Yn(t,e,i){this.name="",this.color=new Qt(t),this.near=void 0!==e?e:1,this.far=void 0!==i?i:1e3}function Zn(){de.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function Jn(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Kn(t,e,i,n){this.data=t,this.itemSize=e,this.offset=i,this.normalized=!0===n}function Qn(t){qe.call(this),this.type="SpriteMaterial",this.color=new Qt(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=!0,this.lights=!1,this.transparent=!0,this.setValues(t)}function $n(t){if(de.call(this),this.type="Sprite",void 0===kn){kn=new Ee;var e=new Jn(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);kn.setIndex([0,1,2,0,2,3]),kn.addAttribute("position",new Kn(e,3,0,!1)),kn.addAttribute("uv",new Kn(e,2,3,!1))}this.geometry=kn,this.material=void 0!==t?t:new Qn,this.center=new St(.5,.5)}function tr(){de.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function er(t,e){t&&t.isGeometry,Qe.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new At,this.bindMatrixInverse=new At}function ir(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{this.boneInverses=[];for(var i=0,n=this.bones.length;i=0?(t(v-l,g,d),p.subVectors(u,d)):(t(v+l,g,d),p.subVectors(d,u)),g-l>=0?(t(v,g-l,d),f.subVectors(u,d)):(t(v,g+l,d),f.subVectors(d,u)),c.crossVectors(p,f).normalize(),s.push(c.x,c.y,c.z),h.push(v,g)}}for(n=0;n.9&&o<.1&&(e<.2&&(a[t+0]+=1),i<.2&&(a[t+2]+=1),n<.2&&(a[t+4]+=1))}}()}(),this.addAttribute("position",new Ae(r,3)),this.addAttribute("normal",new Ae(r.slice(),3)),this.addAttribute("uv",new Ae(a,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}function xr(t,e){ge.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new br(t,e)),this.mergeVertices()}function br(t,e){yr.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function wr(t,e){ge.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new _r(t,e)),this.mergeVertices()}function _r(t,e){yr.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Mr(t,e){ge.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Sr(t,e)),this.mergeVertices()}function Sr(t,e){var i=(1+Math.sqrt(5))/2,n=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1];yr.call(this,n,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ar(t,e){ge.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Tr(t,e)),this.mergeVertices()}function Tr(t,e){var i=(1+Math.sqrt(5))/2,n=1/i,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n];yr.call(this,r,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Lr(t,e,i,n,r,a){ge.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r};var o=new Cr(t,e,i,n,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Cr(t,e,i,n,r){Ee.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r},e=e||64,i=i||1,n=n||8,r=r||!1;var a=t.computeFrenetFrames(e,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,h=new Lt,l=new Lt,c=new St,u=new Lt,d=[],p=[],f=[],m=[];function g(r){u=t.getPointAt(r/e,u);var o=a.normals[r],c=a.binormals[r];for(s=0;s<=n;s++){var f=s/n*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);l.x=g*o.x+m*c.x,l.y=g*o.y+m*c.y,l.z=g*o.z+m*c.z,l.normalize(),p.push(l.x,l.y,l.z),h.x=u.x+i*l.x,h.y=u.y+i*l.y,h.z=u.z+i*l.z,d.push(h.x,h.y,h.z)}}!function(){for(o=0;on.far||r.push({distance:y,point:t.clone(),uv:Je.getUV(t,o,s,h,l,c,u,new St),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return de.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}}),tr.prototype=Object.assign(Object.create(de.prototype),{constructor:tr,copy:function(t){de.prototype.copy.call(this,t,!1);for(var e=t.levels,i=0,n=e.length;i1){t.setFromMatrixPosition(i.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);n[0].object.visible=!0;for(var a=1,o=n.length;a=n[a].distance;a++)n[a-1].object.visible=!1,n[a].object.visible=!0;for(;al||(p.applyMatrix4(this.matrixWorld),(S=n.ray.origin.distanceTo(p))n.far||r.push({distance:S,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this}))}else for(y=0,x=g.length/3-1;yl||(p.applyMatrix4(this.matrixWorld),(S=n.ray.origin.distanceTo(p))n.far||r.push({distance:S,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this}))}else if(o.isGeometry){var _=o.vertices,M=_.length;for(y=0;yl||(p.applyMatrix4(this.matrixWorld),(S=n.ray.origin.distanceTo(p))n.far||r.push({distance:S,point:d.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this}))}}}}}(),copy:function(t){return de.prototype.copy.call(this,t),this.geometry.copy(t.geometry),this.material.copy(t.material),this},clone:function(){return(new this.constructor).copy(this)}}),or.prototype=Object.assign(Object.create(ar.prototype),{constructor:or,isLineSegments:!0,computeLineDistances:function(){var t=new Lt,e=new Lt;return function(){var i=this.geometry;if(i.isBufferGeometry){if(null===i.index){for(var n=i.attributes.position,r=[],a=0,o=n.count;an.far)return;r.push({distance:h,distanceToRay:Math.sqrt(o),point:d.clone(),index:i,face:null,object:a})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),cr.prototype=Object.assign(Object.create(Nt.prototype),{constructor:cr,isVideoTexture:!0,update:function(){var t=this.image;t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),ur.prototype=Object.create(Nt.prototype),ur.prototype.constructor=ur,ur.prototype.isCompressedTexture=!0,dr.prototype=Object.create(Nt.prototype),dr.prototype.constructor=dr,dr.prototype.isCanvasTexture=!0,pr.prototype=Object.create(Nt.prototype),pr.prototype.constructor=pr,pr.prototype.isDepthTexture=!0,fr.prototype=Object.create(Ee.prototype),fr.prototype.constructor=fr,mr.prototype=Object.create(ge.prototype),mr.prototype.constructor=mr,gr.prototype=Object.create(Ee.prototype),gr.prototype.constructor=gr,vr.prototype=Object.create(ge.prototype),vr.prototype.constructor=vr,yr.prototype=Object.create(Ee.prototype),yr.prototype.constructor=yr,xr.prototype=Object.create(ge.prototype),xr.prototype.constructor=xr,br.prototype=Object.create(yr.prototype),br.prototype.constructor=br,wr.prototype=Object.create(ge.prototype),wr.prototype.constructor=wr,_r.prototype=Object.create(yr.prototype),_r.prototype.constructor=_r,Mr.prototype=Object.create(ge.prototype),Mr.prototype.constructor=Mr,Sr.prototype=Object.create(yr.prototype),Sr.prototype.constructor=Sr,Ar.prototype=Object.create(ge.prototype),Ar.prototype.constructor=Ar,Tr.prototype=Object.create(yr.prototype),Tr.prototype.constructor=Tr,Lr.prototype=Object.create(ge.prototype),Lr.prototype.constructor=Lr,Cr.prototype=Object.create(Ee.prototype),Cr.prototype.constructor=Cr,Cr.prototype.toJSON=function(){var t=Ee.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t},Pr.prototype=Object.create(ge.prototype),Pr.prototype.constructor=Pr,Er.prototype=Object.create(Ee.prototype),Er.prototype.constructor=Er,Dr.prototype=Object.create(ge.prototype),Dr.prototype.constructor=Dr,Ir.prototype=Object.create(Ee.prototype),Ir.prototype.constructor=Ir;var Or=function(t,e,i){i=i||2;var n,r,a,o,s,h,l,c=e&&e.length,u=c?e[0]*i:t.length,d=Nr(t,0,u,i,!0),p=[];if(!d)return p;if(c&&(d=function(t,e,i,n){var r,a,o,s=[];for(r=0,a=e.length;r80*i){n=a=t[0],r=o=t[1];for(var f=i;fa&&(a=s),h>o&&(o=h);l=0!==(l=Math.max(a-n,o-r))?1/l:0}return zr(d,p,i,n,r,l),p};function Nr(t,e,i,n,r){var a,o;if(r===function(t,e,i,n){for(var r=0,a=e,o=i-n;a0)for(a=e;a=e;a-=n)o=Qr(a,t[a],t[a+1],o);return o&&Yr(o,o.next)&&($r(o),o=o.next),o}function kr(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!Yr(n,n.next)&&0!==qr(n.prev,n,n.next))n=n.next;else{if($r(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function zr(t,e,i,n,r,a,o){if(t){!o&&a&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=Vr(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,a,o,s,h,l=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,n=i,s=0,e=0;e0||h>0&&n;)0!==s&&(0===h||!n||i.z<=n.z)?(r=i,i=i.nextZ,s--):(r=n,n=n.nextZ,h--),a?a.nextZ=r:t=r,r.prevZ=a,a=r;i=n}a.nextZ=null,l*=2}while(o>1)}(r)}(t,n,r,a);for(var s,h,l=t;t.prev!==t.next;)if(s=t.prev,h=t.next,a?Br(t,n,r,a):Rr(t))e.push(s.i/i),e.push(t.i/i),e.push(h.i/i),$r(t),t=h.next,l=h.next;else if((t=h)===l){o?1===o?zr(t=Fr(t,e,i),e,i,n,r,a,2):2===o&&Ur(t,e,i,n,r,a):zr(kr(t),e,i,n,r,a,1);break}}}function Rr(t){var e=t.prev,i=t,n=t.next;if(qr(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(Hr(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&qr(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Br(t,e,i,n){var r=t.prev,a=t,o=t.next;if(qr(r,a,o)>=0)return!1;for(var s=r.xa.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,c=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,u=Vr(s,h,e,i,n),d=Vr(l,c,e,i,n),p=t.nextZ;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&Hr(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&qr(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=t.prevZ;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&Hr(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&qr(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0}function Fr(t,e,i){var n=t;do{var r=n.prev,a=n.next.next;!Yr(r,a)&&Zr(r,n,n.next,a)&&Jr(r,a)&&Jr(a,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(a.i/i),$r(n),$r(n.next),n=t=a),n=n.next}while(n!==t);return n}function Ur(t,e,i,n,r,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Xr(o,s)){var h=Kr(o,s);return o=kr(o,o.next),h=kr(h,h.next),zr(o,e,i,n,r,a),void zr(h,e,i,n,r,a)}s=s.next}o=o.next}while(o!==t)}function Gr(t,e){return t.x-e.x}function jr(t,e){if(e=function(t,e){var i,n=e,r=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>o){if(o=s,s===r){if(a===n.y)return n;if(a===n.next.y)return n.next}i=n.x=n.x&&n.x>=c&&r!==n.x&&Hr(ai.x)&&Jr(n,t)&&(i=n,d=h),n=n.next;return i}(t,e),e){var i=Kr(e,t);kr(i,i.next)}}function Vr(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Wr(t){var e=t,i=t;do{e.x=0&&(t-o)*(n-s)-(i-o)*(e-s)>=0&&(i-o)*(a-s)-(r-o)*(n-s)>=0}function Xr(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Zr(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&Jr(t,e)&&Jr(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&r<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)}function qr(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Yr(t,e){return t.x===e.x&&t.y===e.y}function Zr(t,e,i,n){return!!(Yr(t,e)&&Yr(i,n)||Yr(t,n)&&Yr(i,e))||qr(t,e,i)>0!=qr(t,e,n)>0&&qr(i,n,t)>0!=qr(i,n,e)>0}function Jr(t,e){return qr(t.prev,t,t.next)<0?qr(t,e,t.next)>=0&&qr(t,t.prev,e)>=0:qr(t,e,t.prev)<0||qr(t,t.next,e)<0}function Kr(t,e){var i=new ta(t.i,t.x,t.y),n=new ta(e.i,e.x,e.y),r=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,a.next=n,n.prev=a,n}function Qr(t,e,i,n){var r=new ta(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function $r(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ta(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ea={area:function(t){for(var e=t.length,i=0,n=e-1,r=0;r2&&t[e-1].equals(t[0])&&t.pop()}function na(t,e){for(var i=0;iNumber.EPSILON){var d=Math.sqrt(c),p=Math.sqrt(h*h+l*l),f=e.x-s/d,m=e.y+o/d,g=((i.x-l/p-f)*l-(i.y+h/p-m)*h)/(o*l-s*h),v=(n=f+o*g-t.x)*n+(r=m+s*g-t.y)*r;if(v<=2)return new St(n,r);a=Math.sqrt(v/2)}else{var y=!1;o>Number.EPSILON?h>Number.EPSILON&&(y=!0):o<-Number.EPSILON?h<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),y?(n=-s,r=o,a=Math.sqrt(c)):(n=o,r=s,a=Math.sqrt(c/2))}return new St(n/a,r/a)}for(var F=[],U=0,G=C.length,j=G-1,V=U+1;U=0;E--){for(I=E/d,O=c*Math.cos(I*Math.PI/2),D=u*Math.sin(I*Math.PI/2),U=0,G=C.length;U=0;){i=U,(n=U-1)<0&&(n=t.length-1);var r=0,a=s+2*d;for(r=0;r0)&&f.push(w,_,S),(h!==i-1||l0&&v(!0),e>0&&v(!1)),this.setIndex(l),this.addAttribute("position",new Ae(c,3)),this.addAttribute("normal",new Ae(u,3)),this.addAttribute("uv",new Ae(d,2))}function _a(t,e,i,n,r,a,o){ba.call(this,0,t,e,i,n,r,a,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function Ma(t,e,i,n,r,a,o){wa.call(this,0,t,e,i,n,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:o}}function Sa(t,e,i,n){ge.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},this.fromBufferGeometry(new Aa(t,e,i,n)),this.mergeVertices()}function Aa(t,e,i,n){Ee.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},t=t||1,e=void 0!==e?Math.max(3,e):8,i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI;var r,a,o=[],s=[],h=[],l=[],c=new Lt,u=new St;for(s.push(0,0,0),h.push(0,0,1),l.push(.5,.5),a=0,r=3;a<=e;a++,r+=3){var d=i+a/e*n;c.x=t*Math.cos(d),c.y=t*Math.sin(d),s.push(c.x,c.y,c.z),h.push(0,0,1),u.x=(s[r]/t+1)/2,u.y=(s[r+1]/t+1)/2,l.push(u.x,u.y)}for(r=1;r<=e;r++)o.push(r,r+1,0);this.setIndex(o),this.addAttribute("position",new Ae(s,3)),this.addAttribute("normal",new Ae(h,3)),this.addAttribute("uv",new Ae(l,2))}ha.prototype=Object.create(ge.prototype),ha.prototype.constructor=ha,la.prototype=Object.create(aa.prototype),la.prototype.constructor=la,ca.prototype=Object.create(ge.prototype),ca.prototype.constructor=ca,ua.prototype=Object.create(Ee.prototype),ua.prototype.constructor=ua,da.prototype=Object.create(ge.prototype),da.prototype.constructor=da,pa.prototype=Object.create(Ee.prototype),pa.prototype.constructor=pa,fa.prototype=Object.create(ge.prototype),fa.prototype.constructor=fa,ma.prototype=Object.create(Ee.prototype),ma.prototype.constructor=ma,ga.prototype=Object.create(ge.prototype),ga.prototype.constructor=ga,ga.prototype.toJSON=function(){var t=ge.prototype.toJSON.call(this);return ya(this.parameters.shapes,t)},va.prototype=Object.create(Ee.prototype),va.prototype.constructor=va,va.prototype.toJSON=function(){var t=Ee.prototype.toJSON.call(this);return ya(this.parameters.shapes,t)},xa.prototype=Object.create(Ee.prototype),xa.prototype.constructor=xa,ba.prototype=Object.create(ge.prototype),ba.prototype.constructor=ba,wa.prototype=Object.create(Ee.prototype),wa.prototype.constructor=wa,_a.prototype=Object.create(ba.prototype),_a.prototype.constructor=_a,Ma.prototype=Object.create(wa.prototype),Ma.prototype.constructor=Ma,Sa.prototype=Object.create(ge.prototype),Sa.prototype.constructor=Sa,Aa.prototype=Object.create(Ee.prototype),Aa.prototype.constructor=Aa;var Ta=Object.freeze({WireframeGeometry:fr,ParametricGeometry:mr,ParametricBufferGeometry:gr,TetrahedronGeometry:xr,TetrahedronBufferGeometry:br,OctahedronGeometry:wr,OctahedronBufferGeometry:_r,IcosahedronGeometry:Mr,IcosahedronBufferGeometry:Sr,DodecahedronGeometry:Ar,DodecahedronBufferGeometry:Tr,PolyhedronGeometry:vr,PolyhedronBufferGeometry:yr,TubeGeometry:Lr,TubeBufferGeometry:Cr,TorusKnotGeometry:Pr,TorusKnotBufferGeometry:Er,TorusGeometry:Dr,TorusBufferGeometry:Ir,TextGeometry:ha,TextBufferGeometry:la,SphereGeometry:ca,SphereBufferGeometry:ua,RingGeometry:da,RingBufferGeometry:pa,PlaneGeometry:Oe,PlaneBufferGeometry:Ne,LatheGeometry:fa,LatheBufferGeometry:ma,ShapeGeometry:ga,ShapeBufferGeometry:va,ExtrudeGeometry:ra,ExtrudeBufferGeometry:aa,EdgesGeometry:xa,ConeGeometry:_a,ConeBufferGeometry:Ma,CylinderGeometry:ba,CylinderBufferGeometry:wa,CircleGeometry:Sa,CircleBufferGeometry:Aa,BoxGeometry:De,BoxBufferGeometry:Ie});function La(t){qe.call(this),this.type="ShadowMaterial",this.color=new Qt(0),this.transparent=!0,this.setValues(t)}function Ca(t){Ye.call(this,t),this.type="RawShaderMaterial"}function Pa(t){qe.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Qt(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ea(t){Pa.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function Da(t){qe.call(this),this.type="MeshPhongMaterial",this.color=new Qt(16777215),this.specular=new Qt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ia(t){Da.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Oa(t){qe.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Na(t){qe.call(this),this.type="MeshLambertMaterial",this.color=new Qt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function ka(t){qe.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Qt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new St(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.lights=!1,this.setValues(t)}function za(t){rr.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}La.prototype=Object.create(qe.prototype),La.prototype.constructor=La,La.prototype.isShadowMaterial=!0,La.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.color.copy(t.color),this},Ca.prototype=Object.create(Ye.prototype),Ca.prototype.constructor=Ca,Ca.prototype.isRawShaderMaterial=!0,Pa.prototype=Object.create(qe.prototype),Pa.prototype.constructor=Pa,Pa.prototype.isMeshStandardMaterial=!0,Pa.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ea.prototype=Object.create(Pa.prototype),Ea.prototype.constructor=Ea,Ea.prototype.isMeshPhysicalMaterial=!0,Ea.prototype.copy=function(t){return Pa.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},Da.prototype=Object.create(qe.prototype),Da.prototype.constructor=Da,Da.prototype.isMeshPhongMaterial=!0,Da.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ia.prototype=Object.create(Da.prototype),Ia.prototype.constructor=Ia,Ia.prototype.isMeshToonMaterial=!0,Ia.prototype.copy=function(t){return Da.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},Oa.prototype=Object.create(qe.prototype),Oa.prototype.constructor=Oa,Oa.prototype.isMeshNormalMaterial=!0,Oa.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Na.prototype=Object.create(qe.prototype),Na.prototype.constructor=Na,Na.prototype.isMeshLambertMaterial=!0,Na.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},ka.prototype=Object.create(qe.prototype),ka.prototype.constructor=ka,ka.prototype.isMeshMatcapMaterial=!0,ka.prototype.copy=function(t){return qe.prototype.copy.call(this,t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},za.prototype=Object.create(rr.prototype),za.prototype.constructor=za,za.prototype.isLineDashedMaterial=!0,za.prototype.copy=function(t){return rr.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var Ra=Object.freeze({ShadowMaterial:La,SpriteMaterial:Qn,RawShaderMaterial:Ca,ShaderMaterial:Ye,PointsMaterial:hr,MeshPhysicalMaterial:Ea,MeshStandardMaterial:Pa,MeshPhongMaterial:Da,MeshToonMaterial:Ia,MeshNormalMaterial:Oa,MeshLambertMaterial:Na,MeshDepthMaterial:An,MeshDistanceMaterial:Tn,MeshBasicMaterial:Ke,MeshMatcapMaterial:ka,LineDashedMaterial:za,LineBasicMaterial:rr,Material:qe}),Ba={arraySlice:function(t,e,i){return Ba.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,i=new Array(e),n=0;n!==e;++n)i[n]=n;return i.sort(function(e,i){return t[e]-t[i]}),i},sortedArray:function(t,e,i){for(var n=t.length,r=new t.constructor(n),a=0,o=0;o!==n;++a)for(var s=i[a]*e,h=0;h!==e;++h)r[o++]=t[s+h];return r},flattenJSON:function(t,e,i,n){for(var r=1,a=t[0];void 0!==a&&void 0===a[n];)a=t[r++];if(void 0!==a){var o=a[n];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[n])&&(e.push(a.time),i.push.apply(i,o)),a=t[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[n])&&(e.push(a.time),o.toArray(i,i.length)),a=t[r++]}while(void 0!==a);else do{void 0!==(o=a[n])&&(e.push(a.time),i.push(o)),a=t[r++]}while(void 0!==a)}}};function Fa(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i}function Ua(t,e,i,n){Fa.call(this,t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Ga(t,e,i,n){Fa.call(this,t,e,i,n)}function ja(t,e,i,n){Fa.call(this,t,e,i,n)}function Va(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ba.convertArray(e,this.TimeBufferType),this.values=Ba.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}function Wa(t,e,i){Va.call(this,t,e,i)}function Ha(t,e,i,n){Va.call(this,t,e,i,n)}function Xa(t,e,i,n){Va.call(this,t,e,i,n)}function qa(t,e,i,n){Fa.call(this,t,e,i,n)}function Ya(t,e,i,n){Va.call(this,t,e,i,n)}function Za(t,e,i,n){Va.call(this,t,e,i,n)}function Ja(t,e,i,n){Va.call(this,t,e,i,n)}function Ka(t,e,i){this.name=t,this.tracks=i,this.duration=void 0!==e?e:-1,this.uuid=Mt.generateUUID(),this.duration<0&&this.resetDuration()}function Qa(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Xa;case"vector":case"vector2":case"vector3":case"vector4":return Ja;case"color":return Ha;case"quaternion":return Ya;case"bool":case"boolean":return Wa;case"string":return Za}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){var i=[],n=[];Ba.flattenJSON(t.keys,i,n,"value"),t.times=i,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}Object.assign(Fa.prototype,{evaluate:function(t){var e=this.parameterPositions,i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{var a;i:{n:if(!(t=r)break t;var s=e[1];for(t=(r=e[--i-1]))break e}a=i,i=0}for(;i>>1;te;)--a;if(++a,0!==r||a!==n){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Ba.arraySlice(i,r,a),this.values=Ba.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(t=!1);var i=this.times,n=this.values,r=i.length;0===r&&(t=!1);for(var a=null,o=0;o!==r;o++){var s=i[o];if("number"==typeof s&&isNaN(s)){t=!1;break}if(null!==a&&a>s){t=!1;break}a=s}if(void 0!==n&&Ba.isTypedArray(n)){o=0;for(var h=n.length;o!==h;++o){var l=n[o];if(isNaN(l)){t=!1;break}}}return t},optimize:function(){for(var t=this.times,e=this.values,i=this.getValueSize(),n=this.getInterpolation()===mt,r=1,a=t.length-1,o=1;o0){for(t[r]=t[a],f=a*i,m=r*i,d=0;d!==i;++d)e[m+d]=e[f+d];++r}return r!==t.length&&(this.times=Ba.arraySlice(t,0,r),this.values=Ba.arraySlice(e,0,r*i)),this},clone:function(){var t=Ba.arraySlice(this.times,0),e=Ba.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}),Wa.prototype=Object.assign(Object.create(Va.prototype),{constructor:Wa,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:pt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ha.prototype=Object.assign(Object.create(Va.prototype),{constructor:Ha,ValueTypeName:"color"}),Xa.prototype=Object.assign(Object.create(Va.prototype),{constructor:Xa,ValueTypeName:"number"}),qa.prototype=Object.assign(Object.create(Fa.prototype),{constructor:qa,interpolate_:function(t,e,i,n){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,h=(i-e)/(n-e),l=s+o;s!==l;s+=4)Tt.slerpFlat(r,0,a,s-o,a,s,h);return r}}),Ya.prototype=Object.assign(Object.create(Va.prototype),{constructor:Ya,ValueTypeName:"quaternion",DefaultInterpolation:ft,InterpolantFactoryMethodLinear:function(t){return new qa(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),Za.prototype=Object.assign(Object.create(Va.prototype),{constructor:Za,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:pt,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ja.prototype=Object.assign(Object.create(Va.prototype),{constructor:Ja,ValueTypeName:"vector"}),Object.assign(Ka,{parse:function(t){for(var e=[],i=t.tracks,n=1/(t.fps||1),r=0,a=i.length;r!==a;++r)e.push(Qa(i[r]).scale(n));return new Ka(t.name,t.duration,e)},toJSON:function(t){for(var e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid},r=0,a=i.length;r!==a;++r)e.push(Va.toJSON(i[r]));return n},CreateFromMorphTargetSequence:function(t,e,i,n){for(var r=e.length,a=[],o=0;o1){var l=n[u=h[1]];l||(n[u]=l=[]),l.push(s)}}var c=[];for(var u in n)c.push(Ka.CreateFromMorphTargetSequence(u,n[u],e,i));return c},parseAnimation:function(t,e){if(!t)return null;for(var i=function(t,e,i,n,r){if(0!==i.length){var a=[],o=[];Ba.flattenJSON(i,a,o,n),0!==a.length&&r.push(new t(e,a,o))}},n=[],r=t.name||"default",a=t.length||-1,o=t.fps||30,s=t.hierarchy||[],h=0;h0||0===t.search(/^data\:image\/jpeg/);r.format=n?tt:et,r.needsUpdate=!0,void 0!==e&&e(r)},i,n),r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(co.prototype,{getPoint:function(){return null},getPointAt:function(t,e){var i=this.getUtoTmapping(t);return this.getPoint(i,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPoint(i/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,i,n=[],r=this.getPoint(0),a=0;for(n.push(0),i=1;i<=t;i++)a+=(e=this.getPoint(i/t)).distanceTo(r),n.push(a),r=e;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var i,n=this.getLengths(),r=0,a=n.length;i=e||t*n[a-1];for(var o,s=0,h=a-1;s<=h;)if((o=n[r=Math.floor(s+(h-s)/2)]-i)<0)s=r+1;else{if(!(o>0)){h=r;break}h=r-1}if(n[r=h]===i)return r/(a-1);var l=n[r];return(r+(i-l)/(n[r+1]-l))/(a-1)},getTangent:function(t){var e=1e-4,i=t-e,n=t+e;i<0&&(i=0),n>1&&(n=1);var r=this.getPoint(i);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var i,n,r,a=new Lt,o=[],s=[],h=[],l=new Lt,c=new At;for(i=0;i<=t;i++)n=i/t,o[i]=this.getTangentAt(n),o[i].normalize();s[0]=new Lt,h[0]=new Lt;var u=Number.MAX_VALUE,d=Math.abs(o[0].x),p=Math.abs(o[0].y),f=Math.abs(o[0].z);for(d<=u&&(u=d,a.set(1,0,0)),p<=u&&(u=p,a.set(0,1,0)),f<=u&&a.set(0,0,1),l.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],l),h[0].crossVectors(o[0],s[0]),i=1;i<=t;i++)s[i]=s[i-1].clone(),h[i]=h[i-1].clone(),l.crossVectors(o[i-1],o[i]),l.length()>Number.EPSILON&&(l.normalize(),r=Math.acos(Mt.clamp(o[i-1].dot(o[i]),-1,1)),s[i].applyMatrix4(c.makeRotationAxis(l,r))),h[i].crossVectors(o[i],s[i]);if(!0===e)for(r=Math.acos(Mt.clamp(s[0].dot(s[t]),-1,1)),r/=t,o[0].dot(l.crossVectors(s[0],s[t]))>0&&(r=-r),i=1;i<=t;i++)s[i].applyMatrix4(c.makeRotationAxis(o[i],r*i)),h[i].crossVectors(o[i],s[i]);return{tangents:o,normals:s,binormals:h}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),uo.prototype=Object.create(co.prototype),uo.prototype.constructor=uo,uo.prototype.isEllipseCurve=!0,uo.prototype.getPoint=function(t,e){for(var i=e||new St,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)n;)r-=n;r0?0:(Math.floor(Math.abs(c)/h)+1)*h:0===u&&c===h-1&&(c=h-2,u=1),this.closed||c>0?i=s[(c-1)%h]:(mo.subVectors(s[0],s[1]).add(s[0]),i=mo),n=s[c%h],r=s[(c+1)%h],this.closed||c+2n.length-2?n.length-1:a+1],c=n[a>n.length-3?n.length-1:a+2];return i.set(bo(o,s.x,h.x,l.x,c.x),bo(o,s.y,h.y,l.y,c.y)),i},Po.prototype.copy=function(t){co.prototype.copy.call(this,t),this.points=[];for(var e=0,i=t.points.length;e=e){var r=i[n]-e,a=this.curves[n],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}n++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,i=0,n=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},copy:function(t){co.prototype.copy.call(this,t),this.curves=[];for(var e=0,i=t.curves.length;e0){var l=h.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(h);var c=h.getPoint(1);return this.currentPoint.copy(c),this},copy:function(t){return Do.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this},toJSON:function(){var t=Do.prototype.toJSON.call(this);return t.currentPoint=this.currentPoint.toArray(),t},fromJSON:function(t){return Do.prototype.fromJSON.call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}),Oo.prototype=Object.assign(Object.create(Io.prototype),{constructor:Oo,getPointsHoles:function(t){for(var e=[],i=0,n=this.holes.length;i0){var a=new so(new to(e));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=t.length;o0?new er(o,s):new Qe(o,s),void 0!==t.drawMode&&n.setDrawMode(t.drawMode);break;case"LOD":n=new tr;break;case"Line":n=new ar(r(t.geometry),a(t.material),t.mode);break;case"LineLoop":n=new sr(r(t.geometry),a(t.material));break;case"LineSegments":n=new or(r(t.geometry),a(t.material));break;case"PointCloud":case"Points":n=new lr(r(t.geometry),a(t.material));break;case"Sprite":n=new $n(a(t.material));break;case"Group":n=new Dn;break;default:n=new de}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(n.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(n.matrixAutoUpdate=t.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.frustumCulled&&(n.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(n.renderOrder=t.renderOrder),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.layers&&(n.layers.mask=t.layers),void 0!==t.children)for(var h=t.children,l=0;lNumber.EPSILON){if(l<0&&(o=e[a],h=-h,s=e[r],l=-l),t.ys.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var c=l*(t.x-o.x)-h*(t.y-o.y);if(0===c)return!0;if(c<0)continue;n=!n}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return n}var r=ea.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===e)return i(a);var o,s,h,l=[];if(1===a.length)return s=a[0],(h=new Oo).curves=s.curves,l.push(h),l;var c=!r(a[0].getPoints());c=t?!c:c;var u,d,p=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=a.length;v1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)p[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],S=0;S0&&(x||(m=p))}v=0;for(var C=f.length;v0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t=.5)for(var a=0;a!==r;++a)t[e+a]=t[i+a]},_slerp:function(t,e,i,n){Tt.slerpFlat(t,e,t,e,t,i,n)},_lerp:function(t,e,i,n,r){for(var a=1-n,o=0;o!==r;++o){var s=e+o;t[s]=t[s]*a+t[i+o]*n}}});var bs,ws,_s,Ms,Ss,As,Ts,Ls,Cs,Ps,Es,Ds,Is,Os="\\[\\]\\.:\\/";function Ns(t,e,i){var n=i||ks.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}function ks(t,e,i){this.path=e,this.parsedPath=i||ks.parseTrackName(e),this.node=ks.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function zs(){this.uuid=Mt.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}function Rs(t,e,i){this._mixer=t,this._clip=e,this._localRoot=i||null;for(var n=e.tracks,r=n.length,a=new Array(r),o={endingStart:gt,endingEnd:gt},s=0;s!==r;++s){var h=n[s].createInterpolant(null);a[s]=h,h.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Bs(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Fs(t){"string"==typeof t&&(t=arguments[1]),this.value=t}function Us(){Ee.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Gs(t,e,i){Jn.call(this,t,e),this.meshPerAttribute=i||1}function js(t,e,i,n){"number"==typeof i&&(n=i,i=!1),ve.call(this,t,e,i),this.meshPerAttribute=n||1}function Vs(t,e,i,n){this.ray=new Ze(t,e),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return this.Points}}})}function Ws(t,e){return t.distance-e.distance}function Hs(t,e,i,n){if(!1!==t.visible&&(t.raycast(e,i),!0===n))for(var r=t.children,a=0,o=r.length;a=e){var c=e++,u=t[c];i[u.uuid]=l,t[l]=u,i[h]=c,t[c]=s;for(var d=0,p=r;d!==p;++d){var f=n[d],m=f[c],g=f[l];f[l]=m,f[c]=g}}}this.nCachedObjects_=e},uncache:function(){for(var t=this._objects,e=t.length,i=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var h=arguments[o].uuid,l=n[h];if(void 0!==l)if(delete n[h],l0)for(var h=this._interpolants,l=this._propertyBindings,c=0,u=h.length;c!==u;++c)h[c].evaluate(o),l[c].accumulate(n,s)}else this._updateWeight(t)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var i=this._weightInterpolant;if(null!==i){var n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var i=this._timeScaleInterpolant;null!==i&&(e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t,i=this._clip.duration,n=this.loop,r=this._loopCount,a=2202===n;if(0===t)return-1===r||!a||1&~r?e:i-e;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=i)e=i;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),e>=i||e<0){var o=Math.floor(e/i);e-=i*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var h=t<0;this._setEndings(h,!h,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&!(1&~r))return this.time=e,i-e}return this.time=e,e},_setEndings:function(t,e,i){var n=this._interpolantSettings;i?(n.endingStart=vt,n.endingEnd=vt):(n.endingStart=t?this.zeroSlopeAtStart?vt:gt:yt,n.endingEnd=e?this.zeroSlopeAtEnd?vt:gt:yt)},_scheduleFading:function(t,e,i){var n=this._mixer,r=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=e,o[1]=r+t,s[1]=i,this}}),Bs.prototype=Object.assign(Object.create(g.prototype),{constructor:Bs,_bindAction:function(t,e){var i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,a=t._propertyBindings,o=t._interpolants,s=i.uuid,h=this._bindingsByRootAndName,l=h[s];void 0===l&&(l={},h[s]=l);for(var c=0;c!==r;++c){var u=n[c],d=u.name,p=l[d];if(void 0!==p)a[c]=p;else{if(void 0!==(p=a[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[c].binding.parsedPath;++(p=new xs(ks.create(i,d,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[c]=p}o[c].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}for(var r=t._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,i=0,n=e.length;i!==n;++i){var r=e[i];0===--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&ethis.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return void 0===e&&(e=new St),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return void 0===e&&(e=new St),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new St;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(Zs.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(t=new Lt),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(t=new Lt),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(e=new Lt),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new Lt,e=new Lt;return function(i,n){t.subVectors(i,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),a=e.dot(t)/r;return n&&(a=Mt.clamp(a,0,1)),a}}(),closestPointToPoint:function(t,e,i){var n=this.closestPointToPointParameter(t,e);return void 0===i&&(i=new Lt),this.delta(i).multiplyScalar(n).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Js.prototype=Object.create(de.prototype),Js.prototype.constructor=Js,Js.prototype.isImmediateRenderObject=!0,Ks.prototype=Object.create(or.prototype),Ks.prototype.constructor=Ks,Ks.prototype.update=function(){var t=new Lt,e=new Lt,i=new Ct;return function(){var n=["a","b","c"];this.object.updateMatrixWorld(!0),i.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry;if(o&&o.isGeometry)for(var s=o.vertices,h=o.faces,l=0,c=0,u=h.length;c1&&t.multiplyScalar(1/e),this.children[0].material.color.copy(this.material.color)}},ih.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()},nh.prototype=Object.create(de.prototype),nh.prototype.constructor=nh,nh.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},nh.prototype.update=function(){var t=new Lt,e=new Qt,i=new Qt;return function(){var n=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var r=n.geometry.getAttribute("color");e.copy(this.light.color),i.copy(this.light.groundColor);for(var a=0,o=r.count;a.99999?this.quaternion.set(0,0,0,1):t.y<-.99999?this.quaternion.set(1,0,0,0):(Is.set(t.z,0,-t.x).normalize(),Ds=Math.acos(t.y),this.quaternion.setFromAxisAngle(Is,Ds))}),ph.prototype.setLength=function(t,e,i){void 0===e&&(e=.2*t),void 0===i&&(i=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()},ph.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},ph.prototype.copy=function(t){return de.prototype.copy.call(this,t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this},ph.prototype.clone=function(){return(new this.constructor).copy(this)},fh.prototype=Object.create(or.prototype),fh.prototype.constructor=fh,co.create=function(t,e){return t.prototype=Object.create(co.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Object.assign(Do.prototype,{createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new ge,i=0,n=t.length;it()),t.tmpEvents.length=0,delete t.tmpEvents)}}}),t.on=function(i,n){var r=[].concat(i);function a(){r.forEach(e=>{t.off(e,n)})}return r.forEach(t=>{(e[t]=e[t]||[]).push(n)}),t.tmpEventMode&&(t.tmpEvents||(t.tmpEvents=[]),t.tmpEvents.push(a)),a},t.clearHandlers=function(t){t?(e[t]={},delete i[t]):(e={},i={})},t.once=function(e,i){function n(){i.apply(t.off(e,n),arguments)}return n.h=i,t.on(e,n)},t.off=function(n,r){for(var a=e[n],o=0;r&&a&&a[o];o++)a[o]!=r&&a[o].h!=r||a.splice(o--,1);return r||(delete e[n],delete i[n]),t},t.emit=function(n){if(!1===i[n])return t;t.__events||(t.__events={}),t.__events[n]=n;for(var r=e[n],a=0;r&&r[a];)r[a++].apply(t,r.slice.call(arguments,1));return t},t}},wh=globalThis.TWEEN||(xh=[],{getAll:function(){return xh},removeAll:function(){xh=[]},add:function(t){xh.push(t)},remove:function(t){var e=xh.indexOf(t);-1!==e&&xh.splice(e,1)},update:function(t,e){if(0===xh.length)return!1;var i=0;for(t=void 0!==t?t:wh.now();i(i===n.length-2?r=t[e]:i===n.length-1&&(a=e),t[e]),t),Object.defineProperty(this,e,{get:function(){return r[a]},set:function(t){r[a]=t}}),i}return i},this.setProp=function(t,e,i){if(t[e])t[e]=i;else if(e in this)this[e]=i;else{for(var n=e.split("."),r=t,a=n.length-1,o=0;o=1?1:x,b=d(x),r)if(!(l.indexOf(".")<0&&this.props.indexOf(l)<0)&&void 0!==this.getProp(n,l)){var w=this.clonePropertyValue(n,l)||0,_=this.getProp(r,l);if(_ instanceof Array)i[l]=p(_,b);else if("string"==typeof _&&(_="+"===_.charAt(0)||"-"===_.charAt(0)?w+parseFloat(_):parseFloat(_)),"number"==typeof _){var M=w+(_-w)*b;l.indexOf(".")<0?i[l]=M:this.setProp(i,l,M)}else this.threeInterpolation(w,_,b),this.getProp(i,l).copy(w)}if(null!==v&&v.call(i,b,i),1===x){if(s>0){for(l in isFinite(s)&&s--,a){if("string"==typeof r[l]&&(a[l]=a[l]+parseFloat(r[l])),h){var S=this.clonePropertyValue(a,l);a[l]=this.clonePropertyValue(r,l),r[l]=S}n[l]=this.clonePropertyValue(a,l)}return u=void 0!==e?t+e:t+c,!0}null!==y&&y.call(i,i);for(var A=0,T=f.length;A1?a(t[i],t[i-1],i-n):a(t[r],t[r+1>i?i:r+1],n-r)},Bezier:function(t,e){for(var i=0,n=t.length-1,r=Math.pow,a=wh.Interpolation.Utils.Bernstein,o=0;o<=n;o++)i+=r(1-e,n-o)*r(e,o)*t[o]*a(n,o);return i},CatmullRom:function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n),a=wh.Interpolation.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(r=Math.floor(n=i*(1+e))),a(t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i],n-r)):e<0?t[0]-(a(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[i]-(a(t[i],t[i],t[i-1],t[i-1],n-i)-t[i]):a(t[r?r-1:0],t[r],t[i1;n--)i*=n;return t[e]=i,i}}(),CatmullRom:function(t,e,i,n,r){var a=.5*(i-t),o=.5*(n-e),s=r*r;return(2*e-2*i+a+o)*(r*s)+(-3*e+3*i-2*a-o)*s+a*r+e}}},wh.getEasingByName=function(t){var e=t.replace(/in|out/gi,"");e=e[0].toUpperCase()+e.slice(1);var i=t.toLowerCase(),n="Out";return i.endsWith("in")?n="In":i.endsWith("inout")&&(n="InOut"),wh.Easing[e]?wh.Easing[e][n]:wh.Easing.Linear.None},wh.getBaseTween=function(t){t=Object.assign({delay:0,duration:1e3,easing:"cubicOut",inverse:!1},t);var e=new wh.Tween({i:t.inverse?1:0}).delay(t.delay).to({i:t.inverse?0:1},t.duration).easing(wh.getEasingByName(t.easing)).onStart(()=>{t.start&&t.start()}).onStop(()=>{t.start&&t.stop()}).onUpdate((e,i)=>{t.update&&t.update(e,i)}).onComplete(()=>{t.complete&&t.complete()});return e},wh.getTween=function(t,e,i){if(t&&e){i=Object.assign({delay:0,duration:1e3,easing:"cubicOut"},i);var n=[];Object.keys(e).forEach(t=>{_h.indexOf(t)<0&&n.push(t)}),n.length&&(e.props=n);var r=new wh.Tween(t).delay(i.delay).to(e,i.duration).easing(wh.getEasingByName(i.easing)).onStart(()=>{i.start&&i.start()}).onStop(()=>{i.stop&&i.stop()}).onUpdate((t,e)=>{i.update&&i.update(t,e)}).onComplete(()=>{i.complete&&i.complete()});return r}};const Mh=Math.PI,Sh=3e3*Mh/180,Ah=6378137,Th=.006693421622965943;function Lh(t,e){var i=t-.0065,n=e-.006,r=Math.sqrt(i*i+n*n)-2e-5*Math.sin(n*Sh),a=Math.atan2(n,i)-3e-6*Math.cos(i*Sh),o=r*Math.cos(a);return{lat:r*Math.sin(a),lng:o}}function Ch(t,e){if(Oh(e,t))return{lng:t,lat:e};var i=Eh(t-105,e-35),n=Ih(t-105,e-35),r=e/180*Mh,a=Math.sin(r);a=1-Th*a*a;var o=Math.sqrt(a);return i=180*i/(Ah*(1-Th)/(a*o)*Mh),{lng:2*t-(t+(n=180*n/(Ah/o*Math.cos(r)*Mh))),lat:2*e-(e+i)}}function Ph(t,e){var i=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return i+=2*(20*Math.sin(6*t*Mh)+20*Math.sin(2*t*Mh))/3,i+=2*(20*Math.sin(e*Mh)+40*Math.sin(e/3*Mh))/3,i+=2*(160*Math.sin(e/12*Mh)+320*Math.sin(e*Mh/30))/3}var Eh=Ph;function Dh(t,e){var i=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return i+=2*(20*Math.sin(6*t*Mh)+20*Math.sin(2*t*Mh))/3,i+=2*(20*Math.sin(t*Mh)+40*Math.sin(t/3*Mh))/3,i+=2*(150*Math.sin(t/12*Mh)+300*Math.sin(t/30*Mh))/3}var Ih=Dh;function Oh(t,e){return e<72.004||e>137.8347||t<.8293||t>55.8271}class Nh{constructor(){this.callbacks=[],this.alldoneArr=[],this.type="OMPromise",this.id=Math.random().toString().slice(2),this.__done=!1,this.__index=0,this.id=Math.random().toString().slice(2)}delay(t){var e=new this.constructor;return setTimeout(function(){e.resolve()},t),e}addAlldone(t){this.alldoneArr.push(t)}alldone(t){this.alldoneArr.forEach(e=>{e(t,this.__index)})}destroy(){this.callbacks.length=this.alldoneArr.length=0}then(t){return this.callbacks.push(t),this}_hasIndex(t){return t}resolve(t){var e=this,i=null,n=!1;setTimeout(()=>{var r=e._hasIndex(i||t);if(!e.callbacks.length)return e.alldone(r),e.destroy(),void(e.__done=!0);for(var a=0;a!t.__done);var prom=new Nh,i=0,n=[];function r(r,a){i++,n.push({value:r,index:a}),i===t.length&&(!1!==e&&n.sort((t,e)=>t.index-e.index),prom.resolve(n.map(t=>t.value)))}return t.forEach((t,e)=>{t.__index=e,t.addAlldone(r)}),prom};var kh={log:console.log,warn:console.warn,error:console.error,cloneJSON:t=>JSON.parse(JSON.stringify(t)),addToken:function(t,e){return t.config.params?e+=this.getParamsStr(t.config.params):t.token&&(e+="?token="+t.token),e},getResourceUrl(t,e,i,n=!0,r="",a=null){var o=/[a-z0-9]{18,36}/.test(i),s="",h="",l=o?".omm":".glb";if(t.config.standalone?(h=t.config.baseUrl).endsWith("/")||(h+="/"):h=t.config.server,!n&&r&&!o){if("function"==typeof r)return r(i,e,a);h=r}return t.config.standalone?i.indexOf("/")>-1?i:!o&&r?`${r}${i}.glb`:`${h}${t.config.appID}/${n?"assets/images/":"assets/models/"}${i}${n?".omi":l}`:(i.indexOf("/")>-1?s=i:(s=`${h}${!r||o?n?"resources/image/":"resources/model/":""}${i}`,s+=n?".omi":l),s)},getParamsStr(t){var e="";return Object.keys(t).forEach((i,n)=>{0===n&&(e="?"),n>0&&(e+="&"),e+=i+"="+encodeURIComponent(t[i])}),e},getSuper:t=>Object.getPrototypeOf(t.constructor.prototype),findFromArray(t,e,i,n){for(var r=0;r{void 0===e[n]&&(e[n]=t[i][n])})},colorToStr:t=>"number"==typeof t?"#"+("000000"+t.toString(16)).slice(-6):t,loadTexture:function(){var t=new lo;function e(t){return t&&!(t&t-1)}return function(i,n,r,a){return t.load(i,t=>{var i=e(t.image.width),r=e(t.image.height);i&&r&&(t.wrapS=t.wrapT=F,t.needsUpdate=!0),n&&n(t)},r,a)}}(),loadImageBitmapTexture:function(){var t=new rs;function e(t){return t&&!(t&t-1)}return t.setOptions({imageOrientation:"flipY"}),function(i,n,r,a){return t.load(i,t=>{var i=new dr(t),r=e(i.image.width),a=e(i.image.height);r&&a&&(i.wrapS=i.wrapT=F,i.needsUpdate=!0),n&&n(i)},r,a)}}(),getZoomFactor(t,e){var i=t.view.currentCamera,n=t.view.getRealHeight();if(i instanceof On){var r=n/2,a=e?e.distanceTo(i.position):t.view.controls.getDistance(),o=t.view.camera.fov*Math.PI/180/2;return Math.tan(o)*a/r}if(i instanceof Uo)return 2*i.top/i.zoom/n},getCameraDataByZoom(t,e){var i=e/t.view.pixelsPerCentimeter/100,n=t.view.getRealHeight()/2*i;return{distance:n/Math.tan(t.view.camera.fov*Mt.DEG2RAD/2),top:n}},getCamera2DSize(t,e){var i=t.view.camera.fov,n=t.view.camera.aspect,r=e||t.view.controls.getDistance(),a=Math.tan(i*Math.PI/180/2)*r;return{top:a||1,right:2*a*n/2,distance:r}},getBBoxOfObjects(t){var e=new Ut;return t.forEach(t=>{t.isLine2?(e.expandByPoint(t.geometry.boundingBox.min),e.expandByPoint(t.geometry.boundingBox.max)):t.geometry||t.children&&t.children.length?e.expandByObject(t):e.expandByPoint(t.point||t.position)}),e},getBoundingSphere(t){var e=new Gt;return t=[].concat(t),this.getBBoxOfObjects(t).getBoundingSphere(e),e},focusObject(t,e,i,n,r,a,o){var s=new Gt;if(e=[].concat(e),this.getBBoxOfObjects(e).getBoundingSphere(s),0===s.radius){if(1===e.length)s.center=e[0].position.clone();else{var h=new Lt;e.forEach(t=>{h.add(t.position)}),h.divideScalar(e.length),s.center=h}s.radius=20}return kh.fitView(t,s.center,s.radius,i,n,r,a,o)},getZoomByRadius:(t,e,i=1.3)=>e*i*2*100/(t.view.width/t.view.pixelsPerCentimeter),fitView(t,e,i,n,r,a,o,s,h){r=void 0===r?t.config.animateDuration:r;var l=0,c=i*(a=a||1.3)*2*100/((h||t.view.width)/t.view.pixelsPerCentimeter);function u(){2==++l&&n&&n()}s&&(c=Math.max(c,s)),t.view.moveTo({viewCenter:e,duration:r,polarAngle:o,easing:wh.Easing.Quartic.Out,callback:u}),t.view.zoom={zoom:c,duration:r,easing:wh.Easing.Quartic.Out,callback:u}},buildCurvePoints(t,e,i){if(t.length>=3){var n=Math.PI/10,r=Math.PI-n,a=i||1,o=null==e?3:e;if(0==o)return t;for(var s=1/o,h=[],l=0;ln&&ma&&v>a){var y=u.clone().lerp(c,a/g),x=u.clone().lerp(d,a/v);h.push(y);for(var b=s;b<.999999;b+=s){var w=b,_=y.clone().lerp(u,w),M=u.clone().lerp(x,w);h.push(_.lerp(M,w))}t[l+1]=x,l++}else h.push(u),l++;l==t.length-2&&h.push(d)}return h}return t.map(t=>t.clone())},vector3ToScreen(t,e){var i=e.project(t.view.currentCamera);return i.x=(i.x+1)/2*t.view.width/t.view.sizeRate,i.y=-(i.y-1)/2*t.view.height/t.view.sizeRate,i},getPointByDistance(t,e){for(var i,n,r=null,a=0,o=t.length,s={point:null,vector:null,isOver:!1,index:0},h=0;h0&&(a+=i=(n=l.clone().sub(r)).length())>=e)return s.vector=n.normalize(),s.point=r.clone().add(s.vector.clone().multiplyScalar(e-a+i)),s.index=h,s;r=l.clone()}return s.vector=n.normalize(),s.point=t[o-1].clone(),s.isOver=!0,s.index=o-1,s},getMouse(t,e){var i,n=e.config.container;i={top:0,left:0,width:n.width/e.view.pixelRatio,height:n.height/e.view.pixelRatio};var r=new St,a=null;t.touches&&t.touches.length>0?a=t.touches:t.changedTouches&&t.changedTouches.length>0&&(a=t.changedTouches);let o=t.clientX,s=t.clientY;return a&&(o=a[0].clientX,s=a[0].clientY,"x"in a[0]&&(o=a[0].x,s=a[0].y)),r.rawX=o-i.left,r.rawY=s-i.top,r.x=r.rawX/i.width*2-1,r.y=-r.rawY/i.height*2+1,r},coordTransform:{bd09ToGcj02:Lh,bd09ToWgs84:function(t,e){var i=Lh(e,t);return Ch(i.lat,i.lng)},gaussianToLongLat:function(t,e,i=20,n=3){var r,a,o,s,h,l,c,u,d,p,f,m,g,v,y,x;return n=i<24?6:3,t+=1e6*i,x=.0174532925199433,c=6378137,l=1/298.257223563,r=parseInt(t/1e6),a=6===n?(r-1)*n+n/2:r*n,a*=x,o=t-(1e6*r+5e5),u=(h=2*l-l*l)/(1-h),y=(v=(e-0)/6367449.145960817)+(3*(s=(1-Math.sqrt(1-h))/(1+Math.sqrt(1-h)))/2-27*s*s*s/32)*Math.sin(2*v)+(21*s*s/16-55*s*s*s*s/32)*Math.sin(4*v)+151*s*s*s/96*Math.sin(6*v)+1097*s*s*s*s/512*Math.sin(8*v),f=u*Math.cos(y)*Math.cos(y),p=Math.tan(y)*Math.tan(y),d=c/Math.sqrt(1-h*Math.sin(y)*Math.sin(y)),g=c*(1-h)/Math.sqrt((1-h*Math.sin(y)*Math.sin(y))*(1-h*Math.sin(y)*Math.sin(y))*(1-h*Math.sin(y)*Math.sin(y))),{lng:(a+((m=o/d)-(1+2*p+f)*m*m*m/6+(5-2*f+28*p-3*f*f+8*u+24*p*p)*m*m*m*m*m/120)/Math.cos(y))/x,lat:(y-d*Math.tan(y)/g*(m*m/2-(5+3*p+10*f-4*f*f-9*u)*m*m*m*m/24+(61+90*p+298*f+45*p*p-256*u-3*f*f)*m*m*m*m*m*m/720))/x}},gcj02ToBd09:function(t,e){e=+e,t=+t;var i=Math.sqrt(t*t+e*e)+2e-5*Math.sin(e*Sh),n=Math.atan2(e,t)+3e-6*Math.cos(t*Sh);return{lng:i*Math.cos(n)+.0065,lat:i*Math.sin(n)+.006}},gcj02ToWgs84:Ch,lnglatDistance:function(t,e,i=6378137){var n=.017453292519943295;return i*Math.acos(Math.sin(t.lat*n)*Math.sin(e.lat*n)+Math.cos(t.lat*n)*Math.cos(e.lat*n)*Math.cos(t.lng*n-e.lng*n))},lnglatToGaussian:function(t,e,i=3){var n,r,a,o,s,h,l,c,u,d,p,f,m,g,v=0;return g=.0174532925199433,h=6378137,l=1/298.257223563,a=6===i?(v=parseInt(t/i))*i+i/2:(v=parseInt(t/i+.5))*i,a*=g,n=t*g,r=e*g,u=(c=2*l-l*l)*(1-c),d=h/Math.sqrt(1-c*Math.sin(r)*Math.sin(r)),p=Math.tan(r)*Math.tan(r),f=u*Math.cos(r)*Math.cos(r),o=d*((m=(n-a)*Math.cos(r))+(1-p+f)*m*m*m/6+(5-18*p+p*p+72*f-58*u)*m*m*m*m*m/120),s=h*(.9983242984527954*r-.002514607060518705*Math.sin(2*r)+26390465943376213e-22*Math.sin(4*r)-35*c*c*c/3072*Math.sin(6*r))+d*Math.tan(r)*(m*m/2+(5-p+9*f+4*f*f)*m*m*m*m/24+(61-58*p+p*p+600*f-330*u)*m*m*m*m*m*m/720),{x:o+=5e5,y:s+=0,projNo:v}},lngLatToMercator:function(t){"number"==typeof t&&(t={lng:arguments[0],lat:arguments[1]});var e={},i=20037508.34*t.lng/180,n=Math.log(Math.tan((90+t.lat)*Mh/360))/(Mh/180);return n=20037508.34*n/180,e.x=i,e.y=n,e},lngLatToMercator2:function(t,e){var i=6378137,n=t*Math.PI/180*i,r=e*Math.PI/180;return{x:n,y:3189068.5*Math.log((1+Math.sin(r))/(1-Math.sin(r)))}},mercatorToLngLat:function(t){"number"==typeof t&&(t={x:arguments[0],y:arguments[1]});var e={},i=t.x/20037508.34*180,n=t.y/20037508.34*180;return n=180/Mh*(2*Math.atan(Math.exp(n*Mh/180))-Mh/2),e.lng=i,e.lat=n,e},wgs84ToGcj02:function(t,e){if(Oh(e,t))return{lng:t,lat:e};var i=function(t,e){var i=Ph(e-105,t-35),n=Dh(e-105,t-35),r=t/180*Mh,a=Math.sin(r);a=1-Th*a*a;var o=Math.sqrt(a);i=180*i/(Ah*(1-Th)/(a*o)*Mh),n=180*n/(Ah/o*Math.cos(r)*Mh);var s=t+i,h=e+n;return{lat:s,lng:h}}(e,t);return{lng:i.lng,lat:i.lat}}},sceneToScreen(t,e){var i=e.clone().project(t.view.currentCamera);return i.x=(i.x+1)/2*t.view.width/t.view.sizeRate,i.y=-(i.y-1)/2*t.view.height/t.view.sizeRate,i},screenToScene(t,e){var i=e.clone();return i.unproject(t.view.currentCamera),i.z=0,i},latLongToVector3(t,e,i,n){var r=t*Math.PI/180,a=(e-180)*Math.PI/180;return new Lt(-(i+n)*Math.cos(r)*Math.cos(a),(i+n)*Math.sin(r),(i+n)*Math.cos(r)*Math.sin(a))},getDPI:()=>96,getNearestAngle(t,e,i){if(void 0===e)return 0;var n=i?180:Math.PI,r=e-t;return(r=(r+n)%(2*n)-n)>n?r-=2*n:r<-n&&(r+=2*n),r},traverse:function(){var t=[],e=!1;function i(n,r,a,o,s,h){a=void 0===a||a,(h=(h=h||[]).slice()).push(0);for(var l=0,c=n.length;lt[e])},iscw:function(t){var e=t.reduce(function(e,i,n){var r=n+10},removeFromArray(t,e){for(var i=t.length;i>-1;i--){var n=t[i];e.indexOf(n)>-1&&t.splice(i,1)}},setMaterialColor(t,e,i){var n=new Qt(e),r=!1;Array.isArray(t)&&(t.length>1?(t=t[1],r=!0):t=t[0]),t.color.copy(n),i&&i.config.noEmissive||(r?t.emissive.setScalar(0):(t.emissive||(t.emissive=new Qt),t.emissive.copy(n.clone().multiplyScalar(.35))))},collectMaterials(t,e){t=[].concat(t);var i=[];return t.forEach(t=>{if(!t.entity)return i;t.entity.traverse(t=>{if(t.material){var n=!1;e&&(n=e(t)),n||(Array.isArray(t.material)?Array.prototype.push.apply(i,t.material):i.push(t.material))}})}),i},getRootNode(t,e,i){var n=[];return t[e]&&n.push(t[e]),t.buildingNode.children.forEach(t=>{t[e]&&n.push(t[e]),t.floorNode.children.forEach(t=>{t[e]&&n.push(t[e])})}),i&&i(n),n},getNodeRoot(t){for(;t;){if(!t.parent)return t;if("OMBuilding"===t.parent.type||"OMScene"===t.parent.type)return t.parent;t=t.parent}},cloneGltf(t){const e={animations:t.animations,scene:t.scene.clone(!0)},i={};t.scene.traverse(t=>{t.isSkinnedMesh&&(i[t.name]=t)});const n={},r={};e.scene.traverse(t=>{t.isBone&&(n[t.name]=t),t.isSkinnedMesh&&(r[t.name]=t)});for(let t in i){const e=i[t].skeleton,a=r[t],o=[];for(let t=0;t"object"==typeof t&&null!=t,traverseJSON(t,e){if(e&&this.isJson(t)){var i="function"==typeof e;for(var n in t)if(void 0!==n){var r=t[n];i?e(n,r,t):e[n]&&e[n](r,t),(r=t[n])instanceof Array?r.forEach(t=>{this.traverseJSON(t,e)}):null!=r&&"object"==typeof r&&this.traverseJSON(r,e)}}},checkSpriteInView:(t,e)=>!(e.rect.x>=t.width/t.sizeRate||e.rect.y>=t.height/t.sizeRate||e.rect.x+e.rect.width<=0||e.rect.y+e.rect.height<=0),getSecret(){return new(t={},function(){if(1==arguments.length)return t[arguments[0]];2==arguments.length&&(t[arguments[0]]=arguments[1])});var t},getEasingByName(t){var e=t.replace(/in|out/gi,"");e=e[0].toUpperCase()+e.slice(1);var i=t.toLowerCase(),n="Out";return i.endsWith("in")?n="In":i.endsWith("inout")&&(n="InOut"),wh.Easing[e]?wh.Easing[e][n]:wh.Easing.Linear.None},_findData:(t,e)=>t.filter(t=>e(t)),findMarkerData(t,e){if(t.markers&&t.markers.length)return this._findData(t.markers,e)},findModelData(t,e){if(t.models&&t.models.length)return this._findData(t.models,e)},_keywordsFindConfig:t=>(("string"==typeof t||Array.isArray(t))&&(t={words:[].concat(t),multi:!0}),t.words=t.words.map(t=>t.toLowerCase()),{config:t,checkWords:function(e){var i=!1;return e.forEach(e=>{i||("object"==typeof e&&(e=e.text),"string"==typeof e&&(e=e.toLowerCase(),t.words.forEach(t=>{i||e.indexOf(t)>-1&&(i=!0)})))}),i},checkTag:function(e){let i=[].concat(e).map(t=>t.toLowerCase());return t.words.some(t=>i.some(e=>e.indexOf(t)>-1))}}),runTasks(t,e){Array.isArray(t)||(t=[].concat(t)),e=Object.assign({timeout:5e3,deltaTime:16.6,complete:null},e);const i=Date.now(),n=()=>{const r=Date.now();for(;t.length>0&&Date.now()-r0&&Date.now()-i0&&Date.now()-n{e.length>0?r():i=!1},0)}return{add:function(t){Array.isArray(t)||(t=[t]),Array.prototype.push.apply(e,t),n()},start:n,stop:function(){i=!1},get length(){return e.length},get isRunning(){return i}}},when(t,e,i=60){t()?e():setTimeout(()=>{kh.when(t,e,i)},i)},findNearestPoint(t,e){let i=1e4,n=null;for(var r=0;rt.charAt(0).toUpperCase()+t.substring(1),setBlockProperty(t,e,i){t.node?t.node[`set${kh.capWord(e)}`](i):t[e]=i}};class zh extends g{constructor(t,e,i){function n(t){p.set(p.radius,0,0),t.update(!0)}super(),this.map=i,this.object=t,this.domElement=void 0!==e?e:document,this.enabled=!0,this.target=new Lt,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25,this.enableZoom=!0,this.zoomSpeed=1,this.zoomToCursor=!1,this.rect={x:0,y:0},this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:P.LEFT,ZOOM:P.MIDDLE,PAN:P.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.updateRect=function(){this.rect={x:this.domElement._left||0,y:this.domElement._top||0,width:this.domElement.width,height:this.domElement.height}},this.updateRect(),this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.getPolarAngle=function(){return d.phi},this.getAzimuthalAngle=function(){return d.theta},Object.defineProperties(this,{azimuthal:{get:function(){return this.getAzimuthalAngle()},set:function(t){d.theta=t,n(this)}},polar:{get:function(){return this.getPolarAngle()},set:function(t){d.phi=t,n(this)}},distance:{get:function(){return this.getDistance()},set:function(t){t=R(t,!0),f=1,d.radius=t,n(this)}}}),this.setPose=function(t,e,i){d.theta=t,d.phi=e,i&&(d.radius=i),n(this)},this.saveState=function(){r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=function(){r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(o),r.update(),c=l.NONE},this.update=function(){var e=new Lt,i=(new Tt).setFromUnitVectors(t.up,new Lt(0,1,0)),n=i.clone().inverse(),a=new Lt,s=new Tt;return function(t){if(r.enabled){var h=r.object.position;e.copy(h).sub(r.target),e.applyQuaternion(i),t||(d.setFromVector3(e),r.autoRotate&&c===l.NONE&&E(2*Math.PI/60/60*r.autoRotateSpeed),d.theta+=p.theta,d.phi+=p.phi,d.theta=Math.max(r.minAzimuthAngle,Math.min(r.maxAzimuthAngle,d.theta)),d.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,d.phi))),d.makeSafe();var x=d.radius;return d.radius*=f,d.radius=Math.max(r.minDistance,Math.min(r.maxDistance,d.radius)),r.target.add(m),r.zoomToCursor&&0!==x&&(r.object.isPerspectiveCamera?r.target.lerp(y,1-d.radius/x):r.object.isOrthographicCamera&&r.target.lerp(y,1-v)),e.setFromSpherical(d),e.applyQuaternion(n),h.copy(r.target).add(e),r.object.lookAt(r.target),!0===r.enableDamping?(p.theta*=1-r.dampingFactor,p.phi*=1-r.dampingFactor):p.set(0,0,0),f=1,m.set(0,0,0),!!(g||a.distanceToSquared(r.object.position)>u||8*(1-s.dot(r.object.quaternion))>u)&&(r.dispatchEvent(o),a.copy(r.object.position),s.copy(r.object.quaternion),g=!1,v=1,!0)}}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",K,!1),r.domElement.removeEventListener("mousedown",j,!1),r.domElement.removeEventListener("wheel",X,!1),r.domElement.removeEventListener("touchstart",Y,!1),r.domElement.removeEventListener("touchend",J,!1),r.domElement.removeEventListener("touchmove",Z,!1),document.removeEventListener("mousemove",V,!1),document.removeEventListener("mouseup",W,!1),window.removeEventListener("keydown",q,!1)};var r=this;function a(){return r.domElement}var o={type:"change"},s={type:"start"},h={type:"end"},l={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5,TOUCH_MAP:6},c=l.NONE,u=1e-6,d=new Xs,p=new Xs,f=1,m=new Lt,g=!1,v=1,y=new Lt,x=new St,b=new St,w=new St,_=new St,M=new St,S=new St,A=new St,T=new St,L=new St;function C(t){return Math.pow(t||.95,r.zoomSpeed)}function E(t){p.theta-=t}function D(t){p.phi-=t}var I=function(){var t=new Lt;return function(e,i){t.setFromMatrixColumn(i,0),t.multiplyScalar(-e),m.add(t)}}(),O=function(){var t=new Lt;return function(e,i){var n=1;1===r.object.up.z&&(n=2),t.setFromMatrixColumn(i,n),t.multiplyScalar(e),m.add(t)}}(),N=function(){var t=new Lt,e=new Lt(0,0,1),i=new Lt,n=new Lt,o=new Lt;return function(s,h){var l=a();r.object.matrix.extractBasis(i,n,o);var c=(new Lt).crossVectors(e,i),u=new At;if(u.makeBasis(i,e,c),r.object instanceof On){var d=r.object.position;t.copy(d).sub(r.target);var p=t.length();p*=Math.tan(r.object.fov/2*Math.PI/180),I(2*s*p/l.clientHeight,u),O(2*h*p/l.clientHeight,u)}else r.object instanceof Uo?(I(s*(r.object.right-r.object.left)/r.object.zoom/l.clientWidth,u),O(h*(r.object.top-r.object.bottom)/r.object.zoom/l.clientHeight,u)):r.enablePan=!1}}();function k(t){if(r.object instanceof On)f=R(f/=t);else if(r.object instanceof Uo){v=r.object.zoom;var e=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*t));r.object.zoom=B(e),v/=r.object.zoom,r.object.updateProjectionMatrix(),g=!0}else r.enableZoom=!1}function z(t){if(r.object instanceof On)f=R(f*=t);else if(r.object instanceof Uo){v=r.object.zoom;var e=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/t));r.object.zoom=B(e),v/=r.object.zoom,r.object.updateProjectionMatrix(),g=!0}else r.enableZoom=!1}function R(t,e){if(!r.map.view.minLevelData)return t;var i=e?t:d.radius*t,n=r.map.view.minLevelData.distance,a=r.map.view.maxLevelData.distance,o=.1;return i>n-o?e?n-o:(n-o)/d.radius:ii-a?r.object.top/(i-a):t}var F,U,G=function(){var t=new Lt;return new Lt,function(e,i,n){if(r.zoomToCursor){void 0===i&&(i=e.clientX),void 0===n&&(n=e.clientY);var o=a(),s=r.rect;if(r.object.isPerspectiveCamera){t.set((i-s.x)/o.clientWidth*2-1,-(n-s.y)/o.clientHeight*2+1,.5),t.unproject(r.object),t.sub(r.object.position).normalize();var h=(r.target.z-r.object.position.z)/t.z;y.copy(r.object.position).add(t.multiplyScalar(h))}else r.object.isOrthographicCamera&&(t.set((i-s.x)/o.clientWidth*2-1,-(n-s.y)/o.clientHeight*2+1,0),t.unproject(r.object),t.z=r.target.z,y.copy(t))}}}();function j(t){if(!1!==r.enabled){switch(t.preventDefault(),clearTimeout(H),r.map.needHeighFrameRate=!0,t.button){case r.mouseButtons.PAN:if(!1===r.enableRotate)return;!function(t){x.set(t.clientX,t.clientY)}(t),c=l.ROTATE;break;case r.mouseButtons.ZOOM:if(!1===r.enableZoom)return;!function(t){A.set(t.clientX,t.clientY)}(t),c=l.DOLLY;break;case r.mouseButtons.ORBIT:if(!1===r.enablePan)return;!function(t){_.set(t.clientX,t.clientY)}(t),c=l.PAN}c!==l.NONE&&(document.addEventListener("mousemove",V,!1),document.addEventListener("mouseup",W,!1),r.dispatchEvent(s))}}function V(t){if(!1!==r.enabled)switch(t.preventDefault(),c){case l.ROTATE:if(!1===r.enableRotate)return;!function(t){b.set(t.clientX,t.clientY),w.subVectors(b,x);var e=a();E(2*Math.PI*w.x/e.clientWidth*r.rotateSpeed),"3d"===r.map.view.viewMode&&D(2*Math.PI*w.y/e.clientHeight*r.rotateSpeed),x.copy(b),r.update()}(t);break;case l.DOLLY:if(!1===r.enableZoom)return;!function(t){T.set(t.clientX,t.clientY),L.subVectors(T,A),L.y>0?k(C()):L.y<0&&z(C()),A.copy(T),r.update()}(t);break;case l.PAN:if(!1===r.enablePan)return;!function(t){M.set(t.clientX,t.clientY),S.subVectors(M,_),N(S.x,S.y),_.copy(M),r.update()}(t)}}function W(t){!1!==r.enabled&&(r.map.needHeighFrameRate=!1,r.map.needHeighFrameRate=!1,document.removeEventListener("mousemove",V,!1),document.removeEventListener("mouseup",W,!1),r.dispatchEvent(h),c=l.NONE)}var H=null;function X(t){!1===r.enabled||!1===r.enableZoom||c!==l.NONE&&c!==l.ROTATE||(t.preventDefault(),t.stopPropagation(),clearTimeout(H),r.map.needHeighFrameRate=!0,function(t){G(t),t.deltaY<0?z(C()):t.deltaY>0&&k(C()),r.update()}(t),H=setTimeout(()=>{r.map.needHeighFrameRate=!1},1e3),r.dispatchEvent(s),r.dispatchEvent(h))}function q(t){!1!==r.enabled&&!1!==r.enableKeys&&!1!==r.enablePan&&(function(t){switch(t.keyCode){case r.keys.UP:N(0,r.keyPanSpeed),r.update();break;case r.keys.BOTTOM:N(0,-r.keyPanSpeed),r.update();break;case r.keys.LEFT:N(r.keyPanSpeed,0),r.update();break;case r.keys.RIGHT:N(-r.keyPanSpeed,0),r.update()}}(t),clearTimeout(H))}function Y(t){if(!1!==r.enabled){switch(clearTimeout(H),r.map.needHeighFrameRate=!0,t.touches.length){case 2:r.enableZoom&&function(t){let e=t.touches[0].pageX,i=t.touches[0].pageY;var n=t.touches[1].pageX-e,r=t.touches[1].pageY-i;G(t,e+n/2,i+r/2);var a=Math.sqrt(n*n+r*r);A.set(0,a)}(t),r.enableRotate&&function(t){x.set(t.touches[0].pageX,t.touches[0].pageY),F=U=null}(t),c=l.TOUCH_MAP;break;case 1:if(!1===r.enablePan)return;!function(t){_.set(t.touches[0].pageX,t.touches[0].pageY)}(t),c=l.TOUCH_PAN;break;default:c=l.NONE}c!==l.NONE&&r.dispatchEvent(s)}}function Z(t){if(!1!==r.enabled)switch(t.preventDefault(),t.stopPropagation(),t.touches.length){case 2:if(c!==l.TOUCH_MAP)return;r.enableZoom&&function(t){var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);T.set(0,n);var a=T.y/A.y;a>1?z(2-a):a<1&&k(a),A.copy(T),r.update()}(t),r.enableRotate&&function(t){var e=a(),i=new Lt(t.touches[0].pageX,t.touches[0].pageY,0),n=new Lt(t.touches[1].pageX,t.touches[1].pageY,0),o=n.clone().sub(i);if(F){var s=o.clone().cross(F).z>0?1:-1,h=o.angleTo(F);F=o.clone();var l=(i.y+n.y)/2;U||(U=l);var c=l-U;U=l,"3d"===r.map.view.viewMode&&Math.abs(c)>r.map.config.controls_phiThreshold?D(2*Math.PI*c/e.clientHeight*r.rotateSpeed*.6):E(h*s*r.rotateSpeed),r.update()}else F=o.clone()}(t);break;case 1:if(!1===r.enablePan)return;if(c!==l.TOUCH_PAN)return;!function(t){M.set(t.touches[0].pageX,t.touches[0].pageY),S.subVectors(M,_),N(S.x,S.y),_.copy(M),r.update()}(t);break;default:c=l.NONE}}function J(t){!1!==r.enabled&&(r.map.needHeighFrameRate=!1,r.dispatchEvent(h),c=l.NONE)}function K(t){t.preventDefault()}r.domElement.addEventListener("contextmenu",K,!1),r.domElement.addEventListener("mousedown",j,!1),r.domElement.addEventListener("wheel",X,!1),r.domElement.addEventListener("touchstart",Y,!1),r.domElement.addEventListener("touchend",J,!1),r.domElement.addEventListener("touchmove",Z,!1),window.addEventListener("keydown",q,!1),this.update()}}Object.defineProperties(zh.prototype,{center:{get:function(){return this.target}},noZoom:{get:function(){return!this.enableZoom},set:function(t){this.enableZoom=!t}},noRotate:{get:function(){return!this.enableRotate},set:function(t){this.enableRotate=!t}},noPan:{get:function(){return!this.enablePan},set:function(t){this.enablePan=!t}},noKeys:{get:function(){return!this.enableKeys},set:function(t){this.enableKeys=!t}},staticMoving:{get:function(){return!this.enableDamping},set:function(t){this.enableDamping=!t}},dynamicDampingFactor:{get:function(){return this.dampingFactor},set:function(t){this.dampingFactor=t}}});var Rh={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")},Bh=function(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1};Object.assign(Bh.prototype,{setSize:function(t,e){},render:function(t,e,i,n,r){}});var Fh=function(t,e){Bh.call(this),this.textureID=void 0!==e?e:"tDiffuse",t instanceof Ye?(this.uniforms=t.uniforms,this.material=t):t&&(this.uniforms=Jt.clone(t.uniforms),this.material=new Ye({defines:Object.assign({},t.defines),uniforms:this.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader})),this.camera=new Uo(-1,1,1,-1,0,1),this.scene=new Zn,this.quad=new Qe(new Ne(2,2),null),this.quad.frustumCulled=!1,this.scene.add(this.quad)};Fh.prototype=Object.assign(Object.create(Bh.prototype),{constructor:Fh,render:function(t,e,i,n,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=i.texture),this.quad.material=this.material,this.renderToScreen?(t.setRenderTarget(null),t.render(this.scene,this.camera)):(t.setRenderTarget(e),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),t.render(this.scene,this.camera))}});var Uh=function(t,e){Bh.call(this),this.scene=t,this.camera=e,this.clear=!0,this.needsSwap=!1,this.inverse=!1};Uh.prototype=Object.assign(Object.create(Bh.prototype),{constructor:Uh,render:function(t,e,i,n,r){var a,o,s=t.context,h=t.state;h.buffers.color.setMask(!1),h.buffers.depth.setMask(!1),h.buffers.color.setLocked(!0),h.buffers.depth.setLocked(!0),this.inverse?(a=0,o=1):(a=1,o=0),h.buffers.stencil.setTest(!0),h.buffers.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),h.buffers.stencil.setFunc(s.ALWAYS,a,4294967295),h.buffers.stencil.setClear(o),t.setRenderTarget(i),this.clear&&t.clear(),t.render(this.scene,this.camera),t.setRenderTarget(e),this.clear&&t.clear(),t.render(this.scene,this.camera),h.buffers.color.setLocked(!1),h.buffers.depth.setLocked(!1),h.buffers.stencil.setFunc(s.EQUAL,1,4294967295),h.buffers.stencil.setOp(s.KEEP,s.KEEP,s.KEEP)}});var Gh=function(){Bh.call(this),this.needsSwap=!1};Gh.prototype=Object.create(Bh.prototype),Object.assign(Gh.prototype,{render:function(t,e,i,n,r){t.state.buffers.stencil.setTest(!1)}});var jh=function(t,e){if(this.renderer=t,void 0===e){var i={minFilter:H,magFilter:H,format:et,stencilBuffer:!1},n=t.getDrawingBufferSize(new St);(e=new zt(n.width,n.height,i)).texture.name="EffectComposer.rt1"}this.renderTarget1=e,this.renderTarget2=e.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.passes=[],this.copyPass=new Fh(Rh),this._previousFrameTime=Date.now()};Object.assign(jh.prototype,{swapBuffers:function(){var t=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=t},addPass:function(t){this.passes.push(t);var e=this.renderer.getDrawingBufferSize(new St);t.setSize(e.width,e.height)},insertPass:function(t,e){this.passes.splice(e,0,t)},render:function(t){void 0===t&&(t=.001*(Date.now()-this._previousFrameTime)),this._previousFrameTime=Date.now();var e,i,n=this.renderer.getRenderTarget(),r=!1,a=this.passes.length;for(i=0;i","vec2 rand( const vec2 coord ) {","vec2 noise;","if ( useNoise ) {","float nx = dot ( coord, vec2( 12.9898, 78.233 ) );","float ny = dot ( coord, vec2( 12.9898, 78.233 ) * 2.0 );","noise = clamp( fract ( 43758.5453 * sin( vec2( nx, ny ) ) ), 0.0, 1.0 );","} else {","float ff = fract( 1.0 - coord.s * ( size.x / 2.0 ) );","float gg = fract( coord.t * ( size.y / 2.0 ) );","noise = vec2( 0.25, 0.75 ) * vec2( ff ) + vec2( 0.75, 0.25 ) * gg;","}","return ( noise * 2.0 - 1.0 ) * noiseAmount;","}","float readDepth( const in vec2 coord ) {","float cameraFarPlusNear = cameraFar + cameraNear;","float cameraFarMinusNear = cameraFar - cameraNear;","float cameraCoef = 2.0 * cameraNear;","#ifdef USE_LOGDEPTHBUF","float logz = unpackRGBAToDepth( texture2D( tDepth, coord ) );","float w = pow(2.0, (logz / logDepthBufFC)) - 1.0;","float z = (logz / w) + 1.0;","#else","float z = unpackRGBAToDepth( texture2D( tDepth, coord ) );","#endif","return cameraCoef / ( cameraFarPlusNear - z * cameraFarMinusNear );","}","float compareDepths( const in float depth1, const in float depth2, inout int far ) {","float garea = 8.0;","float diff = ( depth1 - depth2 ) * 100.0;","if ( diff < gDisplace ) {","garea = diffArea;","} else {","far = 0;","}","float dd = diff - gDisplace;","float gauss = pow( EULER, -2.0 * ( dd * dd ) / ( garea * garea ) );","return gauss;","}","float calcAO( float depth, float dw, float dh ) {","vec2 vv = vec2( dw, dh );","vec2 coord1 = vUv + radius * vv;","vec2 coord2 = vUv - radius * vv;","float temp1 = 0.0;","float temp2 = 0.0;","int far = 0;","temp1 = compareDepths( depth, readDepth( coord1 ), far );","if ( far > 0 ) {","temp2 = compareDepths( readDepth( coord2 ), depth, far );","temp1 += ( 1.0 - temp1 ) * temp2;","}","return temp1;","}","void main() {","vec2 noise = rand( vUv );","float depth = readDepth( vUv );","float tt = clamp( depth, aoClamp, 1.0 );","float w = ( 1.0 / size.x ) / tt + ( noise.x * ( 1.0 - noise.x ) );","float h = ( 1.0 / size.y ) / tt + ( noise.y * ( 1.0 - noise.y ) );","float ao = 0.0;","float dz = 1.0 / float( samples );","float l = 0.0;","float z = 1.0 - dz / 2.0;","for ( int i = 0; i <= samples; i ++ ) {","float r = sqrt( 1.0 - z );","float pw = cos( l ) * r;","float ph = sin( l ) * r;","ao += calcAO( depth, pw * w, ph * h );","z = z - dz;","l = l + DL;","}","ao /= float( samples );","ao = 1.0 - ao;","vec3 color = texture2D( tDiffuse, vUv ).rgb;","vec3 lumcoeff = vec3( 0.299, 0.587, 0.114 );","float lum = dot( color.rgb, lumcoeff );","vec3 luminance = vec3( lum );","vec3 final = vec3( color * mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );","if ( onlyAO ) {","final = vec3( mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );","}","gl_FragColor = vec4( final, 1.0 );","}"].join("\n")};class Hh{constructor(t,e,i,n=1){this.scale=n,this.depthMaterial=new An,this.depthMaterial.depthPacking=_t,this.depthMaterial.blending=0,this.depthMaterial.skinning=!0,this.depthRenderTarget=new zt(e,i,{minFilter:H,magFilter:H}),this.depthRenderTarget.texture.name="SSAOShader.rt",this.ssaoPass=new Fh(Wh),this.ssaoPass.uniforms.tDepth.value=this.depthRenderTarget.texture,this.ssaoPass.uniforms.size.value.set(e*n,i*n),this.ssaoPass.uniforms.cameraNear.value=2,this.ssaoPass.uniforms.cameraFar.value=1200,this.ssaoPass.uniforms.onlyAO.value=!1,this.ssaoPass.uniforms.radius.value=6,this.ssaoPass.uniforms.aoClamp.value=.6,this.ssaoPass.uniforms.lumInfluence.value=1}setSize(t,e){this.depthRenderTarget.setSize(t,e),this.ssaoPass.uniforms.size.value.set(t*this.scale,e*this.scale)}setRadius(t){this.ssaoPass.uniforms.radius.value=t||6}get enabled(){return this.ssaoPass.enabled}set enabled(t){this.ssaoPass.enabled=t}getPass(){return this.ssaoPass}}var Xh={uniforms:{tDiffuse:{value:null},resolution:{value:new St(1/1024,1/512)}},vertexShader:["void main() {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","#define FXAA_REDUCE_MIN (1.0/128.0)","#define FXAA_REDUCE_MUL (1.0/8.0)","#define FXAA_SPAN_MAX 8.0","void main() {","vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;","vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;","vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;","vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;","vec4 rgbaM = texture2D( tDiffuse, gl_FragCoord.xy * resolution );","vec3 rgbM = rgbaM.xyz;","vec3 luma = vec3( 0.299, 0.587, 0.114 );","float lumaNW = dot( rgbNW, luma );","float lumaNE = dot( rgbNE, luma );","float lumaSW = dot( rgbSW, luma );","float lumaSE = dot( rgbSE, luma );","float lumaM = dot( rgbM, luma );","float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );","float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );","vec2 dir;","dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));","dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));","float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );","float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );","dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),","max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),","dir * rcpDirMin)) * resolution;","vec4 rgbA = (1.0/2.0) * (","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (1.0/3.0 - 0.5)) +","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (2.0/3.0 - 0.5)));","vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (0.0/3.0 - 0.5)) +","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (3.0/3.0 - 0.5)));","float lumaB = dot(rgbB, vec4(luma, 0.0));","if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {","gl_FragColor = rgbA;","} else {","gl_FragColor = rgbB;","}","}"].join("\n")};class qh{constructor(t){this.map=t,this.enabled=!0;var e=window.devicePixelRatio||1;this.dpr=e;var i=t.view.width*e,n=t.view.height*e;this.delta=.8,this.depthCamera=this.map.view.camera.clone(),this.basePass=new Vh(t.sceneManager.base,t.view.currentCamera),this.basePass.clearDepth=!0,this.renderDefaultPass=new Vh(t.sceneManager.default,t.view.currentCamera),this.renderDefaultPass.clear=!1,this.renderMainPass=new Vh(t.sceneManager.mainScene,t.view.currentCamera),this.renderMainPass.clear=!1,this.renderMainPass.clearDepth=!1,this.hudPass=new Vh(t.sceneManager.props.constructor("dit"),t.view.cameraHUD),this.hudPass.clear=!1,this.hudPass.clearDepth=!0;var r={minFilter:H,magFilter:H,format:et,stencilBuffer:!0};this.rt=new zt(i,n,r),this.rt.texture.name="EffectComposer.rt1",this.composer=new jh(t.view.renderer,this.rt),this.composer.setSize(i,n),this.ssaoEffect=new Hh(t,i,n),this.ssaoPass=this.ssaoEffect.getPass(),this.markerRender=new Vh(t.sceneManager.markerScene,t.view.currentCamera),this.markerRender.setSize(i,n),this.markerRender.clear=!1,this.markerRender.clearDepth=!1,this.fxaaPass=new Fh(Xh),this.fxaaPass.uniforms.resolution.value=new St(1/i,1/n);var a=new Fh(Rh);a.renderToScreen=!0,this._currentViewMode=null,this.composer.addPass(this.basePass),this.composer.addPass(this.renderDefaultPass),this.composer.addPass(this.renderMainPass),this.composer.addPass(this.markerRender),this.composer.addPass(this.hudPass),this.composer.addPass(this.ssaoPass),this.composer.addPass(a),this.markerNodeEntityVisibles=[]}setSize(t,e){t*=this.dpr,e*=this.dpr,this.rt.setSize(t,e),this.composer.setSize(t,e),this.ssaoEffect.setSize(t,e),this.fxaaPass.uniforms.resolution.value.set(1/t,1/e)}render(){if(this.customRender)this.customRender();else if(this.map.config.context&&this.map.view.renderer.state.reset(),this.map.emit("pre-render"),this.enabled&&"3d"===this.map.view.viewMode&&this.map.config.useAOEffect){this.map.config.context||this.map.view.renderer.clear(),this.map.sceneManager.mainScene.overrideMaterial=this.ssaoEffect.depthMaterial;var t=kh.traverse(this.map.sceneManager.mainScene.children,t=>"markerNodeEntity"===t.name||!!t.isSkinnedMesh||void 0,!0,!0)||[];this.markerNodeEntityVisibles.length=0,t.forEach(t=>{this.markerNodeEntityVisibles.push(t.visible),t.visible=!1}),this.depthCamera.copy(this.map.view.camera);var e=this.map.view.controls.distance,i=e*this.delta,n=e+i;(n/=Math.cos(this.map.view.controls.polar))<300&&(n=300),this.depthCamera.far=n,this.depthCamera.near=e-i,this.depthCamera.updateProjectionMatrix(),this.ssaoPass.uniforms.cameraFar.value=this.depthCamera.far,this.ssaoPass.uniforms.cameraNear.value=this.depthCamera.near,"3d"!==this._currentViewMode&&(this.map.view.renderer.setRenderTarget(this.ssaoEffect.depthRenderTarget),this._currentViewMode="3d"),this.map.view.renderer.render(this.map.sceneManager.mainScene,this.depthCamera),this.map.sceneManager.mainScene.overrideMaterial=null,t.forEach((t,e)=>{t.visible=this.markerNodeEntityVisibles[e]}),this.composer.render()}else"2d"!==this._currentViewMode&&(this.map.view.renderer.setRenderTarget(null),this._currentViewMode="2d"),this.map.config.context||this.map.view.renderer.clear(),this.map.view.renderer.render(this.map.sceneManager.base,this.map.view.currentCamera),this.map.view.renderer.clearDepth(),this.map.view.renderer.render(this.map.sceneManager.default,this.map.view.currentCamera),this.map.view.renderer.render(this.map.sceneManager.mainScene,this.map.view.currentCamera),this.map.view.renderer.render(this.map.sceneManager.markerScene,this.map.view.currentCamera),this.map.view.renderer.clearDepth(),this.map.view.renderer.render(this.map.sceneManager.props.constructor("dit"),this.map.view.cameraHUD)}dispose(){}}Lt.prototype.setFromCoord=function(t){return this.x=t.x,this.y=t.z,this.z=t.y,this};class Yh extends Lt{constructor(t,e,i){super(t,e,i)}setFromArray(t){this.x=t[0]||0,this.y=t[1]||0,this.z=t[2]||0}setFromString(t){var e=t.split(",");return this.x=+e[0],this.y=+e[1],this.z=e[2]?+e[2]:0,this}setFromVector3(t){return this.x=t.x,this.y=t.z,this.z=t.y,this}}var Zh={ambient_intensity:.5,ambient_color:"#d6ebff",l1_intensity:.362,l1_color:"#e6c9a7",l1_angle:325.8,l1_polarAngle:21.78,l1_distance:1e3,l2_intensity:.3,l2_color:"#DAE7FD",l2_angle:174.6,l2_polarAngle:-12.24,l2_distance:1e3,shadow:!1,shadow_type:2,shadow_near:200,shadow_far:2636,shadow_size:1024,light_radius:1e3,shadow_radius:1,shadow_bias:-6e-4},Jh=new Lt(1,0,0),Kh=new Lt(0,0,1);class Qh{constructor(t,e,i){this.group=new Dn,this.group.name="lights",this.renderer=e,this.config=Object.assign(Zh,i),this.ambientLight=new Vo(this.config.ambient_color,this.config.ambient_intensity),this.directionalLight=new jo(this.config.l1_color,this.config.l1_intensity),this.directionalLight2=new jo(this.config.l2_color,this.config.l2_intensity),this.group.add(this.ambientLight,this.directionalLight,this.directionalLight2),this.enableFollowCamera=!0,this.minLightDistance=50,t.mainScene.add(this.group),this.map=t.map,this.config.shadow=this.map.config.useShadowMap,this.setConfig(),this._lightDir=null,this._lightDis=null,this._lightAngle=null,this.offFollowCamera=this.map.on("viewChanged",this.followCamera.bind(this))}getCameraRate(){if("2d"===this.map.view.viewMode)return 1;let t=new Lt;this.map.view.camera.getWorldDirection(t);let e=t.clone();e.z=0;let i=Math.sin(t.angleTo(e));return Math.max(.6,i)}followCamera(){if(!this.enableFollowCamera)return;this._lightDir||this.getLightState();let t=this.directionalLight,e=this.map;t.target.position.copy(e.view.controls.target),t.target.updateMatrixWorld();let i=e.view.controls.distance,n=Math.tan(e.view.camera.fov)*i/1,r=Math.max(n,this.minLightDistance);t.position.copy(e.view.controls.target.clone().add(this._lightDir.clone().multiplyScalar(r))),this.setShadow({shadow_near:.05*r,shadow_far:2*r,light_radius:n}),this.updateShadowMap()}setConfig(t){Object.assign(this.config,t),this.ambientLight.intensity=this.config.ambient_intensity,this.ambientLight.color.set(this.config.ambient_color),this.directionalLight.intensity=this.config.l1_intensity,this.directionalLight.color.set(this.config.l1_color),this.setMainLightAngle(null),this.directionalLight2.intensity=this.config.l2_intensity,this.directionalLight2.color.set(this.config.l2_color),this.setSecondLightAngle(null),this.renderer.shadowMap.type=this.config.shadow_type,this.shadowMapEnabled=this.config.shadow,this.setShadow(),this.getLightState()}getAngle(t){t.updateMatrixWorld();var e=new Lt(t.position.x,t.position.y,0).normalize(),i=Jh.dot(e),n=180*Math.acos(i)/Math.PI;Jh.clone().cross(e).z<0&&(n=360-n),e=new Lt(t.position.x,t.position.y,0).normalize();var r=t.position.clone().normalize(),a=180*Math.acos(e.dot(r))/Math.PI||0;return r.z<0&&(a*=-1),{angle:n,polar:a}}getMainLightAngle(){return this.getAngle(this.directionalLight)}getSecondLightAngle(){return this.getAngle(this.directionalLight2)}setLightAngle(t,e,i,n){null==i?i=this.config[`${e}_angle`]:this.config[`${e}_angle`]=i,null==n?n=this.config[`${e}_polarAngle`]:this.config[`${e}_polarAngle`]=n;var r=i*Math.PI/180,a=n*Math.PI/180,o=Jh.clone().applyAxisAngle(Kh,r),s=(new Lt).crossVectors(o,Kh);o.applyAxisAngle(s,a),o.multiplyScalar(this.config[`${e}_distance`]),t.position.copy(o),t.updateMatrixWorld(),this.config.shadow&&this.setShadow()}setMainLightAngle(t,e){this.setLightAngle(this.directionalLight,"l1",t,e),this.getLightState()}setSecondLightAngle(t,e){this.setLightAngle(this.directionalLight2,"l2",t,e)}setMainLightDistance(t){this.config.l1_distance=t,this.setMainLightAngle(null),this.getLightState()}setSecondLightDistance(t){this.config.l2_distance=t,this.setSecondLightAngle(null)}getLightState(){this.directionalLight.target.updateMatrixWorld(),this.directionalLight.updateMatrixWorld();let t=this.directionalLight.position.clone().sub(this.directionalLight.target.position);this._lightDis=t.length(),this._lightDir=t.normalize();let e=t.clone();e.z=0,this._lightAngle=t.angleTo(e)}setShadow(t){t=Object.assign(this.config,t),this.renderer.shadowMap.type=t.shadow_type;var e=this.directionalLight;e.shadow.bias=t.shadow_bias||-6e-4,e.shadow.radius=t.shadow_radius||1,e.shadow.camera.near=t.shadow_near,e.shadow.camera.far=t.shadow_far,e.shadow.mapSize.width=t.shadow_size,e.shadow.mapSize.height=t.shadow_size;var i=t.light_radius;e.shadow.camera.left=-i,e.shadow.camera.right=i,e.shadow.camera.top=i,e.shadow.camera.bottom=-i,e.shadow.camera.updateProjectionMatrix()}shadowSetting(t){return this.setShadow(t)}updateShadowMap(){this.renderer.shadowMap.needsUpdate=!0}get shadowMapEnabled(){return this.directionalLight.castShadow}set shadowMapEnabled(t){this.config.shadow=t,this.directionalLight.castShadow=t,this.setShadow(),this.updateShadowMap()}get ambientIntensity(){return this.ambientLight.intensity}set ambientIntensity(t){this.ambientLight.intensity=t}get ambientColor(){return this.ambientLight.color}set ambientColor(t){this.ambientLight.color.set(t)}}var $h=new Lt;class tl{constructor(t){this.map=t,this.isCanvas=!1,this.isCanvas=void 0!==t.config.container._canvasId;var n,r={antialias:!0,alpha:!0,context:t.config.context};t.config.webGLConfig&&(r=Object.assign(r,t.config.webGLConfig)),this.isCanvas&&(r.canvas=t.config.container,e(r.canvas,a.prototype),i(r.canvas),e(t.config.canvas2d,a.prototype),i(t.config.canvas2d)),this.renderer=new Xn(r),this.isCanvas||t.config.context||t.config.container.appendChild(this.renderer.domElement),this.width=t.config.container.offsetWidth,this.height=t.config.container.offsetHeight,this._maxSize=null,de.DefaultUp.set(0,0,1),this.renderer.setClearColor("#282a35",1),n=this.map.sysInfo.pixelRatio,this.pixelRatio=n,this.resolution=this.map.config.resolution,this.renderer.setSize(this.width,this.height),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.autoUpdate=!1,this.renderer.shadowMap.type=1,this.renderer.autoClear=!1,this.zoomLevels=[295829355.45,147914677.73,73957338.86,36978669.43,18489334.72,9244667.36,4622333.68,2311166.84,1155583.42,577791.71,288895.85,144447.93,72223.96,36111.98,18056,9028,4514,2257,1128,564,282,141,70,35,17,8,4,2,1],this.pixelsPerCentimeter=kh.getDPI()/2.54,this.camera=new On(35,this.width/this.height,10,1e5);var o=this.width/2,s=this.height/2;this.camera2D=new Uo(-o,o,s,-s,1,1e5),this.camera2D.rotation.set(-Math.PI/2,0,0,"XYZ"),this.camera2D.position.set(0,1e5,0),this.cameraHUD=new Uo(-o,o,s,-s,1,1e5),this.cameraHUD.rotation.set(-Math.PI/2,0,0,"XYZ"),this.cameraHUD.position.set(0,1e3,0),this.frustum=new Vt,this.controls=new zh(this.camera,this.domElement,this.map),Object.assign(this.controls,{dampingFactor:.2,rotateSpeed:.8,zoomSpeed:this.map.config.zoomSpeed,minPolarAngle:this.minPolarAngle*Mt.DEG2RAD,maxPolarAngle:this.maxPolarAngle*Mt.DEG2RAD,zoomToCursor:this.map.config.zoomToCursor}),this.currentCamera=this.camera,this.controls.update(),this.map.config.context&&(this.controls.enabled=!1),this.sizeRate=1,this.lights=new Qh(this.map.sceneManager,this.renderer),this._props={animCount:0,zooms:[]}}init(t){var e=this;t=t||e.map.config;let prom=new Nh;function i(){e.viewMode={mode:t.viewMode,duration:0,callback:()=>{"3d"===t.viewMode&&(e.controls.polar=t.polarAngle*Mt.DEG2RAD,e.controls.azimuthal=t.viewAngle*Mt.DEG2RAD)}},e.updateFrustum(!0),e._events(),setTimeout(()=>{e.map.emit("ready",e.map)},0),prom.resolve()}return e.setZoomLevelRangeData(),t.zoom?e.zoom={zoom:t.zoom,duration:0,callback:i}:(t.zoomLevel=Math.max(Math.min(t.zoomLevel,t.maxZoomLevel),t.minZoomLevel),e.zoomLevel={level:t.zoomLevel,duration:0,callback:i}),prom}get domElement(){return this.map.config.context?this.map.config.context.canvas:this.map.config.eventsOnContainer?this.map.config.container:this.renderer.domElement}setConfig(t){["minZoomLevel","maxZoomLevel","minPolarAngle","maxPolarAngle"].forEach(e=>{t.hasOwnProperty(e)&&void 0!==t[e]&&(this[e]=t[e])}),void 0!==t.viewAngle&&(this.controls.azimuthal=t.viewAngle*Mt.DEG2RAD)}registerZoomChanged(t){t=[].concat(t);var e=[];return t.forEach(t=>{t.id||(t.id=kh.generateID().toLowerCase()),e.push(t.id)}),Array.prototype.push.apply(this._props.zooms,t),()=>{this.unregisterZoomChangedCallback(e)}}unregisterZoomChangedCallback(t){for(var e=this._props.zooms.length-1;e>-1;e--){let i=this._props.zooms[e];t.indexOf(i.id)>-1&&this._props.zooms.splice(e,1)}}getAllZoomChangedCallback(){return this._props.zooms}_events(){var t=null;this.viewChangedFunc=()=>{this.map.emit("viewUpdate"),t||(t=Date.now()),this._zoom=this.zoom,this._props.zooms.forEach(t=>{if(!1!==t.enabled){var e=this._zoom-t.zoom;e<0&&t.lt&&"lt"!==t.state?(t.lt(this._zoom),t.state="lt"):0===e&&t.equal&&"equal"!==t.state?(t.equal(this._zoom),t.state="equal"):e>0&&t.gt&&"gt"!==t.state&&(t.gt(this._zoom),t.state="gt")}});var e=this.zoomLevel;e!==this._props.lastZoomLevel&&(this.map.emit("zoomLevelChanged",{currentLevel:e,lastLevel:this._props.lastZoomLevel}),this._props.lastZoomLevel=e),this._zoom=null;var i=Date.now();i-t>=this.map.config.viewChangedTimeStep&&(t=i,this.updateFrustum(),this.map.emit("viewChanged")),clearTimeout(this._viewChangedID),this._viewChangedID=setTimeout(()=>{t=null,this.updateFrustum(),this.map.emit("viewChanged")},this.map.config.viewChangedEventDelay)},this.controls.addEventListener("change",this.viewChangedFunc)}get maxSize(){return this._maxSize}set maxSize(t){this._maxSize=t,this.resize()}get resolution(){return this._resolution||1}set resolution(t){this._resolution=t,this.renderer.setPixelRatio(this.pixelRatio*t)}clampSize(t,e){t=t||this.map.config.container.offsetWidth,e=e||this.map.config.container.offsetHeight;var i=1;if(this.maxSize){var n=Math.max(t,e);this.maxSizet&&(this.polarAngle={angle:t,duration:0})}get polarAngle(){return this.controls.polar*Mt.RAD2DEG}set polarAngle(t){var e,i;"2d"!==this.viewMode&&("number"==typeof t&&(t={angle:t}),e=void 0===t.duration?this.map.config.animateDuration:t.duration,i=t.callback,t=t.angle,t=Math.min(Math.max(t,this.map.config.minPolarAngle),this.map.config.maxPolarAngle),this._stopAnim("polarAngleAnim"),this._animStart(),this._props.polarAngleAnim=new wh.Tween(this.controls).to({polar:t*Mt.DEG2RAD},e).onComplete(()=>{this._animComplete(),i&&i()}).start())}get viewAngle(){return this.controls.azimuthal*Mt.RAD2DEG}set viewAngle(t){var e,i;"number"==typeof t&&(t={angle:t}),e=void 0===t.duration?this.map.config.animateDuration:t.duration,i=t.callback,t=t.angle,t=kh.getNearestAngle(this.viewAngle,t,!0)+this.viewAngle,this._stopAnim("veiwAngleAnim"),this._animStart(),this._props.veiwAngleAnim=new wh.Tween(this.controls).to({azimuthal:t*Mt.DEG2RAD},e).onComplete(()=>{this._animComplete(),i&&i()}).start()}get backgroundColor(){return this._backgroundColor||"#282a35"}set backgroundColor(t){this.renderer.setClearColor(t),this._backgroundColor=t}get backgroundAlpha(){return void 0===this._backgroundAlpha?1:this._backgroundAlpha}set backgroundAlpha(t){this.renderer.setClearAlpha(t),this._backgroundAlpha=t}get zoom(){return kh.getZoomFactor(this.map)*this.pixelsPerCentimeter*100}set zoom(t){this._stopAnim("zoomAnim");var e=this.map.config.animateDuration,i=null,n=null;"object"==typeof t&&(e=void 0===t.duration?e:t.duration,i=t.callback,n="string"==typeof t.easing?kh.getEasingByName(t.easing):t.easing,t=t.zoom),"2d"===this.viewMode&&this.updateCamera2D(this.currentCamera.top/this.currentCamera.zoom);var r=kh.getCameraDataByZoom(this.map,t),a=r.distance,o=r.top;a=Math.min(Math.max(a,this.maxLevelData.distance),this.minLevelData.distance),o=Math.min(Math.max(o,this.maxLevelData.top),this.minLevelData.top),this._animStart(),this._props.zoomAnim=new wh.Tween(this).to({"controls.distance":a,camera2DTop:o,props:["camera2DTop"]},e).easing(n||wh.Easing.Quartic.Out).onComplete(()=>{this._animComplete(),i&&i()}).onUpdate(()=>{this.camera2D.updateProjectionMatrix(),this.map.emit("zoom")}).start()}get zoomLevel(){for(var t=this._zoom||this.zoom,e=0;ethis.zoomLevels[e])return e;return this.zoomLevels.length}set zoomLevel(t){"number"==typeof t&&(t={level:t}),t.level=Math.max(Math.min(t.level,29),1);var e=(this.zoomLevels[t.level-1]-this.zoomLevels[t.level])/2;t.zoom=this.zoomLevels[t.level]+e,this.zoom=t}setZoomLevelRangeData(t,e){t=this.zoomLevels[(t||this.map.config.minZoomLevel)-1],e=this.zoomLevels[(e||this.map.config.maxZoomLevel)-1];var i=kh.getCameraDataByZoom(this.map,t),n=kh.getCameraDataByZoom(this.map,e);this.minLevelData=i,this.maxLevelData=n}setZoomLevelRange(t,e){this.map.config.minZoomLevel=t,this.map.config.maxZoomLevel=e,this.setZoomLevelRangeData(t,e),this.zoomLevele&&(this.zoomLevel=e)}get minZoomLevel(){return this.map.config.minZoomLevel}set minZoomLevel(t){t=Math.min(Math.max(1,t),28),this.setZoomLevelRange(t,this.maxZoomLevel)}get maxZoomLevel(){return this.map.config.maxZoomLevel}set maxZoomLevel(t){t=Math.min(Math.max(1,t),28),this.setZoomLevelRange(this.minZoomLevel,t)}moveTo(t,e){var i=this;if(!i.stopMoveTo()){var n,r,a,o,s,prom=new Nh,h=t.zoom||t.zoomLevel,l=void 0===t.duration?this.map.config.animateDuration:t.duration,c=null;t||(t=new Lt),Array.isArray(t)&&(t=(new Lt).fromArray(t)),t instanceof Lt||(n=kh.getNearestAngle(this.viewAngle,t.viewAngle,!0)+this.viewAngle,r=t.polarAngle,l=void 0===t.duration?l:t.duration,c=t.callback,o="string"==typeof t.easing?kh.getEasingByName(t.easing):t.easing,t.zoomLevel&&(s=(i.zoomLevels[t.zoomLevel-1]+i.zoomLevels[t.zoomLevel])/2),t.zoom&&(s=t.zoom),s&&(a=kh.getCameraDataByZoom(this.map,s).distance),t=t.viewCenter?Array.isArray(t.viewCenter)?(new Lt).fromArray(t.viewCenter):t.viewCenter.clone():null),o=o||wh.Easing.Cubic.Out,n=void 0===n?this.controls.azimuthal*Mt.RAD2DEG:n,r=void 0===r?this.controls.polar*Mt.RAD2DEG:r,a=void 0===a?this.controls.distance:a,t=t||this.controls.target.clone();var u,d,p=!1;"2d"===this.viewMode?(p=!0,r=0,u=kh.getCameraDataByZoom(this.map,this.zoom).distance):u=this.controls.distance,d=a-u,this._animStart();var f=n*Mt.DEG2RAD,m=r*Mt.DEG2RAD;return Math.abs(i.controls.azimuthal-f)<.05&&Math.abs(i.controls.polar-m)<.05&&i.controls.target.distanceTo(t)<.1&&Math.abs(d)<.1&&(l=0),this._props.moveToAnim=new wh.Tween(i.controls).to({target:t,azimuthal:f,polar:m,props:["target"]},l).easing(o).onUpdate(t=>{if(h&&(i.controls.distance=u+d*t,p)){var e=kh.getCamera2DSize(i.map);i.updateCamera2D(e.top,e.right)}}).onComplete(()=>{i._animComplete(),c&&c(),e&&e(),prom.resolve()}),this._props.moveToAnim.isImportant=t.isImportant,clearTimeout(this._props.move_anim_id),this._props.move_anim_id=setTimeout(()=>{this._props.moveToAnim.start()},0),prom}}_stopAnim(t){if(this._props[t]){if(this._props[t].isImportant)return!0;this._props[t].stop(),this._props[t]=null,this._animComplete()}}_animStart(){this._props.animCount++,this.map.state.addState(this.map.state.VIEW_ANIMATING)}_animComplete(){this._props.animCount--,this._props.animCount<0&&(this._props.animCount=0),this.map.state.removeState(this.map.state.VIEW_ANIMATING)}stopMoveTo(){return this._stopAnim("moveToAnim")}get camera2DTop(){return this.camera2D.top}set camera2DTop(t){this.updateCamera2D(t)}updateCamera2D(t,e,i){e||(e=this.width/this.height*t),i||(this.camera2D._lastTop=this.camera2D.top,this.camera2D.zoom=1),this.camera2D.top=t,this.camera2D.bottom=-t,this.camera2D.right=e,this.camera2D.left=-e,this.camera2D.updateProjectionMatrix()}updateCameraHUD(){var t=this.height/2,e=this.width/2;this.cameraHUD.top=t,this.cameraHUD.bottom=-t,this.cameraHUD.right=e,this.cameraHUD.left=-e,this.cameraHUD.updateProjectionMatrix()}get viewMode(){return this._props.viewMode}set viewMode(t){if("string"==typeof t&&(t={mode:t}),t.mode!==this.viewMode){var e=t.callback;this.map.config.viewMode=this._props.viewMode=t.mode,t.callback=()=>{this.map.emit("viewModeChanged",t.mode),e&&e()},this.setMode(t)}}setMode(t){this._stopAnim("viewModeAnim"),"string"==typeof t&&(t={mode:t}),t.easing&&"string"==typeof t.easing&&(t.easing=kh.getEasingByName(t.easing));var e=this.controls.azimuthal,i=void 0===t.duration?this.map.config.animateDuration:t.duration;switch(t.mode){case"2d":this._animStart(),void 0===t.toNorth&&(t.toNorth=!0),this._props.lastPhi=this.controls.polar<.01?this.map.config.polarAngle*Mt.DEG2RAD:this.controls.polar,this._props.lastViewAngle=this.viewAngle,this.controls.enableRotate=!1;var n={polar:0};t.viewAngle&&(n.azimuthal=t.viewAngle*Mt.DEG2RAD),t.toNorth&&(n.azimuthal=0),this._props.viewModeAnim=new wh.Tween(this.controls).to(n,i).easing(t.easing||wh.Easing.Quartic.Out).onComplete(()=>{var i=kh.getCamera2DSize(this.map);this.currentCamera=this.camera2D,t.toNorth?this.controls.azimuthal=0:this.controls.azimuthal=n.azimuthal||e,this.updateCamera2D(i.top,i.right),this.camera2D.baseTop=i.top,this._animComplete(),t.callback&&t.callback()}),this._props.viewModeAnim.start();break;case"3d":this._animStart(),this.controls.distance=this.controls.distance/this.camera2D.zoom,this.currentCamera=this.camera,this._props.viewModeAnim=new wh.Tween(this.controls).to({polar:this._props.lastPhi||.5,azimuthal:(t.viewAngle||this._props.lastViewAngle)*Mt.DEG2RAD},i).easing(wh.Easing.Quartic.Out).onComplete(()=>{this._animComplete(),t.callback&&t.callback(),this.controls.enableRotate=!0}),this._props.viewModeAnim.start()}}getViewState(t=!1){var e=this.controls.target,i={viewMode:this.viewMode,zoom:this.zoom,zoomLevel:this.zoomLevel,viewAngle:this.viewAngle,polarAngle:this.polarAngle,viewCenter:[e.x,e.y,e.z]};return t?JSON.stringify(i):i}setViewState(t,e,i){var n={};if(["viewMode","zoom","zoomLevel","viewAngle","polarAngle","viewCenter","easing","duration","callback"].forEach(e=>{n[e]=t[e]}),t=n,void 0===e&&(e=t.duration),t.duration=void 0===e?this.map.config.animateDuration:e,t.viewCenter){var r=t.viewCenter;t.viewCenter=new Lt(r[0],r[1],r[2]||0)}return t.viewMode&&t.viewMode!==this.viewMode&&(this.viewMode={mode:t.viewMode,duration:t.duration}),this.moveTo(t,i)}get viewCenter(){var t=this.controls.target;return[t.x,t.y,t.z||0]}set viewCenter(t){var e,i,n;Array.isArray(t)?(e=t[0],i=t[1],n=t[2]):(e=t.x,i=t.y,n=t.z),this.controls.target.set(e,i,n),this.controls.update(!0)}onlyShow(t,e,i){(i=i||{}).withScene||void 0===t?this.map.omScene.showAllNodes():this.map.omScene.onlyShowNode("buildingNode"),this.map.omScene.buildingNode.children.forEach(i=>{void 0===t?(i.visible=!0,i.showAllNodes(),i.floorNode.children.forEach(t=>{t.visible=!0})):t.indexOf(i.data.buildingID)>-1?(i.visible=!0,e&&(i.onlyShowNode("floorNode"),i.floorNode.children.forEach(t=>{t.visible="all"===e||e.indexOf(t.data.floorNumber)>-1}))):i.visible=!1})}getScreenShot(t,e,i,n){var r,a;r=this.width,a=this.height,t=t||r,e=e||a,this.resize(t,e),this.renderer.clearColor(),this.renderer.render(this.map.sceneManager.default,n||this.currentCamera),this.renderer.render(i||this.map.sceneManager.mainScene,n||this.currentCamera);var o=this.renderer.domElement.toDataURL("image/jpeg",1);return this.resize(r,a),o}getScreenShotImage(t=2){var e,i;this.map.baseLayers.length&&(e=(i=this.map.baseLayers[0].entity).parent,this.map.sceneManager.mainScene.add(i));var n=new Image;return n.src=this.getScreenShot(this.width*t,this.height*t),i&&e.add(i),n}get clampSceneArea(){return this._clampSceneArea}set clampSceneArea(t){t?(this._offStartPick=this.map.on("startPick",()=>{this._stopAnim("moveToAnim")}),this._offEndPick=this.map.on("endPick",()=>{var t=this.map.sceneManager.mainScene.area;t.containsPoint(this.controls.target)||(t.clampPoint(this.controls.target,$h),this.moveTo({viewCenter:$h,duration:600,easing:"cubicOut"}))})):(this._offEndPick&&this._offEndPick(),this._offStartPick&&this._offStartPick())}dispose(){this.renderer.renderLists.dispose(),this.renderer.forceContextLoss(),this.controls.dispose(),this.isCanvas||this.map.config.context||this.map.config.container.removeChild(this.renderer.domElement),this.map.off("update",this.updateFunc),this.controls.removeEventListener("change",this.viewChangedFunc),this.renderer.context=null,this.renderer.domElement=null,this.renderer=null}}class el{constructor(t,e){this._name="",this.type="Node",this.data=t||{},this.entity=e,e&&(this.entity.node=this),this.parent=null,this.children=[],this._show=!0}clone(){return new this.constructor(this.data,this.entity)}get name(){return this.data?this.data.name:""}set name(t){this.data.name=t}setEntity(t){var e=null;this.entity&&(e=this.entity.parent),this.entity=t,this.entity&&(this.entity.node=this,e&&e.add(this.entity))}getProp(t){if(this.data)return this.data[t]}setProp(t,e){this.data&&(this.data[t]=e)}getDataClone(){this.data.children&&(this.data.children.length=0);var t=this.data.node;delete this.data.node;var e=kh.cloneJSON(this.data);return this.getDataWithNode&&(e.node=t),t&&(this.data.node=t),e}setData(t){this.data=t}get show(){return this._show}set show(t){this._show=t,this.visible=t}get visible(){return!!this.entity&&this.entity.visible}set visible(t){this.entity&&(this.entity.visible=t&&this.show)}get position(){return this.entity.position}set position(t){this.entity&&(t instanceof Yh?this.entity.position.setFromCoord(t):t instanceof Lt?this.entity.position.copy(t):Array.isArray(t)&&this.entity.position.fromArray(t))}_disposeMaterial(t){t.dispose(),Object.keys(t).forEach(e=>{const i=t[e];i&&"object"==typeof i&&"minFilter"in i&&i.dispose()})}removeEntity(t,e=!0){e&&t.parent&&t.parent.remove(t),t.traverse(t=>{t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(t=>{this._disposeMaterial(t)}):this._disposeMaterial(t.material))})}dispose(){if(this.parent&&this.parent.remove(this),this.entity&&(this.removeEntity(this.entity),this.entity=null,this.children.length))for(var t=this.children.length-1;t>-1;t--)this.children[t]&&this.children[t].dispose();this.data=null}add(t){var e=this;Array.from(arguments).forEach(t=>{var i=!1,n=t.parent?t.parent.entity:t.entity.parent;n&&t.entity&&n!==t.entity&&(t.parent!==this&&t.entity.applyMatrix(n.matrixWorld),t.parent&&t.parent.remove(t),i=!0),e.children.push(t),t.parent=e,e.entity&&t.entity&&e.entity!==t.entity&&(i&&(t.entity.updateMatrixWorld(),t.entity.applyMatrix((new At).getInverse(e.entity.matrixWorld))),e.entity.add(t.entity))})}remove(t,e){var i=this,n=Array.from(arguments);"boolean"==typeof n[n.length-1]&&(e=n.pop());for(var r=n.length-1;r>-1;r--){var a=n[r],o=i.children.indexOf(a);-1!==o&&(i.children.splice(o,1),a.parent=null,a.visible=!1,i.entity&&!1!==e&&i.entity.remove(a.entity))}}find(t,e){var i=null,n="function"==typeof t;return n||(i=Object.keys(t)),kh.traverse(this.children,e=>{if(n)return t(e);for(var r=0,a=i.length;r{this.clear()}),this.map.on("dispose",()=>{this.clear()})}typeNoPicked(t){return["1015"].indexOf(t.data.typeID)<0}add(t){this.mapEventHandlers.indexOf(t)<0&&(this.mapEventHandlers.push(t),this.entities.indexOf(t.entity)<0&&("Object3D"!==t.entity.type||"modelID"in t.data||"linewidth"in t.data)&&!1!==t.data.pickabled&&this.typeNoPicked(t)&&this.entities.push(t.entity))}remove(t){this._removeEntity(t.entity),this._removeHandler(t)}_removeHandler(t){var e=this.mapEventHandlers.indexOf(t);-1!==e&&this.mapEventHandlers.splice(e,1)}_removeEntity(t){var e=this.entities.indexOf(t);-1!==e&&this.entities.splice(e,1)}clear(){this.mapEventHandlers.length=0,this.entities.length=0}update(t){this.mapEventHandlers.forEach(e=>{e.visible&&e.update&&e.update(t)})}}class nl extends el{constructor(t,e,i){super(e,i),this.map=t,this.enabled=!0,this.pickIndex=0,this.picked,this.longPressed,this.doubleClick,this.startPick,this.endPick,this.mouseenter,this.mouseleave,t&&i&&t.mapEventHandlerManager.add(this)}get pickabled(){return!!this.data&&(!1!==this.data.pickabled||this.data.pickabled)}set pickabled(t){this.data.pickabled=t}clone(){var t=new this.constructor(this.map,this.data,this.entity);return t.enabled=this.enabled,t.pickabled=this.pickabled,t.draggable=this.draggable,this.parent&&this.parent.add(t),t}setEntity(t){t&&(super.setEntity(t),this.map.mapEventHandlerManager.remove(this),this.map.mapEventHandlerManager.add(this))}dispose(){this.map.mapEventHandlerManager.remove(this),super.dispose()}}class rl{constructor(t){this.map=t,this.scripts=[],this.scriptClasses={},this.offUpdate=this.map.on("update",t=>{this.invokeScripts("update",t)}),this.offSceneLoaded=this.map.on("sceneDataProcessed",t=>{this.createSceneScripts(t)})}clearScripts(){this.scripts.length=0,this.scriptClasses={}}destroy(){this.clearScripts(),this.offUpdate(),this.offSceneLoaded()}createScriptByString(t,e){var i=new Function("map","scene",`${e}\n\nreturn ${t};`)(this.map,this.map.omScene);return this.scriptClasses[t]=i,i}createSceneScripts(t){}addScript(t,e){this.scriptClasses[t]=e}getClassByName(t){return this.scriptClasses[t]}registerScript(t){this.scripts.push(t)}removeScript(t){var e=this.scripts.findIndex(e=>e.name===t);this.scripts.splice(e,1)}invokeScripts(t,...e){var i=this.scripts.length;if(i)for(var n=i-1;n>-1;n--){var r=this.scripts[n];if(r.enabled&&r[t])try{r[t](...e)}catch(t){kh.error(t)}}}}class al extends nl{constructor(t,e,i){super(t,e=e||{children:[]},i=i||new de),!t.config.forceNewID&&this.data.id&&-1!==this.data.id||(this.data.id=kh.generateID().toLowerCase()),this.type="OMNode",this.data.scripts||(this.data.scripts=[]),this.scripts=[],e.scripts.forEach(t=>{this.addScript(t)})}get id(){return this.data.id||-1}get userData(){return this.nodeIndex?this.nodeIndex.userData:this.data.userData}clone(t){var e=this.data.node;delete this.data.node;var i=kh.cloneJSON(this.data);"function"==typeof t?t(i):"object"==typeof t&&Object.assign(i,t),i.id=-1,this.data.node=e;var n=new this.constructor(this.map,i,this.entity);return this.parent&&this.parent.add(n),n}updateTransform(){if(this.data.transform)return this.data.transform.position=this.entity.position.toArray(),this.data.transform.rotation=this.entity.rotation.toArray().slice(0,3),this.data.transform.scale=this.entity.scale.toArray(),this.data.transform}add(){var t=this,e=!1,i=Array.from(arguments);"boolean"==typeof i[i.length-1]&&(e=i.pop()),super.add.apply(this,i),t.parent&&t.parent.data.children&&i.forEach(e=>{kh.findFromArray(t.parent.data.children,"id",e.data.id,function(e,i){t.parent.data.children.splice(i,1)})}),i.forEach(t=>{t instanceof al&&t.updateTransform()}),e&&t.data.children&&i.forEach(e=>{t.data.children.push(e.data)})}remove(t,e){var i=this;if(super.remove.apply(this,Array.from(arguments)),i.data&&i.data.children){var n=Array.from(arguments);"boolean"==typeof n[n.length-1]&&n.pop();for(var r=n.reduce((t,e)=>(void 0!==e.data.id&&t.push(e.data.id),t),[]),a=i.data.children.length-1;a>-1;a--){var o=i.data.children[a];r.includes(o.id)&&i.data.children.splice(a,1)}}}setTransform(t){(t=t||this.data.transform)&&(this.setPosition(t.position),this.setRotation(t.rotation),this.setScale(t.scale))}setPosition(t){t instanceof Lt&&(t=t.toArray()),this.data.transform.position=t,this.entity.position.fromArray(t),this.entity.updateMatrix()}setRotation(t){t instanceof ae&&(t=t.toArray().slice(0,3)),this.data.transform.rotation=t,this.entity.rotation.fromArray(t)}setScale(t){t instanceof Lt&&(t=t.toArray()),this.data.transform.scale=t,this.entity.scale.fromArray(t)}getAncestor(){if(!this.entity)return null;var t={sceneID:"",buildingID:"",floorNumber:0,scene:null,building:null,floor:null};return this.entity.traverseAncestors(e=>{e.node&&("OMFloor"===e.node.type?(t.floor=e.node,t.floorNumber=e.node.data.floorNumber):"OMBuilding"===e.node.type?(t.building=e.node,t.buildingID=e.node.data.buildingID):"OMScene"===e.node.type&&(t.scene=e.node,t.sceneID=e.node.data.sceneID))}),t}addScript(t){"string"==typeof t&&(t={name:t});var e=t.class||this.map.scriptManager.getClassByName(t.name);if(e){var i=new e(t.data);i.name=t.name,i.node=this;var n=this.data.scripts.findIndex(e=>e.name===t.name);if(this.scripts.push(i),n>-1?this.data.scripts[n]=t:this.data.scripts.push(t),this.map.scriptManager.registerScript(i),i.start)try{i.start()}catch(t){kh.warn(t)}}else kh.warn(`script: ${t.name} is not registered!`)}removeScript(t){this.scripts.length,this.map.scriptManager.removeScript(t);var e=this.data.scripts.findIndex(e=>e.name===t);if(e>-1&&this.data.scripts.splice(e,1)[0],(e=this.scripts.findIndex(e=>e.name===t))>-1)var i=this.scripts.splice(e,1)[0];if(i&&i.onDestroyed)try{i.destroy()}catch(t){kh.warn(t)}}removeAllScriptInstance(t){this.scripts.forEach(t=>{t.node=null}),this.scripts.length=0}getScriptByName(t){return this.scripts.find(e=>e.name===t)}invokeScript(t,...e){var i=this.scripts.length;if(i)for(var n=i-1;n>-1;n--){var r=this.scripts[n];if(r&&r.enabled&&r[t])try{r[t](...e)}catch(t){kh.error(`ooomap script: ${r.name}`,t)}}}}class ol extends al{constructor(t,e,i){super(t,e,i),this.lastVisibles={},this.blockMap={}}getData(){this.data.blocks.length=0,this.data.models.length=0,this.data.route&&(this.data.route=null),this.data.markers&&(this.data.markers.length=0);var t=this.getDataClone();return this.markerNode&&(this.data.markers=this.markerNode.children.map(t=>t.getData())),this.modelNode&&(this.data.models=this.modelNode.children.map(t=>t.getData())),this.blockNode&&(this.data.blocks=this.blockNode.children.map(t=>t.getData())),this.route&&(this.data.route=this.route.getData()),this.getRootModelRadius(),t.blocks=this.data.blocks,t.models=this.data.models,this.data.markers&&(t.markers=this.data.markers),this.data.route&&(t.route=this.data.route),t}getBlockByTypeID(t){return this.blockMap[t]}setBlockByTypeID(t,e){this.blockMap[t]=e}hideNodes(){this.modelNode.visible=!1,this.blockNode.visible=!1,this.markerNode&&(this.markerNode.visible=!1)}keywordsFind(t){var{config:t,checkTag:e,checkWords:i}=kh._keywordsFindConfig(t);return this.findData(t=>t.name&&i([t.name])||t.content&&t.content.texts&&i(t.content.texts)||t.tag&&e(t.tag),t)}showNodesAnimate(t,e){var i=this.map.frameRate;this.map.frameRate=this.map.maxFrameRate,this._showAnim&&(this._showAnim.stop(),this._showAnim=null),e=Object.assign({duration:1e3,easing:t?"cubicOut":"cubicIn",animateAlpha:!0,nodes:[this.modelNode,this.blockNode]},e),t?e.nodes.forEach(t=>t.visible=!0):this.markerNode&&(this.markerNode.show=!1);var n=[],r=[];function a(e,i,n,r){e=Math.max(.01,e),i.nodes.forEach(i=>{i.entity.scale.z=t?e:Math.max(1-e,.01)}),i.animateAlpha&&n.forEach((t,i)=>{t.opacity=r[i].start+r[i].cha*e})}e.animateAlpha&&(n=kh.collectMaterials(e.nodes),r=[],n.forEach(e=>{"_originAlpha"in e||(e._originAlpha=e.opacity),r.push({start:e.opacity,cha:(t?e._originAlpha:0)-e.opacity})})),a(0,e,n,r);var o="string"==typeof e.easing?kh.getEasingByName(e.easing):e.easing;this._showAnim=new wh.Tween({x:.01}).to({x:1},e.duration).onUpdate(t=>{a(t,e,n,r)}).onComplete(()=>{e.nodes.forEach(e=>e.visible=t),t&&this.markerNode&&(this.markerNode.show=!0),n.length=r.length=0,this.map.frameRate=i,this._showAnim=null,e.callback&&e.callback()}).easing(o).start()}showNodes(){this.modelNode.visible=!0,this.blockNode.visible=!0,this.markerNode&&(this.markerNode.visible=!0)}getRootModelRadius(){this.modelNode.children.forEach(t=>{var e=kh.getBoundingSphere(t.entity);t.data.radius=e.radius})}forEachNode(t){["modelNode","markerNode","blockNode","routeNode","buildingNode","floorNode"].forEach(e=>{this[e]&&t&&t(this[e])})}onlyShowNode(t){this.showAllNodes(),this.forEachNode(e=>{this.lastVisibles[e.getProp("id")]=e.visible,e.visible=e.name===t})}showAllNodes(){this.forEachNode(t=>{var e=t.getProp("id"),i=!0;i=!(e in this.lastVisibles)||this.lastVisibles[e],t.visible=i,t.treeNode&&(t.treeNode.tail.value=i)})}setPosition(t){t instanceof Lt&&(t=t.toArray()),(this.nodeIndex||this.data).transform.position=t,this.entity.position.fromArray(t),this.entity.updateMatrix()}setRotation(t){t instanceof ae&&(t=t.toArray().slice(0,3)),(this.nodeIndex||this.data).transform.rotation=t,this.entity.rotation.fromArray(t)}setScale(t){t instanceof Lt&&(t=t.toArray()),(this.nodeIndex||this.data).transform.scale=t,this.entity.scale.fromArray(t)}dispose(){if(this.entity){var t=this.entity.parent;t&&t.remove(this.entity)}this.markerNode&&(this.markerNode.children.forEach(t=>{t.dispose()}),this.markerNode.children.length=0),this.modelNode&&(this.modelNode.children.forEach(t=>{t.dispose()}),this.modelNode.children.length=0),this.route&&this.route.dispose(),this.blockNode&&(this.blockNode.children.forEach(t=>{t.dispose()}),this.blockNode.children.length=0),this.buildingNode&&this.buildingNode.dispose(),this.floorNode&&this.floorNode.dispose()}}class sl extends al{constructor(t,e){super(t,e),this.name="markerNode",this.entity.name="markerNodeEntity",this._cleanChildren=!0,this.cleanChildren=void 0===this.data.cleanChildren||this.data.cleanChildren,this._count=0,this.minLevel=10,this.maxLevel=24,this.isBackground=!0,this.background=!0,this.viewChangedFunc=this.childrenVisible.bind(this),this.map.on("viewChanged",this.viewChangedFunc)}get show(){return this._show}set show(t){this.background=!t,this._show=t,this.visible=t}get background(){return this.isBackground}set background(t){!this.isBackground&&t?this.children.forEach(t=>{t.markerHide&&t.markerHide()}):this.isBackground&&!t&&this.children.forEach(t=>{!t.autoHide&&t.markerShow&&t.markerShow()}),this.isBackground=t}get cleanChildren(){return this._cleanChildren}set cleanChildren(t){this._cleanChildren=t,t||this.children.forEach(t=>{t.targetAlpha=1,t.visible=!0})}bind(t){t.markerNode=this,this.target=t,t.data&&(this.data.children=t.data.markers),t.add(this)}childrenVisible(){var t=this.map.view.zoomLevel;if(this.visible=t>=this.minLevel&&t=r.data.maxLevel)r.markerHide();else if(r.updateRect&&r.updateRect(),"SpriteMarkerNode"!==r.type||r.entity.imageLoaded)if(this._cleanChildren){e=!1;for(var a=0,o=i;as.priority?s.markerHide():(e=!0,r.markerHide()))}e||r.markerShow()}else r.markerShow()}else r.updateRect&&r.updateRect()}}update(t){this.visible&&(this._count+=t,this._count>1&&(this._count=0,this.childrenVisible()))}dispose(){this.map.off("viewChanged",this.viewChangedFunc),super.dispose()}}var hl={id:-1,name:"",type:"cube",visible:!0,transform:{position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]},children:[],materialID:null,color:"#dddddd",alpha:1,minLevel:0,maxLevel:28,userData:{},tag:""},ll=new Ie(1,1,1),cl=new _r(1,1),ul=new wa(.5,.5,1,8),dl=new Sr(1,2),pl=new wa(.5,.5,1,24),fl=new Ma(.5,1,4),ml=new Ma(.5,1,24);[ll,cl,ul,dl,pl,fl,ml].forEach(t=>{t.scale(5,5,5)}),[ll,ul,pl,fl,ml].forEach(t=>{t.rotateX(Math.PI/2),t.translate(0,0,2.5)}),[fl].forEach(t=>{t.rotateZ(Math.PI/4)});class gl extends al{constructor(t,e,i){if("string"==typeof(e=e||"cube")){var n=kh.cloneJSON(hl);n.type=e,e=n}e.name||(e.name=e.type),super(t,e),this.data.node=this,this.type="OMPrimitive",this.options=i,this.setData(),this.pickIndex=3}createEntity(){var t=null,e=new Na({transparent:!0});switch(this.data.type){case"group":t=new de;break;case"cube":t=new Qe(ll,e);break;case"sphere":t=new Qe(dl,e);break;case"lowSphere":t=new Qe(cl,e);break;case"cylinder":t=new Qe(pl,e);break;case"lowCylinder":t=new Qe(ul,e);break;case"pyramid":t=new Qe(fl,e);break;case"cone":t=new Qe(ml,e)}this.setEntity(t)}getData(t){var e=this.getDataClone(),i=e.transform;return i.position=this.entity.position.toArray(),i.rotation=this.entity.rotation.toArray().slice(0,3),i.scale=this.entity.scale.toArray(),this.children.forEach(t=>{t.getData(e.children)}),t&&t.push(e),e}getData2(){var t=this.data.node;delete this.data.node;var e=kh.cloneJSON(this.data),i=e.transform;return t&&(this.data.node=t),i.position=this.entity.position.toArray(),i.rotation=this.entity.rotation.toArray().slice(0,3),i.scale=this.entity.scale.toArray(),e}setData(){if(this.createEntity(),this.setTransform(),this.entity.material&&(this.setColor(this.data.color),this.setAlpha(this.data.alpha)),!this.options||!1!==this.options.createChildren){var t=this.data.children;this.data.children=[],t.forEach(t=>{var e;e=t.modelID?new gl.OMModel(this.map,t):new this.constructor(this.map,t),this.add(e)})}}setColor(t){this.entity.material&&(kh.setMaterialColor(this.entity.material,t),this.data.color=t)}setAlpha(t){this.entity.material&&(this.entity.material.opacity=t,this.data.alpha=t)}}class vl extends Lt{id=null;constructor(t){if(t=t||{},super(),this.id=t.id||kh.generateID(6),this.enabled=!0,this.pointType=t.type||0,this.segments=[],t.connects&&"string"==typeof t.connects)try{t.connects=JSON.parse(t.connects)}catch(t){kh.log("ERROR: RoadPoint connects parseError!")}this.data=t,this.group=t.group,this.connects=t.connects,this.type="roadPoint",t.coord&&this.fromArray(t.coord)}clone(){return new this.constructor({coord:this.toArray(),type:this.pointType,group:this.group,connects:this.connects})}addSegment(t){this.segments.indexOf(t)<0&&this.segments.push(t)}removeSegment(t){var e=this.segments.indexOf(t);e>-1&&this.segments.splice(e,1)}setPointType(t){this.pointType=t,this.helper&&this.helper.setType(this.type)}isSameLiftPoint(t,e=25){return t.pointType===this.pointType&&this.group===t.group&&!(Math.abs(this.x-t.x)>e||Math.abs(this.y-t.y)>e)}checkConnectFloor(t){if(!this.enabled)return!1;if(0===this.pointType)return!1;if(!this.data.connects)return!0;var e=this.data.connects,i=!1;if(e.include&&Array.isArray(e.include)&&e.include.length&&(i=e.include.indexOf(t)>-1),void 0!==e.gte&&(i=t>=e.gte),void 0!==e.lte&&(i=t<=e.lte),void 0!==e.even){var n=t%2==0;i=e.even?n:!n}return e.exclude&&Array.isArray(e.exclude)&&e.exclude.length&&(i=e.exclude.indexOf(t)<0),i}update(){this.segments.forEach(t=>{t.update()})}getData(){return{id:this.id,coord:this.toArray(),type:this.pointType,group:this.group,connects:"string"==typeof this.connects?this.connects:JSON.stringify(this.connects)}}}var yl=new Lt,xl=new Lt,bl=new Lt;class wl{constructor(t){this.indexes=[],this.points=[],this.lineNode=null,this.direction=null,this.directionLine=null}setPoints(t,e){this.points.length=0,this.points.push(t,e),t.addSegment(this),e.addSegment(this),this.update()}getCenter(){if(!(this.points.length<2))return this.points[0].clone().add(this.points[1]).divideScalar(2)}delta(){return bl.subVectors(this.points[1],this.points[0])}closestPointToPointParameter(t,e=!0){yl.subVectors(t,this.points[0]),xl.subVectors(this.points[1],this.points[0]);var i=xl.dot(xl),n=xl.dot(yl)/i;return e&&(n=Mt.clamp(n,0,1)),n}closestPointToPoint(t,e,i=!0){return e=void 0===e?this.closestPointToPointParameter(t,i):e,this.delta(bl).multiplyScalar(e).add(this.points[0])}getLength(){return 2!==this.points.length?-1:+this.points[0].distanceTo(this.points[1]).toFixed(2)}getOtherPoint(t){if(this.points.length>1)return this.points[0].id===t?this.points[1]:this.points[0]}getLoopSegmentsOut(t,e){let i=[];t.points.forEach((t,n)=>{t.segments.length<3&&(i=t.segments.filter(t=>e.indexOf(t)<0),Array.prototype.push.apply(e,i),i.forEach(t=>this.getLoopSegmentsOut(t,e)))})}sortedLoopSegments(t){let e=null;for(var i=0;i2!==t.segments.length);if(n){e=n;break}}let n=[e],r=[],a=t.slice();for(;a.length;){let t=n[n.length-1],e=a.findIndex(e=>e.points.indexOf(t)>-1),i=a[e];r.push(i),n.push(i.getOtherPoint(t.id)),a.splice(e,1)}let o=r;return o.sortedPoints=n,o}getLoopSegments(t){let e=[];return this.getLoopSegmentsOut(t,e),this.sortedLoopSegments(e)}update(){this.lineNode&&(this.lineNode.points[0].copy(this.points[0]),this.lineNode.points[1].copy(this.points[1]),this.lineNode.build())}remove(){this.points.forEach(t=>{t.removeSegment(this)}),this.directionLine&&this.directionLine.dispose(),this.lineNode.dispose(),this.lineNode=null,this.points.length=0,this.indexes.length=0}getData(){var t={indexes:this.points.map(t=>t.id)};return null!==this.direction&&2!==this.direction&&(t.direction=this.direction),t}}class _l extends nl{constructor(t,e,i){super(t,e,i),this.draggable=kh.getp(this.data,"draggable",!1),this.fixedPixelSize=kh.getp(this.data,"fixedPixelSize",!0),this._offset=new Lt,this._startPicked=!1,this._isDragged=!1,this.pixelSize=kh.getp(this.data,"pixelSize",15),this.focusFactor=1}update(){if(this.fixedPixelSize){var t=kh.getZoomFactor(this.map,this.entity.position);this.entity.scale.setScalar(t*this.pixelSize*this.focusFactor)}}setEntity(t){super.setEntity(t)}startPick(t){this._isDragged=!1,this.draggable&&(this.map.view.controls.enabled=!1,this.map.mouseTrack.startTrack(this))}endPick(t){this.draggable&&(this.map.view.controls.enabled=!0,this.map.mouseTrack.stopTrack(),this._isDragged&&(this.onDraggedComplete&&this.onDraggedComplete(this),this._isDragged=!1))}mousedown(t){this._startPicked=!!t.trackerIntersect,this._startPicked&&(t.event.stopPropagation(),this._offset.copy(this.entity.position.clone().sub(t.point)))}mousemove(t){if(this.draggable&&t.isMouseDown&&this._startPicked){t.event.stopPropagation(),this._isDragged=!0;let e=t.point.clone().add(this._offset),i=e.clone().sub(this.entity.position);this.entity.position.copy(e),this.onDragged&&this.onDragged(this.entity.position,i)}}}_l.defaultData={draggable:!1,fixedPixelSize:!0},Lt.prototype.toArray=function(t,e,i=3){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=+this.x.toFixed(i),t[e+1]=+this.y.toFixed(i),t[e+2]=+this.z.toFixed(i),t};var Ml=function(){Us.call(this),this.type="LineSegmentsGeometry",new Ee,this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.addAttribute("position",new Ae([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.addAttribute("uv",new Ae([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))};Ml.prototype=Object.assign(Object.create(Us.prototype),{constructor:Ml,isLineSegmentsGeometry:!0,applyMatrix:function(t){var e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return void 0!==e&&(t.applyToBufferAttribute(e),t.applyToBufferAttribute(i),e.data.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},setPositions:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var i=new Gs(e,6,1);return this.addAttribute("instanceStart",new Kn(i,3,0)),this.addAttribute("instanceEnd",new Kn(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this.maxInstancedCount=this.attributes.instanceStart.data.count,this},setColors:function(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var i=new Gs(e,6,1);return this.addAttribute("instanceColorStart",new Kn(i,3,0)),this.addAttribute("instanceColorEnd",new Kn(i,3,3)),this},fromWireframeGeometry:function(t){return this.setPositions(t.attributes.position.array),this},fromEdgesGeometry:function(t){return this.setPositions(t.attributes.position.array),this},fromMesh:function(t){return this.fromWireframeGeometry(new fr(t.geometry)),this},fromLineSegements:function(t){var e=t.geometry;return e.isGeometry?this.setPositions(e.vertices):e.isBufferGeometry&&this.setPositions(e.position.array),this},computeBoundingBox:function(){var t=new Ut;return function(){null===this.boundingBox&&(this.boundingBox=new Ut);var e=this.attributes.instanceStart,i=this.attributes.instanceEnd;void 0!==e&&void 0!==i&&(this.boundingBox.setFromBufferAttribute(e),t.setFromBufferAttribute(i),this.boundingBox.union(t))}}(),computeBoundingSphere:function(){var t=new Lt;return function(){null===this.boundingSphere&&(this.boundingSphere=new Gt),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,i=this.attributes.instanceEnd;if(void 0!==e&&void 0!==i){var n=this.boundingSphere.center;this.boundingBox.getCenter(n);for(var r=0,a=0,o=e.count;a\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n uniform vec3 color_a;\n \n \n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include \n\t\t\t#include \n\n\n\t\t\tgl_FragColor = vec4(color_a,diffuseColor.b);\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t"};class Al extends Ye{constructor(t){super({type:"LineMaterial",uniforms:Jt.clone(ee["line-fade"].uniforms),vertexShader:ee["line-fade"].vertexShader,fragmentShader:ee["line-fade"].fragmentShader,clipping:!0}),Object.defineProperties(this,{color_a:{enumerable:!0,get:function(){return this.uniforms.color_a.value},set:function(t){this.uniforms.color_a.value=t}},color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},diffuse:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set(t){Boolean(t)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===t?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(t)}}Al.prototype.isLineMaterial=!0,te.line={linewidth:{value:1},resolution:{value:new St(64,64)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},ee.line={uniforms:Jt.merge([te.common,te.fog,te.line]),vertexShader:"\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t"};var Tl=function(t){Ye.call(this,{type:"LineMaterial",uniforms:Jt.clone(ee.line.uniforms),vertexShader:ee.line.vertexShader,fragmentShader:ee.line.fragmentShader}),Object.defineProperties(this,{dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set:function(t){t?this.defines.USE_DASH="":delete this.defines.USE_DASH,this.needsUpdate=!0}},color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}}),this.setValues(t)};(Tl.prototype=Object.create(Ye.prototype)).constructor=Tl,Tl.prototype.isLineMaterial=!0,Tl.prototype.copy=function(t){return Ye.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.resolution=t.resolution,this};var Ll=function(t,e){Qe.call(this),this.type="LineSegments2",this.geometry=void 0!==t?t:new Ml,this.material=void 0!==e?e:new Al({color:16777215*Math.random()}),this.raycast_to_segment=!0};Ll.prototype=Object.assign(Object.create(Qe.prototype),{constructor:Ll,isLineSegments2:!0,computeLineDistances:function(){var t=new Lt,e=new Lt;return function(){for(var i=this.geometry,n=i.attributes.instanceStart,r=i.attributes.instanceEnd,a=new Float32Array(2*n.data.count),o=0,s=0,h=n.data.count;ol)){p.applyMatrix4(this.matrixWorld);var v=n.ray.origin.distanceTo(p);if(!(vn.far||(r.push({distance:v,point:d.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}),this.raycast_to_segment)))return}}}}()});var Cl=function(t,e){Ll.call(this),this.type="Line2",this.geometry=void 0!==t?t:new Sl,this.material=void 0!==e?e:new Tl({color:16777215*Math.random()})};Cl.prototype=Object.assign(Object.create(Ll.prototype),{constructor:Cl,isLine2:!0,copy:function(t){return this}});class Pl extends _l{constructor(t,e){super(t,e),this.data=this.data||{},this.highlightColor=this.data.highlightColor||16777215,this.normalColor=this.data.color||this.data.normalColor||16435041,this.type="ELineNode",this.class="ELineNode",this.points=[],this.allPoints=[],this.segments=this.data.segments||8,this.pickIndex=1,this.isStraight=this.data.isStraight,this.isClosed=this.data.isClosed,this.isSelected=!1,this.fixedPixelSize=!1,this._color=new Qt(this.normalColor);var i=new Sl,n=new Al({color_a:this._color.toArray(),linewidth:this.data.linewidth||4,transparent:!0}),r=new Cl(i,n);this.setEntity(r),n.dashed=this.data.dashed,n.gapSize=this.data.gapSize,this.offResize=this.map.on("resize",(t,e)=>{n.resolution.set(t,e)}),n.resolution.set(this.map.view.width,this.map.view.height),this.buildFunc=this.build.bind(this),this.data.points&&this.data.points.length&&this.addPoint(this.data.points)}get color(){return this._color}set color(t){t.isColor?this._color.copy(t):this._color.set(t),this.entity.material.color_a?this.entity.material.color_a=this._color.toArray():this.entity.material.color=this._color}doubleClick(t,e){this.noPicked||Pl.doubleClick&&Pl.doubleClick(this,e)}checkBeizer(t,e){var i=0;return"bezier"===t.type&&(i=1),"bezier"===e.type&&(i=i?3:2),i}getSegmentCurvePoints(t,e,i){var n;return n=1===i||3===i?t.outPoint:t.clone(),new So(t,n,2===i||3===i?e.inPoint:e.clone(),e).getPoints(this.segments)}getPoints(){if(!(this.points.length<2)){for(var t=[],e=1,i=this.points.length;e{t.index=e.points.length,e.points.push(t)}),e.data.maxPoints&&e.points.length>e.data.maxPoints&&(e.points=e.points.slice(e.points.length-e.data.maxPoints)),e.build()}getCenter(){var t=new Lt;return this.points.forEach(e=>{t.add(e.clone())}),t.divideScalar(this.points.length)}setPivot(t){var e=t;if(!e){var i=this.getCenter();e=i.clone().negate()}this.entity.geometry.applyMatrix((new At).makeTranslation(e.x,e.y,e.z)),this.entity.position.copy(i)}insertPoint(t,e){}deletePoint(t){}updatePointPostion(t,e,i){var n=this.points[t];n[t].x=e,n[t].y=i,n.inPoint&&(n.inPoint.x=e,n.inPoint.y=i),n.outPoint&&(n.outPoint.x=e,n.outPoint.y=i),this.build()}updateGeometry(t){if(t&&!(t.length<2)){var e=new Float32Array(3*t.length);t.forEach((t,i)=>{var n=3*i;e[n]=t.x,e[n+1]=t.y,e[n+2]=t.z}),this.entity.geometry.setPositions(e),this.entity.computeLineDistances(),this.entity.scale.setScalar(1),this.entity.geometry.computeBoundingSphere()}}build(){var t=this.getPoints();this.updateGeometry(t)}dispose(){super.dispose(),this.offResize(),this.allPoints.length=0,this.points.length=0}hideHelpers(t){(t||this).points.forEach(t=>{t.helper&&t.helper.unBind(),t.inPoint&&t.inPoint.helper&&t.inPoint.helper.unBind(),t.outPoint&&t.outPoint.helper&&t.outPoint.helper.unBind()})}showHelpers(t){(t||this).points.forEach(t=>{t.helper||this.map.ehp.getHelper().bind(t),t.inPoint&&!t.inPoint.helper&&this.map.ehp.getHelper().bind(t.inPoint),t.outPoint&&!t.outPoint.helper&&this.map.ehp.getHelper().bind(t.outPoint)})}select(t){(t=void 0===t||t)?(this._lastColorArray||(this._lastColorArray=this.entity.material.color_a.slice()),this.entity.material.color_a=new Qt(this.highlightColor).toArray()):this.entity.material.color_a=this._lastColorArray||new Qt(this.normalColor).toArray(),this.isSelected=t,this.dragable=t}unSelect(){this.entity&&(this.entity.material.color_a=this._lastColorArray||new Qt(this.normalColor).toArray(),this._lastColorArray=null,this.isSelected=!1,this.dragable=!1)}}class El extends ge{constructor(t){super();var e=this;e.path=null,e.radius=1,e.segments=4,e.segLens=[],Object.assign(e,t),e.path||(e.path=[new Lt(-10,-10,0),new Lt(0,-5,0),new Lt(10,-10,0),new Lt(10,-30,0),new Lt(-10,-30,0)],e.path=kh.buildCurvePoints(e.path)),e.path=e.path.slice(),e.yScale=e.yScale||1,e.up||(e.up=new Lt(0,0,1)),e._uvs=[],e._rings=[],e.breakIndexes=[],Dl(e)}setRadius(t){for(var e,i,n=this,r=0,a=n._rings,o=1,s=0;s=t)return{point:i.path[a-1].clone().add(e.clone().multiplyScalar(t-r)).add(i.center),direction:e,index:a-1};r=n}return{point:i.path[i.path.length-1].clone().add(i.center),direction:e,index:i.path.length-1}}}var Dl=function(t){!t.path||t.path.length<2||(function(t,e){if(e.length<2)return;let i,n=null,r=null,a=null;for(var o=0;o0&&(g+=n.distanceTo(i)),v=0,t._rings[l]=[],n.clone().y=0;for(var x=0,b=0;b\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n void main() {\n #include \n #include \n #include \n #include \n #ifdef USE_ENVMAP\n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n }\n ",fragmentShader:"\n uniform vec3 diffuse;\n uniform float opacity;\n uniform vec2 repeat;\n uniform vec2 offset;\n uniform float passRatio;\n #ifndef FLAT_SHADED\n varying vec3 vNormal;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n void main() {\n #include \n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n // #include \n #ifdef USE_MAP\n // support repeat and offset\n vec2 uv = fract(repeat * vUv + offset);\n vec4 texelColor = texture2D( map, uv );\n // 走过的路段变灰\n if (vUv.x < passRatio) {\n float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114));\n texelColor.xyz = vec3(gray);\n }\n \n texelColor = mapTexelToLinear( texelColor );\n diffuseColor *= texelColor;\n #endif\n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n #include \n #include \n #include \n #include \n }\n "};class kl extends Ye{constructor(t={}){super({type:"NaviLineMaterial",uniforms:Jt.clone(ee.naviline.uniforms),vertexShader:ee.naviline.vertexShader,fragmentShader:ee.naviline.fragmentShader,clipping:!0}),this.transparent=t.transparent}get color(){return this.uniforms.color.value}set color(t){t instanceof Qt||(t=new Qt(t)),this.uniforms.color.value=t}get map(){return this.uniforms.map.value}set map(t){this.uniforms.map.value=t}get opacity(){return this.uniforms.opacity.value}set opacity(t){this.uniforms&&(this.uniforms.opacity.value=t)}get passRatio(){return this.uniforms.passRatio.value}set passRatio(t){this.uniforms.passRatio.value=t}get repeat(){return this.uniforms.repeat.value}set repeat(t){this.uniforms.repeat.value=t}get offset(){return this.uniforms.offset.value}set offset(t){this.uniforms.offset.value=t}}class zl extends al{constructor(t,e){"arrow"!==(e=Object.assign({radius:.01},e)).type&&"naviArrow"!==e.type||!(void 0===e.yScale||e.yScale>.5)||(e.yScale=.2);var i=new El(e),n=new kl({color:16777215,transparent:!0}),r=new Qe(i,n);r.position.copy(i.center),super(t,e,r),this.type="LineNode",this.isNaviLineMaterial=n instanceof kl,this.patternLength=this.data.patternLength||32,this.lineWidth=this.data.lineWidth||10,this.lineTexture=new Nl(e),n.map=this.lineTexture.texture,n.map.minFilter=n.map.magFilter=j,n.map.wrapS=n.map.wrapT=F,n.needsUpdate=!0,this._z=0}clone(){return new this.constructor(this.map,this.data)}get animateSpeed(){return this.data.animateSpeed}set animateSpeed(t){this.data.animateSpeed=t}get color(){return lineTexture.config.color}set color(t){this.updateTexture({color:t})}get dashArray(){return this.lineTexture.config.dashArray}set dashArray(t){this.updateTexture({dashArray:t})}get lineType(){return this.lineTexture.config.type}set lineType(t){this.updateTexture({type:t})}updateTexture(t){this.lineTexture.update(t),this.entity.material.map.needsUpdate=!0}updateFactorZ(){let t=new Lt;return this.entity.getWorldPosition(t),this._z=t.z,this._z}update(t){this.map.view.controls.target.clone().z=this._z;var e=kh.getZoomFactor(this.map);this.entity.geometry.setRadius(this.lineWidth*e/2);var i=this.entity.material.map;let n=this.entity.geometry.length/this.patternLength/e;if(this.isNaviLineMaterial?this.entity.material.repeat.x=n:i.repeat.x=n,this.data.animateSpeed){let e=i.offset;this.isNaviLineMaterial&&(e=this.entity.material.offset),e.x-=this.data.animateSpeed*t,e.x>1?e.x=0:e.x<0&&(e.x=1)}this.data.update&&this.data.update.call(this,t)}setRadius(t){this.entity.geometry.setRadius(t)}get length(){return this.entity.geometry.length}getPointByLength(t){return this.entity.geometry.getPointByLength(t)}getPointByRate(t){return t=Math.min(Math.max(t,0),1),this.getPointByLength(this.length*t)}}var Rl={id:"",coord:[0,0,0],major:"",minor:"",scale:1,buildingID:"",floorNumber:0,tag:""};class Bl extends Lt{constructor(t){t=Object.assign({},Rl,t),super(),this.id=t.id=t.id||kh.generateID(6),this.data=t,this.data.node=this,this.type="beaconPoint",t.coord&&this.fromArray(t.coord)}newID(t){return this.id=this.data.id=t||kh.generateID(6),this}clone(t){var e=new this.constructor(this.getData());return e.id=kh.generateID(6),e}update(){this.data.coord=this.toArray()}getData(){var t=this.data.node;delete this.data.node;var e=kh.cloneJSON(this.data),i=Object.assign({},e,{id:this.id,coord:this.toArray()});return t&&(this.data.node=t),i}}var Fl=function(){var t=function(t){var e,i=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&i.push(e);return i},e=function(t,e){return parseFloat(t)-parseFloat(e)},i=function(i,n,r,a){var o,s={},h={0:[n]},l={},c=function(t,e){var i=""+t;h[i]||(h[i]=[]),h[i].push(e)};for(s[n]=0;h&&(o=t(h)).length;){o.sort(e);var u=o[0],d=h[u],p=d.shift(),f=parseFloat(u),m=i[p]||{};for(var g in d.length||delete h[u],m)if(Object.prototype.hasOwnProperty.call(m,g)){var v=m[g]+f,y=s[g];(void 0===y||y>v)&&(s[g]=v,c(v,g),l[g]=p)}}return void 0===s[r]?null:l},n=function(t,e){for(var i=[],n=e;void 0!==n;)i.push(n),n=t[n];return i.reverse(),i},r=function(t,e){for(var r,a,o,s=e.shift(),h=[];e.length;){if(r=e.shift(),!(a=i(t,s,r)))return null;if(o=n(a,r),!e.length)return h.concat(o);h.push.apply(h,o.slice(0,-1)),s=r}},a=function(t,e){try{return Array.prototype.slice.call(t,e)}catch(a){for(var i=[],n=e||0,r=t.length;n{t.helper&&t.helper.unBind(),t.segments.forEach(t=>{e.indexOf(t)<0&&e.push(t)})}),this.removeSegments(e)}deletePoints(t){var e=[];return t.forEach(t=>{t.helper&&t.helper.unBind(),e.push(t.getData()),delete this.pointsMap[t.id]}),kh.removeFromArray(this.points,t),e}removeSegments(t){var e,i=[],n=[],r=[];return t.forEach(t=>{t.points.forEach(t=>{i.indexOf(t)<0&&i.push(t)}),r.push(t.getData()),t.remove()}),kh.removeFromArray(this.segments,t),i.forEach(t=>{t.segments.length||n.push(t)}),n.length&&(e=this.deletePoints(n)),{points:e||[],segments:r||[]}}getData(){var t=this.parent;return{points:this.points.map(t=>t.getData()),segments:this.segments.map(t=>t.getData()),graph:JSON.stringify(this.graph),beacons:this.beacons.map(e=>{var i=e.getData();return t&&(i.buildingID||"OMBuilding"===t.type&&(i.buildingID=t.data.buildingID)),i})}}getPointsByPath(t){var e=t.map(t=>{let e=this.pointsMap[t];if(e)return e.clone()});return e}clearLines(){this.lineNodes.forEach(t=>{t.dispose()}),this.lineNodes.length=0}createLineNodeByPath(t,e=!0){if(!(t.length<2)){this.clearLines();var i=this.getPointsByPath(t);return i=kh.buildCurvePoints(i),this.createLineNodeByPoints(i)}}createLineNodeByPoints(t,e){if(!(t.length<2)){Array.isArray(t[0])&&(t=t.map(t=>(new Lt).fromArray(t)));var i=new zl(this.map,Object.assign({path:t,type:"naviArrow",color:"#6396FF",animateSpeed:.5},Ul.lineStyle,this.lineStyle,e));return this.entity.add(i.entity),this.lineNodes.push(i),i}}findPathRoadPointIDArrSync(){var t=Array.from(arguments);if(!(t.length<2))return Fl.findShortestPath(this.graph,t)}findPathRoadPointIDArrAsync(){var t=Array.from(arguments),prom=new Nh;t.length<2&&prom.resolve([]);var e=Fl.findShortestPath(this.graph,t);return prom.resolve(e),prom}getClosestRoadPointID(t){return t.endpoint?t.endpoint.id:t.segment.points[0].id}_checkStartEndIDs(t,e){var i=!1,n=!1,r=0;t.segment&&r++,e.segment&&r++;var a=[];if(2===r)t.segment!=e.segment?(a.push(this.getClosestRoadPointID(t)),a.push(this.getClosestRoadPointID(e))):(a.push(t.segment.points[0].id,t.segment.points[1].id),i=n=!0);else if(1===r){var o=!1,s=t.segment?(o=!0,t.segment):e.segment;a.push(o?e.endpoint.id:t.endpoint.id);var h=this.getClosestRoadPointID(o?t:e);h==a[0]&&(h=s.getOtherPoint(h).id),o?a.unshift(h):a.push(h)}else t.endpoint!=e.endpoint&&a.push(t.endpoint.id,e.endpoint.id);return{qiatou:i,quwei:n,ids:a}}calcMiddleRoadPointsAsync(t,e){var i=this._checkStartEndIDs(t,e),n=i.qiatou,r=i.quwei,a=i.ids;return(a.length?this.findPathRoadPointIDArrAsync.apply(this,a):Nh.empty()).then(i=>{if(i)return t.endpoint||i[1]===t.segment.points[1].id&&(n=!0),e.endpoint||i[i.length-2]===e.segment.points[1].id&&(r=!0),n&&i.shift(),r&&i.pop(),i})}calcMiddleRoadPointsSync(t,e){var i=this._checkStartEndIDs(t,e),n=i.qiatou,r=i.quwei,a=i.ids;if(a.length){if(!(a=this.findPathRoadPointIDArrSync.apply(this,a)))return;return t.endpoint||a[1]===t.segment.points[1].id&&(n=!0),e.endpoint||a[a.length-2]===e.segment.points[1].id&&(r=!0),n&&a.shift(),r&&a.pop(),a}}getVectors(t,e,i){if(t&&0===t.length)return[e.pedal,i.pedal];var n=this.getPointsByPath(t);return e.endpoint||n.unshift(e.pedal),e.distance>1&&n.unshift(e.point),(!i.endpoint||n.length<2)&&n.push(i.pedal),i.distance>1&&n.push(i.point),n}toPoint(t){return"roadPoint"===t.type||t.isVector3?t:Array.isArray(t)?(new Lt).fromArray(t):"object"==typeof t?(new Lt).copy(t):t}findPathAsync(){var t=Array.from(arguments);if(Array.isArray(t[0])&&"number"!=typeof t[0][0]&&(t=t[0]),!(t.length<2)){var e=t[t.length-1],i={clearLines:!0,createLines:!0,offsetHeight:.2};Array.isArray(e)||"x"in e||Object.assign(i,t.pop());var n=[];t.forEach((e,i)=>{Array.isArray(e)?t[i]=e=(new Lt).fromArray(e):"object"!=typeof e||e.isVector3||"roadPoint"===e.type||(t[i]=e=(new Lt).copy(e)),"string"==typeof e?n.push({endpoint:this.pointsMap[e]}):e&&"clone"in e&&n.push(this.findClosestSegment(e.clone()))});var r=[],a=[],o=[],s=[];i.clearLines&&this.clearLines();for(var h=this,l=0;l{if(n){var r=h.getVectors(n,t,e);if(o.push(r),s.push(n),i.createLines){var l=h.createLineNodeByPoints(kh.buildCurvePoints(r.slice()));i.offsetHeight&&l&&(l.position.z+=i.offsetHeight),l&&a.push(l)}}}),r.push(prom)})(n[l],n[l+1]);return Nh.all(r).then(()=>({lines:a,vectors:o,ids:s,floorNumber:h.parent.data.floorNumber,floorName:h.parent.data.floorName}))}}findPathSync(){var t=Array.from(arguments);if(Array.isArray(t[0])&&"number"!=typeof t[0][0]&&(t=t[0]),!(t.length<2)){var e=t[t.length-1],i={clearLines:!0,createLines:!0,offsetHeight:.2};Array.isArray(e)||"x"in e||Object.assign(i,t.pop());var n=[];t.forEach((e,i)=>{Array.isArray(e)?t[i]=e=(new Lt).fromArray(e):"object"!=typeof e||e.isVector3||"roadPoint"===e.type||(t[i]=e=(new Lt).copy(e)),"string"==typeof e?n.push({endpoint:this.pointsMap[e]}):e&&"clone"in e&&n.push(this.findClosestSegment(e.clone()))});var r=[],a=[],o=[];i.clearLines&&this.clearLines();for(var s=this,h=0;ht.pointType>0&&t.pointType<4);let h,l;for(var c=0;ce.group===t),i.route.findPathSync(l,a,{clearLines:!1,createLines:!1}).vectors.length)return{fromLiftPoint:h,toLiftPoint:l};continue}{let t=i.route.findClosestLifts(h);if(!t||!t.length)continue;if(l=t[0].point,i.route.findPathSync(l,a,{clearLines:!1,createLines:!1}).vectors.length&&h.isSameLiftPoint(l))return{fromLiftPoint:h,toLiftPoint:l};continue}}}findClosestLifts(t,e,i){let n=t.pointType>0&&t.pointType<4;t=this.toPoint(t),i=Object.assign({count:10},i),"object"==typeof arguments[1]&&(i=e,e=null);let r=this.points.filter(t=>t.pointType>0&&t.pointType<4);n&&(r=this.points.filter(e=>e.pointType===t.pointType));for(var a=[],o=0;ot.dis2-e.dis2),Ul.filterClosestLifts?Ul.filterClosestLifts(this,t,a):a.slice(0,i.count)}static tryConnect(t,e,i){let n=t.findPathSync(e,i,{clearLines:!1,createLines:!1}),r={connection:!0,dis2:-1};return n.vectors.length?r.dis2=n.vectors.reduce((t,e)=>t+e.reduce((t,e,i,n)=>0===i?0:t+n[i-1].distanceToSquared(e),0),0):r.connection=!1,r}findClosestSegment(t){Array.isArray(t)&&(t=(new Lt).fromArray(t));var e,i,n=null,r=[];t instanceof Lt&&t instanceof vl||void 0===(t=(new Lt).copy(t)).z&&(t.z=0);var a,o,s,h=Number.MAX_VALUE;return this.segments.forEach(l=>{o=l.closestPointToPointParameter(t),i=l.closestPointToPoint(t,o),(a=i.distanceToSquared(t)){this.createPointByData(t)}),"string"==typeof t.graph)try{this.graph=JSON.parse(t.graph)}catch(t){}else this.graph=t.graph;t.segments&&t.segments.forEach(t=>{this.createSegmentByData(t)}),t.beacons&&this.createBeacons(t.beacons)}createBeacons(t){t=t||this.data.beacons;var e=[];return t.forEach(t=>{var i=new Bl(t);this.map.config.forceNewID&&i.newID(),this.beacons.push(i),e.push(i)}),e}createRoadSegment(t,e,i){var n=new wl;return n.direction=i,n.setPoints(t,e),n}createRoadSegmentByData(t){this.pointsMap[t.indexes[0]],this.pointsMap[t.indexes[1]]}registerToGraph(t,e,i){this.graph[t]||(this.graph[t]={}),this.graph[e]||(this.graph[e]={});var n=this.graph[t][e];if(void 0===n&&(n=this.graph[e][t]),void 0===n&&(n=i.getLength()),void 0===i.direction||null===i.direction||2===i.direction)this.graph[t][e]=this.graph[e][t]=n;else{let r=i.direction,a=0!==i.points.findIndex(e=>e.id===t);(0===r&&!a||1===r&&a)&&(this.graph[t][e]=n)}}computeGraph(){this.points.length&&(this.graph={},this.pointsMap={},this.points.forEach(t=>{var e=t.segments;this.pointsMap[t.id]=t,e.forEach(e=>{var i=e.getOtherPoint(t.id);this.registerToGraph(t.id,i.id,e)})}))}clear(){this.clearLines(),this.graph={},this.pointsMap={},this.points.length=0,this.beacons.length=0,this.segments.length=0}removeBeacons(t){kh.removeFromArray(this.beacons,t)}clearBeacons(){this.beacons.length=0,this.data.beacons&&(this.data.beacons.length=0)}getEntrances(t){return this.points.filter(e=>t?e.pointType===t:e.pointType>=4&&e.pointType<=6)}dispose(){this.clear(),super.dispose()}}Ul.lineStyle={lineWidth:10,naviColor:"#33cc61",naviEdgeColor:"#4a82d2",naviArrowColor:"#F4FEFB"};class Gl{constructor(t,e){e=e||{},this.config=e,this.map=t,this.perimeter=2*Math.PI*6378137,this.tilePixelSize=e.tilePixelSize||e.tileSize||256,this.shift=this.perimeter/2,this.tileType="png",this.minTileLevel=1,this.maxTileLevel=19,this.correct=!0,this.mapBoxTilesServer="https://api.mapbox.com/v4/mapbox.streets",this.accessToken=e.token||"pk.eyJ1IjoiZWFzeWZyb2ciLCJhIjoiY2syM2lqMDZ0MDRmOTNpcDk1MXFsZGF3eCJ9.lLCHYmBUBkGOtGaEexic6g"}getTileData(t,e,i){var n=2<{prom.resolve({img:i,index:e})},i.src=t,prom}addImage(t,e,i,n){var r=n%this.count*this.tileSize,a=Math.floor(n/this.count)*this.tileSize,o=this.indexDict[n];if(o){var s=this.dict[o].mapTile;s.needsUpdate=!0,s.visible=!1,delete this.dict[o]}return this.update(e,r,a),e=null,this.dict[i]={x:r,y:a,mapTile:t},this.indexDict[n]=i,{x:r,y:a}}getTextureIndex(t,e,i,n,r){var a=`${i}_${n}_${r}`,o=this.dict[a];return o?Nh.empty(o):(this._index++,this._index=this._index%(this.count*this.count),this.loadImage(e,this._index).then(({img:e,index:i})=>Nh.empty(this.addImage(t,e,a,i))))}}function Hl(t,e){return new Wl(t,e)}class Xl{constructor(t,e){bh.convert(this),Object.assign(this,t),this.options=e,this.options.opacity=void 0===this.options.opacity?1:this.options.opacity,this.boundingSphere=new Gt,this.boundingSphere.radius=this.size/.7,this.boundingSphere.center.x=t.coord.x,this.boundingSphere.center.y=t.coord.y,this.magFilter=this.minFilter=1003,this.isLoaded=!1}get isMapTile(){return!0}createEntity(t){var e;if(t=t||this,Xl.baseLayer.tileProvider&&Xl.baseLayer.config.demImage){var i=Xl.getGeo(t.level);e=i.geo,this.elevate(e,i.seg)}else e=Xl.tileGeometry.clone();var n=Xl.getTileMaterial({tileSize:Xl.baseLayer.tileProvider.tilePixelSize},this.options);this.entity=new Qe(e,n),this.entity.receiveShadow=Xl.baseLayer.config.receiveShadow,this.entity.castShadow=Xl.baseLayer.config.castShadow,this.initUV(),this.entity.visible=!1;var r=t.size;this.entity.scale.set(r,r,1),this.entity.position.x=t.coord.x,this.entity.position.y=t.coord.y,this.uvLoc={x:0,y:0},setTimeout(()=>{this.requestTile()},0)}getPixelHeight(t,e,i){var n=t.data,r=4*(i*t.width+e);return void 0!==n[r]?.1*(65536*n[r]+256*n[r+1]+n[r+2])-1e4-Xl.baseLayer.config.elevation:0}elevate(t,e){t.dynamic=!0,this.level;for(var i=Xl.baseLayer.demPixels,n=Xl.baseLayer.demRect,r=t.attributes.position.array,a=r.length,o=e+1,s=this.size/e,h=0;hn.rb.x||fn.lt.y)){p-=n.lt.x,f-=n.rb.y;var m=Math.floor(p/n.width*i.width),g=i.height-Math.floor(f/n.height*i.height);r[h+2]=this.getPixelHeight(i,m,g)}}t.attributes.position.needsUpdate=!0}show(t){void 0===t&&(t=!0),this.showAnim&&this.showAnim.stop(),this.entity.material.opacity=t?0:1,this.showAnim=new wh.Tween(this.entity.material).to({opacity:t?this.options.opacity:0},200).onComplete(()=>{this.isLoaded=!0,this.entity.material.depthWrite=!0,this.entity.material.depthTest=!0,this.emit("shown",this)}).start()}initUV(){for(var t=this.entity.geometry.attributes.uv,e=(Xl.baseLayer.tileProvider.tilePixelSize-1)/4096,i=0;i{this.updateUV(t,e),this.entity.visible=!0,this.isLoaded=!0,this.needsUpdate=!1})}dispose(){this.showAnim&&this.showAnim.stop(),this.entity&&(this.entity.parent&&this.entity.parent.remove(this.entity),this.entity.material.dispose(),this.entity.material.map&&this.entity.material.map.dispose()),this.entity=null,this.boundingSphere=null}get visible(){if(this.entity)return this.entity.visible}set visible(t){this.entity&&(this.entity.visible=t)}}Xl.tileSize=256,Xl.tileGeometry=new Ne(1,1,1,1),Xl.getGeo=function(t){return t=Math.pow(2,21-t),{seg:t=Math.min(32,Math.max(t,8)),geo:new Ne(1,1,t,t)}},Xl.tileMaterials=[],Xl.tileMaterials.clear=function(){var t=Xl.tileMaterials;t.forEach(t=>{t.map.dispose(),t.dispose()}),t.length=0,ql=0,Xl.map=null,Xl.tileMaterials.length=0};var ql=0;Xl.getTileMaterial=function(t,e){var i;ql++;var n=4096/(t=t||{tileSize:512}).tileSize;return ql>n*n&&(ql=1),i=1===ql?function(t,e,i){var n,r=Object.assign({map:Hl(t,e),transparent:!0},i);return n="standard"===Xl.baseLayer.config.materialType?new Pa(r):new Ke(r),Xl.tileMaterials.push(n),n}(Xl.map,t,e):Xl.tileMaterials[Xl.tileMaterials.length-1],i};var Yl={center:{x:12957302.75,y:4852766.24},offset:[0,0,0],scale:1,color:"#ffffff",provider:"amap",mapStyle:"",demImage:""};class Zl{constructor(t,e){bh.convert(this),this.map=t,Xl.map||(Xl.map=t),this.config=Object.assign({center:{x:12957302.75,y:4852766.24},offset:[0,0,0],scale:1,color:"#ffffff",provider:"amap",mapStyle:"n1",maxTilesCount:88,needsHide:!0,demImage:"",demIsGray:"",elevation:0,elevationScale:1.5,demRect:null,laps:3,materialType:"",castShadow:!1,receiveShadow:!0},e),this.data=this.config,Xl.baseLayer=this,this.tileProvider=this.config.tileProvider||new jl(this.map,this.data),this.tileProvider.baseLayer=this,this.tileTree={},this.baseTileDatas={},this.tilesCount=0,this.entity=new Dn,this.entity.name="BaseLayerEntity",this.map.sceneManager.base.add(this.entity),this.tileGroups={},this.updateOffset(this.data.offset),this.entity.scale.setScalar(this.data.scale),this.config.demImage&&this.config.demRect&&(this.entity.scale.z=this.config.elevationScale),this.map&&this.map.baseLayers.push(this),this._hidden=!1,this.init()}init(){this.getDemImage(()=>{this.map.config.center||this.map.config.viewCenter,this.map.config.zoomLevel,this.getDemRect(),this.viewToShowOrLoadFunc=this.viewToShowOrLoad.bind(this),this.map.on("viewChanged",this.viewToShowOrLoadFunc),this.map.view.controls.dispatchEvent({type:"change"}),this.emit("ready")})}getDemRect(){if(!this.demRect&&this.data.demRect){var t=this.data.demRect.southWest.split(","),e=kh.coordTransform.lngLatToMercator(+t[0],+t[1]),i=this.data.demRect.northEast.split(","),n=kh.coordTransform.lngLatToMercator(+i[0],+i[1]);this.demRect={lt:{x:e.x,y:n.y},rb:{x:n.x,y:e.y},width:n.x-e.x,height:n.y-e.y,center:{x:(e.x+n.x)/2,y:(e.y+n.y)/2}}}return this.demRect}getDemImage(t){if(this.config.demImage&&this.config.demRect){var e=this,i=document.createElement("img");i.onload=function(){var n=document.createElement("canvas");n.width=i.width,n.height=i.height,n.getContext("2d").drawImage(i,0,0,i.width,i.height),e.demPixels=n.getContext("2d").getImageData(0,0,i.width,i.height),t()},i.src=this.config.demImage}else t()}get visible(){return!this._hidden}set visible(t){this._hidden=!t,this.entity.visible=t}getData(){var t={};return Object.keys(Yl).forEach(e=>{t[e]=this.data[e]}),t.offset=this.entity.position.toArray(),t}updateTileProvider(t){this.disposeAllTiles(),this.tileProvider.update(t),this.map.view.controls.dispatchEvent({type:"change"})}updateColor(t){this.data.color=t,this.updateTileProvider({color:t})}updateMapStyle(t){this.disposeAllTiles(),this.data.mapStyle=t,this.tileProvider.setMapStyle(t),this.map.view.controls.dispatchEvent({type:"change"})}updateCenter(t){t=t||this.data.center,this.disposeAllTiles(),this.data.center=t,this.map.view.controls.dispatchEvent({type:"change"})}updateOffset(t){this.data.offset=t,this.entity.position.add((new Lt).fromArray(this.data.offset))}updateScale(t){this.data.scale=t,this.entity.scale.setScalar(t)}viewToShowOrLoad(t){if(!this._hidden){var e=t||this.map.view.zoomLevel;if(e>this.tileProvider.maxTileLevel)this.config.needsHide&&(this.entity.visible=!1);else{this.entity.visible=!0;var i=this.baseTileDatas[e];if(!i){var n=this.config.center||this.map.config.viewCenter||this.map.config.center;i=this.tileProvider.getTileData(n.x,n.y,e),this.baseTileDatas[e]=i}var r=this;t?a():(clearTimeout(this._vcID),this._vcID=setTimeout(()=>{a()},t?0:60))}}function a(){var t=r.tileProvider.getCenterTileData(i);r.loadOrVisibleTile(t)}}createTile(t){var e=this.baseTileDatas[t.level],i=this.tileProvider.getMapTileDataByBase(t,e);if(!i)return null;var n={imageNearest:this.config.imageNearest,color:this.config.color,opacity:this.config.opacity},r=new Xl(i,n);return this.addToTree(r),r}loadOrVisibleTile(t){this.doNeighbors(t)}createTileGroup(t){var e=new Dn;this.tileGroups[t]=e,this.entity.add(e),e.renderOrder=t-1e3,e.beforeRender=t=>t.clearDepth()}doNeighbors(t,e){e=e||1;var i=this.getLapNeighbor(t,e);1===e&&(this.tileProvider.checkTileExists&&!this.tileProvider.checkTileExists(t.xIndex,t.yIndex,t.level)&&(t.noData=!0),i.unshift(t));var n=!1;i.forEach((t,i)=>{if(t.noData)e<4&&this.hideAllChildren(t);else{var r=this.getTileByData(t);r||(r=this.createTile(t)),this.isInView(r)?(r.entity?r.isLoaded&&(r.needsUpdate?r.requestTile():r.visible=!0,e<4&&this.hideAllChildren(t)):(r.createEntity(),r.once("shown",()=>{this.tilesCount++,e<4&&this.hideAllChildren(t)}),this.tileGroups[r.level]||this.createTileGroup(r.level),this.tileGroups[r.level].add(r.entity)),n=!0):r&&r.entity&&(r.visible=!1)}}),n&&ethis.config.maxTilesCount&&this.disposeTiles(this.tilesCount-this.config.maxTilesCount+40)}findFarOfMyLevel(t){t=t||this.map.view.zoomLevel;for(var e,i=0,n=-1,r=Object.keys(this.tileTree),a=0,o=r.length;ai&&(i=e,n=a);return-1===n?null:r[n]}disposeTiles(t){if(!(t<=0)){var e=this.findFarOfMyLevel();if(null!==e){for(var i=Object.keys(this.tileTree[e]),n=i.length-1;n>-1;n--){for(var r=Object.keys(this.tileTree[e][i[n]]),a=r.length-1;a>-1&&(this.tileTree[e][i[n]][r[a]].dispose(),delete this.tileTree[e][i[n]][r[a]],t--,this.tilesCount--,0!==t);a--);if(a<=0&&delete this.tileTree[e][i[n]],0===t)break}n<=0&&delete this.tileTree[e],t>0&&this.disposeTiles(t)}}}traverseAllTiles(t){Object.keys(this.tileTree).forEach(e=>{Object.keys(this.tileTree[e]).forEach(i=>{Object.keys(this.tileTree[e][i]).forEach(n=>{var r=this.tileTree[e][i][n];t&&t(r)})})})}updateColor(t,e=1){this.config.color=t,this.config.opacity=e,this.traverseAllTiles(i=>{i.options.color=t,i.options.opacity=e,i.entity&&(i.entity.material.color.set(t),i.entity.material.opacity=e)})}disposeAllTiles(){this.traverseAllTiles(t=>t.dispose()),Xl.tileMaterials.clear(),this.tileTree={},this.baseTileDatas={},this.tilesCount=0}hideAllChildren(t){for(var e,i,n,r,a,o=t.level;o<20;)if(o++,this.tileTree[o]){n=Math.pow(2,o-t.level),e=t.xIndex*n,i=t.yIndex*n;for(var s=0;s1?t.parent:t:t.children&&t.children.length?this._getMesh(t.children[0]):void 0}get mesh(){if(this.entity)return this._getMesh(this.entity)}setData(t){(t=t||this.data).modelID&&(this.load(this.callback),delete this.callback),t.children.forEach(t=>{var e;e=t.modelID?new this.constructor(this.map,t):new gl(this.map,t),this.add(e)})}play(t,e=1){var i=this.actions[t],n=Object.keys(this.actions);if(!i){if(!n.length)return;i=this.actions[n[0]]}n.forEach(t=>{this.actions[t].stop()}),i.time=0,i.timeScale=e,i.play(),this.isPlaying=!0,this.currentAction=i}crossFadeTo(t,e,i=1){var n=this.actions[t],r=this.actions[e];n&&r&&(Object.keys(this.actions).forEach(e=>{e!==t?this.actions[e].stop():this.actions[e].enabled||this.actions[e].play()}),r.weight=1,r.time=0,r.play(),this.currentAction=r,this.isPlaying=!0,n.crossFadeTo(r,i))}fadeTo(t,e=1){if(this.currentAction)this.crossFadeTo(this.currentAction.name,t,e);else{this.stopAll();var i=this.actions[t];if(!i)return;i.play(),i.fadeIn(e),this.isPlaying=!0,this.currentAction=i}}stop(t){var e=this.actions[t];e&&e.stop()}stopAll(){Object.keys(this.actions).forEach(t=>{this.actions[t].stop()}),this.currentAction=null,this.isPlaying=!1}setTransform(t){super.setTransform(t)}load(t){this.map.modelLoader.loadByID(this,this.data.modelID,e=>{this.animations=e.animations,this.actions=e.actions||{},this.isSkinnedMesh=kh.traverse([e.scene],t=>{if("SkinnedMesh"===t.type)return!0},!1).length>0,this.model&&this.removeEntity(this.model),this.model=e.scene,this.processMat(this.model),this.entity.add(e.scene),this.play(this.data.playClipName),this.setTransform(),this.originScale||(this.originScale=this.entity.scale.clone()),t&&t(this),this.callback&&(this.callback(this),delete this.callback),this._initCallback&&(this._initCallback(this),delete this._initCallback),this.map.emit("modelCreated",this),this.map.emit("nodeCreated",this)},null,null,this.parentNode)}processMat(t){var e=[];let i=this.map.config.noMetalness;t.traverse(t=>{t.material&&!e.includes(t.material.uuid)&&[].concat(t.material).forEach(t=>{e.includes(t.uuid)||(e.push(t.uuid),t.processed||(t.processed=!0,i&&(t.metalness=0),t.map&&(t.map.encoding=3e3,t.map.needsUpdate=!0)))})})}setEmissive(t){var e=[];if(!this.map.config.noEmissive&&0!==this.map.config.modelEmissive){var i=this.map.config.modelEmissive||.35;t.traverse(t=>{t.material&&!e.includes(t.material.uuid)&&[].concat(t.material).forEach(t=>{e.includes(t.uuid)||(e.push(t.uuid),!t.processed&&t.emissive&&t.emissive.copy(t.color.clone().multiplyScalar(i)))})})}}changeModelID(t,e){this.data.playClipName="",this.currentAction=null,this.isPlaying=!1,this.clearActions(),this.data.modelID=t,this.load(e)}clearActions(){this.actions={}}getScale(){if(!this.map.config.enableModelFixedSize||!this.data.fixedSize||!this.map)return 1;var t=new Lt;return this.entity.getWorldPosition(t),kh.getZoomFactor(this.map,t)}setFixedSize(t){this.originScale||(this.originScale=this.entity.scale.clone()),this.data.fixedSize=t}update(){if(this.map.config.enableModelFixedSize&&this.data.fixedSize){var t=this.map.view.zoomLevel<=this.data.fixedSize.level?this.getScale()*this.data.fixedSize.size:1,e=this.originScale||this.entity.scale;this.entity.scale.set(e.x*t,e.y*t,e.z*t)}}get isInView(){if(this.mesh)return this.map.view.frustum.intersectsSphere(this.mesh.geometry.boundingSphere)}dispose(){super.dispose(),this.currentAction=null,this.isPlaying=!1,this.animations&&(this.animations.length=0),this.model=null}}gl.OMModel=Kl,Kl.prototype.getData=gl.prototype.getData,Kl.fromEntity=function(t,e,i){i=Object.assign(kh.cloneJSON(Jl),i);var n=new Kl(t,i);return n.originScale=n.entity.scale.clone(),n.setEntity(e),n};class Ql{constructor(t){this.map=t}traverse(t,e){e.length&&e.forEach(e=>{var i,n=e;e.modelID?(i=new Kl(this.map,n),t.add(i,!1)):(i=new gl(this.map,n,{createChildren:!1}),t.add(i,!1)),e.children.length&&this.traverse(i,e.children)})}create(t){if(t.modelNode){var e=kh.cloneJSON(t.data.models);e&&e.length&&this.traverse(t.modelNode,e)}}createSingle(t,e,i){var n;if(this.map.emit("modelData",t),this.map.emit("nodeData",t),n=t.modelID?new Kl(this.map,t,null,i):new gl(this.map,t),e.add(n,!1),n.entity.getWorldPosition(n.data.boundingSphere.center),n.visible=!0,"OMFloor"===e.parent.type&&e.parent._isFadeOut&&this.map.config.enableFloorAlpha){var r=this;n._initCallback=function(t){kh.collectMaterials(t).forEach(t=>{t._originAlpha=t.opacity,t.opacity=r.map.config.fadeOutAlpha})}}return n}}var $l=[];class tc{constructor(t,e){var i=this;i.style={},i.setStyle(t),i.ctx=e,i.ctx||void 0===document||(i.ctx=document.createElement("canvas").getContext("2d")),i.isDrawing=!1,i._elements=[],i.ctx.canvas.width=i.style.width,i.ctx.canvas.height=i.style.height}setStyle(t){t&&(this.style={},this.style=Object.assign(this.style,{width:256,height:128,color:4473924,fontColor:0,font:"600 24px Helvetica, monaco, 微软雅黑, Consolas, Courier New, Courier, monospace",elements:[],background:{color:16777215,alpha:0}},t))}readElementSytle(t){var e=this;void 0!==t.color&&(e.ctx.fillStyle=ec(t.color,t.alpha)),void 0!==t.strokeColor&&(e.ctx.strokeStyle=ec(t.strokeColor,t.strokeAlpha)),t.lineWidth&&(e.ctx.lineWidth=t.lineWidth),t.textBaseline?e.ctx.textBaseline=t.textBaseline:e.ctx.textBaseline="top",t.shadow?(void 0!==t.shadow.offsetX&&(e.ctx.shadowOffsetX=t.shadow.offsetX),void 0!==t.shadow.offsetY&&(e.ctx.shadowOffsetY=t.shadow.offsetY),void 0!==t.shadow.blur&&(e.ctx.shadowBlur=t.shadow.blur),void 0!==t.shadow.color&&(e.ctx.shadowColor=ec(t.shadow.color,t.shadow.alpha))):(e.ctx.shadowBlur=0,e.ctx.shadowOffsetX=0,e.ctx.shadowOffsetY=0)}getValue(t,e,i){var n=t[e],r={x:0,y:0};return!t.groups||"x"!=e&&"y"!=e||(r=t.groups.reduce(function(t,e){return{x:t.x+e.x,y:t.y+e.y}},r)),i?n+r.x:n+r.y}getStyleByName(t){var e=null;return function i(n){if(n.elements&&!e)for(var r=0;r2&&e.ctx.closePath(),void 0!==t.lineWidth&&void 0!==t.strokeColor&&e.ctx.stroke(),void 0!==t.color&&!1!==t.close&&e.ctx.fill(),e.next()}}drawImage(t){var e=this,i=null;function n(){e.readElementSytle(t);var i,n,r=e.getValue(t,"x",!0),a=e.getValue(t,"y");t.width&&t.height&&(i=e.getValue(t,"width",!0),n=e.getValue(t,"height")),void 0!==t.sourceX&&void 0!==t.sourceY?e.ctx.drawImage(t.image,t.sourceX,t.sourceY,t.sourceW,t.sourceH,r,a,i,n):i&&n?e.ctx.drawImage(t.image,r,a,i,n):e.ctx.drawImage(t.image,r,a)}if(t.url){var r=!1;if(clearTimeout(e.imageLoadTimeout),t.image)n(t.image),e.next();else{(i=__tmpCanvas.createImage()).crossOrigin="Anonymous",e.imageLoadTimeout=setTimeout(()=>{r||(i.src="",e.next())},1e4);var a=e.ctx.canvas.width,o=e.ctx.canvas.height;i.onload=function(){e.ctx.canvas.width===a&&e.ctx.canvas.height===o||(e.ctx.canvas.width=a,e.ctx.canvas.height=o),r=!0,t.image=i,n(),e.next()},i.onerror=function(t){clearTimeout(e.imageLoadTimeout),e.next()},i.src=t.url}}else e.next()}drawText(t){var e=this,i=t.font||e.style.font,n=i.match(/\d+/);n&&n.length>0&&parseInt(n[0]),e.readElementSytle(t),e.ctx.font=i;var r=e.getValue(t,"x",!0),a=e.getValue(t,"y");t.lineWidth&&(e.ctx.lineWidth=t.lineWidth,e.ctx.lineJoin="round",e.ctx.strokeStyle=t.strokeColor||16777215,e.ctx.strokeText(t.text,r,a)),e.ctx.fillText(t.text,r,a),e.next()}drawElement(t){if(!1!==t.visible){if(t.groups)for(var e=0;e{rc+=10,nc[t]=rc}),nc.cloud=1e4,nc),markerScale:2.5};var nc,rc,ac;wx.getSystemInfoSync().pixelRatio;var oc=null;ac=ic.markerScale;class sc{constructor(t,e,i,n){this.map=t,oc=n||oc,this.description=new fc(e),this.canvasDrawer=new tc(this.description.description,n)}init(t){this.canvasDrawer.init(e=>{t&&t(e),this.canvasDrawer.callback=null})}rebuild(t,e){e&&(this.canvasDrawer.callback=t=>{e(t),this.canvasDrawer.callback=null}),this.description=new fc(t),this.canvasDrawer.update(this.description.description,!0)}get canvas(){return this.canvasDrawer.ctx.canvas}get width(){return this.description.description.width}get height(){return this.description.description.height}getStyleByName(t){return this.canvasDrawer.getStyleByName(t)}getStylesByType(t){return this.canvasDrawer.getStylesByType(t)}updateTextColor(t,e,i,n){var r=[];if(t){var a=this.getStyleByName(t);a&&(r=[a])}else r=this.getStylesByType("text");r.forEach(t=>{null!=e&&(t.color=e),null!=i&&(t.strokeColor=i)}),this.canvasDrawer.update(null,null,n)}updateText(t,e,i){var n=this.getStyleByName(t);if(n){var r=n.width;oc.font=n.font;var a=oc.measureText(e).width,o=a-r;switch(n.align){case"right":n.x-=o;break;case"center":n.x-=o/2}n.text=e,n.width=a,this.canvasDrawer.update(null,null,i)}}updateImage(t,e,i){var n=this.getStyleByName(t);n&&("string"==typeof e?(delete n.image,n.url=e):e instanceof Image?n.image=e:"object"==typeof e&&Object.assign(n,e),this.canvasDrawer.update(null,null,i))}updateFrame(t,e,i){var n=this.getStyleByName(t);n&&Object.assign(n,e),this.canvasDrawer.update(null,null,i)}}sc.setCanvas=function(t){oc=t.getContext("2d")};class hc{constructor(t){this.config=t,t&&(this.name=t.name),this.description={}}get width(){return this.description.width}get height(){return this.description.height}}class lc extends hc{constructor(t){super(t),this.description=t,t.url&&(this.backgroundImage={type:"image",name:"backgroundImage",url:t.url,x:0,y:0})}}class cc extends hc{constructor(t,e){super(t),this.style=e,this.description={type:"group",name:t.name,x:0,y:0,elements:[]},dc(t,null,e,"textGroup"),this.parse()}getTextProp(t,e,i){return void 0!==t[e]?t[e]:void 0!==this.config[e]?this.config[e]:i}parse(){var t=this,e=0,i=0,n=t.description;if(n.elements.length=0,t.config.elements.length){t.config.elements.forEach((r,a)=>{var o={type:"text"};o.name=r.name||"text_"+a,o.text=r.text,dc(r,null,t.style,"text"),o.color=t.getTextProp(r,"color",0),o.strokeColor=t.getTextProp(r,"strokeColor",16777215),o.align=t.getTextProp(r,"align","center");var s=t.getTextProp(r,"size",18)*ac,h=t.getTextProp(r,"font","Arial"),l=t.getTextProp(r,"weight","normal"),c=t.getTextProp(r,"style","");o.font=c+" "+l+" "+s+"px "+h,oc.font=o.font;var u=oc.measureText(o.text).width;u>i&&(i=u),o.width=u,o.height=1.08*s,o.space=t.getTextProp(r,"space",4)*ac,o.lineWidth=t.getTextProp(r,"lineWidth",Math.max(s/6,2)),void 0!==r.letterSpacing&&(o.letterSpacing=r.letterSpacing),e+=o.height+(a{if(e>0){var a=n.elements[e-1];r+=a.height+a.space}switch(t.align){case"left":t.x=0,t.y=r;break;case"right":t.x=i-t.width,t.y=r;break;case"center":t.x=(i-t.width)/2,t.y=r}}),n.width=i,n.height=e}}}class uc extends hc{constructor(t,e){super(t),this.description={type:"image",x:0,y:0},dc(t,null,e,"image"),this.description=Object.assign(this.description,t),this.description.width*=ac,this.description.height*=ac,this.description.space*=ac}}function dc(t,e,i,n){var r=null;if(i[t.styleName]?r=i[t.styleName]:n&&i[n]?r=i[n]:i[t.type]&&(r=i[t.type]),r){var a=e||t;Object.keys(r).forEach(t=>{void 0===a[t]&&(a[t]=r[t])})}}class pc extends hc{constructor(t,e){super(t),this.style=e||{},this.description={type:"group",name:t.name,x:0,y:0,elements:[]},dc(t,null,this.style,"container"),this.parse()}parse(){var t=this;t.config.elements.length&&t.config.elements.forEach((e,i)=>{switch(e.type){case"textGroup":var n=new cc(e,t.style);!1!==e.visible&&t.description.elements.push(n.description);break;case"image":var r=new uc(e,t.style);!1!==e.visible&&t.description.elements.push(r.description);break;case"container":var a=new pc(e,t.style);!1!==e.visible&&t.description.elements.push(a.description)}}),t.locate()}getMaxSize(){var t=0,e=0;return this.description.elements.forEach(i=>{i.width>t&&(t=i.width),i.height>e&&(e=i.height)}),{maxWidth:t,maxHeight:e}}locate(){var t=this,e=t.getMaxSize(),i="horizontal"===t.config.flowType,n=void 0===t.config.margin?5:t.config.margin,r=n*=ac,a=n,o=!1;t.description.elements.forEach((n,s)=>{if(!1!==n.visible){o=s===t.description.elements.length-1;var h=(t.config.elements[s].space||5)*ac;if(i){switch(n.x=r,t.config.elements[s].align){case"top":case"left":n.y=a;break;case"bottom":case"right":n.y=a+e.maxHeight-n.height;break;default:n.y=a+(e.maxHeight-n.height)/2}r+=n.width+(o?0:h)}else{switch(n.y=a,t.config.elements[s].align){case"top":case"left":n.x=r;break;case"bottom":case"right":n.x=r+e.maxWidth-n.width;break;default:n.x=r+(e.maxWidth-n.width)/2}a+=n.height+(o?0:h)}}}),t.description.width=(i?r:e.maxWidth)+n*(i?1:2),t.description.height=(i?e.maxHeight:a)+n*(i?2:1),t.config.frame&&t.parseFrame()}parseFrame(){var t=this,e=t.description.width,i=t.description.height,n=e{t.x+=s,t.y+=s}),t.description.elements.unshift(l)}}class fc{constructor(t={}){this.description={elements:[]},this.style=t.style,t.background&&(this.background=new lc(t.background),this.description.background=this.background.description),this.container=new pc(t.container,this.style),this.description.width=this.container.width,this.description.height=this.container.height,this.background&&this.background.backgroundImage&&(this.background.backgroundImage.width=this.container.width,this.background.backgroundImage.height=this.container.height,this.description.elements.unshift(this.background.backgroundImage)),this.description.elements.push(this.container.description)}}var mc,gc=1,vc=!0;function yc(t,e){var i=t.toDataURL("image/png"),n=m.createImage();n.crossOrigin="Anonymous";var r=new Nt;return n.onload=()=>{r.image=n,r.needsUpdate=!0,e&&e(r,n)},n.src=i,r}gc=ic.markerScale;class xc extends $n{constructor(t,e,i){super(),this.map=t,vc&&(vc=!1,gc=this.map.sysInfo.pixelRatio,sc.setCanvas(t.config.canvas2d)),this.config=e||{},this._width=1,this._height=1,this.anchor=new Lt,this.anchorInput=null,this.originPosition=new Lt,this._scale=1,this.originScale=new Lt(1,1,1),this.fixedSize=kh.getp(this.config,"fixSize","fixedSize",!0),this.visible=!1,this.material.opacity=0,this.imageLoaded=!1,this._xcxCallback=this.xcxCallback.bind(this),this.contentConfig=i,this.setContent(i),this.config.width&&this.config.height&&this.setSize(this.config.width,this.config.height),this.config.anchor&&this.setAnchor(this.config.anchor),this.scale.setScalar(.01)}get camera(){return this.map.view.currentCamera}_updateTexture(){this.material.map.minFilter=1006,this.material.map.magFilter=1006,this.material.map.generateMipmaps=!1,this.material.map.needsUpdate=!0,this.material.needsUpdate=!0}_updateImage(t,e){this.material.map?this.material.map.image=t:this.material.map=yc(t,t=>{this._updateTexture(),e&&e()})}clone(){return new this.constructor(this.map,this.config,this.contentConfig)}xcxCallback(t){this.material.map=yc(t,t=>{this._updateTexture()})}updateContent(t){if(t=t||{},this.content&&t.type){switch(t.type){case"text":this.content.updateText(t.name,t.value,this._xcxCallback);break;case"image":this.content.updateImage(t.name,t.value,()=>{if(this.material.map)this.material.map.needsUpdate=!0;else try{setTimeout(()=>{this.material.map.needsUpdate=!0},88)}catch(t){}});break;case"frame":this.content.updateFrame(t.name,t.value,this._xcxCallback);break;case"textColor":this.content.updateTextColor(t.name,t.color,t.strokeColor,this._xcxCallback)}this.material.map&&"image"!==t.type&&(this.material.map.needsUpdate=!0)}}anchorToImageCenter(t){t=t||"image";var e=this.content.getStyleByName(t);if(e){var i=e.x+e.width/2,n=e.y+e.height/2;this.setAnchor(i,n)}}setContent(t,e){this.contentConfig=t||this.contentConfig,this.content?this.content.rebuild(this.contentConfig,t=>{this._xcxCallback(t),this.config.onLoad&&(this.config.onLoad.call(this),delete this.config.onLoad),e&&e(this)}):(this.content=new sc(this.map,this.contentConfig,null,this.map.config.canvas2d?this.map.config.canvas2d.getContext("2d"):null),this.content.init(t=>{this._updateImage(t,()=>{this.update(),this.imageLoaded=!0}),this.fixedSize||(this.content?this.setSize(this.content.width,this.content.height):this.setSize(.01,.01)),this.config.onLoad&&(this.config.onLoad.call(this,this.node),delete this.config.onLoad),e&&e(this)})),this.fixedSize&&(this._width=this.content.width/gc,this._height=this.content.height/gc,this.setSize(this._width,this._height)),this.update()}_setVec3(t,e){e instanceof Lt?this[t].copy(e):4==arguments.length&&this[t].set(arguments[1],arguments[2],arguments[3])}get width(){return this._width}set width(t){this.setSize(t,this.height),this.anchorInput&&this.setAnchor.apply(this,this.anchorInput)}get height(){return this._height}set height(t){this.setSize(this.width,t),this.anchorInput&&this.setAnchor.apply(this,this.anchorInput)}getPosition(){return this.originPosition}setPosition(t){this._setVec3.bind(this,"originPosition").apply(this,arguments)}getAnchorPosition(t,e){var i=this,n=i.width,r=i.height,a=new Lt(n*t+i.anchor.x,r*e+i.anchor.y,0),o=(new At).makeRotationFromQuaternion(i.camera.quaternion),s=a.clone().multiply(i.originScale).applyMatrix4(o).multiplyScalar(i.fixedSize?i._scale:1),h=new Lt;return i.parent.getWorldPosition(h),i.originPosition.clone().add(h).add(s)}setAnchor(t){var e=this,i=arguments;e.anchorInput=Array.prototype.slice.call(arguments);var n=e.width/2,r=e.height/2;if(2==i.length&&"number"==typeof t)(i=Array.from(i))[0]=n-i[0]/gc,i[1]=i[1]/gc-r,i.length<3&&i.push(0);else if("string"==typeof t){var a=2==i.length?i[1]:e.config.anchorOffset||[0,0];switch(1==a.length&&a.push(0),t){case"center":default:i=[0,0,0];break;case"top":i=[0,-r,0];break;case"bottom":i=[0,r,0];break;case"left":i=[n,0,0];break;case"right":i=[-n,0,0];break;case"leftTop":i=[n,-r,0];break;case"rightTop":i=[-n,-r,0];break;case"leftBottom":i=[n,r,0];break;case"rightBottom":i=[-n,r,0];break;case"imageCenter":e.anchorToImageCenter()}i[0]-=a[0]*e.width,i[1]-=a[1]*e.height}this._setVec3.bind(this,"anchor").apply(this,i)}setSize(t,e){this._width=t,this._height=e,this._updateSize(),this.anchorInput&&this.setAnchor.apply(this,this.anchorInput)}getScale(){if(!(this.parent&&this.fixedSize&&this.camera&&this.map))return 1;var t=new Lt;return this.getWorldPosition(t),kh.getZoomFactor(this.map,t)}_updateAnchor(){if(this.camera){var t=(new At).makeRotationFromQuaternion(this.camera.quaternion),e=this.anchor.clone().multiply(this.originScale).applyMatrix4(t).multiplyScalar(this._scale);this.position.copy(this.originPosition.clone().add(e))}}_updateSize(){this._scale=this.getScale(),this.scale.set(this.width*this._scale*this.originScale.x,this.height*this._scale*this.originScale.y,1)}update(){this.fixedSize&&this._updateSize(),this._updateAnchor()}}class bc{constructor(t,e,i,n){this.x=t||0,this.y=e||0,this.width=i||0,this.height=n||0}checkOverlay(t){return!(this.x>t.x+t.width||this.y>t.y+t.height||this.x+this.width{n=this.getStyle("text",t),i&&!n.align&&(n.align=i),a.elements.push(n)}),{content:r,image:o,textGroup:a}}getContent(t,e){var i,n,r,a,o;switch(t){case"poi":i=this.getStyle("config"),n=this.getStyle("image",e.image),i.container.elements.push(n);break;case"label":i=this.getStyle("config","text"),a=this.getStyle("textGroup"),e.texts.forEach(t=>{r=this.getStyle("text",t),a.elements.push(r)}),i.container.elements.push(a);break;case"composite":case"imageLeft":(i=(o=this._getComposite(e)).content).container.elements.push(o.image,o.textGroup);break;case"imageRight":(i=(o=this._getComposite(e,null,"right")).content).container.elements.push(o.textGroup,o.image);break;case"imageBottom":(i=(o=this._getComposite(e,"vertical","center")).content).container.elements.push(o.textGroup,o.image);break;case"imageTop":(i=(o=this._getComposite(e,"vertical","center")).content).container.elements.push(o.image,o.textGroup);break;case"border":i=(o=this._getComposite(e)).content,e.frame=e.frame||{},i.container.frame=e.frame,i.container.elements.push(o.image,o.textGroup);break;case"borderText":i=this.getStyle("config","horizontal"),a=this.getStyle("textGroup"),e.frame=e.frame||{},i.container.frame=e.frame,e.texts.forEach(t=>{r=this.getStyle("text",t),a.elements.push(r)}),i.container.elements.push(a);break;case"borderHalf":i=(o=this._getComposite(e)).content,e.frame=e.frame||{},o.textGroup.frame=e.frame;var s=this.getStyle("config","text").container;s.frame=e.frame||{},s.elements.push(o.textGroup),i.container.elements.push(o.image,s)}return i}}function _c(t){var e=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):!!window.XMLHttpRequest&&new XMLHttpRequest;function i(e){t.success&&t.success(e)}function n(e){if(t.fail){var i=e;r&&i instanceof ArrayBuffer&&(n=e,i=window.TextDecoder?new window.TextDecoder("utf-8").decode(n):String.fromCharCode.apply(null,new Uint8Array(n))),t.fail(i)}var n}t.dataType=t.dataType||"json",t.async=void 0===t.async||t.async,e.onreadystatechange=function(){4===e.readyState&&("file:"==window.location.protocol&&0==e.status||e.status>=200&&e.status<300?r?i(e.response):e.responseText&&i("json"!==t.dataType?e.responseText:JSON.parse(e.responseText)):n(e.response),t.complete&&t.complete(e.response))},e.ontimeout=n,e.onerror=n,e.onabort=n,e.responseType=t.responseType?t.responseType.toLowerCase():"";var r="arraybuffer"===e.responseType.toLowerCase();t.type=t.type||"GET",t.type.toUpperCase(),e.open(t.type,t.url,t.async),e.timeout=t.timeout||0,t.headers&&"object"==typeof t.headers?(t.headers["Content-type"]||(t.headers["Content-type"]="application/json;charset=utf-8"),Object.keys(t.headers).forEach(function(i){e.setRequestHeader(i,t.headers[i])})):"post"===t.type.toLowerCase()&&(e.setRequestHeader("X-Requested-With","XMLHttpRequest"),t.headers["Content-type"]||e.setRequestHeader("Content-type","application/json;charset=utf-8")),e.setRequestHeader("withCredentials",!0);try{var a=t.data;t.data&&"object"==typeof t.data&&(a=JSON.stringify(t.data)),e.send(a)}catch(t){n(t)}return e}wc.getInstance=function(t){return mc||(mc=new wc(t)),mc};class Mc extends al{constructor(t,e,i){kh.assign(e,{anchor:"bottom",minLevel:16,maxLevel:23,position:[0,0,0],scale:[1,1,1],renderOrder:3}),e.content&&void 0!==e.type&&(i=wc.getInstance(t).getContent(e.type,e.content)),super(t,e,new xc(t,e,i)),this.map=t,this.data.node=this,this.entity.renderOrder=e.renderOrder,this.contentConfig=i,this.pickIndex=10,this.alpha=0,this.targetAlpha=0,this.rect=new bc,this.setTransform(),this.autoHide=e.autoHide,this.visible=!0,!1===this.autoHide&&this.markerShow(),this.type="SpriteMarkerNode",this.class="SpriteMarkerNode"}get markerType(){return this.data.type}set markerType(t){this.data.type=t,this.refresh()}setTransform(){this.position=this.data.position,this.scale=this.data.scale}setData(t){t=Object.assign({type:"imageLeft",anchor:"bottom",minLevel:16,maxLevel:23,position:[0,0,0],scale:[1,1,1]},t),this.contentConfig=wc.getInstance(this.map).getContent(t.type,t.content),this.entity.setContent(this.contentConfig)}refresh(){this.setData(this.data)}get autoHide(){return void 0===this.data.autoHide||this.data.autoHide}set autoHide(t){this.data.autoHide=t}get anchor(){return this.data.anchor}set anchor(t){this.data.anchor=t,this.entity.setAnchor(t)}get priority(){return this.data.priority||0}set priority(t){this.data.priority=t}get tag(){return this.data.tag||""}set tag(t){this.data.tag=t}get renderOrder(){return this.entity.renderOrder}set renderOrder(t){this.entity.renderOrder=t}get position(){if(this.entity)return this.entity.originPosition}set position(t){t instanceof Lt&&(t=t.toArray()),this.data.position=t,this.entity&&(this.entity.originPosition.fromArray(t),this.entity._updateAnchor(),this.entity.fixedSize&&(this.entity._updateSize(),this.entity._updateAnchor()))}get x(){if(this.entity)return this.entity.originPosition.x}set x(t){this.data.position[0]=t,this.entity&&(this.entity.originPosition.x=t),this.data.point&&(this.data.point.x=t)}get y(){if(this.entity)return this.entity.originPosition.y}set y(t){this.data.position[1]=t,this.entity&&(this.entity.originPosition.y=t),this.data.point&&(this.data.point.y=t)}get z(){if(this.entity)return this.entity.originPosition.z}set z(t){this.data.position[2]=t,this.entity&&(this.entity.originPosition.z=t),this.data.point&&(this.data.point.z=t)}get scale(){if(this.entity)return this.entity.originScale}set scale(t){this.data.scale=t,this.entity&&this.entity.originScale.fromArray(t)}get scaleX(){if(this.entity)return this.entity.originScale.x}set scaleX(t){this.data.scale[0]=t,this.entity&&(this.entity.originScale.x=t)}get scaleY(){if(this.entity)return this.entity.originScale.y}set scaleY(t){this.data.scale[1]=t,this.entity&&(this.entity.originScale.y=t)}get scaleZ(){if(this.entity)return this.entity.originScale.z}set scaleZ(t){this.data.scale[2]=t,this.entity&&(this.entity.originScale.z=t)}clone(t){var e=this.getDataClone();"function"==typeof t?t(e):"object"==typeof t&&Object.assign(e,t);var i=new this.constructor(this.map,e,kh.cloneJSON(this.contentConfig));return i.data.id=kh.generateID().toLowerCase(),this.parent?this.parent.add(i):this.entity.parent&&this.entity.parent.add(i.entity),i.position.copy(this.entity.originPosition),i.entity.update(),this.data.point&&(i.data.point=this.data.point.clone()),i}updateRect(){var t=new Lt;this.entity.getWorldPosition(t);var e=kh.sceneToScreen(this.map,t),i=this.entity.width*this.entity.originScale.x*.9,n=this.entity.height*this.entity.originScale.y*.9;this.rect.x=e.x-i/2,this.rect.y=e.y-n/2,this.rect.width=i,this.rect.height=n}setImage(t){var e="",i=typeof t;return"object"===i?t.url&&(e=t.url):"string"===i&&(e=t,this.data.content.image.url?this.data.content.image.url=e:this.data.content.image=e),e&&(e=kh.getResourceUrl(this.map,null,e,!0)),this.entity&&this.entity.updateContent({type:"image",name:"image",value:e}),this}setImageSize(t,e){this.data.content.image&&t&&(e||(e=t),this.data.content.image.width=t,this.data.content.image.height=e,this.refresh())}setText(t,e){e=e||0;var i=this.data.content.texts;if(i){var n=i[e];return"object"!=typeof n?i[e]=t:n.text=t,this.entity&&this.entity.updateContent({type:"text",name:"text_"+e,value:t}),this}}updateFrame(t){return this.entity&&this.entity.updateContent({type:"frame",name:"frame",value:t}),this}setTextColor(t,e,i){var n=null,r=this.data.content.texts;if(void 0!==i){n="text_"+i;var a=r[i];"string"==typeof a&&(r[i]={text:a},t&&(r[i].color=t),e&&(r[i].strokeColor=e))}else r.forEach((i,n)=>{"string"==typeof i&&(i={text:i},r[n]=i),t&&(i.color=t),e&&(i.strokeColor=e)});this.entity&&this.entity.updateContent({type:"textColor",name:n,color:t,strokeColor:e})}updateContent(t){return this.entity.updateContent(t)}getTextString(){var t,e="";if(!this.data.content.texts)return"";var i=this.data.content.texts.length;return this.data.content.texts.forEach((n,r)=>{t="","string"==typeof n?e+=n:(n.strokeColor&&(t=","+n.strokeColor),n.color&&(t=n.color+t),t.length&&(t=","+t),n.align&&(t=n.align+t),t.length&&(t=","+t),n.size&&(t=n.size+t),t.length&&(t=","+t),t=n.text+t,e+=t),r!==i-1&&(e+="\n")}),e}getTextArray(){return this.getTextString().split("\n").map(t=>t.split(",")[0])}toTargetAlpha(t){var e=this.entity.material.opacity;if(e!==this.targetAlpha){var i=Math.sign(this.targetAlpha-e);this.alpha=e+i*t,(i>0&&this.alpha>=this.targetAlpha||i<0&&this.alpha<=this.targetAlpha)&&(this.alpha=this.targetAlpha),this.entity.material.opacity=this.alpha}}markerShow(){var t=1;this.parent&&this.parent.parent&&"OMFloor"===this.parent.parent.type&&this.parent.parent._isFadeOut&&this.map.config.enableFloorAlpha&&(t=this.map.config.fadeOutAlpha),this.targetAlpha=t,this.pickabled=!0,this._markerShow=!0}markerHide(){this.targetAlpha=0,this.pickabled=!1,this._markerShow=!1}update(t){this.parent&&!this.parent.show||(this.entity.update(),this.entity.imageLoaded&&this.toTargetAlpha(5*t))}flash(t){t=Object.assign({duration:400},t),this._flashAnm&&this._flashAnm.stop();var e=this.priority,i=this.autoHide;return this.priority=100,this.autoHide=!1,this.targetAlpha=1,this._flashAnm=new wh.Tween(this.entity).to({originScale:(new Lt).setScalar(t.scale||1.6),props:["originScale"]},.6*t.duration).onComplete(()=>{this._flashAnm=new wh.Tween(this.entity).to({originScale:(new Lt).setScalar(1),props:["originScale"]},.4*t.duration).onComplete(()=>{this.priority=e,this.autoHide=i}).start()}).start(),this}}var Sc={id:"",url:"",imageID:null,type:"",content:{},minLevel:16,maxLevel:24,autoHide:!1,size:null,scale:1,x:null,y:null,w:null,h:null,position:null,fixedSize:!1,onload:null,resizeByContent:!1,transform:{position:[0,0,0],rotation:[0,0,0],scale:[5,5,1]},tag:""};class Ac extends al{constructor(t,e){var i=new Qe(Ac.PLANE_GEO,Ac.PLANE_MAT.clone());i.material.visible=!1,kh.assign(e,Sc),super(t,e,i),this.data.node=this,this.entity.renderOrder=1,this.fixedSize=e.fixedSize||!1,e.size&&Array.isArray(e.size)&&(this.data.transform.scale[0]=e.size[0]||5,this.data.transform.scale[1]=e.size[1]||5,this.data.transform.scale[2]=e.size[2]||1),this.size=this.data.transform.scale,e.position&&(this.data.transform.position[0]=e.position.x||e.position[0]||0,this.data.transform.position[1]=e.position.y||e.position[1]||0,this.data.transform.position[2]=e.position.z||e.position[2]||0),this.type=this.class="PlaneMarkerNode",this.setData(e),this.zoomLevelChangedOff=this.map.on("zoomLevelChanged",()=>{this._checkVisible()}),this._checkVisible()}_checkVisible(){if(this.data.autoHide){var t=this.map.view.zoomLevel;this.visible=t>=this.data.minLevel&&t{this.entity.material.map&&this.entity.material.map.dispose(),this.entity.material.map=t,this.entity.material.visible=!0,null!==this.data.x&&void 0!==this.data.x&&this.setSpriteSheet(this.data),this.entity.material.needsUpdate=!0,this.data.onLoad&&(this.data.onLoad(this),delete this.data.onLoad)})}}getTextString(){return Mc.prototype.getTextString.call(this)}getTextData(t){return Mc.prototype.getTextData.call(this,t)}getFrameData(t){return Mc.prototype.getFrameData.call(this,t)}getFrameString(){return Mc.prototype.getFrameString.call(this)}updateContent(t){this.setData(t)}canvasImage(){var t;this.data.type&&this.data.content&&(t=wc.getInstance(this.map).getContent(this.data.type,this.data.content));var e=new sc(this.map,t,null,this.map.config.canvas2d?this.map.config.canvas2d.getContext("2d"):null);this.markerPainter=e,e.init(t=>{var i=this.data.fixedSize?1:this.data.scale||1;Array.isArray(i)&&(i=i[0]);var n=e.width,r=e.height;if(this.data.size=this.data.size||Math.max(this.size[0],this.size[1]),this.data.size)if("number"==typeof this.data.size){var a=n/r;n>r?r=(n=this.data.size)/a:n=(r=this.data.size)*a}else n=this.data.size[0],r=this.data.size[1];let o=n*i,s=r*i;if(this.data.resizeByContent){let t=e.width/e.height;e.width>=e.height?s=o/t:o=s*t}this.size=[o,s];var h=this.entity.material;h.map?(h.map instanceof dr&&h.map.dispose(),h.map.image=t):h.map=yc(t,t=>{xc.prototype._updateTexture.call(this.entity)}),h.map.needsUpdate=!0,h.visible=!0})}setData(t){t=this.data=Object.assign(this.data,t),this.setTransform(),this.data.type&&this.data.content&&(this.data.content.image||this.data.content.texts)?this.canvasImage():(this.data.imageID||(this.data.imageID=this.data.url),this.data.imageID&&this.setImage(this.data.imageID))}refresh(){this.setData(this.data)}getScale(){if(!this.map||!this.entity)return 1;var t=new Lt;return this.entity.getWorldPosition(t),kh.getZoomFactor(this.map,t)}setSize(t,e){this.size=[t,e]}setSpriteSheet(t){var e=this.entity.material.map;if(e&&e.image){var i=e.image.width,n=e.image.height;e.wrapS=e.wrapT=1e3,e.offset.x=t.x/i,e.offset.y=1-(t.y+t.h)/n,e.repeat.x=t.w/i,e.repeat.y=t.h/n}}clone(){var t=this.getDataClone(),e=new this.constructor(this.map,t);return e.data.id=kh.generateID().toLowerCase(),this.parent?this.parent.add(e):this.entity.parent&&this.entity.parent.add(e.entity),e}update(){if(this.fixedSize){var t=this.getScale(),e=this.size;this.entity.scale.set(e[0]*t,e[1]*t,e[2]*t)}}moveTo(t){var e=t.position;Array.isArray(e)&&(e=(new Lt).fromArray(e)),e&&void 0!==e.x&&void 0!==e.y&&(e instanceof Lt||(e.z=e.z||0,e=(new Lt).copy(e)),this._anim&&this._anim.stop(),this._anim=new wh.Tween(this.entity).to({position:e},t.duration||600).onComplete(()=>{t.callback&&t.callback()}).start())}dispose(){this.block&&this.block.removeTopImage(this),this.zoomLevelChangedOff&&this.zoomLevelChangedOff(),super.dispose()}}Ac.PLANE_GEO=new Ne(1,1,1,1),Ac.PLANE_MAT=new Ke({transparent:!0});class Tc{constructor(t){this.map=t,this.queue=[],this.count=0}create(t){if(t.markerNode){var e=kh.cloneJSON(t.data.markers);e&&e.length&&e.forEach(e=>{if(t.markerNode){var i=null;e.anchor?i=new Mc(this.map,e):e.imageID&&(i=new Ac(this.map,e)),i&&t.markerNode.add(i,!1)}})}}createSingleBuffer(t,e){return this.queue.push({data:t,node:e}),clearTimeout(this._id),this._id=setTimeout(()=>{this.createOneByOne()},30),!0}createOneByOne(){this.queue.splice(0,20).forEach(t=>{this.createSingle(t.data,t.node)}),this.queue.length&&setTimeout(()=>{this.createOneByOne()},30)}createSingle(t,e){var i=null;if(this.map.emit("markerData",t),this.map.emit("nodeData",t),t.anchor?i=new Mc(this.map,t):(t.imageID||t.content)&&(i=new Ac(this.map,t)),i){e.add(i,!1),i.entity.renderOrder=t.content?3:2;var n=this;return i.data.onLoad=function(t){if("OMFloor"===e.parent.type&&e.parent._isFadeOut&&n.map.config.enableFloorAlpha){var i=t.entity.material;i._originAlpha=i.opacity,i.opacity=n.map.config.fadeOutAlpha}},this.map.emit("markerCreated",i),this.map.emit("nodeCreated",i),i}}}var Lc={computeTangents:function(t){var e=t.index,i=t.attributes;if(null!==e&&void 0!==i.position&&void 0!==i.normal&&void 0!==i.uv){var n=e.array,r=i.position.array,a=i.normal.array,o=i.uv.array,s=r.length/3;void 0===i.tangent&&t.addAttribute("tangent",new ve(new Float32Array(4*s),4));for(var h=i.tangent.array,l=[],c=[],u=0;ut.groups),i=e.length,n=e[0].length,r=0,a=[],o=[],s=0,h=0;h0&&u===s&&l&&a[h].forEach(t=>{t[0]=r,r+=t[1]}),a[h].push([r,d.count]),r+=d.count}var p=a[h][0][0];o.push({start:p,count:r-p,materialIndex:e[0][h].materialIndex})}return{mergedData:a,mergedGroups:o}},mergeBufferGeometries:function(t,e){var i,n=null!==t[0].index,r=new Set(Object.keys(t[0].attributes)),a=new Set(Object.keys(t[0].morphAttributes)),o={},s={},h=null,l=t[0].groups&&t[0].groups.length>1;l&&(h=[],i=this.kaoo(t));for(var c=new Ee,u=0,d=0;dt.start)),s=0;s{var n=d[i];l.set(t[s].array.slice(n.start*r,(n.start+n.count)*r),e*r),u[i]=u[i]+n.count})}else l.set(t[s].array,c);c+=t[s].array.length}return new ve(l,r,a)}};function Cc(t,e){if(!(this instanceof Cc))return new Cc(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||Pc,this.length>0)for(var i=this.length>>1;i>=0;i--)this._down(i)}function Pc(t,e){return te?1:0}Cc.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,i=this.compare,n=e[t];t>0;){var r=t-1>>1,a=e[r];if(i(n,a)>=0)break;e[t]=a,t=r}e[t]=n},_down:function(t){for(var e=this.data,i=this.compare,n=this.length,r=n>>1,a=e[t];t=0)break;e[t]=h,t=o}e[t]=a}};var Ec=Cc;function Dc(t,e){return e.max-t.max}function Ic(t,e,i,n){this.x=t,this.y=e,this.h=i,this.d=function(t,e,i){for(var n=!1,r=1/0,a=0;ae!=u[1]>e&&t<(u[0]-c[0])*(e-c[1])/(u[1]-c[1])+c[0]&&(n=!n),r=Math.min(r,Oc(t,e,c,u))}return(n?1:-1)*Math.sqrt(r)}(t,e,n),this.max=this.d+this.h*Math.SQRT2}function Oc(t,e,i,n){var r=i[0],a=i[1],o=n[0]-r,s=n[1]-a;if(0!==o||0!==s){var h=((t-r)*o+(e-a)*s)/(o*o+s*s);h>1?(r=n[0],a=n[1]):h>0&&(r+=o*h,a+=s*h)}return(o=t-r)*o+(s=e-a)*s}var Nc=function(t,e,i){var n,r,a,o;e=e||1;for(var s=0;sa)&&(a=h[0]),(!s||h[1]>o)&&(o=h[1])}var l=a-n,c=o-r,u=Math.min(l,c),d=u/2,p=new Ec(null,Dc);if(0===u)return[n,r];for(var f=n;fg.d&&(g=v),p.length;p.length;){var y=p.pop();y.d>g.d&&(g=y),y.max-g.d<=e||(d=y.h/2,p.push(new Ic(y.x-d,y.y-d,d,t)),p.push(new Ic(y.x+d,y.y-d,d,t)),p.push(new Ic(y.x-d,y.y+d,d,t)),p.push(new Ic(y.x+d,y.y+d,d,t)))}return{x:g.x,y:g.y,radius:g.d}},kc=new class{constructor(){this.map=null,this.ctx=null}setData(t,e){this.map=t,this.ctx=e.getContext("2d")}get canvas(){return this.ctx.canvas}_getTexture(){var t=new Nt,e=document.createElement("img");return e.src=this.ctx.canvas.toDataURL("image/png"),e.onload=function(){t.image=e,t.needsUpdate=!0,e.onload=null},t}_setSize(t=128){this.canvas.width=t,this.canvas.height=t}drawWallTexture(){this._setSize();var t=this.ctx.createLinearGradient(0,0,0,128);t.addColorStop(0,"#dfe5e7"),t.addColorStop(1,"#8e9294"),this.ctx.fillStyle=t,this.ctx.fillRect(0,0,128,128)}get wallTexture(){return this.drawWallTexture(),this._getTexture()}drawGradientAlpha(){this._setSize();var t=this.ctx.createLinearGradient(0,0,0,128);t.addColorStop(0,"rgba(255,255,255,0)"),t.addColorStop(.9,"rgba(255,255,255,1)"),this.ctx.fillStyle=t,this.ctx.fillRect(0,0,128,128)}get gradientAlpha(){return this.drawGradientAlpha(),this._getTexture()}},zc={generateTopUV:function(t,e,i,n,r){var a=e[3*i],o=e[3*i+1],s=e[3*n],h=e[3*n+1],l=e[3*r],c=e[3*r+1];return[new St(a,o).divideScalar(5),new St(s,h).divideScalar(5),new St(l,c).divideScalar(5)]},generateSideWallUV:function(t,e,i,n,r,a){var o=e[3*i],s=e[3*i+1],h=e[3*i+2],l=e[3*n],c=e[3*n+1],u=e[3*n+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*a],g=e[3*a+1],v=e[3*a+2];return Math.abs(o-l)<.01?[new St(s/5,h/2),new St(c/5,u/2),new St(p/5,f/2),new St(g/5,v/2)]:[new St(o/5,h/2),new St(l/5,u/2),new St(d/5,f/2),new St(m/5,v/2)]}},Rc={generateTopUV:zc.generateTopUV,generateSideWallUV:function(t,e,i,n,r,a){var o=e[3*i],s=e[3*i+1];e[3*i+2];var h=e[3*n],l=e[3*n+1];e[3*n+2];var c=e[3*r],u=e[3*r+1];e[3*r+2];var d=e[3*a],p=e[3*a+1];return e[3*a+2],Math.abs(o-h)<.01?[new St(s/5,0),new St(l/5,0),new St(u/5,1),new St(p/5,1)]:[new St(o/5,0),new St(h/5,0),new St(c/5,1),new St(d/5,1)]}},Bc=null,Fc="1015",Uc={id:"",imageID:null,transform:{position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]}},Gc={id:-1,name:"",points:[],noHole:!1,typeID:1e3,minLevel:10,maxLevel:24,userData:{},tag:"",topImages:[],entrances:[]};class jc extends al{constructor(t,e,i){super(t,e=e||kh.cloneJSON(Gc)),this.data.node=this,this.style=null,this.borderLine=null,this.parentNode=i;let n=this.getType();n&&!1===n.mergable&&(this.parentNode=void 0),this.build(),this.type="OMBlock",this.class="OMBlock",["color","alpha","height"].forEach(t=>{t in this.data&&this[`set${kh.capWord(t)}`](this.data[t])})}get noHole(){return this.data.noHole||this.data.userData.noHole}get area(){var t=this.getArea(this.data.points[0]);if(this.data.points.length>1)for(var e=1;e{t.topImages.push(e.getData())}),t}toCenter(t){if(!this.data.points.length)return;this.centerPoints=kh.cloneJSON(this.data.points);let e=this.centerPoints.reduce((t,e)=>{let i=e.reduce((t,e)=>(t[0]+=e[0],t[1]+=e[1],t[2]+=e[2],t),[0,0,0]),n=e.length;return i[0]/=n,i[1]/=n,i[2]/=n,t[0]+=i[0],t[1]+=i[1],t[2]+=i[2],t},[0,0,0]);var i=this.centerPoints.length;e[0]/=i,e[1]/=i,e[2]/=i;var n=t?t.center:e;this.centerPoints.forEach(t=>{t.forEach(t=>{t[0]-=n[0],t[1]-=n[1],t[2]-=n[2]})}),this.center=e}build(t,e){var i;Array.isArray(t)?this.data.points=t:t&&(this.data=t);var n=!1;this.parentNode&&(this.baseNode=i=this.parentNode.getBlockByTypeID(this.data.typeID),i||(n=!0));var r=this.getStyle();if(this.toCenter(i),this.centerPoints.length&&this.centerPoints[0].length){var a=null,o=[];if(this.noHole?(o=this.centerPoints.map(t=>t.map(t=>(new Lt).fromArray(t))),a=o.map(t=>new Oo(t))):this.centerPoints.forEach((t,e)=>{var i=t.map(t=>(new Lt).fromArray(t));0===e?a=new Oo(i):a.holes.push(new Io(i)),o.push(i)}),a){var s,h=null;if(Array.isArray(a)){let t=a.map(t=>new aa(t,{depth:1,bevelEnabled:!1,UVGenerator:this.data.typeID==Fc?Rc:zc}));h=Lc.mergeBufferGeometries(t),t.forEach(t=>t.dispose())}else h=new aa(a,{depth:1,bevelEnabled:!1,UVGenerator:this.data.typeID==Fc?Rc:zc});h.computeBoundingSphere(),"1015"===this.data.typeID&&(h.attributes.uv2=h.attributes.uv),"Object3D"===this.entity.type?(i?(jc.pushToMerge(i,h,this,this.parentNode),s=i.entity):s=new Qe(h,new Na({transparent:!0})),this.setEntity(s),n&&this.parentNode.setBlockByTypeID(this.data.typeID,this)):(this.entity.geometry.dispose(),this.entity.geometry=h)}r.noBorder?this.disposeBorderLine():this.buildBorder(o),this.data.topImages&&(!e||e&&!1!==e.buildTopImage)&&this.buildTopImages(this.data.topImages),this.baseNode||(this.position.fromArray(this.center),this.updateStyle(r))}}fillLineGeo(t,e){var i=new Float32Array(3*e.length);e.forEach((t,e)=>{var n=3*e;i[n]=t.x,i[n+1]=t.y,i[n+2]=t.z});var n=t.geometry.getAttribute("position");n?n.setArray(i):t.geometry.addAttribute("position",new ve(i,3)),t.geometry.attributes.position.needsUpdate=!0,t.geometry.computeBoundingSphere()}getLineGeoByVs(t){var e=new Ee,i=2*t.length*3,n=new Float32Array(i);t.forEach((t,e)=>{if(0===e)n[0]=t.x,n[1]=t.y,n[2]=t.z;else{var i=6*e-3;n[i]=t.x,n[i+1]=t.y,n[i+2]=t.z,n[i+3]=t.x,n[i+4]=t.y,n[i+5]=t.z}}),n[i-3]=t[0].x,n[i-2]=t[0].y,n[i-1]=t[0].z;var r=e.getAttribute("position");return r?r.setArray(n):e.addAttribute("position",new ve(n,3)),e}buildBorder(t){this.disposeBorderLine();var e,i=[];this.baseNode&&i.push(this.baseNode.borderLine.geometry),t.forEach(t=>{i.push(this.getLineGeoByVs(t))});for(var n=Lc.mergeBufferGeometries(i),r=1;r{t.transform.position;var e=new Ac(this.map,t);this.baseNode&&e.entity.position.add(this.getCenter()).sub(this.baseNode.entity.position),e.pickabled=!1,e.entity.renderOrder=2,e.block=this,this.add(e),e.entity.position.z=1.01})}removeTopImages(){this.children.forEach(t=>{t.dispose()}),this.data.topImages&&(this.data.topImages.length=0)}addTopImage(t){if("string"==typeof t){var e=kh.cloneJSON(Uc);e.imageID=t,t=e}"transfrom"in t||(t.transform={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]});var i=this.getMaxArea();t.transform.position[0]=i.x-this.center[0],t.transform.position[1]=i.y-this.center[1],t.transform.position[2]=1.01;var n=t.transform.scale;n[0]=n[1]=n[2]=i.radius;var r=new Ac(this.map,t);return r.pickabled=!1,r.block=this,this.data.topImages||(this.data.topImages=[]),this.add(r),this.data.topImages.push(r.data),r}removeTopImage(t){if(this.children.length){this.children.splice(this.children.indexOf(t),1);for(var e=-1,i=0;i-1&&this.data.topImages.splice(e,1),t.dispose()}}disposeBorderLine(){this.borderLine&&(this.entity.remove(this.borderLine),this.borderLine.material.dispose(),this.borderLine.geometry.dispose(),this.borderLine.children.forEach(t=>{t.geometry.dispose()}),this.borderLine=null)}getType(){return this.map.omScene.theme.data.typeIDs[this.data.typeID]}getStyle(t){return this.map.omScene.theme.getBlockStyleByTypeID(t||this.data.typeID)}setType(t){this.data.typeID=t,this.updateStyle()}setHeight(t){void 0!==t&&(this.height=t)}get height(){return this.entity.scale.z}set height(t){this.entity.scale.z=t,t<=(this.map.config.blockHideSideHeight||.1)?this.entity.geometry.drawRange.count=this.entity.geometry.groups[0].count:this.entity.geometry.drawRange.count=1/0}setColor(t,e){t&&(kh.setMaterialColor(this.entity.material,t,this.map),e&&this.borderLine&&this.borderLine.material.color.set(e))}setAlpha(t){this.entity.material.opacity=t}updateStyle(t){if(this.style=t||this.getStyle(),this.data.typeID==Fc){if(Bc||(Bc=kc.wallTexture),this._lastTypeID!=Fc){var e=this.entity.material;this.entity.material=[e,e.clone()]}(e=this.entity.material)[1].lightMap=Bc,e[1].lightMapIntensity=.4,e[0].color.set("#333"),e[1].color.set("#ddd"),e[0].emissive.set("#333"),e[1].emissive.setScalar(0),e[0].transparent=!1,e[1].transparent=!1,e[1].needsUpdate=!0,this.data.pickabled=!1}else this._lastTypeID==Fc&&(this.entity.material=this.entity.material[0],this.entity.material.transparent=!0),this.data.pickabled=void 0,kh.setMaterialColor(this.entity.material,this.style.color,this.map),this.entity.material.opacity=this.style.alpha;this.height=this._lastHeight=this.style.blockHeight||1,this.entity.position.z=this.style.height||0,this.borderLine&&this.borderLine.material.color.set(this.style.borderColor),this._lastTypeID=this.data.typeID}getMaxArea(){return Nc(this.data.points)}changeType(t){t=t||this.data.typeID;var e=this.map.omScene.theme;this.data.typeID=t,e.data.typeIDs[t]||(t=1e3),this.updateStyle(this.getStyle(t))}flashHeight(t){return t=Object.assign({duration:700},t),this._flashAnm&&(this._flashAnm.stop(),this._lastHeight&&(this.height=this._lastHeight)),this._lastHeight=this.height,this._flashAnm=new wh.Tween(this).to({height:(t.scale||2.8)*this._lastHeight,props:["height"]},.6*t.duration).onComplete(()=>{this._flashAnm=new wh.Tween(this).to({height:this._lastHeight,props:["height"]},.4*t.duration).start()}).start(),this}containPoint(t,e){e=e||this.data.points;for(var i=t.x,n=t.y,r=!1,a=e.length,o=0,s=a-1;on!=u>n&&i<(c-h)*(n-l)/(u-l)+h&&(r=!r)}return r}dispose(){this.centerPoints.length=0,this.center=null,this.disposeBorderLine(),this.removeTopImages(),super.dispose()}}jc.startToMerge=function(){jc.mergeSet&&(clearTimeout(jc.mergeID),jc.mergeID=setTimeout(()=>{Object.keys(jc.mergeSet).forEach(t=>{var e=jc.mergeSet[t],i=e.baseNode.entity.geometry.shareNodes||[],n=e.map(t=>t.geo),r=Lc.mergeBufferGeometries(n,!1);i.length&&e.shift();var a=r.mergedData;a.length;for(var o=1,s=e.length-1;s>-1;s--){for(var h=e[s],l=[],c=0;ct.node)),r.shareNodes=i,e.baseNode.updateStyle(),delete jc.mergeSet[t]})},200))},jc.pushToMerge=function(t,e,i,n){jc.mergeSet||(jc.mergeSet={});var r=`${n.id}-${t.id}`;jc.mergeSet[r]||(jc.mergeSet[r]=[{geo:t.entity.geometry,node:t}],jc.mergeSet[r].baseNode=t),jc.mergeSet[r].push({geo:e,node:i}),jc.startToMerge()};class Vc{constructor(t){this.map=t}create(t){if(t.blockNode){var e=t.data.blocks;e&&e.length&&e.forEach(e=>{var i=new jc(this.map,e);t.blockNode.add(i,!1)})}}createSingle(t,e){this.map.emit("blockData",t),this.map.emit("nodeData",t);var i=this.map.config.mergeSameTypeBlocks?e.parent:null,n=new jc(this.map,t,i);if(e.add(n,!1),n.entity.getWorldPosition(n.data.boundingSphere.center),"OMFloor"===e.parent.type&&("1001"===n.data.typeID&&e.parent.floorBlocks.push(n),e.parent._isFadeOut&&this.map.config.enableFloorAlpha)){var r=n.entity.material;r._originAlpha=r.opacity,r.opacity=this.map.config.fadeOutAlpha,n.children.forEach(t=>{var e=t.entity.material;e._originAlpha=e.opacity,e.opacity=this.map.config.fadeOutAlpha})}return this.map.emit("blockCreated",n),this.map.emit("nodeCreated",n),n}}class Wc{constructor(){}create(t){t.route&&t.data.route&&t.route.createByData(t.data.route,t.editorData?t.editorData.roadSegments:null)}}var Hc=null;function Xc(t){return Hc&&Hc.modelsCreator.map.id===t.id?Hc:Hc={modelsCreator:new Ql(t),markersCreator:new Tc(t),blocksCreator:new Vc(t),routeCreator:new Wc(t)}}var qc={themeID:"",name:"",version:1,default:{anchor:"bottom",fontSize:14,imageWidth:20,imageHeight:20,blockColor:"#dddddd",blockHeight:2,blockAlpha:.9},_markerID:5,_styleID:200,_typeID:1100,background:{color:"#282a35",alpha:1},typeIDs:{1e3:{name:"默认类型",styleID:"100",mergable:!0},1001:{name:"楼板",styleID:"101"},1002:{name:"类型2",styleID:"102"},1003:{name:"类型3",styleID:"103"},1004:{name:"类型4",styleID:"104"},1005:{name:"类型5",styleID:"105"},1006:{name:"类型6",styleID:"106"},1007:{name:"类型7",styleID:"107"},1008:{name:"类型8",styleID:"108"},1009:{name:"类型9",styleID:"109"},1010:{name:"类型10",styleID:"110"},1011:{name:"类型11",styleID:"111"},1012:{name:"类型12",styleID:"112"},1013:{name:"类型13",styleID:"113"},1014:{name:"类型14",styleID:"114"},1015:{name:"室内墙体",styleID:"115"}},styles:{makers:{0:{type:"sprite",anchor:"bottom",content:{image:{imageAlign:"center"}}},1:{type:"sprite",content:{text:{fontAlign:"center"}}},2:{type:"sprite",content:{text:{fontAlign:"left"},image:{imageAlign:"left"}}},3:{type:"sprite",content:{text:{fontAlign:"right"},image:{imageAlign:"right"}}},4:{type:"sprite",content:{text:{fontAlign:"center"},image:{imageAlign:"top"}}},5:{type:"sprite",content:{text:{fontAlign:"center"},image:{imageAlign:"bottom"}}}},blocks:{100:{color:"#eeeeee"},101:{color:"#cccccc",alpha:1,noBorder:!0,blockHeight:1,height:-1},102:{color:"#eda6a1"},103:{color:"#6beb90"},104:{color:"#f37775"},105:{color:"#e6e072"},106:{color:"#86aae7"},107:{color:"#72ebe3"},108:{color:"#d39fea"},109:{color:"#cfd5d6"},110:{color:"#006824"},111:{color:"#b5ac73"},112:{color:"#3f72d7"},113:{color:"#00927f"},114:{color:"#ede99d"},115:{color:"#dddddd",blockHeight:2.1}}},customize:{}};class Yc{constructor(t,e){this.map=t,this.data=e||kh.cloneJSON(qc),this.data.themeID||(this.data.themeID=kh.generateID(16,"t")),this.map.themes[this.data.themeID]=this}get themeID(){return this.data.themeID}getDefault(){var t=Array.from(arguments),e={};return t.forEach(t=>{e[t]=this.data.default[t]}),e}getDefaultBlockStyle(t){if(t||!this.defaultBlockStyle){var e=this.getDefault("blockColor","blockAlpha","blockHeight");void 0!==e.blockColor&&(e.color=e.blockColor,delete e.blockColor),void 0!==e.blockAlpha&&(e.alpha=e.blockAlpha,delete e.blockAlpha),this.defaultBlockStyle=e}return kh.cloneJSON(this.defaultBlockStyle)}getDefaultBorderColor(t){return"#"+new Qt(t).multiplyScalar(.5).getHexString()}getBlockStyleSets(t){var e=this.getDefaultBlockStyle(),i=this.data.styles.blocks[t]||{};return i.borderColor||(e.borderColor=this.getDefaultBorderColor(i.color||e.color)),{default:e,custom:i,styleID:t}}getBlockStyleByStyleID(t){var e=this.getDefaultBlockStyle(),i=this.data.styles.blocks[t]||{};return Object.assign(e,i),e.borderColor||(e.borderColor=this.getDefaultBorderColor(e.color)),e}getBlockStyleByTypeID(t){var e=this.data.typeIDs[t]||this.data.typeIDs[1e3],i=e.styleID;i&&this.data.styles.blocks[i]||(i="100");var n=this.getBlockStyleByStyleID(i);return n.name=e.name,n.styleID=i,n}_updateTypeFunc(t,e){var i=kh.getRootNode(t,"blockNode"),n=[],r=null;return e&&(r=Array.isArray(e)?t=>e.indexOf(t.data.typeID)>-1:t=>t.data.typeID==e),i.forEach(t=>{t.children.forEach(t=>{e&&!r(t)||(t.changeType(),n.push(t))})}),n}apply(t){return this._updateTypeFunc(t,null),this}updateTypes(t,e){return this._updateTypeFunc(t,e)}updateType(t,e){return this._updateTypeFunc(t,e)}setTypeStyle(t,e,i){var n=t.theme;return i&&!n.data.styles.blocks[i]||(i="100"),n.data.typeIDs[e].styleID=i,n.updateType(t,e)}updateStyle(t,e,i,n){var r=t.theme,a=Object.keys(r.data.typeIDs),o=[];return a.forEach(a=>{var s=r.data.typeIDs[a];s.styleID==e&&(null!=i&&(s.styleID=i||"100"),o.push(a),n&&n.push.apply(n,this.updateType(t,a)))}),o}updateTypeData(t){this.data.typeIDs[t.typeID]&&(this.data.typeIDs[t.typeID].name=t.name,this.data.styleIndex[typeID]=t.styleID)}getTypeData(t){var e={};if(this.data.typeIDs[t]){var i=this.data.typeIDs[t];Object.assign(e,i,{typeID:t})}return e}load(t){}}var Zc={sceneID:"",name:"",themeID:"",version:1,idCount:0,frameRate:12,maxFrameRate:30,viewMode:"3d",viewAngle:30,polarAngle:60,minPolarAngle:0,maxPolarAngle:60,zoomLevel:18,minZoomLevel:14,maxZoomLevel:24,center:[0,0],viewCenter:[0,0],useAOEffect:!1,models:[],markers:[],blocks:[],route:null,buildings:[],scriptCodes:{},scripts:[],userData:{},tag:"",baseLayerDatas:[]},Jc={id:-1,buildingID:null,transform:{position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]},minLevel:0,maxLevel:28,userData:{}};class Kc extends ol{constructor(t,e){(e=e||kh.cloneJSON(Zc)).sceneID||(e.sceneID=kh.generateID(16,"s")),super(t,e,new Zn),this.data.node=this,this.map=t,this.data.scriptCodes||(this.data.scriptCodes={}),this.map.mapEventHandlerManager.clear(),this.map.omScene=this,this._theme=null,this.modelNode=new gl(t,"group"),this.modelNode.name="modelNode",this.modelNode.tags=null,this.modelNode.data.children=this.data.models,this.markerNode=null,new sl(t).bind(this),this.markerNode.background=!1,this.buildingNode=new al(t),this.buildingNode.name="buildingNode",this.route=new Ul(t),this.route.name="route",this.createRoute(),this.blockNode=new al(t),this.blockNode.name="blockNode",this.data.blocks=this.data.blocks||[],this.blockNode.data.children=this.data.blocks,this.add(this.modelNode,this.markerNode,this.route,this.blockNode,this.buildingNode),this.map.sceneManager.addOMScene(this),this.type="OMScene",this._autoInOutdoor=this.map.config.autoInOutdoor||!1,this._buildingLoaded={},this.setData(),this.hideNodes(),this.createBaseLayer(),this.isReady=!1,this.map.once("focusFloors",()=>{this.isReady=!0,this.map.emit("first-focus",this.map),this.map.emit("viewChanged")})}get focusBuilding(){return this.map.visibleManager._lastFocusBuilding}createScene(){Xc(this.map).modelsCreator.create(this),Xc(this.map).markersCreator.create(this),Xc(this.map).blocksCreator.create(this),this.createBaseLayer(),this.createRoute()}createBaseLayer(){var t=this.data.baseLayerDatas;t&&t.length&&t.forEach(t=>{new Zl(this.map,t)})}createRoute(){Xc(this.map).routeCreator.create(this)}getData(){var t=super.getData(),e=this.buildingNode.children.map(t=>{var e=kh.getBoundingSphere(t.entity);return t.nodeIndex.radius=e.radius,t.nodeIndex});return t.buildings=e,t.baseLayerDatas=this.map.baseLayers.map(t=>t.getData()),t}get theme(){return this._theme}set theme(t){this._theme=t,this.map.view.backgroundColor=t.data.background.color,this.map.view.backgroundAlpha=t.data.background.alpha}get autoInOutdoor(){return this._autoInOutdoor}set autoInOutdoor(t){this._autoInOutdoor=t,this.map.emit("viewChanged")}loadBuilding(t){}loadAllDatas(){return this.findData({})}addBuilding(t){t.omScene=this,this.buildingNode.add(t);var e=t.nodeIndex||this.getBuildingIndex(t);e||((e=kh.cloneJSON(Jc)).id=kh.generateID().toLowerCase(),e.buildingID=t.data.buildingID,this.data.buildings.push(e),t.nodeIndex=e),t.setTransform()}getBuildingIndex(t){kh.findFromArray(this.data.buildings,"buildingID",t.data.buildingID,(t,e)=>t)}removeBuilding(t){this.buildingNode.remove(t,!1),delete t.omScene,kh.findFromArray(this.data.buildings,"buildingID",t.getProp("buildingID"),(t,e)=>{this.data.buildings.splice(e,1)})}setData(t){t&&(this.data=t),this.removeChildren(!1),this.clearBaseLayer()}getBuildingByName(t,e){}getBuildingByID(t,e){var prom=new Nh,i=this.data.buildings.find(e=>e.buildingID===t);if(i)if(i.node)prom.resolve(i.node),e&&e(i.node);else{if(this._buildingLoaded[t])return this._buildingLoaded[t].push(prom),prom;this._buildingLoaded[t]=[prom],this.map.omLoader.loadBuilding(i);var n=this.map.on("buildingLoaded",i=>{i.data.buildingID===t&&(n(),this._buildingLoaded[t].forEach(t=>{t.resolve(i)}),e&&e(i))})}else prom.resolve(null),e&&e(null);return prom}getBuildingByIndex(t){var prom=new Nh,e=this.data.buildings[t];return e?this.getBuildingByID(e.buildingID):(prom.resolve(null),prom)}getFloor(t,e){var prom,i=new Nh;return 1===arguments.length&&(e=t,t=0),"string"==typeof t?prom=this.getBuildingByID(t):"number"==typeof t&&(prom=this.getBuildingByIndex(t)),e=[].concat(e),prom.then(t=>{var n=e.map(e=>t.getFloorByFloorNumber(e));Nh.all(n).then(t=>{i.resolve(1===t.length?t[0]:t)})}),i}findData(t,e){e=Object.assign({recursive:!0,multi:!1},e);var i=[],n=el.prototype.findData.call(this,t,{recursive:!1,multi:e.multi});return n.type="scene",n.length&&i.push(Nh.empty(n)),e.recursive&&this.data.buildings.forEach(n=>{var r=new Nh;this.getBuildingByID(n.buildingID).then(i=>{i.findData(t,e).then(t=>{r.resolve(t)})}),i.push(r)}),Nh.all(i)}removeChildren(t=!0){this.entity.children.forEach(e=>{this.removeEntity(e,t)})}isRoadPointNear(t,e,i=.5){let n=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y);return n<=i&&r<=i}entranceMatch(t,e){let i=[];for(var n=0;nt.floorNumber===r.floorNumber);if(r&&a){let t=this.entranceMatch(r,a);t.length&&(i[r.floorNumber]=t)}}return i}findNearestMatchPoint(t,e,i){let n=Object.keys(e),r=Number.MAX_SAFE_INTEGER,a=0;n.forEach(e=>{e=+e;let i=Math.abs(e-t.floorNumber);i{Array.isArray(t.point)&&(t.point=(new Lt).fromArray(t.point))});var a=Object.assign({},r,{clearLines:!1});if(i.length<2)return;if(i.length>2){r.clearLines&&this.clearRoutes();for(var o=[],s=0;si.findPath(t,e,r).then(t=>{if(t)return Array.isArray(t)?t.forEach(t=>t.building=i):t.building=i,t}));{let i=u?this.getBuildingByID(u).then(t=>(l=t,t.getEntrancePoints())):Nh.empty(),n=d?this.getBuildingByID(d).then(t=>(c=t,t.getEntrancePoints())):Nh.empty();return Nh.all([i,n]).then(i=>{if(l&&(t.point=l.localPosition(t.point)),c&&(e.point=c.localPosition(e.point)),i.some(t=>!t)){if(i[0]&&!i[1]){let n=i[0].find(t=>1===t.floorNumber),a={point:kh.findNearestPoint(t.point,n),floorNumber:1},o=l.findPath(t,a,r);return this.route.findPathAsync(a.point,e.point,r),Nh.all([o,prom_to]).then(t=>(t[0]&&(t[0].building=l),t))}if(!i[0]&&i[1]){let t=i[1].find(t=>1===t.floorNumber),n={point:kh.findNearestPoint(e.point,t),floorNumber:1},a=c.findPath(e,n,r),o=this.route.findPathAsync(n.point,e.point,r);return Nh.all([o,a]).then(t=>(t[1]&&(t[1].building=c),t))}return this.route.findPathAsync(t.point,e.point,r)}{let n=this.entrancesMatch(i[0],i[1]);if(Object.keys(n).length){let{nearFloor:i,nearEntrance:a}=this.findNearestMatchPoint(t,n,"from"),o=l.findPath(t,{point:a.from,floorNumber:i},r),s=c.findPath({point:a.to,floorNumber:i},e,r);return Nh.all([o,s]).then(t=>(t[0]&&(t[0].building=l),t[1]&&(t[1].building=c),t))}{let n=null,a=null;if(l&&(n=l.connectBuildings),c&&(a=c.connectBuildings),n&&a){let o=n.filter(t=>a.indexOf(t)>-1),s=null;if(o.length)return this.getBuildingByID(o[0]).then(t=>(s=t,t.getEntrancePoints())).then(n=>{let a=this.entrancesMatch(i[0],n),o=this.entrancesMatch(n,i[1]);if(Object.keys(a).length&&Object.keys(o).length){let i=this.findNearestMatchPoint(t,a,"from"),n=l.findPath(t,{point:i.nearEntrance.from,floorNumber:i.nearFloor},r),h=this.findNearestMatchPoint(e,o,"to"),u=s.findPath({point:i.nearEntrance.to,floorNumber:i.nearFloor},{point:h.nearEntrance.from,floorNumber:h.nearFloor},r),d=c.findPath({point:h.nearEntrance.to,floorNumber:h.nearFloor},e,r);return Nh.all([n,u,d]).then(t=>(t[0]&&(t[0].building=l),t[1]&&(t[1].building=s),t[2]&&(t[2].building=c),t))}})}}let a=i[0].find(t=>1===t.floorNumber);i[1].find(t=>1===t.floorNumber);let o=kh.findNearestPoint(t.point,a),s=kh.findNearestPoint(e.point,a),h={point:o,floorNumber:1},u=l.findPath(t,h,r),d={point:s,floorNumber:1},p=c.findPath(d,e,r),f=this.route.findPathAsync(h.point,d.point,r);return Nh.all([u,f,p]).then(t=>(t[0].building=l,t[2].building=c,t))}})}}var p=t.point?t.point:t,f=e.point?e.point:e;return this.route.findPathAsync(p,f)}clearRoutes(){this.route.clearLines(),this.buildingNode.children.forEach(t=>{t.clearRoutes()})}clear(){this.data=null,this.removeChildren(!0),this.clearBaseLayer()}clearBaseLayer(){this.map.baseLayers.length&&(this.map.baseLayers.forEach(t=>{t.dispose()}),this.map.baseLayers.length=0)}dispose(){super.dispose(),this.clear()}}class Qc{constructor(t){this.map=t,this.data=null,this.base=new Zn,this.base.name="base",this.default=new Zn,this.default.name="default",this.mainScene=new Zn,this.mainScene.name="main",this.mainScene.area=new Ut,this.markerScene=new Zn,this.markerScene.name="marker";var e=new Zn;e.name="hud",this.props=kh.getSecret(),this.props.constructor("dit",e),this.globalScene=new Zn,this.globalScene.name="global",this.OMScenes={},this.scenes=[this.default,this.mainScene,this.markerScene,this.globalScene]}addOMScene(t){this.OMScenes[t.data.sceneID]=t,this.mainScene.add(t.entity)}getOMScene(t){return this.OMScenes[t]}getSceneArea(){var t=this.mainScene.area,e=this.map.config.sceneAreaRate;t.expandByObject(this.mainScene);var i=(t.max.x-t.min.x)*(e-1)/2,n=(t.max.y-t.min.y)*(e-1)/2;return t.min.x-=i,t.min.y-=n,t.max.x+=i,t.max.y+=n,t}removeOMScene(t){var e,i;t instanceof Kc?(e=t.ID,i=t):"string"==typeof t&&(e=t,i=this.getOMScene(t)),i&&(i.dispose(),delete this.OMScenes[e])}clearScene(){Object.keys(this.OMScenes).forEach(t=>{this.OMScenes[t].dispose()}),this.OMScenes={}}}var $c={debug:!1,container:null,server:"https://www.ooomap.com/ooomap-sdk-api/",verifyUrl:"",appID:"",standalone:!1,baseUrl:"/",removeLogo:"",frameRate:12,maxFrameRate:30,viewMode:"3d",viewAngle:30,polarAngle:60,viewCenter:null,zoom:null,zoomSpeed:.75,zoomLevel:18,minZoomLevel:14,maxZoomLevel:25,minPolarAngle:0,maxPolarAngle:60,controls_phiThreshold:2,animateDuration:600,viewChangedEventDelay:100,viewChangedTimeStep:300,useAOEffect:!1,useShadowMap:!1,modelPath:null,modelType:".omm",enableModelFixedSize:!0,focusBuildingID:"",viewFloors:null,focusFloors:null,floorSpace:68,fadeOutAlpha:.4,enableFloorAlpha:!1,wallLightMap:"https://www.ooomap.com/assets/textures/wall.png",sceneAreaRate:1,modelEmissive:.3,mouseOverTime:300,doubleClickTime:0,blockHideSideHeight:.1,indoorLevel:10,autoInOutdoor:!1,autoIndoorThreshold:.9,autoIndoorPolarAngle:60,onlyOneIndoor:!1,context:null,mergeSameTypeBlocks:!0,resolution:1,eventsOnContainer:!1,zoomToCursor:!1,webGLConfig:{},onlyShowFocusBuildingMarkers:!1,noMetalness:!0,noEmissive:!1,enableInViewlVisible:!1,linkedFloors:null,liftDistance:25};class tu{constructor(t){this.map=t,this.VIEW_ANIMATING="view_animating",this.ANIMATING="animating",this.INPUTTING="inputting",this._states=[]}get states(){return this._states}haveState(t){return this.states.includes(t)}addState(t){this._states.includes(t)||(this._states.push(t),this.checkStates(),this.map.emit("stateChanged",this._states))}removeState(t){var e=this._states.indexOf(t);e>-1&&(this._states.splice(e,1),this.checkStates(),this.map.emit("stateChanged",this._states))}reset(){this.map.needHeighFrameRate=!1}checkStates(){this.reset(),this._states.includes(this.VIEW_ANIMATING)&&(this.map.needHeighFrameRate=!0)}}class eu{constructor(t){this.map=t,this.enabled=!0,this.raycaster=new Vs,this.raycaster.linePrecision=2.25,this.objects=[],this.nodes=[],this.enableMouseOver=this.map.config.enableMouseOver||!1,this.longPressedTime=400,this.doubleClickTime=t.config.doubleClickTime,this._props={curPick:null,lastPick:null,inters:[],clickCount:0},this._mouseDownFun=this.mouseDown.bind(this),this._mouseMoveFun=this.mouseMove.bind(this),this._mouseUpFun=this.mouseUp.bind(this),this.addEvents()}addEvents(){var t=this,e=t.map.view.domElement;e.addEventListener("mousedown",t._mouseDownFun),e.addEventListener("mousemove",t._mouseMoveFun),e.addEventListener("mouseup",t._mouseUpFun),e.addEventListener("touchstart",t._mouseDownFun),e.addEventListener("touchmove",t._mouseMoveFun),e.addEventListener("touchend",t._mouseUpFun)}dispose(){var t=this,e=t.map.view.domElement;e.removeEventListener("mousedown",t._mouseDownFun),e.removeEventListener("mousemove",t._mouseMoveFun),e.removeEventListener("mouseup",t._mouseUpFun),e.removeEventListener("touchstart",t._mouseDownFun),e.removeEventListener("touchmove",t._mouseMoveFun),e.removeEventListener("touchend",t._mouseUpFun)}getObjects(){if(null===this.objects)return null;var t=[];if(this.nodes&&this.nodes.length&&[].concat(this.nodes).forEach(e=>{e.visible&&e.pickabled&&(t.push(e.entity),e.children.forEach(e=>{!1!==e.data.pickabled&&t.push(e.entity)}))}),this.objects=Array.isArray(this.objects)?this.objects:[].concat(this.objects),this.objects&&this.objects.length&&this.objects.forEach(e=>{t.push(e),Array.prototype.push.apply(t,e.children)}),t.length)return t;var e=this.map.mapEventHandlerManager.entities.filter(t=>{if(t.node&&t.node.data)return!1!==t.node.data.pickabled});return e}intersect(t){var e;this.map.view.currentCamera.update,this.raycaster.setFromCamera(this._props.curPick,this.map.view.currentCamera),e=t||this.getObjects(),this._props.inters.length=0;var i=this.raycaster.intersectObject(eu.plane);return e&&e.length&&(this._props.inters=this.raycaster.intersectObjects(e,!0)),this._props.inters=this._props.inters.concat(i),this._props.inters}mouseDown(t){this.enabled&&(this._isMouseDown=!0,this._props.curPick=kh.getMouse(t,this.map),this._props.lastPick=this._props.curPick.clone(),clearTimeout(this._props.doubleClickID),this.intersect(),this._emitEvent(t,"startPick",!0,!0),this._timeoutID=setTimeout(()=>{this._props.emitLongPressed=!0,this._emitEvent(t,"longPressed")},this.longPressedTime),t.preventDefault())}_isVisible(t){var e=t.entity.visible;if(e)for(var i=t.entity;i.parent;){if(!i.parent.visible)return!1;i=i.parent}return t.checkVisible?t.checkVisible()&&e:e}_checkNode(t){if(t){if("pickerPlane"===t.name)return!0;if("SpriteMarkerNode"===t.type&&!kh.checkSpriteInView(this.map.view,t))return!1}return!!(t instanceof nl&&t.enabled&&t.pickabled&&t.entity&&t.entity.parent&&this._isVisible(t))}getMyFather(t){if(t.parent)return t.parent.node?t.parent.node:this.getMyFather(t.parent)}_getEntityNode(t){if(this.map.config.mergeSameTypeBlocks&&t.object.node&&"OMBlock"===t.object.node.type){var e=3*t.faceIndex,i=t.object.geometry.shareNodes;if(!i)return t.object.node;for(var n=0;n=s[0]&&e{var i=this._getObjectNode(t.object),n=this._getObjectNode(e.object);return void 0===i||void 0===n?0:n.pickIndex-i.pickIndex});for(var n=0;n.01&&clearTimeout(this._timeoutID)):this.enableMouseOver&&(clearTimeout(this._props.mousemoveID),this._props.mousemoveID=setTimeout(()=>{this._props.curPick=kh.getMouse(t,this.map),this.intersect();var e,i=null,n=null;this._props.inters.length>0&&(e=this._getInterNode(this._props.inters))&&(i=e.node),(i&&i.alwaysEmit||i!==this._props.lastOver)&&((n=this._props.lastOver)&&(this._checkNode(n)&&n.mouseleave&&n.mouseleave(t),this._emitEvent(t,"mouseleave",!0,!0)),this._props.lastOver=i,i&&(this._checkNode(i)&&i.mouseenter&&i.mouseenter(t),this._emitEvent(t,"mouseenter",!0,!0)))},this.map.config.mouseOverTime||300)),t.preventDefault())}_emitEvent(t,e,i=!0,n=!1){var r=null;if(this._props.curPick&&this._props.lastPick&&(n||(0==t.button||t.touches&&1===t.touches.length||t.changedTouches&&1===t.changedTouches.length)&&this._props.curPick.distanceTo(this._props.lastPick)<.01)){var a=this._props.inters;a.length>0&&((r=this._getInterNode(a,t))&&r.node&&(r.node.data.scripts&&r.node.data.scripts.length&&r.node.invokeScript(e,r,t),r.node[e]&&r.node[e](r,t)),i||this.map.emit(e,r,t)),i&&this.map.emit(e,r,t)}}mouseUp(t){t.__hasEmit||(this._emitEvent(t,"endPick",!1,!0),this.enabled&&this._props.curPick&&(this._isMouseDown=!1,clearTimeout(this._timeoutID),t.touches||t.changedTouches||(this._props.curPick=kh.getMouse(t,this.map)),this._props.clickCount++,this._props.doubleClickID=setTimeout(()=>{this._props.clickCount=0,this._props.emitLongPressed||this._emitEvent(t,"picked"),this._props.curPick=null},this.doubleClickTime),2===this._props.clickCount&&(this._emitEvent(t,"doubleClick"),this._props.clickCount=0,clearTimeout(this._props.doubleClickID),this._props.curPick=null),this._props.emitLongPressed=!1,t.preventDefault()))}}eu.plane=new Qe(new Ne(2e6,2e6,1,1),new Ke({visible:!1})),eu.plane.node=eu.plane,eu.plane.name="pickerPlane";class iu{constructor(t){this.map=t,this.raycaster=new Vs,this.raycaster.linePrecision=1,this.map.sceneManager.default.add(iu.plane),this.clickCount=0,this.isMouseDown=!1,this.isTracking=!1,this.isAbort=!1,this.snapSystem=null,this.tracker=null,this._mouseDownFun=this._mouseDown.bind(this),this._mouseMoveFun=this._mouseMove.bind(this),this._mouseUpFun=this._mouseUp.bind(this),this.onStart=null,this.onStop=null,this.addEvents()}addEvents(){var t=this,e=t.map.view.domElement;e.addEventListener("mousedown",t._mouseDownFun),document.addEventListener("mousemove",t._mouseMoveFun),document.addEventListener("mouseup",t._mouseUpFun),e.addEventListener("touchstart",t._mouseDownFun),document.addEventListener("touchmove",t._mouseMoveFun),document.addEventListener("touchend",t._mouseUpFun)}dispose(){this.stopTrack();var t=this,e=t.map.view.domElement;e.removeEventListener("mousedown",t._mouseDownFun),document.removeEventListener("mousemove",t._mouseMoveFun),document.removeEventListener("mouseup",t._mouseUpFun),e.removeEventListener("touchstart",t._mouseDownFun),document.removeEventListener("touchmove",t._mouseMoveFun),document.removeEventListener("touchend",t._mouseUpFun)}invokeTracker(t,e,i){if(e&&(e.preventDefault(),e.stopPropagation()),this.tracker&&this.tracker[t]){var n,r={};r.event=e||{},r.isMouseDown=this.isMouseDown,r.clickCount=this.clickCount,i&&(r.intersect=i,r.point=i.point,r.trackerIntersect=i.trackerIntersect);var a=!1;return["mouseabort","complete"].indexOf(t)<0&&(n=this.tracker[t](r),a=!0),this.tracker&&this.tracker.callbacks&&this.tracker.callbacks[t]&&this.tracker.callbacks[t].call(this.tracker,r,n),a||(n=this.tracker[t](r)),n}}getPick(t){var e=this.currentPick;t instanceof MouseEvent||(e=t),this.raycaster.setFromCamera(e,this.map.view.currentCamera);var i=this.raycaster.intersectObject(iu.plane,!1),n=null,r=this.tracker.entities||(this.tracker.entity?[this.tracker.entity]:null);if(this.tracker&&r&&(n=this.raycaster.intersectObjects(r,!0)),i.length){var a=i[0];return n&&n.length&&(a.trackerIntersect=n[0]),i[0]}return null}updatePlaneHeight(t){t=void 0!==t?t:this.tracker&&this.tracker.entity?this.tracker.entity.position.z:0,iu.plane.position.z=t,iu.plane.updateMatrixWorld()}_mouseDown(t){if(this.isTracking){if(2===t.button)return this.invokeTracker("mouseabort",t),this.isAbort=!0,void this.stopTrack(t);this.isMouseDown=!0,this._lastPick=kh.getMouse(t,this.map),this.currentPick=this._lastPick.clone();var e=this._getInter(t);this.snapSystem&&this.snapSystem.snapPoint&&(e.point=this.snapSystem.snapPoint);var i=this.invokeTracker("mousedown",t,e);i&&this.snapSystem&&this.snapSystem.points.push(i.point),t.preventDefault()}}_mouseMove(t){if(this.isTracking){this.currentPick=kh.getMouse(t,this.map);var e=this._getInter(t);this.snapSystem&&this.snapSystem.getSnap(e.point),this.invokeTracker("mousemove",t,e),t.preventDefault()}}_mouseUp(t){if(this.isTracking){if(this.currentPick.distanceTo(this._lastPick)<(this.tracker.moveDistance||.01)){this.isMouseDown=!1,this.clickCount++;var e=this._getInter(t);this.snapSystem&&this.snapSystem.snapPoint&&(e.point=this.snapSystem.snapPoint);var i=this.invokeTracker("mouseup",t,e);i&&this.snapSystem&&this.snapSystem.points.push(i.point)}t.preventDefault()}}_getInter(t){var e=this.getPick(t);return e&&(this.point=e.point),e}startTrack(t,e,i,n){"function"==typeof e&&(n=i,i=e,e=null),this.isAbort=!1,this.onStart&&this.onStart(),this.snapSystem&&this.snapSystem.init(),this.tracker=t,t.tracker=this,this.tracker.map=this.map,t.stopCallback=i,t.callbacks=n,t.init&&t.init(this,e),n&&n.init&&n.init.call(this,e),this.isTracking=!0,iu.plane.visible=!0}stopTrack(t){this.isTracking&&(this.isTracking=!1,this.onStop&&this.onStop(),this.snapSystem&&this.snapSystem.complete(),this.clickCount=0,this.tracker&&this.tracker.complete&&this.tracker.complete(),this.tracker.stopCallback&&(this.tracker.stopCallback(this.tracker),delete this.tracker.stopCallback),this.tracker=null,this.updatePlaneHeight(0),iu.plane.visible=!1)}}iu.plane=new Qe(new Ne(2e6,2e6,1,1),new Ke({visible:!1}));var nu=function(t){ao.call(this,t),this._parser=nu.parse};nu.prototype=Object.create(ao.prototype),nu.prototype.constructor=nu,nu.parse=function(t,e){var i={mipmaps:[],width:0,height:0,format:null,mipmapCount:1};function n(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}function r(t,e,i,n){for(var r=i*n*4,a=new Uint8Array(t,e,r),o=new Uint8Array(r),s=0,h=0,l=0;l>1,1),v=Math.max(v>>1,1)}return i};var ru=function(){function t(t){this.manager=void 0!==t?t:eo,this.dracoLoader=null,this.ddsLoader=null}function e(){var t={};return{get:function(e){return t[e]},add:function(e,i){t[e]=i},remove:function(e){delete t[e]},removeAll:function(){t={}}}}t.prototype={constructor:t,crossOrigin:"anonymous",load:function(t,e,i,n){var r,a=this;r=void 0!==this.resourcePath?this.resourcePath:void 0!==this.path?this.path:Xo.extractUrlBase(t),a.manager.itemStart(t);var o=function(e){n&&n(e),a.manager.itemError(t),a.manager.itemEnd(t)},s=new no(a.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),"use-credentials"===a.crossOrigin&&s.setWithCredentials(!0),s.load(t,function(i){a.parse(i,r,function(i){e(i),a.manager.itemEnd(t)},o)},i,o)},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this},setDRACOLoader:function(t){return this.dracoLoader=t,this},setDDSLoader:function(t){return this.ddsLoader=t,this},parse:function(t,e,s,h){var p,f={};if("string"==typeof t)p=t;else if(Xo.decodeText(new Uint8Array(t,0,4))===o){try{f[i.KHR_BINARY_GLTF]=new l(t)}catch(t){return void(h&&h(t))}p=f[i.KHR_BINARY_GLTF].content}else p=Xo.decodeText(new Uint8Array(t));var m=JSON.parse(p);if(void 0===m.asset||m.asset.version[0]<2)h&&h(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported. Use LegacyGLTFLoader instead."));else{if(m.extensionsUsed)for(var g=0;g",o).replace("#include ",s).replace("#include ",h).replace("#include ",l).replace("#include ",c);delete a.roughness,delete a.metalness,delete a.roughnessMap,delete a.metalnessMap,a.specular={value:(new Qt).setHex(1118481)},a.glossiness={value:.5},a.specularMap={value:null},a.glossinessMap={value:null},t.vertexShader=r.vertexShader,t.fragmentShader=u,t.uniforms=a,t.defines={STANDARD:""},t.color=new Qt(1,1,1),t.opacity=1;var d=[];if(Array.isArray(n.diffuseFactor)){var p=n.diffuseFactor;t.color.fromArray(p),t.opacity=p[3]}if(void 0!==n.diffuseTexture&&d.push(i.assignTexture(t,"map",n.diffuseTexture)),t.emissive=new Qt(0,0,0),t.glossiness=void 0!==n.glossinessFactor?n.glossinessFactor:1,t.specular=new Qt(1,1,1),Array.isArray(n.specularFactor)&&t.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var f=n.specularGlossinessTexture;d.push(i.assignTexture(t,"glossinessMap",f)),d.push(i.assignTexture(t,"specularMap",f))}return Promise.all(d)},createMaterial:function(t){var e=new Ye({defines:t.defines,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,fog:!0,lights:!0,opacity:t.opacity,transparent:t.transparent});return e.isGLTFSpecularGlossinessMaterial=!0,e.color=t.color,e.map=void 0===t.map?null:t.map,e.lightMap=null,e.lightMapIntensity=1,e.aoMap=void 0===t.aoMap?null:t.aoMap,e.aoMapIntensity=1,e.emissive=t.emissive,e.emissiveIntensity=1,e.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,e.bumpMap=void 0===t.bumpMap?null:t.bumpMap,e.bumpScale=1,e.normalMap=void 0===t.normalMap?null:t.normalMap,t.normalScale&&(e.normalScale=t.normalScale),e.displacementMap=null,e.displacementScale=1,e.displacementBias=0,e.specularMap=void 0===t.specularMap?null:t.specularMap,e.specular=t.specular,e.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,e.glossiness=t.glossiness,e.alphaMap=null,e.envMap=void 0===t.envMap?null:t.envMap,e.envMapIntensity=1,e.refractionRatio=.98,e.extensions.derivatives=!0,e},cloneMaterial:function(t){var e=t.clone();e.isGLTFSpecularGlossinessMaterial=!0;for(var i=this.specularGlossinessParams,n=0,r=i.length;n=2&&(n[a++]=t.getY(r)),i>=3&&(n[a++]=t.getZ(r)),i>=4&&(n[a++]=t.getW(r));return new ve(n,i,t.normalized)}return t.clone()}function W(t,i,n){this.json=t||{},this.extensions=i||{},this.options=n||{},this.cache=new e,this.primitiveCache={},this.textureLoader=new lo(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new no(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function X(t,e,i){var n=e.attributes,r=[];function a(e,n){return i.getDependency("accessor",e).then(function(e){t.addAttribute(n,e)})}for(var o in n){var s=T[o]||o.toLowerCase();s in t.attributes||r.push(a(n[o],s))}if(void 0!==e.indices&&!t.index){var h=i.getDependency("accessor",e.indices).then(function(e){t.setIndex(e)});r.push(h)}return k(t,e),Promise.all(r).then(function(){return void 0!==e.targets?function(t,e,i){for(var n=!1,r=!1,a=0,o=e.length;at).catch(t=>{}),o=this.getDependencies("animation").then(t=>t).catch(t=>{}),s=this.getDependencies("camera").then(t=>t).catch(t=>{});Promise.all([a,o,s]).then(function(e){var a={scene:e[0][n.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:n.asset,parser:i,userData:{}};N(r,a,n),k(a,n),t(a)}).catch(e)},W.prototype.markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[],n={},r={},a=0,o=e.length;a=2&&r.setY(T,w[M*o+1]),o>=3&&r.setZ(T,w[M*o+2]),o>=4&&r.setW(T,w[M*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return r})},W.prototype.loadTexture=function(t){var e=this,n=this.json;this.options;var r,a=this.textureLoader,o=n.textures[t],s=o.extensions||{},h=(r=s[i.MSFT_TEXTURE_DDS]?n.images[s[i.MSFT_TEXTURE_DDS].source]:n.images[o.source]).uri;return void 0!==r.bufferView&&(h=e.getDependency("bufferView",r.bufferView).then(function(t){return h="data:image/png;base64,"+wx.arrayBufferToBase64(t)})),Promise.resolve(h).then(function(t){var n=ls.Handlers.get(t);return n||(n=s[i.MSFT_TEXTURE_DDS]?e.extensions[i.MSFT_TEXTURE_DDS].ddsLoader:a),new Promise(function(e,i){n.load(t,e,void 0,i)})}).then(function(t){t.flipY=!1,void 0!==o.name&&(t.name=o.name),r.mimeType in I&&(t.format=I[r.mimeType]);var e=(n.samplers||{})[o.sampler]||{};return t.magFilter=M[e.magFilter]||H,t.minFilter=M[e.minFilter]||void 0,t.wrapS=S[e.wrapS]||F,t.wrapT=S[e.wrapT]||F,t})},W.prototype.assignTexture=function(t,e,n){var r=this,a=this.getDependency("texture",n.index);if("then"in a)return a.then(function(a){if(!a.isCompressedTexture)switch(e){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":a.format=tt}if(r.extensions[i.KHR_TEXTURE_TRANSFORM]){var o=void 0!==n.extensions?n.extensions[i.KHR_TEXTURE_TRANSFORM]:void 0;o&&(a=r.extensions[i.KHR_TEXTURE_TRANSFORM].extendTexture(a,o))}t[e]=a})},W.prototype.assignFinalMaterial=function(t){var e=t.geometry,n=t.material,r=this.extensions,a=void 0!==e.attributes.tangent,o=void 0!==e.attributes.color,s=void 0===e.attributes.normal,h=!0===t.isSkinnedMesh,l=Object.keys(e.morphAttributes).length>0,c=l&&void 0!==e.morphAttributes.normal;if(t.isPoints){var u="PointsMaterial:"+n.uuid,d=this.cache.get(u);d||(d=new hr,qe.prototype.copy.call(d,n),d.color.copy(n.color),d.map=n.map,d.lights=!1,d.sizeAttenuation=!1,this.cache.add(u,d)),n=d}else if(t.isLine){u="LineBasicMaterial:"+n.uuid;var p=this.cache.get(u);p||(p=new rr,qe.prototype.copy.call(p,n),p.color.copy(n.color),p.lights=!1,this.cache.add(u,p)),n=p}if(a||o||s||h||l){u="ClonedMaterial:"+n.uuid+":",n.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),h&&(u+="skinning:"),a&&(u+="vertex-tangents:"),o&&(u+="vertex-colors:"),s&&(u+="flat-shading:"),l&&(u+="morph-targets:"),c&&(u+="morph-normals:");var f=this.cache.get(u);f||(f=n.isGLTFSpecularGlossinessMaterial?r[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].cloneMaterial(n):n.clone(),h&&(f.skinning=!0),a&&(f.vertexTangents=!0),o&&(f.vertexColors=2),s&&(f.flatShading=!0),l&&(f.morphTargets=!0),c&&(f.morphNormals=!0),this.cache.add(u,f)),n=f}n.aoMap&&void 0===e.attributes.uv2&&void 0!==e.attributes.uv&&e.addAttribute("uv2",new ve(e.attributes.uv.array,2)),n.isGLTFSpecularGlossinessMaterial&&(t.onBeforeRender=r[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].refreshUniforms),t.material=n},W.prototype.loadMaterial=function(t){var e,n=this,r=this.json,a=this.extensions,o=r.materials[t],s={},h=o.extensions||{},l=[];if(h[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var c=a[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];e=c.getMaterialType(),l.push(c.extendParams(s,o,n))}else if(h[i.KHR_MATERIALS_UNLIT]){var u=a[i.KHR_MATERIALS_UNLIT];e=u.getMaterialType(),l.push(u.extendParams(s,o,n))}else{e=Pa;var d=o.pbrMetallicRoughness||{};if(s.color=new Qt(1,1,1),s.opacity=1,Array.isArray(d.baseColorFactor)){var p=d.baseColorFactor;s.color.fromArray(p),s.opacity=p[3]}void 0!==d.baseColorTexture&&l.push(n.assignTexture(s,"map",d.baseColorTexture)),s.metalness=void 0!==d.metallicFactor?d.metallicFactor:1,s.roughness=void 0!==d.roughnessFactor?d.roughnessFactor:1,void 0!==d.metallicRoughnessTexture&&(l.push(n.assignTexture(s,"metalnessMap",d.metallicRoughnessTexture)),l.push(n.assignTexture(s,"roughnessMap",d.metallicRoughnessTexture)))}!0===o.doubleSided&&(s.side=2);var f=o.alphaMode||P;return f===D?s.transparent=!0:(s.transparent=!1,f===E&&(s.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&e!==Ke&&(l.push(n.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new St(1,1),void 0!==o.normalTexture.scale&&s.normalScale.set(o.normalTexture.scale,o.normalTexture.scale)),void 0!==o.occlusionTexture&&e!==Ke&&(l.push(n.assignTexture(s,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(s.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&e!==Ke&&(s.emissive=(new Qt).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&e!==Ke&&l.push(n.assignTexture(s,"emissiveMap",o.emissiveTexture)),Promise.all(l).then(function(){var t;return t=e===Ye?a[i.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new e(s),void 0!==o.name&&(t.name=o.name),t.map&&(t.map.encoding=bt),t.emissiveMap&&(t.emissiveMap.encoding=bt),t.specularMap&&(t.specularMap.encoding=bt),k(t,o),o.extensions&&N(a,t,o),t})},W.prototype.loadGeometries=function(t){var e=this,n=this.extensions,r=this.primitiveCache;function a(t){return n[i.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then(function(i){return X(i,t,e)})}for(var o=[],s=0,h=t.length;s0&&z(l,i),l.name=i.name||"mesh_"+t,a.length>1&&(l.name+="_"+s),k(l,i),e.assignFinalMaterial(l),o.push(l)}if(1===o.length)return o[0];var p=new Dn;for(s=0,h=o.length;s1){var i=s[h.mesh]++;(e=t.clone()).name+="_instance_"+i,e.onBeforeRender=t.onBeforeRender;for(var n=0,r=e.children.length;n1?new Dn:1===t.length?t[0]:new de)!==t[0])for(var i=0,n=t.length;i{}).catch(t=>{});s.push(c)}return Promise.all(s).then(function(){return a})}}(),t}();class au{constructor(t){this.map=t,this.isLoading=!1,this.queue=[],this.userQueue=!0,this.modelCache={},this.loader=new ru,this.off=t.on(["reset","clear-cache"],()=>{this.clearQueue(),this.clearCache()})}clearQueue(){this.queue.length=0}clearCache(){this.modelCache={}}preProcess(t){}onLoaded(t,e){this.isLoading=!1,e&&e(t),this.queue.length&&this.queue.splice(0,10).forEach(t=>{this.load(t.url,t.loaded,t.progress,t.error)})}load(t,e,i,n){var r=t.split("?")[0],a=this.modelCache[r];if(!a||a.isSkinnedMesh)this.modelCache[r]=[];else{if(Array.isArray(a))return void a.push({url:t,loaded:e,progress:i,error:n});var o=a,s=o.scene;if(!o.isSkinnedMesh){var h=s.clone();return o.scene=h,void this.onLoaded(o,e)}}this.isLoading=!0,this.loader.load(t,t=>{t.scene.rotateX(Math.PI/2),t.animations.length&&(t.actions={},t.animations.forEach((e,i)=>{var n=this.map.mixer.clipAction(e,t.scene);n.name=e.name,t.actions[e.name||"anim"+i]=n}));var i=!1;t.scene.traverse(t=>{i||"SkinnedMesh"==t.type&&(i=!0)}),t.isSkinnedMesh=i;var n=this.modelCache[r];this.modelCache[r]=t,this.onLoaded(t,e),t.isSkinnedMesh?Array.isArray(n)&&n.forEach(t=>{this.load(t.url,t.loaded,t.progress,t.error)}):(Array.isArray(n)&&n.forEach(e=>{t.scene=t.scene.clone(),this.onLoaded(t,e.loaded)}),this.map.emit("modelLoaded",t))},function(t){var e=t.loaded/t.total;i&&i(e)})}loadByID(t,e,i,n,r,a){var o=kh.getResourceUrl(this.map,t,e,!1,this.map.config.modelPath,a);this.load(o,i,n,r)}dispose(){this.clearCache(),this.clearQueue(),this.off()}}var ou={floorNumber:0,floorName:"",height:0,models:[],markers:[],blocks:[],route:null,userData:"",tag:""};class su extends ol{constructor(t,e,i){super(t,e=e||kh.cloneJSON(ou),new de),this.data.node=this,this.map=t,this.type="OMFloor",this.nodeIndex=i,this.modelNode=new gl(t,"group"),this.modelNode.data.children=this.data.models,new sl(t).bind(this),this.blockNode=new al(t),this.blockNode.data.children=this.data.blocks,this.route=new Ul(t),this.add(this.modelNode,this.route,this.blockNode),this.initByData(e),this._isFadeOut=!1,this.isLocated=!1,this.floorBlocks=[],this.offFocusFloor=this.map.on("viewFloors",(t,e)=>{if(this.nodeIndex.buildingID!==e.data.buildingID)return void(this.map.config.onlyShowFocusBuildingMarkers&&(this.markerNode.background=!0));let i=t.findIndex(t=>t.floorNumber===this.floorNumber)>-1;this.markerNode.background=!i})}get name(){return this.data.floorName}getData(){return super.getData()}get floorNumber(){return this.data.floorNumber}createFloor(){Xc(this.map).modelsCreator.create(this),Xc(this.map).markersCreator.create(this),Xc(this.map).blocksCreator.create(this),this.createRoute()}createRoute(){Xc(this.map).routeCreator.create(this)}updateRouteLineScaleFactor(){this.route.lineNodes.forEach(t=>{t.updateFactorZ()})}initByData(t){this.position.z=this.data.height||0,this.createRoute()}findData(t,e){var prom=new Nh,i=super.findData(t,e);return prom.resolve(i),prom}setAlpha(t,e=600){this._alphaAnim&&this._alphaAnim.stop();var i=kh.collectMaterials(this,t=>{if(t.node&&"SpriteMarkerNode"===t.node.type&&!t.node._markerShow)return!0}),n=[];i.forEach(e=>{"_originAlpha"in e||(e._originAlpha=e.opacity),e.transparent||(e.transparent=!0),n.push({start:e.opacity,cha:(null!==t?t:e._originAlpha)-e.opacity})}),this._alphaAnim=new wh.Tween({x:0}).to({x:1},e).easing(wh.Easing.Cubic.Out).onUpdate(t=>{i.forEach((e,i)=>{e.opacity=n[i].start+n[i].cha*t})}).onComplete(()=>{n.length=0}).start()}getHeight(){return this.entity.updateMatrix(),this.entity.position.z}updateBoundingSphereCenter(){var t=this.data,e=this.getHeight();t.models.forEach(t=>{t.node&&t.node.data&&t.node.data.boundingSphere?t.node.entity.getWorldPosition(t.boundingSphere.center):t.boundingSphere&&(t.boundingSphere.center.z=e)}),t.blocks.forEach(t=>{t.node&&t.node.data&&t.node.data.boundingSphere?t.node.entity.getWorldPosition(t.boundingSphere.center):t.boundingSphere&&(t.boundingSphere.center.z=e)}),t.markers.forEach(t=>{if(t.content||t.anchor)t.node&&t.node.entity?t.node.entity.getWorldPosition(t.point):t.point&&(t.point.z=e);else{if(!t.boundingSphere)return;t.node&&t.node.entity?t.node.entity.getWorldPosition(t.boundingSphere.center):t.boundingSphere.center.z=e}})}fadeOut(t){this._isFadeOut||(this._isFadeOut=!0,t=t||{},this.setAlpha(this.map.config.fadeOutAlpha,t.duration),this.setFloorRenderOrder(!1))}fadeIn(t){this._isFadeOut&&(this._isFadeOut=!1,t=t||{},this.setAlpha(null,t.duration),this.setFloorRenderOrder(!0))}setFloorRenderOrder(t){var e=t?0:1;this.blockNode.children.forEach(t=>{t.entity.renderOrder=e}),this.floorBlocks.forEach(t=>{})}dispose(){super.dispose(),this.offFocusFloor()}}var hu={name:"",buildingID:"",buildingType:0,buildingInfo:"",indoorLevel:0,models:[],blocks:[],markers:[],floors:[],focus:1,viewFloors:[1],userData:"",tag:"",hasOutdoor:!1,entranceFloors:[]};class lu extends ol{constructor(t,e,i){(e=e||kh.cloneJSON(hu)).buildingID&&!t.config.forceNewID||(e.buildingID=kh.generateID(16,"b"));var n=new de;n.name="building",n.visible=!1,super(t,e,n),this.data.node=this,this.map=t,this.nodeIndex=i,this.lastViewFloors=[],this._tryFloorData={},this.type="OMBuilding",this.omScene=null,this.modelNode=new gl(t,"group"),this.modelNode.data.children=this.data.models,new sl(t).bind(this),this.blockNode=new al(t),this.blockNode.data.children=this.data.blocks,this.floorNode=new al(t),this.floorNode.name="floorNode",this.floorNode.visible=!1,this.add(this.modelNode,this.blockNode,this.floorNode),this.currentFocus=[],this.data.floors.sort((t,e)=>t.floorNumber-e.floorNumber);let r=this.map.config.focusBuildingID;r&&r!==this.data.buildingID||(this.data.viewFloors=[].concat(this.map.config.viewFloors||this.data.viewFloors)),this._floorLoaded={},this.map.once("update",()=>{this.isIndoor&&this.setViewFloorsByConfig()}),this.hideNodes(),this.isIndoor=null}get buildingID(){return this.data.buildingID}setViewFloorsByConfig(){var t=this.map.config.viewFloors||this.data.viewFloors;null!=t&&(Array.isArray(t)||"object"!=typeof t||(t=t[this.data.buildingID]),t&&this.isInView&&(this.map.config.focusBuildingID&&this.map.config.focusBuildingID!==this.data.buildingID||this.focusFloors(this.map.config.focusFloors||this.data.focus,{duration:0,animate:!1})))}setTransform(){if(this.nodeIndex){var t=this.nodeIndex.transform;this.position=t.position,this.entity.rotation.fromArray(t.rotation),this.entity.scale.fromArray(t.scale)}}createBuilding(){Xc(this.map).modelsCreator.create(this),Xc(this.map).blocksCreator.create(this)}getData(){var t=super.getData();return t.floors=this.floorNode.children.map(t=>{var e=kh.getBoundingSphere(t.entity);return t.nodeIndex.radius=e.radius,t.nodeIndex}),t}getOMScene(){for(var t=this;t.parent;){if("OMScene"===t.type)return t;t=t.parent}}remove(){var t=this;t.parent&&t.parent.remove(t,!1),t.omScene&&kh.findFromArray(t.omScene.data.buildings,"buildingID",t.data.buildingID,(e,i)=>{t.omScene.data.buildings.splice(i,1)})}addFloor(t){this.floorNode.add(t);var e=t.nodeIndex||this.getFloorIndex(t);e||(e={id:kh.generateID().toLowerCase(),floorNumber:t.data.floorNumber,floorName:t.data.floorName,userData:{}},this.data.floors.push(e)),t.nodeIndex=e,t.building=this}removeFloor(t){this.floorNode.remove(t,!1),delete t.building,kh.findFromArray(this.data.floors,"floorNumber",t.getProp("floorNumber"),(t,e)=>{this.data.floors.splice(e,1)})}get isInView(){return this.map.visibleManager._buildings.find(t=>t.building===this)}viewFloors(t,e){e=Object.assign({floorSpace:this.map.config.floorSpace,duration:0},e),null!=t&&"all"!==t||(t=this.data.floors.map(t=>t.floorNumber));for(var i=(t=[].concat(t)).length-1;i>-1;i--){var n=t[i],r=this.data.floors.findIndex(t=>t.floorNumber===n);r<0&&t.splice(i,1)}return this.data.viewFloors=t,this.data.viewFloors.sort((t,e)=>t-e),this.locateFloors(e).then((t,e)=>Nh.empty(t,this))}focusFloors(t,e){e=e||{},t=[].concat(t);var prom=new Nh,i=null,n=this.data.viewFloors;1===n.length?i=t:n.length>1&&(i=n.slice(),t.forEach(t=>{i.indexOf(t)<0&&i.push(t)}));var r="2d"===this.map.view.viewMode;this.data.focus=t;var a=[];return this.viewFloors(i,e).then(i=>{var n=i.floors,o=i.heights,s=0;if(1===t.length&&t[0]===this.currentFocus[0])return this.map.emit("focusFloors",t,this,n),e.callback&&e.callback(n),setTimeout(()=>{prom.resolve(n)},0),prom;this.currentFocus=t,n.forEach((e,i)=>{t.indexOf(e.data.floorNumber)>-1?(this.map.config.enableFloorAlpha&&e.fadeIn(),e.setFloorRenderOrder(!0),a.push(e),s+=o[i]):(this.map.config.enableFloorAlpha&&e.fadeOut(),e.setFloorRenderOrder(!1))}),s/=t.length;var h=this.map.view.controls.target.clone();h.z=s,this.map.view.moveTo({viewCenter:h,easing:e.easing||"cubicOut",zoom:e.zoom,viewAngle:e.viewAngle,polarAngle:e.polarAngle,duration:r?0:void 0===e.duration?800:e.duration,isImportant:!0,callback:()=>{e.callback&&e.callback(),this.map.emit("focusFloors",t,this,a),setTimeout(()=>{this.map.emit("viewChanged"),this.map.config.floorSpace<.05&&this.map.emit("viewChanged")},0),prom.resolve(a)}})}),prom}toIndoor(t){let prom=new Nh;if(this.isIndoor||this._showAnim)return Nh.empty(this);-1===this.map.visibleManager.focusBuildings.indexOf(this.data)&&this.map.visibleManager.focusBuildings.push(this.data),t=Object.assign({duration:600},t);var e=this;t.noEvent||e.map.config.autoInOutdoor||(e.map.visibleManager._lastFocusBuilding=e,e.map.emit("focusBuilding",e));var i=null===this.isIndoor?0:t.duration/2;return this.isIndoor=!0,e.firstTimeToIndoor||(e.locateFloors({duration:0,emitViewFloorEvent:!1}),e.firstTimeToIndoor=!0),e.showNodesAnimate(!1,{duration:i,nodes:[e.modelNode,e.blockNode],callback:function(){e.showNodesAnimate(!0,{duration:i,animateAlpha:!1,nodes:[e.floorNode],callback:function(){e.map.emit("viewChanged"),e.map.emit("door",!0,e),prom.resolve(e)}})}}),prom}toOutdoor(t){if(!0!==this.data.hasOutdoor)return;let prom=new Nh;if(!1===this.isIndoor||this._showAnim)return Nh.empty(this);var e=this,i=this.map.visibleManager.focusBuildings.indexOf(this.data);return-1!==i&&this.map.visibleManager.focusBuildings.splice(i,1),t=Object.assign({duration:1e3},t),this.isIndoor=!1,t.noEvent||e.map.config.autoInOutdoor||e.map.visibleManager._lastFocusBuilding!==e||(e.map.visibleManager._lastFocusBuilding=null,e.map.emit("focusBuilding",null)),e.showNodesAnimate(!1,{animateAlpha:!1,nodes:[e.floorNode],duration:t.duration/2,callback:function(){e.showNodesAnimate(!0,{duration:t.duration/2,nodes:[e.modelNode,e.blockNode],callback:function(){e.map.emit("viewChanged"),e.map.emit("door",!1,e),prom.resolve(e)}})}}),prom}locateFloors(t){var e=this;function i(t){t.updateBoundingSphereCenter(),e.map.emit("viewChanged"),e.map.emit("locateFloor",t,e),e.map.emit("viewFloor",t,e)}"number"==typeof t&&(t={floorSpace:t}),t=Object.assign({animate:!0,delay:88,autoDelay:!1,allDelayTime:1e3,floorSpace:this.map.config.floorSpace,compactFloorSpace:4,duration:600,easing:"backout",compact:!1,emitViewFloorEvent:!0},t),this.map.config.floorSpace=t.floorSpace;var n=[],r=[],a=[];return this.data.viewFloors.forEach((o,s)=>{var h;h=e.getFloorByFloorNumber(o).then(n=>{new Nh;let o=n.data.floorNumber;e.data.floors.findIndex(t=>t.floorNumber===o);var h=0;if(t.compact){h=(o>0?o-1:o)*t.compactFloorSpace;let i=e.currentFocus[0],n=e.currentFocus[e.currentFocus.length-1];i<0&&o<=i?h-=t.compactFloorSpace:n>0&&o>n&&(h+=t.compactFloorSpace)}else h=(o>0?o-1:o)*t.floorSpace;a.push(h);var l=t.autoDelay?t.allDelayTime/e.data.viewFloors.length:t.delay;if(t.animate){n._anim&&(n._anim.stop(),n._anim=null);var c="string"==typeof t.easing?kh.getEasingByName(t.easing):t.easing,u=new Nh;r.push(u),Math.abs(n.entity.position.z-h)<.05?(n.entity.position.z=h,setTimeout(()=>{u.resolve(n)},0)):n._anim=new wh.Tween(n.entity).delay(s*l).to({"position.z":h},t.duration).onComplete(()=>{n._anim=null,i(n),u.resolve(n)}).easing(c).start()}else n.entity.position.z=h,n.entity.updateMatrix(),e.map.update(!0),i(n);return n}),n.push(h)}),Nh.all(n).then(i=>{i.forEach(t=>{t.isLocated=!0,t.updateRouteLineScaleFactor()});try{e.map.emit("locateFloors",i,e),t.emitViewFloorEvent&&(e.lastViewFloors=i,e.map.emit("viewFloors",i,e))}catch(t){}return r.length?Nh.all(r).then(t=>(this.map.emit("viewChanged"),{floors:i,heights:a})):(this.map.emit("viewChanged"),{floors:i,heights:a})})}getFloorByFloorNumber(t,e){var prom=new Nh,i=this.data.floors.find(e=>e.floorNumber==t);if(i)if(i.node)prom.resolve(i.node),e&&e(i.node);else{if(this._floorLoaded[t])return this._floorLoaded[t].push(prom),prom;this._floorLoaded[t]=[prom],this.map.omLoader.loadFloor(this.data.buildingID,i);var n=this.map.on("floorLoaded",t=>{t.data.floorNumber===i.floorNumber&&t.data.buildingID===i.buildingID&&(n(),this._floorLoaded[i.floorNumber].forEach(e=>{e.resolve(t)}),e&&e(t))})}else prom.resolve(null),e&&e(null);return prom}getFloorByFloorNumberSync(t){return this.floorNode.children.find(e=>e.data.floorNumber===t)}getFloors(t){var e=[];return(t||this.data.floors.map(t=>t.floorNumber)).forEach(t=>{e.push(this.getFloorByFloorNumber(t))}),Nh.all(e)}findData(t,e){var prom=new Nh;e=Object.assign({recursive:!0,multi:!0},e);var i=[];return i.buildingID=this.data.buildingID,this.getFloors(e.floors).then(n=>{n.forEach((n,r)=>{n.findData(t,e).then(t=>{t.length&&(t.floorNumber=n.data.floorNumber,t.floorName=n.data.floorName,i.push(t))})}),prom.resolve(i)}),prom}getNodeByID(t){var prom=new Nh;return this.findData({id:t}).then(t=>{if(t.length){var e=t[0],i=e[0];i.floorNumber=e.floorNumber,i.floorName=e.floorName,prom.resolve(i)}else prom.resolve(null)}),prom}getFloorIndex(t){return t.getRootModelRadius(),kh.findFromArray(this.data.floors,"floorNumber",t.data.floorNumber,(t,e)=>t)}localPosition(t){return Array.isArray(t)&&(t=(new Lt).fromArray(t)),this.entity.worldToLocal(t.clone())}worldPosition(t){return Array.isArray(t)&&(t=(new Lt).fromArray(t)),this.entity.localToWorld(t.clone())}findPath(t,e,i){var n,prom=new Nh,r=(n=Array.isArray(t)?t:Array.from(arguments))[n.length-1],a={clearLines:!0,createLines:!0,createCrossLines:!0,isPair:!1};"object"!=typeof r||"point"in r||(a=Object.assign(a,n.pop()));var o=Object.assign({},a,{clearLines:!1});if(!(n.length<2)){if(n.length>2){this.clearRoutes();var s=[];let t=a.isPair?2:1;for(var h=0;h{i.route.findPathAsync(t.point,e.point,c).then(n=>{n.building=this,n.vectors.length?prom.resolve(n):this.tryConnectTwoFloors(t,e,i,i,c,prom)})}):this.getFloorByFloorNumber(t.floorNumber).then(n=>{this.getFloorByFloorNumber(e.floorNumber).then(r=>{let a=n.route.findLiftPair(t,e,r,i);if(!a||Object.values(a).some(t=>!t))return void this.tryConnectTwoFloors(t,e,n,r,c,prom);let o={point:a.fromLiftPoint},s={point:a.toLiftPoint};var h=n.route.findPathAsync(t.point,o.point,c),l=r.route.findPathAsync(s.point,e.point,c);Nh.all([h,l]).then(i=>{var a=o.point.clone(),h=s.point.clone();n.entity.localToWorld(a),r.entity.localToWorld(h);var l=a.z,u=h.z,d=e.floorNumber>t.floorNumber;a.z-=d?l:u,h.z-=d?l:u;var p=d?n:r;if(c.createLines&&c.createCrossLines){var f=this.createCrossLine(p,a,h);i.push({type:"crossLines",lines:[f],vectors:[a,h]})}i.building=this,i.some(t=>!t.vectors.length)?this.tryConnectTwoFloors(t,e,n,r,c,prom):prom.resolve(i)})})}),prom}}tryFloorConnect(t,e,i,n,r,a,prom){this._tryFloorData[r.floorNumber]||(this._tryFloorData[r.floorNumber]={floor:null,liftsConnection:{}}),this._tryFloorData[r.floorNumber].floor=r;let o=i.route.toPoint(t.point),s=n.route.toPoint(e.point),h=i.route.findClosestLifts(o,r.floorNumber),l=n.route.findClosestLifts(s,r.floorNumber);this._tryFloorData.fromLifts=h,this._tryFloorData.toLifts=l;let c,u,d=r.route.findClosestLifts(o,t.floorNumber,{count:void 0}),p=r.route.findClosestLifts(s,e.floorNumber,{count:void 0});if(this._tryFloorData[r.floorNumber].liftsConnection[t.floorNumber]=d,this._tryFloorData[r.floorNumber].liftsConnection[e.floorNumber]=p,!d.length||!p.length)return Nh.empty();for(var f=0;f{prom.resolve(t)})}}}return Nh.empty()}tryConnectTwoFloors(t,e,i,n,r,prom){let a=this.map.config.linkedFloors||this.nodeIndex.userData.linkedFloors;if(!a||!a.length)return void prom.resolve();let o=[];a.forEach(i=>{let n=Math.abs(t.floorNumber-i)+Math.abs(e.floorNumber-i);o.push({n:i,num:n})}),o.sort((t,e)=>t.num-e.num),o=o.map(t=>t.n),this._tryFloorData={},this.tryWork(t,e,i,n,r,o,0,prom)}tryWork(t,e,i,n,r,a,o,prom){if(o{this.tryFloorConnect(t,e,i,n,s,r,prom).then(s=>{!s||Array.isArray(s)&&s.some(t=>!t)?(o+=1,this.tryWork(t,e,i,n,r,a,o,prom)):prom.resolve(s)})});else{let a=Object.assign({},this._tryFloorData);delete a.fromLifts,delete a.toLifts;let o,l,c,u,d=Object.keys(a),p=d.filter(e=>this._tryFloorData[e].liftsConnection[t.floorNumber].length>0),f=d.filter(t=>this._tryFloorData[t].liftsConnection[e.floorNumber].length>0),m=[];for(var s=0;s-1)continue;u=this._tryFloorData[l].floor;let a=c.route.findLiftPair(t,e,u,r);if(a){let s=!1,h=i.route.findLiftPair(t,{point:a.fromLiftPoint},c,r);if(h||(h=i.route.findLiftPair(t,{point:a.toLiftPoint},u,r),s=!0),h){let i=(s?c:u).route.findLiftPair({point:s?a.fromLiftPoint:a.toLiftPoint},e,n,r);if(s){let t=a.toLiftPoint;a.toLiftPoint=a.fromLiftPoint,a.fromLiftPoint=t,t=o,o=l,l=t}if(i){let n=[t,{point:h.fromLiftPoint,floorNumber:t.floorNumber},{point:h.toLiftPoint,floorNumber:o},{point:a.fromLiftPoint,floorNumber:o},{point:a.toLiftPoint,floorNumber:l},{point:i.fromLiftPoint,floorNumber:l},{point:i.toLiftPoint,floorNumber:e.floorNumber},e,Object.assign(r,{isPair:!0})];return this.findPath(n).then(t=>{prom.resolve(t)})}}}}}prom.resolve(null)}}clearRoutes(){this.floorNode.children.forEach(t=>{t.route.clearLines()})}createCrossLine(t,e,i){return t.route.createLineNodeByPoints([e.clone(),i.clone()],{up:new Lt(0,-1,0),update:function(t){this.entity.rotation.z=this.map.view.controls.getAzimuthalAngle()}})}get entranceFloors(){let t=[],e=this.userData;return e&&e.entranceFloors&&(t=[].concat(e.entranceFloors)),this.data.entranceFloors&&this.data.entranceFloors.length&&(t=[].concat(this.data.entranceFloors)),t.length||(t=[1]),t}get connectBuildings(){if(this.userData){let t=this.userData.connectBuildings;return t?[].concat(t):null}}getEntrancePoints(){let t=this.entranceFloors.map(t=>this.getFloorByFloorNumber(t).then(t=>{if(!t)return null;let e=t.route.points.filter(t=>t.pointType>=4&&t.pointType<=6);return e.floorNumber=t.floorNumber,e.buildingPosition=this.position,e.building=this,e}));return Nh.all(t)}dispose(){this.remove(),super.dispose(),this.nodeIndex=null,this.omScene=null}}function cu(t,e){var i,n,r,a;let o=null;o=t.points.flat(),o.forEach((t,e)=>{0===e?(i=r=t[0],n=a=t[1]):(t[0]r&&(r=t[0]),t[1]a&&(a=t[1]))});var s=new Lt(i,n,0),h=new Lt(r,a,0),l=s.clone().add(h).divideScalar(2);if(e){var c=(new Lt).fromArray(e.transform.position);l.add(c)}var u=new Gt(l,s.distanceTo(h)/2);return t.boundingSphere=u,u}function uu(t,e){var i=(new Lt).fromArray(t.transform.position);e&&i.add((new Lt).fromArray(e.transform.position));var n=t.radius;return t.boundingSphere=new Gt(i,n),t.boundingSphere}function du(t,e){if(e)var i=(new Lt).fromArray(e.transform.position);kh.traverseJSON(t,{userData:(t,e)=>{t&&"string"==typeof t&&(e.userData=JSON.parse(t))},scripts:(t,e)=>{t&&(e.scripts=t.map(t=>JSON.parse(t)))},scriptCodes:(t,e)=>{t&&(e.scriptCodes=JSON.parse(t))}}),t.blocks&&t.blocks.forEach(t=>{cu(t,e),t.topImages&&t.topImages.forEach(t=>{t.content&&(t.content=JSON.parse(t.content))})}),t.models&&t.models.forEach(t=>{uu(t,e)}),t.markers&&t.markers.forEach(t=>{t.content&&"string"==typeof t.content&&(t.content=JSON.parse(t.content)),t.position?t.point=(new Lt).fromArray(t.position):t.transform&&(t.point=(new Lt).fromArray(t.transform.position)),e&&t.point&&t.point.add(i)})}function pu(t){return new Gt((new Lt).fromArray(t.transform.position),t.radius||25)}function fu(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function mu(t,e,i,n,r,a){return fu(function(t,e){return t<>>32-e}(fu(fu(e,t),fu(n,a)),r),i)}function gu(t,e,i,n,r,a,o){return mu(e&i|~e&n,t,e,r,a,o)}function vu(t,e,i,n,r,a,o){return mu(e&n|i&~n,t,e,r,a,o)}function yu(t,e,i,n,r,a,o){return mu(e^i^n,t,e,r,a,o)}function xu(t,e,i,n,r,a,o){return mu(i^(e|~n),t,e,r,a,o)}function bu(t,e){t[e>>5]|=128<>>9<<4)]=e;var i,n,r,a,o,s=1732584193,h=-271733879,l=-1732584194,c=271733878;for(i=0;i>5]>>>e%32&255);return i}function _u(t){var e,i=[];for(i[(t.length>>2)-1]=void 0,e=0;e>5]|=(255&t.charCodeAt(e/8))<>>4&15)+"0123456789abcdef".charAt(15&e);return n}function Su(t){return unescape(encodeURIComponent(t))}function Au(t){return function(t){return wu(bu(_u(t),8*t.length))}(Su(t))}function Tu(t,e){return function(t,e){var i,n,r=_u(t),a=[],o=[];for(a[15]=o[15]=void 0,r.length>16&&(r=bu(r,8*t.length)),i=0;i<16;i+=1)a[i]=909522486^r[i],o[i]=1549556828^r[i];return n=bu(a.concat(_u(e)),512+8*e.length),wu(bu(o.concat(n),640))}(Su(t),Su(e))}var Lu,Cu=function(t,e,i){return e?i?Tu(e,t):function(t,e){return Mu(Tu(t,e))}(e,t):i?Au(t):function(t){return Mu(Au(t))}(t)};function Pu(){var t=["s8oGW5RcMsW","W6NcO2JdM8ohALm","WOldHeRdQCkD","omoSW4ldGa","W6iNWRJcPG","gGejW64","chaUtMK","iCoUeCobgG","W5/cK8kMWORcKL88m8oIWQK","w8o3oLf+","FCoOaSozha","fSkGW7nBW6i","CvFdGSodlG","o8o9cSoqgW","jSo1FcebWQZdNdtdVLG","mmoxpse","WOTbWOTt","WQhcO29TtsHxpG","tCo6oG","WRLvvw3cIa","wLTNqdy","cSkKW7eYW4q","W5pcMmk8hCkp","z0ddR8kcoa","F1tdOSo2W4ddO2b/WPWwhMu","WRdcLJVdMmow","pSkRW77cVIBcMmknWPO","W5/cSJ/dSKO","WPLbWPPlW6K","t8k7amknWP0","rN0j","DurMWRGnoK5hECkz","W77dTLzpBq","bHxdTmkHnvBcV8kWW54","E8ojW7ddNSkeee8","l8oXW4i","WQv7jgZcKq","WR/cH0O","WR8bW4xdSZK","5zUVfowER8kn5z2X","W6xdIWCFcG","EKdcQSksna","lSkZWRC1vG","yYPZdfBdS8omFhjp","BWtcTCkPWPu","xYCzha","saqdc8ox","W71UkdVcGa","W6yNWRRcUCoB","nG3cN8kBESkwDSk0DJBcNq","W67dMGRcH8oaq1RdHN8S","W70HWRm","W6xdNXaYgG","zcPWcxxdPmoqAgnc","W6tcNSk6cmkc","WRtcILBdLCoG","WRO+WRZcV8oa","xSoOlfn/","vHjHWQKU","tJZcTITB","W5JdNuFdTmkT","p8oWWR45","W4xcMXFcO8oXB3/cQtVcP8kHpW","WQ1tx3/cIq","rvFcTSkfoG","W6RdNa/cHmoUB3NdJv0Y","q8oJWRiIW7ZcKhasW6tdTG","W4ZdOfP1AG","iCo1W4BdLmkI","aIVdQW","WOLbWOjxW4q","hCkKW6CYW6y","gmkNytRdQCkVvmofBCkt","WQDCzcy","WO5cEq7cUq","ecVdRmobW48","dmoVg8oObG","tCosna","ESo2W5BcJG","vedcQa","WO7cHSkxE8k7","Bf8ne8o6","amk5W6DMW44","t8kNW5xcHr4","WQDqCYxcTq","W4ZcLmkXdSkp","v3BcR8o6W4TTcCkwWQG","W4ldMSo2W5hcHa","W6u7Cc/dJ8o3WQ1EeCk7d8oZWPy","W5VdJa8joW","WPRMM5nF5z2WxW","W6VdNW/cI8k+ev3dJgyUeWC","eCoYW5/dQmkU","iCo8WRiPbW","kSo2WRu6dG","W7u6WRG","DSkLoN4P","W5xcNrBcQSoY","brtdSCogg1BcLmkcW4rD","ACkzdq","DCkwFLmI","jXNcU8opzIJcVCkMWPqowCo3","zCo+W58","oGVcTSk4","i8okpqTHW41sfSojjSoee8kw","nSomnYBcLa","h8k1W6P1W44","dIFdTSopW4u","WQNdML7dHCkN","yCoul8k4WOe","W6H/W6VcLCo8","W7HrWOFcOfO7rItcHmkjW7q"];return(Pu=function(){return t})()}wx.getSystemInfoSync().pixelRatio,Lu=ic.markerScale,function(t){function e(t,e){return Bu(t- -39,e)}for(var i=t();;)try{if(166732==parseInt(e(262,"T]Dn"))/1+-parseInt(e(296,"azuG"))/2*(-parseInt(e(216,"V6Sb"))/3)+-parseInt(e(287,"*G1c"))/4*(parseInt(e(297,"ok!8"))/5)+parseInt(e(252,"VpWB"))/6+-parseInt(e(249,"azuG"))/7*(-parseInt(e(277,"0*xv"))/8)+-parseInt(e(271,"xl@8"))/9*(-parseInt(e(294,"m!N)"))/10)+-parseInt(e(255,"w$np"))/11*(parseInt(e(280,"N&vO"))/12))break;i.push(i.shift())}catch(t){i.push(i.shift())}}(Pu);var Eu,Du,Iu,Ou,Nu,ku,zu=!0;function Ru(t,e){function i(t,e){return Bu(t-538,e)}var n=t[i(791,"MjPs")+"g"];n[i(851,"P9Ge")]?Cu(n[i(817,"JUJE")]+"&"+n[i(869,"wGJV")+i(886,"IALO")])===e?(ju[i(795,"N&vO")+i(842,"G49u")+"in"](),zu=!1):ju[i(804,"zyCi")+i(798,"qr8#")+i(827,"&X6z")]():ju[i(880,"JUJE")+i(840,"!Jg@")+i(877,"V6Sb")]()}function Bu(t,e){var i=Pu();return Bu=function(e,n){var r=i[e-=237];void 0===Bu.JVALND&&(Bu.SkxzBr=function(t,e){var i,n,r=[],a=0,o="";for(t=function(t){for(var e,i,n="",r="",a=0,o=0;i=t.charAt(o++);~i&&(e=a%4?64*e+i:i,a++%4)?n+=String.fromCharCode(255&e>>(-2*a&6)):0)i="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(i);for(var s=0,h=n.length;s{clearInterval(Iu)}),Iu=setInterval(function(){zu?(Ou=3,Uu()):clearInterval(Iu)},5e3)}function Uu(){function t(t,e){return Bu(t-629,e)}!function(){function t(t,e){return Bu(e- -620,t)}return Eu[t("ok!8",-315)][t("VpWB",-295)],Eu[t("qr8#",-302)][t("V6Sb",-375)+"t"],!0}()?Eu[t(946,"lGTc")][t(912,"Z(TJ")+"t"]-Ou<=40?(Ou=Eu[t(892,"QX$e")][t(925,"P9Ge")+"t"]-40,ju[t(911,"ok!8")+t(959,"qr8#")+t(871,"JUJE")+t(941,"zyCi")+t(876,"OBF^")+"ew"]()):(Ou+=10,setTimeout(function(){Uu()},20)):ju[t(927,"G49u")+t(915,"0*xv")+t(937,"DNnL")+t(875,")t#o")+t(938,"zyCi")+"ew"]()}var Gu,ju={_wx_utils_chu:function(){var t,e;Du[(t="Y3e]",e=939,Bu(e-669,t)+"le")]=!0},_wx_utils_in:function(){var t,e;Du[(t=16,e="J&4N",Bu(t- -249,e)+"le")]=!1},"_wx_editor_core.panorvrview":function(t,e){var i=Eu[o(1302,")t#o")][o(1268,"P9Ge")],n=Eu[o(1264,"677V")][o(1293,"J&4N")+"t"],r=t||i/2,a=e||n/2;function o(t,e){return Bu(t-996,e)}Du[o(1271,"k97v")]=Nu*Eu[o(1247,"Z(TJ")][o(1336,"T]Dn")+o(1281,")t#o")],Du[o(1320,"k97v")+"t"]=ku*Eu[o(1289,"*G1c")][o(1325,"rR*x")+o(1333,"ok!8")],Du[o(1267,"DiXT")+o(1237,")t#o")][o(1263,"&O7z")](r,1,a)}},Vu=Vu||function(t){var e=Object.create||function(){function t(){}return function(e){var i;return t.prototype=e,i=new t,t.prototype=null,i}}(),i={},n=i.lib={},r=n.Base={extend:function(t){var i=e(this);return t&&i.mixIn(t),i.hasOwnProperty("init")&&this.init!==i.init||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=n.WordArray=r.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,i=t.words,n=this.sigBytes,r=t.sigBytes;if(this.clamp(),n%4)for(var a=0;a>>2]>>>24-a%4*8&255;e[n+a>>>2]|=o<<24-(n+a)%4*8}else for(a=0;a>>2]=i[a>>>2];return this.sigBytes+=r,this},clamp:function(){var e=this.words,i=this.sigBytes;e[i>>>2]&=4294967295<<32-i%4*8,e.length=t.ceil(i/4)},clone:function(){var t=r.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var i,n=[],r=function(e){var i=987654321,n=4294967295;return function(){var r=((i=36969*(65535&i)+(i>>16)&n)<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n;return r/=4294967296,(r+=.5)*(t.random()>.5?1:-1)}},o=0;o>>2]>>>24-r%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new a.init(i,e/2)}},h=o.Latin1={stringify:function(t){for(var e=t.words,i=t.sigBytes,n=[],r=0;r>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(t){for(var e=t.length,i=[],n=0;n>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new a.init(i,e)}},l=o.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},c=n.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var i=this._data,n=i.words,r=i.sigBytes,o=this.blockSize,s=r/(4*o),h=(s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*o,l=t.min(4*h,r);if(h){for(var c=0;c>>2]>>>24-a%4*8&255)<<16|(e[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|e[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s>>6*(3-s)&63));var h=n.charAt(64);if(h)for(;r.length%4;)r.push(h);return r.join("")},parse:function(t){var i=t.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var a=0;a>>6-o%4*2;r[a>>>2]|=(s|h)<<24-a%4*8,a++}return e.create(r,a)}(t,i,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){var e=Vu,i=e.lib,n=i.WordArray,r=i.Hasher,a=e.algo,o=[];!function(){for(var e=0;e<64;e++)o[e]=4294967296*t.abs(t.sin(e+1))|0}();var s=a.MD5=r.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var i=0;i<16;i++){var n=e+i,r=t[n];t[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var a=this._hash.words,s=t[e+0],d=t[e+1],p=t[e+2],f=t[e+3],m=t[e+4],g=t[e+5],v=t[e+6],y=t[e+7],x=t[e+8],b=t[e+9],w=t[e+10],_=t[e+11],M=t[e+12],S=t[e+13],A=t[e+14],T=t[e+15],L=a[0],C=a[1],P=a[2],E=a[3];L=h(L,C,P,E,s,7,o[0]),E=h(E,L,C,P,d,12,o[1]),P=h(P,E,L,C,p,17,o[2]),C=h(C,P,E,L,f,22,o[3]),L=h(L,C,P,E,m,7,o[4]),E=h(E,L,C,P,g,12,o[5]),P=h(P,E,L,C,v,17,o[6]),C=h(C,P,E,L,y,22,o[7]),L=h(L,C,P,E,x,7,o[8]),E=h(E,L,C,P,b,12,o[9]),P=h(P,E,L,C,w,17,o[10]),C=h(C,P,E,L,_,22,o[11]),L=h(L,C,P,E,M,7,o[12]),E=h(E,L,C,P,S,12,o[13]),P=h(P,E,L,C,A,17,o[14]),L=l(L,C=h(C,P,E,L,T,22,o[15]),P,E,d,5,o[16]),E=l(E,L,C,P,v,9,o[17]),P=l(P,E,L,C,_,14,o[18]),C=l(C,P,E,L,s,20,o[19]),L=l(L,C,P,E,g,5,o[20]),E=l(E,L,C,P,w,9,o[21]),P=l(P,E,L,C,T,14,o[22]),C=l(C,P,E,L,m,20,o[23]),L=l(L,C,P,E,b,5,o[24]),E=l(E,L,C,P,A,9,o[25]),P=l(P,E,L,C,f,14,o[26]),C=l(C,P,E,L,x,20,o[27]),L=l(L,C,P,E,S,5,o[28]),E=l(E,L,C,P,p,9,o[29]),P=l(P,E,L,C,y,14,o[30]),L=c(L,C=l(C,P,E,L,M,20,o[31]),P,E,g,4,o[32]),E=c(E,L,C,P,x,11,o[33]),P=c(P,E,L,C,_,16,o[34]),C=c(C,P,E,L,A,23,o[35]),L=c(L,C,P,E,d,4,o[36]),E=c(E,L,C,P,m,11,o[37]),P=c(P,E,L,C,y,16,o[38]),C=c(C,P,E,L,w,23,o[39]),L=c(L,C,P,E,S,4,o[40]),E=c(E,L,C,P,s,11,o[41]),P=c(P,E,L,C,f,16,o[42]),C=c(C,P,E,L,v,23,o[43]),L=c(L,C,P,E,b,4,o[44]),E=c(E,L,C,P,M,11,o[45]),P=c(P,E,L,C,T,16,o[46]),L=u(L,C=c(C,P,E,L,p,23,o[47]),P,E,s,6,o[48]),E=u(E,L,C,P,y,10,o[49]),P=u(P,E,L,C,A,15,o[50]),C=u(C,P,E,L,g,21,o[51]),L=u(L,C,P,E,M,6,o[52]),E=u(E,L,C,P,f,10,o[53]),P=u(P,E,L,C,w,15,o[54]),C=u(C,P,E,L,d,21,o[55]),L=u(L,C,P,E,x,6,o[56]),E=u(E,L,C,P,T,10,o[57]),P=u(P,E,L,C,v,15,o[58]),C=u(C,P,E,L,S,21,o[59]),L=u(L,C,P,E,m,6,o[60]),E=u(E,L,C,P,_,10,o[61]),P=u(P,E,L,C,p,15,o[62]),C=u(C,P,E,L,b,21,o[63]),a[0]=a[0]+L|0,a[1]=a[1]+C|0,a[2]=a[2]+P|0,a[3]=a[3]+E|0},_doFinalize:function(){var e=this._data,i=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;i[r>>>5]|=128<<24-r%32;var a=t.floor(n/4294967296),o=n;i[15+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),i[14+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),e.sigBytes=4*(i.length+1),this._process();for(var s=this._hash,h=s.words,l=0;l<4;l++){var c=h[l];h[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return s},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function h(t,e,i,n,r,a,o){var s=t+(e&i|~e&n)+r+o;return(s<>>32-a)+e}function l(t,e,i,n,r,a,o){var s=t+(e&n|i&~n)+r+o;return(s<>>32-a)+e}function c(t,e,i,n,r,a,o){var s=t+(e^i^n)+r+o;return(s<>>32-a)+e}function u(t,e,i,n,r,a,o){var s=t+(i^(e|~n))+r+o;return(s<>>32-a)+e}e.MD5=r._createHelper(s),e.HmacMD5=r._createHmacHelper(s)}(Math),function(){var t=Vu,e=t.lib,i=e.WordArray,n=e.Hasher,r=t.algo,a=[],o=r.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var i=this._hash.words,n=i[0],r=i[1],o=i[2],s=i[3],h=i[4],l=0;l<80;l++){if(l<16)a[l]=0|t[e+l];else{var c=a[l-3]^a[l-8]^a[l-14]^a[l-16];a[l]=c<<1|c>>>31}var u=(n<<5|n>>>27)+h+a[l];u+=l<20?1518500249+(r&o|~r&s):l<40?1859775393+(r^o^s):l<60?(r&o|r&s|o&s)-1894007588:(r^o^s)-899497514,h=s,s=o,o=r<<30|r>>>2,r=n,n=u}i[0]=i[0]+n|0,i[1]=i[1]+r|0,i[2]=i[2]+o|0,i[3]=i[3]+s|0,i[4]=i[4]+h|0},_doFinalize:function(){var t=this._data,e=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(i/4294967296),e[15+(n+64>>>9<<4)]=i,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});t.SHA1=n._createHelper(o),t.HmacSHA1=n._createHmacHelper(o)}(),function(){var t=Vu,e=t.lib.Base,i=t.enc.Utf8;t.algo.HMAC=e.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=i.parse(e));var n=t.blockSize,r=4*n;e.sigBytes>r&&(e=t.finalize(e)),e.clamp();for(var a=this._oKey=e.clone(),o=this._iKey=e.clone(),s=a.words,h=o.words,l=0;l>>2];t.sigBytes-=e}};e.BlockCipher=h.extend({cfg:h.cfg.extend({mode:u,padding:d}),reset:function(){h.reset.call(this);var t=this.cfg,e=t.iv,i=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=i.createEncryptor;else n=i.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==n?this._mode.init(this,e&&e.words):(this._mode=n.call(i,this,e&&e.words),this._mode.__creator=n)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else e=this._process(!0),t.unpad(e);return e},blockSize:4});var p=e.CipherParams=i.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),f=(t.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,i=t.salt;if(i)var r=n.create([1398893684,1701076831]).concat(i).concat(e);else r=e;return r.toString(o)},parse:function(t){var e=o.parse(t),i=e.words;if(1398893684==i[0]&&1701076831==i[1]){var r=n.create(i.slice(2,4));i.splice(0,4),e.sigBytes-=16}return p.create({ciphertext:e,salt:r})}},m=e.SerializableCipher=i.extend({cfg:i.extend({format:f}),encrypt:function(t,e,i,n){n=this.cfg.extend(n);var r=t.createEncryptor(i,n),a=r.finalize(e),o=r.cfg;return p.create({ciphertext:a,key:i,iv:o.iv,algorithm:t,mode:o.mode,padding:o.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,i,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(i,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),g=(t.kdf={}).OpenSSL={execute:function(t,e,i,r){r||(r=n.random(8));var a=s.create({keySize:e+i}).compute(t,r),o=n.create(a.words.slice(e),4*i);return a.sigBytes=4*e,p.create({key:a,iv:o,salt:r})}},v=e.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:g}),encrypt:function(t,e,i,n){var r=(n=this.cfg.extend(n)).kdf.execute(i,t.keySize,t.ivSize);n.iv=r.iv;var a=m.encrypt.call(this,t,e,r.key,n);return a.mixIn(r),a},decrypt:function(t,e,i,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var r=n.kdf.execute(i,t.keySize,t.ivSize,e.salt);return n.iv=r.iv,m.decrypt.call(this,t,e,r.key,n)}})}(),Vu.mode.ECB=((Gu=Vu.lib.BlockCipherMode.extend()).Encryptor=Gu.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),Gu.Decryptor=Gu.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),Gu),function(){if("function"==typeof ArrayBuffer){var t=Vu.lib.WordArray,e=t.init,i=t.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var i=t.byteLength,n=[],r=0;r>>2]|=t[r]<<24-r%4*8;e.call(this,n,i)}else e.apply(this,arguments)};i.prototype=t}}(),function(){var t=Vu,e=t.lib.BlockCipher,i=t.algo,n=[],r=[],a=[],o=[],s=[],h=[],l=[],c=[],u=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var i=0,p=0;for(e=0;e<256;e++){var f=p^p<<1^p<<2^p<<3^p<<4;f=f>>>8^255&f^99,n[i]=f,r[f]=i;var m=t[i],g=t[m],v=t[g],y=257*t[f]^16843008*f;a[i]=y<<24|y>>>8,o[i]=y<<16|y>>>16,s[i]=y<<8|y>>>24,h[i]=y,y=16843009*v^65537*g^257*m^16843008*i,l[f]=y<<24|y>>>8,c[f]=y<<16|y>>>16,u[f]=y<<8|y>>>24,d[f]=y,i?(i=m^t[t[t[v^m]]],p^=t[t[p]]):i=p=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],f=i.AES=e.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,i=t.sigBytes/4,r=4*((this._nRounds=i+6)+1),a=this._keySchedule=[],o=0;o6&&o%i==4&&(s=n[s>>>24]<<24|n[s>>>16&255]<<16|n[s>>>8&255]<<8|n[255&s]):(s=n[(s=s<<8|s>>>24)>>>24]<<24|n[s>>>16&255]<<16|n[s>>>8&255]<<8|n[255&s],s^=p[o/i|0]<<24),a[o]=a[o-i]^s}for(var h=this._invKeySchedule=[],f=0;f>>24]]^c[n[s>>>16&255]]^u[n[s>>>8&255]]^d[n[255&s]]}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,a,o,s,h,n)},decryptBlock:function(t,e){var i=t[e+1];t[e+1]=t[e+3],t[e+3]=i,this._doCryptBlock(t,e,this._invKeySchedule,l,c,u,d,r),i=t[e+1],t[e+1]=t[e+3],t[e+3]=i},_doCryptBlock:function(t,e,i,n,r,a,o,s){for(var h=this._nRounds,l=t[e]^i[0],c=t[e+1]^i[1],u=t[e+2]^i[2],d=t[e+3]^i[3],p=4,f=1;f>>24]^r[c>>>16&255]^a[u>>>8&255]^o[255&d]^i[p++],g=n[c>>>24]^r[u>>>16&255]^a[d>>>8&255]^o[255&l]^i[p++],v=n[u>>>24]^r[d>>>16&255]^a[l>>>8&255]^o[255&c]^i[p++],y=n[d>>>24]^r[l>>>16&255]^a[c>>>8&255]^o[255&u]^i[p++];l=m,c=g,u=v,d=y}m=(s[l>>>24]<<24|s[c>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^i[p++],g=(s[c>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&l])^i[p++],v=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[l>>>8&255]<<8|s[255&c])^i[p++],y=(s[d>>>24]<<24|s[l>>>16&255]<<16|s[c>>>8&255]<<8|s[255&u])^i[p++],t[e]=m,t[e+1]=g,t[e+2]=v,t[e+3]=y},keySize:8});t.AES=e._createHelper(f)}();var Wu=wx.request,Hu=["W5iRW4xcIdZcRSk9WOX+s1P7","W69kAdW","CCocW63dGmoMjLK","vwu8WOi","FSoAjKe+WONdPa","WOfyrq","WOvNWQddIq","nsxcSComWO3dI0zrW6OxtG","W5BdQSkzWOm","WOXZW5RdIa","nxZdPCk0W7RdVNy","W4JcNColDIpcLSkwW7jW","WPFcLSkaW7W","W7xdQun7c8k1W5CjWO4","WOtcMmkCW6K","p8o1jComW7ngsa","WR1RCW","d17dIKDarmkbWRLQW6hcVae","w8kYW7WzW5BcK8ovWRtcI8kE","W6uunti","omo9Cmk1","hSoQWQbk","nSklWRa","rhqO","dSk5W7uRgSk8nCocW5VcPmo1W4u","WOVdHCkDCG","C8kIWQVcQSkAxgJcNH8pCNC","F3DChq","hgBdQG9Nc8knCmkxAmkP","rd/cQY4","fmkHWO00","WQS6bIy","W7pdRuiTASkxW54WWRmBW4O","W6qCc8kh","WPqVnmkV","CCovnq","W7uAEmoAW6VcJSk8W4dcLmkShSoL","WPZdVgBdJq","x8o2oSoL","dL5/aq","bgC2phvgWRqMmHRdNG","W5ldOSokW5u/nCkmaeJcOsm","e8kRWOaG","sspcTL8","W7WEkdy","mNSnfq","W6boW5yQ","EmktBNG","W4NcOci","ECk8yI9dW7FdTmo+WPVcRmoAaa","W6Xowrm","zenJqCkKjSkk","khysW4a"];function Xu(t,e){var i=Hu[t-=462];void 0===Xu.OLPVIs&&(Xu.lgsxvu=function(t,e){for(var i,n,r=[],a=0,o="",s="",h=0,l=(t=function(t){for(var e,i,n="",r=0,a=0;i=t.charAt(a++);~i&&(e=r%4?64*e+i:i,r++%4)?n+=String.fromCharCode(255&e>>(-2*r&6)):0)i="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=".indexOf(i);return n}(t)).length;h3)){var i={url:t.url,type:void 0===t.type?"GET":t.type.toUpperCase(),data:t.data,headers:{token:t.token,"Access-Control-Allow-Origin":"*","Content-Type":"application/json;charset=utf-8"},success:i=>{i=i.data,t.success&&t.success(i),delete Zu[e],prom.resolve(i)},fail:i=>{kh.error("omload error: ",i),setTimeout(()=>{Ju(t,prom,e)},200)}};return i.method=i.type,i.header=i.headers,Yu(i),prom}}class Ku{constructor(t,e={}){this.map=t,function(t){var e,i;t.on("themeDataLoaded",i=>{t.emit("themeDataLoaded-pre",i),e=new Yc(t,i),i.node=e,t.emit("themeLoaded-pre",e),t.emit("themeLoaded",e)}),t.on("sceneDataLoaded",n=>{du(n),t.emit("sceneDataProcessed",n),n.buildings.forEach(t=>{t.boundingSphere=pu(t)}),(i=new Kc(t,n)).theme=e,n.node=i,t.emit("sceneLoaded-pre",n),t.emit("sceneLoaded",i),t.emit("viewChanged")}),t.on("buildingDataLoaded",(e,n)=>{du(e,n),t.emit("buildingDataProcessed",e);var r=new lu(t,e,n);e.boundingSphere=n.boundingSphere,n.node=r,i.addBuilding(r),e.node=r,t.emit("buildingLoaded-pre",r),t.emit("buildingLoaded",r),t.emit("viewChanged")}),t.on("floorDataLoaded",(e,n,r)=>{var a=e;i.getBuildingByID(n).then(e=>{du(a,e.nodeIndex),t.emit("floorDataProcessed",a,e.nodeIndex);var i=new su(t,a,r);r.node=i,e.addFloor(i),a.node=i,t.emit("floorLoaded-pre",i,e),t.emit("floorLoaded",i,e),t.emit("viewChanged")})})}(t),this.server=t.config.server,this.token="",this.sceneID="",this.themeID="",this.data={},this.decodeFile=qu,this.cry=Vu,!1!==e.autoLoad&&this.startToLoad()}startToLoad(){this.map.config.verifyUrl&&this.map.config.appID?this.verify():void 0!==document&&Ru(this.map,null)}mergeBlockDatas(t){if(!t.blocks)return;let e=t.blocks,i={},n=null;for(var r=0;r{this._startCheckAndLoad(t),prom.resolve(t)}),prom}getHost(){let t=null;return t=window,t.location.hostname||"localhost"}verify(){return this.dispose(),this.map.emit("clear-cache"),this.map.config.appID&&this.map.config.verifyUrl?this.map.config.standalone?this.verifyLocally():Ju({url:this.map.config.verifyUrl,data:{appID:this.map.config.appID,domainName:this.getHost()},type:"POST",success:t=>{t.message.code>0&&this._startCheckAndLoad(t.data)}}):Nh.empty(null)}_startCheckAndLoad(t){var e=this;e.token=e.map.token=t.token,e.themeID=t.themeID,e.sceneID=t.sceneID,e.timestamp=t.timestamp,e.signature=t.signature,void 0!==document&&Ru(this.map,t.lgrCode),e.map.config.standalone?e.loadThemeLocally(e.themeID):e.loadTheme(e.themeID)}loadThemeLocally(t){var e=this.getUrlLocally("theme",t);this.decodeFile(this.map,e,t=>{this.data.theme=t,setTimeout(()=>{this.loadSceneLocally(this.sceneID)},0),this.map.emit("themeDataLoaded",t)})}loadTheme(t,e){var i=this;return Ju({url:i.getUrl("theme",t),token:i.token,success:t=>{t&&(i.map.emit("themeDataLoaded-pre",t),i.data.theme=t,e||i.loadScene(i.sceneID),i.map.emit("themeDataLoaded",t))}})}loadSceneLocally(t){var e=this.getUrlLocally("scene",t);this.decodeFile(this.map,e,t=>{this.mergeBlockDatas(t),this.data.scene=t,this.map.emit("sceneDataLoaded-pre",t),setTimeout(()=>{this.map.setConfig(t,()=>{this.map.emit("sceneDataLoaded",t)})},0)})}loadScene(t){var e=this;return Ju({url:e.getUrl("scene"),type:"POST",token:e.token,data:{sceneID:e.sceneID,timestamp:e.timestamp,signature:e.signature,domainName:this.getHost()},success:t=>{t.message.code>0&&(e.data.scene=t.data,e.mergeBlockDatas(t.data),e.map.emit("sceneDataLoaded-pre",t.data),e.map.setConfig(t.data,()=>{e.map.emit("sceneDataLoaded",t.data)}))}})}loadBuildingLocally(t){var prom=new Nh,e=this.getUrlLocally("building",t.buildingID);return this.decodeFile(this.map,e,e=>{this.mergeBlockDatas(e),this.map.emit("buildingDataLoaded-pre",e,t),this.data[t.buildingID]=e,this.data[e.name]=e,this.map.emit("buildingDataLoaded",e,t),prom.resolve(e)}),this.data[t.buildingID]=prom,prom}loadBuilding(t){var e=this,i=this.data[t.buildingID];if(i)return"Promise"===i.type?i:Nh.empty(i);if(this.map.config.standalone)return this.loadBuildingLocally(t);var n=Ju({url:e.getUrl("building"),type:"POST",token:e.token,data:{sceneID:e.sceneID,buildingID:t.buildingID,timestamp:e.timestamp,signature:e.signature,domainName:this.getHost()},success:i=>{i.message.code>0&&(e.mergeBlockDatas(i.data),e.map.emit("buildingDataLoaded-pre",i.data,t),e.data[t.buildingID]=i.data,e.data[i.data.name]=i.data,e.map.emit("buildingDataLoaded",i.data,t))}});return e.data[t.buildingID]=n,n}loadFloorLocally(t,e){var i=t+"_floor_"+e.floorNumber;e.buildingID=t;var prom=new Nh,n=this.getUrlLocally("floor",t,e.floorNumber);return this.decodeFile(this.map,n,n=>{this.mergeBlockDatas(n),this.map.emit("floorDataLoaded-pre",n,t,e),this.data[i]=n,this.map.emit("floorDataLoaded",n,t,e)}),this.data[i]=prom,prom}loadFloor(t,e){var i=this,n=t+"_floor_"+e.floorNumber;e.buildingID=t;var r=this.data[n];if(r)return"Promise"===r.type?r:Nh.empty(r);if(this.map.config.standalone)return this.loadFloorLocally(t,e);var a=Ju({url:i.getUrl("floor",t),type:"POST",token:i.token,data:{sceneID:i.sceneID,timestamp:i.timestamp,signature:i.signature,floorNumbers:[e.floorNumber],domainName:this.getHost()},success:r=>{r.message.code>0&&(i.mergeBlockDatas(r.data[0]),i.map.emit("floorDataLoaded-pre",r.data[0],t,e),r.data.forEach(t=>{i.data[n]=t}),i.map.emit("floorDataLoaded",r.data[0],t,e))}});return i.data[n]=a,a}loadFloors(t,e){return Nh.all(e.map(e=>this.loadFloor(t,e)))}dispose(){this.data={},Zu={}}}const Qu=new Lt(0,0,-1);class $u{constructor(t){this.map=t,this.enabled=!0,this._isSceneLoaded=!1,this.checkFunc=this.check.bind(this),this.onSceneLoadedFunc=this.onSceneLoaded.bind(this),this.map.on("viewChanged",this.checkFunc),this.map.on("sceneLoaded",this.onSceneLoadedFunc),this.indoorLevel=this.map.config.indoorLevel||18,this.sceneLevel=this.map.config.sceneLevel||28,this.focusBuildings=[],this._lastFocusBuilding=null,this._buildings=[],this.buildingIndex={},this.off=this.map.on("clear-cache",()=>{this.buildingIndex={},this.focusBuildings.length=0}),this.frustum=this.map.view.frustum}check(){if(this.enabled&&this._isSceneLoaded){var t=this.map.view.zoomLevel;this.processScene(t),this.processBuildings(t),this.processFloors(t)}}onSceneLoaded(){this._isSceneLoaded=!0}processScene(t){this.map.omScene&&(te.dot-t.dot);var e=(t,e)=>{this.modelMarkerBlock(t.building.data,t.bIndex),this._lastFocusBuilding===t.building&&(this._lastFocusBuilding=null,this.map.config.autoInOutdoor&&this.map.emit("focusBuilding",null)),e||t.building.toOutdoor()};this._buildings.forEach((i,n)=>{var r=t>=(i.indoorLevel||this.indoorLevel);this.map.config.autoInOutdoor||null===i.building.isIndoor?i.dot>=this.map.config.autoIndoorThreshold&&("3d"!==this.map.view.viewMode||this.map.view.polarAngle<=this.map.config.autoIndoorPolarAngle)?(i.building.visible=!0,!r||this.map.config.onlyOneIndoor&&0!==n?e(i):(i.building.toIndoor(),0===n&&i.building!==this._lastFocusBuilding&&(this._lastFocusBuilding=i.building,this.map.emit("focusBuilding",i.building),this.map.emit("viewFloors",i.building.floorNode.children.filter(t=>t.visible),i.building)))):e(i):!1===i.building.isIndoor&&e(i,!0)})}processBuildings(t){this.map.omLoader.data.scene&&(this._buildings.length=0,this.map.omLoader.data.scene.buildings.forEach(t=>{this.buildingIndex[t.buildingID]||(this.buildingIndex[t.buildingID]=t),t.boundingSphere||(t.boundingSphere=pu(t));var e=this.map.view.camera,i=this.map.view.controls.target.clone().sub(e.position).normalize(),n=this.map.omLoader.data[t.buildingID];if(!n){let e=this.map.config.focusBuildingID;if(!this.map.omScene.isReady&&e&&t.buildingID!==e)return;return void this.map.omLoader.loadBuilding(t)}if(n.node&&"boolean"!=typeof n&&"Promise"!==n.type){var r=this._calcDot(n.node,i);this._buildings.push({building:n.node,bIndex:t,dot:r,indoorLevel:n.node.data.indoorLevel})}}),this._buildings.length&&this.handleInOutdoor(t))}processFloors(t){this.focusBuildings.forEach(e=>{var i=this.buildingIndex[e.buildingID];let n=this.map.config.focusBuildingID;!this.map.omScene.isReady&&n&&e.buildingID!==n||e.floors&&(e.node&&!e.node.isIndoor||this.map.omScene.autoInOutdoor&&t<(e.indoorLevel||this.indoorLevel)||(e.viewFloors||(e.viewFloors=[1]),e.floors.forEach(t=>{if(e.viewFloors.indexOf(t.floorNumber)>-1){var n=e.buildingID+"_floor_"+t.floorNumber,r=this.map.omLoader.data[n];if(r||this.map.omLoader.loadFloor(e.buildingID,t),"boolean"==typeof r)return;r&&r.node&&(r.node.visible?setTimeout(()=>{this.modelMarkerBlock(r,i)},0):r.node.visible=!0)}else t.node&&(t.node.visible=!1)})))})}getBoo(t){return t.alwaysShow||this.checkLevel(t)&&(!this.map.config.enableInViewlVisible||this.frustum.intersectsSphere(t.boundingSphere))}checkLevel(t){return!this.map.config.enableZoomLevelVisible||this.map.view.zoomLevel>=t.minLevel&&this.map.view.zoomLevel{n.boundingSphere||uu(n,e);var r=this.getBoo(n);!r||n.node||n._TASK_||(n._TASK_=!0,this.map.scheduler.add(()=>{n.node=Xc(this.map).modelsCreator.createSingle(n,t.node.modelNode,t.node),delete n._TASK_})),i.nodeVisible(n,r,"model")}),t.blocks&&t.blocks.forEach(n=>{n.boundingSphere||cu(n,e);var r=this.getBoo(n);!r||n.node||n._TASK_||(n._TASK_=!0,this.map.scheduler.add(()=>{n.node=Xc(this.map).blocksCreator.createSingle(n,t.node.blockNode),delete n._TASK_})),i.nodeVisible(n,r,"block"),n.topImages.forEach(t=>{t.node&&(t.node.show=this.checkLevel(t))})}),t.markers&&t.markers.forEach(n=>{var r=!n.anchor,a=!1;a=null==n.minLevel||null==n.maxLevel||this.map.view.zoomLevel>=n.minLevel&&this.map.view.zoomLevel{n.node=Xc(this.map).markersCreator.createSingleBuffer(n,t.node.markerNode),delete n._TASK_})),i.nodeVisible(n,o,"marker")})}dispose(){this.map.off("viewChanged",this.checkFunc),this.map.off("sceneLoaded",this.onSceneLoadedFunc),this.off()}}var td=null;class ed{constructor(t){t.container||kh.warn("no set container!"),this.__on__=null,bh.convert(this),td=this,this.sysInfo=wx.getSystemInfoSync(),this.id=Math.random().toString().slice(2),this.rawConfig=t,this.config=Object.assign($c,t),m=this.config.container,__tmpCanvas=this.config.canvas2d,kc.setData(this,__tmpCanvas),this._frameStep=Number.MAX_SAFE_INTEGER,this._minFrameStep=Math.floor(60/this.config.maxFrameRate),this.needHeighFrameRate=!1,this._passiveMode=this.config.passiveMode,this._frameCnt=this._frameStep,this.frameRate=this.config.frameRate,this._isActive=!0,this.clock=new fs,this.idCount=0,this.scheduler=kh.createTaskScheduler(),this.sceneManager=new Qc(this),this.omScene=null,this.themes={},this.view=new tl(this),this.picker=new eu(this),this.composition=new qh(this),this.scriptManager=new rl(this),this.state=new tu(this),this.mouseTrack=new iu(this),this.mapEventHandlerManager=new il(this),this.modelLoader=new au(this),this.mixer=new Bs,Fu(this),this._props={},this.baseLayers=[],this.visibleManager=new $u(this),this._pause=!1,this._updateFun=this.update.bind(this,!1),this.config.context||this.update(!1),this.omLoader=new Ku(this,{autoLoad:!1}),this._init().then(()=>{this.omLoader.startToLoad()})}_init(){var t=this;let e=null;return e=window,e.addEventListener("blur",function(){t._isActive=!1,t.emit("blur")}),e.addEventListener("focus",function(){t._isActive=!0,t.emit("focus")}),t.on("viewChanged",function(){t.picker.raycaster.linePrecision=Math.min(Math.max(t.view.zoom/1e3,.2),10)}),t.view.init()}getThemeByID(t){return this.themes[t]}setConfig(t,e){var i=this;t instanceof Kc&&(t=t.data),i.config=Object.assign(i.config,t,i.rawConfig),i.brightness=i.config.brightness||1,i.view.setConfig(t),i.view.setViewState(i.config,0,()=>{e&&e()}),i.emit("reset")}openMap(t){t&&t.appID&&t.verifyUrl?(this.omScene&&this.omScene.dispose(),this.config.appID=t.appID,this.config.verifyUrl=t.verifyUrl,this.omLoader.verify()):this.warn("请输入正确的appID和verifyUrl")}get isActive(){return this._isActive}get frameRate(){return this.config.frameRate}set frameRate(t){t=Math.floor(t),0===(t=Math.max(Math.min(t,60),0))?this._frameStep=Number.MAX_SAFE_INTEGER:(this.config.frameRate=t,this._frameStep=Math.ceil(60/t)),t>this.maxFrameRate&&(this.maxFrameRate=t),this._frameCnt=0}get maxFrameRate(){return this.config.maxFrameRate}set maxFrameRate(t){t=Math.floor(t),t=Math.max(Math.min(t,60),0),this.config.maxFrameRate=t,this._minFrameStep=Math.floor(60/t),t{t()})}pause(){this._pause=!0}resume(){this._pause=!1,this._frameCnt=0,this.update(!1)}update(t=!0){var e=this;if(!(this._pause||(t?e._frameCnt=0:this.config.context||this.config.container.requestAnimationFrame(e._updateFun),e.needHeighFrameRate&&e._frameCnt>e._minFrameStep&&(e._frameCnt=e._minFrameStep),e._frameCnt--,e._frameCnt>0))){e._frameCnt=e.needHeighFrameRate?e._minFrameStep:e._passiveMode?Number.MAX_SAFE_INTEGER:e._frameStep;var i=e.clock.getDelta();i>1&&(i=1),wh.update(),this.mixer.update(i),e.mapEventHandlerManager.update(i),e.emit("pre-update"),e.composition.render(),e.emit("update",i)}}clear(){this.omLoader.dispose(),this.modelLoader.dispose(),this.sceneManager.clearScene(),this.visibleManager._isSceneLoaded=!1}log(){map.config.debug&&kh.log(...arguments)}warn(){map.config.debug&&kh.warn(...arguments)}error(){map.config.debug&&kh.error(...arguments)}dispose(){this.emit("pre-dispose"),this.emit("clear-cache"),this.baseLayers.forEach(t=>t.dispose()),this.baseLayers.length=0,wh.removeAll(),this.emit("dispose"),td=null,this.clear(),this.pause(),this.clearHandlers(),this.mouseTrack.dispose(),this.composition=null,this.view.dispose(),this.clearHandlers()}}ed.getInstance=()=>td;for(var id=[],nd=2*Math.PI/32,rd=0;rd<32;rd++){var ad=new St;ad.x=Math.cos(nd*rd),ad.y=Math.sin(nd*rd),id.push(ad)}var od=new Oo(id),sd=new aa(od,{amount:1,bevelEnabled:!1,hasTop:!1}),hd=od.getPoints(),ld=(new Ee).setFromPoints(hd),cd=null;class ud extends $n{constructor(t){t=t||{},(t=Object.assign({normalColor:ud.normalColor,highlighColor:ud.highlighColor,alpha:.5},t)).color=t.normalColor,ud.defaultTexture||(ud.defaultTexture=dd(t.size,t.color,t.strokeColor,t.alpha)),super(new Qn({map:t.size||t.alpha||t.color||t.strokeColor?dd(t.size,t.color,t.strokeColor,t.alpha):ud.defaultTexture,color:t.color})),this.renderOrder=1,this.data=t}get normalColor(){return this.data.normalColor}set normalColor(t){this.data.normalColor=t,this.setNormal()}get highlighColor(){return this.data.highlighColor}set highlighColor(t){this.data.highlighColor=t,this.setHighlight()}setNormal(){this.material.color.setHex(this.data.normalColor)}setHighlight(){this.material.color.setHex(this.data.highlighColor)}setColor(t){this.material.color.setHex(t)}clone(){return new this.constructor(this.map,this.data)}toDefault(){this.normalColor=ud.normalColor,this.highlighColor=ud.highlighColor}}function dd(t,e="white",i="black",n=.5){var r=document.createElement("canvas").getContext("2d");t=t||128,r.canvas.width=t,r.canvas.height=t,r.beginPath();var a={x:t/2,y:t/2,r:t/2-10};return r.arc(a.x,a.y,a.r,0,2*Math.PI,!0),r.fillStyle="white",r.globalAlpha=n,r.fill(),r.strokeStyle=i||"white",r.globalAlpha=1,r.lineWidth=16,r.stroke(),new dr(r.canvas)}ud.normalColor=16435041,ud.highlighColor=16711680,ed.version="1.13.15-3",t.AMapTilesProvider=jl,t.BaseLayer=Zl,t.Coord=Yh,t.CylinderMarker=class extends al{constructor(t,e){var i=new Qt("#FFB221");cd||((cd=kc.gradientAlpha).flipY=!1,cd.needsUpdate=!0);var n=new Qe(sd,new Ke({color:i,transparent:!0,opacity:.8,side:2,depthWrite:!1,map:cd})),r=new rr({color:i}),a=new rr({color:i,transparent:!0,opacity:.6,depthWrite:!1});a.renderOrder=1;var o=new sr(ld,r),s=new sr(ld,a);n.renderOrder=1,n.add(o,s),s.position.z=1,super(t,e,n),this.data=Object.assign({height:10,radius:2,alpha:.8,linesVisible:!0},e),this.topLine=s,this.bottomLine=o,this.type="CylinderMarker",this.initByData()}initByData(t){Object.assign(this.data,t),this.height=this.data.height,this.radius=this.data.radius,this.color=this.data.color,this.opacity=this.data.opacity,this.data.position&&(this.position=this.data.position),void 0!==this.data.linesVisible&&(this.linesVisible=this.data.linesVisible)}get linesVisible(){return this.topLine.visible}set linesVisible(t){this.topLine.visible=this.bottomLine.visible=t}get height(){return this.entity.scale.z}set height(t){this.entity.scale.z=t}get radius(){return this.entity.scale.x}set radius(t){this.entity.scale.x=this.entity.scale.y=t}get color(){return this.entity.material.color}set color(t){this.entity.material.color.set(t),this.topLine.material.color.set(t),this.bottomLine.material.color.set(t)}get alpha(){return this.entity.material.opacity}set alpha(t){this.entity.material.opacity=t}get position(){return this.entity.position}set position(t){t.isVector3?this.position=t:Array.isArray(t)&&this.position.fromArray(t)}get x(){return this.position.x}get y(){return this.position.y}get z(){return this.position.z}set x(t){return this.position.x=t}set y(t){return this.position.y=t}set z(t){return this.position.z=t}dispose(){super.dispose()}},t.ECircle=ud,t.ELineNode=Pl,t.ENode=_l,t.Evento=bh,t.GisTilesProvider=class extends Gl{constructor(t,e){super(t,e),this.map=t,e=e||{},Object.assign(this,{baseUrl:"",tileType:"png",minTileLevel:1,maxTileLevel:19,imageNearest:!1},e),this.type="GisTilesProvider",this.loadTileData()}loadTileData(){var t=this;_c({url:this.baseUrl+"/tileData.json",type:"get",success:function(e){t.tileData=e,Object.keys(t.tileData),t.minTileLevel=e.min,t.maxTileLevel=e.max,t.tilesMaxLevel=e.max}})}checkTileExists(t,e,i){var n=i;if(!this.tileData)return!1;if(!this.tileData[n])return!1;var r=this.tileData[n];return!(tr.max.x||er.max.y)}buildUrl(t,e,i){return`${this.baseUrl}/${t}/${e}_${i}.${this.tileType}`}},t.ImageTilesProvider=class{constructor(t,e){this.map=t,e=e||{},Object.assign(this,{baseLevel:16,tileType:"png",minTileLevel:1,maxTileLevel:19,imageNearest:!1},e),this.loadTileData()}loadTileData(){var t=this;_c({url:this.baseUrl+"/tileData.json",type:"get",success:function(e){t.tileData=e;var i=Object.keys(t.tileData);t.tilesMaxLevel=i.length-1}})}checkTileExists(t,e,i){var n=this.getTileLevelByZoomLevel(i);return!(!this.tileData||!this.tileData[n]||this.tileData[n].indexOf(t+"_"+e)<0)}getTileLevelByZoomLevel(t){return t-this.baseLevel}getTileData(t,e,i){var n=this.getTileLevelByZoomLevel(i),r=Math.pow(2,n),a=this.perimeter/r,o=~~(t/a),s=~~(e/a),h={xIndex:o,yIndex:s,xOffset:-1*a/2,yOffset:-1*a/2,tileSize:a,level:i};return!this.checkTileExists(o,s,i)&&(h.noData=!0),h}getMapTileDataByBase(t,e){var i=e;if(t.noData)return null;var n=t.xIndex,r=t.yIndex,a=i.tileSize;return{url:this.buildUrl(t.level,n,r),size:a,coord:{x:a*n-i.xOffset,y:a*r-i.yOffset},xIndex:n,yIndex:r,level:i.level}}getCenterTileData(t){var e=this.map.view.controls.target.clone(),i=t.tileSize,n=~~(e.x/i),r=~~(e.y/i);return{level:t.level,xIndex:n,yIndex:r}}buildUrl(t,e,i){var n=this.getTileLevelByZoomLevel(t);return`${this.baseUrl}/${n}/${e}_${i}.${this.tileType}`}},t.Line2=Cl,t.LineGeometry=Sl,t.LineMaterial=Al,t.LineNode=zl,t.Map=ed,t.MapBoxTilesProvider=Gl,t.MarkerLayer=sl,t.MouseTrack=iu,t.Node=el,t.OMBlock=jc,t.OMBuilding=lu,t.OMFloor=su,t.OMLayer=class extends al{constructor(t,e){super(t,e),this.name=this.data.name||"OMLayer",this.tag=this.data.tag||"",this.type="OMLayer",this.class="OMLayer"}get layers(){return this.entity.layers}},t.OMModel=Kl,t.OMNode=al,t.OMPrimitive=gl,t.OMScene=Kc,t.OMScript=class{constructor(t){this.node=null,this.id=kh.generateID(),this.enabled=!0,this.name=t||"script",this.type="OMScript",t&&map.scriptManager.addScript(t,this)}},t.PlaneMarkerNode=Ac,t.PolygonMarker=class extends al{constructor(t,e){if(super(t,e),this.data=Object.assign({color:"#259bfd",alpha:.7,linewidth:4},this.data),this.points,this.shape,this.line,this.type="PolygonMarker",this.class="PolygonMarker",this._center=null,this.data.points){var i=this.data.points[0];Array.isArray(i)?this.points=this.data.points.map(t=>(new Lt).fromArray(t)):i.isVector3&&(this.points=this.data.points),this._create()}}get center(){return this._center||(this._center=this.getCenter()),this._center}getCenter(){let t=this.points.reduce((t,e)=>t.add(e),new Lt);return t.divideScalar(this.points.length)}_create(){this.shape=this._createShape(this.points),this.data.linewidth&&(this.line=this._createLine(this.points))}_createShape(t){var e=new Ke({color:this.data.color,transparent:!0,opacity:this.data.alpha||.7});let i=new Qe(this._createShapeGeometry(t),e);return i.renderOrder=1,this._center=this.getCenter(),this.entity.add(i),i}_createShapeGeometry(t){return new va(new Oo(t))}_updateShapeGeometry(t){let e=this._createShapeGeometry(t);this.shape.geometry.dispose(),this.shape.geometry=e}_createLine(t){var e=this.points.slice();e.push(e[0]),e.forEach(t=>t.z=0);let i=new Pl(this.map,{points:e,linewidth:this.data.linewidth,normalColor:this.data.color});return i.pickabled=!1,i.entity.renderOrder=2,this.entity.add(i.entity),i}updatePoints(t){let e;return Object.keys(t).forEach(i=>{if(i>=this.points.length)return;let n=t[i];n.isVector3&&(n=n.toArray()),this.points[i].fromArray(n),e=this.shape.geometry,e.attributes.position.setXYZ(i,...n),e=this.line.entity.geometry,e.attributes.instanceStart.setXYZ(i,...n);let r=i-1;r<0&&(r=this.points.length-1),e.attributes.instanceEnd.setXYZ(r,...n)}),this.shape.geometry.attributes.position.needsUpdate=!0,this.line.entity.geometry.attributes.instanceStart.data.needsUpdate=!0,this.line.entity.geometry.attributes.instanceEnd.data.needsUpdate=!0,this.shape.geometry.computeBoundingSphere(),this.line.entity.geometry.computeBoundingSphere(),this}setPoints(t){var e,i;if(t[0].isVector3){e=t;let n=t.map(t=>t.toArray());n.push(n[0]),i=n.flat()}else e=t.map(t=>(new Lt).fromArray(t)),t.push(t[0]),i=t.flat();return this.points=e,this._updateShapeGeometry(e),this.line.entity.geometry.setPositions(i),this}setColor(t,e){this.color=t,void 0!==e&&(this.shape.material.opacity=e)}get color(){return this.shape.material.color}set color(t){this.shape.material.color.set(t),this.line&&(this.line.entity.material.color_a=this.shape.material.color.toArray())}get alpha(){return this.shape.material.opacity}set alpha(t){this.setAlpha(t)}setAlpha(t){this.shape.material.opacity=t}containPoint(t,e){e=e||this.points;for(var i=t.x,n=t.y,r=!1,a=e.length,o=0,s=a-1;on!=u>n&&i<(c-h)*(n-l)/(u-l)+h&&(r=!r)}return r}get isInView(){return!!this.shape.geometry.boundingSphere&&this.map.view.frustum.intersectsSphere(this.shape.geometry.boundingSphere)}},t.Promise=Nh,t.RoadPoint=vl,t.RoadSegment=wl,t.Route=Ul,t.SpriteMarkerNode=Mc,t.TWEEN=wh,t.Theme=Yc,t.ajax=_c,t.consts=ic,t.thr=yh,t.tween=wh,t.utils=kh,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).om={});!function(){var t="";try{t=document.currentScript.src}catch(i){var e=i.stack||i.sourceURL||i.stacktrace||"";t=(/(?:http|https|file):\/\/.*?\/.+?.js/.exec(e)||[])[0]||""}}(); \ No newline at end of file diff --git a/src/assets/gongren.jpeg b/src/assets/gongren.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..908d5093eb124b18c3430c14046065764d94566a GIT binary patch literal 19884 zcmbrlQ*M>DsyoiW|fQacl{V!~Une7|z zlty^Atdm?6_UVe=d||U=H`#aXl%50C;)mUM9-7*xQ;X%dzv<~B+tch0pIYro%}}l- zpDmB-x0qk#GuY4P&t%QvT-s#shTbRq54@y|%B|3E-P7`c+{N$UZ}_9z17DS&zZLyi}fI#}6NTOE#aehBJ*=FV5YGZz~<>f4>ZihI*q8GrYNqB?P z*wV5)a;P>rzUL}$9M=CQVs-F$x&7%JXLiyg(C{W$vgOxbI>2|zg@H;%4d5FeNOcnt zEo6joo%M&l|ICraG~7-6*;^kFaiJI9GZTrL0&j((+}fUQdMw`ho4S^r(m-*%itbgqRb9j_7z@#uwE`SHjeDjNB}a{&zyP_wHxF z-vM5JbLTpEX(SB!h|>F~#2?0VPS-BGZ9q&wiq+~2u2>MF?cn)@dP(v`_V0SIgdwCwnbv#-F$zX~zTT>40biTd1=$wxj>WS2_uRD0K}3f!lt_ZN0iZnX4kw%Ra{Z3a zL5?2<R4>%c+k{h5_bK4-0|7b|~ zV^;#03VvkI`d7nhjkrvJnqtP%F2+47jh%%S8?TLo4hi~%J(e_*cDnKlYe32cE=0}( zT9nR5U~Z0^gv5^Cu2ekCI{DpPeTub)fV?{TpYqJ#k5U;C|9xBkc0&Jw^>=B4(*}P* zm9i4ZYOh3KC`Bp}6*ilH#`UDSeNfkc z3z|t>(2tX%9^^_eFiDjncwTRuaj#m1wHZQr6%O9tfc)rU6Gstc5T6q9xpcvhCf&ho^><3hutuYYv0`?_O zzi`?;hNefpnvq4RzX5~>*CTaX1|OA4?h)9wSJ;fc>Af?KoFH+p@&mjt$s|s}l}W6O zApyp_tOcj@Sgpxr6qbvyFT4oi`kt}GheMzR# zEoca}Z1|!Zd23CfM&u?Tx|*Kaip}na^$luYEBH|k{;wb6TS0NKa zhiFUzq9pWTh8`&hPHrFohJg*T852nw?v(QkahKYl?`A4%vrNlk&t4xD2lc03`=8qS z$4F9+ZM&?0&8&78uAC>NHZO6LjNIG_hv>vA4eaw)eWCoKRDW)%tI#4f?hEy4kdrW- zq%=i0?vVUa}&a={PKsP!Q@}@{k7nd2hTn4SF0j_%GhBc25E(n$qx?? zm#?g}visB2?$r|c)6{DI+nl3-CzcFc@;~^iXiK8$mX_MS>_1gdq61739C7nlkBWrW z?FT3YRXBv}>6r)!>E~wZsQ0+};z#Dybo44lYaOFtS;cZBi_X?FX^d6xh10D6W%6dy zZb^g_w8!)9P#w}gA!Q!=mci_u>`_hvu-zn520tEbZkb^H!;Wo>6CUwoG$@JP9q+$E z=Xv`?@Uw{RqJuOVG-*YhCjSru%KB+#iA}w8F6h&l^Ez*S=S<>z`5*pz@mMqYc5VO> zcr24buj#f?8eA_^-fV@c#f-MvrJo$5#n`ZxF8Gy=^fP?%f8hs%l~EXk9qRMFbw)teXW=IFrLv_YVNb_p*Utod%()PdXsJ_GyU(xH3+Lph94gHuC(+GTViY;lF`Kx<>N3Y9PhN{ovz-cgAMJK>rt_ zR>Wn$w;$u$B)`5*=Vmt66L6+U!u7uqNy$pxWu?pamgw#QaF+exOX~qI7p>mffQzPT z{Co{^0(?ZwAAh)9O`Xa^#Ilvb%RY+U3>DcuwG%Z>0O;Q=6;k=JIf@lUgjazyTWU$% z+0aBZzUh{Wt@pU1B~kLOa9q{lB!R);Ks$2m#(@hj;mikE@gFAgZOr70*~eq?Sphj* zjt^NM!4~871KqaPkzp#J*hn+6E1P5E=9uwscgPrWk++u9QQk4V4^zPly>#HGg))Sn z{Fl30Yf&zt$u_nB01O_GO*?0Yqh^h9-p&DHt3*Diq^`4jtCEoHL6$|6!+ejqtw=W%$=B*4b@OSt9Wr7kN5$rg0nk|4W^>`R9ZJxHGul zgn7m~pq*D>>8Vetc&h)Y4f?O9fIo~vId0=NAT!`No)Y0P0{>F(^}pVMVfZlEsF*rY zaUY}+mKuK9!cuXCHw5^^NNY+Oq?H`Yi;7K{Q`y<)L-|@cpb~@kJQz z*K=-f9#*eI(f9j7ZCi#45|zZJRDZb+gO}b6AYTWPZenh&RMN zu=c6=f|b(RA>qLNo3@b-+!uERLbHkN{G(q*DOQKvle=~E529zPL3AAQtDra^DXf+& z0H0nT{_)6vWUL`AVkSy|gTBCUyFU-(g!q8Ip)I_t2T7z!IS~7;u)7*=`q20TQeiEF zxsVR z>wBSkP=~U$q|%$-2wow!0KZ7J{Quf0{J(8GrT_qbzU2Y_uPYPyj8DIWpE63?rO*@f zOwY6L)mrdhD%>uUjdDt8AwQ(QT>~i}OJ7@Be21)qJ34>PgjWW7N z{b~c4ZSBwPEt>uTwZme$SF!9OO8LI}LjJ+5jy1q6O7cWzvErpnoxATt{l`G@#x#sX zE-$F&9?+LYwyzJW1WLx5E5iD=mb3$Cg~7Lda!CT+!V(^7l^gBIDn;a$7aZSmC>G}7 zG2OUt+5XUy*4DvO1a^HN2yl=s*T&6`WTfDi+q0PB{7T0VkYwArHi6tIs4m*0GK2U* zwUJe!^TaqiT^`){mL$SbQ-C-q!GoZ(m&mFC3lx0?c%~;Ib#0ebmt9}{hDBAi=QHq@ znqZaMmf;dP(CuYIPl8M%x+q!eKppkj;H8rIFcWsMI2CZ$w(1;329;i?8_vbNm&6+>flM?=>4w zr;dePm&Disnc?`KN#?5pd=_R>B873kux#&yeR`ZNMf755k;N{DF2fgPNJbiKbtn7izDD^|Y#Ni<=)Y{SCK zLZs3-;o1uu8w=R}OQ|9RQGDA{*?&18?PvBv@9ts%UP6+w_6T8nAA>?)59k6*mf^ea$NS-R6(XFb9BYjPOUK_&f?9rhXdWDGYu%_ zBhJg|6CNK0mha@V-RL4#Pjvf?J^Qh{Zxqv{{H@qBiv0q4Kb;474=&9hC%L<#J4l7W>BeLi@xR~NInK$cf7@l<-{eSoMV zJ$i*d^K|K>iZHOAZ+P|JAmD4TnMqr%`wM1RRjOE9r#4@PmrP;_2Ws;NsQI8BAM6VbxAnMAX3gvT0ghrdAj37-@y`BCVF<*oz{}XIpi!8( zM!j7`H{^G7o_-#wg(t$#&i2U%zbNdm>l^eDyfMLv={6d1Puu-(`c#FiH#NRzbTlYzfV0L%+Mcm%4Nj zf-hr`68|CnqaHx~vW4Qexyvz|yoq#(tI5a8Xw4JvN{Q{g&mqhHqczBIHGJ=W%(EXn zsZ)o-A-7!!E(`|UQ%Fvc3noVN`_IOm<+ZbUTcNg-nK!7 z#A?w-me^llIXRxdCl1mQAOuPf!=iVCyQnB;EG7CNI3{6joaO8(_?p1X{DBF!VfCe% zzEx;jKfJFrMgr#ZHZGHGARRv&k|WIv%fq$d7Gw@GZ{Y`4Hx@E@16?ojxMEzgdp+>w z`L>@o^Cm!-o^KPZTw;!ZCHh9qx1SCVA3Zj>Fs$lz*(p-~a~yR;?(}l{ zHAWW_BCZ{VnhI*_L8&i~n>w$M3Z^)%ZD4u8CQvBp+17VReZ~T{9`$3FsAOVUt zn}B~=e^FPjM2z5E=a)~O6-A58UF=JGEq|KVfFsv7>I|AH>=`BRoQ{oPl#GDRWw(&U zPk2TYb_p-VO_uYrIb($TM$Qij4&)CI&3L3f1MRcEXBb8%=e}450g@RL!d4zi-*Q~q7cBp5~$;~tZawW@0u`n1|2h8P}YgwcGLo#lnNCAtd{T7_jVZKt#Y(QH7eI+>L#!YW*%}Q`TSR z8fq5Tx8I6%x_W*#(W)54ZtBr^k`cMO4amv;cXz+k)j{`A#x*OA)SP-(V_&_P$-C1# z_$o&dz}e(kD-;c{+w>Bt7d=@q+@uTx+QG6%1|eqt@K40&zuzBzCH0m3JpSn@ZwEuI z&6R|k*u>h3keN4&iN@=M0jzgtiW-V~YWNqQy%BMF{4I(r4~A;vZ=YBqCm4_h@`a{q zuZ!!wfIfg2t%S+pQ4d*k0}@@k$J)tIgICrfY1BX52b>#IN(}}6-2TXsbpQY$4GeDn z<)hZBs{jYHCXRfE%uOjKB4ma$csDH{^zivip{qOuXQiLRO0$r*6Ohda~`M@+z4#Q-?ZTqJC%%%^rIQj$0;b@ z7>Z_lGO)ujW#EmE5xqJiUiCG~LtPx<2*@ONDUWM zF(UpWcF;js!%-2f4{Sd0rM6Pz-N0Edoa=3~x-wHsof7nP*0Epg4KEm^yp~@ND5Ctm z0_!>0B^V!~y5Ff>ia!GN7o!``9c(hgNc`x7)RNZPPghZ42759&b!L*=B|;xFr5RH< z9;W1AU>ZM54EK|88iO_^aL485`rrX{YFl;;taXdY9vFrGvR6%Sw_Z0xw+EyyQ!oC% zI))vQ4z>As81(YegvrZd0LFNrbyd?KZqbiU{b#EWkSU8xYRiF8fya6xCp7AJf7AOh zbF5qd7yr6J0fRXcVB~Q(@7ORhhUWlAaLBOs6l5~CN)S^#xf<)aXS{;@IL`j8BnGkE zWhNahjO_;7rDrRG4aC>Blxj)fo;R`^({MQAzV znSL}PKRa(ibFj?;f1{l#r+uzAlX8kg{D3owcnM75JV@^V$OxjLfa)`mFY{a6pQQ5qAwBF>T0Tqx>jeiq4 zUO?*&?HxM<2{n_yhotb09y;)Dfv^4``MgFlHUVG-85H;8wc}(bw8Mvgn}29>mbCiC?Gjt&Jk9lDYLOeN^IqwgH5yhZoMUfmCL@RayUItDx}wl#7|`- z^ALYcI}(1@G0h{PJPLOIL7kS5dIRrfQ&#EfFA1iIk3@7EbLCtHd5_)S;gf+6H3SWe zu2=L5P;yt~l1i(){Q-iALz{uKdZ&tQ0THz{HH3RQizF+}=!ATY%3qqwa(~&FuJWTX z`ZJ}nP7znb=X=rnt9T)C++Vk{>^xjeXCZ8J_>0UvoPh7$QVvq-;}m5!(+ixMhKRd1h_0hnBb;gWrI_?hgqE5l{TP`3{g-L!**CxmnC5n1Vh9;Ar{>+#`w7J( ztON8z=D-&P?A(tfhL*D&RAGO;uzik8W{%Q*qzZdX$`5e>a zt_H!X9A|Xwj9H3(lfRfYP(fTL%2_O-Q zXDqU(d3%&63-bi#q&R%DgPX1u5``vNlLRlW&uEKz-pf2LPgj=2j{t!ajw%|B0T*rr zvCBqBXFRb>6~EEDCWA(j#YY%La+|Z0{UI#X8PXNMm6!53aKX0V2Q&km$vf^5z zQH&hBn&p&gM5K<&-!MdnSbEH&ZL4XJe)AY!Q84;DC12fTW0WTVwZaHE2saQ|BrqY! zi5n(P>sDY?Zb5U=m)~q47Ef7;i8J^3{$IsqRwP9}Ht8n(;;uv)Gk458(o_z_FH+cC zzHGh@Eq`IpAHZy>67UAjBnN>G@>5V*0hk&W6^J}eMcOSM67wp(WTIW*yXyNlpmX*u zqOuUi>uZ&LYoVGcIVify5okmBI19pI_n;BZ14+Ir0%L3G5!wl<8(y-XuG$tx66!U6 zRp*bF6CyNdg*$+;;SPG&f&J??NhgTAhgx9y+@kr)#2WP%ZWX8{$5zTds)SA?u`%1> z3M@|Ttw6d=;K@JS^Z*A2@q|PoWS|ZOwqegt+;~*jRQCilH>AKFZ|6{WoKLlT^RCNk zp-M4_2{yiYrdU%zr@G~*2szQ8eak$jvn^V8Fc+%i2PpbWT#TD4_^%>iu~vZi3Y)y+ zgbg$G-3LLb3a(n4XweaLXhI>AuC*3Bq>1?C^&G|nRa9}QZzuy-O6ek$)Lwy9Buc+| z)MY_LBRQZW(6m^|mfd|v<{CQYefnsnWp1~Qwe%T}s8wP2ZC#PpuwJ@pF+-ZYtk>{? z-rMuMONyoH#XR0aIAF$oVJV%#0f~gCXR^@cs=YvnSz4Gqr^Szh=es^;%_qERrb9$% zrCSiNv4LYs)0SWHz#pCn91&OwVQZY;2i4a0+VK6t7b?yx?DJ)&BQrqrLx<{3QB+1s zox76PkPr5V#V2}_CIqm;r7CHC3ZYz`P`MjMa96x|{p{hj_fv;OFz0RVe zI_uJybF@?4-dreh7;E3vM=KsEO1)P8>|?O|xZ1Nvu>8&N&UV-#Srs!Mi{7~_>(IzN z9Eh3wEZcsY3EUzcmT7XY$d@dLMQ>a5y1#E182AFvMTKe-ct5QF#t7iL8#pSK*GZ6$ z!1e_gpjDTEw5Mn)M4?g$0rJzw5|7;(F)3pIQR7Q}=ob1UplNRCIJlW7zrf6UU_av6 z?*Sp>Kl~gQt^Yx9`yr(?qiws_(B{|Qo3AjI94p`#BBhWvsjKFN3CqJoKuDxr^?rHf zHG|jr^AQuO^HYtG6!(6suE4!tLpXVSK$)(?e`*)Z`P>%@lC(YJ!gV^SoN=vyPL;ED z7w;1Gq_*YO@!Y6*RaMFgc>pb``STW8To7dY(Anrn&!66iA-Q~}R`mt(S{yPX8h)w1 zNxg@SbOLB%RfX>55ri}m%*Od55l`xF!p3BDN=Lz;?(c;!FD;`{TFf1bq=ta1kq7E- zHXziqXXr@k?hdpzQIWa`;tTb&?8uEq3x3d6_<3ELFQ^IHQoU;p{Hl(xle>NcBFm)1 zHeUnhLbGgFFm7M9SRvy0Dd~?!9#Jq|3@}y4b+0OC8VckQD*lIivhS8?BH{0 z%vZT^ktnNs15M@2up0>*{zH}s-Ja%0N9Uwp-5xb-3`PE3G5)71^XG@UtLkiROyK|n zD_j#LVGF_}yn5YPbZf(${*dfFIz;l3H>ffW7_j%*ZgQkgGh7)FOP7*sq6AsFYmd^U zRhTkFihLKE6x}R#DLZ{Pufhd^iRY|F_^{hNqI7V>k#tef-5_QfYWa`KY7}obtuYVO zwe9_{1&9$69uke4N35+CX;JQ57AYQ*cIbKmCsi$Q6@lneyf24H1{WJXdF8Y5^dVmq z3OmcM3=SfXnyfDD;}=i{yf_cLAx^_Homm%$;2y!gxP0-@7kIcjxj)mf)xr_>lPQ|Z z^8UAjT_l87#rIQnsa2LEvvu+IEtQdNf^PAxTZP!4YDvOM9TN<=W3@pC{*|^u6^q70`Ey>QAL~7WPV6m31UYh8(kkO;Ljy!eI#! zS*f3#?2y@AS2a`#Nr<~(Be-6>FJt-(cnDCnUW%@~Kl_oMZLj7+yol_f>`Ym=a;o1( zc_F>9GjK*7?HGv1n9*P6z@aD@gL1{I~i6f1#UFbmy8Qb0Gqr;liJg9$DJfcj1ZXgP#p@&?lQ} z%L8=+d`D8SwAy~&s0AlQchLCcrVmo%8<1q?g-ZH0IJSCy*x->cX!HjM}e$z+GD9c^nNwb?r zG9u@{GJy&M1}EpopNsMlZv8Rj&_|g2we(H@K+Av}L;5BQDv_C+N;)U`5cLX(`=pLk z-c3=ReqN2ktKf;Ny(?m5hXYOLnW$>_0&mi%={^dI6^5{Jc7AF7tX>ZBf9!3>zI2Xe zoF@Ciiw}qFFd?Rt68%KFe;mS1nWCDAhf?kHGscJH0>!QNvp;!gP}!AqVLtp8bQu() zlhhD)(O!-1aU8IqaY+O#X;Xn}3Xq=@Uv3aZPj`DkI|phmC;Ps=c=A6$km&Y`jSq$2 zlz6W^LQ(qkK7-$$4#LItqku#&mF0>CDZ-=YA@M=mrQn;ZSgQU~NKNz^I{ZM3OAGVNz9iZcwg5x^ZfN$4Q& zwyf_}tgISZRMR$1w%kfB?Am0;e6zr{cl*>BUoxjzQs_jmcM~sDdH_f{meMeVN?N~W zG|VzL>Jr}KtfPywzY(9suYf7fp`(jQxDBFG^g~fYY3tZ{z4M z{R=etSkh78l7V#vdzX(P<`75Tu$C`F6-EAbx3{cJ4V*KZk@b6vHf*dAjAi2p9$CKr zeTNcctXhEgvIy1Xf`?y zwRL!IE_1~6Mo-Y_=r$2!nVKv%I1ET;z$n@$hQ+or*5-;nUWuvVJ~bDMx!OL9C^yS2 zwP8LXm=oB~YUOq!Z-N}5=@sZPXT>+dMiD|N?W8|%jbFSKfO9dK_{|#jmy*5?SR!R) z5H#V?CwwB1t#?MdOz*J%uAf56F&ic^vKXBP=GR!6%qtWm90r3&9Yb%iBK~^)ERye+ z?fnVTX{PkcM4?q4Uc|O#Yr)+4qZZpM{NmPTL$c)8yw{MPZL|RA8WuCE32L0zYGf@C zrS2U)=0!p{v0xEkl+}0r7-FRu@5*u%j2tHea0CkD#VBRV%*4#3@OZn9EWPA(b5H4|Cht5p5_FJDaTOGVV2KMfv68ySe}7de(94 zh`(tV7|&Xmyt)Ns1ZF6#S{R8Xu$;n1kt|*2QhN_g&nW<;e`ks^CcP-Vnbt?>bzQIs zhc#Av;^U$RV~ZJFib2tz&%aH9-|Nxx_%%QaAMvgqtfzR-B>QH&$T<^98Y$B5{8SGB zEckp99yH{rnUpjDft$f%K^k(ghntXrY+HoxtGy=|18jC;)=7CE{*Cst*xSQT<`tW; z=E8H=VBT*MtcOHFt8Xu%1-<;(rohKaO-9;V+1!1oxCM(VLP0S|DBCAS_PDUo@?fCyzbcc{%)vovmB z>c$|obXV<^XRdQkx%r#>K&JXWzJ8tFS%Bo!i)-Teee-$eyw0~LcL^23%Zn&8k_FG+ z_Ta9?&}B6mRmn@5p3679x*ou|2I-B!0@(8v3eF@R?*0p+nq*OATxxT1m{34vT`-9H z5h%`mf;s0y0ejGBUr_2i`W>NCp7~#^^+cq|@NIF8lDeuE$aN|~mKKwl_r%s1A((hI z4hC*7BZ@gy^n)2?r!N`$1*p87;Tornn`(tS^b2=%_6Ef^yIr;E1G&yiTb8>9pVhvm zh2LCy^+akwnm4{w~Bv+n5%&mNqJ?Wp=$&l=!Y6;9VZ#x376?` zNXMbV?$f=YPY2mt+B3yr)ZoeWcXgtIXy+L*jvmq8lrSfD#{uYGei-85yoJa!O@Y*B zajo;>y!h*27XYbfu+uHq9y;?Em!&G!X~uX}+o~flN-kp-!`B1Fa;4$?W_);!C z9*?i3pol@2UW+qo)#RM{Xc_l72n7fw2##l<$f_E1(csamUu*TgQ$2|c(RIDag*9$*0@Ns#5PjD_ zdh6^d8VV@da5IiS1z!G&an{21 zwr5Sb1L2oad11z61|9$?mBm?L?O$AXgcY~BgHd=UIQW-+EbQY>5rIi_F847)NVQ!R zN;PQ%a{xji8?R$*Gre1TQ$Iv|T@#)NBqt;L@ zI{wP+{iEz@e?_SVX?~=bCxWKfcSpk4s4@0FqxR5i^cp0WaQ6n8I51>_PyT z`fedk*Yq<4!+qx@Z^B2px#38Xo5NQlLAn>6v`?KG@~6X_Z=L$JhU~$UkFI9oGR#Ge z1{Hc%WiCLAI3F)VA&xrt7(X@SNv$d4=);bNJMP_YbLQxSD2S{8i;HWA7AIVLlYY2n zGLh#7hq=IC)}C;ebzLptFBygN_t3vvjJVpkMmPK0B#g1^jTfayJt4x8l?oL95MsPqK@Nfh z8$>^kuSgY~D6cfM`7F>`T6fyRp3!8~;tP$6E~%dl4rU#-V~%<50OL-q{tauzY13dN8IsxowbL;PQ5Wls$)?nGF)W`B{PpAH> z5J}d>On`pl;|M?+#Nn#s(h-j-P@RGP9(f(Q`SR{^7+S<;7g9Rd^MqeL?{bCYUzQ;e zoAZ2WN=BKTJmZt>%p-l?5X`{rmr}~%if!Ug{>H>;C`)toB zCbYSHp z*ni;rH(dBo%kgc!f4k#IS0K`x>^{#%b$CsR)`XS$RW_YeV6rNRJyNBM=`bz*u3W+R zY{nM(NSZKuALklwQ9uc?c1(Ol0A@xv(N(gafl-)U{0VA<{i2s{cGK1btFW*qJ{jS2 zK-|%N%P#zYf_P@M#I;p+C=V6G8bC@dKh(mJ7mix1_ykMqT~nd8c=R5uL=rt)Lkmbk ze0n0!?Rn0AWlfFmUZj>mSfa4E=Hn}OhkukDB4M!HuS4mm_)Tj0h3>*`FJ4qfh;B4- z22fO}qmu2~`RAO}M+24gB*afHBLvbI7dgFapL@u;U+jDot!n{84hVfjs8IguowP`t z{OD!`IiSZpJ&=J!N8!9^xDhms#qwiw@3qslvfGA72;0}+hXhp@^{A~q5hxoGiLwst zKl3l`4da6bu{!#1n+Q=U4eR0g*x}%AXxyKMQ7DDnHKtATZ8~(!5+sM>9H!8_F{(oB zm>^W2`!~8NsjFRtaA}EhIStYo=)Qbsg2>yewA_u(on%%5my*`DAj*@8UG<%7{cx5i z;~oz^VxWg~m9gf(HDHuf)z2H5leH5nLIa4(b969}vOzJ#2zzrq8O3=Yt;qCbq8md_ z02a37P~8FB*J~?fLdxAKrJ30B zEEuj6%e2|EIAJx02r;vsluY&VICkpLHe#m=bWY7ng4dvf%T!VyneJcm&ECie!o^Zt z!4Sxek|xS0+{TYIa)nbfD8f3sFUXzS*lc=F(y_)*YP4%Rd?Nec>rlz2V}9~MwvptK zuI9ME$OPL_M)ZHTu|&*)x=B6LyDeD1Lrh;Gc-!x|gn3CGP-Dzb`fO&gYI zfMn9dSCkvcx`!0;%YqWri|x?hK)v5O_C17Pmsog-f7k%13Ym+_h4(ck zEm|5hOjU&1tTL9e_XLi8P8B94=of4{a)RaZraR-p!DUMo+IX-;aa??|%o$VZVVlhV ztdw}jE`a~J&R=JWy}W8ri78qxx#Uv8?HDu9Jy`WCwto7{S)Me{?!0Z}-Tkiz^Ss%M zc6;zm=g93@J?|Pi@3Xe(C*&e_OG1NdD`G-UUpA)$*yMPfF3~%xk*rx(ay8YDzb+nBsZxf;odQ~Dr$}m{3$=-nQca@Bs4ZeOn#+rk$qg}V*oksZ1>Z%x$M94b z$eXjo{v;OCl3^Bebca%MT;h=<_U15mh6@bPD%^0S@*+b=IcP19+hXo-pj@g1UGNwC za4W?jH=X9rAUmI@Ud@BXr-EQ@tCT9hbt*_Gq4^83HY!6EN^k`C&!HBbG2mXfa9LoN zI>w?V$$5g%!qfI7c^;;Ts8@&2@|gNbk8bEg2fUk{wII|Q$WrBGhN?x3$Z?hmGjGJv zs9_Amw)g<;wF{z|VFnD_%Ho@df%uPtFC|FKbeU&kpPRHg7piKG#+Ld!wxMLznQ%e& zrJf=frY4g)e~bIg!TbtLcZT>XzU$U|U;64wLJ>qL@Yy(_ch#_f0syy;!5j1^WTcdZZJWtzWT(0z zB+?sa@y&4iZrEsfzlDPIf^1TDpq!*YxVk?V8gg!fFg=qi3FI`M^N))+y?Gyz1~zve zieZ;(TpHa0K>Ow6moC1y(4Q;m%NMcfzV9PekUURZg@JR*EGR5K+S41@;<&Uij}@x$ z=1HCd6kbSL`*i`Yl&CkE-0_EdAKn*LH7}B;qV_Z?8tePSf%c;y@T-F~)#;FNu}uiw z-5keCBVBJKi-z<&pphbMKNO#|1=(>QwVR`tYg_qYBh@RkjbPw0KM~?DF*&5KcNHl+ zRrxyJMv%#C%RT9(L6@Yw!oT08g-+yA>*dAX#N;F=63K@xy>>uBHKbP z1#jke4RXYORyN7I%*NpYrcH{4uT zO@p~-i2UjUtn6&1XI}2-%Ud%`-DXY7B2lk_YF`1~&Sv>2(A}tdfkU7|&kS!buXIT+2O?PqqGNYrcvbM3`R8H6wS$~PK=+=$6()!OaE?ksi z0@_!>DyU*9t4VTV^y5tqy7&IRh(SnVVuR??laRYEU|t4?l$jFAK-^gl9G)FO|vf zK)uKrVq<9(5GL9)C_L7=em?8eKr7dQ09U>8I3xT=N|$0GtRQL+5Z;wK1`&V9mU_3y z(#BUc4Nbpquy1GlT7OA{qT5?>6{JU8j3`7nQ2zPb0VQ$D!C&e;5&c{G(;?WDrM^@< zlnaTU+_Unj!?LE#GPea_MbK7EDZnKU+q5^MoX4FL$aU0A&vzH)C1#MNP6~{58;gq# zC*ID4yit!1>FOrJa~l<8C#qO8}o=iS`?M=xvmk|{6l#|?8W3T+2wcv54{`BQXqiHo@bC?K0=ayk*%@Frnw0L?1a4)+$4= zK3_&`Ex;ni$2v&Zlp-!sc6eQqJ3c|fOv8JW5&)|n^kG{*eSpw@Yo^Rrw2<_R#=f*l zJ;bFno62#s*3}RzW1E}1K05V;yR0;se(`KfKM2v|Xaro31z<)~$EwOE@9rSCF(Fc0 z!PHU;E#iC#*)A`OagNJ~aU{9-bvo==nz)#&dbyp*9by#}Ug}qiUCJXVjQq#6KI+;LM#AhLe-J+OL{pnEs}Co>Gp^J$R3o7Qe^Sm>4?ss1PsX)%Kj+%rRG z2!2&l;xYlQo3G11JF{3iP-#eUW)nDIn4L)P85BNbx>53b8RreU@zZ*4;IQP6$s|gv z-tW6!W$YDPUcf$Wu4FT||I5q(7@J)bMO32L?8`@;D6}frWQ~?-pL!+|=gEJ!t8n7m zf@7!5<>OuDw^pvEuj%e;9DJ%UXqFTm>*LVsnJ$l3hWVUheyC^sCJVwOWRMW|ehQ)BSeZj)*r=wH^H zL5en9&+Bg1f}JV$IA5E`EjEW+N{_|zqBVfm`*nDcH6$iocKI{vla*h6vKRf`t_MZl zytDrp-JCwsMq4gSW)cFvDE%+2rj}d5&5MUUumUO=yk(!)q-kT_+b7MuKRE6)(}Wnx zeZ*dIpCis(EDbrO;T2%B*o*55BUGW?o$2{=&L$IOO)C{ki4%p~j-JztsZqa<>sp4q z*3M3u;GiP5J)JW!tH+M`u%3VCz)6Ti_+3BFDj3~J+cf{s8C**HrZVslkua0Y>KSf& z9B}}297(>{ISeyNdH8 zW1?fY&g{wKN1L_@QcpsPV9?@&Z@qKyr>GMH9BVeq_ z+!JW6bY3i?5@$%(jXK$^E*r{uaIOKRTPy@}rx zr{lmJLH-uXlhUhg-#Mv2p=P4fBo&i@bj441h}+e@<>?_DC{;rPLtgmA)xKnW=O1Ro z@v%dnJKe06cO(o@Gk)tz3?MAN^qd!4jl3PX^*qxBJ4yK(H{tdwqkmt85WC%PF^x=(98AOIWJRcs9Sej%MGyoJwj z>_4ohR>h#))X3U6#jb#J$sv@k_(^^bdmL@dKCWCc3D6keTvKuVVWy~~%gc>r1|%X5 z7?t{9n2j&On|q#w?8H5QY4g%)g;NnocQjQPViUR1; z4?7PaoiV-YIqgFy1VV=WI9)u*G(zzSR~Fn=Qi$;BfZ`RgcCmtu?STF3 z(l*reu`)38YAOcv7!!^murBX9WWWTqaJGxPRUU{P5wKLNU_@NrHNzoLQOn#<{{a(|XWijGxD@|i}*QTpj;C!I=nkp#>G7T=8e z7K{yx&gy!AUJE^}cY;f(JK(mm==QA{f1+(XsFM#By>TJwj?1U$OW$GY+DRY=k%*L7 zq%a>Pp;6Bv5R`kmUWPVnStl-X@2B)FmEES`qJRUWPO*6|Q2Y-~qwV1ZqhnEXY!pAn zi)%+MBc9FKvEp1eQIiF`F@JZ#jh__HInn+@3LGf$4byhe&YVsOOKmPmJw*-I9RnZ( zzSHz{1P()Hg=pSkTI!QwbEQ*)dx>A$xgWfYsdU_G!_dirSIG0BMI0UUGBI(GLK8e+ z(k4cE%jz}<$LfE+Fw`#m06mCTDwMmXfD5Jku{c@nxsKJBdYmU?5LKkb`Q>YBMuTP! zi$EH}vnpn8-$y~Amvb~HL(!RvF2o3uA$1J&rfYoMILK#)-6!;R_i#i51gLFT>n7{~ zJ&FKbaRhWA=vk0O7qSP@cS|OGS8ok~ z3h+O?%5ou&bps{5X2wW#Qcov$P3kvw8ubJ-h!d@oiEk=>z;U#74XgX~D`F%z26|lz zKn^oBtEK>^V((;eDDkOzn@ja$)#=;7K~#g*o?oRz6pAnQxGcuQCx2gF z3O;R@`B@hO>~Y>iFyS(!#r-xmcYC41&zMHX2_+!!W{?2NW`mB)dKGeD$^j#k;SaGB z-flyK?+TglEMauat<7{3AC!`gji$(E5vc_1JFNtpGmE1TBGX0Y)^AkhGZg@ODA^m* z7$4-GC3>pYH9Q#SH0T(Hf2ioR5DZ0F(C-6)QxsqSsQ?-S`Lqs$c&XGRU>_NC>z;2k zuBX8NMDvb!G7rs<55EMk#OzFS0OMDfJ%0$DFJ)uF81rONr|`ddYfBi*^3laRz2IJ| zJ_q-p9l8nvkAWk-Wiq4-@%njD9Y;*u}K;#Lf?Zjdx-zvYj2G2L!Ao8cX(a%}FRp*&PILYR}Os)P_ z?s>{Bs@JL%T5W7zoEaL7sFobE8mgPgdcDdif<{JG1Ka!YtH>;=H9r z^eM)Ssj>yOeKcCc-QZu9{_***LC{dGZr5;z#4rseTLT0%J)s>f#jOY)cR7nC+px5c zJtWVBM`iRU(b$!{dYREQc{&FB#(4CD+W>NG6&=L(Y-K8xG26{Wfp3(kBH*0h-OQMk zNDCkY0*?<#xEQdSaLM?39^b75#uv&z!+XhY^Rk=`E;qrjEJ@i(F^=krkW+#X2vY4k zi9_9ng7W>3RP;MDV;cRi*2-Wh%7_|4lmJ06n0@`0f)- z!J4O}ISUh0{-ixfjzljW^N2oAerVf=C$&r2YJ4 zs8%^h?oniUe{HZiO5Eloh4t|YN)L|M2a=XB;G`nZ=5}YzNc>6u(kh@GlXMZ{)NUE?@hiO-v^u(w)II#>ub1LCX zOit=WBS3nEw7~|cHDd>E*5kO_{2;PdyS%rJOBUy1{WGY jy?=t{1&d)~!<8h^RsaA100000000000000000000NiJay literal 0 HcmV?d00001 diff --git a/src/components/CampusMap.vue b/src/components/CampusMap.vue index a827a14..44f30df 100644 --- a/src/components/CampusMap.vue +++ b/src/components/CampusMap.vue @@ -1,277 +1,729 @@ - \ No newline at end of file + diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue index 4eff0e2..49ee086 100644 --- a/src/components/HelloWorld.vue +++ b/src/components/HelloWorld.vue @@ -1,59 +1,116 @@