aframe-vartiste-toolkit
Version:
Toolkit to create GUI similar to VARTISTE
2 lines • 72 kB
JavaScript
/*! For license information please see 676.vartiste-toolkit.js.LICENSE.txt */
"use strict";(self.webpackChunkvartiste=self.webpackChunkvartiste||[]).push([[676],{6676:(e,t,n)=>{n.r(t),n.d(t,{FBXLoader:()=>Tn});var r={};n.r(r),n.d(r,{AsyncCompress:()=>Me,AsyncDecompress:()=>Ke,AsyncDeflate:()=>ke,AsyncGunzip:()=>Oe,AsyncGzip:()=>Me,AsyncInflate:()=>Se,AsyncUnzipInflate:()=>It,AsyncUnzlib:()=>We,AsyncZipDeflate:()=>vt,AsyncZlib:()=>je,Compress:()=>Le,DecodeUTF8:()=>nt,Decompress:()=>Ze,Deflate:()=>Te,EncodeUTF8:()=>rt,Gunzip:()=>Ne,Gzip:()=>Le,Inflate:()=>Ee,Unzip:()=>xt,UnzipInflate:()=>bt,UnzipPassThrough:()=>wt,Unzlib:()=>Xe,Zip:()=>gt,ZipDeflate:()=>dt,ZipPassThrough:()=>pt,Zlib:()=>Ue,compress:()=>Fe,compressSync:()=>Re,decompress:()=>Ye,decompressSync:()=>qe,deflate:()=>Ae,deflateSync:()=>De,gunzip:()=>Be,gunzipSync:()=>ze,gzip:()=>Fe,gzipSync:()=>Re,inflate:()=>Pe,inflateSync:()=>Ce,strFromU8:()=>ot,strToU8:()=>it,unzip:()=>Tt,unzipSync:()=>kt,unzlib:()=>He,unzlibSync:()=>_e,zip:()=>mt,zipSync:()=>yt,zlib:()=>Ve,zlibSync:()=>Ge});var i={},o=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},a=function(e){return new Worker(e)};try{URL.revokeObjectURL(o(""))}catch(e){o=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},a=function(e){return new Worker(e,{type:"module"})}}var s=Uint8Array,c=Uint16Array,l=Uint32Array,u=new s([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),h=new s([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),f=new s([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),p=function(e,t){for(var n=new c(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new l(n[30]);for(r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return[n,i]},d=p(u,2),v=d[0],g=d[1];v[28]=258,g[258]=28;for(var m=p(h,0),y=m[0],w=m[1],b=new c(32768),I=0;I<32768;++I){var x=(43690&I)>>>1|(21845&I)<<1;x=(61680&(x=(52428&x)>>>2|(13107&x)<<2))>>>4|(3855&x)<<4,b[I]=((65280&x)>>>8|(255&x)<<8)>>>1}var T=function(e,t,n){for(var r=e.length,i=0,o=new c(t);i<r;++i)++o[e[i]-1];var a,s=new c(t);for(i=0;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;if(n){a=new c(1<<t);var l=15-t;for(i=0;i<r;++i)if(e[i])for(var u=i<<4|e[i],h=t-e[i],f=s[e[i]-1]++<<h,p=f|(1<<h)-1;f<=p;++f)a[b[f]>>>l]=u}else for(a=new c(r),i=0;i<r;++i)e[i]&&(a[i]=b[s[e[i]-1]++]>>>15-e[i]);return a},k=new s(288);for(I=0;I<144;++I)k[I]=8;for(I=144;I<256;++I)k[I]=9;for(I=256;I<280;++I)k[I]=7;for(I=280;I<288;++I)k[I]=8;var A=new s(32);for(I=0;I<32;++I)A[I]=5;var D=T(k,9,0),E=T(k,9,1),S=T(A,5,0),P=T(A,5,1),C=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},L=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&n},M=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},F=function(e){return(e/8|0)+(7&e&&1)},R=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof c?c:e instanceof l?l:s)(n-t);return r.set(e.subarray(t,n)),r},N=function(e,t,n){var r=e.length;if(!r||n&&!n.l&&r<5)return t||new s(0);var i=!t||n,o=!n||n.i;n||(n={}),t||(t=new s(3*r));var a=function(e){var n=t.length;if(e>n){var r=new s(Math.max(2*n,e));r.set(t),t=r}},c=n.f||0,l=n.p||0,p=n.b||0,d=n.l,g=n.d,m=n.m,w=n.n,b=8*r;do{if(!d){n.f=c=L(e,l,1);var I=L(e,l+1,3);if(l+=3,!I){var x=e[(V=F(l)+4)-4]|e[V-3]<<8,k=V+x;if(k>r){if(o)throw"unexpected EOF";break}i&&a(p+x),t.set(e.subarray(V,k),p),n.b=p+=x,n.p=l=8*k;continue}if(1==I)d=E,g=P,m=9,w=5;else{if(2!=I)throw"invalid block type";var A=L(e,l,31)+257,D=L(e,l+10,15)+4,S=A+L(e,l+5,31)+1;l+=14;for(var N=new s(S),O=new s(19),B=0;B<D;++B)O[f[B]]=L(e,l+3*B,7);l+=3*D;var z=C(O),U=(1<<z)-1,j=T(O,z,1);for(B=0;B<S;){var V,G=j[L(e,l,U)];if(l+=15&G,(V=G>>>4)<16)N[B++]=V;else{var X=0,W=0;for(16==V?(W=3+L(e,l,3),l+=2,X=N[B-1]):17==V?(W=3+L(e,l,7),l+=3):18==V&&(W=11+L(e,l,127),l+=7);W--;)N[B++]=X}}var H=N.subarray(0,A),_=N.subarray(A);m=C(H),w=C(_),d=T(H,m,1),g=T(_,w,1)}if(l>b){if(o)throw"unexpected EOF";break}}i&&a(p+131072);for(var Z=(1<<m)-1,K=(1<<w)-1,Y=l;;Y=l){var q=(X=d[M(e,l)&Z])>>>4;if((l+=15&X)>b){if(o)throw"unexpected EOF";break}if(!X)throw"invalid length/literal";if(q<256)t[p++]=q;else{if(256==q){Y=l,d=null;break}var $=q-254;if(q>264){var Q=u[B=q-257];$=L(e,l,(1<<Q)-1)+v[B],l+=Q}var J=g[M(e,l)&K],ee=J>>>4;if(!J)throw"invalid distance";l+=15&J;_=y[ee];if(ee>3){Q=h[ee];_+=M(e,l)&(1<<Q)-1,l+=Q}if(l>b){if(o)throw"unexpected EOF";break}i&&a(p+131072);for(var te=p+$;p<te;p+=4)t[p]=t[p-_],t[p+1]=t[p+1-_],t[p+2]=t[p+2-_],t[p+3]=t[p+3-_];p=te}}n.l=d,n.p=Y,n.b=p,d&&(c=1,n.m=m,n.d=g,n.n=w)}while(!c);return p==t.length?t:R(t,0,p)},O=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>>8},B=function(e,t,n){n<<=7&t;var r=t/8|0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},z=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,o=n.slice();if(!i)return[H,0];if(1==i){var a=new s(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var l=n[0],u=n[1],h=0,f=1,p=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};f!=i-1;)l=n[n[h].f<n[p].f?h++:p++],u=n[h!=f&&n[h].f<n[p].f?h++:p++],n[f++]={s:-1,f:l.f+u.f,l,r:u};var d=o[0].s;for(r=1;r<i;++r)o[r].s>d&&(d=o[r].s);var v=new c(d+1),g=U(n[f-1],v,0);if(g>t){r=0;var m=0,y=g-t,w=1<<y;for(o.sort((function(e,t){return v[t.s]-v[e.s]||e.f-t.f}));r<i;++r){var b=o[r].s;if(!(v[b]>t))break;m+=w-(1<<g-v[b]),v[b]=t}for(m>>>=y;m>0;){var I=o[r].s;v[I]<t?m-=1<<t-v[I]++-1:++r}for(;r>=0&&m;--r){var x=o[r].s;v[x]==t&&(--v[x],++m)}g=t}return[new s(v),g]},U=function(e,t,n){return-1==e.s?Math.max(U(e.l,t,n+1),U(e.r,t,n+1)):t[e.s]=n},j=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new c(++t),r=0,i=e[0],o=1,a=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(i),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(i);o=1,i=e[s]}return[n.subarray(0,r),t]},V=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},G=function(e,t,n){var r=n.length,i=F(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o<r;++o)e[i+o+4]=n[o];return 8*(i+4+r)},X=function(e,t,n,r,i,o,a,s,l,p,d){O(t,d++,n),++i[256];for(var v=z(i,15),g=v[0],m=v[1],y=z(o,15),w=y[0],b=y[1],I=j(g),x=I[0],E=I[1],P=j(w),C=P[0],L=P[1],M=new c(19),F=0;F<x.length;++F)M[31&x[F]]++;for(F=0;F<C.length;++F)M[31&C[F]]++;for(var R=z(M,7),N=R[0],U=R[1],X=19;X>4&&!N[f[X-1]];--X);var W,H,_,Z,K=p+5<<3,Y=V(i,k)+V(o,A)+a,q=V(i,g)+V(o,w)+a+14+3*X+V(M,N)+(2*M[16]+3*M[17]+7*M[18]);if(K<=Y&&K<=q)return G(t,d,e.subarray(l,l+p));if(O(t,d,1+(q<Y)),d+=2,q<Y){W=T(g,m,0),H=g,_=T(w,b,0),Z=w;var $=T(N,U,0);O(t,d,E-257),O(t,d+5,L-1),O(t,d+10,X-4),d+=14;for(F=0;F<X;++F)O(t,d+3*F,N[f[F]]);d+=3*X;for(var Q=[x,C],J=0;J<2;++J){var ee=Q[J];for(F=0;F<ee.length;++F){var te=31&ee[F];O(t,d,$[te]),d+=N[te],te>15&&(O(t,d,ee[F]>>>5&127),d+=ee[F]>>>12)}}}else W=D,H=k,_=S,Z=A;for(F=0;F<s;++F)if(r[F]>255){te=r[F]>>>18&31;B(t,d,W[te+257]),d+=H[te+257],te>7&&(O(t,d,r[F]>>>23&31),d+=u[te]);var ne=31&r[F];B(t,d,_[ne]),d+=Z[ne],ne>3&&(B(t,d,r[F]>>>5&8191),d+=h[ne])}else B(t,d,W[r[F]]),d+=H[r[F]];return B(t,d,W[256]),d+H[256]},W=new l([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),H=new s(0),_=function(e,t,n,r,i,o){var a=e.length,f=new s(r+a+5*(1+Math.ceil(a/7e3))+i),p=f.subarray(r,f.length-i),d=0;if(!t||a<8)for(var v=0;v<=a;v+=65535){var m=v+65535;m<a?d=G(p,d,e.subarray(v,m)):(p[v]=o,d=G(p,d,e.subarray(v,a)))}else{for(var y=W[t-1],b=y>>>13,I=8191&y,x=(1<<n)-1,T=new c(32768),k=new c(x+1),A=Math.ceil(n/3),D=2*A,E=function(t){return(e[t]^e[t+1]<<A^e[t+2]<<D)&x},S=new l(25e3),P=new c(288),C=new c(32),L=0,M=0,N=(v=0,0),O=0,B=0;v<a;++v){var z=E(v),U=32767&v,j=k[z];if(T[U]=j,k[z]=U,O<=v){var V=a-v;if((L>7e3||N>24576)&&V>423){d=X(e,p,0,S,P,C,M,N,B,v-B,d),N=L=M=0,B=v;for(var _=0;_<286;++_)P[_]=0;for(_=0;_<30;++_)C[_]=0}var Z=2,K=0,Y=I,q=U-j&32767;if(V>2&&z==E(v-q))for(var $=Math.min(b,V)-1,Q=Math.min(32767,v),J=Math.min(258,V);q<=Q&&--Y&&U!=j;){if(e[v+Z]==e[v+Z-q]){for(var ee=0;ee<J&&e[v+ee]==e[v+ee-q];++ee);if(ee>Z){if(Z=ee,K=q,ee>$)break;var te=Math.min(q,ee-2),ne=0;for(_=0;_<te;++_){var re=v-q+_+32768&32767,ie=re-T[re]+32768&32767;ie>ne&&(ne=ie,j=re)}}}q+=(U=j)-(j=T[U])+32768&32767}if(K){S[N++]=268435456|g[Z]<<18|w[K];var oe=31&g[Z],ae=31&w[K];M+=u[oe]+h[ae],++P[257+oe],++C[ae],O=v+Z,++L}else S[N++]=e[v],++P[e[v]]}}d=X(e,p,o,S,P,C,M,N,B,v-B,d),!o&&7&d&&(d=G(p,d+1,H))}return R(f,0,r+F(d)+i)},Z=function(){for(var e=new l(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),K=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=Z[255&n^t[r]]^n>>>8;e=n},d:function(){return~e}}},Y=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,o=n.length,a=0;a!=o;){for(var s=Math.min(a+2655,o);a<s;++a)i+=r+=n[a];r=(65535&r)+15*(r>>16),i=(65535&i)+15*(i>>16)}e=r,t=i},d:function(){return(255&(e%=65521))<<24|e>>>8<<16|(255&(t%=65521))<<8|t>>>8}}},q=function(e,t,n,r,i){return _(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!i)},$=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},Q=function(e,t,n){for(var r=e(),i=e.toString(),o=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/ /g,"").split(","),a=0;a<r.length;++a){var s=r[a],c=o[a];if("function"==typeof s){t+=";"+c+"=";var l=s.toString();if(s.prototype)if(-1!=l.indexOf("[native code]")){var u=l.indexOf(" ",8)+1;t+=l.slice(u,l.indexOf("(",u))}else for(var h in t+=l,s.prototype)t+=";"+c+".prototype."+h+"="+s.prototype[h].toString();else t+=l}else n[c]=s}return[t,n]},J=[],ee=function(e,t,n,r){var u;if(!J[n]){for(var h="",f={},p=e.length-1,d=0;d<p;++d)h=(u=Q(e[d],h,f))[0],f=u[1];J[n]=Q(e[p],h,f)}var v=$({},J[n][1]);return function(e,t,n,r,s){var c=a(i[t]||(i[t]=o(e)));return c.onerror=function(e){return s(e.error,null)},c.onmessage=function(e){return s(null,e.data)},c.postMessage(n,r),c}(J[n][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",n,v,function(e){var t=[];for(var n in e)(e[n]instanceof s||e[n]instanceof c||e[n]instanceof l)&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t}(v),r)},te=function(){return[s,c,l,u,h,f,v,y,E,P,b,T,C,L,M,F,R,N,Ce,se,ce]},ne=function(){return[s,c,l,u,h,f,g,w,D,k,S,A,b,W,H,T,O,B,z,U,j,V,G,X,F,R,_,q,De,se]},re=function(){return[ge,we,ve,K,Z]},ie=function(){return[me,ye]},oe=function(){return[be,ve,Y]},ae=function(){return[Ie]},se=function(e){return postMessage(e,[e.buffer])},ce=function(e){return e&&e.size&&new s(e.size)},le=function(e,t,n,r,i,o){var a=ee(n,r,i,(function(e,t){a.terminate(),o(e,t)}));return a.postMessage([e,t],t.consume?[e.buffer]:[]),function(){a.terminate()}},ue=function(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){return e.push(t.data[0],t.data[1])}},he=function(e,t,n,r,i){var o,a=ee(e,r,i,(function(e,n){e?(a.terminate(),t.ondata.call(t,e)):(n[1]&&a.terminate(),t.ondata.call(t,e,n[0],n[1]))}));a.postMessage(n),t.push=function(e,n){if(o)throw"stream finished";if(!t.ondata)throw"no stream handler";a.postMessage([e,o=n],[e.buffer])},t.terminate=function(){a.terminate()}},fe=function(e,t){return e[t]|e[t+1]<<8},pe=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},de=function(e,t){return pe(e,t)+4294967296*pe(e,t+4)},ve=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},ge=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&ve(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},me=function(e){if(31!=e[0]||139!=e[1]||8!=e[2])throw"invalid gzip data";var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(2&t)},ye=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},we=function(e){return 10+(e.filename&&e.filename.length+1||0)},be=function(e,t){var n=t.level,r=0==n?0:n<6?1:9==n?3:2;e[0]=120,e[1]=r<<6|(r?32-2*r:1)},Ie=function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"};function xe(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var Te=function(){function e(e,t){t||"function"!=typeof e||(t=e,e={}),this.ondata=t,this.o=e||{}}return e.prototype.p=function(e,t){this.ondata(q(e,this.o,0,0,!t),t)},e.prototype.push=function(e,t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=t,this.p(e,t||!1)},e}(),ke=function(){return function(e,t){he([ne,function(){return[ue,Te]}],this,xe.call(this,e,t),(function(e){var t=new Te(e.data);onmessage=ue(t)}),6)}}();function Ae(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return le(e,t,[ne],(function(e){return se(De(e.data[0],e.data[1]))}),0,n)}function De(e,t){return q(e,t||{},0,0)}var Ee=function(){function e(e){this.s={},this.p=new s(0),this.ondata=e}return e.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,n=new s(t+e.length);n.set(this.p),n.set(e,t),this.p=n},e.prototype.c=function(e){this.d=this.s.i=e||!1;var t=this.s.b,n=N(this.p,this.o,this.s);this.ondata(R(n,t,this.s.b),this.d),this.o=R(n,this.s.b-32768),this.s.b=this.o.length,this.p=R(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),Se=function(){return function(e){this.ondata=e,he([te,function(){return[ue,Ee]}],this,0,(function(){var e=new Ee;onmessage=ue(e)}),7)}}();function Pe(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return le(e,t,[te],(function(e){return se(Ce(e.data[0],ce(e.data[1])))}),1,n)}function Ce(e,t){return N(e,t)}var Le=function(){function e(e,t){this.c=K(),this.l=0,this.v=1,Te.call(this,e,t)}return e.prototype.push=function(e,t){Te.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length;var n=q(e,this.o,this.v&&we(this.o),t&&8,!t);this.v&&(ge(n,this.o),this.v=0),t&&(ve(n,n.length-8,this.c.d()),ve(n,n.length-4,this.l)),this.ondata(n,t)},e}(),Me=function(){return function(e,t){he([ne,re,function(){return[ue,Te,Le]}],this,xe.call(this,e,t),(function(e){var t=new Le(e.data);onmessage=ue(t)}),8)}}();function Fe(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return le(e,t,[ne,re,function(){return[Re]}],(function(e){return se(Re(e.data[0],e.data[1]))}),2,n)}function Re(e,t){t||(t={});var n=K(),r=e.length;n.p(e);var i=q(e,t,we(t),8),o=i.length;return ge(i,t),ve(i,o-8,n.d()),ve(i,o-4,r),i}var Ne=function(){function e(e){this.v=1,Ee.call(this,e)}return e.prototype.push=function(e,t){if(Ee.prototype.e.call(this,e),this.v){var n=this.p.length>3?me(this.p):4;if(n>=this.p.length&&!t)return;this.p=this.p.subarray(n),this.v=0}if(t){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}Ee.prototype.c.call(this,t)},e}(),Oe=function(){return function(e){this.ondata=e,he([te,ie,function(){return[ue,Ee,Ne]}],this,0,(function(){var e=new Ne;onmessage=ue(e)}),9)}}();function Be(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return le(e,t,[te,ie,function(){return[ze]}],(function(e){return se(ze(e.data[0]))}),3,n)}function ze(e,t){return N(e.subarray(me(e),-8),t||new s(ye(e)))}var Ue=function(){function e(e,t){this.c=Y(),this.v=1,Te.call(this,e,t)}return e.prototype.push=function(e,t){Te.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e);var n=q(e,this.o,this.v&&2,t&&4,!t);this.v&&(be(n,this.o),this.v=0),t&&ve(n,n.length-4,this.c.d()),this.ondata(n,t)},e}(),je=function(){return function(e,t){he([ne,oe,function(){return[ue,Te,Ue]}],this,xe.call(this,e,t),(function(e){var t=new Ue(e.data);onmessage=ue(t)}),10)}}();function Ve(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return le(e,t,[ne,oe,function(){return[Ge]}],(function(e){return se(Ge(e.data[0],e.data[1]))}),4,n)}function Ge(e,t){t||(t={});var n=Y();n.p(e);var r=q(e,t,2,4);return be(r,t),ve(r,r.length-4,n.d()),r}var Xe=function(){function e(e){this.v=1,Ee.call(this,e)}return e.prototype.push=function(e,t){if(Ee.prototype.e.call(this,e),this.v){if(this.p.length<2&&!t)return;this.p=this.p.subarray(2),this.v=0}if(t){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}Ee.prototype.c.call(this,t)},e}(),We=function(){return function(e){this.ondata=e,he([te,ae,function(){return[ue,Ee,Xe]}],this,0,(function(){var e=new Xe;onmessage=ue(e)}),11)}}();function He(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return le(e,t,[te,ae,function(){return[_e]}],(function(e){return se(_e(e.data[0],ce(e.data[1])))}),5,n)}function _e(e,t){return N((Ie(e),e.subarray(2,-4)),t)}var Ze=function(){function e(e){this.G=Ne,this.I=Ee,this.Z=Xe,this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var n=new s(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length)}else this.p=e;if(this.p.length>2){var r=this,i=function(){r.ondata.apply(r,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(i):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(i):new this.Z(i),this.s.push(this.p,t),this.p=null}}},e}(),Ke=function(){function e(e){this.G=Oe,this.I=Se,this.Z=We,this.ondata=e}return e.prototype.push=function(e,t){Ze.prototype.push.call(this,e,t)},e}();function Ye(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return 31==e[0]&&139==e[1]&&8==e[2]?Be(e,t,n):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?Pe(e,t,n):He(e,t,n)}function qe(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?ze(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?Ce(e,t):_e(e,t)}var $e=function(e,t,n,r){for(var i in e){var o=e[i],a=t+i;o instanceof s?n[a]=[o,r]:Array.isArray(o)?n[a]=[o[0],$(r,o[1])]:$e(o,a+"/",n,r)}},Qe="undefined"!=typeof TextEncoder&&new TextEncoder,Je="undefined"!=typeof TextDecoder&&new TextDecoder,et=0;try{Je.decode(H,{stream:!0}),et=1}catch(e){}var tt=function(e){for(var t="",n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return[t,R(e,n-1)];i?3==i?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&i?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}},nt=function(){function e(e){this.ondata=e,et?this.t=new TextDecoder:this.p=H}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t=!!t,this.t){if(this.ondata(this.t.decode(e,{stream:!0}),t),t){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}}else{if(!this.p)throw"stream finished";var n=new s(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length);var r=tt(n),i=r[0],o=r[1];if(t){if(o.length)throw"invalid utf-8 data";this.p=null}else this.p=o;this.ondata(i,t)}},e}(),rt=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(it(e),this.d=t||!1)},e}();function it(e,t){if(t){for(var n=new s(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(Qe)return Qe.encode(e);var i=e.length,o=new s(e.length+(e.length>>1)),a=0,c=function(e){o[a++]=e};for(r=0;r<i;++r){if(a+5>o.length){var l=new s(a+8+(i-r<<1));l.set(o),o=l}var u=e.charCodeAt(r);u<128||t?c(u):u<2048?(c(192|u>>6),c(128|63&u)):u>55295&&u<57344?(c(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++r))>>18),c(128|u>>12&63),c(128|u>>6&63),c(128|63&u)):(c(224|u>>12),c(128|u>>6&63),c(128|63&u))}return R(o,0,a)}function ot(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(Je)return Je.decode(e);var i=tt(e),o=i[0];if(i[1].length)throw"invalid utf-8 data";return o}var at=function(e){return 1==e?3:e<6?2:9==e?1:0},st=function(e,t){return t+30+fe(e,t+26)+fe(e,t+28)},ct=function(e,t,n){var r=fe(e,t+28),i=ot(e.subarray(t+46,t+46+r),!(2048&fe(e,t+8))),o=t+46+r,a=pe(e,t+20),s=n&&4294967295==a?lt(e,o):[a,pe(e,t+24),pe(e,t+42)],c=s[0],l=s[1],u=s[2];return[fe(e,t+10),c,l,i,o+fe(e,t+30)+fe(e,t+32),u]},lt=function(e,t){for(;1!=fe(e,t);t+=4+fe(e,t+2));return[de(e,t+12),de(e,t+4),de(e,t+20)]},ut=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;if(r>65535)throw"extra field too long";t+=r+4}return t},ht=function(e,t,n,r,i,o,a,s){var c=r.length,l=n.extra,u=s&&s.length,h=ut(l);ve(e,t,null!=a?33639248:67324752),t+=4,null!=a&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(null==o&&8),e[t++]=i&&8,e[t++]=255&n.compression,e[t++]=n.compression>>8;var f=new Date(null==n.mtime?Date.now():n.mtime),p=f.getFullYear()-1980;if(p<0||p>119)throw"date not in range 1980-2099";if(ve(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>>1),t+=4,null!=o&&(ve(e,t,n.crc),ve(e,t+4,o),ve(e,t+8,n.size)),ve(e,t+12,c),ve(e,t+14,h),t+=16,null!=a&&(ve(e,t,u),ve(e,t+6,n.attrs),ve(e,t+10,a),t+=14),e.set(r,t),t+=c,h)for(var d in l){var v=l[d],g=v.length;ve(e,t,+d),ve(e,t+2,g),e.set(v,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},ft=function(e,t,n,r,i){ve(e,t,101010256),ve(e,t+8,n),ve(e,t+10,n),ve(e,t+12,r),ve(e,t+16,i)},pt=function(){function e(e){this.filename=e,this.c=K(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}(),dt=function(){function e(e,t){var n=this;t||(t={}),pt.call(this,e),this.d=new Te(t,(function(e,t){n.ondata(null,e,t)})),this.compression=8,this.flag=at(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){pt.prototype.push.call(this,e,t)},e}(),vt=function(){function e(e,t){var n=this;t||(t={}),pt.call(this,e),this.d=new ke(t,(function(e,t,r){n.ondata(e,t,r)})),this.compression=8,this.flag=at(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){pt.prototype.push.call(this,e,t)},e}(),gt=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(2&this.d)throw"stream finished";var n=it(e.filename),r=n.length,i=e.comment,o=i&&it(i),a=r!=e.filename.length||o&&i.length!=o.length,c=r+ut(e.extra)+30;if(r>65535)throw"filename too long";var l=new s(c);ht(l,0,e,n,a);var u=[l],h=function(){for(var e=0,n=u;e<n.length;e++){var r=n[e];t.ondata(null,r,!1)}u=[]},f=this.d;this.d=0;var p=this.u.length,d=$(e,{f:n,u:a,o,t:function(){e.terminate&&e.terminate()},r:function(){if(h(),f){var e=t.u[p+1];e?e.r():t.d=1}f=1}}),v=0;e.ondata=function(n,r,i){if(n)t.ondata(n,r,i),t.terminate();else if(v+=r.length,u.push(r),i){var o=new s(16);ve(o,0,134695760),ve(o,4,e.crc),ve(o,8,v),ve(o,12,e.size),u.push(o),d.c=v,d.b=c+v+16,d.crc=e.crc,d.size=e.size,f&&d.r(),f=1}else f&&h()},this.u.push(d)},e.prototype.end=function(){var e=this;if(2&this.d){if(1&this.d)throw"stream finishing";throw"stream finished"}this.d?this.e():this.u.push({r:function(){1&e.d&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,n=0,r=0,i=this.u;r<i.length;r++){n+=46+(l=i[r]).f.length+ut(l.extra)+(l.o?l.o.length:0)}for(var o=new s(n+22),a=0,c=this.u;a<c.length;a++){var l=c[a];ht(o,e,l,l.f,l.u,l.c,t,l.o),e+=46+l.f.length+ut(l.extra)+(l.o?l.o.length:0),t+=l.b}ft(o,e,this.u.length,n,t),this.ondata(null,o,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++){t[e].t()}this.d=2},e}();function mt(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";var r={};$e(e,"",r,t);var i=Object.keys(r),o=i.length,a=0,c=0,l=o,u=new Array(o),h=[],f=function(){for(var e=0;e<h.length;++e)h[e]()},p=function(){var e=new s(c+22),t=a,r=c-a;c=0;for(var i=0;i<l;++i){var o=u[i];try{var h=o.c.length;ht(e,c,o,o.f,o.u,h);var f=30+o.f.length+ut(o.extra),p=c+f;e.set(o.c,p),ht(e,a,o,o.f,o.u,h,c,o.m),a+=16+f+(o.m?o.m.length:0),c=p+h}catch(e){return n(e,null)}}ft(e,a,u.length,r,t),n(null,e)};o||p();for(var d=function(e){var t=i[e],s=r[t],l=s[0],d=s[1],v=K(),g=l.length;v.p(l);var m=it(t),y=m.length,w=d.comment,b=w&&it(w),I=b&&b.length,x=ut(d.extra),T=0==d.level?0:8,k=function(r,i){if(r)f(),n(r,null);else{var s=i.length;u[e]=$(d,{size:g,crc:v.d(),c:i,f:m,m:b,u:y!=t.length||b&&w.length!=I,compression:T}),a+=30+y+x+s,c+=76+2*(y+x)+(I||0)+s,--o||p()}};if(y>65535&&k("filename too long",null),T)if(g<16e4)try{k(null,De(l,d))}catch(e){k(e,null)}else h.push(Ae(l,d,k));else k(null,l)},v=0;v<l;++v)d(v);return f}function yt(e,t){t||(t={});var n={},r=[];$e(e,"",n,t);var i=0,o=0;for(var a in n){var c=n[a],l=c[0],u=c[1],h=0==u.level?0:8,f=(k=it(a)).length,p=u.comment,d=p&&it(p),v=d&&d.length,g=ut(u.extra);if(f>65535)throw"filename too long";var m=h?De(l,u):l,y=m.length,w=K();w.p(l),r.push($(u,{size:l.length,crc:w.d(),c:m,f:k,m:d,u:f!=a.length||d&&p.length!=v,o:i,compression:h})),i+=30+f+g+y,o+=76+2*(f+g)+(v||0)+y}for(var b=new s(o+22),I=i,x=o-i,T=0;T<r.length;++T){var k=r[T];ht(b,k.o,k,k.f,k.u,k.c.length);var A=30+k.f.length+ut(k.extra);b.set(k.c,k.o+A),ht(b,i,k,k.f,k.u,k.c.length,k.o,k.m),i+=16+A+(k.m?k.m.length:0)}return ft(b,i,r.length,x,I),b}var wt=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),bt=function(){function e(){var e=this;this.i=new Ee((function(t,n){e.ondata(null,t,n)}))}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(n){this.ondata(n,e,t)}},e.compression=8,e}(),It=function(){function e(e,t){var n=this;t<32e4?this.i=new Ee((function(e,t){n.ondata(null,e,t)})):(this.i=new Se((function(e,t,r){n.ondata(e,t,r)})),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=R(e,0)),this.i.push(e,t)},e.compression=8,e}(),xt=function(){function e(e){this.onfile=e,this.k=[],this.o={0:wt},this.p=H}return e.prototype.push=function(e,t){var n=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(this.c>0){var r=Math.min(this.c,e.length),i=e.subarray(0,r);if(this.c-=r,this.d?this.d.push(i,!this.c):this.k[0].push(i),(e=e.subarray(r)).length)return this.push(e,t)}else{var o=0,a=0,c=void 0,l=void 0;this.p.length?e.length?((l=new s(this.p.length+e.length)).set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var u=l.length,h=this.c,f=h&&this.d,p=function(){var e,t=pe(l,a);if(67324752==t){o=1,c=a,d.d=null,d.c=0;var r=fe(l,a+6),i=fe(l,a+8),s=2048&r,f=8&r,p=fe(l,a+26),v=fe(l,a+28);if(u>a+30+p+v){var g=[];d.k.unshift(g),o=2;var m,y=pe(l,a+18),w=pe(l,a+22),b=ot(l.subarray(a+30,a+=30+p),!s);4294967295==y?(e=f?[-2]:lt(l,a),y=e[0],w=e[1]):f&&(y=-1),a+=v,d.c=y;var I={name:b,compression:i,start:function(){if(!I.ondata)throw"no callback";if(y){var e=n.o[i];if(!e)throw"unknown compression type "+i;(m=y<0?new e(b):new e(b,y,w)).ondata=function(e,t,n){I.ondata(e,t,n)};for(var t=0,r=g;t<r.length;t++){var o=r[t];m.push(o,!1)}n.k[0]==g&&n.c?n.d=m:m.push(H,!0)}else I.ondata(null,H,!0)},terminate:function(){m&&m.terminate&&m.terminate()}};y>=0&&(I.size=y,I.originalSize=w),d.onfile(I)}return"break"}if(h){if(134695760==t)return c=a+=12+(-2==h&&8),o=3,d.c=0,"break";if(33639248==t)return c=a-=4,o=3,d.c=0,"break"}},d=this;a<u-4;++a){if("break"===p())break}if(this.p=H,h<0){var v=o?l.subarray(0,c-12-(-2==h&&8)-(134695760==pe(l,c-16)&&4)):l.subarray(0,a);f?f.push(v,!!o):this.k[+(2==o)].push(v)}if(2&o)return this.push(l.subarray(a),t);this.p=l.subarray(a)}if(t){if(this.c)throw"invalid zip file";this.p=null}},e.prototype.register=function(e){this.o[e.compression]=e},e}();function Tt(e,t){if("function"!=typeof t)throw"no callback";for(var n=[],r=function(){for(var e=0;e<n.length;++e)n[e]()},i={},o=e.length-22;101010256!=pe(e,o);--o)if(!o||e.length-o>65558)return void t("invalid zip file",null);var a=fe(e,o+8);a||t(null,{});var c=a,l=pe(e,o+16),u=4294967295==l;if(u){if(o=pe(e,o-12),101075792!=pe(e,o))return void t("invalid zip file",null);c=a=pe(e,o+32),l=pe(e,o+48)}for(var h=function(o){var c=ct(e,l,u),h=c[0],f=c[1],p=c[2],d=c[3],v=c[4],g=c[5],m=st(e,g);l=v;var y=function(e,n){e?(r(),t(e,null)):(i[d]=n,--a||t(null,i))};if(h)if(8==h){var w=e.subarray(m,m+f);if(f<32e4)try{y(null,Ce(w,new s(p)))}catch(e){y(e,null)}else n.push(Pe(w,{size:p},y))}else y("unknown compression type "+h,null);else y(null,R(e,m,m+f))},f=0;f<c;++f)h();return r}function kt(e){for(var t={},n=e.length-22;101010256!=pe(e,n);--n)if(!n||e.length-n>65558)throw"invalid zip file";var r=fe(e,n+8);if(!r)return{};var i=pe(e,n+16),o=4294967295==i;if(o){if(n=pe(e,n-12),101075792!=pe(e,n))throw"invalid zip file";r=pe(e,n+32),i=pe(e,n+48)}for(var a=0;a<r;++a){var c=ct(e,i,o),l=c[0],u=c[1],h=c[2],f=c[3],p=c[4],d=c[5],v=st(e,d);if(i=p,l){if(8!=l)throw"unknown compression type "+l;t[f]=Ce(e.subarray(v,v+u),new s(h))}else t[f]=R(e,v,v+u)}return t}const{Vector3:At,Vector4:Dt}=THREE;var Et={findSpan:function(e,t,n){var r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;for(var i=e,o=r,a=Math.floor((i+o)/2);t<n[a]||t>=n[a+1];)t<n[a]?o=a:i=a,a=Math.floor((i+o)/2);return a},calcBasisFunctions:function(e,t,n,r){var i=[],o=[],a=[];i[0]=1;for(var s=1;s<=n;++s){o[s]=t-r[e+1-s],a[s]=r[e+s]-t;for(var c=0,l=0;l<s;++l){var u=a[l+1],h=o[s-l],f=i[l]/(u+h);i[l]=c+u*f,c=h*f}i[s]=c}return i},calcBSplinePoint:function(e,t,n,r){for(var i=this.findSpan(e,r,t),o=this.calcBasisFunctions(i,r,e,t),a=new Dt(0,0,0,0),s=0;s<=e;++s){var c=n[i-e+s],l=o[s],u=c.w*l;a.x+=c.x*u,a.y+=c.y*u,a.z+=c.z*u,a.w+=c.w*l}return a},calcBasisFunctionDerivatives:function(e,t,n,r,i){for(var o=[],a=0;a<=n;++a)o[a]=0;var s=[];for(a=0;a<=r;++a)s[a]=o.slice(0);var c=[];for(a=0;a<=n;++a)c[a]=o.slice(0);c[0][0]=1;for(var l=o.slice(0),u=o.slice(0),h=1;h<=n;++h){l[h]=t-i[e+1-h],u[h]=i[e+h]-t;for(var f=0,p=0;p<h;++p){var d=u[p+1],v=l[h-p];c[h][p]=d+v;var g=c[p][h-1]/c[h][p];c[p][h]=f+d*g,f=v*g}c[h][h]=f}for(h=0;h<=n;++h)s[0][h]=c[h][n];for(p=0;p<=n;++p){var m=0,y=1,w=[];for(a=0;a<=n;++a)w[a]=o.slice(0);w[0][0]=1;for(var b=1;b<=r;++b){var I=0,x=p-b,T=n-b;p>=b&&(w[y][0]=w[m][0]/c[T+1][x],I=w[y][0]*c[x][T]);var k=p-1<=T?b-1:n-p;for(h=x>=-1?1:-x;h<=k;++h)w[y][h]=(w[m][h]-w[m][h-1])/c[T+1][x+h],I+=w[y][h]*c[x+h][T];p<=T&&(w[y][b]=-w[m][b-1]/c[T+1][p],I+=w[y][b]*c[p][T]),s[b][p]=I;h=m;m=y,y=h}}for(p=n,b=1;b<=r;++b){for(h=0;h<=n;++h)s[b][h]*=p;p*=n-b}return s},calcBSplineDerivatives:function(e,t,n,r,i){for(var o=i<e?i:e,a=[],s=this.findSpan(e,r,t),c=this.calcBasisFunctionDerivatives(s,r,e,o,t),l=[],u=0;u<n.length;++u){var h=(p=n[u].clone()).w;p.x*=h,p.y*=h,p.z*=h,l[u]=p}for(var f=0;f<=o;++f){for(var p=l[s-e].clone().multiplyScalar(c[f][0]),d=1;d<=e;++d)p.add(l[s-e+d].clone().multiplyScalar(c[f][d]));a[f]=p}for(f=o+1;f<=i+1;++f)a[f]=new Dt(0,0,0);return a},calcKoverI:function(e,t){for(var n=1,r=2;r<=e;++r)n*=r;var i=1;for(r=2;r<=t;++r)i*=r;for(r=2;r<=e-t;++r)i*=r;return n/i},calcRationalCurveDerivatives:function(e){for(var t=e.length,n=[],r=[],i=0;i<t;++i){var o=e[i];n[i]=new At(o.x,o.y,o.z),r[i]=o.w}for(var a=[],s=0;s<t;++s){var c=n[s].clone();for(i=1;i<=s;++i)c.sub(a[s-i].clone().multiplyScalar(this.calcKoverI(s,i)*r[i]));a[s]=c.divideScalar(r[0])}return a},calcNURBSDerivatives:function(e,t,n,r,i){var o=this.calcBSplineDerivatives(e,t,n,r,i);return this.calcRationalCurveDerivatives(o)},calcSurfacePoint:function(e,t,n,r,i,o,a,s){for(var c=this.findSpan(e,o,n),l=this.findSpan(t,a,r),u=this.calcBasisFunctions(c,o,e,n),h=this.calcBasisFunctions(l,a,t,r),f=[],p=0;p<=t;++p){f[p]=new Dt(0,0,0,0);for(var d=0;d<=e;++d){var v=i[c-e+d][l-t+p].clone(),g=v.w;v.x*=g,v.y*=g,v.z*=g,f[p].add(v.multiplyScalar(u[d]))}}var m=new Dt(0,0,0,0);for(p=0;p<=t;++p)m.add(f[p].multiplyScalar(h[p]));m.divideScalar(m.w),s.set(m.x,m.y,m.z)}};const{Curve:St,Vector3:Pt,Vector4:Ct}=THREE;var Lt=function(e,t,n,r,i){St.call(this),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=r||0,this.endKnot=i||this.knots.length-1;for(var o=0;o<n.length;++o){var a=n[o];this.controlPoints[o]=new Ct(a.x,a.y,a.z,a.w)}};(Lt.prototype=Object.create(St.prototype)).constructor=Lt,Lt.prototype.getPoint=function(e,t){var n=t||new Pt,r=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=Et.calcBSplinePoint(this.degree,this.knots,this.controlPoints,r);return 1!=i.w&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)},Lt.prototype.getTangent=function(e,t){var n=t||new Pt,r=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=Et.calcNURBSDerivatives(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n};const{AmbientLight:Mt,AnimationClip:Ft,Bone:Rt,BufferGeometry:Nt,ClampToEdgeWrapping:Ot,Color:Bt,DirectionalLight:zt,EquirectangularReflectionMapping:Ut,Euler:jt,FileLoader:Vt,Float32BufferAttribute:Gt,Group:Xt,Line:Wt,LineBasicMaterial:Ht,Loader:_t,LoaderUtils:Zt,MathUtils:Kt,Matrix3:Yt,Matrix4:qt,Mesh:$t,MeshLambertMaterial:Qt,MeshPhongMaterial:Jt,NumberKeyframeTrack:en,Object3D:tn,OrthographicCamera:nn,PerspectiveCamera:rn,PointLight:on,PropertyBinding:an,Quaternion:sn,QuaternionKeyframeTrack:cn,RepeatWrapping:ln,Skeleton:un,SkinnedMesh:hn,SpotLight:fn,Texture:pn,TextureLoader:dn,Uint16BufferAttribute:vn,Vector3:gn,Vector4:mn,VectorKeyframeTrack:yn,sRGBEncoding:wn}=THREE;let bn,In,xn;class Tn extends _t{constructor(e){super(e)}load(e,t,n,r){const i=this,o=""===i.path?Zt.extractUrlBase(e):i.path,a=new Vt(this.manager);a.setPath(i.path),a.setResponseType("arraybuffer"),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,(function(n){try{t(i.parse(n,o))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}}),n,r)}parse(e,t){if(function(e){const t="Kaydara FBX Binary \0";return e.byteLength>=t.length&&t===jn(e,0,t.length)}(e))bn=(new Sn).parse(e);else{const t=jn(e);if(!function(e){const t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let n=0;function r(t){const r=e[t-1];return e=e.slice(n+t),n++,r}for(let e=0;e<t.length;++e){if(r(1)===t[e])return!1}return!0}(t))throw new Error("THREE.FBXLoader: Unknown format.");if(Ln(t)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ln(t));bn=(new En).parse(t)}const n=new dn(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new kn(n,this.manager).parse(bn)}}class kn{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){In=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),r=this.parseDeformers(),i=(new An).parse(r);return this.parseScene(r,i,n),xn}parseConnections(){const e=new Map;if("Connections"in bn){bn.Connections.connections.forEach((function(t){const n=t[0],r=t[1],i=t[2];e.has(n)||e.set(n,{parents:[],children:[]});const o={ID:r,relationship:i};e.get(n).parents.push(o),e.has(r)||e.set(r,{parents:[],children:[]});const a={ID:n,relationship:i};e.get(r).children.push(a)}))}return e}parseImages(){const e={},t={};if("Video"in bn.Objects){const n=bn.Objects.Video;for(const r in n){const i=n[r];if(e[parseInt(r)]=i.RelativeFilename||i.Filename,"Content"in i){const e=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,o="string"==typeof i.Content&&""!==i.Content;if(e||o){const e=this.parseImage(n[r]);t[i.RelativeFilename||i.Filename]=e}}}}for(const n in e){const r=e[n];void 0!==t[r]?e[n]=t[r]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let i;switch(r){case"bmp":i="image/bmp";break;case"jpg":case"jpeg":i="image/jpeg";break;case"png":i="image/png";break;case"tif":i="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),i="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+r+'" is not supported.')}if("string"==typeof t)return"data:"+i+";base64,"+t;{const e=new Uint8Array(t);return window.URL.createObjectURL(new Blob([e],{type:i}))}}parseTextures(e){const t=new Map;if("Texture"in bn.Objects){const n=bn.Objects.Texture;for(const r in n){const i=this.parseTexture(n[r],e);t.set(parseInt(r),i)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const r=e.WrapModeU,i=e.WrapModeV,o=void 0!==r?r.value:0,a=void 0!==i?i.value:0;if(n.wrapS=0===o?ln:Ot,n.wrapT=0===a?ln:Ot,"Scaling"in e){const t=e.Scaling.value;n.repeat.x=t[0],n.repeat.y=t[1]}if("Translation"in e){const t=e.Translation.value;n.offset.x=t[0],n.offset.y=t[1]}return n}loadTexture(e,t){let n;const r=this.textureLoader.path,i=In.get(e.id).children;let o;void 0!==i&&i.length>0&&void 0!==t[i[0].ID]&&(n=t[i[0].ID],0!==n.indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0));const a=e.FileName.slice(-3).toLowerCase();if("tga"===a){const t=this.manager.getHandler(".tga");null===t?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new pn):(t.setPath(this.textureLoader.path),o=t.load(n))}else"psd"===a?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),o=new pn):o=this.textureLoader.load(n);return this.textureLoader.setPath(r),o}parseMaterials(e){const t=new Map;if("Material"in bn.Objects){const n=bn.Objects.Material;for(const r in n){const i=this.parseMaterial(n[r],e);null!==i&&t.set(parseInt(r),i)}}return t}parseMaterial(e,t){const n=e.id,r=e.attrName;let i=e.ShadingModel;if("object"==typeof i&&(i=i.value),!In.has(n))return null;const o=this.parseParameters(e,t,n);let a;switch(i.toLowerCase()){case"phong":a=new Jt;break;case"lambert":a=new Qt;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),a=new Jt}return a.setValues(o),a.name=r,a}parseParameters(e,t,n){const r={};e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=(new Bt).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(r.color=(new Bt).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=(new Bt).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(r.emissive=(new Bt).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=(new Bt).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(r.specular=(new Bt).fromArray(e.SpecularColor.value));const i=this;return In.get(n).children.forEach((function(e){const n=e.relationship;switch(n){case"Bump":r.bumpMap=i.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":r.aoMap=i.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=i.getTexture(t,e.ID),void 0!==r.map&&(r.map.encoding=wn);break;case"DisplacementColor":r.displacementMap=i.getTexture(t,e.ID);break;case"EmissiveColor":r.emissiveMap=i.getTexture(t,e.ID),void 0!==r.emissiveMap&&(r.emissiveMap.encoding=wn);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=i.getTexture(t,e.ID);break;case"ReflectionColor":r.envMap=i.getTexture(t,e.ID),void 0!==r.envMap&&(r.envMap.mapping=Ut,r.envMap.encoding=wn);break;case"SpecularColor":r.specularMap=i.getTexture(t,e.ID),void 0!==r.specularMap&&(r.specularMap.encoding=wn);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=i.getTexture(t,e.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),r}getTexture(e,t){return"LayeredTexture"in bn.Objects&&t in bn.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=In.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in bn.Objects){const n=bn.Objects.Deformer;for(const r in n){const i=n[r],o=In.get(parseInt(r));if("Skin"===i.attrType){const t=this.parseSkeleton(o,n);t.ID=r,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),t.geometryID=o.parents[0].ID,e[r]=t}else if("BlendShape"===i.attrType){const e={id:r};e.rawTargets=this.parseMorphTargets(o,n),e.id=r,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=e}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach((function(e){const r=t[e.ID];if("Cluster"!==r.attrType)return;const i={ID:e.ID,indices:[],weights:[],transformLink:(new qt).fromArray(r.TransformLink.a)};"Indexes"in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)})),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let r=0;r<e.children.length;r++){const i=e.children[r],o=t[i.ID],a={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if("BlendShapeChannel"!==o.attrType)return;a.geoID=In.get(parseInt(i.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,n.push(a)}return n}parseScene(e,t,n){xn=new Xt;const r=this.parseModels(e.skeletons,t,n),i=bn.Objects.Model,o=this;r.forEach((function(e){const t=i[e.ID];o.setLookAtProperties(e,t);In.get(e.ID).parents.forEach((function(t){const n=r.get(t.ID);void 0!==n&&n.add(e)})),null===e.parent&&xn.add(e)})),this.bindSkeleton(e.skeletons,t,r),this.createAmbientLight(),xn.traverse((function(e){if(e.userData.transformData){e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld);const t=Bn(e.userData.transformData);e.applyMatrix4(t),e.updateWorldMatrix()}}));const a=(new Dn).parse();1===xn.children.length&&xn.children[0].isGroup&&(xn.children[0].animations=a,xn=xn.children[0]),xn.animations=a}parseModels(e,t,n){const r=new Map,i=bn.Objects.Model;for(const o in i){const a=parseInt(o),s=i[o],c=In.get(a);let l=this.buildSkeleton(c,e,a,s.attrName);if(!l){switch(s.attrType){case"Camera":l=this.createCamera(c);break;case"Light":l=this.createLight(c);break;case"Mesh":l=this.createMesh(c,t,n);break;case"NurbsCurve":l=this.createCurve(c,t);break;case"LimbNode":case"Root":l=new Rt;break;default:l=new Xt}l.name=s.attrName?an.sanitizeNodeName(s.attrName):"",l.ID=a}this.getTransformData(l,s),r.set(a,l)}return r}buildSkeleton(e,t,n,r){let i=null;return e.parents.forEach((function(e){for(const o in t){const a=t[o];a.rawBones.forEach((function(t,o){if(t.ID===e.ID){const e=i;i=new Rt,i.matrixWorld.copy(t.transformLink),i.name=r?an.sanitizeNodeName(r):"",i.ID=n,a.bones[o]=i,null!==e&&i.add(e)}}))}})),i}createCamera(e){let t,n;if(e.children.forEach((function(e){const t=bn.Objects.NodeAttribute[e.ID];void 0!==t&&(n=t)})),void 0===n)t=new tn;else{let e=0;void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(e=1);let r=1;void 0!==n.NearPlane&&(r=n.NearPlane.value/1e3);let i=1e3;void 0!==n.FarPlane&&(i=n.FarPlane.value/1e3);let o=window.innerWidth,a=window.innerHeight;void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(o=n.AspectWidth.value,a=n.AspectHeight.value);const s=o/a;let c=45;void 0!==n.FieldOfView&&(c=n.FieldOfView.value);const l=n.FocalLength?n.FocalLength.value:null;switch(e){case 0:t=new rn(c,s,r,i),null!==l&&t.setFocalLength(l);break;case 1:t=new nn(-o/2,o/2,a/2,-a/2,r,i);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+e+"."),t=new tn}}return t}createLight(e){let t,n;if(e.children.forEach((function(e){const t=bn.Objects.NodeAttribute[e.ID];void 0!==t&&(n=t)})),void 0===n)t=new tn;else{let e;e=void 0===n.LightType?0:n.LightType.value;let r=16777215;void 0!==n.Color&&(r=(new Bt).fromArray(n.Color.value));let i=void 0===n.Intensity?1:n.Intensity.value/100;void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(i=0);let o=0;void 0!==n.FarAttenuationEnd&&(o=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value);const a=1;switch(e){case 0:t=new on(r,i,o,a);break;case 1:t=new zt(r,i);break;case 2:let e=Math.PI/3;void 0!==n.InnerAngle&&(e=Kt.degToRad(n.InnerAngle.value));let s=0;void 0!==n.OuterAngle&&(s=Kt.degToRad(n.OuterAngle.value),s=Math.max(s,1)),t=new fn(r,i,o,e,s,a);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new on(r,i)}void 0!==n.CastShadows&&1===n.CastShadows.value&&(t.castShadow=!0)}return t}createMesh(e,t,n){let r,i=null,o=null;const a=[];return e.children.forEach((function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&a.push(n.get(e.ID))})),a.length>1?o=a:a.length>0?o=a[0]:(o=new Jt({color:13421772}),a.push(o)),"color"in i.attributes&&a.forEach((function(e){e.vertexColors=!0})),i.FBX_Deformer?(r=new hn(i,o),r.normalizeSkinWeights()):r=new $t(i,o),r}createCurve(e,t){const n=e.children.reduce((function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e}),null),r=new Ht({color:3342591,linewidth:1});return new Wt(n,r)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?zn(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){if("LookAtProperty"in t){In.get(e.ID).children.forEach((function(t){if("LookAtProperty"===t.relationship){const n=bn.Objects.Model[t.ID];if("Lcl_Translation"in n){const t=n.Lcl_Translation.value;void 0!==e.target?(e.target.position.fromArray(t),xn.add(e.target)):e.lookAt((new gn).fromArray(t))}}}))}}bindSkeleton(e,t,n){const r=this.parsePoseNodes();for(const i in e){const o=e[i];In.get(parseInt(o.ID)).parents.forEach((function(e){if(t.has(e.ID)){const t=e.ID;In.get(t).parents.forEach((function(e){if(n.has(e.ID)){n.get(e.ID).bind(new un(o.bones),r[e.ID])}}))}}))}}parsePoseNodes(){const e={};if("Pose"in bn.Objects){const t=bn.Objects.Pose;for(const n in t)if("BindPose"===t[n].attrType&&t[n].NbPoseNodes>0){const r=t[n].PoseNode;Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new qt).fromArray(t.Matrix.a)})):e[r.Node]=(new qt).fromArray(r.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in bn&&"AmbientColor"in bn.GlobalSettings){const e=bn.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],r=e[2];if(0!==t||0!==n||0!==r){const e=new Bt(t,n,r);xn.add(new Mt(e,1))}}}}class An{parse(e){const t=new Map;if("Geometry"in bn.Objects){const n=bn.Objects.Geometry;for(const r in n){const i=In.get(parseInt(r)),o=this.parseGeometry(i,n[r],e);t.set(parseInt(r),o)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const r=n.skeletons,i=[],o=e.parents.map((function(e){return bn.Objects.Model[e.ID]}));if(0===o.length)return;const a=e.children.reduce((function(e,t){return void 0!==r[t.ID]&&(e=r[t.ID]),e}),null);e.children.forEach((function(e){void 0!==n.morphTargets[e.ID]&&i.push(n.morphTargets[e.ID])}));const s=o[0],c={};"RotationOrder"in s&&(c.eulerOrder=zn(s.RotationOrder.value)),"InheritType"in s&&(c.inheritType=parseInt(s.InheritType.value)),"GeometricTranslation"in s&&(c.translation=s.GeometricTranslation.value),"GeometricRotation"in s&&(c.rotation=s.GeometricRotation.value),"GeometricScaling"in s&&(c.scale=s.GeometricScaling.value);const l=Bn(c);return this.genGeometry(t,a,i,l)}genGeometry(e,t,n,r){const i=new Nt;e.attrName&&(i.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),s=new Gt(a.vertex,3);if(s.applyMatrix4(r),i.setAttribute("position",s),a.colors.length>0&&i.setAttribute("color",new Gt(a.colors,3)),t&&(i.setAttribute("skinIndex",new vn(a.weightsIndices,4)),i.setAttribute("skinWeight",new Gt(a.vertexWeights,4)),i.FBX_Deformer=t),a.normal.length>0){const e=(new Yt).getNormalMatrix(r),t=new Gt(a.normal,3);t.applyNormalMatrix(e),i.setAttribute("normal",t)}if(a.uvs.forEach((function(e,t){let n="uv"+(t+1).toString();0===t&&(n="uv"),i.setAttribute(n,new Gt(a.uvs[t],2))})),o.material&&"AllSame"!==o.material.mappingType){let e=a.materialIndex[0],t=0;if(a.materialIndex.forEach((function(n,r){n!==e&&(i.addGroup(t,r-t,e),e=n,t=r)})),i.groups.length>0){const t=i.groups[i.groups.length-1],n=t.start+t.count;n!==a.materialIndex.length&&i.addGroup(n,a.materialIndex.length-n,e)}0===i.groups.length&&i.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(i,e,n,r),i}parseGeoNode(e,t){const n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let t=0;for(;e.LayerElementUV[t];)e.LayerElementUV[t].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[t])),t++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})}))}))),n}gen