@galacean/cli 2.0.0-alpha.11 → 2.0.0-alpha.14

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.
Files changed (95) hide show
  1. package/dist/cli.bundle.cjs +3171 -2951
  2. package/dist/viewport-client/_static/Accordion-3d330bc6.js +1 -0
  3. package/dist/viewport-client/_static/AmbientLightAsset-bdbc4e1d.js +5 -0
  4. package/dist/viewport-client/_static/AnimationClipAsset-9167378a.js +1 -0
  5. package/dist/viewport-client/_static/AnimatorControllerAsset-21dc6332.js +1 -0
  6. package/dist/viewport-client/_static/AnimatorStore-18d3c551.js +1 -0
  7. package/dist/viewport-client/_static/AssetViewer-64cd01fa.js +1 -0
  8. package/dist/viewport-client/_static/AudioAsset-0c828c80.js +1 -0
  9. package/dist/viewport-client/_static/AudioComponent-fbff3825.js +1 -0
  10. package/dist/viewport-client/_static/Callout-ba7e2adf.js +1 -0
  11. package/dist/viewport-client/_static/CameraComponent-74975570.js +1 -0
  12. package/dist/viewport-client/_static/Component-ed7aa0ab.js +1 -0
  13. package/dist/viewport-client/_static/DirectLight-b884e7db.js +1 -0
  14. package/dist/viewport-client/_static/FontAsset-d1ced18d.js +5 -0
  15. package/dist/viewport-client/_static/FormItemArray-6d69acd4.js +6 -0
  16. package/dist/viewport-client/_static/GlTFAsset-2723b84a.js +20 -0
  17. package/dist/viewport-client/_static/IconEdit-ab77303f.js +6 -0
  18. package/dist/viewport-client/_static/IconPointFilled-811fc660.js +6 -0
  19. package/dist/viewport-client/_static/LightBaseComponent-12dc27d1.js +1 -0
  20. package/dist/viewport-client/_static/LottieAnimationComponent-c48c5eb5.js +1 -0
  21. package/dist/viewport-client/_static/LottieAsset-3692580d.js +6 -0
  22. package/dist/viewport-client/_static/MarkdownAsset-bcb90be4.js +1 -0
  23. package/dist/viewport-client/_static/MaterialAsset-6ef9b4ed.js +1 -0
  24. package/dist/viewport-client/_static/MaterialInspector-e8242674.js +1 -0
  25. package/dist/viewport-client/_static/Menu-0b8da92f.js +17 -0
  26. package/dist/viewport-client/_static/MeshAsset-ca9305e5.js +1 -0
  27. package/dist/viewport-client/_static/MeshRendererBaseComponent-9efd3943.js +1 -0
  28. package/dist/viewport-client/_static/MeshRendererComponent-c9a03641.js +1 -0
  29. package/dist/viewport-client/_static/MeshThumbnail-ab28b3b8.js +1 -0
  30. package/dist/viewport-client/_static/ParticleRendererComponent-96947c1d.js +26 -0
  31. package/dist/viewport-client/_static/PhysicsMaterialAsset-4a1e5ea3.js +1 -0
  32. package/dist/viewport-client/_static/PhysicsStore-33cac578.js +1 -0
  33. package/dist/viewport-client/_static/PointLight-fd514526.js +1 -0
  34. package/dist/viewport-client/_static/PostProcessComponent-d0ea27a4.js +6 -0
  35. package/dist/viewport-client/_static/PrefabAsset-9179b95c.js +1 -0
  36. package/dist/viewport-client/_static/PrimitiveMesh-0572a073.js +1 -0
  37. package/dist/viewport-client/_static/ProxyConfigs-3a5fd860.js +1 -0
  38. package/dist/viewport-client/_static/ReferencedMaterial-5773c9d2.js +1 -0
  39. package/dist/viewport-client/_static/RenderTargetAsset-ab6e06d2.js +1 -0
  40. package/dist/viewport-client/_static/SceneAsset-385fa837.js +1 -0
  41. package/dist/viewport-client/_static/ShaderAsset-f4514b03.js +185 -0
  42. package/dist/viewport-client/_static/ShaderChunkAsset-34116f2c.js +5 -0
  43. package/dist/viewport-client/_static/ShaderUIScriptAsset-fc503291.js +516 -0
  44. package/dist/viewport-client/_static/SkinnedMeshRendererComponent-494ad439.js +1 -0
  45. package/dist/viewport-client/_static/SpineAnimationComponent-3918d7b5.js +1 -0
  46. package/dist/viewport-client/_static/SpineSkeletonDataAsset-27244892.js +1 -0
  47. package/dist/viewport-client/_static/SpotLight-f9972dc0.js +1 -0
  48. package/dist/viewport-client/_static/SpriteAsset-558ffca8.js +6 -0
  49. package/dist/viewport-client/_static/SpriteAtlasAsset-cdc34386.js +1 -0
  50. package/dist/viewport-client/_static/SpriteBaseComponent-3edafa31.js +1 -0
  51. package/dist/viewport-client/_static/SpriteMaskComponent-de2e5231.js +1 -0
  52. package/dist/viewport-client/_static/SpriteRendererComponent-e999e735.js +1 -0
  53. package/dist/viewport-client/_static/TaskQueue-05c94a4d.js +1 -0
  54. package/dist/viewport-client/_static/TextBaseComponent-ce1402c3.js +11 -0
  55. package/dist/viewport-client/_static/TextRendererComponent-f7c0deae.js +1 -0
  56. package/dist/viewport-client/_static/TextureAsset-39fb07fe.js +36 -0
  57. package/dist/viewport-client/_static/Tooltip-82063435.js +1 -0
  58. package/dist/viewport-client/_static/TrailRendererComponent-37f5c981.js +1 -0
  59. package/dist/viewport-client/_static/TransformBaseComponent-713d57e9.js +1 -0
  60. package/dist/viewport-client/_static/TransformComponent-40a57948.js +1 -0
  61. package/dist/viewport-client/_static/XRReferenceImageAsset-2f6ff226.js +1 -0
  62. package/dist/viewport-client/_static/assetEditorActions-c4e5962f.js +1 -0
  63. package/dist/viewport-client/_static/audio-7120ec91.js +1 -0
  64. package/dist/viewport-client/_static/bundlers-9b0d37fc.js +1 -0
  65. package/dist/viewport-client/_static/createOnModelChange-b57a0da8.js +1 -0
  66. package/dist/viewport-client/_static/encode-ac4bb64e.js +1 -0
  67. package/dist/viewport-client/_static/enum-58295f88.js +1 -0
  68. package/dist/viewport-client/_static/glTFIO-79bbca27.js +1 -0
  69. package/dist/viewport-client/_static/index-483b5738.js +1 -0
  70. package/dist/viewport-client/_static/index-74130ff3.js +1 -0
  71. package/dist/viewport-client/_static/index-78269e76.js +1 -0
  72. package/dist/viewport-client/_static/index-7834b582.js +1 -0
  73. package/dist/viewport-client/_static/index-7917f782.js +20 -0
  74. package/dist/viewport-client/_static/index-7acd49d2.js +1 -0
  75. package/dist/viewport-client/_static/index-9d3917da.js +1 -0
  76. package/dist/viewport-client/_static/index-a9b2675e.js +1 -0
  77. package/dist/viewport-client/_static/index-aec7e708.js +11487 -0
  78. package/dist/viewport-client/_static/index-b5582401.js +1 -0
  79. package/dist/viewport-client/_static/index-bfe6f30e.js +16 -0
  80. package/dist/viewport-client/_static/index-c63c9606.js +2 -0
  81. package/dist/viewport-client/_static/index-cd1fee9d.js +1 -0
  82. package/dist/viewport-client/_static/index-e73ceaed.js +1 -0
  83. package/dist/viewport-client/_static/index-e8a45e82.js +1 -0
  84. package/dist/viewport-client/_static/index-f2cb64af.js +1 -0
  85. package/dist/viewport-client/_static/index-fbe040bf.js +31 -0
  86. package/dist/viewport-client/_static/ktx2-encoder-53b21bdc.js +1 -0
  87. package/dist/viewport-client/_static/ktx2-worker-a04f41ea.js +1 -0
  88. package/dist/viewport-client/_static/meshopt_simplifier.module-cd99529d.js +1 -0
  89. package/dist/viewport-client/_static/module-220b3921.js +1 -0
  90. package/dist/viewport-client/_static/module-8816772d.js +1 -0
  91. package/dist/viewport-client/_static/module-ffeaf99f.js +56 -0
  92. package/dist/viewport-client/_static/postmen-2f47f6bb.js +1 -0
  93. package/dist/viewport-client/_static/scriptPropertyActions-d3a583d2.js +1 -0
  94. package/dist/viewport-client/index.html +20 -0
  95. package/package.json +2 -1
@@ -0,0 +1 @@
1
+ var On=Object.defineProperty;var Dn=(i,e,t)=>e in i?On(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var Q=(i,e,t)=>(Dn(i,typeof e!="symbol"?e+"":e,t),t);import{M as Yt,a as Wt}from"./meshopt_simplifier.module-cd99529d.js";class Es{constructor(){this._listeners={}}addEventListener(e,t){const r=this._listeners;return r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t),this}removeEventListener(e,t){const s=this._listeners[e];if(s!==void 0){const n=s.indexOf(t);n!==-1&&s.splice(n,1)}return this}dispatchEvent(e){const r=this._listeners[e.type];if(r!==void 0){const s=r.slice(0);for(let n=0,o=s.length;n<o;n++)s[n].call(this,e)}return this}dispose(){for(const e in this._listeners)delete this._listeners[e]}}class ke{constructor(e,t,r,s={}){if(this._name=void 0,this._parent=void 0,this._child=void 0,this._attributes=void 0,this._disposed=!1,this._name=e,this._parent=t,this._child=r,this._attributes=s,!t.isOnGraph(r))throw new Error("Cannot connect disconnected graphs.")}getName(){return this._name}getParent(){return this._parent}getChild(){return this._child}setChild(e){return this._child=e,this}getAttributes(){return this._attributes}dispose(){this._disposed||(this._parent._destroyRef(this),this._disposed=!0)}isDisposed(){return this._disposed}}class vn extends Es{constructor(...e){super(...e),this._emptySet=new Set,this._edges=new Set,this._parentEdges=new Map,this._childEdges=new Map}listEdges(){return Array.from(this._edges)}listParentEdges(e){return Array.from(this._childEdges.get(e)||this._emptySet)}listParents(e){const t=new Set;for(const r of this.listParentEdges(e))t.add(r.getParent());return Array.from(t)}listChildEdges(e){return Array.from(this._parentEdges.get(e)||this._emptySet)}listChildren(e){const t=new Set;for(const r of this.listChildEdges(e))t.add(r.getChild());return Array.from(t)}disconnectParents(e,t){for(const r of this.listParentEdges(e))(!t||t(r.getParent()))&&r.dispose();return this}_createEdge(e,t,r,s){const n=new ke(e,t,r,s);this._edges.add(n);const o=n.getParent();this._parentEdges.has(o)||this._parentEdges.set(o,new Set),this._parentEdges.get(o).add(n);const a=n.getChild();return this._childEdges.has(a)||this._childEdges.set(a,new Set),this._childEdges.get(a).add(n),n}_destroyEdge(e){return this._edges.delete(e),this._parentEdges.get(e.getParent()).delete(e),this._childEdges.get(e.getChild()).delete(e),this}}function Je(){return Je=Object.assign||function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Je.apply(this,arguments)}class xe{constructor(e){if(this.list=[],e)for(const t of e)this.list.push(t)}add(e){this.list.push(e)}remove(e){const t=this.list.indexOf(e);t>=0&&this.list.splice(t,1)}removeChild(e){const t=[];for(const r of this.list)r.getChild()===e&&t.push(r);for(const r of t)this.remove(r);return t}listRefsByChild(e){const t=[];for(const r of this.list)r.getChild()===e&&t.push(r);return t}values(){return this.list}}class V{constructor(e){if(this.set=new Set,this.map=new Map,e)for(const t of e)this.add(t)}add(e){const t=e.getChild();this.removeChild(t),this.set.add(e),this.map.set(t,e)}remove(e){this.set.delete(e),this.map.delete(e.getChild())}removeChild(e){const t=this.map.get(e)||null;return t&&this.remove(t),t}getRefByChild(e){return this.map.get(e)||null}values(){return Array.from(this.set)}}class oe{constructor(e){this.map={},e&&Object.assign(this.map,e)}set(e,t){this.map[e]=t}delete(e){delete this.map[e]}get(e){return this.map[e]||null}keys(){return Object.keys(this.map)}values(){return Object.values(this.map)}}const F=Symbol("attributes"),Fe=Symbol("immutableKeys");class bt extends Es{constructor(e){super(),this._disposed=!1,this.graph=void 0,this[F]=void 0,this[Fe]=void 0,this.graph=e,this[Fe]=new Set,this[F]=this._createAttributes()}getDefaults(){return{}}_createAttributes(){const e=this.getDefaults(),t={};for(const r in e){const s=e[r];if(s instanceof bt){const n=this.graph._createEdge(r,this,s);this[Fe].add(r),t[r]=n}else t[r]=s}return t}isOnGraph(e){return this.graph===e.graph}isDisposed(){return this._disposed}dispose(){this._disposed||(this.graph.listChildEdges(this).forEach(e=>e.dispose()),this.graph.disconnectParents(this),this._disposed=!0,this.dispatchEvent({type:"dispose"}))}detach(){return this.graph.disconnectParents(this),this}swap(e,t){for(const r in this[F]){const s=this[F][r];if(s instanceof ke){const n=s;n.getChild()===e&&this.setRef(r,t,n.getAttributes())}else if(s instanceof xe)for(const n of s.listRefsByChild(e)){const o=n.getAttributes();this.removeRef(r,e),this.addRef(r,t,o)}else if(s instanceof V){const n=s.getRefByChild(e);if(n){const o=n.getAttributes();this.removeRef(r,e),this.addRef(r,t,o)}}else if(s instanceof oe)for(const n of s.keys()){const o=s.get(n);o.getChild()===e&&this.setRefMap(r,n,t,o.getAttributes())}}return this}get(e){return this[F][e]}set(e,t){return this[F][e]=t,this.dispatchEvent({type:"change",attribute:e})}getRef(e){const t=this[F][e];return t?t.getChild():null}setRef(e,t,r){if(this[Fe].has(e))throw new Error(`Cannot overwrite immutable attribute, "${e}".`);const s=this[F][e];if(s&&s.dispose(),!t)return this;const n=this.graph._createEdge(e,this,t,r);return this[F][e]=n,this.dispatchEvent({type:"change",attribute:e})}listRefs(e){return this.assertRefList(e).values().map(r=>r.getChild())}addRef(e,t,r){const s=this.graph._createEdge(e,this,t,r);return this.assertRefList(e).add(s),this.dispatchEvent({type:"change",attribute:e})}removeRef(e,t){const r=this.assertRefList(e);if(r instanceof xe)for(const s of r.listRefsByChild(t))s.dispose();else{const s=r.getRefByChild(t);s&&s.dispose()}return this}assertRefList(e){const t=this[F][e];if(t instanceof xe||t instanceof V)return t;throw new Error(`Expected RefList or RefSet for attribute "${e}"`)}listRefMapKeys(e){return this.assertRefMap(e).keys()}listRefMapValues(e){return this.assertRefMap(e).values().map(t=>t.getChild())}getRefMap(e,t){const s=this.assertRefMap(e).get(t);return s?s.getChild():null}setRefMap(e,t,r,s){const n=this.assertRefMap(e),o=n.get(t);if(o&&o.dispose(),!r)return this;s=Object.assign(s||{},{key:t});const a=this.graph._createEdge(e,this,r,Je({},s,{key:t}));return n.set(t,a),this.dispatchEvent({type:"change",attribute:e,key:t})}assertRefMap(e){const t=this[F][e];if(t instanceof oe)return t;throw new Error(`Expected RefMap for attribute "${e}"`)}dispatchEvent(e){return super.dispatchEvent(Je({},e,{target:this})),this.graph.dispatchEvent(Je({},e,{target:this,type:`node:${e.type}`})),this}_destroyRef(e){const t=e.getName();if(this[F][t]===e)this[F][t]=null,this[Fe].has(t)&&e.getChild().dispose();else if(this[F][t]instanceof xe)this[F][t].remove(e);else if(this[F][t]instanceof V)this[F][t].remove(e);else if(this[F][t]instanceof oe){const r=this[F][t];for(const s of r.keys())r.get(s)===e&&r.delete(s)}else return;this.graph._destroyEdge(e),this.dispatchEvent({type:"change",attribute:t})}}const ys="v4.1.0",He="@glb.bin";var h;(function(i){i.ACCESSOR="Accessor",i.ANIMATION="Animation",i.ANIMATION_CHANNEL="AnimationChannel",i.ANIMATION_SAMPLER="AnimationSampler",i.BUFFER="Buffer",i.CAMERA="Camera",i.MATERIAL="Material",i.MESH="Mesh",i.PRIMITIVE="Primitive",i.PRIMITIVE_TARGET="PrimitiveTarget",i.NODE="Node",i.ROOT="Root",i.SCENE="Scene",i.SKIN="Skin",i.TEXTURE="Texture",i.TEXTURE_INFO="TextureInfo"})(h||(h={}));var ct;(function(i){i.INTERLEAVED="interleaved",i.SEPARATE="separate"})(ct||(ct={}));var te;(function(i){i.ARRAY_BUFFER="ARRAY_BUFFER",i.ELEMENT_ARRAY_BUFFER="ELEMENT_ARRAY_BUFFER",i.INVERSE_BIND_MATRICES="INVERSE_BIND_MATRICES",i.OTHER="OTHER",i.SPARSE="SPARSE"})(te||(te={}));var ie;(function(i){i[i.R=4096]="R",i[i.G=256]="G",i[i.B=16]="B",i[i.A=1]="A"})(ie||(ie={}));var me;(function(i){i.GLTF="GLTF",i.GLB="GLB"})(me||(me={}));const ht={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};var Et=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});function Fn(){var i=new Et(3);return Et!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function Tt(i){var e=i[0],t=i[1],r=i[2];return Math.hypot(e,t,r)}function Un(i,e,t){var r=e[0],s=e[1],n=e[2],o=t[3]*r+t[7]*s+t[11]*n+t[15];return o=o||1,i[0]=(t[0]*r+t[4]*s+t[8]*n+t[12])/o,i[1]=(t[1]*r+t[5]*s+t[9]*n+t[13])/o,i[2]=(t[2]*r+t[6]*s+t[10]*n+t[14])/o,i}(function(){var i=Fn();return function(e,t,r,s,n,o){var a,c;for(t||(t=3),r||(r=0),s?c=Math.min(s*t+r,e.length):c=e.length,a=r;a<c;a+=t)i[0]=e[a],i[1]=e[a+1],i[2]=e[a+2],n(i,i,o),e[a]=i[0],e[a+1]=i[1],e[a+2]=i[2];return e}})();function Bn(i){const e=Rs(),t=i.propertyType===h.NODE?[i]:i.listChildren();for(const r of t)r.traverse(s=>{const n=s.getMesh();if(!n)return;const o=Ln(n,s.getWorldMatrix());o.min.every(isFinite)&&o.max.every(isFinite)&&(yt(o.min,e),yt(o.max,e))});return e}function Ln(i,e){const t=Rs();for(const r of i.listPrimitives()){const s=r.getAttribute("POSITION"),n=r.getIndices();if(!s)continue;let o=[0,0,0],a=[0,0,0];for(let c=0,u=n?n.getCount():s.getCount();c<u;c++){const g=n?n.getScalar(c):c;o=s.getElement(g,o),a=Un(a,o,e),yt(a,t)}}return t}function yt(i,e){for(let t=0;t<3;t++)e.min[t]=Math.min(i[t],e.min[t]),e.max[t]=Math.max(i[t],e.max[t])}function Rs(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class D{static createBufferFromDataURI(e){if(typeof Buffer>"u"){const t=atob(e.split(",")[1]),r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}else{const t=e.split(",")[1],r=e.indexOf("base64")>=0;return Buffer.from(t,r?"base64":"utf8")}}static encodeText(e){return new TextEncoder().encode(e)}static decodeText(e){return new TextDecoder().decode(e)}static concat(e){let t=0;for(const n of e)t+=n.byteLength;const r=new Uint8Array(t);let s=0;for(const n of e)r.set(n,s),s+=n.byteLength;return r}static pad(e,t=0){const r=this.padNumber(e.byteLength);if(r===e.byteLength)return e;const s=new Uint8Array(r);if(s.set(e),t!==0)for(let n=e.byteLength;n<r;n++)s[n]=t;return s}static padNumber(e){return Math.ceil(e/4)*4}static equals(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;let r=e.byteLength;for(;r--;)if(e[r]!==t[r])return!1;return!0}static toView(e,t=0,r=1/0){return new Uint8Array(e.buffer,e.byteOffset+t,Math.min(e.byteLength,r))}static assertView(e){if(e&&!ArrayBuffer.isView(e))throw new Error(`Method requires Uint8Array parameter; received "${typeof e}".`);return e}}class _i{static hexToFactor(e,t){e=Math.floor(e);const r=t;return r[0]=(e>>16&255)/255,r[1]=(e>>8&255)/255,r[2]=(e&255)/255,this.convertSRGBToLinear(t,t)}static factorToHex(e){const t=[...e],[r,s,n]=this.convertLinearToSRGB(e,t);return r*255<<16^s*255<<8^n*255<<0}static convertSRGBToLinear(e,t){const r=e,s=t;for(let n=0;n<3;n++)s[n]=r[n]<.04045?r[n]*.0773993808:Math.pow(r[n]*.9478672986+.0521327014,2.4);return t}static convertLinearToSRGB(e,t){const r=e,s=t;for(let n=0;n<3;n++)s[n]=r[n]<.0031308?r[n]*12.92:1.055*Math.pow(r[n],.41666)-.055;return t}}class jn{match(e){return e.length>=3&&e[0]===255&&e[1]===216&&e[2]===255}getSize(e){let t=new DataView(e.buffer,e.byteOffset+4),r,s;for(;t.byteLength;){if(r=t.getUint16(0,!1),Pn(t,r),s=t.getUint8(r+1),s===192||s===193||s===194)return[t.getUint16(r+7,!1),t.getUint16(r+5,!1)];t=new DataView(e.buffer,t.byteOffset+r+2)}throw new TypeError("Invalid JPG, no size found")}getChannels(e){return 3}}class gt{match(e){return e.length>=8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71&&e[4]===13&&e[5]===10&&e[6]===26&&e[7]===10}getSize(e){const t=new DataView(e.buffer,e.byteOffset);return D.decodeText(e.slice(12,16))===gt.PNG_FRIED_CHUNK_NAME?[t.getUint32(32,!1),t.getUint32(36,!1)]:[t.getUint32(16,!1),t.getUint32(20,!1)]}getChannels(e){return 4}}gt.PNG_FRIED_CHUNK_NAME="CgBI";class fe{static registerFormat(e,t){this.impls[e]=t}static getMimeType(e){for(const t in this.impls)if(this.impls[t].match(e))return t;return null}static getSize(e,t){return this.impls[t]?this.impls[t].getSize(e):null}static getChannels(e,t){return this.impls[t]?this.impls[t].getChannels(e):null}static getVRAMByteLength(e,t){if(!this.impls[t])return null;if(this.impls[t].getVRAMByteLength)return this.impls[t].getVRAMByteLength(e);let r=0;const s=4,n=this.getSize(e,t);if(!n)return null;for(;n[0]>1||n[1]>1;)r+=n[0]*n[1]*s,n[0]=Math.max(Math.floor(n[0]/2),1),n[1]=Math.max(Math.floor(n[1]/2),1);return r+=1*1*s,r}static mimeTypeToExtension(e){return e==="image/jpeg"?"jpg":e.split("/").pop()}static extensionToMimeType(e){return e==="jpg"?"image/jpeg":e?`image/${e}`:""}}fe.impls={"image/jpeg":new jn,"image/png":new gt};function Pn(i,e){if(e>i.byteLength)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(i.getUint8(e)!==255)throw new TypeError("Invalid JPG, marker table corrupted");return i}class ze{static basename(e){const t=e.split(/[\\/]/).pop();return t.substring(0,t.lastIndexOf("."))}static extension(e){if(e.startsWith("data:image/")){const t=e.match(/data:(image\/\w+)/)[1];return fe.mimeTypeToExtension(t)}else{if(e.startsWith("data:model/gltf+json"))return"gltf";if(e.startsWith("data:model/gltf-binary"))return"glb";if(e.startsWith("data:application/"))return"bin"}return e.split(/[\\/]/).pop().split(/[.]/).pop()}}function Jt(i){return Object.prototype.toString.call(i)==="[object Object]"}function Ue(i){if(Jt(i)===!1)return!1;const e=i.constructor;if(e===void 0)return!0;const t=e.prototype;return!(Jt(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}var Rt,It;(function(i){i[i.SILENT=4]="SILENT",i[i.ERROR=3]="ERROR",i[i.WARN=2]="WARN",i[i.INFO=1]="INFO",i[i.DEBUG=0]="DEBUG"})(It||(It={}));class re{constructor(e){this.verbosity=void 0,this.verbosity=e}debug(e){this.verbosity<=re.Verbosity.DEBUG&&console.debug(e)}info(e){this.verbosity<=re.Verbosity.INFO&&console.info(e)}warn(e){this.verbosity<=re.Verbosity.WARN&&console.warn(e)}error(e){this.verbosity<=re.Verbosity.ERROR&&console.error(e)}}Rt=re;re.Verbosity=It;re.DEFAULT_INSTANCE=new Rt(Rt.Verbosity.INFO);function Vn(i){var e=i[0],t=i[1],r=i[2],s=i[3],n=i[4],o=i[5],a=i[6],c=i[7],u=i[8],g=i[9],p=i[10],x=i[11],I=i[12],m=i[13],_=i[14],M=i[15],l=e*o-t*n,b=e*a-r*n,T=e*c-s*n,y=t*a-r*o,E=t*c-s*o,N=r*c-s*a,f=u*m-g*I,d=u*_-p*I,R=u*M-x*I,A=g*_-p*m,w=g*M-x*m,O=p*M-x*_;return l*O-b*w+T*A+y*R-E*d+N*f}function kn(i,e,t){var r=e[0],s=e[1],n=e[2],o=e[3],a=e[4],c=e[5],u=e[6],g=e[7],p=e[8],x=e[9],I=e[10],m=e[11],_=e[12],M=e[13],l=e[14],b=e[15],T=t[0],y=t[1],E=t[2],N=t[3];return i[0]=T*r+y*a+E*p+N*_,i[1]=T*s+y*c+E*x+N*M,i[2]=T*n+y*u+E*I+N*l,i[3]=T*o+y*g+E*m+N*b,T=t[4],y=t[5],E=t[6],N=t[7],i[4]=T*r+y*a+E*p+N*_,i[5]=T*s+y*c+E*x+N*M,i[6]=T*n+y*u+E*I+N*l,i[7]=T*o+y*g+E*m+N*b,T=t[8],y=t[9],E=t[10],N=t[11],i[8]=T*r+y*a+E*p+N*_,i[9]=T*s+y*c+E*x+N*M,i[10]=T*n+y*u+E*I+N*l,i[11]=T*o+y*g+E*m+N*b,T=t[12],y=t[13],E=t[14],N=t[15],i[12]=T*r+y*a+E*p+N*_,i[13]=T*s+y*c+E*x+N*M,i[14]=T*n+y*u+E*I+N*l,i[15]=T*o+y*g+E*m+N*b,i}function Gn(i,e){var t=e[0],r=e[1],s=e[2],n=e[4],o=e[5],a=e[6],c=e[8],u=e[9],g=e[10];return i[0]=Math.hypot(t,r,s),i[1]=Math.hypot(n,o,a),i[2]=Math.hypot(c,u,g),i}function Hn(i,e){var t=new Et(3);Gn(t,e);var r=1/t[0],s=1/t[1],n=1/t[2],o=e[0]*r,a=e[1]*s,c=e[2]*n,u=e[4]*r,g=e[5]*s,p=e[6]*n,x=e[8]*r,I=e[9]*s,m=e[10]*n,_=o+g+m,M=0;return _>0?(M=Math.sqrt(_+1)*2,i[3]=.25*M,i[0]=(p-I)/M,i[1]=(x-c)/M,i[2]=(a-u)/M):o>g&&o>m?(M=Math.sqrt(1+o-g-m)*2,i[3]=(p-I)/M,i[0]=.25*M,i[1]=(a+u)/M,i[2]=(x+c)/M):g>m?(M=Math.sqrt(1+g-o-m)*2,i[3]=(x-c)/M,i[0]=(a+u)/M,i[1]=.25*M,i[2]=(p+I)/M):(M=Math.sqrt(1+m-o-g)*2,i[3]=(a-u)/M,i[0]=(x+c)/M,i[1]=(p+I)/M,i[2]=.25*M),i}class L{static identity(e){return e}static eq(e,t,r=1e-5){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(Math.abs(e[s]-t[s])>r)return!1;return!0}static clamp(e,t,r){return e<t?t:e>r?r:e}static decodeNormalizedInt(e,t){switch(t){case 5126:return e;case 5123:return e/65535;case 5121:return e/255;case 5122:return Math.max(e/32767,-1);case 5120:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}static encodeNormalizedInt(e,t){switch(t){case 5126:return e;case 5123:return Math.round(L.clamp(e,0,1)*65535);case 5121:return Math.round(L.clamp(e,0,1)*255);case 5122:return Math.round(L.clamp(e,-1,1)*32767);case 5120:return Math.round(L.clamp(e,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(e,t,r,s){let n=Tt([e[0],e[1],e[2]]);const o=Tt([e[4],e[5],e[6]]),a=Tt([e[8],e[9],e[10]]);Vn(e)<0&&(n=-n),t[0]=e[12],t[1]=e[13],t[2]=e[14];const u=e.slice(),g=1/n,p=1/o,x=1/a;u[0]*=g,u[1]*=g,u[2]*=g,u[4]*=p,u[5]*=p,u[6]*=p,u[8]*=x,u[9]*=x,u[10]*=x,Hn(r,u),s[0]=n,s[1]=o,s[2]=a}static compose(e,t,r,s){const n=s,o=t[0],a=t[1],c=t[2],u=t[3],g=o+o,p=a+a,x=c+c,I=o*g,m=o*p,_=o*x,M=a*p,l=a*x,b=c*x,T=u*g,y=u*p,E=u*x,N=r[0],f=r[1],d=r[2];return n[0]=(1-(M+b))*N,n[1]=(m+E)*N,n[2]=(_-y)*N,n[3]=0,n[4]=(m-E)*f,n[5]=(1-(I+b))*f,n[6]=(l+T)*f,n[7]=0,n[8]=(_+y)*d,n[9]=(l-T)*d,n[10]=(1-(I+M))*d,n[11]=0,n[12]=e[0],n[13]=e[1],n[14]=e[2],n[15]=1,n}}function zn(i,e){if(!!i!=!!e)return!1;const t=i.getChild(),r=e.getChild();return t===r||t.equals(r)}function $n(i,e){if(!!i!=!!e)return!1;const t=i.values(),r=e.values();if(t.length!==r.length)return!1;for(let s=0;s<t.length;s++){const n=t[s],o=r[s];if(n.getChild()!==o.getChild()&&!n.getChild().equals(o.getChild()))return!1}return!0}function Xn(i,e){if(!!i!=!!e)return!1;const t=i.keys(),r=e.keys();if(t.length!==r.length)return!1;for(const s of t){const n=i.get(s),o=e.get(s);if(!!n!=!!o)return!1;const a=n.getChild(),c=o.getChild();if(a!==c&&!a.equals(c))return!1}return!0}function Is(i,e){if(i===e)return!0;if(!!i!=!!e||!i||!e||i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!==e[t])return!1;return!0}function As(i,e){if(i===e)return!0;if(!!i!=!!e)return!1;if(!Ue(i)||!Ue(e))return i===e;const t=i,r=e;let s=0,n=0,o;for(o in t)s++;for(o in r)n++;if(s!==n)return!1;for(o in t){const a=t[o],c=r[o];if(ut(a)&&ut(c)){if(!Is(a,c))return!1}else if(Ue(a)&&Ue(c)){if(!As(a,c))return!1}else if(a!==c)return!1}return!0}function ut(i){return Array.isArray(i)||ArrayBuffer.isView(i)}const Qt="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",Kn=999,qn=6,Zt=new Set,Yn=function(){let e="";for(let t=0;t<qn;t++)e+=Qt.charAt(Math.floor(Math.random()*Qt.length));return e},Wn=function(){for(let e=0;e<Kn;e++){const t=Yn();if(!Zt.has(t))return Zt.add(t),t}return""},es="https://null.example";class Qe{static dirname(e){const t=e.lastIndexOf("/");return t===-1?"./":e.substring(0,t+1)}static basename(e){return ze.basename(new URL(e,es).pathname)}static extension(e){return ze.extension(new URL(e,es).pathname)}static resolve(e,t){if(!this.isRelativePath(t))return t;const r=e.split("/"),s=t.split("/");r.pop();for(let n=0;n<s.length;n++)s[n]!=="."&&(s[n]===".."?r.pop():r.push(s[n]));return r.join("/")}static isAbsoluteURL(e){return this.PROTOCOL_REGEXP.test(e)}static isRelativePath(e){return!/^(?:[a-zA-Z]+:)?\//.test(e)}}Qe.DEFAULT_INIT={};Qe.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;const Ee=i=>i,Jn=new Set;class wt extends bt{constructor(e,t=""){super(e),this[F].name=t,this.init(),this.dispatchEvent({type:"create"})}getGraph(){return this.graph}getDefaults(){return Object.assign(super.getDefaults(),{name:"",extras:{}})}set(e,t){return Array.isArray(t)&&(t=t.slice()),super.set(e,t)}getName(){return this.get("name")}setName(e){return this.set("name",e)}getExtras(){return this.get("extras")}setExtras(e){return this.set("extras",e)}clone(){const e=this.constructor;return new e(this.graph).copy(this,Ee)}copy(e,t=Ee){for(const r in this[F]){const s=this[F][r];if(s instanceof ke)this[Fe].has(r)||s.dispose();else if(s instanceof xe||s instanceof V)for(const n of s.values())n.dispose();else if(s instanceof oe)for(const n of s.values())n.dispose()}for(const r in e[F]){const s=this[F][r],n=e[F][r];if(n instanceof ke)this[Fe].has(r)?s.getChild().copy(t(n.getChild()),t):this.setRef(r,t(n.getChild()),n.getAttributes());else if(n instanceof V||n instanceof xe)for(const o of n.values())this.addRef(r,t(o.getChild()),o.getAttributes());else if(n instanceof oe)for(const o of n.keys()){const a=n.get(o);this.setRefMap(r,o,t(a.getChild()),a.getAttributes())}else Ue(n)?this[F][r]=JSON.parse(JSON.stringify(n)):Array.isArray(n)||n instanceof ArrayBuffer||ArrayBuffer.isView(n)?this[F][r]=n.slice():this[F][r]=n}return this}equals(e,t=Jn){if(this===e)return!0;if(this.propertyType!==e.propertyType)return!1;for(const r in this[F]){if(t.has(r))continue;const s=this[F][r],n=e[F][r];if(s instanceof ke||n instanceof ke){if(!zn(s,n))return!1}else if(s instanceof V||n instanceof V||s instanceof xe||n instanceof xe){if(!$n(s,n))return!1}else if(s instanceof oe||n instanceof oe){if(!Xn(s,n))return!1}else if(Ue(s)||Ue(n)){if(!As(s,n))return!1}else if(ut(s)||ut(n)){if(!Is(s,n))return!1}else if(s!==n)return!1}return!0}detach(){return this.graph.disconnectParents(this,e=>e.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}}class J extends wt{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new oe})}getExtension(e){return this.getRefMap("extensions",e)}setExtension(e,t){return t&&t._validateParent(this),this.setRefMap("extensions",e,t)}listExtensions(){return this.listRefMapValues("extensions")}}class S extends J{init(){this.propertyType=h.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:S.Type.SCALAR,componentType:S.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(e){switch(e){case S.Type.SCALAR:return 1;case S.Type.VEC2:return 2;case S.Type.VEC3:return 3;case S.Type.VEC4:return 4;case S.Type.MAT2:return 4;case S.Type.MAT3:return 9;case S.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+e)}}static getComponentSize(e){switch(e){case S.ComponentType.BYTE:return 1;case S.ComponentType.UNSIGNED_BYTE:return 1;case S.ComponentType.SHORT:return 2;case S.ComponentType.UNSIGNED_SHORT:return 2;case S.ComponentType.UNSIGNED_INT:return 4;case S.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+e)}}getMinNormalized(e){const t=this.getNormalized(),r=this.getElementSize(),s=this.getComponentType();if(this.getMin(e),t)for(let n=0;n<r;n++)e[n]=L.decodeNormalizedInt(e[n],s);return e}getMin(e){const t=this.getArray(),r=this.getCount(),s=this.getElementSize();for(let n=0;n<s;n++)e[n]=1/0;for(let n=0;n<r*s;n+=s)for(let o=0;o<s;o++){const a=t[n+o];Number.isFinite(a)&&(e[o]=Math.min(e[o],a))}return e}getMaxNormalized(e){const t=this.getNormalized(),r=this.getElementSize(),s=this.getComponentType();if(this.getMax(e),t)for(let n=0;n<r;n++)e[n]=L.decodeNormalizedInt(e[n],s);return e}getMax(e){const t=this.get("array"),r=this.getCount(),s=this.getElementSize();for(let n=0;n<s;n++)e[n]=-1/0;for(let n=0;n<r*s;n+=s)for(let o=0;o<s;o++){const a=t[n+o];Number.isFinite(a)&&(e[o]=Math.max(e[o],a))}return e}getCount(){const e=this.get("array");return e?e.length/this.getElementSize():0}getType(){return this.get("type")}setType(e){return this.set("type",e)}getElementSize(){return S.getElementSize(this.get("type"))}getComponentSize(){return this.get("array").BYTES_PER_ELEMENT}getComponentType(){return this.get("componentType")}getNormalized(){return this.get("normalized")}setNormalized(e){return this.set("normalized",e)}getScalar(e){const t=this.getElementSize(),r=this.getComponentType(),s=this.getArray();return this.getNormalized()?L.decodeNormalizedInt(s[e*t],r):s[e*t]}setScalar(e,t){const r=this.getElementSize(),s=this.getComponentType(),n=this.getArray();return this.getNormalized()?n[e*r]=L.encodeNormalizedInt(t,s):n[e*r]=t,this}getElement(e,t){const r=this.getNormalized(),s=this.getElementSize(),n=this.getComponentType(),o=this.getArray();for(let a=0;a<s;a++)r?t[a]=L.decodeNormalizedInt(o[e*s+a],n):t[a]=o[e*s+a];return t}setElement(e,t){const r=this.getNormalized(),s=this.getElementSize(),n=this.getComponentType(),o=this.getArray();for(let a=0;a<s;a++)r?o[e*s+a]=L.encodeNormalizedInt(t[a],n):o[e*s+a]=t[a];return this}getSparse(){return this.get("sparse")}setSparse(e){return this.set("sparse",e)}getBuffer(){return this.getRef("buffer")}setBuffer(e){return this.setRef("buffer",e)}getArray(){return this.get("array")}setArray(e){return this.set("componentType",e?Qn(e):S.ComponentType.FLOAT),this.set("array",e),this}getByteLength(){const e=this.get("array");return e?e.byteLength:0}}S.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};S.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function Qn(i){switch(i.constructor){case Float32Array:return S.ComponentType.FLOAT;case Uint32Array:return S.ComponentType.UNSIGNED_INT;case Uint16Array:return S.ComponentType.UNSIGNED_SHORT;case Uint8Array:return S.ComponentType.UNSIGNED_BYTE;case Int16Array:return S.ComponentType.SHORT;case Int8Array:return S.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class Ns extends J{init(){this.propertyType=h.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new V,samplers:new V})}addChannel(e){return this.addRef("channels",e)}removeChannel(e){return this.removeRef("channels",e)}listChannels(){return this.listRefs("channels")}addSampler(e){return this.addRef("samplers",e)}removeSampler(e){return this.removeRef("samplers",e)}listSamplers(){return this.listRefs("samplers")}}class Ct extends J{init(){this.propertyType=h.ANIMATION_CHANNEL}getDefaults(){return Object.assign(super.getDefaults(),{targetPath:null,targetNode:null,sampler:null})}getTargetPath(){return this.get("targetPath")}setTargetPath(e){return this.set("targetPath",e)}getTargetNode(){return this.getRef("targetNode")}setTargetNode(e){return this.setRef("targetNode",e)}getSampler(){return this.getRef("sampler")}setSampler(e){return this.setRef("sampler",e)}}Ct.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class Xe extends J{init(){this.propertyType=h.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:Xe.Interpolation.LINEAR,input:null,output:null})}getInterpolation(){return this.get("interpolation")}setInterpolation(e){return this.set("interpolation",e)}getInput(){return this.getRef("input")}setInput(e){return this.setRef("input",e,{usage:te.OTHER})}getOutput(){return this.getRef("output")}setOutput(e){return this.setRef("output",e,{usage:te.OTHER})}}Xe.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class Ss extends J{init(){this.propertyType=h.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(e){return this.set("uri",e)}}class je extends J{init(){this.propertyType=h.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:je.Type.PERSPECTIVE,znear:.1,zfar:100,aspectRatio:null,yfov:Math.PI*2*50/360,xmag:1,ymag:1})}getType(){return this.get("type")}setType(e){return this.set("type",e)}getZNear(){return this.get("znear")}setZNear(e){return this.set("znear",e)}getZFar(){return this.get("zfar")}setZFar(e){return this.set("zfar",e)}getAspectRatio(){return this.get("aspectRatio")}setAspectRatio(e){return this.set("aspectRatio",e)}getYFov(){return this.get("yfov")}setYFov(e){return this.set("yfov",e)}getXMag(){return this.get("xmag")}setXMag(e){return this.set("xmag",e)}getYMag(){return this.get("ymag")}setYMag(e){return this.set("ymag",e)}}je.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class k extends wt{_validateParent(e){if(!this.parentTypes.includes(e.propertyType))throw new Error(`Parent "${e.propertyType}" invalid for child "${this.propertyType}".`)}}k.EXTENSION_NAME=void 0;class j extends J{init(){this.propertyType=h.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:j.WrapMode.REPEAT,wrapT:j.WrapMode.REPEAT})}getTexCoord(){return this.get("texCoord")}setTexCoord(e){return this.set("texCoord",e)}getMagFilter(){return this.get("magFilter")}setMagFilter(e){return this.set("magFilter",e)}getMinFilter(){return this.get("minFilter")}setMinFilter(e){return this.set("minFilter",e)}getWrapS(){return this.get("wrapS")}setWrapS(e){return this.set("wrapS",e)}getWrapT(){return this.get("wrapT")}setWrapT(e){return this.set("wrapT",e)}}j.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};j.MagFilter={NEAREST:9728,LINEAR:9729};j.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};const{R:nt,G:rt,B:it,A:Zn}=ie;class Be extends J{init(){this.propertyType=h.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:Be.AlphaMode.OPAQUE,alphaCutoff:.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new j(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new j(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new j(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new j(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new j(this.graph,"metallicRoughnessTextureInfo")})}getDoubleSided(){return this.get("doubleSided")}setDoubleSided(e){return this.set("doubleSided",e)}getAlpha(){return this.get("baseColorFactor")[3]}setAlpha(e){const t=this.get("baseColorFactor").slice();return t[3]=e,this.set("baseColorFactor",t)}getAlphaMode(){return this.get("alphaMode")}setAlphaMode(e){return this.set("alphaMode",e)}getAlphaCutoff(){return this.get("alphaCutoff")}setAlphaCutoff(e){return this.set("alphaCutoff",e)}getBaseColorFactor(){return this.get("baseColorFactor")}setBaseColorFactor(e){return this.set("baseColorFactor",e)}getBaseColorTexture(){return this.getRef("baseColorTexture")}getBaseColorTextureInfo(){return this.getRef("baseColorTexture")?this.getRef("baseColorTextureInfo"):null}setBaseColorTexture(e){return this.setRef("baseColorTexture",e,{channels:nt|rt|it|Zn,isColor:!0})}getEmissiveFactor(){return this.get("emissiveFactor")}setEmissiveFactor(e){return this.set("emissiveFactor",e)}getEmissiveTexture(){return this.getRef("emissiveTexture")}getEmissiveTextureInfo(){return this.getRef("emissiveTexture")?this.getRef("emissiveTextureInfo"):null}setEmissiveTexture(e){return this.setRef("emissiveTexture",e,{channels:nt|rt|it,isColor:!0})}getNormalScale(){return this.get("normalScale")}setNormalScale(e){return this.set("normalScale",e)}getNormalTexture(){return this.getRef("normalTexture")}getNormalTextureInfo(){return this.getRef("normalTexture")?this.getRef("normalTextureInfo"):null}setNormalTexture(e){return this.setRef("normalTexture",e,{channels:nt|rt|it})}getOcclusionStrength(){return this.get("occlusionStrength")}setOcclusionStrength(e){return this.set("occlusionStrength",e)}getOcclusionTexture(){return this.getRef("occlusionTexture")}getOcclusionTextureInfo(){return this.getRef("occlusionTexture")?this.getRef("occlusionTextureInfo"):null}setOcclusionTexture(e){return this.setRef("occlusionTexture",e,{channels:nt})}getRoughnessFactor(){return this.get("roughnessFactor")}setRoughnessFactor(e){return this.set("roughnessFactor",e)}getMetallicFactor(){return this.get("metallicFactor")}setMetallicFactor(e){return this.set("metallicFactor",e)}getMetallicRoughnessTexture(){return this.getRef("metallicRoughnessTexture")}getMetallicRoughnessTextureInfo(){return this.getRef("metallicRoughnessTexture")?this.getRef("metallicRoughnessTextureInfo"):null}setMetallicRoughnessTexture(e){return this.setRef("metallicRoughnessTexture",e,{channels:rt|it})}}Be.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class Ms extends J{init(){this.propertyType=h.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new V})}addPrimitive(e){return this.addRef("primitives",e)}removePrimitive(e){return this.removeRef("primitives",e)}listPrimitives(){return this.listRefs("primitives")}getWeights(){return this.get("weights")}setWeights(e){return this.set("weights",e)}}class _s extends J{init(){this.propertyType=h.NODE}getDefaults(){return Object.assign(super.getDefaults(),{translation:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1],weights:[],camera:null,mesh:null,skin:null,children:new V})}copy(e,t=Ee){if(t===Ee)throw new Error("Node cannot be copied.");return super.copy(e,t)}getTranslation(){return this.get("translation")}getRotation(){return this.get("rotation")}getScale(){return this.get("scale")}setTranslation(e){return this.set("translation",e)}setRotation(e){return this.set("rotation",e)}setScale(e){return this.set("scale",e)}getMatrix(){return L.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(e){const t=this.get("translation").slice(),r=this.get("rotation").slice(),s=this.get("scale").slice();return L.decompose(e,t,r,s),this.set("translation",t).set("rotation",r).set("scale",s)}getWorldTranslation(){const e=[0,0,0];return L.decompose(this.getWorldMatrix(),e,[0,0,0,1],[1,1,1]),e}getWorldRotation(){const e=[0,0,0,1];return L.decompose(this.getWorldMatrix(),[0,0,0],e,[1,1,1]),e}getWorldScale(){const e=[1,1,1];return L.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],e),e}getWorldMatrix(){const e=[];for(let s=this;s!=null;s=s.getParentNode())e.push(s);let t;const r=e.pop().getMatrix();for(;t=e.pop();)kn(r,r,t.getMatrix());return r}addChild(e){const t=e.getParentNode();t&&t.removeChild(e);for(const r of e.listParents())r.propertyType===h.SCENE&&r.removeChild(e);return this.addRef("children",e)}removeChild(e){return this.removeRef("children",e)}listChildren(){return this.listRefs("children")}getParentNode(){for(const e of this.listParents())if(e.propertyType===h.NODE)return e;return null}getMesh(){return this.getRef("mesh")}setMesh(e){return this.setRef("mesh",e)}getCamera(){return this.getRef("camera")}setCamera(e){return this.setRef("camera",e)}getSkin(){return this.getRef("skin")}setSkin(e){return this.setRef("skin",e)}getWeights(){return this.get("weights")}setWeights(e){return this.set("weights",e)}traverse(e){e(this);for(const t of this.listChildren())t.traverse(e);return this}}class Le extends J{init(){this.propertyType=h.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:Le.Mode.TRIANGLES,material:null,indices:null,attributes:new oe,targets:new V})}getIndices(){return this.getRef("indices")}setIndices(e){return this.setRef("indices",e,{usage:te.ELEMENT_ARRAY_BUFFER})}getAttribute(e){return this.getRefMap("attributes",e)}setAttribute(e,t){return this.setRefMap("attributes",e,t,{usage:te.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}getMaterial(){return this.getRef("material")}setMaterial(e){return this.setRef("material",e)}getMode(){return this.get("mode")}setMode(e){return this.set("mode",e)}listTargets(){return this.listRefs("targets")}addTarget(e){return this.addRef("targets",e)}removeTarget(e){return this.removeRef("targets",e)}}Le.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class er extends wt{init(){this.propertyType=h.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new oe})}getAttribute(e){return this.getRefMap("attributes",e)}setAttribute(e,t){return this.setRefMap("attributes",e,t,{usage:te.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function W(){return W=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},W.apply(null,arguments)}class bs extends J{init(){this.propertyType=h.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new V})}copy(e,t=Ee){if(t===Ee)throw new Error("Scene cannot be copied.");return super.copy(e,t)}addChild(e){const t=e.getParentNode();return t&&t.removeChild(e),this.addRef("children",e)}removeChild(e){return this.removeRef("children",e)}listChildren(){return this.listRefs("children")}traverse(e){for(const t of this.listChildren())t.traverse(e);return this}}class ws extends J{init(){this.propertyType=h.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new V})}getSkeleton(){return this.getRef("skeleton")}setSkeleton(e){return this.setRef("skeleton",e)}getInverseBindMatrices(){return this.getRef("inverseBindMatrices")}setInverseBindMatrices(e){return this.setRef("inverseBindMatrices",e,{usage:te.INVERSE_BIND_MATRICES})}addJoint(e){return this.addRef("joints",e)}removeJoint(e){return this.removeRef("joints",e)}listJoints(){return this.listRefs("joints")}}class Cs extends J{init(){this.propertyType=h.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||fe.extensionToMimeType(ze.extension(this.get("uri")))}setMimeType(e){return this.set("mimeType",e)}getURI(){return this.get("uri")}setURI(e){this.set("uri",e);const t=fe.extensionToMimeType(ze.extension(e));return t&&this.set("mimeType",t),this}getImage(){return this.get("image")}setImage(e){return this.set("image",D.assertView(e))}getSize(){const e=this.get("image");return e?fe.getSize(e,this.getMimeType()):null}}class Os extends J{init(){this.propertyType=h.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${ys}`,version:"2.0"},defaultScene:null,accessors:new V,animations:new V,buffers:new V,cameras:new V,materials:new V,meshes:new V,nodes:new V,scenes:new V,skins:new V,textures:new V})}constructor(e){super(e),this._extensions=new Set,e.addEventListener("node:create",t=>{this._addChildOfRoot(t.target)})}clone(){throw new Error("Root cannot be cloned.")}copy(e,t=Ee){if(t===Ee)throw new Error("Root cannot be copied.");this.set("asset",W({},e.get("asset"))),this.setName(e.getName()),this.setExtras(W({},e.getExtras())),this.setDefaultScene(e.getDefaultScene()?t(e.getDefaultScene()):null);for(const r of e.listRefMapKeys("extensions")){const s=e.getExtension(r);this.setExtension(r,t(s))}return this}_addChildOfRoot(e){return e instanceof bs?this.addRef("scenes",e):e instanceof _s?this.addRef("nodes",e):e instanceof je?this.addRef("cameras",e):e instanceof ws?this.addRef("skins",e):e instanceof Ms?this.addRef("meshes",e):e instanceof Be?this.addRef("materials",e):e instanceof Cs?this.addRef("textures",e):e instanceof Ns?this.addRef("animations",e):e instanceof S?this.addRef("accessors",e):e instanceof Ss&&this.addRef("buffers",e),this}getAsset(){return this.get("asset")}listExtensionsUsed(){return Array.from(this._extensions)}listExtensionsRequired(){return this.listExtensionsUsed().filter(e=>e.isRequired())}_enableExtension(e){return this._extensions.add(e),this}_disableExtension(e){return this._extensions.delete(e),this}listScenes(){return this.listRefs("scenes")}setDefaultScene(e){return this.setRef("defaultScene",e)}getDefaultScene(){return this.getRef("defaultScene")}listNodes(){return this.listRefs("nodes")}listCameras(){return this.listRefs("cameras")}listSkins(){return this.listRefs("skins")}listMeshes(){return this.listRefs("meshes")}listMaterials(){return this.listRefs("materials")}listTextures(){return this.listRefs("textures")}listAnimations(){return this.listRefs("animations")}listAccessors(){return this.listRefs("accessors")}listBuffers(){return this.listRefs("buffers")}}class Ze{static fromGraph(e){return Ze._GRAPH_DOCUMENTS.get(e)||null}constructor(){this._graph=new vn,this._root=new Os(this._graph),this._logger=re.DEFAULT_INSTANCE,Ze._GRAPH_DOCUMENTS.set(this._graph,this)}getRoot(){return this._root}getGraph(){return this._graph}getLogger(){return this._logger}setLogger(e){return this._logger=e,this}clone(){throw new Error("Use 'cloneDocument(source)' from '@gltf-transform/functions'.")}merge(e){throw new Error("Use 'mergeDocuments(target, source)' from '@gltf-transform/functions'.")}async transform(...e){const t=e.map(r=>r.name);for(const r of e)await r(this,{stack:t});return this}createExtension(e){const t=e.EXTENSION_NAME;return this.getRoot().listExtensionsUsed().find(s=>s.extensionName===t)||new e(this)}createScene(e=""){return new bs(this._graph,e)}createNode(e=""){return new _s(this._graph,e)}createCamera(e=""){return new je(this._graph,e)}createSkin(e=""){return new ws(this._graph,e)}createMesh(e=""){return new Ms(this._graph,e)}createPrimitive(){return new Le(this._graph)}createPrimitiveTarget(e=""){return new er(this._graph,e)}createMaterial(e=""){return new Be(this._graph,e)}createTexture(e=""){return new Cs(this._graph,e)}createAnimation(e=""){return new Ns(this._graph,e)}createAnimationChannel(e=""){return new Ct(this._graph,e)}createAnimationSampler(e=""){return new Xe(this._graph,e)}createAccessor(e="",t=null){return t||(t=this.getRoot().listBuffers()[0]),new S(this._graph,e).setBuffer(t)}createBuffer(e=""){return new Ss(this._graph,e)}}Ze._GRAPH_DOCUMENTS=new WeakMap;class P{constructor(e){this.extensionName="",this.prereadTypes=[],this.prewriteTypes=[],this.readDependencies=[],this.writeDependencies=[],this.document=void 0,this.required=!1,this.properties=new Set,this._listener=void 0,this.document=e,e.getRoot()._enableExtension(this),this._listener=r=>{const s=r,n=s.target;n instanceof k&&n.extensionName===this.extensionName&&(s.type==="node:create"&&this._addExtensionProperty(n),s.type==="node:dispose"&&this._removeExtensionProperty(n))};const t=e.getGraph();t.addEventListener("node:create",this._listener),t.addEventListener("node:dispose",this._listener)}dispose(){this.document.getRoot()._disableExtension(this);const e=this.document.getGraph();e.removeEventListener("node:create",this._listener),e.removeEventListener("node:dispose",this._listener);for(const t of this.properties)t.dispose()}static register(){}isRequired(){return this.required}setRequired(e){return this.required=e,this}listProperties(){return Array.from(this.properties)}_addExtensionProperty(e){return this.properties.add(e),this}_removeExtensionProperty(e){return this.properties.delete(e),this}install(e,t){return this}preread(e,t){return this}prewrite(e,t){return this}}P.EXTENSION_NAME=void 0;class tr{constructor(e){this.jsonDoc=void 0,this.buffers=[],this.bufferViews=[],this.bufferViewBuffers=[],this.accessors=[],this.textures=[],this.textureInfos=new Map,this.materials=[],this.meshes=[],this.cameras=[],this.nodes=[],this.skins=[],this.animations=[],this.scenes=[],this.jsonDoc=e}setTextureInfo(e,t){this.textureInfos.set(e,t),t.texCoord!==void 0&&e.setTexCoord(t.texCoord),t.extras!==void 0&&e.setExtras(t.extras);const r=this.jsonDoc.json.textures[t.index];if(r.sampler===void 0)return;const s=this.jsonDoc.json.samplers[r.sampler];s.magFilter!==void 0&&e.setMagFilter(s.magFilter),s.minFilter!==void 0&&e.setMinFilter(s.minFilter),s.wrapS!==void 0&&e.setWrapS(s.wrapS),s.wrapT!==void 0&&e.setWrapT(s.wrapT)}}const ts={logger:re.DEFAULT_INSTANCE,extensions:[],dependencies:{}},sr=new Set([h.BUFFER,h.TEXTURE,h.MATERIAL,h.MESH,h.PRIMITIVE,h.NODE,h.SCENE]);class nr{static read(e,t=ts){const r=W({},ts,t),{json:s}=e,n=new Ze().setLogger(r.logger);this.validate(e,r);const o=new tr(e),a=s.asset,c=n.getRoot().getAsset();a.copyright&&(c.copyright=a.copyright),a.extras&&(c.extras=a.extras),s.extras!==void 0&&n.getRoot().setExtras(W({},s.extras));const u=s.extensionsUsed||[],g=s.extensionsRequired||[];r.extensions.sort((f,d)=>f.EXTENSION_NAME>d.EXTENSION_NAME?1:-1);for(const f of r.extensions)if(u.includes(f.EXTENSION_NAME)){const d=n.createExtension(f).setRequired(g.includes(f.EXTENSION_NAME)),R=d.prereadTypes.filter(A=>!sr.has(A));R.length&&r.logger.warn(`Preread hooks for some types (${R.join()}), requested by extension ${d.extensionName}, are unsupported. Please file an issue or a PR.`);for(const A of d.readDependencies)d.install(A,r.dependencies[A])}const p=s.buffers||[];n.getRoot().listExtensionsUsed().filter(f=>f.prereadTypes.includes(h.BUFFER)).forEach(f=>f.preread(o,h.BUFFER)),o.buffers=p.map(f=>{const d=n.createBuffer(f.name);return f.extras&&d.setExtras(f.extras),f.uri&&f.uri.indexOf("__")!==0&&d.setURI(f.uri),d});const x=s.bufferViews||[];o.bufferViewBuffers=x.map((f,d)=>{if(!o.bufferViews[d]){const R=e.json.buffers[f.buffer],A=R.uri?e.resources[R.uri]:e.resources[He],w=f.byteOffset||0;o.bufferViews[d]=D.toView(A,w,f.byteLength)}return o.buffers[f.buffer]});const I=s.accessors||[];o.accessors=I.map(f=>{const d=o.bufferViewBuffers[f.bufferView],R=n.createAccessor(f.name,d).setType(f.type);return f.extras&&R.setExtras(f.extras),f.normalized!==void 0&&R.setNormalized(f.normalized),f.bufferView===void 0||R.setArray(at(f,o)),R});const m=s.images||[],_=s.textures||[];n.getRoot().listExtensionsUsed().filter(f=>f.prereadTypes.includes(h.TEXTURE)).forEach(f=>f.preread(o,h.TEXTURE)),o.textures=m.map(f=>{const d=n.createTexture(f.name);if(f.extras&&d.setExtras(f.extras),f.bufferView!==void 0){const R=s.bufferViews[f.bufferView],A=e.json.buffers[R.buffer],w=A.uri?e.resources[A.uri]:e.resources[He],O=R.byteOffset||0,C=R.byteLength,B=w.slice(O,O+C);d.setImage(B)}else f.uri!==void 0&&(d.setImage(e.resources[f.uri]),f.uri.indexOf("__")!==0&&d.setURI(f.uri));if(f.mimeType!==void 0)d.setMimeType(f.mimeType);else if(f.uri){const R=ze.extension(f.uri);d.setMimeType(fe.extensionToMimeType(R))}return d}),n.getRoot().listExtensionsUsed().filter(f=>f.prereadTypes.includes(h.MATERIAL)).forEach(f=>f.preread(o,h.MATERIAL));const M=s.materials||[];o.materials=M.map(f=>{const d=n.createMaterial(f.name);f.extras&&d.setExtras(f.extras),f.alphaMode!==void 0&&d.setAlphaMode(f.alphaMode),f.alphaCutoff!==void 0&&d.setAlphaCutoff(f.alphaCutoff),f.doubleSided!==void 0&&d.setDoubleSided(f.doubleSided);const R=f.pbrMetallicRoughness||{};if(R.baseColorFactor!==void 0&&d.setBaseColorFactor(R.baseColorFactor),f.emissiveFactor!==void 0&&d.setEmissiveFactor(f.emissiveFactor),R.metallicFactor!==void 0&&d.setMetallicFactor(R.metallicFactor),R.roughnessFactor!==void 0&&d.setRoughnessFactor(R.roughnessFactor),R.baseColorTexture!==void 0){const A=R.baseColorTexture,w=o.textures[_[A.index].source];d.setBaseColorTexture(w),o.setTextureInfo(d.getBaseColorTextureInfo(),A)}if(f.emissiveTexture!==void 0){const A=f.emissiveTexture,w=o.textures[_[A.index].source];d.setEmissiveTexture(w),o.setTextureInfo(d.getEmissiveTextureInfo(),A)}if(f.normalTexture!==void 0){const A=f.normalTexture,w=o.textures[_[A.index].source];d.setNormalTexture(w),o.setTextureInfo(d.getNormalTextureInfo(),A),f.normalTexture.scale!==void 0&&d.setNormalScale(f.normalTexture.scale)}if(f.occlusionTexture!==void 0){const A=f.occlusionTexture,w=o.textures[_[A.index].source];d.setOcclusionTexture(w),o.setTextureInfo(d.getOcclusionTextureInfo(),A),f.occlusionTexture.strength!==void 0&&d.setOcclusionStrength(f.occlusionTexture.strength)}if(R.metallicRoughnessTexture!==void 0){const A=R.metallicRoughnessTexture,w=o.textures[_[A.index].source];d.setMetallicRoughnessTexture(w),o.setTextureInfo(d.getMetallicRoughnessTextureInfo(),A)}return d}),n.getRoot().listExtensionsUsed().filter(f=>f.prereadTypes.includes(h.MESH)).forEach(f=>f.preread(o,h.MESH));const l=s.meshes||[];n.getRoot().listExtensionsUsed().filter(f=>f.prereadTypes.includes(h.PRIMITIVE)).forEach(f=>f.preread(o,h.PRIMITIVE)),o.meshes=l.map(f=>{const d=n.createMesh(f.name);return f.extras&&d.setExtras(f.extras),f.weights!==void 0&&d.setWeights(f.weights),(f.primitives||[]).forEach(A=>{const w=n.createPrimitive();A.extras&&w.setExtras(A.extras),A.material!==void 0&&w.setMaterial(o.materials[A.material]),A.mode!==void 0&&w.setMode(A.mode);for(const[B,v]of Object.entries(A.attributes||{}))w.setAttribute(B,o.accessors[v]);A.indices!==void 0&&w.setIndices(o.accessors[A.indices]);const O=f.extras&&f.extras.targetNames||[];(A.targets||[]).forEach((B,v)=>{const U=O[v]||v.toString(),H=n.createPrimitiveTarget(U);for(const[Z,K]of Object.entries(B))H.setAttribute(Z,o.accessors[K]);w.addTarget(H)}),d.addPrimitive(w)}),d});const b=s.cameras||[];o.cameras=b.map(f=>{const d=n.createCamera(f.name).setType(f.type);if(f.extras&&d.setExtras(f.extras),f.type===je.Type.PERSPECTIVE){const R=f.perspective;d.setYFov(R.yfov),d.setZNear(R.znear),R.zfar!==void 0&&d.setZFar(R.zfar),R.aspectRatio!==void 0&&d.setAspectRatio(R.aspectRatio)}else{const R=f.orthographic;d.setZNear(R.znear).setZFar(R.zfar).setXMag(R.xmag).setYMag(R.ymag)}return d});const T=s.nodes||[];n.getRoot().listExtensionsUsed().filter(f=>f.prereadTypes.includes(h.NODE)).forEach(f=>f.preread(o,h.NODE)),o.nodes=T.map(f=>{const d=n.createNode(f.name);if(f.extras&&d.setExtras(f.extras),f.translation!==void 0&&d.setTranslation(f.translation),f.rotation!==void 0&&d.setRotation(f.rotation),f.scale!==void 0&&d.setScale(f.scale),f.matrix!==void 0){const R=[0,0,0],A=[0,0,0,1],w=[1,1,1];L.decompose(f.matrix,R,A,w),d.setTranslation(R),d.setRotation(A),d.setScale(w)}return f.weights!==void 0&&d.setWeights(f.weights),d});const y=s.skins||[];o.skins=y.map(f=>{const d=n.createSkin(f.name);f.extras&&d.setExtras(f.extras),f.inverseBindMatrices!==void 0&&d.setInverseBindMatrices(o.accessors[f.inverseBindMatrices]),f.skeleton!==void 0&&d.setSkeleton(o.nodes[f.skeleton]);for(const R of f.joints)d.addJoint(o.nodes[R]);return d}),T.map((f,d)=>{const R=o.nodes[d];(f.children||[]).forEach(w=>R.addChild(o.nodes[w])),f.mesh!==void 0&&R.setMesh(o.meshes[f.mesh]),f.camera!==void 0&&R.setCamera(o.cameras[f.camera]),f.skin!==void 0&&R.setSkin(o.skins[f.skin])});const E=s.animations||[];o.animations=E.map(f=>{const d=n.createAnimation(f.name);f.extras&&d.setExtras(f.extras);const A=(f.samplers||[]).map(O=>{const C=n.createAnimationSampler().setInput(o.accessors[O.input]).setOutput(o.accessors[O.output]).setInterpolation(O.interpolation||Xe.Interpolation.LINEAR);return O.extras&&C.setExtras(O.extras),d.addSampler(C),C});return(f.channels||[]).forEach(O=>{const C=n.createAnimationChannel().setSampler(A[O.sampler]).setTargetPath(O.target.path);O.target.node!==void 0&&C.setTargetNode(o.nodes[O.target.node]),O.extras&&C.setExtras(O.extras),d.addChannel(C)}),d});const N=s.scenes||[];return n.getRoot().listExtensionsUsed().filter(f=>f.prereadTypes.includes(h.SCENE)).forEach(f=>f.preread(o,h.SCENE)),o.scenes=N.map(f=>{const d=n.createScene(f.name);return f.extras&&d.setExtras(f.extras),(f.nodes||[]).map(A=>o.nodes[A]).forEach(A=>d.addChild(A)),d}),s.scene!==void 0&&n.getRoot().setDefaultScene(o.scenes[s.scene]),n.getRoot().listExtensionsUsed().forEach(f=>f.read(o)),I.forEach((f,d)=>{const R=o.accessors[d],A=!!f.sparse,w=!f.bufferView&&!R.getArray();(A||w)&&R.setSparse(!0).setArray(ir(f,o))}),n}static validate(e,t){const r=e.json;if(r.asset.version!=="2.0")throw new Error(`Unsupported glTF version, "${r.asset.version}".`);if(r.extensionsRequired){for(const s of r.extensionsRequired)if(!t.extensions.find(n=>n.EXTENSION_NAME===s))throw new Error(`Missing required extension, "${s}".`)}if(r.extensionsUsed)for(const s of r.extensionsUsed)t.extensions.find(n=>n.EXTENSION_NAME===s)||t.logger.warn(`Missing optional extension, "${s}".`)}}function rr(i,e){const t=e.jsonDoc,r=e.bufferViews[i.bufferView],s=t.json.bufferViews[i.bufferView],n=ht[i.componentType],o=S.getElementSize(i.type),a=n.BYTES_PER_ELEMENT,c=i.byteOffset||0,u=new n(i.count*o),g=new DataView(r.buffer,r.byteOffset,r.byteLength),p=s.byteStride;for(let x=0;x<i.count;x++)for(let I=0;I<o;I++){const m=c+x*p+I*a;let _;switch(i.componentType){case S.ComponentType.FLOAT:_=g.getFloat32(m,!0);break;case S.ComponentType.UNSIGNED_INT:_=g.getUint32(m,!0);break;case S.ComponentType.UNSIGNED_SHORT:_=g.getUint16(m,!0);break;case S.ComponentType.UNSIGNED_BYTE:_=g.getUint8(m);break;case S.ComponentType.SHORT:_=g.getInt16(m,!0);break;case S.ComponentType.BYTE:_=g.getInt8(m);break;default:throw new Error(`Unexpected componentType "${i.componentType}".`)}u[x*o+I]=_}return u}function at(i,e){const t=e.jsonDoc,r=e.bufferViews[i.bufferView],s=t.json.bufferViews[i.bufferView],n=ht[i.componentType],o=S.getElementSize(i.type),a=n.BYTES_PER_ELEMENT,c=o*a;if(s.byteStride!==void 0&&s.byteStride!==c)return rr(i,e);const u=r.byteOffset+(i.byteOffset||0),g=i.count*o*a;return new n(r.buffer.slice(u,u+g))}function ir(i,e){const t=ht[i.componentType],r=S.getElementSize(i.type);let s;i.bufferView!==void 0?s=at(i,e):s=new t(i.count*r);const n=i.sparse;if(!n)return s;const o=n.count,a=W({},i,n.indices,{count:o,type:"SCALAR"}),c=W({},i,n.values,{count:o}),u=at(a,e),g=at(c,e);for(let p=0;p<a.count;p++)for(let x=0;x<r;x++)s[u[p]*r+x]=g[p*r+x];return s}var et;(function(i){i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(et||(et={}));class le{constructor(e,t,r){this._doc=void 0,this.jsonDoc=void 0,this.options=void 0,this.accessorIndexMap=new Map,this.animationIndexMap=new Map,this.bufferIndexMap=new Map,this.cameraIndexMap=new Map,this.skinIndexMap=new Map,this.materialIndexMap=new Map,this.meshIndexMap=new Map,this.nodeIndexMap=new Map,this.imageIndexMap=new Map,this.textureDefIndexMap=new Map,this.textureInfoDefMap=new Map,this.samplerDefIndexMap=new Map,this.sceneIndexMap=new Map,this.imageBufferViews=[],this.otherBufferViews=new Map,this.otherBufferViewsIndexMap=new Map,this.extensionData={},this.bufferURIGenerator=void 0,this.imageURIGenerator=void 0,this.logger=void 0,this._accessorUsageMap=new Map,this.accessorUsageGroupedByParent=new Set(["ARRAY_BUFFER"]),this.accessorParents=new Map,this._doc=e,this.jsonDoc=t,this.options=r;const s=e.getRoot(),n=s.listBuffers().length,o=s.listTextures().length;this.bufferURIGenerator=new ss(n>1,()=>r.basename||"buffer"),this.imageURIGenerator=new ss(o>1,a=>or(e,a)||r.basename||"texture"),this.logger=e.getLogger()}createTextureInfoDef(e,t){const r={magFilter:t.getMagFilter()||void 0,minFilter:t.getMinFilter()||void 0,wrapS:t.getWrapS(),wrapT:t.getWrapT()},s=JSON.stringify(r);this.samplerDefIndexMap.has(s)||(this.samplerDefIndexMap.set(s,this.jsonDoc.json.samplers.length),this.jsonDoc.json.samplers.push(r));const n={source:this.imageIndexMap.get(e),sampler:this.samplerDefIndexMap.get(s)},o=JSON.stringify(n);this.textureDefIndexMap.has(o)||(this.textureDefIndexMap.set(o,this.jsonDoc.json.textures.length),this.jsonDoc.json.textures.push(n));const a={index:this.textureDefIndexMap.get(o)};return t.getTexCoord()!==0&&(a.texCoord=t.getTexCoord()),Object.keys(t.getExtras()).length>0&&(a.extras=t.getExtras()),this.textureInfoDefMap.set(t,a),a}createPropertyDef(e){const t={};return e.getName()&&(t.name=e.getName()),Object.keys(e.getExtras()).length>0&&(t.extras=e.getExtras()),t}createAccessorDef(e){const t=this.createPropertyDef(e);return t.type=e.getType(),t.componentType=e.getComponentType(),t.count=e.getCount(),this._doc.getGraph().listParentEdges(e).some(s=>s.getName()==="attributes"&&s.getAttributes().key==="POSITION"||s.getName()==="input")&&(t.max=e.getMax([]).map(Math.fround),t.min=e.getMin([]).map(Math.fround)),e.getNormalized()&&(t.normalized=e.getNormalized()),t}createImageData(e,t,r){if(this.options.format===me.GLB)this.imageBufferViews.push(t),e.bufferView=this.jsonDoc.json.bufferViews.length,this.jsonDoc.json.bufferViews.push({buffer:0,byteOffset:-1,byteLength:t.byteLength});else{const s=fe.mimeTypeToExtension(r.getMimeType());e.uri=this.imageURIGenerator.createURI(r,s),this.assignResourceURI(e.uri,t,!1)}}assignResourceURI(e,t,r){const s=this.jsonDoc.resources;if(!(e in s)){s[e]=t;return}if(t===s[e]){this.logger.warn(`Duplicate resource URI, "${e}".`);return}const n=`Resource URI "${e}" already assigned to different data.`;if(!r){this.logger.warn(n);return}throw new Error(n)}getAccessorUsage(e){const t=this._accessorUsageMap.get(e);if(t)return t;if(e.getSparse())return te.SPARSE;for(const r of this._doc.getGraph().listParentEdges(e)){const{usage:s}=r.getAttributes();if(s)return s;r.getParent().propertyType!==h.ROOT&&this.logger.warn(`Missing attribute ".usage" on edge, "${r.getName()}".`)}return te.OTHER}addAccessorToUsageGroup(e,t){const r=this._accessorUsageMap.get(e);if(r&&r!==t)throw new Error(`Accessor with usage "${r}" cannot be reused as "${t}".`);return this._accessorUsageMap.set(e,t),this}}le.BufferViewTarget=et;le.BufferViewUsage=te;le.USAGE_TO_TARGET={[te.ARRAY_BUFFER]:et.ARRAY_BUFFER,[te.ELEMENT_ARRAY_BUFFER]:et.ELEMENT_ARRAY_BUFFER};class ss{constructor(e,t){this.multiple=void 0,this.basename=void 0,this.counter={},this.multiple=e,this.basename=t}createURI(e,t){if(e.getURI())return e.getURI();if(this.multiple){const r=this.basename(e);return this.counter[r]=this.counter[r]||1,`${r}_${this.counter[r]++}.${t}`}else return`${this.basename(e)}.${t}`}}function or(i,e){const t=i.getGraph().listParentEdges(e).find(r=>r.getParent()!==i.getRoot());return t?t.getName().replace(/texture$/i,""):""}const{BufferViewUsage:ot}=le,{UNSIGNED_INT:ar,UNSIGNED_SHORT:cr,UNSIGNED_BYTE:ur}=S.ComponentType,fr=new Set([h.ACCESSOR,h.BUFFER,h.MATERIAL,h.MESH]);class lr{static write(e,t){const r=e.getGraph(),s=e.getRoot(),n={asset:W({generator:`glTF-Transform ${ys}`},s.getAsset()),extras:W({},s.getExtras())},o={json:n,resources:{}},a=new le(e,o,t),c=t.logger||re.DEFAULT_INSTANCE,u=new Set(t.extensions.map(l=>l.EXTENSION_NAME)),g=e.getRoot().listExtensionsUsed().filter(l=>u.has(l.extensionName)).sort((l,b)=>l.extensionName>b.extensionName?1:-1),p=e.getRoot().listExtensionsRequired().filter(l=>u.has(l.extensionName)).sort((l,b)=>l.extensionName>b.extensionName?1:-1);g.length<e.getRoot().listExtensionsUsed().length&&c.warn("Some extensions were not registered for I/O, and will not be written.");for(const l of g){const b=l.prewriteTypes.filter(T=>!fr.has(T));b.length&&c.warn(`Prewrite hooks for some types (${b.join()}), requested by extension ${l.extensionName}, are unsupported. Please file an issue or a PR.`);for(const T of l.writeDependencies)l.install(T,t.dependencies[T])}function x(l,b,T,y){const E=[];let N=0;for(const R of l){const A=a.createAccessorDef(R);A.bufferView=n.bufferViews.length;const w=R.getArray(),O=D.pad(D.toView(w));A.byteOffset=N,N+=O.byteLength,E.push(O),a.accessorIndexMap.set(R,n.accessors.length),n.accessors.push(A)}const f=D.concat(E),d={buffer:b,byteOffset:T,byteLength:f.byteLength};return y&&(d.target=y),n.bufferViews.push(d),{buffers:E,byteLength:N}}function I(l,b,T){const y=l[0].getCount();let E=0;for(const A of l){const w=a.createAccessorDef(A);w.bufferView=n.bufferViews.length,w.byteOffset=E;const O=A.getElementSize(),C=A.getComponentSize();E+=D.padNumber(O*C),a.accessorIndexMap.set(A,n.accessors.length),n.accessors.push(w)}const N=y*E,f=new ArrayBuffer(N),d=new DataView(f);for(let A=0;A<y;A++){let w=0;for(const O of l){const C=O.getElementSize(),B=O.getComponentSize(),v=O.getComponentType(),U=O.getArray();for(let H=0;H<C;H++){const Z=A*E+w+H*B,K=U[A*C+H];switch(v){case S.ComponentType.FLOAT:d.setFloat32(Z,K,!0);break;case S.ComponentType.BYTE:d.setInt8(Z,K);break;case S.ComponentType.SHORT:d.setInt16(Z,K,!0);break;case S.ComponentType.UNSIGNED_BYTE:d.setUint8(Z,K);break;case S.ComponentType.UNSIGNED_SHORT:d.setUint16(Z,K,!0);break;case S.ComponentType.UNSIGNED_INT:d.setUint32(Z,K,!0);break;default:throw new Error("Unexpected component type: "+v)}}w+=D.padNumber(C*B)}}const R={buffer:b,byteOffset:T,byteLength:N,byteStride:E,target:le.BufferViewTarget.ARRAY_BUFFER};return n.bufferViews.push(R),{byteLength:N,buffers:[new Uint8Array(f)]}}function m(l,b,T){const y=[];let E=0;const N=new Map;let f=-1/0,d=!1;for(const v of l){const U=a.createAccessorDef(v);n.accessors.push(U),a.accessorIndexMap.set(v,n.accessors.length-1);const H=[],Z=[],K=[],X=new Array(v.getElementSize()).fill(0);for(let de=0,Cn=v.getCount();de<Cn;de++)if(v.getElement(de,K),!L.eq(K,X,0)){f=Math.max(de,f),H.push(de);for(let dt=0;dt<K.length;dt++)Z.push(K[dt])}const ee=H.length,pe={accessorDef:U,count:ee};if(N.set(v,pe),ee===0)continue;ee>v.getCount()/2&&(d=!0);const pt=ht[v.getComponentType()];pe.indices=H,pe.values=new pt(Z)}if(!Number.isFinite(f))return{buffers:y,byteLength:E};d&&c.warn("Some sparse accessors have >50% non-zero elements, which may increase file size.");const R=f<255?Uint8Array:f<65535?Uint16Array:Uint32Array,A=f<255?ur:f<65535?cr:ar,w={buffer:b,byteOffset:T+E,byteLength:0};for(const v of l){const U=N.get(v);if(U.count===0)continue;U.indicesByteOffset=w.byteLength;const H=D.pad(D.toView(new R(U.indices)));y.push(H),E+=H.byteLength,w.byteLength+=H.byteLength}n.bufferViews.push(w);const O=n.bufferViews.length-1,C={buffer:b,byteOffset:T+E,byteLength:0};for(const v of l){const U=N.get(v);if(U.count===0)continue;U.valuesByteOffset=C.byteLength;const H=D.pad(D.toView(U.values));y.push(H),E+=H.byteLength,C.byteLength+=H.byteLength}n.bufferViews.push(C);const B=n.bufferViews.length-1;for(const v of l){const U=N.get(v);U.count!==0&&(U.accessorDef.sparse={count:U.count,indices:{bufferView:O,byteOffset:U.indicesByteOffset,componentType:A},values:{bufferView:B,byteOffset:U.valuesByteOffset}})}return{buffers:y,byteLength:E}}if(n.accessors=[],n.bufferViews=[],n.samplers=[],n.textures=[],n.images=s.listTextures().map((l,b)=>{const T=a.createPropertyDef(l);l.getMimeType()&&(T.mimeType=l.getMimeType());const y=l.getImage();return y&&a.createImageData(T,y,l),a.imageIndexMap.set(l,b),T}),g.filter(l=>l.prewriteTypes.includes(h.ACCESSOR)).forEach(l=>l.prewrite(a,h.ACCESSOR)),s.listAccessors().forEach(l=>{const b=a.accessorUsageGroupedByParent,T=a.accessorParents;if(a.accessorIndexMap.has(l))return;const y=a.getAccessorUsage(l);if(a.addAccessorToUsageGroup(l,y),b.has(y)){const E=r.listParents(l).find(N=>N.propertyType!==h.ROOT);T.set(l,E)}}),g.filter(l=>l.prewriteTypes.includes(h.BUFFER)).forEach(l=>l.prewrite(a,h.BUFFER)),(s.listAccessors().length>0||a.otherBufferViews.size>0||s.listTextures().length>0&&t.format===me.GLB)&&s.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");n.buffers=[],s.listBuffers().forEach((l,b)=>{const T=a.createPropertyDef(l),y=a.accessorUsageGroupedByParent,E=l.listParents().filter(C=>C instanceof S),N=new Set(E.map(C=>a.accessorParents.get(C))),f=new Map(Array.from(N).map((C,B)=>[C,B])),d={};for(const C of E){var R;if(a.accessorIndexMap.has(C))continue;const B=a.getAccessorUsage(C);let v=B;if(y.has(B)){const U=a.accessorParents.get(C);v+=`:${f.get(U)}`}d[R=v]||(d[R]={usage:B,accessors:[]}),d[v].accessors.push(C)}const A=[],w=n.buffers.length;let O=0;for(const{usage:C,accessors:B}of Object.values(d))if(C===ot.ARRAY_BUFFER&&t.vertexLayout===ct.INTERLEAVED){const v=I(B,w,O);O+=v.byteLength,A.push(...v.buffers)}else if(C===ot.ARRAY_BUFFER)for(const v of B){const U=I([v],w,O);O+=U.byteLength,A.push(...U.buffers)}else if(C===ot.SPARSE){const v=m(B,w,O);O+=v.byteLength,A.push(...v.buffers)}else if(C===ot.ELEMENT_ARRAY_BUFFER){const v=le.BufferViewTarget.ELEMENT_ARRAY_BUFFER,U=x(B,w,O,v);O+=U.byteLength,A.push(...U.buffers)}else{const v=x(B,w,O);O+=v.byteLength,A.push(...v.buffers)}if(a.imageBufferViews.length&&b===0){for(let C=0;C<a.imageBufferViews.length;C++)if(n.bufferViews[n.images[C].bufferView].byteOffset=O,O+=a.imageBufferViews[C].byteLength,A.push(a.imageBufferViews[C]),O%8){const B=8-O%8;O+=B,A.push(new Uint8Array(B))}}if(a.otherBufferViews.has(l))for(const C of a.otherBufferViews.get(l))n.bufferViews.push({buffer:w,byteOffset:O,byteLength:C.byteLength}),a.otherBufferViewsIndexMap.set(C,n.bufferViews.length-1),O+=C.byteLength,A.push(C);if(O){let C;t.format===me.GLB?C=He:(C=a.bufferURIGenerator.createURI(l,"bin"),T.uri=C),T.byteLength=O,a.assignResourceURI(C,D.concat(A),!0)}n.buffers.push(T),a.bufferIndexMap.set(l,b)}),s.listAccessors().find(l=>!l.getBuffer())&&c.warn("Skipped writing one or more Accessors: no Buffer assigned."),g.filter(l=>l.prewriteTypes.includes(h.MATERIAL)).forEach(l=>l.prewrite(a,h.MATERIAL)),n.materials=s.listMaterials().map((l,b)=>{const T=a.createPropertyDef(l);if(l.getAlphaMode()!==Be.AlphaMode.OPAQUE&&(T.alphaMode=l.getAlphaMode()),l.getAlphaMode()===Be.AlphaMode.MASK&&(T.alphaCutoff=l.getAlphaCutoff()),l.getDoubleSided()&&(T.doubleSided=!0),T.pbrMetallicRoughness={},L.eq(l.getBaseColorFactor(),[1,1,1,1])||(T.pbrMetallicRoughness.baseColorFactor=l.getBaseColorFactor()),L.eq(l.getEmissiveFactor(),[0,0,0])||(T.emissiveFactor=l.getEmissiveFactor()),l.getRoughnessFactor()!==1&&(T.pbrMetallicRoughness.roughnessFactor=l.getRoughnessFactor()),l.getMetallicFactor()!==1&&(T.pbrMetallicRoughness.metallicFactor=l.getMetallicFactor()),l.getBaseColorTexture()){const y=l.getBaseColorTexture(),E=l.getBaseColorTextureInfo();T.pbrMetallicRoughness.baseColorTexture=a.createTextureInfoDef(y,E)}if(l.getEmissiveTexture()){const y=l.getEmissiveTexture(),E=l.getEmissiveTextureInfo();T.emissiveTexture=a.createTextureInfoDef(y,E)}if(l.getNormalTexture()){const y=l.getNormalTexture(),E=l.getNormalTextureInfo(),N=a.createTextureInfoDef(y,E);l.getNormalScale()!==1&&(N.scale=l.getNormalScale()),T.normalTexture=N}if(l.getOcclusionTexture()){const y=l.getOcclusionTexture(),E=l.getOcclusionTextureInfo(),N=a.createTextureInfoDef(y,E);l.getOcclusionStrength()!==1&&(N.strength=l.getOcclusionStrength()),T.occlusionTexture=N}if(l.getMetallicRoughnessTexture()){const y=l.getMetallicRoughnessTexture(),E=l.getMetallicRoughnessTextureInfo();T.pbrMetallicRoughness.metallicRoughnessTexture=a.createTextureInfoDef(y,E)}return a.materialIndexMap.set(l,b),T}),g.filter(l=>l.prewriteTypes.includes(h.MESH)).forEach(l=>l.prewrite(a,h.MESH)),n.meshes=s.listMeshes().map((l,b)=>{const T=a.createPropertyDef(l);let y=null;return T.primitives=l.listPrimitives().map(E=>{const N={attributes:{}};N.mode=E.getMode();const f=E.getMaterial();f&&(N.material=a.materialIndexMap.get(f)),Object.keys(E.getExtras()).length&&(N.extras=E.getExtras());const d=E.getIndices();d&&(N.indices=a.accessorIndexMap.get(d));for(const R of E.listSemantics())N.attributes[R]=a.accessorIndexMap.get(E.getAttribute(R));for(const R of E.listTargets()){const A={};for(const w of R.listSemantics())A[w]=a.accessorIndexMap.get(R.getAttribute(w));N.targets=N.targets||[],N.targets.push(A)}return E.listTargets().length&&!y&&(y=E.listTargets().map(R=>R.getName())),N}),l.getWeights().length&&(T.weights=l.getWeights()),y&&(T.extras=T.extras||{},T.extras.targetNames=y),a.meshIndexMap.set(l,b),T}),n.cameras=s.listCameras().map((l,b)=>{const T=a.createPropertyDef(l);if(T.type=l.getType(),T.type===je.Type.PERSPECTIVE){T.perspective={znear:l.getZNear(),zfar:l.getZFar(),yfov:l.getYFov()};const y=l.getAspectRatio();y!==null&&(T.perspective.aspectRatio=y)}else T.orthographic={znear:l.getZNear(),zfar:l.getZFar(),xmag:l.getXMag(),ymag:l.getYMag()};return a.cameraIndexMap.set(l,b),T}),n.nodes=s.listNodes().map((l,b)=>{const T=a.createPropertyDef(l);return L.eq(l.getTranslation(),[0,0,0])||(T.translation=l.getTranslation()),L.eq(l.getRotation(),[0,0,0,1])||(T.rotation=l.getRotation()),L.eq(l.getScale(),[1,1,1])||(T.scale=l.getScale()),l.getWeights().length&&(T.weights=l.getWeights()),a.nodeIndexMap.set(l,b),T}),n.skins=s.listSkins().map((l,b)=>{const T=a.createPropertyDef(l),y=l.getInverseBindMatrices();y&&(T.inverseBindMatrices=a.accessorIndexMap.get(y));const E=l.getSkeleton();return E&&(T.skeleton=a.nodeIndexMap.get(E)),T.joints=l.listJoints().map(N=>a.nodeIndexMap.get(N)),a.skinIndexMap.set(l,b),T}),s.listNodes().forEach((l,b)=>{const T=n.nodes[b],y=l.getMesh();y&&(T.mesh=a.meshIndexMap.get(y));const E=l.getCamera();E&&(T.camera=a.cameraIndexMap.get(E));const N=l.getSkin();N&&(T.skin=a.skinIndexMap.get(N)),l.listChildren().length>0&&(T.children=l.listChildren().map(f=>a.nodeIndexMap.get(f)))}),n.animations=s.listAnimations().map((l,b)=>{const T=a.createPropertyDef(l),y=new Map;return T.samplers=l.listSamplers().map((E,N)=>{const f=a.createPropertyDef(E);return f.input=a.accessorIndexMap.get(E.getInput()),f.output=a.accessorIndexMap.get(E.getOutput()),f.interpolation=E.getInterpolation(),y.set(E,N),f}),T.channels=l.listChannels().map(E=>{const N=a.createPropertyDef(E);return N.sampler=y.get(E.getSampler()),N.target={node:a.nodeIndexMap.get(E.getTargetNode()),path:E.getTargetPath()},N}),a.animationIndexMap.set(l,b),T}),n.scenes=s.listScenes().map((l,b)=>{const T=a.createPropertyDef(l);return T.nodes=l.listChildren().map(y=>a.nodeIndexMap.get(y)),a.sceneIndexMap.set(l,b),T});const M=s.getDefaultScene();return M&&(n.scene=s.listScenes().indexOf(M)),n.extensionsUsed=g.map(l=>l.extensionName),n.extensionsRequired=p.map(l=>l.extensionName),g.forEach(l=>l.write(a)),hr(n),o}}function hr(i){const e=[];for(const t in i){const r=i[t];(Array.isArray(r)&&r.length===0||r===null||r===""||r&&typeof r=="object"&&Object.keys(r).length===0)&&e.push(t)}for(const t of e)delete i[t]}var ft;(function(i){i[i.JSON=1313821514]="JSON",i[i.BIN=5130562]="BIN"})(ft||(ft={}));class gr{constructor(){this._logger=re.DEFAULT_INSTANCE,this._extensions=new Set,this._dependencies={},this._vertexLayout=ct.INTERLEAVED,this.lastReadBytes=0,this.lastWriteBytes=0}setLogger(e){return this._logger=e,this}registerExtensions(e){for(const t of e)this._extensions.add(t),t.register();return this}registerDependencies(e){return Object.assign(this._dependencies,e),this}setVertexLayout(e){return this._vertexLayout=e,this}async read(e){return await this.readJSON(await this.readAsJSON(e))}async readAsJSON(e){const t=await this.readURI(e,"view");this.lastReadBytes=t.byteLength;const r=ns(t)?this._binaryToJSON(t):{json:JSON.parse(D.decodeText(t)),resources:{}};return await this._readResourcesExternal(r,this.dirname(e)),this._readResourcesInternal(r),r}async readJSON(e){return e=this._copyJSON(e),this._readResourcesInternal(e),nr.read(e,{extensions:Array.from(this._extensions),dependencies:this._dependencies,logger:this._logger})}async binaryToJSON(e){const t=this._binaryToJSON(D.assertView(e));this._readResourcesInternal(t);const r=t.json;if(r.buffers&&r.buffers.some(s=>pr(t,s)))throw new Error("Cannot resolve external buffers with binaryToJSON().");if(r.images&&r.images.some(s=>dr(t,s)))throw new Error("Cannot resolve external images with binaryToJSON().");return t}async readBinary(e){return this.readJSON(await this.binaryToJSON(D.assertView(e)))}async writeJSON(e,t={}){if(t.format===me.GLB&&e.getRoot().listBuffers().length>1)throw new Error("GLB must have 0–1 buffers.");return lr.write(e,{format:t.format||me.GLTF,basename:t.basename||"",logger:this._logger,vertexLayout:this._vertexLayout,dependencies:W({},this._dependencies),extensions:Array.from(this._extensions)})}async writeBinary(e){const{json:t,resources:r}=await this.writeJSON(e,{format:me.GLB}),s=new Uint32Array([1179937895,2,12]),n=JSON.stringify(t),o=D.pad(D.encodeText(n),32),a=D.toView(new Uint32Array([o.byteLength,1313821514])),c=D.concat([a,o]);s[s.length-1]+=c.byteLength;const u=Object.values(r)[0];if(!u||!u.byteLength)return D.concat([D.toView(s),c]);const g=D.pad(u,0),p=D.toView(new Uint32Array([g.byteLength,5130562])),x=D.concat([p,g]);return s[s.length-1]+=x.byteLength,D.concat([D.toView(s),c,x])}async _readResourcesExternal(e,t){var r=this;const s=e.json.images||[],n=e.json.buffers||[],o=[...s,...n].map(async function(a){const c=a.uri;if(!c||c.match(/data:/))return Promise.resolve();e.resources[c]=await r.readURI(r.resolve(t,c),"view"),r.lastReadBytes+=e.resources[c].byteLength});await Promise.all(o)}_readResourcesInternal(e){function t(n){if(n.uri){if(n.uri in e.resources){D.assertView(e.resources[n.uri]);return}if(n.uri.match(/data:/)){const o=`__${Wn()}.${ze.extension(n.uri)}`;e.resources[o]=D.createBufferFromDataURI(n.uri),n.uri=o}}}(e.json.images||[]).forEach(n=>{if(n.bufferView===void 0&&n.uri===void 0)throw new Error("Missing resource URI or buffer view.");t(n)}),(e.json.buffers||[]).forEach(t)}_copyJSON(e){const{images:t,buffers:r}=e.json;return e={json:W({},e.json),resources:W({},e.resources)},t&&(e.json.images=t.map(s=>W({},s))),r&&(e.json.buffers=r.map(s=>W({},s))),e}_binaryToJSON(e){if(!ns(e))throw new Error("Invalid glTF 2.0 binary.");const t=new Uint32Array(e.buffer,e.byteOffset+12,2);if(t[1]!==ft.JSON)throw new Error("Missing required GLB JSON chunk.");const r=20,s=t[0],n=D.decodeText(D.toView(e,r,s)),o=JSON.parse(n),a=r+s;if(e.byteLength<=a)return{json:o,resources:{}};const c=new Uint32Array(e.buffer,e.byteOffset+a,2);if(c[1]!==ft.BIN)return{json:o,resources:{}};const u=c[0],g=D.toView(e,a+8,u);return{json:o,resources:{[He]:g}}}}function pr(i,e){return e.uri!==void 0&&!(e.uri in i.resources)}function dr(i,e){return e.uri!==void 0&&!(e.uri in i.resources)&&e.bufferView===void 0}function ns(i){if(i.byteLength<3*Uint32Array.BYTES_PER_ELEMENT)return!1;const e=new Uint32Array(i.buffer,i.byteOffset,3);return e[0]===1179937895&&e[1]===2}class Tr extends gr{constructor(e=Qe.DEFAULT_INIT){super(),this._fetchConfig=void 0,this._fetchConfig=e}async readURI(e,t){const r=await fetch(e,this._fetchConfig);switch(t){case"view":return new Uint8Array(await r.arrayBuffer());case"text":return r.text()}}resolve(e,t){return Qe.resolve(e,t)}dirname(e){return Qe.dirname(e)}}const Te="GALACEAN_materials_remap";class Ds extends k{constructor(){super(...arguments);Q(this,"parentTypes",[h.MATERIAL]);Q(this,"propertyType");Q(this,"extensionName",Te)}init(){this.extensionName=Te,this.propertyType="GlTFRemapping",this.parentTypes=[h.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{refId:""})}getRefId(){return this.get("refId")}setRefId(t){return this.set("refId",t)}}Q(Ds,"EXTENSION_NAME",Te);class vs extends P{constructor(){super(...arguments);Q(this,"extensionName","GALACEAN_materials_remap")}createGlTFRemapping(){return new Ds(this.document.getGraph())}read(t){return(t.jsonDoc.json.materials||[]).forEach((n,o)=>{if(n.extensions&&n.extensions[Te]){const a=this.createGlTFRemapping();t.materials[o].setExtension(Te,a);const c=n.extensions[Te];c.refId!==void 0&&a.setRefId(c.refId)}}),this}write(t){const r=t.jsonDoc;return this.document.getRoot().listMaterials().forEach(s=>{const n=s.getExtension(Te);if(n){const o=t.materialIndexMap.get(s),a=r.json.materials[o];a.extensions=a.extensions||{},a.extensions[Te]={refId:n.getRefId()}}}),this}}Q(vs,"EXTENSION_NAME","GALACEAN_materials_remap");const ue="GALACEAN_animation_event";class Fs extends k{constructor(){super(...arguments);Q(this,"parentTypes",[h.ANIMATION]);Q(this,"propertyType");Q(this,"extensionName",ue)}init(){this.extensionName=ue,this.propertyType="GlTFAnimationEvent"}getDefaults(){return Object.assign(super.getDefaults(),{events:{}})}getEvents(){return this.get("events")}setEvents(t){return this.set("events",t)}}Q(Fs,"EXTENSION_NAME",ue);class Us extends P{constructor(){super(...arguments);Q(this,"extensionName",ue);Q(this,"eventProperty")}createAnimationEvent(){return this.eventProperty=new Fs(this.document.getGraph()),this.eventProperty}read(t){return(t.jsonDoc.json.animations||[]).forEach((n,o)=>{if(n.extensions&&n.extensions[ue]){const a=this.createAnimationEvent();t.animations[o].setExtension(ue,a);const u=n.extensions[ue].events;u&&a.setEvents(u)}}),this}write(t){const r=t.jsonDoc;return this.document.getRoot().listAnimations().forEach(s=>{const n=s.getExtension(ue);if(n){const o=t.animationIndexMap.get(s),a=r.json.animations[o];a.extensions=a.extensions||{},a.extensions[ue]={events:n.getEvents()}}}),this}}Q(Us,"EXTENSION_NAME",ue);const xr=0,mr=0,Er=0,yr=2,Rr=0,Ir=163,Ar=166,Nr=0,Sr=2,Mr=1,_r=64,br=0;class wr{constructor(){this.vkFormat=br,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=xr,this.levels=[],this.dataFormatDescriptor=[{vendorId:Er,descriptorType:mr,descriptorBlockSize:0,versionNumber:yr,colorModel:Rr,colorPrimaries:Mr,transferFunction:Sr,flags:Nr,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Ke{constructor(e,t,r,s){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=s,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian),t=this._dataView.getUint32(this._offset+4,this._littleEndian),r=e+2**32*t;return this._offset+=8,r}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){const r=this._offset;let s=0;for(;this._dataView.getUint8(this._offset)!==t&&s<e;)s++,this._offset++;return s<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,s)}}const q=[171,75,84,88,32,50,48,187,13,10,26,10];function rs(i){return new TextDecoder().decode(i)}function xt(i){const e=new Uint8Array(i.buffer,i.byteOffset,q.length);if(e[0]!==q[0]||e[1]!==q[1]||e[2]!==q[2]||e[3]!==q[3]||e[4]!==q[4]||e[5]!==q[5]||e[6]!==q[6]||e[7]!==q[7]||e[8]!==q[8]||e[9]!==q[9]||e[10]!==q[10]||e[11]!==q[11])throw new Error("Missing KTX 2.0 identifier.");const t=new wr,r=17*Uint32Array.BYTES_PER_ELEMENT,s=new Ke(i,q.length,r,!0);t.vkFormat=s._nextUint32(),t.typeSize=s._nextUint32(),t.pixelWidth=s._nextUint32(),t.pixelHeight=s._nextUint32(),t.pixelDepth=s._nextUint32(),t.layerCount=s._nextUint32(),t.faceCount=s._nextUint32();const n=s._nextUint32();t.supercompressionScheme=s._nextUint32();const o=s._nextUint32(),a=s._nextUint32(),c=s._nextUint32(),u=s._nextUint32(),g=s._nextUint64(),p=s._nextUint64(),x=n*3*8,I=new Ke(i,q.length+r,x,!0);for(let X=0;X<n;X++)t.levels.push({levelData:new Uint8Array(i.buffer,i.byteOffset+I._nextUint64(),I._nextUint64()),uncompressedByteLength:I._nextUint64()});const m=new Ke(i,o,a,!0),_={vendorId:m._skip(4)._nextUint16(),descriptorType:m._nextUint16(),versionNumber:m._nextUint16(),descriptorBlockSize:m._nextUint16(),colorModel:m._nextUint8(),colorPrimaries:m._nextUint8(),transferFunction:m._nextUint8(),flags:m._nextUint8(),texelBlockDimension:[m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8()],bytesPlane:[m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8()],samples:[]},M=6,l=4,b=(_.descriptorBlockSize/4-M)/l;for(let X=0;X<b;X++){const ee={bitOffset:m._nextUint16(),bitLength:m._nextUint8(),channelType:m._nextUint8(),samplePosition:[m._nextUint8(),m._nextUint8(),m._nextUint8(),m._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};ee.channelType&_r?(ee.sampleLower=m._nextInt32(),ee.sampleUpper=m._nextInt32()):(ee.sampleLower=m._nextUint32(),ee.sampleUpper=m._nextUint32()),_.samples[X]=ee}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(_);const T=new Ke(i,c,u,!0);for(;T._offset<u;){const X=T._nextUint32(),ee=T._scan(X),pe=rs(ee);if(t.keyValue[pe]=T._nextUint8Array(X-ee.byteLength-1),pe.match(/^ktx/i)){const de=rs(t.keyValue[pe]);t.keyValue[pe]=de.substring(0,de.lastIndexOf("\0"))}const pt=X%4?4-X%4:0;T._skip(pt)}if(p<=0)return t;const y=new Ke(i,g,p,!0),E=y._nextUint16(),N=y._nextUint16(),f=y._nextUint32(),d=y._nextUint32(),R=y._nextUint32(),A=y._nextUint32(),w=[];for(let X=0;X<n;X++)w.push({imageFlags:y._nextUint32(),rgbSliceByteOffset:y._nextUint32(),rgbSliceByteLength:y._nextUint32(),alphaSliceByteOffset:y._nextUint32(),alphaSliceByteLength:y._nextUint32()});const O=g+y._offset,C=O+f,B=C+d,v=B+R,U=new Uint8Array(i.buffer,i.byteOffset+O,f),H=new Uint8Array(i.buffer,i.byteOffset+C,d),Z=new Uint8Array(i.buffer,i.byteOffset+B,R),K=new Uint8Array(i.buffer,i.byteOffset+v,A);return t.globalData={endpointCount:E,selectorCount:N,imageDescs:w,endpointsData:U,selectorsData:H,tablesData:Z,extendedData:K},t}const Ot="EXT_mesh_gpu_instancing",At="EXT_meshopt_compression",Cr="EXT_texture_webp",Or="EXT_texture_avif",Bs="KHR_draco_mesh_compression",Dt="KHR_lights_punctual",vt="KHR_materials_anisotropy",Ft="KHR_materials_clearcoat",Ut="KHR_materials_diffuse_transmission",Bt="KHR_materials_dispersion",Lt="KHR_materials_emissive_strength",jt="KHR_materials_ior",Pt="KHR_materials_iridescence",Vt="KHR_materials_pbrSpecularGlossiness",kt="KHR_materials_sheen",Gt="KHR_materials_specular",Ht="KHR_materials_transmission",zt="KHR_materials_unlit",$t="KHR_materials_volume",Pe="KHR_materials_variants",Dr="KHR_mesh_quantization",vr="KHR_texture_basisu",Xt="KHR_texture_transform",lt="KHR_xmp_json_ld",Nt="INSTANCE_ATTRIBUTE";class Ls extends k{init(){this.extensionName=Ot,this.propertyType="InstancedMesh",this.parentTypes=[h.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new oe})}getAttribute(e){return this.getRefMap("attributes",e)}setAttribute(e,t){return this.setRefMap("attributes",e,t,{usage:Nt})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}Ls.EXTENSION_NAME=Ot;const ye=Ot;class js extends P{constructor(...e){super(...e),this.extensionName=ye,this.provideTypes=[h.NODE],this.prewriteTypes=[h.ACCESSOR]}createInstancedMesh(){return new Ls(this.document.getGraph())}read(e){return(e.jsonDoc.json.nodes||[]).forEach((s,n)=>{if(!s.extensions||!s.extensions[ye])return;const o=s.extensions[ye],a=this.createInstancedMesh();for(const c in o.attributes)a.setAttribute(c,e.accessors[o.attributes[c]]);e.nodes[n].setExtension(ye,a)}),this}prewrite(e){e.accessorUsageGroupedByParent.add(Nt);for(const t of this.properties)for(const r of t.listAttributes())e.addAccessorToUsageGroup(r,Nt);return this}write(e){const t=e.jsonDoc;return this.document.getRoot().listNodes().forEach(r=>{const s=r.getExtension(ye);if(s){const n=e.nodeIndexMap.get(r),o=t.json.nodes[n],a={attributes:{}};s.listSemantics().forEach(c=>{const u=s.getAttribute(c);a.attributes[c]=e.accessorIndexMap.get(u)}),o.extensions=o.extensions||{},o.extensions[ye]=a}}),this}}js.EXTENSION_NAME=ye;function ge(){return ge=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},ge.apply(null,arguments)}var tt;(function(i){i.QUANTIZE="quantize",i.FILTER="filter"})(tt||(tt={}));var Ge;(function(i){i.ATTRIBUTES="ATTRIBUTES",i.TRIANGLES="TRIANGLES",i.INDICES="INDICES"})(Ge||(Ge={}));var G;(function(i){i.NONE="NONE",i.OCTAHEDRAL="OCTAHEDRAL",i.QUATERNION="QUATERNION",i.EXPONENTIAL="EXPONENTIAL"})(G||(G={}));const{BYTE:Fr,SHORT:is,FLOAT:Ur}=S.ComponentType,{encodeNormalizedInt:os,decodeNormalizedInt:St}=L;function Br(i,e,t,r){const{filter:s,bits:n}=r,o={array:i.getArray(),byteStride:i.getElementSize()*i.getComponentSize(),componentType:i.getComponentType(),normalized:i.getNormalized()};if(t!==Ge.ATTRIBUTES)return o;if(s!==G.NONE){let a=i.getNormalized()?Lr(i):new Float32Array(o.array);switch(s){case G.EXPONENTIAL:o.byteStride=i.getElementSize()*4,o.componentType=Ur,o.normalized=!1,o.array=e.encodeFilterExp(a,i.getCount(),o.byteStride,n);break;case G.OCTAHEDRAL:o.byteStride=n>8?8:4,o.componentType=n>8?is:Fr,o.normalized=!0,a=i.getElementSize()===3?Pr(a):a,o.array=e.encodeFilterOct(a,i.getCount(),o.byteStride,n);break;case G.QUATERNION:o.byteStride=8,o.componentType=is,o.normalized=!0,o.array=e.encodeFilterQuat(a,i.getCount(),o.byteStride,n);break;default:throw new Error("Invalid filter.")}o.min=i.getMin([]),o.max=i.getMax([]),i.getNormalized()&&(o.min=o.min.map(c=>St(c,i.getComponentType())),o.max=o.max.map(c=>St(c,i.getComponentType()))),o.normalized&&(o.min=o.min.map(c=>os(c,o.componentType)),o.max=o.max.map(c=>os(c,o.componentType)))}else o.byteStride%4&&(o.array=jr(o.array,i.getElementSize()),o.byteStride=o.array.byteLength/i.getCount());return o}function Lr(i){const e=i.getComponentType(),t=i.getArray(),r=new Float32Array(t.length);for(let s=0;s<t.length;s++)r[s]=St(t[s],e);return r}function jr(i,e){const r=D.padNumber(i.BYTES_PER_ELEMENT*e)/i.BYTES_PER_ELEMENT,s=i.length/e,n=new i.constructor(s*r);for(let o=0;o*e<i.length;o++)for(let a=0;a<e;a++)n[o*r+a]=i[o*e+a];return n}function Pr(i){const e=new Float32Array(i.length*4/3);for(let t=0,r=i.length/3;t<r;t++)e[t*4]=i[t*3],e[t*4+1]=i[t*3+1],e[t*4+2]=i[t*3+2];return e}function Vr(i,e){return e===le.BufferViewUsage.ELEMENT_ARRAY_BUFFER?i.listParents().some(r=>r instanceof Le&&r.getMode()===Le.Mode.TRIANGLES)?Ge.TRIANGLES:Ge.INDICES:Ge.ATTRIBUTES}function kr(i,e){const t=e.getGraph().listParentEdges(i).filter(r=>!(r.getParent()instanceof Os));for(const r of t){const s=r.getName(),n=r.getAttributes().key||"",o=r.getParent().propertyType===h.PRIMITIVE_TARGET;if(s==="indices")return{filter:G.NONE};if(s==="attributes"){if(n==="POSITION")return{filter:G.NONE};if(n==="TEXCOORD_0")return{filter:G.NONE};if(n.startsWith("JOINTS_"))return{filter:G.NONE};if(n.startsWith("WEIGHTS_"))return{filter:G.NONE};if(n==="NORMAL"||n==="TANGENT")return o?{filter:G.NONE}:{filter:G.OCTAHEDRAL,bits:8}}if(s==="output"){const a=Ps(i);return a==="rotation"?{filter:G.QUATERNION,bits:16}:a==="translation"?{filter:G.EXPONENTIAL,bits:12}:a==="scale"?{filter:G.EXPONENTIAL,bits:12}:{filter:G.NONE}}if(s==="input")return{filter:G.NONE};if(s==="inverseBindMatrices")return{filter:G.NONE}}return{filter:G.NONE}}function Ps(i){for(const e of i.listParents())if(e instanceof Xe){for(const t of e.listParents())if(t instanceof Ct)return t.getTargetPath()}return null}function Gr(i){return!i.extensions||!i.extensions[At]?!1:!!i.extensions[At].fallback}const Y=At,as={method:tt.QUANTIZE};class Kt extends P{constructor(...e){super(...e),this.extensionName=Y,this.prereadTypes=[h.BUFFER,h.PRIMITIVE],this.prewriteTypes=[h.BUFFER,h.ACCESSOR],this.readDependencies=["meshopt.decoder"],this.writeDependencies=["meshopt.encoder"],this._decoder=null,this._decoderFallbackBufferMap=new Map,this._encoder=null,this._encoderOptions=as,this._encoderFallbackBuffer=null,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={}}install(e,t){return e==="meshopt.decoder"&&(this._decoder=t),e==="meshopt.encoder"&&(this._encoder=t),this}setEncoderOptions(e){return this._encoderOptions=ge({},as,e),this}preread(e,t){if(!this._decoder){if(!this.isRequired())return this;throw new Error(`[${Y}] Please install extension dependency, "meshopt.decoder".`)}if(!this._decoder.supported){if(!this.isRequired())return this;throw new Error(`[${Y}]: Missing WASM support.`)}return t===h.BUFFER?this._prereadBuffers(e):t===h.PRIMITIVE&&this._prereadPrimitives(e),this}_prereadBuffers(e){const t=e.jsonDoc;(t.json.bufferViews||[]).forEach((s,n)=>{if(!s.extensions||!s.extensions[Y])return;const o=s.extensions[Y],a=o.byteOffset||0,c=o.byteLength||0,u=o.count,g=o.byteStride,p=new Uint8Array(u*g),x=t.json.buffers[o.buffer],I=x.uri?t.resources[x.uri]:t.resources[He],m=D.toView(I,a,c);this._decoder.decodeGltfBuffer(p,u,g,m,o.mode,o.filter),e.bufferViews[n]=p})}_prereadPrimitives(e){const t=e.jsonDoc;(t.json.bufferViews||[]).forEach(s=>{if(!s.extensions||!s.extensions[Y])return;const n=s.extensions[Y],o=e.buffers[n.buffer],a=e.buffers[s.buffer],c=t.json.buffers[s.buffer];Gr(c)&&this._decoderFallbackBufferMap.set(a,o)})}read(e){if(!this.isRequired())return this;for(const[t,r]of this._decoderFallbackBufferMap){for(const s of t.listParents())s instanceof S&&s.swap(t,r);t.dispose()}return this}prewrite(e,t){return t===h.ACCESSOR?this._prewriteAccessors(e):t===h.BUFFER&&this._prewriteBuffers(e),this}_prewriteAccessors(e){const t=e.jsonDoc.json,r=this._encoder,s=this._encoderOptions,n=this.document.getGraph(),o=this.document.createBuffer(),a=this.document.getRoot().listBuffers().indexOf(o);let c=1;const u=new Map,g=p=>{for(const x of n.listParents(p)){if(x.propertyType===h.ROOT)continue;let I=u.get(p);return I===void 0&&u.set(p,I=c++),I}return-1};this._encoderFallbackBuffer=o,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={};for(const p of this.document.getRoot().listAccessors()){if(Ps(p)==="weights"||p.getSparse())continue;const x=e.getAccessorUsage(p),I=e.accessorUsageGroupedByParent.has(x)?g(p):null,m=Vr(p,x),_=s.method===tt.FILTER?kr(p,this.document):{filter:G.NONE},M=Br(p,r,m,_),{array:l,byteStride:b}=M,T=p.getBuffer();if(!T)throw new Error(`${Y}: Missing buffer for accessor.`);const y=this.document.getRoot().listBuffers().indexOf(T),E=[x,I,m,_.filter,b,y].join(":");let N=this._encoderBufferViews[E],f=this._encoderBufferViewData[E],d=this._encoderBufferViewAccessors[E];(!N||!f)&&(d=this._encoderBufferViewAccessors[E]=[],f=this._encoderBufferViewData[E]=[],N=this._encoderBufferViews[E]={buffer:a,target:le.USAGE_TO_TARGET[x],byteOffset:0,byteLength:0,byteStride:x===le.BufferViewUsage.ARRAY_BUFFER?b:void 0,extensions:{[Y]:{buffer:y,byteOffset:0,byteLength:0,mode:m,filter:_.filter!==G.NONE?_.filter:void 0,byteStride:b,count:0}}});const R=e.createAccessorDef(p);R.componentType=M.componentType,R.normalized=M.normalized,R.byteOffset=N.byteLength,R.min&&M.min&&(R.min=M.min),R.max&&M.max&&(R.max=M.max),e.accessorIndexMap.set(p,t.accessors.length),t.accessors.push(R),d.push(R),f.push(new Uint8Array(l.buffer,l.byteOffset,l.byteLength)),N.byteLength+=l.byteLength,N.extensions.EXT_meshopt_compression.count+=p.getCount()}}_prewriteBuffers(e){const t=this._encoder;for(const r in this._encoderBufferViews){const s=this._encoderBufferViews[r],n=this._encoderBufferViewData[r],o=this.document.getRoot().listBuffers()[s.extensions[Y].buffer],a=e.otherBufferViews.get(o)||[],{count:c,byteStride:u,mode:g}=s.extensions[Y],p=D.concat(n),x=t.encodeGltfBuffer(p,c,u,g),I=D.pad(x);s.extensions[Y].byteLength=x.byteLength,n.length=0,n.push(I),a.push(I),e.otherBufferViews.set(o,a)}}write(e){let t=0;for(const o in this._encoderBufferViews){const a=this._encoderBufferViews[o],c=this._encoderBufferViewData[o][0],u=e.otherBufferViewsIndexMap.get(c),g=this._encoderBufferViewAccessors[o];for(const m of g)m.bufferView=u;const p=e.jsonDoc.json.bufferViews[u],x=p.byteOffset||0;Object.assign(p,a),p.byteOffset=t;const I=p.extensions[Y];I.byteOffset=x,t+=D.padNumber(a.byteLength)}const r=this._encoderFallbackBuffer,s=e.bufferIndexMap.get(r),n=e.jsonDoc.json.buffers[s];return n.byteLength=t,n.extensions={[Y]:{fallback:!0}},r.dispose(),this}}Kt.EXTENSION_NAME=Y;Kt.EncoderMethod=tt;const qe=Or;class Hr{match(e){return e.length>=12&&D.decodeText(e.slice(4,12))==="ftypavif"}getSize(e){if(!this.match(e))return null;const t=new DataView(e.buffer,e.byteOffset,e.byteLength);let r=cs(t,0);if(!r)return null;let s=r.end;for(;r=cs(t,s);)if(r.type==="meta")s=r.start+4;else if(r.type==="iprp"||r.type==="ipco")s=r.start;else{if(r.type==="ispe")return[t.getUint32(r.start+4),t.getUint32(r.start+8)];if(r.type==="mdat")break;s=r.end}return null}getChannels(e){return 4}}class Vs extends P{constructor(...e){super(...e),this.extensionName=qe,this.prereadTypes=[h.TEXTURE]}static register(){fe.registerFormat("image/avif",new Hr)}preread(e){return(e.jsonDoc.json.textures||[]).forEach(r=>{r.extensions&&r.extensions[qe]&&(r.source=r.extensions[qe].source)}),this}read(e){return this}write(e){const t=e.jsonDoc;return this.document.getRoot().listTextures().forEach(r=>{if(r.getMimeType()==="image/avif"){const s=e.imageIndexMap.get(r);(t.json.textures||[]).forEach(o=>{o.source===s&&(o.extensions=o.extensions||{},o.extensions[qe]={source:o.source},delete o.source)})}}),this}}Vs.EXTENSION_NAME=qe;function cs(i,e){if(i.byteLength<4+e)return null;const t=i.getUint32(e);return i.byteLength<t+e||t<8?null:{type:D.decodeText(new Uint8Array(i.buffer,i.byteOffset+e+4,4)),start:e+8,end:e+t}}const Ye=Cr;class zr{match(e){return e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80}getSize(e){const t=D.decodeText(e.slice(0,4)),r=D.decodeText(e.slice(8,12));if(t!=="RIFF"||r!=="WEBP")return null;const s=new DataView(e.buffer,e.byteOffset);let n=12;for(;n<s.byteLength;){const o=D.decodeText(new Uint8Array([s.getUint8(n),s.getUint8(n+1),s.getUint8(n+2),s.getUint8(n+3)])),a=s.getUint32(n+4,!0);if(o==="VP8 "){const c=s.getInt16(n+14,!0)&16383,u=s.getInt16(n+16,!0)&16383;return[c,u]}else if(o==="VP8L"){const c=s.getUint8(n+9),u=s.getUint8(n+10),g=s.getUint8(n+11),p=s.getUint8(n+12),x=1+((u&63)<<8|c),I=1+((p&15)<<10|g<<2|(u&192)>>6);return[x,I]}n+=8+a+a%2}return null}getChannels(e){return 4}}class ks extends P{constructor(...e){super(...e),this.extensionName=Ye,this.prereadTypes=[h.TEXTURE]}static register(){fe.registerFormat("image/webp",new zr)}preread(e){return(e.jsonDoc.json.textures||[]).forEach(r=>{r.extensions&&r.extensions[Ye]&&(r.source=r.extensions[Ye].source)}),this}read(e){return this}write(e){const t=e.jsonDoc;return this.document.getRoot().listTextures().forEach(r=>{if(r.getMimeType()==="image/webp"){const s=e.imageIndexMap.get(r);(t.json.textures||[]).forEach(o=>{o.source===s&&(o.extensions=o.extensions||{},o.extensions[Ye]={source:o.source},delete o.source)})}}),this}}ks.EXTENSION_NAME=Ye;const us=Bs;let $,Gs,Hs;function $r(i,e){const t=new $.DecoderBuffer;try{if(t.Init(e,e.length),i.GetEncodedGeometryType(t)!==$.TRIANGULAR_MESH)throw new Error(`[${us}] Unknown geometry type.`);const s=new $.Mesh;if(!i.DecodeBufferToMesh(t,s).ok()||s.ptr===0)throw new Error(`[${us}] Decoding failure.`);return s}finally{$.destroy(t)}}function Xr(i,e){const r=e.num_faces()*3;let s,n;if(e.num_points()<=65534){const o=r*Uint16Array.BYTES_PER_ELEMENT;s=$._malloc(o),i.GetTrianglesUInt16Array(e,o,s),n=new Uint16Array($.HEAPU16.buffer,s,r).slice()}else{const o=r*Uint32Array.BYTES_PER_ELEMENT;s=$._malloc(o),i.GetTrianglesUInt32Array(e,o,s),n=new Uint32Array($.HEAPU32.buffer,s,r).slice()}return $._free(s),n}function Kr(i,e,t,r){const s=Hs[r.componentType],n=Gs[r.componentType],o=t.num_components(),c=e.num_points()*o,u=c*n.BYTES_PER_ELEMENT,g=$._malloc(u);i.GetAttributeDataArrayForAllPoints(e,t,s,u,g);const p=new n($.HEAPF32.buffer,g,c).slice();return $._free(g),p}function qr(i){$=i,Gs={[S.ComponentType.FLOAT]:Float32Array,[S.ComponentType.UNSIGNED_INT]:Uint32Array,[S.ComponentType.UNSIGNED_SHORT]:Uint16Array,[S.ComponentType.UNSIGNED_BYTE]:Uint8Array,[S.ComponentType.SHORT]:Int16Array,[S.ComponentType.BYTE]:Int8Array},Hs={[S.ComponentType.FLOAT]:$.DT_FLOAT32,[S.ComponentType.UNSIGNED_INT]:$.DT_UINT32,[S.ComponentType.UNSIGNED_SHORT]:$.DT_UINT16,[S.ComponentType.UNSIGNED_BYTE]:$.DT_UINT8,[S.ComponentType.SHORT]:$.DT_INT16,[S.ComponentType.BYTE]:$.DT_INT8}}let se;var st;(function(i){i[i.EDGEBREAKER=1]="EDGEBREAKER",i[i.SEQUENTIAL=0]="SEQUENTIAL"})(st||(st={}));var ne;(function(i){i.POSITION="POSITION",i.NORMAL="NORMAL",i.COLOR="COLOR",i.TEX_COORD="TEX_COORD",i.GENERIC="GENERIC"})(ne||(ne={}));const zs={[ne.POSITION]:14,[ne.NORMAL]:10,[ne.COLOR]:8,[ne.TEX_COORD]:12,[ne.GENERIC]:12},fs={decodeSpeed:5,encodeSpeed:5,method:st.EDGEBREAKER,quantizationBits:zs,quantizationVolume:"mesh"};function Yr(i){se=i}function Wr(i,e=fs){const t=ge({},fs,e);t.quantizationBits=ge({},zs,e.quantizationBits);const r=new se.MeshBuilder,s=new se.Mesh,n=new se.ExpertEncoder(s),o={},a=new se.DracoInt8Array,c=i.listTargets().length>0;let u=!1;for(const _ of i.listSemantics()){const M=i.getAttribute(_);if(M.getSparse()){u=!0;continue}const l=Jr(_),b=Qr(r,M.getComponentType(),s,se[l],M.getCount(),M.getElementSize(),M.getArray());if(b===-1)throw new Error(`Error compressing "${_}" attribute.`);if(o[_]=b,t.quantizationVolume==="mesh"||_!=="POSITION")n.SetAttributeQuantization(b,t.quantizationBits[l]);else if(typeof t.quantizationVolume=="object"){const{quantizationVolume:T}=t,y=Math.max(T.max[0]-T.min[0],T.max[1]-T.min[1],T.max[2]-T.min[2]);n.SetAttributeExplicitQuantization(b,t.quantizationBits[l],M.getElementSize(),T.min,y)}else throw new Error("Invalid quantization volume state.")}const g=i.getIndices();if(!g)throw new Mt("Primitive must have indices.");r.AddFacesToMesh(s,g.getCount()/3,g.getArray()),n.SetSpeedOptions(t.encodeSpeed,t.decodeSpeed),n.SetTrackEncodedProperties(!0),t.method===st.SEQUENTIAL||c||u?n.SetEncodingMethod(se.MESH_SEQUENTIAL_ENCODING):n.SetEncodingMethod(se.MESH_EDGEBREAKER_ENCODING);const p=n.EncodeToDracoBuffer(!(c||u),a);if(p<=0)throw new Mt("Error applying Draco compression.");const x=new Uint8Array(p);for(let _=0;_<p;++_)x[_]=a.GetValue(_);const I=n.GetNumberOfEncodedPoints(),m=n.GetNumberOfEncodedFaces()*3;return se.destroy(a),se.destroy(s),se.destroy(r),se.destroy(n),{numVertices:I,numIndices:m,data:x,attributeIDs:o}}function Jr(i){return i==="POSITION"?ne.POSITION:i==="NORMAL"?ne.NORMAL:i.startsWith("COLOR_")?ne.COLOR:i.startsWith("TEXCOORD_")?ne.TEX_COORD:ne.GENERIC}function Qr(i,e,t,r,s,n,o){switch(e){case S.ComponentType.UNSIGNED_BYTE:return i.AddUInt8Attribute(t,r,s,n,o);case S.ComponentType.BYTE:return i.AddInt8Attribute(t,r,s,n,o);case S.ComponentType.UNSIGNED_SHORT:return i.AddUInt16Attribute(t,r,s,n,o);case S.ComponentType.SHORT:return i.AddInt16Attribute(t,r,s,n,o);case S.ComponentType.UNSIGNED_INT:return i.AddUInt32Attribute(t,r,s,n,o);case S.ComponentType.FLOAT:return i.AddFloatAttribute(t,r,s,n,o);default:throw new Error(`Unexpected component type, "${e}".`)}}class Mt extends Error{}const z=Bs;class qt extends P{constructor(...e){super(...e),this.extensionName=z,this.prereadTypes=[h.PRIMITIVE],this.prewriteTypes=[h.ACCESSOR],this.readDependencies=["draco3d.decoder"],this.writeDependencies=["draco3d.encoder"],this._decoderModule=null,this._encoderModule=null,this._encoderOptions={}}install(e,t){return e==="draco3d.decoder"&&(this._decoderModule=t,qr(this._decoderModule)),e==="draco3d.encoder"&&(this._encoderModule=t,Yr(this._encoderModule)),this}setEncoderOptions(e){return this._encoderOptions=e,this}preread(e){if(!this._decoderModule)throw new Error(`[${z}] Please install extension dependency, "draco3d.decoder".`);const t=this.document.getLogger(),r=e.jsonDoc,s=new Map;try{const n=r.json.meshes||[];for(const o of n)for(const a of o.primitives){if(!a.extensions||!a.extensions[z])continue;const c=a.extensions[z];let[u,g]=s.get(c.bufferView)||[];if(!g||!u){const p=r.json.bufferViews[c.bufferView],x=r.json.buffers[p.buffer],I=x.uri?r.resources[x.uri]:r.resources[He],m=p.byteOffset||0,_=p.byteLength,M=D.toView(I,m,_);u=new this._decoderModule.Decoder,g=$r(u,M),s.set(c.bufferView,[u,g]),t.debug(`[${z}] Decompressed ${M.byteLength} bytes.`)}for(const p in a.attributes){const x=e.jsonDoc.json.accessors[a.attributes[p]],I=u.GetAttributeByUniqueId(g,c.attributes[p]),m=Kr(u,g,I,x);e.accessors[a.attributes[p]].setArray(m)}a.indices!==void 0&&e.accessors[a.indices].setArray(Xr(u,g))}}finally{for(const[n,o]of Array.from(s.values()))this._decoderModule.destroy(n),this._decoderModule.destroy(o)}return this}read(e){return this}prewrite(e,t){if(!this._encoderModule)throw new Error(`[${z}] Please install extension dependency, "draco3d.encoder".`);const r=this.document.getLogger();r.debug(`[${z}] Compression options: ${JSON.stringify(this._encoderOptions)}`);const s=Zr(this.document),n=new Map;let o="mesh";this._encoderOptions.quantizationVolume==="scene"&&(this.document.getRoot().listScenes().length!==1?r.warn(`[${z}]: quantizationVolume=scene requires exactly 1 scene.`):o=Bn(this.document.getRoot().listScenes().pop()));for(const a of Array.from(s.keys())){const c=s.get(a);if(!c)throw new Error("Unexpected primitive.");if(n.has(c)){n.set(c,n.get(c));continue}const u=a.getIndices(),g=e.jsonDoc.json.accessors;let p;try{p=Wr(a,ge({},this._encoderOptions,{quantizationVolume:o}))}catch(m){if(m instanceof Mt){r.warn(`[${z}]: ${m.message} Skipping primitive compression.`);continue}throw m}n.set(c,p);const x=e.createAccessorDef(u);x.count=p.numIndices,e.accessorIndexMap.set(u,g.length),g.push(x),p.numVertices>65534&&x.componentType!==S.ComponentType.UNSIGNED_INT&&(x.componentType=S.ComponentType.UNSIGNED_INT);for(const m of a.listSemantics()){const _=a.getAttribute(m);if(p.attributeIDs[m]===void 0)continue;const M=e.createAccessorDef(_);M.count=p.numVertices,e.accessorIndexMap.set(_,g.length),g.push(M)}const I=a.getAttribute("POSITION").getBuffer()||this.document.getRoot().listBuffers()[0];e.otherBufferViews.has(I)||e.otherBufferViews.set(I,[]),e.otherBufferViews.get(I).push(p.data)}return r.debug(`[${z}] Compressed ${s.size} primitives.`),e.extensionData[z]={primitiveHashMap:s,primitiveEncodingMap:n},this}write(e){const t=e.extensionData[z];for(const r of this.document.getRoot().listMeshes()){const s=e.jsonDoc.json.meshes[e.meshIndexMap.get(r)];for(let n=0;n<r.listPrimitives().length;n++){const o=r.listPrimitives()[n],a=s.primitives[n],c=t.primitiveHashMap.get(o);if(!c)continue;const u=t.primitiveEncodingMap.get(c);u&&(a.extensions=a.extensions||{},a.extensions[z]={bufferView:e.otherBufferViewsIndexMap.get(u.data),attributes:u.attributeIDs})}}if(!t.primitiveHashMap.size){const r=e.jsonDoc.json;r.extensionsUsed=(r.extensionsUsed||[]).filter(s=>s!==z),r.extensionsRequired=(r.extensionsRequired||[]).filter(s=>s!==z)}return this}}qt.EXTENSION_NAME=z;qt.EncoderMethod=st;function Zr(i){const e=i.getLogger(),t=new Set,r=new Set;let s=0,n=0;for(const p of i.getRoot().listMeshes())for(const x of p.listPrimitives())x.getIndices()?x.getMode()!==Le.Mode.TRIANGLES?(r.add(x),n++):t.add(x):(r.add(x),s++);s>0&&e.warn(`[${z}] Skipping Draco compression of ${s} non-indexed primitives.`),n>0&&e.warn(`[${z}] Skipping Draco compression of ${n} non-TRIANGLES primitives.`);const o=i.getRoot().listAccessors(),a=new Map;for(let p=0;p<o.length;p++)a.set(o[p],p);const c=new Map,u=new Set,g=new Map;for(const p of Array.from(t)){let x=ls(p,a);if(u.has(x)){g.set(p,x);continue}if(c.has(p.getIndices())){const I=p.getIndices(),m=I.clone();a.set(m,i.getRoot().listAccessors().length-1),p.swap(I,m)}for(const I of p.listAttributes())if(c.has(I)){const m=I.clone();a.set(m,i.getRoot().listAccessors().length-1),p.swap(I,m)}x=ls(p,a),u.add(x),g.set(p,x),c.set(p.getIndices(),x);for(const I of p.listAttributes())c.set(I,x)}for(const p of Array.from(c.keys())){const x=new Set(p.listParents().map(I=>I.propertyType));if(x.size!==2||!x.has(h.PRIMITIVE)||!x.has(h.ROOT))throw new Error(`[${z}] Compressed accessors must only be used as indices or vertex attributes.`)}for(const p of Array.from(t)){const x=g.get(p),I=p.getIndices();if(c.get(I)!==x||p.listAttributes().some(m=>c.get(m)!==x))throw new Error(`[${z}] Draco primitives must share all, or no, accessors.`)}for(const p of Array.from(r)){const x=p.getIndices();if(c.has(x)||p.listAttributes().some(I=>c.has(I)))throw new Error(`[${z}] Accessor cannot be shared by compressed and uncompressed primitives.`)}return g}function ls(i,e){const t=[],r=i.getIndices();t.push(e.get(r));for(const s of i.listAttributes())t.push(e.get(s));return t.sort().join("|")}class $e extends k{init(){this.extensionName=Dt,this.propertyType="Light",this.parentTypes=[h.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{color:[1,1,1],intensity:1,type:$e.Type.POINT,range:null,innerConeAngle:0,outerConeAngle:Math.PI/4})}getColor(){return this.get("color")}setColor(e){return this.set("color",e)}getIntensity(){return this.get("intensity")}setIntensity(e){return this.set("intensity",e)}getType(){return this.get("type")}setType(e){return this.set("type",e)}getRange(){return this.get("range")}setRange(e){return this.set("range",e)}getInnerConeAngle(){return this.get("innerConeAngle")}setInnerConeAngle(e){return this.set("innerConeAngle",e)}getOuterConeAngle(){return this.get("outerConeAngle")}setOuterConeAngle(e){return this.set("outerConeAngle",e)}}$e.EXTENSION_NAME=Dt;$e.Type={POINT:"point",SPOT:"spot",DIRECTIONAL:"directional"};const ae=Dt;class $s extends P{constructor(...e){super(...e),this.extensionName=ae}createLight(e=""){return new $e(this.document.getGraph(),e)}read(e){const t=e.jsonDoc;if(!t.json.extensions||!t.json.extensions[ae])return this;const n=(t.json.extensions[ae].lights||[]).map(o=>{var a,c;const u=this.createLight().setName(o.name||"").setType(o.type);return o.color!==void 0&&u.setColor(o.color),o.intensity!==void 0&&u.setIntensity(o.intensity),o.range!==void 0&&u.setRange(o.range),((a=o.spot)==null?void 0:a.innerConeAngle)!==void 0&&u.setInnerConeAngle(o.spot.innerConeAngle),((c=o.spot)==null?void 0:c.outerConeAngle)!==void 0&&u.setOuterConeAngle(o.spot.outerConeAngle),u});return t.json.nodes.forEach((o,a)=>{if(!o.extensions||!o.extensions[ae])return;const c=o.extensions[ae];e.nodes[a].setExtension(ae,n[c.light])}),this}write(e){const t=e.jsonDoc;if(this.properties.size===0)return this;const r=[],s=new Map;for(const n of this.properties){const o=n,a={type:o.getType()};L.eq(o.getColor(),[1,1,1])||(a.color=o.getColor()),o.getIntensity()!==1&&(a.intensity=o.getIntensity()),o.getRange()!=null&&(a.range=o.getRange()),o.getName()&&(a.name=o.getName()),o.getType()===$e.Type.SPOT&&(a.spot={innerConeAngle:o.getInnerConeAngle(),outerConeAngle:o.getOuterConeAngle()}),r.push(a),s.set(o,r.length-1)}return this.document.getRoot().listNodes().forEach(n=>{const o=n.getExtension(ae);if(o){const a=e.nodeIndexMap.get(n),c=t.json.nodes[a];c.extensions=c.extensions||{},c.extensions[ae]={light:s.get(o)}}}),t.json.extensions=t.json.extensions||{},t.json.extensions[ae]={lights:r},this}}$s.EXTENSION_NAME=ae;const{R:ei,G:ti,B:si}=ie;class Xs extends k{init(){this.extensionName=vt,this.propertyType="Anisotropy",this.parentTypes=[h.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{anisotropyStrength:0,anisotropyRotation:0,anisotropyTexture:null,anisotropyTextureInfo:new j(this.graph,"anisotropyTextureInfo")})}getAnisotropyStrength(){return this.get("anisotropyStrength")}setAnisotropyStrength(e){return this.set("anisotropyStrength",e)}getAnisotropyRotation(){return this.get("anisotropyRotation")}setAnisotropyRotation(e){return this.set("anisotropyRotation",e)}getAnisotropyTexture(){return this.getRef("anisotropyTexture")}getAnisotropyTextureInfo(){return this.getRef("anisotropyTexture")?this.getRef("anisotropyTextureInfo"):null}setAnisotropyTexture(e){return this.setRef("anisotropyTexture",e,{channels:ei|ti|si})}}Xs.EXTENSION_NAME=vt;const Re=vt;class Ks extends P{constructor(...e){super(...e),this.extensionName=Re,this.prereadTypes=[h.MESH],this.prewriteTypes=[h.MESH]}createAnisotropy(){return new Xs(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],s=t.json.textures||[];return r.forEach((n,o)=>{if(n.extensions&&n.extensions[Re]){const a=this.createAnisotropy();e.materials[o].setExtension(Re,a);const c=n.extensions[Re];if(c.anisotropyStrength!==void 0&&a.setAnisotropyStrength(c.anisotropyStrength),c.anisotropyRotation!==void 0&&a.setAnisotropyRotation(c.anisotropyRotation),c.anisotropyTexture!==void 0){const u=c.anisotropyTexture,g=e.textures[s[u.index].source];a.setAnisotropyTexture(g),e.setTextureInfo(a.getAnisotropyTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const s=r.getExtension(Re);if(s){const n=e.materialIndexMap.get(r),o=t.json.materials[n];o.extensions=o.extensions||{};const a=o.extensions[Re]={};if(s.getAnisotropyStrength()>0&&(a.anisotropyStrength=s.getAnisotropyStrength()),s.getAnisotropyRotation()!==0&&(a.anisotropyRotation=s.getAnisotropyRotation()),s.getAnisotropyTexture()){const c=s.getAnisotropyTexture(),u=s.getAnisotropyTextureInfo();a.anisotropyTexture=e.createTextureInfoDef(c,u)}}}),this}}Ks.EXTENSION_NAME=Re;const{R:hs,G:gs,B:ni}=ie;class qs extends k{init(){this.extensionName=Ft,this.propertyType="Clearcoat",this.parentTypes=[h.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{clearcoatFactor:0,clearcoatTexture:null,clearcoatTextureInfo:new j(this.graph,"clearcoatTextureInfo"),clearcoatRoughnessFactor:0,clearcoatRoughnessTexture:null,clearcoatRoughnessTextureInfo:new j(this.graph,"clearcoatRoughnessTextureInfo"),clearcoatNormalScale:1,clearcoatNormalTexture:null,clearcoatNormalTextureInfo:new j(this.graph,"clearcoatNormalTextureInfo")})}getClearcoatFactor(){return this.get("clearcoatFactor")}setClearcoatFactor(e){return this.set("clearcoatFactor",e)}getClearcoatTexture(){return this.getRef("clearcoatTexture")}getClearcoatTextureInfo(){return this.getRef("clearcoatTexture")?this.getRef("clearcoatTextureInfo"):null}setClearcoatTexture(e){return this.setRef("clearcoatTexture",e,{channels:hs})}getClearcoatRoughnessFactor(){return this.get("clearcoatRoughnessFactor")}setClearcoatRoughnessFactor(e){return this.set("clearcoatRoughnessFactor",e)}getClearcoatRoughnessTexture(){return this.getRef("clearcoatRoughnessTexture")}getClearcoatRoughnessTextureInfo(){return this.getRef("clearcoatRoughnessTexture")?this.getRef("clearcoatRoughnessTextureInfo"):null}setClearcoatRoughnessTexture(e){return this.setRef("clearcoatRoughnessTexture",e,{channels:gs})}getClearcoatNormalScale(){return this.get("clearcoatNormalScale")}setClearcoatNormalScale(e){return this.set("clearcoatNormalScale",e)}getClearcoatNormalTexture(){return this.getRef("clearcoatNormalTexture")}getClearcoatNormalTextureInfo(){return this.getRef("clearcoatNormalTexture")?this.getRef("clearcoatNormalTextureInfo"):null}setClearcoatNormalTexture(e){return this.setRef("clearcoatNormalTexture",e,{channels:hs|gs|ni})}}qs.EXTENSION_NAME=Ft;const Ie=Ft;class Ys extends P{constructor(...e){super(...e),this.extensionName=Ie,this.prereadTypes=[h.MESH],this.prewriteTypes=[h.MESH]}createClearcoat(){return new qs(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],s=t.json.textures||[];return r.forEach((n,o)=>{if(n.extensions&&n.extensions[Ie]){const a=this.createClearcoat();e.materials[o].setExtension(Ie,a);const c=n.extensions[Ie];if(c.clearcoatFactor!==void 0&&a.setClearcoatFactor(c.clearcoatFactor),c.clearcoatRoughnessFactor!==void 0&&a.setClearcoatRoughnessFactor(c.clearcoatRoughnessFactor),c.clearcoatTexture!==void 0){const u=c.clearcoatTexture,g=e.textures[s[u.index].source];a.setClearcoatTexture(g),e.setTextureInfo(a.getClearcoatTextureInfo(),u)}if(c.clearcoatRoughnessTexture!==void 0){const u=c.clearcoatRoughnessTexture,g=e.textures[s[u.index].source];a.setClearcoatRoughnessTexture(g),e.setTextureInfo(a.getClearcoatRoughnessTextureInfo(),u)}if(c.clearcoatNormalTexture!==void 0){const u=c.clearcoatNormalTexture,g=e.textures[s[u.index].source];a.setClearcoatNormalTexture(g),e.setTextureInfo(a.getClearcoatNormalTextureInfo(),u),u.scale!==void 0&&a.setClearcoatNormalScale(u.scale)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const s=r.getExtension(Ie);if(s){const n=e.materialIndexMap.get(r),o=t.json.materials[n];o.extensions=o.extensions||{};const a=o.extensions[Ie]={clearcoatFactor:s.getClearcoatFactor(),clearcoatRoughnessFactor:s.getClearcoatRoughnessFactor()};if(s.getClearcoatTexture()){const c=s.getClearcoatTexture(),u=s.getClearcoatTextureInfo();a.clearcoatTexture=e.createTextureInfoDef(c,u)}if(s.getClearcoatRoughnessTexture()){const c=s.getClearcoatRoughnessTexture(),u=s.getClearcoatRoughnessTextureInfo();a.clearcoatRoughnessTexture=e.createTextureInfoDef(c,u)}if(s.getClearcoatNormalTexture()){const c=s.getClearcoatNormalTexture(),u=s.getClearcoatNormalTextureInfo();a.clearcoatNormalTexture=e.createTextureInfoDef(c,u),s.getClearcoatNormalScale()!==1&&(a.clearcoatNormalTexture.scale=s.getClearcoatNormalScale())}}}),this}}Ys.EXTENSION_NAME=Ie;const{R:ri,G:ii,B:oi,A:ai}=ie;class Ws extends k{init(){this.extensionName=Ut,this.propertyType="DiffuseTransmission",this.parentTypes=[h.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseTransmissionFactor:0,diffuseTransmissionTexture:null,diffuseTransmissionTextureInfo:new j(this.graph,"diffuseTransmissionTextureInfo"),diffuseTransmissionColorFactor:[1,1,1],diffuseTransmissionColorTexture:null,diffuseTransmissionColorTextureInfo:new j(this.graph,"diffuseTransmissionColorTextureInfo")})}getDiffuseTransmissionFactor(){return this.get("diffuseTransmissionFactor")}setDiffuseTransmissionFactor(e){return this.set("diffuseTransmissionFactor",e)}getDiffuseTransmissionTexture(){return this.getRef("diffuseTransmissionTexture")}getDiffuseTransmissionTextureInfo(){return this.getRef("diffuseTransmissionTexture")?this.getRef("diffuseTransmissionTextureInfo"):null}setDiffuseTransmissionTexture(e){return this.setRef("diffuseTransmissionTexture",e,{channels:ai})}getDiffuseTransmissionColorFactor(){return this.get("diffuseTransmissionColorFactor")}setDiffuseTransmissionColorFactor(e){return this.set("diffuseTransmissionColorFactor",e)}getDiffuseTransmissionColorTexture(){return this.getRef("diffuseTransmissionColorTexture")}getDiffuseTransmissionColorTextureInfo(){return this.getRef("diffuseTransmissionColorTexture")?this.getRef("diffuseTransmissionColorTextureInfo"):null}setDiffuseTransmissionColorTexture(e){return this.setRef("diffuseTransmissionColorTexture",e,{channels:ri|ii|oi})}}Ws.EXTENSION_NAME=Ut;const Ae=Ut;class Js extends P{constructor(...e){super(...e),this.extensionName=Ae}createDiffuseTransmission(){return new Ws(this.document.getGraph())}read(e){const t=e.jsonDoc,r=t.json.materials||[],s=t.json.textures||[];return r.forEach((n,o)=>{if(n.extensions&&n.extensions[Ae]){const a=this.createDiffuseTransmission();e.materials[o].setExtension(Ae,a);const c=n.extensions[Ae];if(c.diffuseTransmissionFactor!==void 0&&a.setDiffuseTransmissionFactor(c.diffuseTransmissionFactor),c.diffuseTransmissionColorFactor!==void 0&&a.setDiffuseTransmissionColorFactor(c.diffuseTransmissionColorFactor),c.diffuseTransmissionTexture!==void 0){const u=c.diffuseTransmissionTexture,g=e.textures[s[u.index].source];a.setDiffuseTransmissionTexture(g),e.setTextureInfo(a.getDiffuseTransmissionTextureInfo(),u)}if(c.diffuseTransmissionColorTexture!==void 0){const u=c.diffuseTransmissionColorTexture,g=e.textures[s[u.index].source];a.setDiffuseTransmissionColorTexture(g),e.setTextureInfo(a.getDiffuseTransmissionColorTextureInfo(),u)}}}),this}write(e){const t=e.jsonDoc;for(const r of this.document.getRoot().listMaterials()){const s=r.getExtension(Ae);if(!s)continue;const n=e.materialIndexMap.get(r),o=t.json.materials[n];o.extensions=o.extensions||{};const a=o.extensions[Ae]={diffuseTransmissionFactor:s.getDiffuseTransmissionFactor(),diffuseTransmissionColorFactor:s.getDiffuseTransmissionColorFactor()};if(s.getDiffuseTransmissionTexture()){const c=s.getDiffuseTransmissionTexture(),u=s.getDiffuseTransmissionTextureInfo();a.diffuseTransmissionTexture=e.createTextureInfoDef(c,u)}if(s.getDiffuseTransmissionColorTexture()){const c=s.getDiffuseTransmissionColorTexture(),u=s.getDiffuseTransmissionColorTextureInfo();a.diffuseTransmissionColorTexture=e.createTextureInfoDef(c,u)}}return this}}Js.EXTENSION_NAME=Ae;class Qs extends k{init(){this.extensionName=Bt,this.propertyType="Dispersion",this.parentTypes=[h.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{dispersion:0})}getDispersion(){return this.get("dispersion")}setDispersion(e){return this.set("dispersion",e)}}Qs.EXTENSION_NAME=Bt;const Ne=Bt;class Zs extends P{constructor(...e){super(...e),this.extensionName=Ne,this.prereadTypes=[h.MESH],this.prewriteTypes=[h.MESH]}createDispersion(){return new Qs(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){return(e.jsonDoc.json.materials||[]).forEach((s,n)=>{if(s.extensions&&s.extensions[Ne]){const o=this.createDispersion();e.materials[n].setExtension(Ne,o);const a=s.extensions[Ne];a.dispersion!==void 0&&o.setDispersion(a.dispersion)}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const s=r.getExtension(Ne);if(s){const n=e.materialIndexMap.get(r),o=t.json.materials[n];o.extensions=o.extensions||{},o.extensions[Ne]={dispersion:s.getDispersion()}}}),this}}Zs.EXTENSION_NAME=Ne;class en extends k{init(){this.extensionName=Lt,this.propertyType="EmissiveStrength",this.parentTypes=[h.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{emissiveStrength:1})}getEmissiveStrength(){return this.get("emissiveStrength")}setEmissiveStrength(e){return this.set("emissiveStrength",e)}}en.EXTENSION_NAME=Lt;const Se=Lt;class tn extends P{constructor(...e){super(...e),this.extensionName=Se,this.prereadTypes=[h.MESH],this.prewriteTypes=[h.MESH]}createEmissiveStrength(){return new en(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){return(e.jsonDoc.json.materials||[]).forEach((s,n)=>{if(s.extensions&&s.extensions[Se]){const o=this.createEmissiveStrength();e.materials[n].setExtension(Se,o);const a=s.extensions[Se];a.emissiveStrength!==void 0&&o.setEmissiveStrength(a.emissiveStrength)}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const s=r.getExtension(Se);if(s){const n=e.materialIndexMap.get(r),o=t.json.materials[n];o.extensions=o.extensions||{},o.extensions[Se]={emissiveStrength:s.getEmissiveStrength()}}}),this}}tn.EXTENSION_NAME=Se;class sn extends k{init(){this.extensionName=jt,this.propertyType="IOR",this.parentTypes=[h.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{ior:1.5})}getIOR(){return this.get("ior")}setIOR(e){return this.set("ior",e)}}sn.EXTENSION_NAME=jt;const Me=jt;class nn extends P{constructor(...e){super(...e),this.extensionName=Me,this.prereadTypes=[h.MESH],this.prewriteTypes=[h.MESH]}createIOR(){return new sn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){return(e.jsonDoc.json.materials||[]).forEach((s,n)=>{if(s.extensions&&s.extensions[Me]){const o=this.createIOR();e.materials[n].setExtension(Me,o);const a=s.extensions[Me];a.ior!==void 0&&o.setIOR(a.ior)}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const s=r.getExtension(Me);if(s){const n=e.materialIndexMap.get(r),o=t.json.materials[n];o.extensions=o.extensions||{},o.extensions[Me]={ior:s.getIOR()}}}),this}}nn.EXTENSION_NAME=Me;const{R:ci,G:ui}=ie;class rn extends k{init(){this.extensionName=Pt,this.propertyType="Iridescence",this.parentTypes=[h.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{iridescenceFactor:0,iridescenceTexture:null,iridescenceTextureInfo:new j(this.graph,"iridescenceTextureInfo"),iridescenceIOR:1.3,iridescenceThicknessMinimum:100,iridescenceThicknessMaximum:400,iridescenceThicknessTexture:null,iridescenceThicknessTextureInfo:new j(this.graph,"iridescenceThicknessTextureInfo")})}getIridescenceFactor(){return this.get("iridescenceFactor")}setIridescenceFactor(e){return this.set("iridescenceFactor",e)}getIridescenceTexture(){return this.getRef("iridescenceTexture")}getIridescenceTextureInfo(){return this.getRef("iridescenceTexture")?this.getRef("iridescenceTextureInfo"):null}setIridescenceTexture(e){return this.setRef("iridescenceTexture",e,{channels:ci})}getIridescenceIOR(){return this.get("iridescenceIOR")}setIridescenceIOR(e){return this.set("iridescenceIOR",e)}getIridescenceThicknessMinimum(){return this.get("iridescenceThicknessMinimum")}setIridescenceThicknessMinimum(e){return this.set("iridescenceThicknessMinimum",e)}getIridescenceThicknessMaximum(){return this.get("iridescenceThicknessMaximum")}setIridescenceThicknessMaximum(e){return this.set("iridescenceThicknessMaximum",e)}getIridescenceThicknessTexture(){return this.getRef("iridescenceThicknessTexture")}getIridescenceThicknessTextureInfo(){return this.getRef("iridescenceThicknessTexture")?this.getRef("iridescenceThicknessTextureInfo"):null}setIridescenceThicknessTexture(e){return this.setRef("iridescenceThicknessTexture",e,{channels:ui})}}rn.EXTENSION_NAME=Pt;const _e=Pt;class on extends P{constructor(...e){super(...e),this.extensionName=_e,this.prereadTypes=[h.MESH],this.prewriteTypes=[h.MESH]}createIridescence(){return new rn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],s=t.json.textures||[];return r.forEach((n,o)=>{if(n.extensions&&n.extensions[_e]){const a=this.createIridescence();e.materials[o].setExtension(_e,a);const c=n.extensions[_e];if(c.iridescenceFactor!==void 0&&a.setIridescenceFactor(c.iridescenceFactor),c.iridescenceIor!==void 0&&a.setIridescenceIOR(c.iridescenceIor),c.iridescenceThicknessMinimum!==void 0&&a.setIridescenceThicknessMinimum(c.iridescenceThicknessMinimum),c.iridescenceThicknessMaximum!==void 0&&a.setIridescenceThicknessMaximum(c.iridescenceThicknessMaximum),c.iridescenceTexture!==void 0){const u=c.iridescenceTexture,g=e.textures[s[u.index].source];a.setIridescenceTexture(g),e.setTextureInfo(a.getIridescenceTextureInfo(),u)}if(c.iridescenceThicknessTexture!==void 0){const u=c.iridescenceThicknessTexture,g=e.textures[s[u.index].source];a.setIridescenceThicknessTexture(g),e.setTextureInfo(a.getIridescenceThicknessTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const s=r.getExtension(_e);if(s){const n=e.materialIndexMap.get(r),o=t.json.materials[n];o.extensions=o.extensions||{};const a=o.extensions[_e]={};if(s.getIridescenceFactor()>0&&(a.iridescenceFactor=s.getIridescenceFactor()),s.getIridescenceIOR()!==1.3&&(a.iridescenceIor=s.getIridescenceIOR()),s.getIridescenceThicknessMinimum()!==100&&(a.iridescenceThicknessMinimum=s.getIridescenceThicknessMinimum()),s.getIridescenceThicknessMaximum()!==400&&(a.iridescenceThicknessMaximum=s.getIridescenceThicknessMaximum()),s.getIridescenceTexture()){const c=s.getIridescenceTexture(),u=s.getIridescenceTextureInfo();a.iridescenceTexture=e.createTextureInfoDef(c,u)}if(s.getIridescenceThicknessTexture()){const c=s.getIridescenceThicknessTexture(),u=s.getIridescenceThicknessTextureInfo();a.iridescenceThicknessTexture=e.createTextureInfoDef(c,u)}}}),this}}on.EXTENSION_NAME=_e;const{R:ps,G:ds,B:Ts,A:xs}=ie;class an extends k{init(){this.extensionName=Vt,this.propertyType="PBRSpecularGlossiness",this.parentTypes=[h.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseFactor:[1,1,1,1],diffuseTexture:null,diffuseTextureInfo:new j(this.graph,"diffuseTextureInfo"),specularFactor:[1,1,1],glossinessFactor:1,specularGlossinessTexture:null,specularGlossinessTextureInfo:new j(this.graph,"specularGlossinessTextureInfo")})}getDiffuseFactor(){return this.get("diffuseFactor")}setDiffuseFactor(e){return this.set("diffuseFactor",e)}getDiffuseTexture(){return this.getRef("diffuseTexture")}getDiffuseTextureInfo(){return this.getRef("diffuseTexture")?this.getRef("diffuseTextureInfo"):null}setDiffuseTexture(e){return this.setRef("diffuseTexture",e,{channels:ps|ds|Ts|xs,isColor:!0})}getSpecularFactor(){return this.get("specularFactor")}setSpecularFactor(e){return this.set("specularFactor",e)}getGlossinessFactor(){return this.get("glossinessFactor")}setGlossinessFactor(e){return this.set("glossinessFactor",e)}getSpecularGlossinessTexture(){return this.getRef("specularGlossinessTexture")}getSpecularGlossinessTextureInfo(){return this.getRef("specularGlossinessTexture")?this.getRef("specularGlossinessTextureInfo"):null}setSpecularGlossinessTexture(e){return this.setRef("specularGlossinessTexture",e,{channels:ps|ds|Ts|xs})}}an.EXTENSION_NAME=Vt;const be=Vt;class cn extends P{constructor(...e){super(...e),this.extensionName=be,this.prereadTypes=[h.MESH],this.prewriteTypes=[h.MESH]}createPBRSpecularGlossiness(){return new an(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],s=t.json.textures||[];return r.forEach((n,o)=>{if(n.extensions&&n.extensions[be]){const a=this.createPBRSpecularGlossiness();e.materials[o].setExtension(be,a);const c=n.extensions[be];if(c.diffuseFactor!==void 0&&a.setDiffuseFactor(c.diffuseFactor),c.specularFactor!==void 0&&a.setSpecularFactor(c.specularFactor),c.glossinessFactor!==void 0&&a.setGlossinessFactor(c.glossinessFactor),c.diffuseTexture!==void 0){const u=c.diffuseTexture,g=e.textures[s[u.index].source];a.setDiffuseTexture(g),e.setTextureInfo(a.getDiffuseTextureInfo(),u)}if(c.specularGlossinessTexture!==void 0){const u=c.specularGlossinessTexture,g=e.textures[s[u.index].source];a.setSpecularGlossinessTexture(g),e.setTextureInfo(a.getSpecularGlossinessTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const s=r.getExtension(be);if(s){const n=e.materialIndexMap.get(r),o=t.json.materials[n];o.extensions=o.extensions||{};const a=o.extensions[be]={diffuseFactor:s.getDiffuseFactor(),specularFactor:s.getSpecularFactor(),glossinessFactor:s.getGlossinessFactor()};if(s.getDiffuseTexture()){const c=s.getDiffuseTexture(),u=s.getDiffuseTextureInfo();a.diffuseTexture=e.createTextureInfoDef(c,u)}if(s.getSpecularGlossinessTexture()){const c=s.getSpecularGlossinessTexture(),u=s.getSpecularGlossinessTextureInfo();a.specularGlossinessTexture=e.createTextureInfoDef(c,u)}}}),this}}cn.EXTENSION_NAME=be;const{R:fi,G:li,B:hi,A:gi}=ie;class un extends k{init(){this.extensionName=kt,this.propertyType="Sheen",this.parentTypes=[h.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{sheenColorFactor:[0,0,0],sheenColorTexture:null,sheenColorTextureInfo:new j(this.graph,"sheenColorTextureInfo"),sheenRoughnessFactor:0,sheenRoughnessTexture:null,sheenRoughnessTextureInfo:new j(this.graph,"sheenRoughnessTextureInfo")})}getSheenColorFactor(){return this.get("sheenColorFactor")}setSheenColorFactor(e){return this.set("sheenColorFactor",e)}getSheenColorTexture(){return this.getRef("sheenColorTexture")}getSheenColorTextureInfo(){return this.getRef("sheenColorTexture")?this.getRef("sheenColorTextureInfo"):null}setSheenColorTexture(e){return this.setRef("sheenColorTexture",e,{channels:fi|li|hi,isColor:!0})}getSheenRoughnessFactor(){return this.get("sheenRoughnessFactor")}setSheenRoughnessFactor(e){return this.set("sheenRoughnessFactor",e)}getSheenRoughnessTexture(){return this.getRef("sheenRoughnessTexture")}getSheenRoughnessTextureInfo(){return this.getRef("sheenRoughnessTexture")?this.getRef("sheenRoughnessTextureInfo"):null}setSheenRoughnessTexture(e){return this.setRef("sheenRoughnessTexture",e,{channels:gi})}}un.EXTENSION_NAME=kt;const we=kt;class fn extends P{constructor(...e){super(...e),this.extensionName=we,this.prereadTypes=[h.MESH],this.prewriteTypes=[h.MESH]}createSheen(){return new un(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],s=t.json.textures||[];return r.forEach((n,o)=>{if(n.extensions&&n.extensions[we]){const a=this.createSheen();e.materials[o].setExtension(we,a);const c=n.extensions[we];if(c.sheenColorFactor!==void 0&&a.setSheenColorFactor(c.sheenColorFactor),c.sheenRoughnessFactor!==void 0&&a.setSheenRoughnessFactor(c.sheenRoughnessFactor),c.sheenColorTexture!==void 0){const u=c.sheenColorTexture,g=e.textures[s[u.index].source];a.setSheenColorTexture(g),e.setTextureInfo(a.getSheenColorTextureInfo(),u)}if(c.sheenRoughnessTexture!==void 0){const u=c.sheenRoughnessTexture,g=e.textures[s[u.index].source];a.setSheenRoughnessTexture(g),e.setTextureInfo(a.getSheenRoughnessTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const s=r.getExtension(we);if(s){const n=e.materialIndexMap.get(r),o=t.json.materials[n];o.extensions=o.extensions||{};const a=o.extensions[we]={sheenColorFactor:s.getSheenColorFactor(),sheenRoughnessFactor:s.getSheenRoughnessFactor()};if(s.getSheenColorTexture()){const c=s.getSheenColorTexture(),u=s.getSheenColorTextureInfo();a.sheenColorTexture=e.createTextureInfoDef(c,u)}if(s.getSheenRoughnessTexture()){const c=s.getSheenRoughnessTexture(),u=s.getSheenRoughnessTextureInfo();a.sheenRoughnessTexture=e.createTextureInfoDef(c,u)}}}),this}}fn.EXTENSION_NAME=we;const{R:pi,G:di,B:Ti,A:xi}=ie;class ln extends k{init(){this.extensionName=Gt,this.propertyType="Specular",this.parentTypes=[h.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{specularFactor:1,specularTexture:null,specularTextureInfo:new j(this.graph,"specularTextureInfo"),specularColorFactor:[1,1,1],specularColorTexture:null,specularColorTextureInfo:new j(this.graph,"specularColorTextureInfo")})}getSpecularFactor(){return this.get("specularFactor")}setSpecularFactor(e){return this.set("specularFactor",e)}getSpecularColorFactor(){return this.get("specularColorFactor")}setSpecularColorFactor(e){return this.set("specularColorFactor",e)}getSpecularTexture(){return this.getRef("specularTexture")}getSpecularTextureInfo(){return this.getRef("specularTexture")?this.getRef("specularTextureInfo"):null}setSpecularTexture(e){return this.setRef("specularTexture",e,{channels:xi})}getSpecularColorTexture(){return this.getRef("specularColorTexture")}getSpecularColorTextureInfo(){return this.getRef("specularColorTexture")?this.getRef("specularColorTextureInfo"):null}setSpecularColorTexture(e){return this.setRef("specularColorTexture",e,{channels:pi|di|Ti,isColor:!0})}}ln.EXTENSION_NAME=Gt;const Ce=Gt;class hn extends P{constructor(...e){super(...e),this.extensionName=Ce,this.prereadTypes=[h.MESH],this.prewriteTypes=[h.MESH]}createSpecular(){return new ln(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],s=t.json.textures||[];return r.forEach((n,o)=>{if(n.extensions&&n.extensions[Ce]){const a=this.createSpecular();e.materials[o].setExtension(Ce,a);const c=n.extensions[Ce];if(c.specularFactor!==void 0&&a.setSpecularFactor(c.specularFactor),c.specularColorFactor!==void 0&&a.setSpecularColorFactor(c.specularColorFactor),c.specularTexture!==void 0){const u=c.specularTexture,g=e.textures[s[u.index].source];a.setSpecularTexture(g),e.setTextureInfo(a.getSpecularTextureInfo(),u)}if(c.specularColorTexture!==void 0){const u=c.specularColorTexture,g=e.textures[s[u.index].source];a.setSpecularColorTexture(g),e.setTextureInfo(a.getSpecularColorTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const s=r.getExtension(Ce);if(s){const n=e.materialIndexMap.get(r),o=t.json.materials[n];o.extensions=o.extensions||{};const a=o.extensions[Ce]={};if(s.getSpecularFactor()!==1&&(a.specularFactor=s.getSpecularFactor()),L.eq(s.getSpecularColorFactor(),[1,1,1])||(a.specularColorFactor=s.getSpecularColorFactor()),s.getSpecularTexture()){const c=s.getSpecularTexture(),u=s.getSpecularTextureInfo();a.specularTexture=e.createTextureInfoDef(c,u)}if(s.getSpecularColorTexture()){const c=s.getSpecularColorTexture(),u=s.getSpecularColorTextureInfo();a.specularColorTexture=e.createTextureInfoDef(c,u)}}}),this}}hn.EXTENSION_NAME=Ce;const{R:mi}=ie;class gn extends k{init(){this.extensionName=Ht,this.propertyType="Transmission",this.parentTypes=[h.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{transmissionFactor:0,transmissionTexture:null,transmissionTextureInfo:new j(this.graph,"transmissionTextureInfo")})}getTransmissionFactor(){return this.get("transmissionFactor")}setTransmissionFactor(e){return this.set("transmissionFactor",e)}getTransmissionTexture(){return this.getRef("transmissionTexture")}getTransmissionTextureInfo(){return this.getRef("transmissionTexture")?this.getRef("transmissionTextureInfo"):null}setTransmissionTexture(e){return this.setRef("transmissionTexture",e,{channels:mi})}}gn.EXTENSION_NAME=Ht;const Oe=Ht;class pn extends P{constructor(...e){super(...e),this.extensionName=Oe,this.prereadTypes=[h.MESH],this.prewriteTypes=[h.MESH]}createTransmission(){return new gn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],s=t.json.textures||[];return r.forEach((n,o)=>{if(n.extensions&&n.extensions[Oe]){const a=this.createTransmission();e.materials[o].setExtension(Oe,a);const c=n.extensions[Oe];if(c.transmissionFactor!==void 0&&a.setTransmissionFactor(c.transmissionFactor),c.transmissionTexture!==void 0){const u=c.transmissionTexture,g=e.textures[s[u.index].source];a.setTransmissionTexture(g),e.setTextureInfo(a.getTransmissionTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const s=r.getExtension(Oe);if(s){const n=e.materialIndexMap.get(r),o=t.json.materials[n];o.extensions=o.extensions||{};const a=o.extensions[Oe]={transmissionFactor:s.getTransmissionFactor()};if(s.getTransmissionTexture()){const c=s.getTransmissionTexture(),u=s.getTransmissionTextureInfo();a.transmissionTexture=e.createTextureInfoDef(c,u)}}}),this}}pn.EXTENSION_NAME=Oe;class dn extends k{init(){this.extensionName=zt,this.propertyType="Unlit",this.parentTypes=[h.MATERIAL]}}dn.EXTENSION_NAME=zt;const Ve=zt;class Tn extends P{constructor(...e){super(...e),this.extensionName=Ve,this.prereadTypes=[h.MESH],this.prewriteTypes=[h.MESH]}createUnlit(){return new dn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){return(e.jsonDoc.json.materials||[]).forEach((r,s)=>{r.extensions&&r.extensions[Ve]&&e.materials[s].setExtension(Ve,this.createUnlit())}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{if(r.getExtension(Ve)){const s=e.materialIndexMap.get(r),n=t.json.materials[s];n.extensions=n.extensions||{},n.extensions[Ve]={}}}),this}}Tn.EXTENSION_NAME=Ve;class xn extends k{init(){this.extensionName=Pe,this.propertyType="Mapping",this.parentTypes=["MappingList"]}getDefaults(){return Object.assign(super.getDefaults(),{material:null,variants:new V})}getMaterial(){return this.getRef("material")}setMaterial(e){return this.setRef("material",e)}addVariant(e){return this.addRef("variants",e)}removeVariant(e){return this.removeRef("variants",e)}listVariants(){return this.listRefs("variants")}}xn.EXTENSION_NAME=Pe;class mn extends k{init(){this.extensionName=Pe,this.propertyType="MappingList",this.parentTypes=[h.PRIMITIVE]}getDefaults(){return Object.assign(super.getDefaults(),{mappings:new V})}addMapping(e){return this.addRef("mappings",e)}removeMapping(e){return this.removeRef("mappings",e)}listMappings(){return this.listRefs("mappings")}}mn.EXTENSION_NAME=Pe;class _t extends k{init(){this.extensionName=Pe,this.propertyType="Variant",this.parentTypes=["MappingList"]}}_t.EXTENSION_NAME=Pe;const ce=Pe;class En extends P{constructor(...e){super(...e),this.extensionName=ce}createMappingList(){return new mn(this.document.getGraph())}createVariant(e=""){return new _t(this.document.getGraph(),e)}createMapping(){return new xn(this.document.getGraph())}listVariants(){return Array.from(this.properties).filter(e=>e instanceof _t)}read(e){const t=e.jsonDoc;if(!t.json.extensions||!t.json.extensions[ce])return this;const n=(t.json.extensions[ce].variants||[]).map(a=>this.createVariant().setName(a.name||""));return(t.json.meshes||[]).forEach((a,c)=>{const u=e.meshes[c];(a.primitives||[]).forEach((p,x)=>{if(!p.extensions||!p.extensions[ce])return;const I=this.createMappingList(),m=p.extensions[ce];for(const _ of m.mappings){const M=this.createMapping();_.material!==void 0&&M.setMaterial(e.materials[_.material]);for(const l of _.variants||[])M.addVariant(n[l]);I.addMapping(M)}u.listPrimitives()[x].setExtension(ce,I)})}),this}write(e){const t=e.jsonDoc,r=this.listVariants();if(!r.length)return this;const s=[],n=new Map;for(const o of r)n.set(o,s.length),s.push(e.createPropertyDef(o));for(const o of this.document.getRoot().listMeshes()){const a=e.meshIndexMap.get(o);o.listPrimitives().forEach((c,u)=>{const g=c.getExtension(ce);if(!g)return;const p=e.jsonDoc.json.meshes[a].primitives[u],x=g.listMappings().map(I=>{const m=e.createPropertyDef(I),_=I.getMaterial();return _&&(m.material=e.materialIndexMap.get(_)),m.variants=I.listVariants().map(M=>n.get(M)),m});p.extensions=p.extensions||{},p.extensions[ce]={mappings:x}})}return t.json.extensions=t.json.extensions||{},t.json.extensions[ce]={variants:s},this}}En.EXTENSION_NAME=ce;const{G:Ei}=ie;class yn extends k{init(){this.extensionName=$t,this.propertyType="Volume",this.parentTypes=[h.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{thicknessFactor:0,thicknessTexture:null,thicknessTextureInfo:new j(this.graph,"thicknessTexture"),attenuationDistance:1/0,attenuationColor:[1,1,1]})}getThicknessFactor(){return this.get("thicknessFactor")}setThicknessFactor(e){return this.set("thicknessFactor",e)}getThicknessTexture(){return this.getRef("thicknessTexture")}getThicknessTextureInfo(){return this.getRef("thicknessTexture")?this.getRef("thicknessTextureInfo"):null}setThicknessTexture(e){return this.setRef("thicknessTexture",e,{channels:Ei})}getAttenuationDistance(){return this.get("attenuationDistance")}setAttenuationDistance(e){return this.set("attenuationDistance",e)}getAttenuationColor(){return this.get("attenuationColor")}setAttenuationColor(e){return this.set("attenuationColor",e)}}yn.EXTENSION_NAME=$t;const De=$t;class Rn extends P{constructor(...e){super(...e),this.extensionName=De,this.prereadTypes=[h.MESH],this.prewriteTypes=[h.MESH]}createVolume(){return new yn(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],s=t.json.textures||[];return r.forEach((n,o)=>{if(n.extensions&&n.extensions[De]){const a=this.createVolume();e.materials[o].setExtension(De,a);const c=n.extensions[De];if(c.thicknessFactor!==void 0&&a.setThicknessFactor(c.thicknessFactor),c.attenuationDistance!==void 0&&a.setAttenuationDistance(c.attenuationDistance),c.attenuationColor!==void 0&&a.setAttenuationColor(c.attenuationColor),c.thicknessTexture!==void 0){const u=c.thicknessTexture,g=e.textures[s[u.index].source];a.setThicknessTexture(g),e.setTextureInfo(a.getThicknessTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const s=r.getExtension(De);if(s){const n=e.materialIndexMap.get(r),o=t.json.materials[n];o.extensions=o.extensions||{};const a=o.extensions[De]={};if(s.getThicknessFactor()>0&&(a.thicknessFactor=s.getThicknessFactor()),Number.isFinite(s.getAttenuationDistance())&&(a.attenuationDistance=s.getAttenuationDistance()),L.eq(s.getAttenuationColor(),[1,1,1])||(a.attenuationColor=s.getAttenuationColor()),s.getThicknessTexture()){const c=s.getThicknessTexture(),u=s.getThicknessTextureInfo();a.thicknessTexture=e.createTextureInfoDef(c,u)}}}),this}}Rn.EXTENSION_NAME=De;const In=Dr;class An extends P{constructor(...e){super(...e),this.extensionName=In}read(e){return this}write(e){return this}}An.EXTENSION_NAME=In;const We=vr;class yi{match(e){return e[0]===171&&e[1]===75&&e[2]===84&&e[3]===88&&e[4]===32&&e[5]===50&&e[6]===48&&e[7]===187&&e[8]===13&&e[9]===10&&e[10]===26&&e[11]===10}getSize(e){const t=xt(e);return[t.pixelWidth,t.pixelHeight]}getChannels(e){const r=xt(e).dataFormatDescriptor[0];if(r.colorModel===Ir)return r.samples.length===2&&(r.samples[1].channelType&15)===15?4:3;if(r.colorModel===Ar)return(r.samples[0].channelType&15)===3?4:3;throw new Error(`Unexpected KTX2 colorModel, "${r.colorModel}".`)}getVRAMByteLength(e){const t=xt(e),r=this.getChannels(e)>3;let s=0;for(let n=0;n<t.levels.length;n++){const o=t.levels[n];if(o.uncompressedByteLength)s+=o.uncompressedByteLength;else{const a=Math.max(1,Math.floor(t.pixelWidth/Math.pow(2,n))),c=Math.max(1,Math.floor(t.pixelHeight/Math.pow(2,n))),u=r?16:8;s+=a/4*(c/4)*u}}return s}}class Nn extends P{constructor(...e){super(...e),this.extensionName=We,this.prereadTypes=[h.TEXTURE]}static register(){fe.registerFormat("image/ktx2",new yi)}preread(e){return e.jsonDoc.json.textures.forEach(t=>{if(t.extensions&&t.extensions[We]){const r=t.extensions[We];t.source=r.source}}),this}read(e){return this}write(e){const t=e.jsonDoc;return this.document.getRoot().listTextures().forEach(r=>{if(r.getMimeType()==="image/ktx2"){const s=e.imageIndexMap.get(r);t.json.textures.forEach(n=>{n.source===s&&(n.extensions=n.extensions||{},n.extensions[We]={source:n.source},delete n.source)})}}),this}}Nn.EXTENSION_NAME=We;class Sn extends k{init(){this.extensionName=Xt,this.propertyType="Transform",this.parentTypes=[h.TEXTURE_INFO]}getDefaults(){return Object.assign(super.getDefaults(),{offset:[0,0],rotation:0,scale:[1,1],texCoord:null})}getOffset(){return this.get("offset")}setOffset(e){return this.set("offset",e)}getRotation(){return this.get("rotation")}setRotation(e){return this.set("rotation",e)}getScale(){return this.get("scale")}setScale(e){return this.set("scale",e)}getTexCoord(){return this.get("texCoord")}setTexCoord(e){return this.set("texCoord",e)}}Sn.EXTENSION_NAME=Xt;const ve=Xt;class Mn extends P{constructor(...e){super(...e),this.extensionName=ve}createTransform(){return new Sn(this.document.getGraph())}read(e){for(const[t,r]of Array.from(e.textureInfos.entries())){if(!r.extensions||!r.extensions[ve])continue;const s=this.createTransform(),n=r.extensions[ve];n.offset!==void 0&&s.setOffset(n.offset),n.rotation!==void 0&&s.setRotation(n.rotation),n.scale!==void 0&&s.setScale(n.scale),n.texCoord!==void 0&&s.setTexCoord(n.texCoord),t.setExtension(ve,s)}return this}write(e){const t=Array.from(e.textureInfoDefMap.entries());for(const[r,s]of t){const n=r.getExtension(ve);if(!n)continue;s.extensions=s.extensions||{};const o={},a=L.eq;a(n.getOffset(),[0,0])||(o.offset=n.getOffset()),n.getRotation()!==0&&(o.rotation=n.getRotation()),a(n.getScale(),[1,1])||(o.scale=n.getScale()),n.getTexCoord()!=null&&(o.texCoord=n.getTexCoord()),s.extensions[ve]=o}return this}}Mn.EXTENSION_NAME=ve;const Ri=[h.ROOT,h.SCENE,h.NODE,h.MESH,h.MATERIAL,h.TEXTURE,h.ANIMATION];class _n extends k{init(){this.extensionName=lt,this.propertyType="Packet",this.parentTypes=Ri}getDefaults(){return Object.assign(super.getDefaults(),{context:{},properties:{}})}getContext(){return this.get("context")}setContext(e){return this.set("context",ge({},e))}listProperties(){return Object.keys(this.get("properties"))}getProperty(e){const t=this.get("properties");return e in t?t[e]:null}setProperty(e,t){this._assertContext(e);const r=ge({},this.get("properties"));return t?r[e]=t:delete r[e],this.set("properties",r)}toJSONLD(){const e=mt(this.get("context")),t=mt(this.get("properties"));return ge({"@context":e},t)}fromJSONLD(e){e=mt(e);const t=e["@context"];return t&&this.set("context",t),delete e["@context"],this.set("properties",e)}_assertContext(e){if(!(e.split(":")[0]in this.get("context")))throw new Error(`${lt}: Missing context for term, "${e}".`)}}_n.EXTENSION_NAME=lt;function mt(i){return JSON.parse(JSON.stringify(i))}const he=lt;class bn extends P{constructor(...e){super(...e),this.extensionName=he}createPacket(){return new _n(this.document.getGraph())}listPackets(){return Array.from(this.properties)}read(e){var t;const r=(t=e.jsonDoc.json.extensions)==null?void 0:t[he];if(!r||!r.packets)return this;const s=e.jsonDoc.json,n=this.document.getRoot(),o=r.packets.map(u=>this.createPacket().fromJSONLD(u)),a=[[s.asset],s.scenes,s.nodes,s.meshes,s.materials,s.images,s.animations],c=[[n],n.listScenes(),n.listNodes(),n.listMeshes(),n.listMaterials(),n.listTextures(),n.listAnimations()];for(let u=0;u<a.length;u++){const g=a[u]||[];for(let p=0;p<g.length;p++){const x=g[p];if(x.extensions&&x.extensions[he]){const I=x.extensions[he];c[u][p].setExtension(he,o[I.packet])}}}return this}write(e){const{json:t}=e.jsonDoc,r=[];for(const s of this.properties){r.push(s.toJSONLD());for(const n of s.listParents()){let o;switch(n.propertyType){case h.ROOT:o=t.asset;break;case h.SCENE:o=t.scenes[e.sceneIndexMap.get(n)];break;case h.NODE:o=t.nodes[e.nodeIndexMap.get(n)];break;case h.MESH:o=t.meshes[e.meshIndexMap.get(n)];break;case h.MATERIAL:o=t.materials[e.materialIndexMap.get(n)];break;case h.TEXTURE:o=t.images[e.imageIndexMap.get(n)];break;case h.ANIMATION:o=t.animations[e.animationIndexMap.get(n)];break;default:o=null,this.document.getLogger().warn(`[${he}]: Unsupported parent property, "${n.propertyType}"`);break}o&&(o.extensions=o.extensions||{},o.extensions[he]={packet:r.length-1})}}return r.length>0&&(t.extensions=t.extensions||{},t.extensions[he]={packets:r}),this}}bn.EXTENSION_NAME=he;const Ii=[qt,$s,Ks,Ys,Js,Zs,tn,nn,on,cn,hn,fn,pn,Tn,En,Rn,An,Nn,Mn,bn],Ai=[js,Kt,Vs,ks,...Ii],wn=new Tr;let ms=!1;async function Ni(){ms||(await Yt.ready,await Wt.ready,wn.registerExtensions([...Ai,vs,Us]).registerDependencies({"meshopt.decoder":Yt,"meshopt.encoder":Wt}),ms=!0)}const bi=Object.freeze(Object.defineProperty({__proto__:null,initGlTFIO:Ni,io:wn},Symbol.toStringTag,{value:"Module"}));export{S as A,D as B,_i as C,Ze as D,Kt as E,me as F,vs as G,An as K,L as M,_s as N,Le as P,Os as R,bs as S,Cs as T,h as a,Ct as b,j as c,k as d,Be as e,er as f,Nn as g,Us as h,wn as i,bi as j,Wn as u};
@@ -0,0 +1 @@
1
+ import{A as l,a as C,b}from"./AnimationClipAsset-9167378a.js";import"./index-aec7e708.js";import"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";import"./AssetViewer-64cd01fa.js";import"./assetEditorActions-c4e5962f.js";import"./encode-ac4bb64e.js";import"./meshopt_simplifier.module-cd99529d.js";import"./module-8816772d.js";import"./module-ffeaf99f.js";export{l as AnimationClipAsset,C as AnimationClipInspector,b as AnimationClipViewer};
@@ -0,0 +1 @@
1
+ import{aC as e,aD as m,aE as i,aF as l}from"./index-aec7e708.js";function c(t){const{label:r,info:o,value:s,displayType:a="text"}=t;return e.jsxs(m,{...i(t),children:[a==="text"&&e.jsx(l,{size:"sm",selectable:!0,code:!0,children:s}),a==="image"&&e.jsx("img",{src:s,alt:r})]})}export{c as F};
@@ -0,0 +1 @@
1
+ var f=Object.defineProperty;var m=(r,e,t)=>e in r?f(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var o=(r,e,t)=>(m(r,typeof e!="symbol"?e+"":e,t),t);import{a as s,E as S,b as u}from"./ShaderUIScriptAsset-fc503291.js";import{t as P}from"./ShaderUIScriptAsset-fc503291.js";import{q as g,a$ as h}from"./index-aec7e708.js";import"./index-e8a45e82.js";var l=Object.defineProperty,M=Object.getOwnPropertyDescriptor,b=(r,e,t,p)=>{for(var a=p>1?void 0:p?M(e,t):e,i=r.length-1,c;i>=0;i--)(c=r[i])&&(a=(p?c(e,t,a):c(a))||a);return p&&a&&l(e,t,a),a};class n extends s{constructor(){super(...arguments);o(this,"subType",S.StateMachine)}getMetaConfig(){let t=s.getRegisteredAssetMeta(s);return t={...t,defaultName:"StateMachineScript.ts",dragLayer:g.StateMachineScript},t}}b([h()],n.prototype,"subType",2);s.registerScriptConstruct(S.ShaderUI,u);s.registerScriptConstruct(S.StateMachine,n);export{S as EScriptSubType,s as ScriptAsset,u as ShaderUIScriptAsset,n as StateMachineScript,P as scriptTemplates};
@@ -0,0 +1 @@
1
+ var Se=Object.defineProperty;var Te=(n,e,t)=>e in n?Se(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var u=(n,e,t)=>(Te(n,typeof e!="symbol"?e+"":e,t),t);import{aQ as L,aR as N,aS as p,dN as K,e9 as $,aU as B,bN as Q,q as J,et as xe,bP as Ae,bl as Re,cy as j,E as O,eB as we,eC as Me,eD as Ie,p as y,C as R,s as b,e as A,eu as z,f as Pe,eE as f,eF as _,eG as te,aO as Le,c9 as de,t as ue,ca as he,eH as Ee,aL as se,eI as je,x as ze,eJ as Oe,eK as S,eL as P,ef as q,eM as X,ay as fe,K as Be,bE as Fe,cK as De,cL as Ue,cN as qe,cM as ke,cJ as Ve,cO as Ne}from"./index-aec7e708.js";import"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";import{c as W}from"./Component-ed7aa0ab.js";import{F as We}from"./FormItemArray-6d69acd4.js";import{S as $e}from"./SpriteBaseComponent-3edafa31.js";import{T as He}from"./TextBaseComponent-ce1402c3.js";import{T as I}from"./TransformBaseComponent-713d57e9.js";import{S as Ge}from"./Callout-ba7e2adf.js";import"./Accordion-3d330bc6.js";import"./IconEdit-ab77303f.js";const Ke=L(({item:n,onPropsChange:e})=>{const{t}=N(),i=n.props;return p.jsxs(p.Fragment,{children:[p.jsx(K,{label:t("ui.transition.color.normal.label"),value:i.normal,onChange:a=>{e(r=>{r.normal=a})}}),p.jsx(K,{label:t("ui.transition.color.hover.label"),value:i.hover,onChange:a=>{e(r=>{r.hover=a})}}),p.jsx(K,{label:t("ui.transition.color.pressed.label"),value:i.pressed,onChange:a=>{e(r=>{r.pressed=a})}}),p.jsx(K,{label:t("ui.transition.color.disabled.label"),value:i.disabled,onChange:a=>{e(r=>{r.disabled=a})}})]})});function Qe(n,e){const t=n.props;e.normal.copyFrom(t.normal),e.hover.copyFrom(t.hover),e.pressed.copyFrom(t.pressed),e.disabled.copyFrom(t.disabled)}const Je=L(({item:n,onPropsChange:e})=>{const{t}=N(),i=n.props;return p.jsxs(p.Fragment,{children:[p.jsx($,{label:t("ui.transition.scale.normal.label"),value:i.normal,min:.5,max:2,step:.05,onChange:a=>{e(r=>{r.normal=a})}}),p.jsx($,{label:t("ui.transition.scale.hover.label"),value:i.hover,min:.5,max:2,step:.05,onChange:a=>{e(r=>{r.hover=a})}}),p.jsx($,{label:t("ui.transition.scale.pressed.label"),value:i.pressed,min:.5,max:2,step:.05,onChange:a=>{e(r=>{r.pressed=a})}}),p.jsx($,{label:t("ui.transition.scale.disabled.label"),value:i.disabled,min:.5,max:2,step:.05,onChange:a=>{e(r=>{r.disabled=a})}})]})});function Xe(n,e){const t=n.props;e.normal=t.normal,e.hover=t.hover,e.pressed=t.pressed,e.disabled=t.disabled}const re=new WeakMap;function Ye(n){const e=(re.get(n)??0)+1;return re.set(n,e),e}function ae(n,e){return re.get(n)===e}function Y(n,e,t,i,a){if(!i){if(!ae(e,t))return;a(null);return}n.getAssetByRef(i).then(r=>{ae(e,t)&&a((r==null?void 0:r.engineObject)??null)}).catch(r=>{ae(e,t)&&(console.warn("[SpriteTransitionOption] syncSpriteTransition failed:",r),a(null))})}function Ze(n,e,t){const{normal:i,hover:a,pressed:r,disabled:o}=e.props,l=Ye(t);Y(n.assetStore,t,l,i,c=>{t.normal=c}),Y(n.assetStore,t,l,a,c=>{t.hover=c}),Y(n.assetStore,t,l,r,c=>{t.pressed=c}),Y(n.assetStore,t,l,o,c=>{t.disabled=c})}function Z(n,e,t){if(!e)return t(null),()=>{};let i=!1;return n.getAssetByRef(e).then(a=>{i||t(a??null)}).catch(()=>{i||t(null)}),()=>{i=!0}}const et=L(({item:n,model:e,onPropsChange:t})=>{const[i,a]=B.useState(null),[r,o]=B.useState(null),[l,c]=B.useState(null),[g,m]=B.useState(null),{normal:s,hover:d,pressed:h,disabled:T}=n.props,{assetStore:C}=e.root,G=Object.values(C.assets).filter(v=>v.getMetaConfig().type==="sprite");return B.useEffect(()=>Z(C,s,a),[C,s]),B.useEffect(()=>Z(C,d,o),[C,d]),B.useEffect(()=>Z(C,h,c),[C,h]),B.useEffect(()=>Z(C,T,m),[C,T]),p.jsxs(p.Fragment,{children:[p.jsx(Q,{label:"Normal Sprite",dropLayer:J.Sprite,asset:i,value:i==null?void 0:i.name,assets:G,onSelect:v=>{t(U=>{U.normal=(v==null?void 0:v.getCurrentRef())??null})},onDelete:()=>{t(v=>{v.normal=null})},onLocate:()=>{s!=null&&s.refId&&C.selectAsset(s.refId)}}),p.jsx(Q,{label:"Hover Sprite",dropLayer:J.Sprite,asset:r,value:r==null?void 0:r.name,assets:G,onSelect:v=>{t(U=>{U.hover=(v==null?void 0:v.getCurrentRef())??null})},onDelete:()=>{t(v=>{v.hover=null})},onLocate:()=>{d!=null&&d.refId&&C.selectAsset(d.refId)}}),p.jsx(Q,{label:"Pressed Sprite",dropLayer:J.Sprite,asset:l,value:l==null?void 0:l.name,assets:G,onSelect:v=>{t(U=>{U.pressed=(v==null?void 0:v.getCurrentRef())??null})},onDelete:()=>{t(v=>{v.pressed=null})},onLocate:()=>{h!=null&&h.refId&&C.selectAsset(h.refId)}}),p.jsx(Q,{label:"Disabled Sprite",dropLayer:J.Sprite,asset:g,value:g==null?void 0:g.name,assets:G,onSelect:v=>{t(U=>{U.disabled=(v==null?void 0:v.getCurrentRef())??null})},onDelete:()=>{t(v=>{v.disabled=null})},onLocate:()=>{T!=null&&T.refId&&C.selectAsset(T.refId)}})]})});function tt(n,e,t){Ze(n,e,t)}function nt(n,e,t){if(!t)return null;const i=n.entities.get(t);if(!i)return null;for(let a=0,r=e.length;a<r;a++){const o=i.getComponentByTypeName(e[a]);if(o)return{ownerId:t,componentId:o.id}}return null}function it(n,e){n.selectEntity((e==null?void 0:e.ownerId)??null)}function at(n,e){const t=(e==null?void 0:e.ownerId)??null;return{entityId:t,entity:t?n.entities.get(t)??null:null}}const ye=L(n=>{const{inspectorConfig:{property:e,label:t,disabled:i,info:a,componentTypes:r},model:o,onModelChange:l}=n,c=o.root.sceneStore,g=c.rootEntity.children,m=c.entities,{entityId:s,entity:d}=at(c,o[e]??null),{t:h}=N();function T(C){l==null||l(e,nt(c,r,C))}return p.jsx(xe,{info:a,entities:g,entityMap:Ae(m),label:t,value:s,disabled:i,displayValue:d==null?void 0:d.name,placeholder:h("Select component..."),onSelect:T,onLocate:()=>{it(c,o[e]??null)},onDelete:()=>{T(null)}})}),oe={SpriteTransition:{class:"SpriteTransition",props:{target:null,normal:null,hover:null,pressed:null,disabled:null,duration:0}},ColorTransition:{class:"ColorTransition",props:{target:null,normal:{r:1,g:1,b:1,a:1},hover:{r:1,g:1,b:1,a:1},pressed:{r:1,g:1,b:1,a:1},disabled:{r:1,g:1,b:1,a:1},duration:0}},ScaleTransition:{class:"ScaleTransition",props:{target:null,normal:1,hover:1,pressed:1.2,disabled:1,duration:.1}}},rt=L(({item:n,index:e,model:t,onModelChange:i})=>{var g;const{t:a}=N();let r,o;switch(n.class){case"SpriteTransition":r=et,o=["Image"];break;case"ColorTransition":r=Ke,o=["Image","Text"];break;case"ScaleTransition":r=Je,o=["Image","Text"];break}const l=m=>{const s=j(t.transitions);m(s),i==null||i("transitions",s)},c=m=>{l(s=>{const d=s[e];d&&m(d)})};return p.jsxs(p.Fragment,{children:[p.jsx(ye,{inspectorConfig:{label:a("ui.transition.target.label"),info:a("ui.transition.target.info"),property:"target",componentTypes:o,value:((g=n.props.target)==null?void 0:g.ownerId)??null},model:n.props,onModelChange:(m,s)=>{c(d=>{d.props.target=s})}}),p.jsx(Re,{label:a("ui.transition.type.label"),info:a("ui.transition.type.info"),value:n.class,options:[{label:a("ui.transition.type.sprite"),value:"SpriteTransition"},{label:a("ui.transition.type.scale"),value:"ScaleTransition"},{label:a("ui.transition.type.color"),value:"ColorTransition"}],onChange:m=>{oe[m].class!==n.class&&c(d=>{const h=oe[m],T=d.props.target;d.class=h.class,d.props={...d.props,duration:h.props.duration,normal:j(h.props.normal),hover:j(h.props.hover),pressed:j(h.props.pressed),disabled:j(h.props.disabled),target:T}})}}),p.jsx(r,{item:n,model:t,onPropsChange:m=>{c(s=>{m(s.props)})}}),p.jsx($,{label:a("ui.transition.duration.label"),info:a("ui.transition.duration.info"),value:n.props.duration,min:0,max:2,step:.05,onChange:m=>{c(s=>{s.props.duration=m})}})]})}),ot=L(({model:n,inspectorConfig:e,onModelChange:t})=>{const{label:i}=e,{t:a}=N(),r=n.transitions,o=l=>{const c=j(r);l(c),t==null||t("transitions",c)};return p.jsx(We,{label:i,items:r.map((l,c)=>{const g={SpriteTransition:a("ui.transition.type.sprite"),ColorTransition:a("ui.transition.type.color"),ScaleTransition:a("ui.transition.type.scale")};return{removable:!0,children:p.jsx(rt,{item:l,index:c,model:n,onModelChange:t}),id:c+"",name:g[l.class]||l.class}}),addable:!0,onAdd:()=>{o(l=>{var m;const c=j(oe.SpriteTransition),g=(m=l[0])==null?void 0:m.props.target;c.props.target=g?j(g):null,l.push(c)})},onDelete:l=>{o(c=>{c.splice(parseInt(l.id),1)})}})});var st=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,le=(n,e,t,i)=>{for(var a=i>1?void 0:i?lt(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(a=(i?o(e,t,a):o(a))||a);return i&&a&&st(e,t,a),a};let ee=class extends O{constructor(e,t){super(e,t);u(this,"_transitionMap",new Map);u(this,"interactive",!0);u(this,"transitions",[])}syncTransitionsFromModel(){const e=this.transitions,t=this._transitionMap;for(const[i,a]of Array.from(t.entries()))e.includes(i)||(a&&this.engineObject.removeTransition(a),t.delete(i));for(let i=0,a=e.length;i<a;i++)this.addTransition(e[i])}_onInitComplete(){const e=this.transitions;for(let t=0,i=e.length;t<i;t++)this.addTransition(e[t])}addTransition(e){var m;const t=e==null?void 0:e.class;if(!(t==="SpriteTransition"||t==="ColorTransition"||t==="ScaleTransition")){console.warn(`[ButtonComponent] Unsupported transition.class: ${t}`);return}const a=this.transitions;let r=a.indexOf(e);if(r===-1)r=a.push(e)-1;else{const s=this._transitionMap.get(a[r]);s&&(this.engineObject.removeTransition(s),this._transitionMap.delete(e))}const o=this._transitionMap;let l;const c=this.engineObject;switch(t){case"SpriteTransition":l=new Ie,tt(this.root,e,l);break;case"ColorTransition":l=new Me,Qe(e,l);break;case"ScaleTransition":l=new we,Xe(e,l);break}const g=e.props.target;if(g){const s=(m=this.root.sceneStore.entities.get(g.ownerId))==null?void 0:m.getComponentById(g.componentId);s==null||s.onReady().then(()=>{(s==null?void 0:s.status)==="ready"&&(l.target=s==null?void 0:s.engineObject)})}c.addTransition(l),o.set(a[r],l)}getTransition(e){return this._transitionMap.get(e)}};le([y({label:"ui.button.interactive.label",info:"ui.button.interactive.info",type:R.Toggle,onChange(n,e,t){const i=n.engineObject;i.interactive=t;const a=i._getInteractiveState(),r=i.transitions;for(let o=0,l=r.length;o<l;o++)r[o]._setState(a,!0)}}),b()],ee.prototype,"interactive",2);le([b({type:"methods",key:"addTransition",onSerialize:n=>n.map(e=>[{class:e.class,props:j(e.props)}]),onDeserialize:n=>n.map(e=>e[0])}),y({label:A("ui.button.transitions.label"),info:A("ui.button.transitions.info"),customComponent:ot,triggerAfterInit:!1,onChange(n){n.syncTransitionsFromModel();const e=n.engineObject,t=e._getInteractiveState(),i=e.transitions;for(let a=0,r=i.length;a<r;a++)i[a]._setState(t,!0)}}),b()],ee.prototype,"transitions",2);ee=le([W({type:"Button",componentsMenu:{group:"UI",label:"component.ui-button.title"},dependentComponent:{type:"UITransform",dependentMode:z.AutoAdd},mutuallyComponent:{type:"Transform",dependentMode:z.AutoDel}})],ee);var be=Object.defineProperty,ct=Object.getOwnPropertyDescriptor,pt=(n,e,t)=>e in n?be(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ne=(n,e,t,i)=>{for(var a=i>1?void 0:i?ct(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(a=(i?o(e,t,a):o(a))||a);return i&&a&&be(e,t,a),a},dt=(n,e,t)=>(pt(n,typeof e!="symbol"?e+"":e,t),t);let F=class extends $e{constructor(e,t){super(e,t);u(this,"raycastEnabled",!0);u(this,"raycastPadding",{x:0,y:0,z:0,w:0});u(this,"material",{refId:F._internalImageMaterialRefId});this.formSchema.addGroup("ui.image.raycast.title",["raycastEnabled","raycastPadding"])}_onInitComplete(){this.raycastEnabled=!1,this.applyBoundPathChange("raycastEnabled",R.Toggle,!1)}};dt(F,"_internalImageMaterialRefId","0000204");ne([y({label:"ui.image.raycast.enabled.label",info:"ui.image.raycast.enabled.info",type:R.Toggle,bindPath:"raycastEnabled"}),b()],F.prototype,"raycastEnabled",2);ne([y({label:"ui.image.raycast.padding.label",info:"ui.image.raycast.padding.info",type:R.Vector4,slotMapping:{x:A("ui.image.raycast.padding.left"),y:A("ui.image.raycast.padding.down"),z:A("ui.image.raycast.padding.right"),w:A("ui.image.raycast.padding.up")}}),b()],F.prototype,"raycastPadding",2);ne([y({label:"ui.image.material.label",info:"ui.image.material.info",type:R.AssetPicker,assetType:"Material",customFilter:n=>{var e;return((e=n.engineObject.shader)==null?void 0:e.name)!=="particle-shader"},onChange:async n=>{const{material:e}=n,t=n.engineObject;if(!e){t.setMaterial(null);return}const{refId:i}=e;if(i===F._internalImageMaterialRefId)t.setMaterial(t.engine._getUIDefaultMaterial());else{const a=await n.root.assetStore.getAssetByRef(e);a?t.setMaterial(a.engineObject):console.error(`Material asset not found: ${e.refId}`)}}}),Pe({engineKey:"setMaterial",getEngineValue:n=>n.getMaterial()}),b({type:"methods",key:"setMaterial",onSerialize:n=>n?[[n]]:void 0,onDeserialize(n){return n?n[0][0]:void 0}})],F.prototype,"material",2);F=ne([W({type:"Image",componentsMenu:{group:"UI",label:"component.ui-image.title"},dependentComponent:{type:"UITransform",dependentMode:z.AutoAdd},mutuallyComponent:{type:"Transform",dependentMode:z.AutoDel}})],F);var ut=Object.defineProperty,ht=Object.getOwnPropertyDescriptor,gt=(n,e,t,i)=>{for(var a=i>1?void 0:i?ht(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(a=(i?o(e,t,a):o(a))||a);return i&&a&&ut(e,t,a),a};let ge=class extends He{constructor(n,e){super(n,e)}};ge=gt([W({type:"Text",componentsMenu:{group:"UI",label:"component.ui-text.title"},dependentComponent:{type:"UITransform",dependentMode:z.AutoAdd},mutuallyComponent:{type:"Transform",dependentMode:z.AutoDel}})],ge);function ce(n,e,t){var o;const i=(o=n._getParentTransform())==null?void 0:o._rect;if(!i)return;const a=n._rect,r=n.position.x;switch(e){case f.Left:n.alignLeft=r-i.x+a.x,t.push("alignLeft");break;case f.Right:n.alignRight=i.x+i.width-a.x-a.width-r,t.push("alignRight");break;case f.Center:n.alignCenter=r-i.x-i.width*.5+a.x+a.width*.5,t.push("alignCenter");break;case f.LeftAndRight:n.alignLeft=r-i.x+a.x,n.alignRight=i.x+i.width-a.x-a.width-r,t.push("alignLeft","alignRight");break}}function pe(n,e,t){var o;const i=(o=n._getParentTransform())==null?void 0:o._rect;if(!i)return;const a=n._rect,r=n.position.y;switch(e){case _.Top:n.alignTop=i.y+i.height-a.y-a.height-r,t.push("alignTop");break;case _.Bottom:n.alignBottom=r-i.y+a.y,t.push("alignBottom");break;case _.Middle:n.alignMiddle=r-i.y-i.height*.5+a.y+a.height*.5,t.push("alignMiddle");break;case _.TopAndBottom:n.alignTop=i.y+i.height-a.y-a.height-r,n.alignBottom=r-i.y+a.y,t.push("alignTop","alignBottom");break}}function mt(n,e,t=n.horizontalAlignment,i=n.verticalAlignment){e.length=0;const a=n.engineObject;return a.horizontalAlignment=f.None,a.verticalAlignment=_.None,ce(a,t,e),pe(a,i,e),a.horizontalAlignment=t,a.verticalAlignment=i,e}const ft=te({position:"relative",width:"95%",height:"100%","border-radius":"5px",background:"#00000000",border:"1px solid #646c75",display:"flex","justify-content":"center","align-items":"center","flex-shrink":0})(),yt=te({position:"absolute",width:"calc(100% - 40px)",height:"calc(100% - 33px)",border:"1px solid #646c75","border-radius":"5px","pointer-events":"none"})(),bt=te({display:"grid",width:"100%",padding:"var(--space-0_5)","grid-template-columns":"minmax(0px, 1.3fr) repeat(3, minmax(0px, 1fr))","grid-template-rows":"auto","column-gap":"var(--space-1)",alignItems:"center"})(),vt=te({display:"grid",columnGap:"$1","align-items":"flex-start","grid-column":"2 / -1","column-gap":"var(--space-1)","row-gap":"var(--space-1)"})(),me=Le("div",{display:"grid",gap:"var(--space-1)",variants:{column:{1:{gridTemplateColumns:"1fr"},2:{gridTemplateColumns:"repeat(2, 1fr)"},3:{gridTemplateColumns:"repeat(3, 1fr)"}}}}),_t=[],D=L(()=>null),Ct=L(({model:n,onModelChange:e})=>{const t=n.engineObject,i=(s,d)=>{const h=mt(n,_t,s,d);for(let T=0;T<h.length;T++){const C=h[T];n._syncTransformToEditor(C,t[C]),e==null||e(C,n[C])}},a=s=>d=>{e==null||e(s,d)},r=s=>{switch(s){case f.None:return 1;case f.Left:case f.Right:case f.Center:return 2;case f.LeftAndRight:return 3;default:return 1}},o=(s,d="")=>p.jsx(Ee,{startSlot:d,value:n[s],onValueChange:a(s)},s),l=s=>{const d=n.horizontalAlignment;let h=d;d&s?h=d&~s:d===f.Center||s===f.Center?h=s:h=d|s,e==null||e("horizontalAlignment",h),i(h,n.verticalAlignment)},c=s=>{const d=n.verticalAlignment;let h=d;d&s?h=d&~s:d===_.Middle||s===_.Middle?h=s:h=d|s,e==null||e("verticalAlignment",h),i(n.horizontalAlignment,h)},g=s=>!!(n.horizontalAlignment&s),m=s=>!!(n.verticalAlignment&s);return p.jsxs("div",{className:bt,children:[p.jsxs("div",{className:ft,id:"ring",children:[p.jsx("div",{className:yt}),p.jsx(k,{...St,isActive:g(f.Left),onClick:()=>l(f.Left)}),p.jsx(k,{...Tt,isActive:g(f.Right),onClick:()=>l(f.Right)}),p.jsx(k,{...xt,isActive:g(f.Center),onClick:()=>l(f.Center)}),p.jsx(k,{...At,isActive:m(_.Top),onClick:()=>c(_.Top)}),p.jsx(k,{...Rt,isActive:m(_.Bottom),onClick:()=>c(_.Bottom)}),p.jsx(k,{...wt,isActive:m(_.Middle),onClick:()=>c(_.Middle)})]}),p.jsxs("div",{className:vt,children:[p.jsxs(me,{column:r(n.horizontalAlignment),children:[p.jsx(de,{startSlot:n.horizontalAlignment===f.None?"Horizontal":"",value:n.horizontalAlignment,onValueChange:s=>{e==null||e("horizontalAlignment",s),i(s,n.verticalAlignment)},children:ue(f).map(s=>p.jsx(he,{value:s.value,children:s.label},s.value))}),n.horizontalAlignment===f.Left&&o("alignLeft"),n.horizontalAlignment===f.Right&&o("alignRight"),n.horizontalAlignment===f.Center&&o("alignCenter"),n.horizontalAlignment===f.LeftAndRight&&p.jsxs(p.Fragment,{children:[o("alignLeft","Left"),o("alignRight","Right")]})]}),p.jsxs(me,{column:r(n.verticalAlignment),children:[p.jsx(de,{startSlot:n.verticalAlignment===_.None?"Vertical":"",value:n.verticalAlignment,onValueChange:s=>{e==null||e("verticalAlignment",s),i(n.horizontalAlignment,s)},children:ue(_).map(s=>p.jsx(he,{value:s.value,children:s.label},s.value))}),n.verticalAlignment===_.Top&&o("alignTop"),n.verticalAlignment===_.Bottom&&o("alignBottom"),n.verticalAlignment===_.Middle&&o("alignMiddle"),n.verticalAlignment===_.TopAndBottom&&p.jsxs(p.Fragment,{children:[o("alignTop","Top"),o("alignBottom","Bottom")]})]})]})]})}),St={left:2,top:"cal(50% - 12px)",width:16,height:25,lw:10,lh:1,activeLH:3,orientation:"h"},Tt={right:2,top:"cal(50% - 12px)",width:16,height:25,lw:10,lh:1,activeLH:3,orientation:"h"},xt={left:"cal(50% - 12px)",top:"cal(50% - 4px)",width:24,height:8,lw:14,lh:1,activeLH:3,orientation:"h"},At={left:"cal(50% - 12px)",top:2,width:25,height:12,lw:1,lh:10,activeLW:3,orientation:"v"},Rt={left:"cal(50% - 12px)",bottom:2,width:25,height:12,lw:1,lh:10,activeLW:3,orientation:"v"},wt={left:"cal(50% - 12px)",top:"cal(50% - 4px)",width:8,h:24,lw:1,lh:14,activeLW:3,orientation:"v"},k=L(function({isActive:e,onClick:t,...i}){return p.jsx("button",{onClick:t,style:{background:"transparent",padding:0,border:0,cursor:"pointer",display:"flex",position:"absolute",justifyContent:"center",alignItems:"center",...i},children:p.jsx("span",{style:{display:"block",background:e?"#1e88e5":"#a8acb3",borderRadius:e?"2px":"0px",width:i.orientation==="h"?i.lw:e&&i.activeLW||i.lw,height:i.orientation==="v"?i.lh:e&&i.activeLH||i.lh,transition:"all 0.15s ease"}})})});var ve=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,It=(n,e,t)=>e in n?ve(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,M=(n,e,t,i)=>{for(var a=i>1?void 0:i?Mt(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(a=(i?o(e,t,a):o(a))||a);return i&&a&&ve(e,t,a),a},Pt=(n,e,t)=>(It(n,typeof e!="symbol"?e+"":e,t),t);let x=class extends I{constructor(e,t){super(e,t);u(this,"_tempPropertiesForPosition",[]);u(this,"_tempPropertiesForSize",[]);u(this,"disabled",!1);u(this,"size",{x:100,y:100});u(this,"pivot",{x:.5,y:.5});u(this,"alignment",{});u(this,"horizontalAlignment",f.None);u(this,"verticalAlignment",_.None);u(this,"alignLeft",0);u(this,"alignCenter",0);u(this,"alignRight",0);u(this,"alignTop",0);u(this,"alignMiddle",0);u(this,"alignBottom",0);u(this,"syncEngineToEditor",se((e=!1)=>{const t=this.engineObject,{size:i,pivot:a,position:r,rotation:o,scale:l}=t;!e&&this._isLock?(r.copyFrom(this.position),o.copyFrom(this.rotation),l.copyFrom(this.scale),i.copyFrom(this.size),a.copyFrom(this.pivot),t.horizontalAlignment=this.horizontalAlignment,t.alignLeft=this.alignLeft,t.alignCenter=this.alignCenter,t.alignRight=this.alignRight,t.verticalAlignment=this.verticalAlignment,t.alignTop=this.alignTop,t.alignMiddle=this.alignMiddle,t.alignBottom=this.alignBottom):(this._syncTransformToEditor("position",r),this._syncTransformToEditor("rotation",o),this._syncTransformToEditor("scale",l),this._syncTransformToEditor("size",i),this._syncTransformToEditor("pivot",a),this._syncTransformToEditor("horizontalAlignment",t.horizontalAlignment),this._syncTransformToEditor("alignLeft",t.alignLeft),this._syncTransformToEditor("alignCenter",t.alignCenter),this._syncTransformToEditor("alignRight",t.alignRight),this._syncTransformToEditor("verticalAlignment",t.verticalAlignment),this._syncTransformToEditor("alignTop",t.alignTop),this._syncTransformToEditor("alignMiddle",t.alignMiddle),this._syncTransformToEditor("alignBottom",t.alignBottom))}));u(this,"_engineParentEntity");u(this,"_isLock",!1);u(this,"_lockWorldMatrix");this._onParentChange=this._onParentChange.bind(this),this._onParentTransformChange=this._onParentTransformChange.bind(this),this.formSchema.addGroup("ui.transform.relativeLayout",["alignment"],{when:i=>{var a,r;return!((r=(a=i.entityModel)==null?void 0:a.getComponentByTypeName("UICanvas"))!=null&&r.isRootCanvas())}})}static roundVector2(e,t){return t.x=I.roundToThreeDecimal(e.x),t.y=I.roundToThreeDecimal(e.y),t}static equalVector2(e,t){return e.x===t.x&&e.y===t.y}_updateEditorSize(){const e=this.engineObject,t=I.roundVector2(e.size,I._tempVector2);I.copyVector2(t,this.size)}_updateEditorPosition(){const e=this.engineObject,t=I.roundVector3(e.position,I._tempVector3);I.copyVector3(t,this.position)}onInitComplete(){var e;this._onTransformModify=this._onTransformModify.bind(this),(e=this.engineObject.entity)==null||e._updateFlagManager.addListener(this._onTransformModify)}_onTransformModify(e){this.engineObject;const t=512,i=1024;e&t&&this._updateEditorSize(),(e&t||e&i)&&(this.horizontalAlignment||this.verticalAlignment)&&this._updateEditorPosition()}syncRotation(e=!1){!e&&this._isLock?this.engineObject.rotation.copyFrom(this.rotation):this._syncTransformToEditor("rotation",this.engineObject.rotation)}syncTransformToEditor(e){this._isLock||(super.syncTransformToEditor(e),this._syncTransformToEditor("size",e.size),this._syncTransformToEditor("pivot",e.pivot),this._syncTransformToEditor("horizontalAlignment",e.horizontalAlignment),this._syncTransformToEditor("alignLeft",e.alignLeft),this._syncTransformToEditor("alignCenter",e.alignCenter),this._syncTransformToEditor("alignRight",e.alignRight),this._syncTransformToEditor("verticalAlignment",e.verticalAlignment),this._syncTransformToEditor("alignTop",e.alignTop),this._syncTransformToEditor("alignMiddle",e.alignMiddle),this._syncTransformToEditor("alignBottom",e.alignBottom))}destroy(e){var t,i;(i=(t=this.engineObject)==null?void 0:t.entity)==null||i._updateFlagManager.removeListener(this._onTransformModify),super.destroy(e)}checkCanDisable(){return{code:1,msg:"ui.transform.error.cant-disable"}}checkCanDeletable(){return{code:1,msg:"ui.transform.error.cant-delete"}}_onPositionChange(){const{horizontalAlignment:e,verticalAlignment:t}=this;if(e||t){const i=this.engineObject,a=this._tempPropertiesForPosition;a.length=0,i.horizontalAlignment=f.None,i.verticalAlignment=_.None,i.position.copyFrom(this.position),ce(i,e,a),pe(i,t,a),i.horizontalAlignment=e,i.verticalAlignment=t;for(let r=0;r<a.length;r++){const o=a[r];this._syncTransformToEditor(o,i[o])}}else this.engineObject.position.copyFrom(this.position)}_onParentChange(e){e&je.Parent&&this._updateParent(this.engineObject.entity.parent)}_updateParent(e){const t=this._engineParentEntity;t!==e&&(t&&t._updateFlagManager.removeListener(this._onParentTransformChange),e&&e._updateFlagManager.addListener(this._onParentTransformChange),this._engineParentEntity=e,this._onParentTransformChange())}_onParentTransformChange(){this.engineObject.worldMatrix.copyFrom(this._lockWorldMatrix),this.syncEngineToEditor(!0)}lock(e){this._isLock=!0,this._lockWorldMatrix?this._lockWorldMatrix.copyFrom(e):this._lockWorldMatrix=e.clone();const t=this.engineObject.entity;t._registerModifyListener(this._onParentChange),this._updateParent(t.parent)}unlock(){var e;this._isLock=!1,this.engineObject.entity._unRegisterModifyListener(this._onParentChange),(e=this._engineParentEntity)==null||e._updateFlagManager.removeListener(this._onParentTransformChange)}onShow(){this.syncEngineToEditor(!0)}get ignoreToJSON(){return!0}getEditable(){return!this.disabled}onAddToEntity(e){for(let t=0;t<e.components.length;t++){const i=e.components[t];if((i.type==="Transform"||i.type==="UITransform")&&i!==this){e.removeComponent(i);break}}e.setComponentIndex(this,0)}getAnimatableProperties(){let e=[];const t=i=>{if(!(i!=null&&i.length))return e;i.filter(a=>a.property==="alignment"?!1:!a.when||a.when(this)).forEach(a=>{a.type==="Group"?t(a.children):e.push({property:a.property,label:a.label,type:a.type})})};return t(this.formSchema.items),e=e.concat(this._additionAnimatableProperties),e}_syncTransformToEditor(e,t){switch(e){case"horizontalAlignment":case"verticalAlignment":{this[e]!==t&&(this[e]=t,this.notifyPropertyChange(e,!1));break}case"alignLeft":case"alignCenter":case"alignRight":case"alignTop":case"alignMiddle":case"alignBottom":{const i=I.roundToThreeDecimal(t);this[e]!==i&&(this[e]=i,this.notifyPropertyChange(e,!1));break}case"size":case"pivot":{const i=this[e],a=x.roundVector2(t,x._tempVector2);x.equalVector2(a,i)||(i.x=a.x,i.y=a.y,this.notifyPropertyChange(e,!1));break}default:super._syncTransformToEditor(e,t);break}}};Pt(x,"_tempVector2",{x:0,y:0});M([ze],x.prototype,"disabled",2);M([y({label:A("ui.transform.size.label"),info:A("ui.transform.size.info"),type:R.Vector2,slotMapping:{x:"W",y:"H"},onChange:(n,e,t)=>{const i=n.engineObject,a=n.size,{x:r,y:o}=i.size,{horizontalAlignment:l,verticalAlignment:c}=n,g=I.roundToThreeDecimal(r)!==a.x,m=I.roundToThreeDecimal(o)!==a.y;if(!(!g&&!m))if(l||c){const s=n._tempPropertiesForSize;s.length=0,s.push("position"),i.horizontalAlignment=f.None,i.verticalAlignment=_.None,i.size.copyFrom(a),ce(i,l,s),pe(i,c,s),i.horizontalAlignment=l,i.verticalAlignment=c;for(let d=0;d<s.length;d++){const h=s[d];n._syncTransformToEditor(h,i[h])}}else i.size.copyFrom(a)}}),b()],x.prototype,"size",2);M([y({label:A("ui.transform.pivot.label"),info:A("ui.transform.pivot.info"),type:R.Vector2,onChange:(n,e,t)=>{const i=n.pivot,a=n.engineObject;a.pivot.set(i.x,i.y),n._syncTransformToEditor("position",a.position)}}),b()],x.prototype,"pivot",2);M([y({customComponent:Ct,when:n=>{var e,t;return!((t=(e=n.entityModel)==null?void 0:e.getComponentByTypeName("UICanvas"))!=null&&t.isRootCanvas())}})],x.prototype,"alignment",2);M([y({label:A("ui.transform.horizontalAlignment.label"),customComponent:D,onChange:n=>{n.engineObject.horizontalAlignment=n.horizontalAlignment}}),b()],x.prototype,"horizontalAlignment",2);M([y({label:A("ui.transform.verticalAlignment.label"),customComponent:D,onChange:n=>{n.engineObject.verticalAlignment=n.verticalAlignment}}),b()],x.prototype,"verticalAlignment",2);M([y({label:A("ui.transform.alignLeft.label"),customComponent:D,onChange:n=>{n.engineObject.alignLeft=n.alignLeft,n._updateEditorPosition()}}),b()],x.prototype,"alignLeft",2);M([y({label:A("ui.transform.alignCenter.label"),customComponent:D,onChange:n=>{n.engineObject.alignCenter=n.alignCenter,n._updateEditorPosition()}}),b()],x.prototype,"alignCenter",2);M([y({label:A("ui.transform.alignRight.label"),customComponent:D,onChange:n=>{n.engineObject.alignRight=n.alignRight,n._updateEditorPosition()}}),b()],x.prototype,"alignRight",2);M([y({label:A("ui.transform.alignTop.label"),customComponent:D,onChange:n=>{n.engineObject.alignTop=n.alignTop,n._updateEditorPosition()}}),b()],x.prototype,"alignTop",2);M([y({label:A("ui.transform.alignMiddle.label"),customComponent:D,onChange:n=>{n.engineObject.alignMiddle=n.alignMiddle,n._updateEditorPosition()}}),b()],x.prototype,"alignMiddle",2);M([y({label:A("ui.transform.alignBottom.label"),customComponent:D,onChange:n=>{n.engineObject.alignBottom=n.alignBottom,n._updateEditorPosition()}}),b()],x.prototype,"alignBottom",2);M([se],x.prototype,"syncRotation",1);x=M([W({type:"UITransform",componentsMenu:{group:"UI",label:"component.ui-transform.title"},mutuallyComponent:{type:"Transform",dependentMode:z.AutoDel}})],x);const Lt=L(({model:n,inspectorConfig:e})=>{const{t}=N(),i=n.enabled?t("ui.canvas.warning.not-root-canvas-reason-not-closest"):t("ui.canvas.warning.not-root-canvas-reason-disabled");return p.jsxs(Ge,{type:"warning",css:{width:"100%"},children:[t("ui.canvas.warning.not-root-canvas")," ",i]})});function V(n){n.run().then(e=>{n.isActive()&&(n.shouldApply&&!n.shouldApply(e)||n.apply(e))}).catch(()=>{})}function Et(n,e){var t;return e?((t=n.entities.get(e.ownerId))==null?void 0:t.getComponentById(e.componentId))??null:null}var _e=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,zt=(n,e,t)=>e in n?_e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,E=(n,e,t,i)=>{for(var a=i>1?void 0:i?jt(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(a=(i?o(e,t,a):o(a))||a);return i&&a&&_e(e,t,a),a},Ce=(n,e,t)=>(zt(n,typeof e!="symbol"?e+"":e,t),t);let w=class extends O{constructor(e,t){super(e,t);u(this,"_cameraListener");u(this,"_initReadySequence",0);u(this,"_cameraReadySequence",0);u(this,"_poseReadySequence",0);u(this,"_sizeReadySequence",0);u(this,"_canvasReadySequence",0);u(this,"debouncedRootCanvasCheck",Oe(this._triggerRootCanvasCheck.bind(this),500,{edges:["trailing"]}));u(this,"warning","");u(this,"renderMode",S.ScreenSpaceOverlay);u(this,"referenceResolution",{x:800,y:600});u(this,"referenceResolutionPerUnit",100);u(this,"renderCamera",null);u(this,"resolutionAdaptationMode",P.HeightAdaptation);u(this,"sortOrder",0);u(this,"distance",10);this._onCanvasSizeListener=this._onCanvasSizeListener.bind(this),this._triggerRootCanvasCheck=this._triggerRootCanvasCheck.bind(this),this._onCameraModifyListener=this._onCameraModifyListener.bind(this),this._onCameraTransformListener=this._onCameraTransformListener.bind(this),this.formSchema.addGroup("ui.canvas.adaptation",["referenceResolution","resolutionAdaptationMode","referenceResolutionPerUnit"],{collapsible:!1,when:i=>i.isRootCanvas()})}onInitComplete(){this.applyBoundPathChange("renderMode",R.Select,S.WorldSpace);const e=this._getTransformModel();if(!e)return;const t=++this._initReadySequence;V({run:async()=>(await e.onReady(),e),isActive:()=>this._isSequenceActive(t,this._initReadySequence),shouldApply:()=>{var i;return((i=this._getTransformModel())==null?void 0:i.status)==="ready"},apply:()=>{q.on("UICanvasEnabled",this.debouncedRootCanvasCheck),q.on("UICanvasDisable",this.debouncedRootCanvasCheck),this._engineObject.engine.canvas._sizeUpdateFlagManager.addListener(this._onCanvasSizeListener);const i=this.root.projectStore.currentScene;i&&(i.initComplete?this.debouncedRootCanvasCheck():V({run:async()=>(await i.onReady(),i),isActive:()=>this._isSequenceActive(t,this._initReadySequence),shouldApply:a=>a.status==="ready",apply:()=>{this.debouncedRootCanvasCheck()}}))}})}_isSequenceActive(e,t){return!this.destroyed&&e===t}_triggerRootCanvasCheck(){var e,t;this._enabled&&this.isRootCanvas()?(this._onRenderCameraDirty(),this._onRenderModeDirty()):(this._setCameraListener(null),(t=(e=this.entityModel)==null?void 0:e.transform)==null||t.unlock(),this._setTransformDisabled(!1))}_onRenderModeDirty(){var t,i;switch(this.renderMode){case S.ScreenSpaceCamera:case S.ScreenSpaceOverlay:this._adapterPoseInScreenSpace(),this._adapterSizeInScreenSpace(),this._setTransformDisabled(!0);break;case S.WorldSpace:(i=(t=this.entityModel)==null?void 0:t.transform)==null||i.unlock(),this._setTransformDisabled(!1);break}}_setCameraListener(e){if(e){const t=++this._cameraReadySequence;V({run:async()=>(await e.onReady(),e),isActive:()=>this._isSequenceActive(t,this._cameraReadySequence),shouldApply:i=>i.status==="ready",apply:i=>{const a=i.engineObject,r=this._cameraListener;r!==a&&(this._cameraListener=a,r&&(r.entity._updateFlagManager.removeListener(this._onCameraTransformListener),r._unRegisterModifyListener(this._onCameraModifyListener)),a&&(a.entity._updateFlagManager.addListener(this._onCameraTransformListener),a._registerModifyListener(this._onCameraModifyListener)))}})}else{this._cameraReadySequence++;const t=this._cameraListener;t&&(t.entity._updateFlagManager.removeListener(this._onCameraTransformListener),t._unRegisterModifyListener(this._onCameraModifyListener)),this._cameraListener=null}}_onRenderCameraDirty(){this._setCameraListener(this.renderMode===S.ScreenSpaceCamera?this._getCameraModel():null)}onEnabled(){super.onEnabled(),q.dispatch("UICanvasEnabled",this)}onDisabled(){super.onDisabled(),q.dispatch("UICanvasDisable",this)}isRootCanvas(){var e;return!!((e=this.engineObject)!=null&&e._isRootCanvas)}destroy(e){this._initReadySequence++,this._cameraReadySequence++,this._poseReadySequence++,this._sizeReadySequence++,this._canvasReadySequence++,q.off("UICanvasEnabled",this.debouncedRootCanvasCheck),q.off("UICanvasDisable",this.debouncedRootCanvasCheck),this._setCameraListener(null),this._engineObject.engine.canvas._sizeUpdateFlagManager.removeListener(this._onCanvasSizeListener),super.destroy(e)}_setTransformDisabled(e){var i;const t=(i=this.entityModel)==null?void 0:i.transform;t&&(t.disabled=e)}_onCameraModifyListener(e){switch(e){case X.ProjectionType:case X.AspectRatio:this._adapterSizeInScreenSpace();break;case X.FieldOfView:!this._cameraListener.isOrthographic&&this._adapterSizeInScreenSpace();break;case X.OrthographicSize:this._cameraListener.isOrthographic&&this._adapterSizeInScreenSpace();break}}_onCameraTransformListener(){this.renderMode===S.ScreenSpaceCamera&&this._adapterPoseInScreenSpace()}_adapterPoseInScreenSpace(){var a,r;const e=this.engineObject,t=e.entity.transform,i=this._getCameraModel();if(this.renderMode===S.ScreenSpaceCamera&&i){const o=++this._poseReadySequence;V({run:async()=>(await i.onReady(),i),isActive:()=>this._isSequenceActive(o,this._poseReadySequence),shouldApply:l=>l.status==="ready",apply:l=>{var g,m;const c=l.engineObject;if(!this._isSameEntityOrChildEntity(c.entity)){const{transform:s}=c.entity,{worldPosition:d,worldForward:h}=s,T=e.distance;t.setWorldPosition(d.x+h.x*T,d.y+h.y*T,d.z+h.z*T),t.worldRotationQuaternion.copyFrom(s.worldRotationQuaternion),(m=(g=this.entityModel)==null?void 0:g.transform)==null||m.lock(t.worldMatrix),this._syncPose()}}})}else{this._poseReadySequence++;const{canvas:o}=e.engine,l=o.height,c=o.width;t.setWorldPosition(c*.5,l*.5,0),t.worldRotationQuaternion.set(0,0,0,1),(r=(a=this.entityModel)==null?void 0:a.transform)==null||r.lock(t.worldMatrix),this._syncPose()}}_adapterSizeInScreenSpace(){let e,t;const i=this._getCameraModel();if(this.renderMode===S.ScreenSpaceCamera&&i){const a=++this._sizeReadySequence;V({run:async()=>(await i.onReady(),i),isActive:()=>this._isSequenceActive(a,this._sizeReadySequence),shouldApply:r=>r.status==="ready",apply:r=>{const o=r.engineObject;t=o.isOrthographic?o.orthographicSize*2:2*(Math.tan(Fe.degreeToRadian(o.fieldOfView*.5))*this.engineObject.distance),e=o.aspectRatio*t,this._applySize(e,t)}})}else{this._sizeReadySequence++;const{canvas:a}=this.engineObject.engine;this._applySize(a.width,a.height)}}_onCanvasSizeListener(){const e=++this._canvasReadySequence;V({run:async()=>(await this.onReady(),this),isActive:()=>this._isSequenceActive(e,this._canvasReadySequence),shouldApply:t=>t.status==="ready",apply:()=>{const t=this._getCameraModel(),i=this.renderMode;if(i===S.ScreenSpaceOverlay||i===S.ScreenSpaceCamera&&!t){const a=this.engineObject,{canvas:r}=a.engine;a.entity.transform.setWorldPosition(r.width*.5,r.height*.5,0),this._adapterSizeInScreenSpace()}}})}_applySize(e,t){const i=this.engineObject.entity.transform,{x:a,y:r}=this.referenceResolution;let o,l,c;switch(this.resolutionAdaptationMode){case P.WidthAdaptation:o=l=c=e/a;break;case P.HeightAdaptation:o=l=c=t/r;break;case P.BothAdaptation:o=e/a,l=t/r,c=(o+l)*.5;break;case P.ExpandAdaptation:o=l=c=Math.min(e/a,t/r);break;case P.ShrinkAdaptation:o=l=c=Math.max(e/a,t/r);break}const g=w._tempMat;fe.affineTransformation(w._tempVec3.set(o,l,c),i.worldRotationQuaternion,i.worldPosition,g),i.worldMatrix.copyFrom(g),i.size.set(e/o,t/l),this._syncPose()}_syncPose(){var t;const e=(t=this.entityModel)==null?void 0:t.transform;e&&e.syncEngineToEditor(!0)}_getTransformModel(){var e;return(e=this.entityModel)==null?void 0:e.transform}_getCameraModel(){return Et(this.root.sceneStore,this.renderCamera)}_isSameEntityOrChildEntity(e){const t=this.engineObject.entity;for(;e;){if(e===t)return!0;e=e.parent}return!1}};Ce(w,"_tempVec3",new Be);Ce(w,"_tempMat",new fe);E([y({label:"ui.canvas.warning.label",info:"ui.canvas.warning.info",customComponent:Lt,when:n=>!n.isRootCanvas()})],w.prototype,"warning",2);E([y({label:"ui.canvas.render-mode.label",info:"ui.canvas.render-mode.info",type:R.Select,value:S.ScreenSpaceOverlay,when:n=>n.isRootCanvas(),triggerAfterInit:!1,options:[{label:"ui.canvas.render-mode.screen-space-overlay",value:S.ScreenSpaceOverlay},{label:"ui.canvas.render-mode.screen-space-camera",value:S.ScreenSpaceCamera},{label:"ui.canvas.render-mode.world-space",value:S.WorldSpace}],onChange(n,e,t){n._onRenderCameraDirty(),n._onRenderModeDirty()}}),b()],w.prototype,"renderMode",2);E([y({label:"ui.canvas.resolution.label",info:"ui.canvas.resolution.info",type:R.Vector2,slotMapping:{x:"W",y:"H"},triggerAfterInit:!1,when:n=>n.isRootCanvas()&&n.renderMode!==S.WorldSpace,onChange:(n,e,t)=>{n._adapterSizeInScreenSpace()}}),b()],w.prototype,"referenceResolution",2);E([y({label:"ui.canvas.resolution-per-unit.label",info:"ui.canvas.resolution-per-unit.info",type:R.Number,when:n=>n.isRootCanvas(),bindPath:"referenceResolutionPerUnit"}),b()],w.prototype,"referenceResolutionPerUnit",2);E([y({label:"ui.canvas.render-camera.label",info:"ui.canvas.render-camera.info",customComponent:ye,triggerAfterInit:!1,componentTypes:["Camera"],when:n=>n.isRootCanvas()&&n.renderMode===S.ScreenSpaceCamera,onChange:(n,e,t)=>{n._onRenderCameraDirty(),n._onRenderModeDirty()}}),b()],w.prototype,"renderCamera",2);E([y({label:"ui.canvas.adaptation-mode.label",info:"ui.canvas.adaptation-mode.info",type:R.Select,value:P.HeightAdaptation,triggerAfterInit:!1,when:n=>n.isRootCanvas()&&n.renderMode!==S.WorldSpace,options:[{label:"ui.canvas.adaptation-mode.width",value:P.WidthAdaptation},{label:"ui.canvas.adaptation-mode.height",value:P.HeightAdaptation},{label:"ui.canvas.adaptation-mode.both",value:P.BothAdaptation},{label:"ui.canvas.adaptation-mode.expand",value:P.ExpandAdaptation},{label:"ui.canvas.adaptation-mode.shrink",value:P.ShrinkAdaptation}],onChange(n,e,t){n._adapterSizeInScreenSpace()}}),b()],w.prototype,"resolutionAdaptationMode",2);E([y({label:"ui.canvas.sort-order.label",info:"ui.canvas.sort-order.info",type:R.Number,when:n=>n.isRootCanvas()&&n.renderMode===S.ScreenSpaceOverlay,bindPath:"sortOrder"}),b()],w.prototype,"sortOrder",2);E([y({label:"ui.canvas.distance.label",info:"ui.canvas.distance.info",type:R.Number,when:n=>n.isRootCanvas()&&n.renderMode===S.ScreenSpaceCamera,bindPath:"distance",triggerAfterInit:!1,onChange:(n,e,t)=>{n.renderCamera&&(n._adapterPoseInScreenSpace(),n._adapterSizeInScreenSpace())}}),b()],w.prototype,"distance",2);E([se],w.prototype,"_setTransformDisabled",1);w=E([W({type:"UICanvas",componentsMenu:{group:"UI",label:"component.ui-canvas.title"},dependentComponent:{type:"UITransform",dependentMode:z.AutoAdd},mutuallyComponent:{type:"Transform",dependentMode:z.AutoDel},unique:!0})],w);var Ot=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor,ie=(n,e,t,i)=>{for(var a=i>1?void 0:i?Bt(e,t):e,r=n.length-1,o;r>=0;r--)(o=n[r])&&(a=(i?o(e,t,a):o(a))||a);return i&&a&&Ot(e,t,a),a};let H=class extends O{constructor(e,t){super(e,t);u(this,"alpha",1);u(this,"interactive",!0);u(this,"ignoreParentGroup",!1)}};ie([y({label:"ui.group.alpha.label",info:"ui.group.alpha.info",type:R.Slider,bindPath:"alpha",min:0,max:1,dragStep:.02}),b()],H.prototype,"alpha",2);ie([y({label:"ui.group.interactive.label",info:"ui.group.interactive.info",type:R.Toggle,bindPath:"interactive"}),b()],H.prototype,"interactive",2);ie([y({label:"ui.group.ignore-parent.label",info:"ui.group.ignore-parent.info",type:R.Toggle,bindPath:"ignoreParentGroup"}),b()],H.prototype,"ignoreParentGroup",2);H=ie([W({type:"UIGroup",componentsMenu:{group:"UI",label:"component.ui-group.title"},unique:!0})],H);O.registerCustomEngineComponent("UICanvas",De);O.registerCustomEngineComponent("UIGroup",Ue);O.registerCustomEngineComponent("Image",qe);O.registerCustomEngineComponent("Button",ke);O.registerCustomEngineComponent("UITransform",Ve);O.registerCustomEngineComponent("Text",Ne);export{ee as ButtonComponent,F as ImageComponent,ge as TextComponent,w as UICanvasComponent,H as UIGroupComponent,x as UITransformComponent};