@mappedin/react-sdk 6.0.1-beta.12 → 6.0.1-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- THE FOLLOWING SETS FORTH ATTRIBUTION NOTICES FOR THIRD PARTY SOFTWARE THAT MAY BE CONTAINED IN PORTIONS OF THE WORKSPACE AGGREGATOR FD920FD2 7C09 4834 A69F B06B9CD815BA PRODUCT.
1
+ THE FOLLOWING SETS FORTH ATTRIBUTION NOTICES FOR THIRD PARTY SOFTWARE THAT MAY BE CONTAINED IN PORTIONS OF THE WORKSPACE AGGREGATOR 0BF0D0E2 1224 4BE9 B8B0 F41FF61D75AA PRODUCT.
2
2
 
3
3
  -----
4
4
 
@@ -6817,6 +6817,232 @@ Apache License
6817
6817
 
6818
6818
  -----
6819
6819
 
6820
+ The following software may be included in this product: dexie. A copy of the source code may be downloaded from https://github.com/dexie/Dexie.js.git. This software contains the following license and notice below:
6821
+
6822
+ Apache License
6823
+ Version 2.0, January 2004
6824
+ http://www.apache.org/licenses/
6825
+
6826
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6827
+
6828
+ 1. Definitions.
6829
+
6830
+ "License" shall mean the terms and conditions for use, reproduction,
6831
+ and distribution as defined by Sections 1 through 9 of this document.
6832
+
6833
+ "Licensor" shall mean the copyright owner or entity authorized by
6834
+ the copyright owner that is granting the License.
6835
+
6836
+ "Legal Entity" shall mean the union of the acting entity and all
6837
+ other entities that control, are controlled by, or are under common
6838
+ control with that entity. For the purposes of this definition,
6839
+ "control" means (i) the power, direct or indirect, to cause the
6840
+ direction or management of such entity, whether by contract or
6841
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
6842
+ outstanding shares, or (iii) beneficial ownership of such entity.
6843
+
6844
+ "You" (or "Your") shall mean an individual or Legal Entity
6845
+ exercising permissions granted by this License.
6846
+
6847
+ "Source" form shall mean the preferred form for making modifications,
6848
+ including but not limited to software source code, documentation
6849
+ source, and configuration files.
6850
+
6851
+ "Object" form shall mean any form resulting from mechanical
6852
+ transformation or translation of a Source form, including but
6853
+ not limited to compiled object code, generated documentation,
6854
+ and conversions to other media types.
6855
+
6856
+ "Work" shall mean the work of authorship, whether in Source or
6857
+ Object form, made available under the License, as indicated by a
6858
+ copyright notice that is included in or attached to the work
6859
+ (an example is provided in the Appendix below).
6860
+
6861
+ "Derivative Works" shall mean any work, whether in Source or Object
6862
+ form, that is based on (or derived from) the Work and for which the
6863
+ editorial revisions, annotations, elaborations, or other modifications
6864
+ represent, as a whole, an original work of authorship. For the purposes
6865
+ of this License, Derivative Works shall not include works that remain
6866
+ separable from, or merely link (or bind by name) to the interfaces of,
6867
+ the Work and Derivative Works thereof.
6868
+
6869
+ "Contribution" shall mean any work of authorship, including
6870
+ the original version of the Work and any modifications or additions
6871
+ to that Work or Derivative Works thereof, that is intentionally
6872
+ submitted to Licensor for inclusion in the Work by the copyright owner
6873
+ or by an individual or Legal Entity authorized to submit on behalf of
6874
+ the copyright owner. For the purposes of this definition, "submitted"
6875
+ means any form of electronic, verbal, or written communication sent
6876
+ to the Licensor or its representatives, including but not limited to
6877
+ communication on electronic mailing lists, source code control systems,
6878
+ and issue tracking systems that are managed by, or on behalf of, the
6879
+ Licensor for the purpose of discussing and improving the Work, but
6880
+ excluding communication that is conspicuously marked or otherwise
6881
+ designated in writing by the copyright owner as "Not a Contribution."
6882
+
6883
+ "Contributor" shall mean Licensor and any individual or Legal Entity
6884
+ on behalf of whom a Contribution has been received by Licensor and
6885
+ subsequently incorporated within the Work.
6886
+
6887
+ 2. Grant of Copyright License. Subject to the terms and conditions of
6888
+ this License, each Contributor hereby grants to You a perpetual,
6889
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
6890
+ copyright license to reproduce, prepare Derivative Works of,
6891
+ publicly display, publicly perform, sublicense, and distribute the
6892
+ Work and such Derivative Works in Source or Object form.
6893
+
6894
+ 3. Grant of Patent License. Subject to the terms and conditions of
6895
+ this License, each Contributor hereby grants to You a perpetual,
6896
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
6897
+ (except as stated in this section) patent license to make, have made,
6898
+ use, offer to sell, sell, import, and otherwise transfer the Work,
6899
+ where such license applies only to those patent claims licensable
6900
+ by such Contributor that are necessarily infringed by their
6901
+ Contribution(s) alone or by combination of their Contribution(s)
6902
+ with the Work to which such Contribution(s) was submitted. If You
6903
+ institute patent litigation against any entity (including a
6904
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
6905
+ or a Contribution incorporated within the Work constitutes direct
6906
+ or contributory patent infringement, then any patent licenses
6907
+ granted to You under this License for that Work shall terminate
6908
+ as of the date such litigation is filed.
6909
+
6910
+ 4. Redistribution. You may reproduce and distribute copies of the
6911
+ Work or Derivative Works thereof in any medium, with or without
6912
+ modifications, and in Source or Object form, provided that You
6913
+ meet the following conditions:
6914
+
6915
+ (a) You must give any other recipients of the Work or
6916
+ Derivative Works a copy of this License; and
6917
+
6918
+ (b) You must cause any modified files to carry prominent notices
6919
+ stating that You changed the files; and
6920
+
6921
+ (c) You must retain, in the Source form of any Derivative Works
6922
+ that You distribute, all copyright, patent, trademark, and
6923
+ attribution notices from the Source form of the Work,
6924
+ excluding those notices that do not pertain to any part of
6925
+ the Derivative Works; and
6926
+
6927
+ (d) If the Work includes a "NOTICE" text file as part of its
6928
+ distribution, then any Derivative Works that You distribute must
6929
+ include a readable copy of the attribution notices contained
6930
+ within such NOTICE file, excluding those notices that do not
6931
+ pertain to any part of the Derivative Works, in at least one
6932
+ of the following places: within a NOTICE text file distributed
6933
+ as part of the Derivative Works; within the Source form or
6934
+ documentation, if provided along with the Derivative Works; or,
6935
+ within a display generated by the Derivative Works, if and
6936
+ wherever such third-party notices normally appear. The contents
6937
+ of the NOTICE file are for informational purposes only and
6938
+ do not modify the License. You may add Your own attribution
6939
+ notices within Derivative Works that You distribute, alongside
6940
+ or as an addendum to the NOTICE text from the Work, provided
6941
+ that such additional attribution notices cannot be construed
6942
+ as modifying the License.
6943
+
6944
+ You may add Your own copyright statement to Your modifications and
6945
+ may provide additional or different license terms and conditions
6946
+ for use, reproduction, or distribution of Your modifications, or
6947
+ for any such Derivative Works as a whole, provided Your use,
6948
+ reproduction, and distribution of the Work otherwise complies with
6949
+ the conditions stated in this License.
6950
+
6951
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
6952
+ any Contribution intentionally submitted for inclusion in the Work
6953
+ by You to the Licensor shall be under the terms and conditions of
6954
+ this License, without any additional terms or conditions.
6955
+ Notwithstanding the above, nothing herein shall supersede or modify
6956
+ the terms of any separate license agreement you may have executed
6957
+ with Licensor regarding such Contributions.
6958
+
6959
+ 6. Trademarks. This License does not grant permission to use the trade
6960
+ names, trademarks, service marks, or product names of the Licensor,
6961
+ except as required for reasonable and customary use in describing the
6962
+ origin of the Work and reproducing the content of the NOTICE file.
6963
+
6964
+ 7. Disclaimer of Warranty. Unless required by applicable law or
6965
+ agreed to in writing, Licensor provides the Work (and each
6966
+ Contributor provides its Contributions) on an "AS IS" BASIS,
6967
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
6968
+ implied, including, without limitation, any warranties or conditions
6969
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
6970
+ PARTICULAR PURPOSE. You are solely responsible for determining the
6971
+ appropriateness of using or redistributing the Work and assume any
6972
+ risks associated with Your exercise of permissions under this License.
6973
+
6974
+ 8. Limitation of Liability. In no event and under no legal theory,
6975
+ whether in tort (including negligence), contract, or otherwise,
6976
+ unless required by applicable law (such as deliberate and grossly
6977
+ negligent acts) or agreed to in writing, shall any Contributor be
6978
+ liable to You for damages, including any direct, indirect, special,
6979
+ incidental, or consequential damages of any character arising as a
6980
+ result of this License or out of the use or inability to use the
6981
+ Work (including but not limited to damages for loss of goodwill,
6982
+ work stoppage, computer failure or malfunction, or any and all
6983
+ other commercial damages or losses), even if such Contributor
6984
+ has been advised of the possibility of such damages.
6985
+
6986
+ 9. Accepting Warranty or Additional Liability. While redistributing
6987
+ the Work or Derivative Works thereof, You may choose to offer,
6988
+ and charge a fee for, acceptance of support, warranty, indemnity,
6989
+ or other liability obligations and/or rights consistent with this
6990
+ License. However, in accepting such obligations, You may act only
6991
+ on Your own behalf and on Your sole responsibility, not on behalf
6992
+ of any other Contributor, and only if You agree to indemnify,
6993
+ defend, and hold each Contributor harmless for any liability
6994
+ incurred by, or claims asserted against, such Contributor by reason
6995
+ of your accepting any such warranty or additional liability.
6996
+
6997
+ END OF TERMS AND CONDITIONS
6998
+
6999
+ APPENDIX: How to apply the Apache License to your work.
7000
+
7001
+ To apply the Apache License to your work, attach the following
7002
+ boilerplate notice, with the fields enclosed by brackets "{}"
7003
+ replaced with your own identifying information. (Don't include
7004
+ the brackets!) The text should be enclosed in the appropriate
7005
+ comment syntax for the file format. We also recommend that a
7006
+ file or class name and description of purpose be included on the
7007
+ same "printed page" as the copyright notice for easier
7008
+ identification within third-party archives.
7009
+
7010
+ Copyright {yyyy} {name of copyright owner}
7011
+
7012
+ Licensed under the Apache License, Version 2.0 (the "License");
7013
+ you may not use this file except in compliance with the License.
7014
+ You may obtain a copy of the License at
7015
+
7016
+ http://www.apache.org/licenses/LICENSE-2.0
7017
+
7018
+ Unless required by applicable law or agreed to in writing, software
7019
+ distributed under the License is distributed on an "AS IS" BASIS,
7020
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7021
+ See the License for the specific language governing permissions and
7022
+ limitations under the License.
7023
+
7024
+
7025
+
7026
+ NOTICE
7027
+
7028
+ Dexie.js
7029
+
7030
+ Copyright (c) 2014-2017 David Fahlander
7031
+
7032
+ Licensed under the Apache License, Version 2.0 (the "License");
7033
+ you may not use this file except in compliance with the License.
7034
+ You may obtain a copy of the License at
7035
+
7036
+ http://www.apache.org/licenses/LICENSE-2.0
7037
+
7038
+ Unless required by applicable law or agreed to in writing, software
7039
+ distributed under the License is distributed on an "AS IS" BASIS,
7040
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7041
+ See the License for the specific language governing permissions and
7042
+ limitations under the License.
7043
+
7044
+ -----
7045
+
6820
7046
  The following software may be included in this product: doctrine. A copy of the source code may be downloaded from https://github.com/eslint/doctrine.git. This software contains the following license and notice below:
6821
7047
 
6822
7048
  Apache License
@@ -1 +1 @@
1
- import{C as Ye,D,G as W,J as Ke,M as _,O as je,Pa as z,Q as qe,Qa as Ze,S as Xe,U as We,X as Je,Z as P,c as _e,d as Ce,e as Ue,f as ve,g as Le,h as Oe,i as De,j as Pe,k as ze,l as Be,n as Fe,na as Y,o as ke,oa as Qe,p as He,t as Ve,u as V,w as G,z as Ge}from"./chunk-SQXYZZBW.js";import{a as T,j as H}from"./chunk-GZ7LZ5UP.js";H();H();var B,J,U,K;function j(c,e=1/0,s=null){J||(J=new We(2,2,1,1)),U||(U=new qe({uniforms:{blitTexture:new Ze(c)},vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = vec4(position.xy * 1.0,0.,.999999);\n }",fragmentShader:"\n uniform sampler2D blitTexture; \n varying vec2 vUv;\n\n void main(){ \n gl_FragColor = vec4(vUv.xy, 0, 1);\n \n #ifdef IS_SRGB\n gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );\n #else\n gl_FragColor = texture2D( blitTexture, vUv);\n #endif\n }"})),U.uniforms.blitTexture.value=c,U.defines.IS_SRGB=c.colorSpace==V,U.needsUpdate=!0,K||(K=new je(J,U),K.frustrumCulled=!1);let r=new Xe,t=new P;t.add(K),s===null&&(s=B=new Je({antialias:!1}));let i=Math.min(c.image.width,e),n=Math.min(c.image.height,e);s.setSize(i,n),s.clear(),s.render(t,r);let o=document.createElement("canvas"),a=o.getContext("2d");o.width=i,o.height=n,a.drawImage(s.domElement,0,0,i,n);let u=new Qe(o);return u.minFilter=c.minFilter,u.magFilter=c.magFilter,u.wrapS=c.wrapS,u.wrapT=c.wrapT,u.name=c.name,B&&(B.forceContextLoss(),B.dispose(),B=null),u}T(j,"decompress");var $e={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},pe=class pe{constructor(){this.pluginCallbacks=[],this.register(function(e){return new ee(e)}),this.register(function(e){return new se(e)}),this.register(function(e){return new re(e)}),this.register(function(e){return new ie(e)}),this.register(function(e){return new oe(e)}),this.register(function(e){return new ae(e)}),this.register(function(e){return new te(e)}),this.register(function(e){return new ne(e)}),this.register(function(e){return new ce(e)}),this.register(function(e){return new ue(e)}),this.register(function(e){return new le(e)}),this.register(function(e){return new fe(e)}),this.register(function(e){return new he(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,s,r,t){let i=new $,n=[];for(let o=0,a=this.pluginCallbacks.length;o<a;o++)n.push(this.pluginCallbacks[o](i));i.setPlugins(n),i.write(e,s,t).catch(r)}parseAsync(e,s){let r=this;return new Promise(function(t,i){r.parse(e,t,i,s)})}};T(pe,"GLTFExporter");var q=pe,x={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},Q="KHR_mesh_quantization",b={};b[Le]=x.NEAREST;b[Oe]=x.NEAREST_MIPMAP_NEAREST;b[De]=x.NEAREST_MIPMAP_LINEAR;b[Pe]=x.LINEAR;b[ze]=x.LINEAR_MIPMAP_NEAREST;b[Be]=x.LINEAR_MIPMAP_LINEAR;b[Ue]=x.CLAMP_TO_EDGE;b[Ce]=x.REPEAT;b[ve]=x.MIRRORED_REPEAT;var es={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},cs=new Ke,ss=12,us=1179937895,ls=2,ts=8,fs=1313821514,hs=5130562;function F(c,e){return c.length===e.length&&c.every(function(s,r){return s===e[r]})}T(F,"equalArray");function ps(c){return new TextEncoder().encode(c).buffer}T(ps,"stringToArrayBuffer");function ds(c){return F(c.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}T(ds,"isIdentityMatrix");function gs(c,e,s){let r={min:new Array(c.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(c.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let t=e;t<e+s;t++)for(let i=0;i<c.itemSize;i++){let n;c.itemSize>4?n=c.array[t*c.itemSize+i]:(i===0?n=c.getX(t):i===1?n=c.getY(t):i===2?n=c.getZ(t):i===3&&(n=c.getW(t)),c.normalized===!0&&(n=G.normalize(n,c.array))),r.min[i]=Math.min(r.min[i],n),r.max[i]=Math.max(r.max[i],n)}return r}T(gs,"getMinMax");function is(c){return Math.ceil(c/4)*4}T(is,"getPaddedBufferSize");function Z(c,e=0){let s=is(c.byteLength);if(s!==c.byteLength){let r=new Uint8Array(s);if(r.set(new Uint8Array(c)),e!==0)for(let t=c.byteLength;t<s;t++)r[t]=e;return r.buffer}return c}T(Z,"getPaddedArrayBuffer");function ns(){return typeof document>"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}T(ns,"getCanvas");function rs(c,e){if(c.toBlob!==void 0)return new Promise(r=>c.toBlob(r,e));let s;return e==="image/jpeg"?s=.92:e==="image/webp"&&(s=.8),c.convertToBlob({type:e,quality:s})}T(rs,"getToBlobPromise");var de=class de{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,s,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);let t=this,i=t.buffers,n=t.json;r=t.options;let o=t.extensionsUsed,a=t.extensionsRequired,u=new Blob(i,{type:"application/octet-stream"}),p=Object.keys(o),f=Object.keys(a);if(p.length>0&&(n.extensionsUsed=p),f.length>0&&(n.extensionsRequired=f),n.buffers&&n.buffers.length>0&&(n.buffers[0].byteLength=u.size),r.binary===!0){let m=new FileReader;m.readAsArrayBuffer(u),m.onloadend=function(){let l=Z(m.result),d=new DataView(new ArrayBuffer(ts));d.setUint32(0,l.byteLength,!0),d.setUint32(4,hs,!0);let h=Z(ps(JSON.stringify(n)),32),w=new DataView(new ArrayBuffer(ts));w.setUint32(0,h.byteLength,!0),w.setUint32(4,fs,!0);let M=new ArrayBuffer(ss),N=new DataView(M);N.setUint32(0,us,!0),N.setUint32(4,ls,!0);let k=ss+w.byteLength+h.byteLength+d.byteLength+l.byteLength;N.setUint32(8,k,!0);let g=new Blob([M,w,h,d,l],{type:"application/octet-stream"}),y=new FileReader;y.readAsArrayBuffer(g),y.onloadend=function(){s(y.result)}}}else if(n.buffers&&n.buffers.length>0){let m=new FileReader;m.readAsDataURL(u),m.onloadend=function(){let l=m.result;n.buffers[0].uri=l,s(n)}}else s(n)}serializeUserData(e,s){if(Object.keys(e.userData).length===0)return;let r=this.options,t=this.extensionsUsed;try{let i=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&i.gltfExtensions){s.extensions===void 0&&(s.extensions={});for(let n in i.gltfExtensions)s.extensions[n]=i.gltfExtensions[n],t[n]=!0;delete i.gltfExtensions}Object.keys(i).length>0&&(s.extras=i)}catch(i){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+i.message)}}getUID(e,s=!1){if(this.uids.has(e)===!1){let t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(s)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;let r=new D;for(let t=0,i=e.count;t<i;t++)if(Math.abs(r.fromBufferAttribute(e,t).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){let s=this.cache;if(s.attributesNormalized.has(e))return s.attributesNormalized.get(e);let r=e.clone(),t=new D;for(let i=0,n=r.count;i<n;i++)t.fromBufferAttribute(r,i),t.x===0&&t.y===0&&t.z===0?t.setX(1):t.normalize(),r.setXYZ(i,t.x,t.y,t.z);return s.attributesNormalized.set(e,r),r}applyTextureTransform(e,s){let r=!1,t={};(s.offset.x!==0||s.offset.y!==0)&&(t.offset=s.offset.toArray(),r=!0),s.rotation!==0&&(t.rotation=s.rotation,r=!0),(s.repeat.x!==1||s.repeat.y!==1)&&(t.scale=s.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=t,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,s){if(e===s)return e;function r(l){return l.colorSpace===V?T(function(h){return h<.04045?h*.0773993808:Math.pow(h*.9478672986+.0521327014,2.4)},"SRGBToLinear"):T(function(h){return h},"LinearToLinear")}T(r,"getEncodingConversion"),console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof Y&&(e=j(e)),s instanceof Y&&(s=j(s));let t=e?e.image:null,i=s?s.image:null,n=Math.max(t?t.width:0,i?i.width:0),o=Math.max(t?t.height:0,i?i.height:0),a=ns();a.width=n,a.height=o;let u=a.getContext("2d");u.fillStyle="#00ffff",u.fillRect(0,0,n,o);let p=u.getImageData(0,0,n,o);if(t){u.drawImage(t,0,0,n,o);let l=r(e),d=u.getImageData(0,0,n,o).data;for(let h=2;h<d.length;h+=4)p.data[h]=l(d[h]/256)*256}if(i){u.drawImage(i,0,0,n,o);let l=r(s),d=u.getImageData(0,0,n,o).data;for(let h=1;h<d.length;h+=4)p.data[h]=l(d[h]/256)*256}u.putImageData(p,0,0);let m=(e||s).clone();return m.source=new Ge(a),m.colorSpace=Ve,m.channel=(e||s).channel,e&&s&&e.channel!==s.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),m}processBuffer(e){let s=this.json,r=this.buffers;return s.buffers||(s.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,s,r,t,i){let n=this.json;n.bufferViews||(n.bufferViews=[]);let o;switch(s){case x.BYTE:case x.UNSIGNED_BYTE:o=1;break;case x.SHORT:case x.UNSIGNED_SHORT:o=2;break;default:o=4}let a=is(t*e.itemSize*o),u=new DataView(new ArrayBuffer(a)),p=0;for(let l=r;l<r+t;l++)for(let d=0;d<e.itemSize;d++){let h;e.itemSize>4?h=e.array[l*e.itemSize+d]:(d===0?h=e.getX(l):d===1?h=e.getY(l):d===2?h=e.getZ(l):d===3&&(h=e.getW(l)),e.normalized===!0&&(h=G.normalize(h,e.array))),s===x.FLOAT?u.setFloat32(p,h,!0):s===x.INT?u.setInt32(p,h,!0):s===x.UNSIGNED_INT?u.setUint32(p,h,!0):s===x.SHORT?u.setInt16(p,h,!0):s===x.UNSIGNED_SHORT?u.setUint16(p,h,!0):s===x.BYTE?u.setInt8(p,h):s===x.UNSIGNED_BYTE&&u.setUint8(p,h),p+=o}let f={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:a};return i!==void 0&&(f.target=i),i===x.ARRAY_BUFFER&&(f.byteStride=e.itemSize*o),this.byteOffset+=a,n.bufferViews.push(f),{id:n.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){let s=this,r=s.json;return r.bufferViews||(r.bufferViews=[]),new Promise(function(t){let i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){let n=Z(i.result),o={buffer:s.processBuffer(n),byteOffset:s.byteOffset,byteLength:n.byteLength};s.byteOffset+=n.byteLength,t(r.bufferViews.push(o)-1)}})}processAccessor(e,s,r,t){let i=this.json,n={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"},o;if(e.array.constructor===Float32Array)o=x.FLOAT;else if(e.array.constructor===Int32Array)o=x.INT;else if(e.array.constructor===Uint32Array)o=x.UNSIGNED_INT;else if(e.array.constructor===Int16Array)o=x.SHORT;else if(e.array.constructor===Uint16Array)o=x.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)o=x.BYTE;else if(e.array.constructor===Uint8Array)o=x.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(r===void 0&&(r=0),(t===void 0||t===1/0)&&(t=e.count),t===0)return null;let a=gs(e,r,t),u;s!==void 0&&(u=e===s.index?x.ELEMENT_ARRAY_BUFFER:x.ARRAY_BUFFER);let p=this.processBufferView(e,o,r,t,u),f={bufferView:p.id,byteOffset:p.byteOffset,componentType:o,count:t,max:a.max,min:a.min,type:n[e.itemSize]};return e.normalized===!0&&(f.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(f)-1}processImage(e,s,r,t="image/png"){if(e!==null){let i=this,n=i.cache,o=i.json,a=i.options,u=i.pending;n.images.has(e)||n.images.set(e,{});let p=n.images.get(e),f=t+":flipY/"+r.toString();if(p[f]!==void 0)return p[f];o.images||(o.images=[]);let m={mimeType:t},l=ns();l.width=Math.min(e.width,a.maxTextureSize),l.height=Math.min(e.height,a.maxTextureSize);let d=l.getContext("2d");if(r===!0&&(d.translate(0,l.height),d.scale(1,-1)),e.data!==void 0){s!==Fe&&console.error("GLTFExporter: Only RGBAFormat is supported.",s),(e.width>a.maxTextureSize||e.height>a.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);let w=new Uint8ClampedArray(e.height*e.width*4);for(let M=0;M<w.length;M+=4)w[M+0]=e.data[M+0],w[M+1]=e.data[M+1],w[M+2]=e.data[M+2],w[M+3]=e.data[M+3];d.putImageData(new ImageData(w,e.width,e.height),0,0)}else if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap)d.drawImage(e,0,0,l.width,l.height);else throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement or ImageBitmap.");a.binary===!0?u.push(rs(l,t).then(w=>i.processBufferViewImage(w)).then(w=>{m.bufferView=w})):l.toDataURL!==void 0?m.uri=l.toDataURL(t):u.push(rs(l,t).then(w=>new FileReader().readAsDataURL(w)).then(w=>{m.uri=w}));let h=o.images.push(m)-1;return p[f]=h,h}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){let s=this.json;s.samplers||(s.samplers=[]);let r={magFilter:b[e.magFilter],minFilter:b[e.minFilter],wrapS:b[e.wrapS],wrapT:b[e.wrapT]};return s.samplers.push(r)-1}processTexture(e){let r=this.options,t=this.cache,i=this.json;if(t.textures.has(e))return t.textures.get(e);i.textures||(i.textures=[]),e instanceof Y&&(e=j(e,r.maxTextureSize));let n=e.userData.mimeType;n==="image/webp"&&(n="image/png");let o={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,n)};e.name&&(o.name=e.name),this._invokeAll(function(u){u.writeTexture&&u.writeTexture(e,o)});let a=i.textures.push(o)-1;return t.textures.set(e,a),a}processMaterial(e){let s=this.cache,r=this.json;if(s.materials.has(e))return s.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);let t={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");let i=e.color.toArray().concat([e.opacity]);if(F(i,[1,1,1,1])||(t.pbrMetallicRoughness.baseColorFactor=i),e.isMeshStandardMaterial?(t.pbrMetallicRoughness.metallicFactor=e.metalness,t.pbrMetallicRoughness.roughnessFactor=e.roughness):(t.pbrMetallicRoughness.metallicFactor=.5,t.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){let o=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),a={index:this.processTexture(o),channel:o.channel};this.applyTextureTransform(a,o),t.pbrMetallicRoughness.metallicRoughnessTexture=a}if(e.map){let o={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(o,e.map),t.pbrMetallicRoughness.baseColorTexture=o}if(e.emissive){let o=e.emissive;if(Math.max(o.r,o.g,o.b)>0&&(t.emissiveFactor=e.emissive.toArray()),e.emissiveMap){let u={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(u,e.emissiveMap),t.emissiveTexture=u}}if(e.normalMap){let o={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(o.scale=e.normalScale.x),this.applyTextureTransform(o,e.normalMap),t.normalTexture=o}if(e.aoMap){let o={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(o.strength=e.aoMapIntensity),this.applyTextureTransform(o,e.aoMap),t.occlusionTexture=o}e.transparent?t.alphaMode="BLEND":e.alphaTest>0&&(t.alphaMode="MASK",t.alphaCutoff=e.alphaTest),e.side===_e&&(t.doubleSided=!0),e.name!==""&&(t.name=e.name),this.serializeUserData(e,t),this._invokeAll(function(o){o.writeMaterial&&o.writeMaterial(e,t)});let n=r.materials.push(t)-1;return s.materials.set(e,n),n}processMesh(e){let s=this.cache,r=this.json,t=[e.geometry.uuid];if(Array.isArray(e.material))for(let g=0,y=e.material.length;g<y;g++)t.push(e.material[g].uuid);else t.push(e.material.uuid);let i=t.join(":");if(s.meshes.has(i))return s.meshes.get(i);let n=e.geometry,o;e.isLineSegments?o=x.LINES:e.isLineLoop?o=x.LINE_LOOP:e.isLine?o=x.LINE_STRIP:e.isPoints?o=x.POINTS:o=e.material.wireframe?x.LINES:x.TRIANGLES;let a={},u={},p=[],f=[],m={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},l=n.getAttribute("normal");l!==void 0&&!this.isNormalizedNormalAttribute(l)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),n.setAttribute("normal",this.createNormalizedNormalAttribute(l)));let d=null;for(let g in n.attributes){if(g.slice(0,5)==="morph")continue;let y=n.attributes[g];if(g=m[g]||g.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(g)||(g="_"+g),s.attributes.has(this.getUID(y))){u[g]=s.attributes.get(this.getUID(y));continue}d=null;let A=y.array;g==="JOINTS_0"&&!(A instanceof Uint16Array)&&!(A instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),d=new _(new Uint16Array(A),y.itemSize,y.normalized));let E=this.processAccessor(d||y,n);E!==null&&(g.startsWith("_")||this.detectMeshQuantization(g,y),u[g]=E,s.attributes.set(this.getUID(y),E))}if(l!==void 0&&n.setAttribute("normal",l),Object.keys(u).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){let g=[],y=[],I={};if(e.morphTargetDictionary!==void 0)for(let A in e.morphTargetDictionary)I[e.morphTargetDictionary[A]]=A;for(let A=0;A<e.morphTargetInfluences.length;++A){let E={},Se=!1;for(let v in n.morphAttributes){if(v!=="position"&&v!=="normal"){Se||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),Se=!0);continue}let S=n.morphAttributes[v][A],X=v.toUpperCase(),L=n.attributes[v];if(s.attributes.has(this.getUID(S,!0))){E[X]=s.attributes.get(this.getUID(S,!0));continue}let O=S.clone();if(!n.morphTargetsRelative)for(let R=0,os=S.count;R<os;R++)for(let C=0;C<S.itemSize;C++)C===0&&O.setX(R,S.getX(R)-L.getX(R)),C===1&&O.setY(R,S.getY(R)-L.getY(R)),C===2&&O.setZ(R,S.getZ(R)-L.getZ(R)),C===3&&O.setW(R,S.getW(R)-L.getW(R));E[X]=this.processAccessor(O,n),s.attributes.set(this.getUID(L,!0),E[X])}f.push(E),g.push(e.morphTargetInfluences[A]),e.morphTargetDictionary!==void 0&&y.push(I[A])}a.weights=g,y.length>0&&(a.extras={},a.extras.targetNames=y)}let h=Array.isArray(e.material);if(h&&n.groups.length===0)return null;let w=!1;if(h&&n.index===null){let g=[];for(let y=0,I=n.attributes.position.count;y<I;y++)g[y]=y;n.setIndex(g),w=!0}let M=h?e.material:[e.material],N=h?n.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let g=0,y=N.length;g<y;g++){let I={mode:o,attributes:u};if(this.serializeUserData(n,I),f.length>0&&(I.targets=f),n.index!==null){let E=this.getUID(n.index);(N[g].start!==void 0||N[g].count!==void 0)&&(E+=":"+N[g].start+":"+N[g].count),s.attributes.has(E)?I.indices=s.attributes.get(E):(I.indices=this.processAccessor(n.index,n,N[g].start,N[g].count),s.attributes.set(E,I.indices)),I.indices===null&&delete I.indices}let A=this.processMaterial(M[N[g].materialIndex]);A!==null&&(I.material=A),p.push(I)}w===!0&&n.setIndex(null),a.primitives=p,r.meshes||(r.meshes=[]),this._invokeAll(function(g){g.writeMesh&&g.writeMesh(e,a)});let k=r.meshes.push(a)-1;return s.meshes.set(i,k),k}detectMeshQuantization(e,s){if(this.extensionsUsed[Q])return;let r;switch(s.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}s.normalized&&(r+=" normalized");let t=e.split("_",1)[0];$e[t]&&$e[t].includes(r)&&(this.extensionsUsed[Q]=!0,this.extensionsRequired[Q]=!0)}processCamera(e){let s=this.json;s.cameras||(s.cameras=[]);let r=e.isOrthographicCamera,t={type:r?"orthographic":"perspective"};return r?t.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:t.perspective={aspectRatio:e.aspect,yfov:G.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(t.name=e.type),s.cameras.push(t)-1}processAnimation(e,s){let r=this.json,t=this.nodeMap;r.animations||(r.animations=[]),e=q.Utils.mergeMorphTargetTracks(e.clone(),s);let i=e.tracks,n=[],o=[];for(let a=0;a<i.length;++a){let u=i[a],p=z.parseTrackName(u.name),f=z.findNode(s,p.nodeName),m=es[p.propertyName];if(p.objectName==="bones"&&(f.isSkinnedMesh===!0?f=f.skeleton.getBoneByName(p.objectIndex):f=void 0),!f||!m)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name),null;let l=1,d=u.values.length/u.times.length;m===es.morphTargetInfluences&&(d/=f.morphTargetInfluences.length);let h;u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(h="CUBICSPLINE",d/=3):u.getInterpolation()===ke?h="STEP":h="LINEAR",o.push({input:this.processAccessor(new _(u.times,l)),output:this.processAccessor(new _(u.values,d)),interpolation:h}),n.push({sampler:o.length-1,target:{node:t.get(f),path:m}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:n}),r.animations.length-1}processSkin(e){let s=this.json,r=this.nodeMap,t=s.nodes[r.get(e)],i=e.skeleton;if(i===void 0)return null;let n=e.skeleton.bones[0];if(n===void 0)return null;let o=[],a=new Float32Array(i.bones.length*16),u=new W;for(let f=0;f<i.bones.length;++f)o.push(r.get(i.bones[f])),u.copy(i.boneInverses[f]),u.multiply(e.bindMatrix).toArray(a,f*16);return s.skins===void 0&&(s.skins=[]),s.skins.push({inverseBindMatrices:this.processAccessor(new _(a,16)),joints:o,skeleton:r.get(n)}),t.skin=s.skins.length-1}processNode(e){let s=this.json,r=this.options,t=this.nodeMap;s.nodes||(s.nodes=[]);let i={};if(r.trs){let o=e.quaternion.toArray(),a=e.position.toArray(),u=e.scale.toArray();F(o,[0,0,0,1])||(i.rotation=o),F(a,[0,0,0])||(i.translation=a),F(u,[1,1,1])||(i.scale=u)}else e.matrixAutoUpdate&&e.updateMatrix(),ds(e.matrix)===!1&&(i.matrix=e.matrix.elements);if(e.name!==""&&(i.name=String(e.name)),this.serializeUserData(e,i),e.isMesh||e.isLine||e.isPoints){let o=this.processMesh(e);o!==null&&(i.mesh=o)}else e.isCamera&&(i.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){let o=[];for(let a=0,u=e.children.length;a<u;a++){let p=e.children[a];if(p.visible||r.onlyVisible===!1){let f=this.processNode(p);f!==null&&o.push(f)}}o.length>0&&(i.children=o)}this._invokeAll(function(o){o.writeNode&&o.writeNode(e,i)});let n=s.nodes.push(i)-1;return t.set(e,n),n}processScene(e){let s=this.json,r=this.options;s.scenes||(s.scenes=[],s.scene=0);let t={};e.name!==""&&(t.name=e.name),s.scenes.push(t);let i=[];for(let n=0,o=e.children.length;n<o;n++){let a=e.children[n];if(a.visible||r.onlyVisible===!1){let u=this.processNode(a);u!==null&&i.push(u)}}i.length>0&&(t.nodes=i),this.serializeUserData(e,t)}processObjects(e){let s=new P;s.name="AuxScene";for(let r=0;r<e.length;r++)s.children.push(e[r]);this.processScene(s)}processInput(e){let s=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(t){t.beforeParse&&t.beforeParse(e)});let r=[];for(let t=0;t<e.length;t++)e[t]instanceof P?this.processScene(e[t]):r.push(e[t]);r.length>0&&this.processObjects(r);for(let t=0;t<this.skins.length;++t)this.processSkin(this.skins[t]);for(let t=0;t<s.animations.length;++t)this.processAnimation(s.animations[t],e[0]);this._invokeAll(function(t){t.afterParse&&t.afterParse(e)})}_invokeAll(e){for(let s=0,r=this.plugins.length;s<r;s++)e(this.plugins[s])}};T(de,"GLTFWriter");var $=de,ge=class ge{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,s){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}let r=this.writer,t=r.json,i=r.extensionsUsed,n={};e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",e.distance>0&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",e.distance>0&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(1-e.penumbra)*e.angle,n.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(t.extensions=t.extensions||{},t.extensions[this.name]={lights:[]},i[this.name]=!0);let o=t.extensions[this.name].lights;o.push(n),s.extensions=s.extensions||{},s.extensions[this.name]={light:o.length-1}}};T(ge,"GLTFLightExtension");var ee=ge,xe=class xe{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,s){if(!e.isMeshBasicMaterial)return;let t=this.writer.extensionsUsed;s.extensions=s.extensions||{},s.extensions[this.name]={},t[this.name]=!0,s.pbrMetallicRoughness.metallicFactor=0,s.pbrMetallicRoughness.roughnessFactor=.9}};T(xe,"GLTFMaterialsUnlitExtension");var se=xe,me=class me{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;let r=this.writer,t=r.extensionsUsed,i={};if(i.clearcoatFactor=e.clearcoat,e.clearcoatMap){let n={index:r.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};r.applyTextureTransform(n,e.clearcoatMap),i.clearcoatTexture=n}if(i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){let n={index:r.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};r.applyTextureTransform(n,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=n}if(e.clearcoatNormalMap){let n={index:r.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};r.applyTextureTransform(n,e.clearcoatNormalMap),i.clearcoatNormalTexture=n}s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(me,"GLTFMaterialsClearcoatExtension");var te=me,Te=class Te{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;let r=this.writer,t=r.extensionsUsed,i={};if(i.iridescenceFactor=e.iridescence,e.iridescenceMap){let n={index:r.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};r.applyTextureTransform(n,e.iridescenceMap),i.iridescenceTexture=n}if(i.iridescenceIor=e.iridescenceIOR,i.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){let n={index:r.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};r.applyTextureTransform(n,e.iridescenceThicknessMap),i.iridescenceThicknessTexture=n}s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(Te,"GLTFMaterialsIridescenceExtension");var ne=Te,ye=class ye{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;let r=this.writer,t=r.extensionsUsed,i={};if(i.transmissionFactor=e.transmission,e.transmissionMap){let n={index:r.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(n,e.transmissionMap),i.transmissionTexture=n}s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(ye,"GLTFMaterialsTransmissionExtension");var re=ye,we=class we{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;let r=this.writer,t=r.extensionsUsed,i={};if(i.thicknessFactor=e.thickness,e.thicknessMap){let n={index:r.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};r.applyTextureTransform(n,e.thicknessMap),i.thicknessTexture=n}i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(we,"GLTFMaterialsVolumeExtension");var ie=we,Me=class Me{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;let t=this.writer.extensionsUsed,i={};i.ior=e.ior,s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(Me,"GLTFMaterialsIorExtension");var oe=Me,Ie=class Ie{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(cs)&&!e.specularIntensityMap&&!e.specularColorMap)return;let r=this.writer,t=r.extensionsUsed,i={};if(e.specularIntensityMap){let n={index:r.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};r.applyTextureTransform(n,e.specularIntensityMap),i.specularTexture=n}if(e.specularColorMap){let n={index:r.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};r.applyTextureTransform(n,e.specularColorMap),i.specularColorTexture=n}i.specularFactor=e.specularIntensity,i.specularColorFactor=e.specularColor.toArray(),s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(Ie,"GLTFMaterialsSpecularExtension");var ae=Ie,Ae=class Ae{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;let r=this.writer,t=r.extensionsUsed,i={};if(e.sheenRoughnessMap){let n={index:r.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(n,e.sheenRoughnessMap),i.sheenRoughnessTexture=n}if(e.sheenColorMap){let n={index:r.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(n,e.sheenColorMap),i.sheenColorTexture=n}i.sheenRoughnessFactor=e.sheenRoughness,i.sheenColorFactor=e.sheenColor.toArray(),s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(Ae,"GLTFMaterialsSheenExtension");var ce=Ae,Re=class Re{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;let r=this.writer,t=r.extensionsUsed,i={};if(e.anisotropyMap){let n={index:r.processTexture(e.anisotropyMap)};r.applyTextureTransform(n,e.anisotropyMap),i.anisotropyTexture=n}i.anisotropyStrength=e.anisotropy,i.anisotropyRotation=e.anisotropyRotation,s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(Re,"GLTFMaterialsAnisotropyExtension");var ue=Re,Ee=class Ee{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,s){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;let t=this.writer.extensionsUsed,i={};i.emissiveStrength=e.emissiveIntensity,s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(Ee,"GLTFMaterialsEmissiveStrengthExtension");var le=Ee,be=class be{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,s){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;let r=this.writer,t=r.extensionsUsed,i={};if(e.bumpMap){let n={index:r.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};r.applyTextureTransform(n,e.bumpMap),i.bumpTexture=n}i.bumpFactor=e.bumpScale,s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(be,"GLTFMaterialsBumpExtension");var fe=be,Ne=class Ne{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,s){if(!e.isInstancedMesh)return;let r=this.writer,t=e,i=new Float32Array(t.count*3),n=new Float32Array(t.count*4),o=new Float32Array(t.count*3),a=new W,u=new D,p=new Ye,f=new D;for(let l=0;l<t.count;l++)t.getMatrixAt(l,a),a.decompose(u,p,f),u.toArray(i,l*3),p.toArray(n,l*4),f.toArray(o,l*3);let m={TRANSLATION:r.processAccessor(new _(i,3)),ROTATION:r.processAccessor(new _(n,4)),SCALE:r.processAccessor(new _(o,3))};t.instanceColor&&(m._COLOR_0=r.processAccessor(t.instanceColor)),s.extensions=s.extensions||{},s.extensions[this.name]={attributes:m},r.extensionsUsed[this.name]=!0,r.extensionsRequired[this.name]=!0}};T(Ne,"GLTFMeshGpuInstancing");var he=Ne;q.Utils={insertKeyframe:function(c,e){let r=c.getValueSize(),t=new c.TimeBufferType(c.times.length+1),i=new c.ValueBufferType(c.values.length+r),n=c.createInterpolant(new c.ValueBufferType(r)),o;if(c.times.length===0){t[0]=e;for(let a=0;a<r;a++)i[a]=0;o=0}else if(e<c.times[0]){if(Math.abs(c.times[0]-e)<.001)return 0;t[0]=e,t.set(c.times,1),i.set(n.evaluate(e),0),i.set(c.values,r),o=0}else if(e>c.times[c.times.length-1]){if(Math.abs(c.times[c.times.length-1]-e)<.001)return c.times.length-1;t[t.length-1]=e,t.set(c.times,0),i.set(c.values,0),i.set(n.evaluate(e),c.values.length),o=t.length-1}else for(let a=0;a<c.times.length;a++){if(Math.abs(c.times[a]-e)<.001)return a;if(c.times[a]<e&&c.times[a+1]>e){t.set(c.times.slice(0,a+1),0),t[a+1]=e,t.set(c.times.slice(a+1),a+2),i.set(c.values.slice(0,(a+1)*r),0),i.set(n.evaluate(e),(a+1)*r),i.set(c.values.slice((a+1)*r),(a+2)*r),o=a+1;break}}return c.times=t,c.values=i,o},mergeMorphTargetTracks:function(c,e){let s=[],r={},t=c.tracks;for(let i=0;i<t.length;++i){let n=t[i],o=z.parseTrackName(n.name),a=z.findNode(e,o.nodeName);if(o.propertyName!=="morphTargetInfluences"||o.propertyIndex===void 0){s.push(n);continue}if(n.createInterpolant!==n.InterpolantFactoryMethodDiscrete&&n.createInterpolant!==n.InterpolantFactoryMethodLinear){if(n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),n=n.clone(),n.setInterpolation(He)}let u=a.morphTargetInfluences.length,p=a.morphTargetDictionary[o.propertyIndex];if(p===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+o.propertyIndex);let f;if(r[a.uuid]===void 0){f=n.clone();let l=new f.ValueBufferType(u*f.times.length);for(let d=0;d<f.times.length;d++)l[d*u+p]=f.values[d];f.name=(o.nodeName||"")+".morphTargetInfluences",f.values=l,r[a.uuid]=f,s.push(f);continue}let m=n.createInterpolant(new n.ValueBufferType(1));f=r[a.uuid];for(let l=0;l<f.times.length;l++)f.values[l*u+p]=m.evaluate(f.times[l]);for(let l=0;l<n.times.length;l++){let d=this.insertKeyframe(f,n.times[l]);f.values[d*u+p]=n.values[l]}}return c.tracks=s,c}};export{q as GLTFExporter};
1
+ import{C as Ye,D,G as W,J as Ke,M as _,O as je,Pa as z,Q as qe,Qa as Ze,S as Xe,U as We,X as Je,Z as P,c as _e,d as Ce,e as Ue,f as ve,g as Le,h as Oe,i as De,j as Pe,k as ze,l as Be,n as Fe,na as Y,o as ke,oa as Qe,p as He,t as Ve,u as V,w as G,z as Ge}from"./chunk-TZI6DH4C.js";import{a as T,j as H}from"./chunk-MG6EK6W7.js";H();H();var B,J,U,K;function j(c,e=1/0,s=null){J||(J=new We(2,2,1,1)),U||(U=new qe({uniforms:{blitTexture:new Ze(c)},vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = vec4(position.xy * 1.0,0.,.999999);\n }",fragmentShader:"\n uniform sampler2D blitTexture; \n varying vec2 vUv;\n\n void main(){ \n gl_FragColor = vec4(vUv.xy, 0, 1);\n \n #ifdef IS_SRGB\n gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );\n #else\n gl_FragColor = texture2D( blitTexture, vUv);\n #endif\n }"})),U.uniforms.blitTexture.value=c,U.defines.IS_SRGB=c.colorSpace==V,U.needsUpdate=!0,K||(K=new je(J,U),K.frustrumCulled=!1);let r=new Xe,t=new P;t.add(K),s===null&&(s=B=new Je({antialias:!1}));let i=Math.min(c.image.width,e),n=Math.min(c.image.height,e);s.setSize(i,n),s.clear(),s.render(t,r);let o=document.createElement("canvas"),a=o.getContext("2d");o.width=i,o.height=n,a.drawImage(s.domElement,0,0,i,n);let u=new Qe(o);return u.minFilter=c.minFilter,u.magFilter=c.magFilter,u.wrapS=c.wrapS,u.wrapT=c.wrapT,u.name=c.name,B&&(B.forceContextLoss(),B.dispose(),B=null),u}T(j,"decompress");var $e={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},pe=class pe{constructor(){this.pluginCallbacks=[],this.register(function(e){return new ee(e)}),this.register(function(e){return new se(e)}),this.register(function(e){return new re(e)}),this.register(function(e){return new ie(e)}),this.register(function(e){return new oe(e)}),this.register(function(e){return new ae(e)}),this.register(function(e){return new te(e)}),this.register(function(e){return new ne(e)}),this.register(function(e){return new ce(e)}),this.register(function(e){return new ue(e)}),this.register(function(e){return new le(e)}),this.register(function(e){return new fe(e)}),this.register(function(e){return new he(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,s,r,t){let i=new $,n=[];for(let o=0,a=this.pluginCallbacks.length;o<a;o++)n.push(this.pluginCallbacks[o](i));i.setPlugins(n),i.write(e,s,t).catch(r)}parseAsync(e,s){let r=this;return new Promise(function(t,i){r.parse(e,t,i,s)})}};T(pe,"GLTFExporter");var q=pe,x={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},Q="KHR_mesh_quantization",b={};b[Le]=x.NEAREST;b[Oe]=x.NEAREST_MIPMAP_NEAREST;b[De]=x.NEAREST_MIPMAP_LINEAR;b[Pe]=x.LINEAR;b[ze]=x.LINEAR_MIPMAP_NEAREST;b[Be]=x.LINEAR_MIPMAP_LINEAR;b[Ue]=x.CLAMP_TO_EDGE;b[Ce]=x.REPEAT;b[ve]=x.MIRRORED_REPEAT;var es={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},cs=new Ke,ss=12,us=1179937895,ls=2,ts=8,fs=1313821514,hs=5130562;function F(c,e){return c.length===e.length&&c.every(function(s,r){return s===e[r]})}T(F,"equalArray");function ps(c){return new TextEncoder().encode(c).buffer}T(ps,"stringToArrayBuffer");function ds(c){return F(c.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}T(ds,"isIdentityMatrix");function gs(c,e,s){let r={min:new Array(c.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(c.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let t=e;t<e+s;t++)for(let i=0;i<c.itemSize;i++){let n;c.itemSize>4?n=c.array[t*c.itemSize+i]:(i===0?n=c.getX(t):i===1?n=c.getY(t):i===2?n=c.getZ(t):i===3&&(n=c.getW(t)),c.normalized===!0&&(n=G.normalize(n,c.array))),r.min[i]=Math.min(r.min[i],n),r.max[i]=Math.max(r.max[i],n)}return r}T(gs,"getMinMax");function is(c){return Math.ceil(c/4)*4}T(is,"getPaddedBufferSize");function Z(c,e=0){let s=is(c.byteLength);if(s!==c.byteLength){let r=new Uint8Array(s);if(r.set(new Uint8Array(c)),e!==0)for(let t=c.byteLength;t<s;t++)r[t]=e;return r.buffer}return c}T(Z,"getPaddedArrayBuffer");function ns(){return typeof document>"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}T(ns,"getCanvas");function rs(c,e){if(c.toBlob!==void 0)return new Promise(r=>c.toBlob(r,e));let s;return e==="image/jpeg"?s=.92:e==="image/webp"&&(s=.8),c.convertToBlob({type:e,quality:s})}T(rs,"getToBlobPromise");var de=class de{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,s,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);let t=this,i=t.buffers,n=t.json;r=t.options;let o=t.extensionsUsed,a=t.extensionsRequired,u=new Blob(i,{type:"application/octet-stream"}),p=Object.keys(o),f=Object.keys(a);if(p.length>0&&(n.extensionsUsed=p),f.length>0&&(n.extensionsRequired=f),n.buffers&&n.buffers.length>0&&(n.buffers[0].byteLength=u.size),r.binary===!0){let m=new FileReader;m.readAsArrayBuffer(u),m.onloadend=function(){let l=Z(m.result),d=new DataView(new ArrayBuffer(ts));d.setUint32(0,l.byteLength,!0),d.setUint32(4,hs,!0);let h=Z(ps(JSON.stringify(n)),32),w=new DataView(new ArrayBuffer(ts));w.setUint32(0,h.byteLength,!0),w.setUint32(4,fs,!0);let M=new ArrayBuffer(ss),N=new DataView(M);N.setUint32(0,us,!0),N.setUint32(4,ls,!0);let k=ss+w.byteLength+h.byteLength+d.byteLength+l.byteLength;N.setUint32(8,k,!0);let g=new Blob([M,w,h,d,l],{type:"application/octet-stream"}),y=new FileReader;y.readAsArrayBuffer(g),y.onloadend=function(){s(y.result)}}}else if(n.buffers&&n.buffers.length>0){let m=new FileReader;m.readAsDataURL(u),m.onloadend=function(){let l=m.result;n.buffers[0].uri=l,s(n)}}else s(n)}serializeUserData(e,s){if(Object.keys(e.userData).length===0)return;let r=this.options,t=this.extensionsUsed;try{let i=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&i.gltfExtensions){s.extensions===void 0&&(s.extensions={});for(let n in i.gltfExtensions)s.extensions[n]=i.gltfExtensions[n],t[n]=!0;delete i.gltfExtensions}Object.keys(i).length>0&&(s.extras=i)}catch(i){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+i.message)}}getUID(e,s=!1){if(this.uids.has(e)===!1){let t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(s)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;let r=new D;for(let t=0,i=e.count;t<i;t++)if(Math.abs(r.fromBufferAttribute(e,t).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){let s=this.cache;if(s.attributesNormalized.has(e))return s.attributesNormalized.get(e);let r=e.clone(),t=new D;for(let i=0,n=r.count;i<n;i++)t.fromBufferAttribute(r,i),t.x===0&&t.y===0&&t.z===0?t.setX(1):t.normalize(),r.setXYZ(i,t.x,t.y,t.z);return s.attributesNormalized.set(e,r),r}applyTextureTransform(e,s){let r=!1,t={};(s.offset.x!==0||s.offset.y!==0)&&(t.offset=s.offset.toArray(),r=!0),s.rotation!==0&&(t.rotation=s.rotation,r=!0),(s.repeat.x!==1||s.repeat.y!==1)&&(t.scale=s.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=t,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,s){if(e===s)return e;function r(l){return l.colorSpace===V?T(function(h){return h<.04045?h*.0773993808:Math.pow(h*.9478672986+.0521327014,2.4)},"SRGBToLinear"):T(function(h){return h},"LinearToLinear")}T(r,"getEncodingConversion"),console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof Y&&(e=j(e)),s instanceof Y&&(s=j(s));let t=e?e.image:null,i=s?s.image:null,n=Math.max(t?t.width:0,i?i.width:0),o=Math.max(t?t.height:0,i?i.height:0),a=ns();a.width=n,a.height=o;let u=a.getContext("2d");u.fillStyle="#00ffff",u.fillRect(0,0,n,o);let p=u.getImageData(0,0,n,o);if(t){u.drawImage(t,0,0,n,o);let l=r(e),d=u.getImageData(0,0,n,o).data;for(let h=2;h<d.length;h+=4)p.data[h]=l(d[h]/256)*256}if(i){u.drawImage(i,0,0,n,o);let l=r(s),d=u.getImageData(0,0,n,o).data;for(let h=1;h<d.length;h+=4)p.data[h]=l(d[h]/256)*256}u.putImageData(p,0,0);let m=(e||s).clone();return m.source=new Ge(a),m.colorSpace=Ve,m.channel=(e||s).channel,e&&s&&e.channel!==s.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),m}processBuffer(e){let s=this.json,r=this.buffers;return s.buffers||(s.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,s,r,t,i){let n=this.json;n.bufferViews||(n.bufferViews=[]);let o;switch(s){case x.BYTE:case x.UNSIGNED_BYTE:o=1;break;case x.SHORT:case x.UNSIGNED_SHORT:o=2;break;default:o=4}let a=is(t*e.itemSize*o),u=new DataView(new ArrayBuffer(a)),p=0;for(let l=r;l<r+t;l++)for(let d=0;d<e.itemSize;d++){let h;e.itemSize>4?h=e.array[l*e.itemSize+d]:(d===0?h=e.getX(l):d===1?h=e.getY(l):d===2?h=e.getZ(l):d===3&&(h=e.getW(l)),e.normalized===!0&&(h=G.normalize(h,e.array))),s===x.FLOAT?u.setFloat32(p,h,!0):s===x.INT?u.setInt32(p,h,!0):s===x.UNSIGNED_INT?u.setUint32(p,h,!0):s===x.SHORT?u.setInt16(p,h,!0):s===x.UNSIGNED_SHORT?u.setUint16(p,h,!0):s===x.BYTE?u.setInt8(p,h):s===x.UNSIGNED_BYTE&&u.setUint8(p,h),p+=o}let f={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:a};return i!==void 0&&(f.target=i),i===x.ARRAY_BUFFER&&(f.byteStride=e.itemSize*o),this.byteOffset+=a,n.bufferViews.push(f),{id:n.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){let s=this,r=s.json;return r.bufferViews||(r.bufferViews=[]),new Promise(function(t){let i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){let n=Z(i.result),o={buffer:s.processBuffer(n),byteOffset:s.byteOffset,byteLength:n.byteLength};s.byteOffset+=n.byteLength,t(r.bufferViews.push(o)-1)}})}processAccessor(e,s,r,t){let i=this.json,n={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"},o;if(e.array.constructor===Float32Array)o=x.FLOAT;else if(e.array.constructor===Int32Array)o=x.INT;else if(e.array.constructor===Uint32Array)o=x.UNSIGNED_INT;else if(e.array.constructor===Int16Array)o=x.SHORT;else if(e.array.constructor===Uint16Array)o=x.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)o=x.BYTE;else if(e.array.constructor===Uint8Array)o=x.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(r===void 0&&(r=0),(t===void 0||t===1/0)&&(t=e.count),t===0)return null;let a=gs(e,r,t),u;s!==void 0&&(u=e===s.index?x.ELEMENT_ARRAY_BUFFER:x.ARRAY_BUFFER);let p=this.processBufferView(e,o,r,t,u),f={bufferView:p.id,byteOffset:p.byteOffset,componentType:o,count:t,max:a.max,min:a.min,type:n[e.itemSize]};return e.normalized===!0&&(f.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(f)-1}processImage(e,s,r,t="image/png"){if(e!==null){let i=this,n=i.cache,o=i.json,a=i.options,u=i.pending;n.images.has(e)||n.images.set(e,{});let p=n.images.get(e),f=t+":flipY/"+r.toString();if(p[f]!==void 0)return p[f];o.images||(o.images=[]);let m={mimeType:t},l=ns();l.width=Math.min(e.width,a.maxTextureSize),l.height=Math.min(e.height,a.maxTextureSize);let d=l.getContext("2d");if(r===!0&&(d.translate(0,l.height),d.scale(1,-1)),e.data!==void 0){s!==Fe&&console.error("GLTFExporter: Only RGBAFormat is supported.",s),(e.width>a.maxTextureSize||e.height>a.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);let w=new Uint8ClampedArray(e.height*e.width*4);for(let M=0;M<w.length;M+=4)w[M+0]=e.data[M+0],w[M+1]=e.data[M+1],w[M+2]=e.data[M+2],w[M+3]=e.data[M+3];d.putImageData(new ImageData(w,e.width,e.height),0,0)}else if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap)d.drawImage(e,0,0,l.width,l.height);else throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement or ImageBitmap.");a.binary===!0?u.push(rs(l,t).then(w=>i.processBufferViewImage(w)).then(w=>{m.bufferView=w})):l.toDataURL!==void 0?m.uri=l.toDataURL(t):u.push(rs(l,t).then(w=>new FileReader().readAsDataURL(w)).then(w=>{m.uri=w}));let h=o.images.push(m)-1;return p[f]=h,h}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){let s=this.json;s.samplers||(s.samplers=[]);let r={magFilter:b[e.magFilter],minFilter:b[e.minFilter],wrapS:b[e.wrapS],wrapT:b[e.wrapT]};return s.samplers.push(r)-1}processTexture(e){let r=this.options,t=this.cache,i=this.json;if(t.textures.has(e))return t.textures.get(e);i.textures||(i.textures=[]),e instanceof Y&&(e=j(e,r.maxTextureSize));let n=e.userData.mimeType;n==="image/webp"&&(n="image/png");let o={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,n)};e.name&&(o.name=e.name),this._invokeAll(function(u){u.writeTexture&&u.writeTexture(e,o)});let a=i.textures.push(o)-1;return t.textures.set(e,a),a}processMaterial(e){let s=this.cache,r=this.json;if(s.materials.has(e))return s.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);let t={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");let i=e.color.toArray().concat([e.opacity]);if(F(i,[1,1,1,1])||(t.pbrMetallicRoughness.baseColorFactor=i),e.isMeshStandardMaterial?(t.pbrMetallicRoughness.metallicFactor=e.metalness,t.pbrMetallicRoughness.roughnessFactor=e.roughness):(t.pbrMetallicRoughness.metallicFactor=.5,t.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){let o=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),a={index:this.processTexture(o),channel:o.channel};this.applyTextureTransform(a,o),t.pbrMetallicRoughness.metallicRoughnessTexture=a}if(e.map){let o={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(o,e.map),t.pbrMetallicRoughness.baseColorTexture=o}if(e.emissive){let o=e.emissive;if(Math.max(o.r,o.g,o.b)>0&&(t.emissiveFactor=e.emissive.toArray()),e.emissiveMap){let u={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(u,e.emissiveMap),t.emissiveTexture=u}}if(e.normalMap){let o={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(o.scale=e.normalScale.x),this.applyTextureTransform(o,e.normalMap),t.normalTexture=o}if(e.aoMap){let o={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(o.strength=e.aoMapIntensity),this.applyTextureTransform(o,e.aoMap),t.occlusionTexture=o}e.transparent?t.alphaMode="BLEND":e.alphaTest>0&&(t.alphaMode="MASK",t.alphaCutoff=e.alphaTest),e.side===_e&&(t.doubleSided=!0),e.name!==""&&(t.name=e.name),this.serializeUserData(e,t),this._invokeAll(function(o){o.writeMaterial&&o.writeMaterial(e,t)});let n=r.materials.push(t)-1;return s.materials.set(e,n),n}processMesh(e){let s=this.cache,r=this.json,t=[e.geometry.uuid];if(Array.isArray(e.material))for(let g=0,y=e.material.length;g<y;g++)t.push(e.material[g].uuid);else t.push(e.material.uuid);let i=t.join(":");if(s.meshes.has(i))return s.meshes.get(i);let n=e.geometry,o;e.isLineSegments?o=x.LINES:e.isLineLoop?o=x.LINE_LOOP:e.isLine?o=x.LINE_STRIP:e.isPoints?o=x.POINTS:o=e.material.wireframe?x.LINES:x.TRIANGLES;let a={},u={},p=[],f=[],m={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},l=n.getAttribute("normal");l!==void 0&&!this.isNormalizedNormalAttribute(l)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),n.setAttribute("normal",this.createNormalizedNormalAttribute(l)));let d=null;for(let g in n.attributes){if(g.slice(0,5)==="morph")continue;let y=n.attributes[g];if(g=m[g]||g.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(g)||(g="_"+g),s.attributes.has(this.getUID(y))){u[g]=s.attributes.get(this.getUID(y));continue}d=null;let A=y.array;g==="JOINTS_0"&&!(A instanceof Uint16Array)&&!(A instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),d=new _(new Uint16Array(A),y.itemSize,y.normalized));let E=this.processAccessor(d||y,n);E!==null&&(g.startsWith("_")||this.detectMeshQuantization(g,y),u[g]=E,s.attributes.set(this.getUID(y),E))}if(l!==void 0&&n.setAttribute("normal",l),Object.keys(u).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){let g=[],y=[],I={};if(e.morphTargetDictionary!==void 0)for(let A in e.morphTargetDictionary)I[e.morphTargetDictionary[A]]=A;for(let A=0;A<e.morphTargetInfluences.length;++A){let E={},Se=!1;for(let v in n.morphAttributes){if(v!=="position"&&v!=="normal"){Se||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),Se=!0);continue}let S=n.morphAttributes[v][A],X=v.toUpperCase(),L=n.attributes[v];if(s.attributes.has(this.getUID(S,!0))){E[X]=s.attributes.get(this.getUID(S,!0));continue}let O=S.clone();if(!n.morphTargetsRelative)for(let R=0,os=S.count;R<os;R++)for(let C=0;C<S.itemSize;C++)C===0&&O.setX(R,S.getX(R)-L.getX(R)),C===1&&O.setY(R,S.getY(R)-L.getY(R)),C===2&&O.setZ(R,S.getZ(R)-L.getZ(R)),C===3&&O.setW(R,S.getW(R)-L.getW(R));E[X]=this.processAccessor(O,n),s.attributes.set(this.getUID(L,!0),E[X])}f.push(E),g.push(e.morphTargetInfluences[A]),e.morphTargetDictionary!==void 0&&y.push(I[A])}a.weights=g,y.length>0&&(a.extras={},a.extras.targetNames=y)}let h=Array.isArray(e.material);if(h&&n.groups.length===0)return null;let w=!1;if(h&&n.index===null){let g=[];for(let y=0,I=n.attributes.position.count;y<I;y++)g[y]=y;n.setIndex(g),w=!0}let M=h?e.material:[e.material],N=h?n.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let g=0,y=N.length;g<y;g++){let I={mode:o,attributes:u};if(this.serializeUserData(n,I),f.length>0&&(I.targets=f),n.index!==null){let E=this.getUID(n.index);(N[g].start!==void 0||N[g].count!==void 0)&&(E+=":"+N[g].start+":"+N[g].count),s.attributes.has(E)?I.indices=s.attributes.get(E):(I.indices=this.processAccessor(n.index,n,N[g].start,N[g].count),s.attributes.set(E,I.indices)),I.indices===null&&delete I.indices}let A=this.processMaterial(M[N[g].materialIndex]);A!==null&&(I.material=A),p.push(I)}w===!0&&n.setIndex(null),a.primitives=p,r.meshes||(r.meshes=[]),this._invokeAll(function(g){g.writeMesh&&g.writeMesh(e,a)});let k=r.meshes.push(a)-1;return s.meshes.set(i,k),k}detectMeshQuantization(e,s){if(this.extensionsUsed[Q])return;let r;switch(s.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}s.normalized&&(r+=" normalized");let t=e.split("_",1)[0];$e[t]&&$e[t].includes(r)&&(this.extensionsUsed[Q]=!0,this.extensionsRequired[Q]=!0)}processCamera(e){let s=this.json;s.cameras||(s.cameras=[]);let r=e.isOrthographicCamera,t={type:r?"orthographic":"perspective"};return r?t.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:t.perspective={aspectRatio:e.aspect,yfov:G.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(t.name=e.type),s.cameras.push(t)-1}processAnimation(e,s){let r=this.json,t=this.nodeMap;r.animations||(r.animations=[]),e=q.Utils.mergeMorphTargetTracks(e.clone(),s);let i=e.tracks,n=[],o=[];for(let a=0;a<i.length;++a){let u=i[a],p=z.parseTrackName(u.name),f=z.findNode(s,p.nodeName),m=es[p.propertyName];if(p.objectName==="bones"&&(f.isSkinnedMesh===!0?f=f.skeleton.getBoneByName(p.objectIndex):f=void 0),!f||!m)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name),null;let l=1,d=u.values.length/u.times.length;m===es.morphTargetInfluences&&(d/=f.morphTargetInfluences.length);let h;u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(h="CUBICSPLINE",d/=3):u.getInterpolation()===ke?h="STEP":h="LINEAR",o.push({input:this.processAccessor(new _(u.times,l)),output:this.processAccessor(new _(u.values,d)),interpolation:h}),n.push({sampler:o.length-1,target:{node:t.get(f),path:m}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:n}),r.animations.length-1}processSkin(e){let s=this.json,r=this.nodeMap,t=s.nodes[r.get(e)],i=e.skeleton;if(i===void 0)return null;let n=e.skeleton.bones[0];if(n===void 0)return null;let o=[],a=new Float32Array(i.bones.length*16),u=new W;for(let f=0;f<i.bones.length;++f)o.push(r.get(i.bones[f])),u.copy(i.boneInverses[f]),u.multiply(e.bindMatrix).toArray(a,f*16);return s.skins===void 0&&(s.skins=[]),s.skins.push({inverseBindMatrices:this.processAccessor(new _(a,16)),joints:o,skeleton:r.get(n)}),t.skin=s.skins.length-1}processNode(e){let s=this.json,r=this.options,t=this.nodeMap;s.nodes||(s.nodes=[]);let i={};if(r.trs){let o=e.quaternion.toArray(),a=e.position.toArray(),u=e.scale.toArray();F(o,[0,0,0,1])||(i.rotation=o),F(a,[0,0,0])||(i.translation=a),F(u,[1,1,1])||(i.scale=u)}else e.matrixAutoUpdate&&e.updateMatrix(),ds(e.matrix)===!1&&(i.matrix=e.matrix.elements);if(e.name!==""&&(i.name=String(e.name)),this.serializeUserData(e,i),e.isMesh||e.isLine||e.isPoints){let o=this.processMesh(e);o!==null&&(i.mesh=o)}else e.isCamera&&(i.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){let o=[];for(let a=0,u=e.children.length;a<u;a++){let p=e.children[a];if(p.visible||r.onlyVisible===!1){let f=this.processNode(p);f!==null&&o.push(f)}}o.length>0&&(i.children=o)}this._invokeAll(function(o){o.writeNode&&o.writeNode(e,i)});let n=s.nodes.push(i)-1;return t.set(e,n),n}processScene(e){let s=this.json,r=this.options;s.scenes||(s.scenes=[],s.scene=0);let t={};e.name!==""&&(t.name=e.name),s.scenes.push(t);let i=[];for(let n=0,o=e.children.length;n<o;n++){let a=e.children[n];if(a.visible||r.onlyVisible===!1){let u=this.processNode(a);u!==null&&i.push(u)}}i.length>0&&(t.nodes=i),this.serializeUserData(e,t)}processObjects(e){let s=new P;s.name="AuxScene";for(let r=0;r<e.length;r++)s.children.push(e[r]);this.processScene(s)}processInput(e){let s=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(t){t.beforeParse&&t.beforeParse(e)});let r=[];for(let t=0;t<e.length;t++)e[t]instanceof P?this.processScene(e[t]):r.push(e[t]);r.length>0&&this.processObjects(r);for(let t=0;t<this.skins.length;++t)this.processSkin(this.skins[t]);for(let t=0;t<s.animations.length;++t)this.processAnimation(s.animations[t],e[0]);this._invokeAll(function(t){t.afterParse&&t.afterParse(e)})}_invokeAll(e){for(let s=0,r=this.plugins.length;s<r;s++)e(this.plugins[s])}};T(de,"GLTFWriter");var $=de,ge=class ge{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,s){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}let r=this.writer,t=r.json,i=r.extensionsUsed,n={};e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",e.distance>0&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",e.distance>0&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(1-e.penumbra)*e.angle,n.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(t.extensions=t.extensions||{},t.extensions[this.name]={lights:[]},i[this.name]=!0);let o=t.extensions[this.name].lights;o.push(n),s.extensions=s.extensions||{},s.extensions[this.name]={light:o.length-1}}};T(ge,"GLTFLightExtension");var ee=ge,xe=class xe{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,s){if(!e.isMeshBasicMaterial)return;let t=this.writer.extensionsUsed;s.extensions=s.extensions||{},s.extensions[this.name]={},t[this.name]=!0,s.pbrMetallicRoughness.metallicFactor=0,s.pbrMetallicRoughness.roughnessFactor=.9}};T(xe,"GLTFMaterialsUnlitExtension");var se=xe,me=class me{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;let r=this.writer,t=r.extensionsUsed,i={};if(i.clearcoatFactor=e.clearcoat,e.clearcoatMap){let n={index:r.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};r.applyTextureTransform(n,e.clearcoatMap),i.clearcoatTexture=n}if(i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){let n={index:r.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};r.applyTextureTransform(n,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=n}if(e.clearcoatNormalMap){let n={index:r.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};r.applyTextureTransform(n,e.clearcoatNormalMap),i.clearcoatNormalTexture=n}s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(me,"GLTFMaterialsClearcoatExtension");var te=me,Te=class Te{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;let r=this.writer,t=r.extensionsUsed,i={};if(i.iridescenceFactor=e.iridescence,e.iridescenceMap){let n={index:r.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};r.applyTextureTransform(n,e.iridescenceMap),i.iridescenceTexture=n}if(i.iridescenceIor=e.iridescenceIOR,i.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){let n={index:r.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};r.applyTextureTransform(n,e.iridescenceThicknessMap),i.iridescenceThicknessTexture=n}s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(Te,"GLTFMaterialsIridescenceExtension");var ne=Te,ye=class ye{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;let r=this.writer,t=r.extensionsUsed,i={};if(i.transmissionFactor=e.transmission,e.transmissionMap){let n={index:r.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(n,e.transmissionMap),i.transmissionTexture=n}s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(ye,"GLTFMaterialsTransmissionExtension");var re=ye,we=class we{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;let r=this.writer,t=r.extensionsUsed,i={};if(i.thicknessFactor=e.thickness,e.thicknessMap){let n={index:r.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};r.applyTextureTransform(n,e.thicknessMap),i.thicknessTexture=n}i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(we,"GLTFMaterialsVolumeExtension");var ie=we,Me=class Me{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;let t=this.writer.extensionsUsed,i={};i.ior=e.ior,s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(Me,"GLTFMaterialsIorExtension");var oe=Me,Ie=class Ie{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(cs)&&!e.specularIntensityMap&&!e.specularColorMap)return;let r=this.writer,t=r.extensionsUsed,i={};if(e.specularIntensityMap){let n={index:r.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};r.applyTextureTransform(n,e.specularIntensityMap),i.specularTexture=n}if(e.specularColorMap){let n={index:r.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};r.applyTextureTransform(n,e.specularColorMap),i.specularColorTexture=n}i.specularFactor=e.specularIntensity,i.specularColorFactor=e.specularColor.toArray(),s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(Ie,"GLTFMaterialsSpecularExtension");var ae=Ie,Ae=class Ae{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;let r=this.writer,t=r.extensionsUsed,i={};if(e.sheenRoughnessMap){let n={index:r.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(n,e.sheenRoughnessMap),i.sheenRoughnessTexture=n}if(e.sheenColorMap){let n={index:r.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(n,e.sheenColorMap),i.sheenColorTexture=n}i.sheenRoughnessFactor=e.sheenRoughness,i.sheenColorFactor=e.sheenColor.toArray(),s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(Ae,"GLTFMaterialsSheenExtension");var ce=Ae,Re=class Re{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,s){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;let r=this.writer,t=r.extensionsUsed,i={};if(e.anisotropyMap){let n={index:r.processTexture(e.anisotropyMap)};r.applyTextureTransform(n,e.anisotropyMap),i.anisotropyTexture=n}i.anisotropyStrength=e.anisotropy,i.anisotropyRotation=e.anisotropyRotation,s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(Re,"GLTFMaterialsAnisotropyExtension");var ue=Re,Ee=class Ee{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,s){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;let t=this.writer.extensionsUsed,i={};i.emissiveStrength=e.emissiveIntensity,s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(Ee,"GLTFMaterialsEmissiveStrengthExtension");var le=Ee,be=class be{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,s){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;let r=this.writer,t=r.extensionsUsed,i={};if(e.bumpMap){let n={index:r.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};r.applyTextureTransform(n,e.bumpMap),i.bumpTexture=n}i.bumpFactor=e.bumpScale,s.extensions=s.extensions||{},s.extensions[this.name]=i,t[this.name]=!0}};T(be,"GLTFMaterialsBumpExtension");var fe=be,Ne=class Ne{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,s){if(!e.isInstancedMesh)return;let r=this.writer,t=e,i=new Float32Array(t.count*3),n=new Float32Array(t.count*4),o=new Float32Array(t.count*3),a=new W,u=new D,p=new Ye,f=new D;for(let l=0;l<t.count;l++)t.getMatrixAt(l,a),a.decompose(u,p,f),u.toArray(i,l*3),p.toArray(n,l*4),f.toArray(o,l*3);let m={TRANSLATION:r.processAccessor(new _(i,3)),ROTATION:r.processAccessor(new _(n,4)),SCALE:r.processAccessor(new _(o,3))};t.instanceColor&&(m._COLOR_0=r.processAccessor(t.instanceColor)),s.extensions=s.extensions||{},s.extensions[this.name]={attributes:m},r.extensionsUsed[this.name]=!0,r.extensionsRequired[this.name]=!0}};T(Ne,"GLTFMeshGpuInstancing");var he=Ne;q.Utils={insertKeyframe:function(c,e){let r=c.getValueSize(),t=new c.TimeBufferType(c.times.length+1),i=new c.ValueBufferType(c.values.length+r),n=c.createInterpolant(new c.ValueBufferType(r)),o;if(c.times.length===0){t[0]=e;for(let a=0;a<r;a++)i[a]=0;o=0}else if(e<c.times[0]){if(Math.abs(c.times[0]-e)<.001)return 0;t[0]=e,t.set(c.times,1),i.set(n.evaluate(e),0),i.set(c.values,r),o=0}else if(e>c.times[c.times.length-1]){if(Math.abs(c.times[c.times.length-1]-e)<.001)return c.times.length-1;t[t.length-1]=e,t.set(c.times,0),i.set(c.values,0),i.set(n.evaluate(e),c.values.length),o=t.length-1}else for(let a=0;a<c.times.length;a++){if(Math.abs(c.times[a]-e)<.001)return a;if(c.times[a]<e&&c.times[a+1]>e){t.set(c.times.slice(0,a+1),0),t[a+1]=e,t.set(c.times.slice(a+1),a+2),i.set(c.values.slice(0,(a+1)*r),0),i.set(n.evaluate(e),(a+1)*r),i.set(c.values.slice((a+1)*r),(a+2)*r),o=a+1;break}}return c.times=t,c.values=i,o},mergeMorphTargetTracks:function(c,e){let s=[],r={},t=c.tracks;for(let i=0;i<t.length;++i){let n=t[i],o=z.parseTrackName(n.name),a=z.findNode(e,o.nodeName);if(o.propertyName!=="morphTargetInfluences"||o.propertyIndex===void 0){s.push(n);continue}if(n.createInterpolant!==n.InterpolantFactoryMethodDiscrete&&n.createInterpolant!==n.InterpolantFactoryMethodLinear){if(n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),n=n.clone(),n.setInterpolation(He)}let u=a.morphTargetInfluences.length,p=a.morphTargetDictionary[o.propertyIndex];if(p===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+o.propertyIndex);let f;if(r[a.uuid]===void 0){f=n.clone();let l=new f.ValueBufferType(u*f.times.length);for(let d=0;d<f.times.length;d++)l[d*u+p]=f.values[d];f.name=(o.nodeName||"")+".morphTargetInfluences",f.values=l,r[a.uuid]=f,s.push(f);continue}let m=n.createInterpolant(new n.ValueBufferType(1));f=r[a.uuid];for(let l=0;l<f.times.length;l++)f.values[l*u+p]=m.evaluate(f.times[l]);for(let l=0;l<n.times.length;l++){let d=this.insertKeyframe(f,n.times[l]);f.values[d*u+p]=n.values[l]}}return c.tracks=s,c}};export{q as GLTFExporter};