@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,26 @@
1
+ var Ut=Object.defineProperty;var Jt=(a,e,t)=>e in a?Ut(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var x=(a,e,t)=>(Jt(a,typeof e!="symbol"?e+"":e,t),t);import{aH as Re,b9 as we,aC as T,aD as ge,b8 as Ee,ci as be,c9 as Tt,ca as jt,cj as ie,ch as le,eH as Ce,aG as Qt,aQ as Z,aU as $,aS as C,aW as ea,aO as ta,aP as Lt,aF as aa,dD as ra,aR as G,bm as oa,cC as te,bl as st,eT as ze,eU as me,bN as na,by as sa,cy as R,eV as ia,bX as _t,eW as la,eX as ca,eY as pa,eZ as ua,e_ as ma,e$ as q,f0 as da,f1 as ha,f2 as fa,f3 as de,dQ as ya,cf as Te,cg as je,bP as ve,cl as St,B as Mt,cm as Pt,eO as ba,E as va,C as A,f4 as W,f5 as Y,f6 as ye,e as n,x as Q,f as V,z as ga,p as z,s as O}from"./index-aec7e708.js";import{u as Rt}from"./index-e8a45e82.js";import{c as xa}from"./Component-ed7aa0ab.js";import"./postmen-2f47f6bb.js";import{c as Sa}from"./createOnModelChange-b57a0da8.js";import{R as Ma}from"./ReferencedMaterial-5773c9d2.js";import"./TextureAsset-39fb07fe.js";import"./GlTFAsset-2723b84a.js";import"./MaterialAsset-6ef9b4ed.js";import{MeshAsset as Pa}from"./MeshAsset-ca9305e5.js";import"./AnimatorControllerAsset-21dc6332.js";import"./AnimationClipAsset-9167378a.js";import"./SpriteAsset-558ffca8.js";import"./SpriteAtlasAsset-cdc34386.js";import"./AmbientLightAsset-bdbc4e1d.js";import"./LottieAsset-3692580d.js";import"./ShaderChunkAsset-34116f2c.js";import"./SpineSkeletonDataAsset-27244892.js";import"./FontAsset-d1ced18d.js";import"./SceneAsset-385fa837.js";import"./ShaderAsset-f4514b03.js";import"./PrimitiveMesh-0572a073.js";import"./XRReferenceImageAsset-2f6ff226.js";import"./PrefabAsset-9179b95c.js";import"./PhysicsMaterialAsset-4a1e5ea3.js";import"./RenderTargetAsset-ab6e06d2.js";import"./AudioAsset-0c828c80.js";import"./index-78269e76.js";import"./MarkdownAsset-bcb90be4.js";import{B as tt}from"./index-fbe040bf.js";import"./MaterialInspector-e8242674.js";import"./IconPointFilled-811fc660.js";import"./enum-58295f88.js";import"./encode-ac4bb64e.js";import"./meshopt_simplifier.module-cd99529d.js";import"./Tooltip-82063435.js";import"./AssetViewer-64cd01fa.js";import"./ktx2-encoder-53b21bdc.js";import"./TaskQueue-05c94a4d.js";import"./glTFIO-79bbca27.js";import"./ProxyConfigs-3a5fd860.js";import"./index-74130ff3.js";import"./MeshThumbnail-ab28b3b8.js";import"./bundlers-9b0d37fc.js";import"./assetEditorActions-c4e5962f.js";import"./module-8816772d.js";import"./module-ffeaf99f.js";import"./FormItemArray-6d69acd4.js";import"./Accordion-3d330bc6.js";import"./IconEdit-ab77303f.js";import"./ShaderUIScriptAsset-fc503291.js";import"./module-220b3921.js";import"./Menu-0b8da92f.js";/**
2
+ * @license @tabler/icons-react v3.17.0 - MIT
3
+ *
4
+ * This source code is licensed under the MIT license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */var At=Re("outline","ease-in","IconEaseIn",[["path",{d:"M3 20c8 0 18 -16 18 -16",key:"svg-0"}]]);/**
7
+ * @license @tabler/icons-react v3.17.0 - MIT
8
+ *
9
+ * This source code is licensed under the MIT license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */var Vt=Re("outline","equal","IconEqual",[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}]]);/**
12
+ * @license @tabler/icons-react v3.17.0 - MIT
13
+ *
14
+ * This source code is licensed under the MIT license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */var kt=Re("outline","plus-minus","IconPlusMinus",[["path",{d:"M4 7h6",key:"svg-0"}],["path",{d:"M7 4v6",key:"svg-1"}],["path",{d:"M20 18h-6",key:"svg-2"}],["path",{d:"M5 19l14 -14",key:"svg-3"}]]);/**
17
+ * @license @tabler/icons-react v3.17.0 - MIT
18
+ *
19
+ * This source code is licensed under the MIT license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */var Bt=Re("outline","vector-bezier-2","IconVectorBezier2",[["path",{d:"M3 3m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z",key:"svg-0"}],["path",{d:"M17 17m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z",key:"svg-1"}],["path",{d:"M7 5l7 0",key:"svg-2"}],["path",{d:"M10 19l7 0",key:"svg-3"}],["path",{d:"M9 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}],["path",{d:"M15 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-5"}],["path",{d:"M7 5.5a5 6.5 0 0 1 5 6.5a5 6.5 0 0 0 5 6.5",key:"svg-6"}]]);const Ct=[{type:"constant",icon:T.jsx(Vt,{size:"14px"}),columns:"1fr 32px"},{type:"gradient",icon:T.jsx(At,{size:"14px"}),columns:"1fr 32px"},{type:"two-constant",icon:T.jsx(kt,{size:"14px"}),columns:"repeat(2, minmax(0, 12fr)) 32px"},{type:"two-gradient",icon:T.jsx(Bt,{size:"14px"}),columns:"repeat(2, minmax(0, 12fr)) 32px"}];function Ca(a){return a.map(e=>{const{type:t,value:r}=e;return t==="constant"?{type:t,label:e.label,value:ie(r)}:t==="two-constant"?{type:t,label:e.label,value:[ie(r[0]),ie(r[1])]}:t==="gradient"?{type:t,label:e.label,value:{color:r.color.map(o=>({value:ie(o.value),time:o.position})),alpha:r.alpha.map(o=>({value:o.value.a,time:o.position}))}}:t==="two-gradient"?{type:t,label:e.label,value:[{color:r[0].color.map(o=>({value:ie(o.value),time:o.position})),alpha:r[0].alpha.map(o=>({value:o.value.a,time:o.position}))},{color:r[1].color.map(o=>({value:ie(o.value),time:o.position})),alpha:r[1].alpha.map(o=>({value:o.value.a,time:o.position}))}]}:e})}function za(a){return a.map(e=>{const{type:t,value:r}=e;return t==="constant"?{type:t,label:e.label,value:le(r)}:t==="two-constant"?{type:t,label:e.label,value:[le(r[0]),le(r[1])]}:t==="gradient"?{type:t,label:e.label,value:{color:r.color.map(o=>({value:le(o.value),position:o.time})),alpha:r.alpha.map(o=>({value:{r:255,g:255,b:255,a:o.value},position:o.time}))}}:t==="two-gradient"?{type:t,label:e.label,value:[{color:r[0].color.map(o=>({value:le(o.value),position:o.time})),alpha:r[0].alpha.map(o=>({value:{r:255,g:255,b:255,a:o.value},position:o.time}))},{color:r[1].color.map(o=>({value:le(o.value),position:o.time})),alpha:r[1].alpha.map(o=>({value:{r:255,g:255,b:255,a:o.value},position:o.time}))}]}:e})}function at({hdr:a,value:e,onValueChange:t,...r}){return a?T.jsx(be,{...r,mode:"hdr",value:e,onValueChange:t}):T.jsx(be,{...r,mode:"constant",value:e,onValueChange:t})}function Dt(a){var d;const{label:e,labelFirst:t,info:r,value:o,hdr:i=!1}=a,[f,p]=we({prop:za(o),onChange:s=>{a.onValueChange&&a.onValueChange(Ca(s),M)}}),[M,v]=we({prop:a.type,defaultProp:"constant",onChange:s=>{a.onValueChange&&a.onValueChange(o,s)}});function m(s,b){var h;return b==="trigger"?(h=Ct.find(u=>u.type===s))==null?void 0:h.icon:s}const y=s=>{p(b=>b.map(h=>h.type!==M?h:{...h,value:s}))},P=s=>b=>{p(h=>h.map(u=>{if(u.type!==M)return u;const{value:j}=u;if(u.type==="two-constant"){if(s===0)return{...u,value:[b,j[1]]};if(s===1)return{...u,value:[j[0],b]}}return u}))},l=s=>{p(b=>b.map(h=>h.type!==M?h:h.type==="gradient"?{...h,value:s}:h))},c=s=>b=>{p(h=>h.map(u=>{if(u.type!==M)return u;if(u.type==="two-gradient"){const{value:j}=u;if(s===0)return{...u,value:[b,j[1]]};if(s===1)return{...u,value:[j[0],b]}}return u}))};return T.jsxs(ge,{label:e,info:r,fieldCss:{gridTemplateColumns:(d=Ct.find(s=>s.type===M))==null?void 0:d.columns},children:[f.map(s=>{const{type:b,value:h}=s;if(!b||M!==b)return null;switch(b){case"constant":return T.jsx(at,{fullsize:!0,hdr:i,value:h,onValueChange:y},"constant");case"gradient":return T.jsx(be,{fullsize:!0,mode:"particle",value:h,onValueChange:l},"gradient");case"two-constant":return T.jsxs(Ee.Fragment,{children:[T.jsx(at,{fullsize:!0,hdr:i,value:h[0],onValueChange:P(0)}),T.jsx(at,{fullsize:!0,hdr:i,value:h[1],onValueChange:P(1)})]},"two-constant");case"two-gradient":return T.jsxs(Ee.Fragment,{children:[T.jsx(be,{fullsize:!0,mode:"particle",value:h[0],onValueChange:c(0)}),T.jsx(be,{fullsize:!0,mode:"particle",value:h[1],onValueChange:c(1)})]},"two-gradient");default:return null}}),T.jsx(Tt,{defaultValue:"constant",position:"item-aligned",cornerArrow:!0,value:M,valueRenderer:m,onValueChange:s=>v(s),children:f.map(s=>T.jsx(jt,{value:s.type,children:s.label||s.type},s.type))})]})}const It=[{type:"constant",icon:T.jsx(Vt,{size:"14px"}),columns:"minmax(0, 12fr) 32px"},{type:"curve",icon:T.jsx(At,{size:"14px"}),columns:"minmax(0, 12fr) 32px"},{type:"two-constant",icon:T.jsx(kt,{size:"14px"}),columns:"repeat(2, minmax(0, 12fr)) 32px"},{type:"two-curve",icon:T.jsx(Bt,{size:"14px"}),columns:"repeat(2, minmax(0, 12fr)) 32px"}];function Oa(a,e){var t;return e==="trigger"?(t=It.find(r=>r.type===a))==null?void 0:t.icon:a}const rt=[{x:0,y:0},{x:.25,y:.25},{x:.75,y:.75},{x:1,y:1}];function Le(a){var E;const{label:e,info:t,value:r,onValueChange:o,algo:i="bezier",yRangeMode:f,yTickScale:p,yTickScaleMin:M,yTickScaleMax:v,onYTickScaleChange:m,onYTickScaleCommit:y,hideTypeSelector:P,...l}=a,[c,d]=we({prop:a.type,defaultProp:"constant",onChange:w=>{o&&o(r,w)}}),[s,b]=we({prop:r,onChange:w=>{o&&o(w,c)},defaultProp:[{value:0,type:"constant"},{value:rt,type:"curve"},{value:[0,0],type:"two-constant"},{value:[rt,rt],type:"two-curve"}]}),h=w=>{b(k=>k.map(L=>L.type!==c?L:{...L,value:w}))},u=w=>k=>{b(L=>L.map(B=>{if(B.type!==c)return B;const{value:X}=B;return w===0?{...B,value:[k,X[1]]}:w===1?{...B,value:[X[0],k]}:B}))},j=w=>{b(k=>k.map(L=>L.type!==c?L:{...L,value:w}))},_=w=>k=>{b(L=>L.map(B=>{if(B.type!==c)return B;const{value:X}=B;return w===0?{...B,value:[k,X[1]]}:w===1?{...B,value:[X[0],k]}:B}))},F={algo:i,yRangeMode:f,yTickScale:p,yTickScaleMin:M,yTickScaleMax:v,onYTickScaleChange:m,onYTickScaleCommit:y};return T.jsxs(ge,{label:e,info:t,fieldCss:{gridTemplateColumns:(E=It.find(w=>w.type===c))==null?void 0:E.columns,columnGap:"$1"},...l,children:[s.map(w=>{const{type:k,value:L,min:B,max:X,step:J}=w;if(!k||c!==k)return null;switch(k){case"constant":return T.jsx(Ce,{min:B,max:X,dragStep:J,step:J,value:L,onValueChange:h},"constant");case"curve":return T.jsx(tt,{...F,value:L,onChange:j},"curve");case"two-constant":return T.jsxs(Ee.Fragment,{children:[T.jsx(Ce,{size:"sm",startSlot:"min",value:L[0],min:B,max:X,dragStep:J,step:J,onValueChange:u(0)}),T.jsx(Ce,{size:"sm",startSlot:"max",value:L[1],min:B,max:X,dragStep:J,step:J,onValueChange:u(1)})]},"two-constant");case"two-curve":return T.jsxs(Ee.Fragment,{children:[T.jsx(tt,{...F,value:L[0],onChange:_(0)}),T.jsx(tt,{...F,value:L[1],onChange:_(1)})]},"two-curve");default:return null}}),!P&&T.jsx(Tt,{value:c,position:"item-aligned",cornerArrow:!0,valueRenderer:Oa,onValueChange:w=>d(w),children:s.map(w=>T.jsx(jt,{value:w.type,children:w.label||w.type},w.type))})]})}/**
22
+ * @license @tabler/icons-react v3.24.0 - MIT
23
+ *
24
+ * This source code is licensed under the MIT license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */var wa=Qt("filled","triangle-inverted-filled","IconTriangleInvertedFilled",[["path",{d:"M20.118 3h-16.225a2.914 2.914 0 0 0 -2.503 4.371l8.116 13.549a2.917 2.917 0 0 0 4.987 .005l8.11 -13.539a2.914 2.914 0 0 0 -2.486 -4.386z",key:"svg-0"}]]);const Ea=Z(function(a){const[e,t]=$.useState(null),r=a.data,{assetStore:o,inspectorFacade:i}=Rt();return $.useEffect(()=>{o.getAssetByRef(r.material).then(f=>{t(f)})},[r.material]),C.jsxs(C.Fragment,{children:[C.jsx(ea.List,{model:r,configs:r.formSchema.items,onModelChange:Sa("component",r.id,i,r)}),e&&C.jsx(Ma,{materialAsset:e})]})});ta(wa,{height:"6px",width:"6px",transform:"rotate(-90deg)",variants:{open:{true:{transform:"rotate(0)"}}}});const Ta=function(e){const{title:t,controlOpenKey:r,onCheckedChange:o,model:i}=e;return C.jsxs(Lt,{align:"v",gap:"xs",css:{borderTop:"1px solid $gray4",paddingTop:"$1_5"},justifyContent:"between",children:[C.jsx(aa,{size:"sm",muted:!0,children:t}),C.jsx(ra,{checked:i[r],onCheckedChange:o})]})},ja=Z(Ta);async function La(a,e){await a.assetStore.getAssetByRef(e)}function _a(a,e,t,r){a.inspectorFacade.componentChange(e,t,r)}var D=(a=>(a.BoxShape="BoxShape",a.CircleShape="CircleShape",a.ConeShape="ConeShape",a.HemisphereShape="HemisphereShape",a.SphereShape="SphereShape",a.MeshShape="MeshShape",a))(D||{});function U(a,e){return{class:a.class,props:{...a.props,...e}}}const Ra=Z(({item:a,onModelChange:e})=>{const{t}=G();return C.jsx(C.Fragment,{children:C.jsx(oa,{label:t("effects.shape.size"),value:{x:a.props.size.x,y:a.props.size.y,z:a.props.size.z},onChange:(r,o)=>{const i=U(a,{size:{...a.props.size,[o]:r[o]}});e==null||e("shape",i)}})})}),Aa=Z(({item:a,onModelChange:e})=>{const{t}=G();return C.jsxs(C.Fragment,{children:[C.jsx(te,{label:t("effects.shape.radius"),min:1e-4,step:.05,dragStep:.05,value:a.props.radius,onChange:r=>{const o=U(a,{radius:r});e==null||e("shape",o)}}),C.jsx(te,{label:t("effects.shape.arc"),min:0,max:360,value:a.props.arc,onChange:r=>{const o=U(a,{arc:r});e==null||e("shape",o)}}),C.jsx(st,{label:t("effects.shape.arc-mode.label"),options:[{label:t("effects.shape.loop"),value:ze.Loop},{label:t("effects.shape.random"),value:ze.Random}],value:a.props.arcMode,onChange:r=>{const o=U(a,{arcMode:r});e==null||e("shape",o)}}),a.props.arcMode===ze.Loop?C.jsx(te,{label:t("effects.shape.arc-speed.label"),step:.1,dragStep:.1,value:a.props.arcSpeed,onChange:r=>{const o=U(a,{arcSpeed:r});e==null||e("shape",o)}}):null]})}),Va=Z(({item:a,onModelChange:e})=>{const{t}=G();return C.jsxs(C.Fragment,{children:[C.jsx(st,{label:t("effects.shape.emit-type.label"),options:[{label:t("effects.shape.cone-base"),value:me.Base},{label:t("effects.shape.volume"),value:me.Volume}],value:a.props.emitType,onChange:r=>{const o=U(a,{emitType:r});e==null||e("shape",o)}}),C.jsx(te,{label:t("effects.shape.angle"),min:1e-4,max:90,step:.05,dragStep:.05,value:a.props.angle,onChange:r=>{const o=U(a,{angle:r});e==null||e("shape",o)}}),C.jsx(te,{label:t("effects.shape.radius"),min:1e-4,step:.05,dragStep:.05,value:a.props.radius,onChange:r=>{const o=U(a,{radius:r});e==null||e("shape",o)}}),C.jsx(te,{label:t("effects.shape.length"),min:1e-4,step:.1,dragStep:.1,value:a.props.length,disabled:a.props.emitType===me.Base,onChange:r=>{const o=U(a,{length:r});e==null||e("shape",o)}})]})}),ka=Z(({item:a,onModelChange:e})=>{const{t}=G();return C.jsx(C.Fragment,{children:C.jsx(te,{label:t("effects.shape.radius"),min:1e-4,step:.05,dragStep:.05,value:a.props.radius,onChange:r=>{const o=U(a,{radius:r});e==null||e("shape",o)}})})}),Ba=Z(({item:a,onModelChange:e})=>{const{t}=G();return C.jsx(C.Fragment,{children:C.jsx(te,{label:t("effects.shape.radius"),min:1e-4,step:.05,dragStep:.05,value:a.props.radius,onChange:r=>{const o=U(a,{radius:r});e==null||e("shape",o)}})})}),Da=Z(({item:a,onModelChange:e})=>{const{t}=G(),{assetStore:r}=Rt(),o=Object.values(r.assets).filter(p=>p instanceof Pa),[i,f]=$.useState("");return $.useEffect(()=>{let p=!1;return(async()=>{if(!a.props.mesh){f("");return}try{const v=await r.getAssetByRef(a.props.mesh);p||f((v==null?void 0:v.name)??"")}catch{p||f("")}})(),()=>{p=!0}},[r,a.props.mesh]),C.jsx(na,{label:t("effects.renderer.render-mode.options.mesh"),assets:o,dropLayer:0,value:i,onSelect:async p=>{f(p.name);const M=!!p.engineObject;M||sa.error("Mesh asset is not initialized");const v={class:a.class,props:{...a.props,mesh:p.getCurrentRef(),enabled:M}};e==null||e("shape",v)}})}),Ia=Z(({item:a,onModelChange:e})=>{const{t}=G();return C.jsx(te,{label:t("effects.shape.random-direction-amount"),info:t("effects.shape.random-direction-amount-tip"),min:0,step:1,dragStep:.05,value:a.props.randomDirectionAmount||0,onChange:r=>{const o=U(a,{randomDirectionAmount:r});e==null||e("shape",o)}})}),nt=new Map;function Fa(a,e){let t;switch(e.class){case D.BoxShape:{t=new ma;const r=t.size;r.copyFrom(e.props.size),t.size=r;break}case D.CircleShape:{t=new ua,t.radius=e.props.radius,t.arc=e.props.arc,t.arcMode=e.props.arcMode,t.arcSpeed=e.props.arcSpeed;break}case D.ConeShape:{t=new pa,t.angle=e.props.angle,t.radius=e.props.radius,t.length=e.props.length,t.emitType=e.props.emitType;break}case D.HemisphereShape:{t=new ca,t.radius=e.props.radius;break}case D.SphereShape:{t=new la,t.radius=e.props.radius;break}case D.MeshShape:{t=new ia;const r=e.props.mesh;if(r!=null&&r.refId){const o=a.root.assetStore.assets[r.refId];t.mesh=o==null?void 0:o.engineObject}t.mesh||(t.mesh=_t.createSphere(a.engineObject.engine));break}}return t&&(e.props.randomDirectionAmount=e.props.randomDirectionAmount??0,t.randomDirectionAmount=e.props.randomDirectionAmount,t.enabled=e.props.enabled),t}const Ya=(a,e,t)=>{let r=nt.get(`${a.id}-${t.class}`);r&&(r=JSON.parse(r),nt.delete(`${a.id}-${t.class}`),Object.assign(t.props,r));const o=Fa(a,t);o&&a.applyEmissionShape(o)},Za={BoxShape:Ra,CircleShape:Aa,ConeShape:Va,HemisphereShape:ka,SphereShape:Ba,MeshShape:Da},Xa={BoxShape:{class:D.BoxShape,props:{size:{x:1,y:1,z:1},randomDirectionAmount:0,enabled:!0}},CircleShape:{class:D.CircleShape,props:{radius:1,arc:360,arcMode:ze.Random,arcSpeed:1,randomDirectionAmount:0,enabled:!0}},ConeShape:{class:D.ConeShape,props:{angle:25,radius:1,length:5,emitType:me.Base,randomDirectionAmount:0,enabled:!0}},HemisphereShape:{class:D.HemisphereShape,props:{radius:1,randomDirectionAmount:0,enabled:!0}},SphereShape:{class:D.SphereShape,props:{radius:1,randomDirectionAmount:0,enabled:!0}},MeshShape:{class:D.MeshShape,props:{randomDirectionAmount:0,enabled:!0,mesh:void 0}}},$a=Z(({model:a,onModelChange:e})=>{const{t}=G(),r=a.shape;if(!r.class)return;const o=Za[r.class];return C.jsxs(C.Fragment,{children:[C.jsx(st,{label:t("effects.shape.type.label"),info:t("effects.shape.type.info"),value:r.class,options:[{label:t("effects.shape.options.box"),value:D.BoxShape},{label:t("effects.shape.options.circle"),value:D.CircleShape},{label:t("effects.shape.options.cone"),value:D.ConeShape},{label:t("effects.shape.options.hemisphere"),value:D.HemisphereShape},{label:t("effects.shape.options.sphere"),value:D.SphereShape},{label:t("effects.shape.options.mesh"),value:D.MeshShape}],onChange:i=>{const f=Xa[i];if(a.shape&&a.shape.class!==i&&nt.set(`${a.id}-${a.shape.class}`,JSON.stringify(a.shape.props)),f.class!==r.class){const p=R(f);e==null||e("shape",p)}}}),C.jsx(o,{item:r,component:a.engineObject,onModelChange:e}),C.jsx(Ia,{item:r,component:a.engineObject,onModelChange:e})]})}),it=["constant","two-constant","curve","two-curve"],ae=[{x:0,y:0},{x:.25,y:.25},{x:.75,y:.75},{x:1,y:1}];function _e(a){return a.map(e=>({x:e.constructParams[0],y:e.constructParams[1]}))}const zt={class:"ParticleCurve",constructParams:[{class:"CurveKey",constructParams:[0,0]},{class:"CurveKey",constructParams:[.25,.25]},{class:"CurveKey",constructParams:[.75,.75]},{class:"CurveKey",constructParams:[1,1]}]};function I(a,e=0,t=0,r=q.Constant){return{module:a,mode:r,constantMin:t,constantMax:e,curveMax:R(zt),curveMin:R(zt)}}function ce(a,e=0,t=0,r=q.Constant){return{enabled:!1,x:I(a,e,t,r),y:I(a,e,t,r),z:I(a,e,t,r)}}const qa={class:"Burst",constructParams:[0,{class:"ParticleCompositeCurve",constructParams:[15],props:{mode:q.Constant,constantMax:15,constantMin:0}}]},Ga=Z(({model:a,inspectorConfig:e,onModelChange:t})=>{const{t:r}=G(),{label:o,info:i}=e,f=a.bursts,p=l=>{const c=R(f);l(c),t==null||t("bursts",c)},M=(l,c)=>{p(d=>{const s=d[l];s&&c(s)})},v=l=>{const c=f.indexOf(l);c!==-1&&p(d=>{d.splice(c,1)})},m=()=>{p(l=>{l.push(R(qa))})},y=[{title:r("effects.burst.time.label")},{title:r("effects.burst.count.label")}],P=(l,c)=>{const d=Math.max(1,l.constructParams[1].props.constantMax??0,l.constructParams[1].props.constantMin??0);return{data:l,cells:[C.jsx(ge,{children:C.jsx(Ce,{min:0,max:a.duration,step:.05,dragStep:.05,value:l.constructParams[0],onValueChange:s=>{M(c,b=>{b.constructParams[0]=s})}})},`time-${c}`),C.jsx(Le,{type:it[l.constructParams[1].props.mode],direction:"column",algo:"bezier",yRangeMode:"positive",yTickScale:d,yTickScaleMin:0,yTickScaleMax:d,onYTickScaleChange:()=>{},onYTickScaleCommit:()=>{},value:[{value:l.constructParams[1].props.constantMax,type:"constant",min:0,step:1},{value:[l.constructParams[1].props.constantMin,l.constructParams[1].props.constantMax],type:"two-constant",min:0,step:1}],onValueChange:(s,b)=>{const h=s.find(u=>u.type===b);h&&M(c,u=>{switch(b){case"constant":{u.constructParams[1].props.mode=q.Constant,u.constructParams[1].props.constantMax=h.value;break}case"two-constant":{u.constructParams[1].props.mode=q.TwoConstants,u.constructParams[1].props.constantMin=h.value[0],u.constructParams[1].props.constantMax=h.value[1];break}}})}},`count-${c}`)]}};return C.jsx(da,{columns:y,items:f.map((l,c)=>P(l,c)),label:r(o),info:r(i),addable:!0,onAdd:m,onDelete:v,addText:r("effects.burst.add"),emptyText:r("effects.burst.empty","No bursts")})}),Ka=(a,e,t)=>{const r=a.engineObject.generator.emission,o=r.bursts;for(let i=o.length-1;i>=0;i--)r.removeBurst(o[i]);for(let i=0;i<t.length;i++){const f=t[i];if(!f||!f.constructParams||!Array.isArray(f.constructParams)||f.constructParams.length<2){console.warn(`Invalid burst item at index ${i}:`,f);continue}const p=f.constructParams[0],M=f.constructParams[1];if(!M||!M.props){console.warn(`Invalid burst count data at index ${i}:`,M);continue}const v=M.props,m=new ha(v.constantMax);m.mode=v.mode,m.constantMin=v.constantMin,m.constantMax=v.constantMax,m.constant=v.constantMax,r.addBurst(new fa(p,m))}};function Ot(a="colorOverLifetime"){return{module:a,mode:de.Gradient,gradientMax:{class:"ParticleGradient",constructParams:[[{color:{r:1,g:1,b:1,a:1},time:0},{color:{r:1,g:1,b:1,a:1},time:.3},{color:{r:1,g:1,b:1,a:1},time:.6},{color:{r:1,g:1,b:1,a:1},time:1}],[{time:0,alpha:0},{time:.25,alpha:.25},{time:.5,alpha:.5},{time:1,alpha:1}]]},gradientMin:{class:"ParticleGradient",constructParams:[[{time:0,color:{r:1,g:1,b:1,a:1}},{time:.3,color:{r:1,g:1,b:1,a:1}},{time:.6,color:{r:1,g:1,b:1,a:1}},{time:1,color:{r:1,g:1,b:1,a:1}}],[{time:0,alpha:0},{time:.25,alpha:.25},{time:.5,alpha:.5},{time:1,alpha:1}]]}}}const Pe=["x","y","z"],Na={constant:q.Constant,"two-constant":q.TwoConstants,curve:q.Curve,"two-curve":q.TwoCurves},he=Z(({model:a,inspectorConfig:e,onModelChange:t})=>{const{t:r}=G(),o=e.property,{mainAxis:i}=e,f=a[o],[p,M]=$.useState({x:{max:ae,min:ae},y:{max:ae,min:ae},z:{max:ae,min:ae}}),[v,m]=$.useState(e.yTickScale??1),y=it[f.x.mode];function P(s){return(b,h)=>{const u=b.find(E=>E.type===h);if(!u)return;const j=R(f),_=j[s],F=Na[h];for(const E of Pe)j[E].mode=F;switch(h){case"constant":_.constantMax=u.value;break;case"two-constant":_.constantMin=u.value[0],_.constantMax=u.value[1];break;case"curve":{if(u.value.length>4)return;M(E=>({...E,[s]:{...E[s],max:u.value}})),u.value.forEach((E,w)=>{_.curveMax.constructParams[w].constructParams[0]=E.x,_.curveMax.constructParams[w].constructParams[1]=E.y*v});break}case"two-curve":{if(u.value[0].length>4||u.value[1].length>4)return;M(E=>({...E,[s]:{min:u.value[0],max:u.value[1]}})),u.value[0].forEach((E,w)=>{_.curveMin.constructParams[w].constructParams[0]=E.x,_.curveMin.constructParams[w].constructParams[1]=E.y*v}),u.value[1].forEach((E,w)=>{_.curveMax.constructParams[w].constructParams[0]=E.x,_.curveMax.constructParams[w].constructParams[1]=E.y*v});break}}a[o]=j,t==null||t(o,j)}}function l(s){return[{value:f[s].constantMax,type:"constant",label:r("effects.curve.constant"),min:e.min,max:e.max,step:e.step},{value:[f[s].constantMin,f[s].constantMax],type:"two-constant",label:r("effects.curve.two-constant"),min:e.min,max:e.max,step:e.step},{value:p[s].max,type:"curve",label:r("effects.curve.curve")},{value:[p[s].min,p[s].max],type:"two-curve",label:r("effects.curve.two-curve")}]}const c=s=>{const b=s/v,h=R(f);for(const u of Pe){const j=h[u];j.curveMax.constructParams.forEach(_=>{_.constructParams[1]*=b}),j.curveMin.constructParams.forEach(_=>{_.constructParams[1]*=b})}m(s),a[o]=h,t==null||t(o,h)},d={algo:"linear",yRangeMode:e.yRangeMode,yTickScale:v,yTickScaleMin:e.yTickScaleMin,yTickScaleMax:e.yTickScaleMax,onYTickScaleChange:c,onYTickScaleCommit:()=>{}};return $.useEffect(()=>{const s={};for(const b of Pe)s[b]={max:_e(f[b].curveMax.constructParams).map(h=>({...h,y:h.y/v})),min:_e(f[b].curveMin.constructParams).map(h=>({...h,y:h.y/v}))};M(s)},[]),C.jsxs(C.Fragment,{children:[C.jsx(ya,{label:e.toggleLabel?r(e.toggleLabel):r("effects.curve.3d-prefix")+" "+r(e.label||o),info:r(e.info),value:f.enabled,onChange:s=>{const b=R(f);b.enabled=s,a[o]=b,t==null||t(o,b)}}),f.enabled?C.jsx(ge,{label:"",children:C.jsx(Lt,{direction:"column",gap:"xxs",children:Pe.map((s,b)=>C.jsx(Le,{label:r(s).toLocaleUpperCase(),type:y,css:{gridTemplateColumns:"$4 repeat(3, minmax(0px, 1fr))"},...d,value:l(s),hideTypeSelector:b!==0,onValueChange:P(s)},s))})}):C.jsx(Le,{label:r(e.label||o),type:y,...d,value:l(i),onValueChange:P(i)})]})}),fe=a=>(e,t,r)=>{var f,p;const o=(p=(f=e.engineObject)==null?void 0:f.generator)==null?void 0:p[r.x.module];if(!o){console.warn(`Module container not found for: ${r.x.module}`);return}o[a]=r.enabled;const i={x:o[t+"X"],y:o[t+"Y"],z:o[t+"Z"]};for(const M in i){const v=r[M],m=i[M];if(!m){console.warn(`Axis module not found for: ${M} in ${t}`);continue}m.mode=v.mode,m.constantMax=v.constantMax,m.constantMin=v.constantMin,m.curveMax=new Te,v.curveMax.constructParams.forEach(y=>{const P=y.constructParams[0],l=y.constructParams[1];m.curveMax.addKey(new je(P,l))}),m.curveMin=new Te,v.curveMin.constructParams.forEach(y=>{const P=y.constructParams[0],l=y.constructParams[1];m.curveMin.addKey(new je(P,l))})}},K=Z(({model:a,inspectorConfig:e,onModelChange:t})=>{const{t:r}=G(),o=e.property,i=a[o],[f,p]=$.useState(ae),[M,v]=$.useState(ae),[m,y]=$.useState(e.yTickScale??1);$.useEffect(()=>{const l=_e(i.curveMax.constructParams),c=_e(i.curveMin.constructParams);p(l),v(c)},[]);const P=(l,c)=>{const d=l.find(b=>b.type===c);if(!d)return;const s=R(i);switch(c){case"constant":s.mode=q.Constant,s.constantMax=d.value;break;case"two-constant":s.mode=q.TwoConstants,s.constantMin=d.value[0],s.constantMax=d.value[1];break;case"curve":{if(d.value.length>4)return;p(d.value),s.mode=q.Curve,d.value.forEach((b,h)=>{s.curveMax.constructParams[h].constructParams[0]=b.x,s.curveMax.constructParams[h].constructParams[1]=b.y});break}case"two-curve":{if(d.value[0].length>4||d.value[1].length>4)return;s.mode=q.TwoCurves,v(d.value[0]),p(d.value[1]),d.value[0].forEach((b,h)=>{s.curveMin.constructParams[h].constructParams[0]=b.x,s.curveMin.constructParams[h].constructParams[1]=b.y}),d.value[1].forEach((b,h)=>{s.curveMax.constructParams[h].constructParams[0]=b.x,s.curveMax.constructParams[h].constructParams[1]=b.y});break}}a[o]=s,t==null||t(o,s)};return C.jsx(C.Fragment,{children:C.jsx(Le,{label:r(e.label||e.property),info:r(e.info),type:it[i.mode],algo:"linear",yRangeMode:e.yRangeMode,yTickScale:m,yTickScaleMin:e.yTickScaleMin,yTickScaleMax:e.yTickScaleMax,onYTickScaleChange:y,onYTickScaleCommit:()=>{},value:[{value:i.constantMax,type:"constant",label:r("effects.curve.constant"),min:e.min,max:e.max,step:e.step},{value:[i.constantMin,i.constantMax],type:"two-constant",label:r("effects.curve.two-constant"),min:e.min,max:e.max,step:e.step},{value:f,type:"curve",label:r("effects.curve.curve")},{value:[M,f],type:"two-curve",label:r("effects.curve.two-curve")}],onValueChange:P})})}),N=(a,e,t)=>{var i,f;const r=(f=(i=a.engineObject)==null?void 0:i.generator)==null?void 0:f[t.module];if(!r){console.warn(`Module container not found for: ${t.module}`);return}const o=r[e];if(!o){console.warn(`Module not found for property: ${e} in ${t.module}`);return}o.mode=t.mode,o.constantMax=t.constantMax,o.constantMin=t.constantMin,o.curveMax=new Te,t.curveMax.constructParams.forEach(p=>{const M=p.constructParams[0],v=p.constructParams[1];o.curveMax.addKey(new je(M,v))}),o.curveMin=new Te,t.curveMin.constructParams.forEach(p=>{const M=p.constructParams[0],v=p.constructParams[1];o.curveMin.addKey(new je(M,v))})},Ha=["constant","two-constant"],Wa=Z(({model:a,inspectorConfig:e,onModelChange:t})=>{var v,m;const{t:r}=G(),o=e.property,i=a[o],f={...ve(i.constantMax),intensity:((v=i.constantMax)==null?void 0:v.intensity)??1},p={...ve(i.constantMin),intensity:((m=i.constantMin)==null?void 0:m.intensity)??1},M=(y,P)=>{const l=y.find(d=>d.type===P);if(!l)return;const c=R(i);switch(P){case"constant":{c.mode=de.Constant,c.constantMax=l.value;break}case"two-constant":{const d=l.value[0],s=l.value[1];c.mode=de.TwoConstants,c.constantMin=d,c.constantMax=s;break}}a[o]=c,t==null||t(o,c)};return C.jsx(Dt,{label:r(e.label||e.property),type:Ha[i.mode],info:r(e.info),hdr:!0,value:[{value:f,type:"constant",label:r("effects.curve.constant")},{value:[p,f],type:"two-constant",label:r("effects.curve.two-constant")}],onValueChange:M})}),Ua=(a,e,t)=>{const r=a.engineObject.generator.main.startColor;r.mode=t.mode;const{constantMax:o,constantMin:i}=t,f=o.intensity??1,p=i.intensity??1;r.constantMax.set(o.r*f,o.g*f,o.b*f,o.a),r.constantMin.set(i.r*p,i.g*p,i.b*p,i.a)},Ja=["gradient","two-gradient"],Qa=Z(({model:a,inspectorConfig:e,onModelChange:t})=>{const{t:r}=G(),o=e.property,i=a[o],f=(p,M)=>{var y,P;if(!p.find(l=>l.type===M))return;const m=R(i);switch(M){case"gradient":{const l=p.find(c=>c.type===M);if(!((y=l==null?void 0:l.value)!=null&&y.color)||!((P=l==null?void 0:l.value)!=null&&P.alpha)){console.warn(`Invalid gradient value structure for ${o}`);return}if(l.value.color.length>4||l.value.alpha.length>4)return;m.mode=de.Gradient,m.gradientMax.constructParams=[l.value.color.map(c=>({color:c.value,time:c.time})),l.value.alpha.map(c=>({alpha:c.value,time:c.time}))];break}case"two-gradient":{const l=p.find(c=>c.type===M);if(l.value[0].color.length>4||l.value[0].alpha.length>4||l.value[1].color.length>4||l.value[1].alpha.length>4)return;m.mode=de.TwoGradients,m.gradientMin.constructParams=[l.value[0].color.map(c=>({color:c.value,time:c.time})),l.value[0].alpha.map(c=>({alpha:c.value,time:c.time}))],m.gradientMax.constructParams=[l.value[1].color.map(c=>({color:c.value,time:c.time})),l.value[1].alpha.map(c=>({alpha:c.value,time:c.time}))];break}}a[o]=m,t==null||t(o,m)};return C.jsx(C.Fragment,{children:C.jsx(Dt,{label:r(e.property),type:Ja[i.mode-2],info:r(e.info),value:[{value:{color:i.gradientMax.constructParams[0].map(p=>({value:ve(p.color),time:p.time})),alpha:i.gradientMax.constructParams[1].map(p=>({value:p.alpha,time:p.time}))},type:"gradient",label:r("effects.curve.gradient")},{value:[{color:i.gradientMin.constructParams[0].map(p=>({value:ve(p.color),time:p.time})),alpha:i.gradientMin.constructParams[1].map(p=>({value:p.alpha,time:p.time}))},{color:i.gradientMax.constructParams[0].map(p=>({value:ve(p.color),time:p.time})),alpha:i.gradientMax.constructParams[1].map(p=>({value:p.alpha,time:p.time}))}],type:"two-gradient",label:r("effects.curve.two-gradient")}],onValueChange:f})})}),pe=[],ue=[],er=(a,e,t)=>{var M,v,m;const r=(v=(M=a.engineObject)==null?void 0:M.generator)==null?void 0:v[t.module];if(!r){console.warn(`Module container not found for: ${t.module}`);return}const o=r[e];if(!o){console.warn(`Module not found for property: ${e} in ${t.module}`);return}if(o.mode=t.mode,pe.length=0,ue.length=0,!((m=t.gradientMax)!=null&&m.constructParams)||!Array.isArray(t.gradientMax.constructParams)){console.warn(`Invalid gradientMax.constructParams for ${e}`);return}const i=t.gradientMax.constructParams,f=i[0]||[],p=i[1]||[];Array.isArray(f)&&f.forEach(y=>{if(y&&y.color&&typeof y.time=="number"){const P=y.color;pe.push(new St(y.time,new Mt(P.r??0,P.g??0,P.b??0,P.a??1)))}}),Array.isArray(p)&&p.forEach(y=>{y&&typeof y.time=="number"&&typeof y.alpha=="number"&&ue.push(new Pt(y.time,y.alpha))}),o.gradientMax.setKeys(pe,ue),pe.length=0,ue.length=0,t.gradientMin.constructParams[0].forEach(y=>{pe.push(new St(y.time,new Mt(y.color.r,y.color.g,y.color.b,y.color.a)))}),t.gradientMin.constructParams[1].forEach(y=>{ue.push(new Pt(y.time,y.alpha))}),o.gradientMin.setKeys(pe,ue)};function Oe(a){return a-Math.floor(a*(1/289))*289}function H(a){return Oe((34*a+1)*a)}function ot(a,e,t){const r=.16666666666666666,o=1/3,i=(a+e+t)*o,f=Math.floor(a+i),p=Math.floor(e+i),M=Math.floor(t+i),v=(f+p+M)*r,m=a-f+v,y=e-p+v,P=t-M+v;let l,c,d,s,b,h;m>=y?y>=P?(l=1,c=0,d=0,s=1,b=1,h=0):m>=P?(l=1,c=0,d=0,s=1,b=0,h=1):(l=0,c=0,d=1,s=1,b=0,h=1):y<P?(l=0,c=0,d=1,s=0,b=1,h=1):m<P?(l=0,c=1,d=0,s=0,b=1,h=1):(l=0,c=1,d=0,s=1,b=1,h=0);const u=m-l+r,j=y-c+r,_=P-d+r,F=m-s+o,E=y-b+o,w=P-h+o,k=m-.5,L=y-.5,B=P-.5,X=Oe(f),J=Oe(p),xe=Oe(M),Ft=H(H(H(xe)+J)+X),Yt=H(H(H(xe+d)+J+c)+X+l),Zt=H(H(H(xe+h)+J+b)+X+s),Xt=H(H(H(xe+1)+J+1)+X+1),Ae=.142857142857,lt=Ae*2-0,ct=Ae*.5-1,Ve=Ae*1-0;function Se(dt){const ht=dt-49*Math.floor(dt*Ve*Ve),ft=Math.floor(ht*Ve),Nt=Math.floor(ht-7*ft),yt=ft*lt+ct,bt=Nt*lt+ct,Me=1-Math.abs(yt)-Math.abs(bt),vt=yt,gt=bt,Ht=Math.floor(vt)*2+1,Wt=Math.floor(gt)*2+1,xt=-(Me<0?1:0),Je=vt+Ht*xt,Qe=gt+Wt*xt,et=1.79284291400159-.85373472095314*(Je*Je+Qe*Qe+Me*Me);return[Je*et,Qe*et,Me*et]}const re=Se(Ft),oe=Se(Yt),ne=Se(Zt),se=Se(Xt),ke=Math.max(.6-(m*m+y*y+P*P),0),Be=Math.max(.6-(u*u+j*j+_*_),0),De=Math.max(.6-(F*F+E*E+w*w),0),Ie=Math.max(.6-(k*k+L*L+B*B),0),Fe=ke*ke,Ye=Be*Be,Ze=De*De,Xe=Ie*Ie,$e=Fe*Fe,qe=Ye*Ye,Ge=Ze*Ze,Ke=Xe*Xe,$t=re[0]*m+re[1]*y+re[2]*P,qt=oe[0]*u+oe[1]*j+oe[2]*_,Gt=ne[0]*F+ne[1]*E+ne[2]*w,Kt=se[0]*k+se[1]*L+se[2]*B,Ne=Fe*ke*$t,He=Ye*Be*qt,We=Ze*De*Gt,Ue=Xe*Ie*Kt;let pt=-8*(Ne*m+He*u+We*F+Ue*k),ut=-8*(Ne*y+He*j+We*E+Ue*L),mt=-8*(Ne*P+He*_+We*w+Ue*B);return pt+=$e*re[0]+qe*oe[0]+Ge*ne[0]+Ke*se[0],ut+=$e*re[1]+qe*oe[1]+Ge*ne[1]+Ke*se[1],mt+=$e*re[2]+qe*oe[2]+Ge*ne[2]+Ke*se[2],[pt*42,ut*42,mt*42]}function wt(a,e,t){ot(t,e,a);const o=ot(a+100,t,e);return ot(e,a+100,t)[1]-o[2]}function tr(a,e,t,r,o,i,f){let p=wt(a*r,e*r,t*r),M=1,v=r,m=1;for(let y=1;y<o;y++)m*=f,v*=i,M+=m,p+=m*wt(a*v,e*v,t*v);return p/M}const ee=80,Et=5,ar=({model:a})=>{const e=$.useRef(null),t=$.useRef(0);return $.useEffect(()=>{const r=e.current;if(!r)return;const o=r.getContext("2d");if(!o)return;const i=ba(()=>{var c,d;const f=((d=(c=a.noiseStrength)==null?void 0:c.x)==null?void 0:d.constantMax)??1,p=a.noiseFrequency??.5,M=a.noiseScrollSpeed??0,v=a.noiseOctaveCount??1,m=a.noiseOctaveIntensityMultiplier??.5,y=a.noiseOctaveFrequencyMultiplier??2;cancelAnimationFrame(t.current);const P=performance.now(),l=s=>{const b=(s-P)/1e3*M,h=o.createImageData(ee,ee),u=h.data;for(let j=0;j<ee;j++){const _=(1-j/ee)*Et;for(let F=0;F<ee;F++){const E=F/ee*Et,w=tr(E,_,b,p,v,y,m),k=Math.max(0,Math.min(255,Math.round((w*f*(.5/7)+.5)*255))),L=(j*ee+F)*4;u[L]=k,u[L+1]=k,u[L+2]=k,u[L+3]=255}}o.putImageData(h,0,0),M>0&&(t.current=requestAnimationFrame(l))};t.current=requestAnimationFrame(l)});return()=>{cancelAnimationFrame(t.current),i()}},[a]),C.jsx(ge,{label:" ",labelCss:{visibility:"hidden"},children:C.jsxs("div",{style:{position:"relative",width:80,height:80},children:[C.jsx("canvas",{ref:e,width:ee,height:ee,style:{width:80,height:80,borderRadius:4,border:"1px solid var(--color-border-default, rgba(255,255,255,0.12))",display:"block"}}),C.jsx("span",{style:{position:"absolute",bottom:2,left:0,right:0,textAlign:"center",fontSize:9,color:"rgba(255,255,255,0.6)",textShadow:"0 1px 2px rgba(0,0,0,0.8)",pointerEvents:"none"},children:"Preview"})]})})};var rr=Object.defineProperty,or=Object.getOwnPropertyDescriptor,S=(a,e,t,r)=>{for(var o=r>1?void 0:r?or(e,t):e,i=a.length-1,f;i>=0;i--)(f=a[i])&&(o=(r?f(e,t,o):f(o))||o);return r&&o&&rr(e,t,o),o};let g=class extends va{constructor(e,t){super(e,t);x(this,"_emissionModuleEnabled",!0);x(this,"_emissionShapeModuleEnabled",!0);x(this,"_rotationOverLifetimeModuleEnabled",!1);x(this,"_sizeOverLifetimeModuleEnabled",!1);x(this,"_textureSheetAnimationModuleEnabled",!1);x(this,"_velocityOverLifetimeModuleEnabled",!1);x(this,"_forceOverLifetimeModuleEnabled",!1);x(this,"_limitVelocityOverLifetimeModuleEnabled",!1);x(this,"_colorOverLifetimeModuleEnabled",!1);x(this,"_noiseModuleEnabled",!1);x(this,"material",{refId:"0000202"});x(this,"priority",0);x(this,"velocityScale",0);x(this,"lengthScale",2);x(this,"pivot",{x:0,y:0,z:0});x(this,"renderMode",W.Billboard);x(this,"mesh",null);x(this,"duration",5);x(this,"isLoop",!0);x(this,"startDelay",I("main"));x(this,"startLifetime",I("main",5));x(this,"startSpeed",I("main",5));x(this,"startSize",ce("main",1));x(this,"startRotation",ce("main"));x(this,"flipRotation",0);x(this,"startColor",{module:"main",mode:de.Constant,constantMax:{r:1,g:1,b:1,a:1,intensity:1},constantMin:{r:1,g:1,b:1,a:1,intensity:1}});x(this,"gravityModifier",I("main"));x(this,"simulationSpace",Y.Local);x(this,"simulationSpeed",1);x(this,"scalingMode",ye.Local);x(this,"playOnEnabled",!0);x(this,"maxParticles",1e3);x(this,"rateOverTime",I("emission",10));x(this,"shape",{class:D.ConeShape,props:{angle:25,radius:1,length:5,emitType:me.Base,enabled:!0}});x(this,"bursts",[]);x(this,"size",ce("sizeOverLifetime",1));x(this,"rotation",ce("rotationOverLifetime",45));x(this,"textureSheetAnimationType",0);x(this,"cycleCount",1);x(this,"tiling",{x:1,y:1});x(this,"frameOverTime",I("textureSheetAnimation",1,0,q.Curve));x(this,"spaceMode",Y.Local);x(this,"forceSpaceMode",Y.Local);x(this,"velocityX",I("velocityOverLifetime"));x(this,"velocityY",I("velocityOverLifetime"));x(this,"velocityZ",I("velocityOverLifetime"));x(this,"speed",ce("limitVelocityOverLifetime",1));x(this,"limitVelocitySpaceMode",Y.Local);x(this,"dampen",0);x(this,"drag",I("limitVelocityOverLifetime"));x(this,"multiplyDragByParticleSize",!1);x(this,"multiplyDragByParticleVelocity",!1);x(this,"forceX",I("forceOverLifetime"));x(this,"forceY",I("forceOverLifetime"));x(this,"forceZ",I("forceOverLifetime"));x(this,"color",Ot());x(this,"noisePreview",null);x(this,"noiseStrength",ce("noise",1));x(this,"noiseFrequency",.5);x(this,"noiseScrollSpeed",0);x(this,"noiseOctaveCount",1);x(this,"noiseOctaveIntensityMultiplier",.5);x(this,"noiseOctaveFrequencyMultiplier",2);const r=this.formSchema;r.addGroup(n("effects.renderer.sections.main"),["duration","isLoop","startDelay","startLifetime","startSpeed","startSize","startRotation","flipRotation","startColor","gravityModifier","simulationSpace","simulationSpeed","scalingMode","playOnEnabled","maxParticles"]);const o=(i,f,p,M,v)=>{r.addGroup(n(i),f,{collapsible:!1,controlOpenKey:p,customTitle:C.jsx(ja,{model:this,title:n(i),controlOpenKey:p,onCheckedChange:m=>{v==null||v(m),_a(this.root,this.id,p,m),this.applyBoundPathChange(M,A.Toggle,m)}})})};o("effects.renderer.sections.emission",["rateOverTime","bursts"],"_emissionModuleEnabled","generator.emission.enabled"),o("effects.renderer.sections.shape",["shape"],"_emissionShapeModuleEnabled","generator.emission.shape.enabled",i=>{this.shape.props.enabled=i}),o("effects.renderer.sections.size-over-lifetime",["size"],"_sizeOverLifetimeModuleEnabled","generator.sizeOverLifetime.enabled"),o("effects.renderer.sections.rotation-over-lifetime",["rotation"],"_rotationOverLifetimeModuleEnabled","generator.rotationOverLifetime.enabled"),o("effects.renderer.sections.force-over-lifetime",["forceSpaceMode","forceX","forceY","forceZ"],"_forceOverLifetimeModuleEnabled","generator.forceOverLifetime.enabled"),o("effects.renderer.sections.velocity-over-lifetime",["spaceMode","velocityX","velocityY","velocityZ"],"_velocityOverLifetimeModuleEnabled","generator.velocityOverLifetime.enabled"),o("effects.renderer.sections.limit-velocity-over-lifetime",["speed","limitVelocitySpaceMode","dampen","drag","multiplyDragByParticleSize","multiplyDragByParticleVelocity"],"_limitVelocityOverLifetimeModuleEnabled","generator.limitVelocityOverLifetime.enabled"),o("effects.renderer.sections.texture-sheet-animation",["textureSheetAnimationType","cycleCount","tiling","frameOverTime"],"_textureSheetAnimationModuleEnabled","generator.textureSheetAnimation.enabled"),o("effects.renderer.sections.color-over-lifetime",["color"],"_colorOverLifetimeModuleEnabled","generator.colorOverLifetime.enabled"),o("effects.renderer.sections.noise",["noisePreview","noiseStrength","noiseFrequency","noiseScrollSpeed","noiseOctaveCount","noiseOctaveIntensityMultiplier","noiseOctaveFrequencyMultiplier"],"_noiseModuleEnabled","generator.noise.enabled"),r.addGroup(n("effects.renderer.sections.rendering"),["renderMode","mesh","material","velocityScale","lengthScale","pivot","priority"])}applyEmissionShape(e){this.applyBoundPathChange("generator.emission.shape",A.Input,e)}onInitComplete(){const{_engineObject:{generator:e}}=this;if(this.applyBoundPathChange("enabled",A.Toggle,this._enabled),this.applyBoundPathChange("renderMode",A.Select,this.renderMode),e.emission.enabled=this._emissionModuleEnabled,e.emission.shape.enabled=this._emissionShapeModuleEnabled,this.shape.class===D.MeshShape){const t=e.emission.shape,r=this.shape.props.mesh;r?(t.enabled=!1,La(this.root,r).then(()=>{this.applyBoundPathChange("generator.emission.shape.mesh",A.AssetPicker,r),t.enabled=this._emissionShapeModuleEnabled})):this.applyBoundPathChange("generator.emission.shape.mesh",A.Input,_t.createSphere(this.engineObject.engine))}e.rotationOverLifetime.enabled=this._rotationOverLifetimeModuleEnabled,e.sizeOverLifetime.enabled=this._sizeOverLifetimeModuleEnabled,e.textureSheetAnimation.enabled=this._textureSheetAnimationModuleEnabled,e.velocityOverLifetime.enabled=this._velocityOverLifetimeModuleEnabled,e.limitVelocityOverLifetime.enabled=this._limitVelocityOverLifetimeModuleEnabled,e.forceOverLifetime.enabled=this._forceOverLifetimeModuleEnabled,e.main.simulationSpeed=0,e.colorOverLifetime.enabled=this._colorOverLifetimeModuleEnabled,e.noise.enabled=this._noiseModuleEnabled,this.renderMode===W.Mesh&&this._applyRendererMeshFromRef()}_applyRendererMeshFromRef(){this.applyBoundPathChange("mesh",A.AssetPicker,this.mesh??null)}async bindEngineObject(e){e.enabled=!1,await super.bindEngineObject(e)}deserialize(e){var r,o,i,f,p,M;if(this._enabled=((r=e.props)==null?void 0:r.enabled)??!0,(o=e.props)!=null&&o.generator){const{props:v}=e;this.priority=v.priority??this.priority,this.velocityScale=v.velocityScale??this.velocityScale,this.lengthScale=v.lengthScale??this.lengthScale,this.pivot=v.pivot??this.pivot,this.renderMode=v.renderMode??this.renderMode,this.mesh=v.mesh??null;const{main:m,emission:y,sizeOverLifetime:P,rotationOverLifetime:l,velocityOverLifetime:c,limitVelocityOverLifetime:d,colorOverLifetime:s,textureSheetAnimation:b,forceOverLifetime:h,noise:u}=e.props.generator;this.duration=m.duration,this.isLoop=m.isLoop,this.startDelay=m.startDelay,this.startLifetime=m.startLifetime,this.startSpeed=m.startSpeed,this.startSize.enabled=m.startSize3D,this.startSize.x=m.startSizeX,this.startSize.y=m.startSizeY,this.startSize.z=m.startSizeZ,this.startRotation.enabled=m.startRotation3D,this.startRotation.x=m.startRotationX,this.startRotation.y=m.startRotationY,this.startRotation.z=m.startRotationZ,this.flipRotation=m.flipRotation,this.startColor=m.startColor,this.gravityModifier=m.gravityModifier,this.simulationSpace=m.simulationSpace,this.simulationSpeed=m.simulationSpeed,this.scalingMode=m.scalingMode,this.playOnEnabled=m.playOnEnabled,this.maxParticles=m.maxParticles,this._emissionModuleEnabled=y.enabled,this.rateOverTime=y.rateOverTime,this.shape=y.shape,(((i=y.shape)==null?void 0:i.class)==="Null"||y.shape===null)&&(this.shape={class:D.ConeShape,props:{angle:25,radius:1,length:5,emitType:me.Base,enabled:!1}}),this._emissionShapeModuleEnabled=((p=(f=y==null?void 0:y.shape)==null?void 0:f.props)==null?void 0:p.enabled)??!0;const j=[];if((M=y==null?void 0:y.methods)!=null&&M.addBurst&&Array.isArray(y.methods.addBurst))for(let E=0;E<y.methods.addBurst.length;E++)y.methods.addBurst[E]&&y.methods.addBurst[E][0]&&j.push(y.methods.addBurst[E][0]);this.bursts=j,this._sizeOverLifetimeModuleEnabled=(P==null?void 0:P.enabled)??!1,this.size.enabled=(P==null?void 0:P.separateAxes)??!1,this.size.x=P!=null&&P.sizeX?{...P.sizeX,module:"sizeOverLifetime"}:{...R(this.size.x),module:"sizeOverLifetime"},this.size.y=P!=null&&P.sizeY?{...P.sizeY,module:"sizeOverLifetime"}:{...R(this.size.y),module:"sizeOverLifetime"},this.size.z=P!=null&&P.sizeZ?{...P.sizeZ,module:"sizeOverLifetime"}:{...R(this.size.z),module:"sizeOverLifetime"},this._rotationOverLifetimeModuleEnabled=(l==null?void 0:l.enabled)??!1,this.rotation.enabled=(l==null?void 0:l.separateAxes)??!1,this.rotation.x=l!=null&&l.rotationX?{...l.rotationX,module:"rotationOverLifetime"}:{...R(this.rotation.x),module:"rotationOverLifetime"},this.rotation.y=l!=null&&l.rotationY?{...l.rotationY,module:"rotationOverLifetime"}:{...R(this.rotation.y),module:"rotationOverLifetime"},this.rotation.z=l!=null&&l.rotationZ?{...l.rotationZ,module:"rotationOverLifetime"}:{...R(this.rotation.z),module:"rotationOverLifetime"},this._velocityOverLifetimeModuleEnabled=(c==null?void 0:c.enabled)??!1,this.velocityX=(c==null?void 0:c.velocityX)??R(this.velocityX),this.velocityY=(c==null?void 0:c.velocityY)??R(this.velocityY),this.velocityZ=(c==null?void 0:c.velocityZ)??R(this.velocityZ),this.spaceMode=(c==null?void 0:c.space)??Y.Local,this._limitVelocityOverLifetimeModuleEnabled=(d==null?void 0:d.enabled)??!1,this.speed.enabled=(d==null?void 0:d.separateAxes)??!1;const _=(d==null?void 0:d.speedX)??(d==null?void 0:d.speed);this.speed.x=_?{..._,module:"limitVelocityOverLifetime"}:{...R(this.speed.x),module:"limitVelocityOverLifetime"},this.speed.y=d!=null&&d.speedY?{...d.speedY,module:"limitVelocityOverLifetime"}:{...R(this.speed.y),module:"limitVelocityOverLifetime"},this.speed.z=d!=null&&d.speedZ?{...d.speedZ,module:"limitVelocityOverLifetime"}:{...R(this.speed.z),module:"limitVelocityOverLifetime"},this.dampen=(d==null?void 0:d.dampen)??0,this.drag=d!=null&&d.drag?{...d.drag,module:"limitVelocityOverLifetime"}:I("limitVelocityOverLifetime"),this.multiplyDragByParticleSize=(d==null?void 0:d.multiplyDragByParticleSize)??!1,this.multiplyDragByParticleVelocity=(d==null?void 0:d.multiplyDragByParticleVelocity)??!1,this.limitVelocitySpaceMode=(d==null?void 0:d.space)??Y.Local,this._forceOverLifetimeModuleEnabled=(h==null?void 0:h.enabled)??!1,this.forceX=(h==null?void 0:h.forceX)??I("forceOverLifetime"),this.forceY=(h==null?void 0:h.forceY)??I("forceOverLifetime"),this.forceZ=(h==null?void 0:h.forceZ)??I("forceOverLifetime"),this.forceSpaceMode=(h==null?void 0:h.space)??Y.Local,s?(this._colorOverLifetimeModuleEnabled=s.enabled,this.color=s.color):(this._colorOverLifetimeModuleEnabled=!0,this.color=Ot()),this._textureSheetAnimationModuleEnabled=b.enabled,this.textureSheetAnimationType=b.type,this.cycleCount=b.cycleCount,this.tiling=b.tiling,this.frameOverTime=b.frameOverTime,this._noiseModuleEnabled=(u==null?void 0:u.enabled)??!1,this.noiseStrength.enabled=(u==null?void 0:u.separateAxes)??!1;const F=u==null?void 0:u.strengthX;this.noiseStrength.x=F?{...F,module:"noise"}:{...R(this.noiseStrength.x),module:"noise"},this.noiseStrength.y=u!=null&&u.strengthY?{...u.strengthY,module:"noise"}:{...R(this.noiseStrength.y),module:"noise"},this.noiseStrength.z=u!=null&&u.strengthZ?{...u.strengthZ,module:"noise"}:{...R(this.noiseStrength.z),module:"noise"},this.noiseFrequency=(u==null?void 0:u.frequency)??.5,this.noiseScrollSpeed=(u==null?void 0:u.scrollSpeed)??0,this.noiseOctaveCount=(u==null?void 0:u.octaveCount)??1,this.noiseOctaveIntensityMultiplier=(u==null?void 0:u.octaveIntensityMultiplier)??.5,this.noiseOctaveFrequencyMultiplier=(u==null?void 0:u.octaveFrequencyMultiplier)??2}e.methods&&(this.material=e.methods.setMaterial[0][0]);const t=e.methods?e:{...e,methods:{setMaterial:[[this.material]]}};super.deserialize(t)}toJSON(){const e=[];return this.bursts.forEach(r=>{e.push([r])}),{id:this.id,class:this.type,props:{enabled:this.enabled,priority:this.priority,velocityScale:this.velocityScale,lengthScale:this.lengthScale,pivot:this.pivot,renderMode:this.renderMode,mesh:this.mesh,generator:{main:{duration:this.duration,isLoop:this.isLoop,startDelay:this.startDelay,startLifetime:this.startLifetime,startSpeed:this.startSpeed,startSize3D:this.startSize.enabled,startSizeX:this.startSize.x,startSizeY:this.startSize.y,startSizeZ:this.startSize.z,startRotation3D:this.startRotation.enabled,startRotationX:this.startRotation.x,startRotationY:this.startRotation.y,startRotationZ:this.startRotation.z,flipRotation:this.flipRotation,startColor:this.startColor,gravityModifier:this.gravityModifier,simulationSpace:this.simulationSpace,simulationSpeed:this.simulationSpeed,scalingMode:this.scalingMode,playOnEnabled:this.playOnEnabled,maxParticles:this.maxParticles},emission:{enabled:this._emissionModuleEnabled,rateOverTime:this.rateOverTime,shape:this.shape,methods:{addBurst:e}},sizeOverLifetime:{enabled:this._sizeOverLifetimeModuleEnabled,separateAxes:this.size.enabled,sizeX:this.size.x,sizeY:this.size.y,sizeZ:this.size.z},rotationOverLifetime:{enabled:this._rotationOverLifetimeModuleEnabled,separateAxes:this.rotation.enabled,rotationX:this.rotation.x,rotationY:this.rotation.y,rotationZ:this.rotation.z},velocityOverLifetime:{enabled:this._velocityOverLifetimeModuleEnabled,space:this.spaceMode,velocityX:this.velocityX,velocityY:this.velocityY,velocityZ:this.velocityZ},limitVelocityOverLifetime:{enabled:this._limitVelocityOverLifetimeModuleEnabled,separateAxes:this.speed.enabled,speedX:this.speed.x,speedY:this.speed.y,speedZ:this.speed.z,dampen:this.dampen,drag:this.drag,multiplyDragByParticleSize:this.multiplyDragByParticleSize,multiplyDragByParticleVelocity:this.multiplyDragByParticleVelocity,space:this.limitVelocitySpaceMode},forceOverLifetime:{enabled:this._forceOverLifetimeModuleEnabled,space:this.forceSpaceMode,forceX:this.forceX,forceY:this.forceY,forceZ:this.forceZ},colorOverLifetime:{enabled:this._colorOverLifetimeModuleEnabled,color:this.color},textureSheetAnimation:{enabled:this._textureSheetAnimationModuleEnabled,type:this.textureSheetAnimationType,cycleCount:this.cycleCount,tiling:this.tiling,frameOverTime:this.frameOverTime},noise:{enabled:this._noiseModuleEnabled,separateAxes:this.noiseStrength.enabled,strengthX:this.noiseStrength.x,strengthY:this.noiseStrength.y,strengthZ:this.noiseStrength.z,frequency:this.noiseFrequency,scrollSpeed:this.noiseScrollSpeed,octaveCount:this.noiseOctaveCount,octaveIntensityMultiplier:this.noiseOctaveIntensityMultiplier,octaveFrequencyMultiplier:this.noiseOctaveFrequencyMultiplier}}},methods:{setMaterial:[[this.material]]}}}};S([Q],g.prototype,"_emissionModuleEnabled",2);S([Q],g.prototype,"_emissionShapeModuleEnabled",2);S([Q],g.prototype,"_rotationOverLifetimeModuleEnabled",2);S([Q],g.prototype,"_sizeOverLifetimeModuleEnabled",2);S([Q],g.prototype,"_textureSheetAnimationModuleEnabled",2);S([Q],g.prototype,"_velocityOverLifetimeModuleEnabled",2);S([Q],g.prototype,"_forceOverLifetimeModuleEnabled",2);S([Q],g.prototype,"_limitVelocityOverLifetimeModuleEnabled",2);S([Q],g.prototype,"_colorOverLifetimeModuleEnabled",2);S([Q],g.prototype,"_noiseModuleEnabled",2);S([V({engineKey:"setMaterial",setPath:"setMaterial()",getPath:"getMaterial()",valueType:ga.ReferResource,getEngineValue:a=>a.getMaterial()}),z({type:A.AssetPicker,assetType:"Material",customFilter:a=>{var e;return((e=a.engineObject.shader)==null?void 0:e.name)==="particle-shader"},priority:-100,label:n("effects.renderer.material.label"),info:n("effects.renderer.material.info")}),O()],g.prototype,"material",2);S([z({bindPath:"priority",min:0,step:1,dragStep:1,priority:-100,label:n("effects.renderer.priority.label"),info:n("effects.renderer.priority.info")}),O()],g.prototype,"priority",2);S([z({bindPath:"velocityScale",priority:-100,label:n("effects.renderer.velocity-scale.label"),info:n("effects.renderer.velocity-scale.info"),when:a=>a.renderMode===W.StretchBillboard}),O()],g.prototype,"velocityScale",2);S([z({bindPath:"lengthScale",priority:-100,label:n("effects.renderer.length-scale.label"),info:n("effects.renderer.length-scale.info"),when:a=>a.renderMode===W.StretchBillboard}),O()],g.prototype,"lengthScale",2);S([z({type:A.Vector3,bindPath:"pivot",label:n("effects.renderer.pivot.label"),priority:-100}),O()],g.prototype,"pivot",2);S([V({getPath:"renderMode",setPath:"renderMode"}),z({type:A.Select,value:W.Billboard,label:n("effects.renderer.render-mode.label"),options:[{label:n("effects.renderer.render-mode.options.billboard"),value:W.Billboard},{label:n("effects.renderer.render-mode.options.stretch-billboard"),value:W.StretchBillboard},{label:n("effects.renderer.render-mode.options.horizontal-billboard"),value:W.HorizontalBillboard},{label:n("effects.renderer.render-mode.options.mesh"),value:W.Mesh},{label:n("effects.renderer.render-mode.options.none"),value:W.None}],onChange(a){a.renderMode===W.Mesh&&a._applyRendererMeshFromRef()},priority:-100}),O()],g.prototype,"renderMode",2);S([z({type:A.AssetPicker,assetType:"Mesh",label:n("effects.renderer.mesh.label"),info:n("effects.renderer.mesh.info"),when:a=>a.renderMode===W.Mesh,onChange:async(a,e,t)=>{a.mesh=t?t.getCurrentRef():null;try{await a.applyBoundPathChange("mesh",A.AssetPicker,a.mesh)}catch(r){console.warn(r)}},priority:-100}),O()],g.prototype,"mesh",2);S([V({getPath:"generator.main.duration",setPath:"generator.main.duration"}),z({bindPath:"generator.main.duration",min:.05,step:.05,dragStep:.05,label:n("effects.renderer.duration.label"),info:n("effects.renderer.duration.info")}),O()],g.prototype,"duration",2);S([V({getPath:"generator.main.isLoop",setPath:"generator.main.isLoop"}),z({bindPath:"generator.main.isLoop",label:n("effects.renderer.loop.label"),info:n("effects.renderer.loop.info")}),O()],g.prototype,"isLoop",2);S([z({customComponent:K,min:0,yRangeMode:"positive",onChange:N,info:n("effects.renderer.start.delay.info"),label:n("effects.renderer.start.delay.label")}),O()],g.prototype,"startDelay",2);S([z({customComponent:K,onChange:N,min:1e-4,yRangeMode:"positive",label:n("effects.renderer.start.lifetime.label"),info:n("effects.renderer.start.lifetime.info")}),O()],g.prototype,"startLifetime",2);S([z({customComponent:K,onChange:N,label:n("effects.renderer.start.speed.label")}),O()],g.prototype,"startSpeed",2);S([z({module:"main",toggleProps:"startSize3D",axisX:"startSizeX",axisY:"startSizeY",axisZ:"startSizeZ",mainAxis:"x",customComponent:he,onChange:fe("startSize3D"),label:n("effects.renderer.start.size.label"),info:n("effects.renderer.start.size.info"),min:0,yRangeMode:"positive"}),O()],g.prototype,"startSize",2);S([z({module:"main",toggleProps:"startRotation3D",axisX:"startRotationX",axisY:"startRotationY",axisZ:"startRotationZ",mainAxis:"z",customComponent:he,onChange:fe("startRotation3D"),label:n("effects.renderer.start.rotation.label"),info:n("effects.renderer.start.rotation.info"),step:1}),O()],g.prototype,"startRotation",2);S([V({getPath:"generator.main.flipRotation",setPath:"generator.main.flipRotation"}),z({bindPath:"generator.main.flipRotation",min:0,max:1,step:.05,dragStep:.05,label:n("effects.renderer.flip-rotation.label")}),O()],g.prototype,"flipRotation",2);S([z({customComponent:Wa,onChange:Ua,label:n("effects.renderer.start.color.label")}),O()],g.prototype,"startColor",2);S([z({customComponent:K,info:n("effects.renderer.gravity-modifier.info"),onChange:N,label:n("effects.renderer.gravity-modifier.label")}),O()],g.prototype,"gravityModifier",2);S([V({getPath:"generator.main.simulationSpace",setPath:"generator.main.simulationSpace"}),z({type:A.Select,bindPath:"generator.main.simulationSpace",value:Y.Local,label:n("effects.renderer.simulation.space.label"),info:n("effects.renderer.simulation.space.info"),options:[{label:n("effects.renderer.simulation.space.options.local"),value:Y.Local},{label:n("effects.renderer.simulation.space.options.world"),value:Y.World}]}),O()],g.prototype,"simulationSpace",2);S([V({getPath:"generator.main.simulationSpeed",setPath:"generator.main.simulationSpeed"}),z({bindPath:"generator.main.simulationSpeed",step:.05,dragStep:.05,label:n("effects.renderer.simulation.speed.label"),info:n("effects.renderer.simulation.speed.info")}),O()],g.prototype,"simulationSpeed",2);S([V({getPath:"generator.main.scalingMode",setPath:"generator.main.scalingMode"}),z({type:A.Select,bindPath:"generator.main.scalingMode",label:n("effects.renderer.scaling-mode.label"),info:n("effects.renderer.scaling-mode.info"),value:ye.Local,options:[{label:n("effects.renderer.scaling-mode.options.hierarchy"),value:ye.Hierarchy},{label:n("effects.renderer.scaling-mode.options.local"),value:ye.Local},{label:n("effects.renderer.scaling-mode.options.world"),value:ye.World}]}),O()],g.prototype,"scalingMode",2);S([V({getPath:"generator.main.playOnEnabled",setPath:"generator.main.playOnEnabled"}),z({type:A.Toggle,bindPath:"generator.main.playOnEnabled",label:n("effects.renderer.play-on-enabled.label"),info:n("effects.renderer.play-on-enabled.info")}),O()],g.prototype,"playOnEnabled",2);S([V({getPath:"generator.main.maxParticles",setPath:"generator.main.maxParticles"}),z({type:A.Number,bindPath:"generator.main.maxParticles",min:1,dragStep:1,label:n("effects.renderer.max-particles.label"),info:n("effects.renderer.max-particles.info")}),O()],g.prototype,"maxParticles",2);S([z({customComponent:K,onChange:N,min:0,yRangeMode:"positive",label:n("effects.renderer.rate-over-time.label"),info:n("effects.renderer.rate-over-time.info")}),O()],g.prototype,"rateOverTime",2);S([z({customComponent:$a,onChange:Ya}),O()],g.prototype,"shape",2);S([O({type:"methods",key:"addBurst"}),z({label:n("effects.renderer.bursts.label"),info:n("effects.renderer.bursts.info"),customComponent:Ga,onChange:Ka})],g.prototype,"bursts",2);S([z({module:"sizeOverLifetime",toggleProps:"separateAxes",toggleLabel:"effects.curve.separate-axes",axisX:"sizeX",axisY:"sizeY",axisZ:"sizeZ",mainAxis:"x",customComponent:he,onChange:fe("separateAxes"),min:0,yRangeMode:"positive",label:n("effects.renderer.over-lifetime.size.label")}),O()],g.prototype,"size",2);S([z({module:"rotationOverLifetime",toggleProps:"separateAxes",toggleLabel:"effects.curve.separate-axes",axisX:"rotationX",axisY:"rotationY",axisZ:"rotationZ",mainAxis:"z",customComponent:he,onChange:fe("separateAxes"),step:1,yTickScale:45,label:n("effects.renderer.over-lifetime.rotation.label")}),O()],g.prototype,"rotation",2);S([V({getPath:"generator.textureSheetAnimation.type",setPath:"generator.textureSheetAnimation.type"}),z({type:A.Select,value:0,label:n("effects.renderer.texture-sheet.type.label"),info:n("effects.renderer.texture-sheet.type.info"),options:[{label:n("effects.renderer.texture-sheet.type.options.whole-sheet"),value:0},{label:n("effects.renderer.texture-sheet.type.options.single-row"),value:1}]}),O()],g.prototype,"textureSheetAnimationType",2);S([V({getPath:"generator.textureSheetAnimation.cycleCount",setPath:"generator.textureSheetAnimation.cycleCount"}),z({bindPath:"generator.textureSheetAnimation.cycleCount",min:1e-4,step:1,dragStep:1,label:n("effects.renderer.texture-sheet.cycle-count.label"),info:n("effects.renderer.texture-sheet.cycle-count.info")}),O()],g.prototype,"cycleCount",2);S([z({type:A.Vector2,min:1,label:n("effects.renderer.texture-sheet.tiling.label"),info:n("effects.renderer.texture-sheet.tiling.info"),onChange(a,e,t){a.applyBoundPathChange("generator.textureSheetAnimation.tiling",A.Vector2,t)}}),O()],g.prototype,"tiling",2);S([z({customComponent:K,onChange:N,min:0,max:1,yRangeMode:"positive",label:n("effects.renderer.over-lifetime.frame.label")}),O()],g.prototype,"frameOverTime",2);S([V({getPath:"generator.velocityOverLifetime.space",setPath:"generator.velocityOverLifetime.space"}),z({type:A.Select,bindPath:"generator.velocityOverLifetime.space",value:0,label:n("effects.renderer.space-mode.label"),info:n("effects.renderer.space-mode.info"),options:[{label:n("effects.renderer.space-mode.options.local"),value:Y.Local},{label:n("effects.renderer.space-mode.options.world"),value:Y.World}]}),O()],g.prototype,"spaceMode",2);S([V({getPath:"generator.forceOverLifetime.space",setPath:"generator.forceOverLifetime.space"}),z({type:A.Select,bindPath:"generator.forceOverLifetime.space",value:0,label:n("effects.renderer.space-mode.label"),info:n("effects.renderer.space-mode.info-force"),options:[{label:"Local",value:Y.Local},{label:"World",value:Y.World}]}),O()],g.prototype,"forceSpaceMode",2);S([z({customComponent:K,onChange:N,label:n("effects.renderer.velocity.x.label"),info:n("effects.renderer.velocity.x.info")}),O()],g.prototype,"velocityX",2);S([z({customComponent:K,onChange:N,label:n("effects.renderer.velocity.y.label")}),O()],g.prototype,"velocityY",2);S([z({customComponent:K,onChange:N,label:n("effects.renderer.velocity.z.label")}),O()],g.prototype,"velocityZ",2);S([z({module:"limitVelocityOverLifetime",toggleProps:"separateAxes",toggleLabel:"effects.curve.separate-axes",axisX:"speedX",axisY:"speedY",axisZ:"speedZ",mainAxis:"x",customComponent:he,onChange:fe("separateAxes"),min:0,yRangeMode:"positive",label:n("effects.renderer.limit-velocity.limit.label")}),O()],g.prototype,"speed",2);S([V({getPath:"generator.limitVelocityOverLifetime.space",setPath:"generator.limitVelocityOverLifetime.space"}),z({type:A.Select,bindPath:"generator.limitVelocityOverLifetime.space",value:0,when:a=>a.speed.enabled,label:n("effects.renderer.space-mode.label"),info:n("effects.renderer.limit-velocity.space.info"),options:[{label:n("effects.renderer.space-mode.options.local"),value:Y.Local},{label:n("effects.renderer.space-mode.options.world"),value:Y.World}]}),O()],g.prototype,"limitVelocitySpaceMode",2);S([V({getPath:"generator.limitVelocityOverLifetime.dampen",setPath:"generator.limitVelocityOverLifetime.dampen"}),z({bindPath:"generator.limitVelocityOverLifetime.dampen",min:0,max:1,step:.01,dragStep:.01,label:n("effects.renderer.limit-velocity.dampen.label"),info:n("effects.renderer.limit-velocity.dampen.info")}),O()],g.prototype,"dampen",2);S([z({customComponent:K,onChange:N,min:0,yRangeMode:"positive",label:n("effects.renderer.limit-velocity.drag.label"),info:n("effects.renderer.limit-velocity.drag.info")}),O()],g.prototype,"drag",2);S([V({getPath:"generator.limitVelocityOverLifetime.multiplyDragByParticleSize",setPath:"generator.limitVelocityOverLifetime.multiplyDragByParticleSize"}),z({type:A.Toggle,bindPath:"generator.limitVelocityOverLifetime.multiplyDragByParticleSize",label:n("effects.renderer.limit-velocity.multiply-drag-by-size.label"),info:n("effects.renderer.limit-velocity.multiply-drag-by-size.info")}),O()],g.prototype,"multiplyDragByParticleSize",2);S([V({getPath:"generator.limitVelocityOverLifetime.multiplyDragByParticleVelocity",setPath:"generator.limitVelocityOverLifetime.multiplyDragByParticleVelocity"}),z({type:A.Toggle,bindPath:"generator.limitVelocityOverLifetime.multiplyDragByParticleVelocity",label:n("effects.renderer.limit-velocity.multiply-drag-by-velocity.label"),info:n("effects.renderer.limit-velocity.multiply-drag-by-velocity.info")}),O()],g.prototype,"multiplyDragByParticleVelocity",2);S([z({customComponent:K,onChange:N}),O()],g.prototype,"forceX",2);S([z({customComponent:K,onChange:N}),O()],g.prototype,"forceY",2);S([z({customComponent:K,onChange:N}),O()],g.prototype,"forceZ",2);S([z({customComponent:Qa,onChange:er,label:n("effects.renderer.color-over-lifetime.label")}),O()],g.prototype,"color",2);S([z({customComponent:ar,label:n("effects.renderer.noise.preview.label")})],g.prototype,"noisePreview",2);S([z({module:"noise",toggleProps:"separateAxes",toggleLabel:"effects.curve.separate-axes",axisX:"strengthX",axisY:"strengthY",axisZ:"strengthZ",mainAxis:"x",customComponent:he,onChange:(a,e,t)=>{fe("separateAxes")(a,"strength",t)},label:n("effects.renderer.noise.strength.label")}),O()],g.prototype,"noiseStrength",2);S([V({getPath:"generator.noise.frequency",setPath:"generator.noise.frequency"}),z({bindPath:"generator.noise.frequency",min:1e-6,step:.1,dragStep:.1,label:n("effects.renderer.noise.frequency.label")}),O()],g.prototype,"noiseFrequency",2);S([V({getPath:"generator.noise.scrollSpeed",setPath:"generator.noise.scrollSpeed"}),z({bindPath:"generator.noise.scrollSpeed",min:0,step:.01,dragStep:.01,label:n("effects.renderer.noise.scroll-speed.label")}),O()],g.prototype,"noiseScrollSpeed",2);S([V({getPath:"generator.noise.octaveCount",setPath:"generator.noise.octaveCount"}),z({bindPath:"generator.noise.octaveCount",min:1,max:3,step:1,dragStep:1,label:n("effects.renderer.noise.octave-count.label")}),O()],g.prototype,"noiseOctaveCount",2);S([V({getPath:"generator.noise.octaveIntensityMultiplier",setPath:"generator.noise.octaveIntensityMultiplier"}),z({bindPath:"generator.noise.octaveIntensityMultiplier",min:0,max:1,step:.01,dragStep:.01,when:a=>a.noiseOctaveCount>1,label:n("effects.renderer.noise.octave-intensity-multiplier.label")}),O()],g.prototype,"noiseOctaveIntensityMultiplier",2);S([V({getPath:"generator.noise.octaveFrequencyMultiplier",setPath:"generator.noise.octaveFrequencyMultiplier"}),z({bindPath:"generator.noise.octaveFrequencyMultiplier",min:1,max:4,step:.1,dragStep:.1,when:a=>a.noiseOctaveCount>1,label:n("effects.renderer.noise.octave-frequency-multiplier.label")}),O()],g.prototype,"noiseOctaveFrequencyMultiplier",2);g=S([xa({type:"ParticleRenderer",customInspector:Ea,componentsMenu:{group:"effects",label:n("component.particle-renderer.title")}})],g);export{g as ParticleRendererComponent};
@@ -0,0 +1 @@
1
+ var y=Object.defineProperty;var M=(t,i,e)=>i in t?y(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e;var r=(t,i,e)=>(M(t,typeof i!="symbol"?i+"":i,e),e);import{j as h,P as a,k as d,p as l,C as b,m,n as v,e as C,o as F,q as P}from"./index-aec7e708.js";import"./index-e8a45e82.js";var f=Object.defineProperty,g=Object.getOwnPropertyDescriptor,c=(t,i,e,n)=>{for(var o=n>1?void 0:n?g(i,e):i,u=t.length-1,p;u>=0;u--)(p=t[u])&&(o=(n?p(i,e,o):p(o))||o);return n&&o&&f(i,e,o),o};let s=class extends h{constructor(i){super(i);r(this,"dynamicFriction",.6);r(this,"staticFriction",.6);r(this,"bounciness",0);r(this,"frictionCombine",a.Average);r(this,"bounceCombine",a.Average)}async initByMain(i){const e=JSON.parse(await i.text()),n=new d;n.dynamicFriction=this.dynamicFriction=e.dynamicFriction,n.staticFriction=this.staticFriction=e.staticFriction,n.bounciness=this.bounciness=e.bounciness,n.frictionCombine=this.frictionCombine=e.frictionCombine,n.bounceCombine=this.bounceCombine=e.bounceCombine,this.bindEngineObject(n)}async initByCreation(){return this.getMainData()}destroy(){var i;super.destroy(),(i=this.engineObject)==null||i.destroy()}};c([l({type:b.Number,label:"DynamicFriction",bindPath:"dynamicFriction"}),m()],s.prototype,"dynamicFriction",2);c([l({type:b.Number,label:"StaticFriction",bindPath:"staticFriction"}),m()],s.prototype,"staticFriction",2);c([l({type:b.Number,min:0,max:1,label:"Bounciness",bindPath:"bounciness"}),m()],s.prototype,"bounciness",2);c([l({type:b.Select,label:"FrictionCombine",bindPath:"frictionCombine",options:[{label:"Average",value:a.Average},{label:"Minimum",value:a.Minimum},{label:"Multiply",value:a.Multiply},{label:"Maximum",value:a.Maximum}]}),m()],s.prototype,"frictionCombine",2);c([l({type:b.Select,label:"BounceCombine",bindPath:"bounceCombine",options:[{label:"Average",value:a.Average},{label:"Minimum",value:a.Minimum},{label:"Multiply",value:a.Multiply},{label:"Maximum",value:a.Maximum}]}),m()],s.prototype,"bounceCombine",2);s=c([v({type:"PhysicsMaterial",label:C("asset.physics-material.title"),extname:"physMat",importMenuConfig:{type:F.Add},dragLayer:P.PhysicsMaterial,async bundle({content:t}){return{content:t}}})],s);export{s as PhysicsMaterialAsset};
@@ -0,0 +1 @@
1
+ var ce=Object.defineProperty;var pe=(o,t,e)=>t in o?ce(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var p=(o,t,e)=>(pe(o,typeof t!="symbol"?t+"":t,e),e);import{aQ as j,aR as z,aS as l,bm as X,cC as P,bl as oe,ej as L,dQ as ne,bN as de,q as ye,cR as q,ek as B,el as J,em as I,en as N,cy as E,f as he,z as me,s as y,p as h,e as r,eo as ue,E as se,ep as U,eq as S,er as V,C as m,es as Y,et as fe,eu as G,dZ as re,ev as be,ew as ge,bq as Ce,cP as W,bs as xe,bt as Se}from"./index-aec7e708.js";import{r as ae}from"./index-e8a45e82.js";import{c as A}from"./Component-ed7aa0ab.js";import"./postmen-2f47f6bb.js";import{F as Pe}from"./FormItemArray-6d69acd4.js";const je={BoxColliderShape:["size","isTrigger","position","rotation","material"],CapsuleColliderShape:["radius","height","upAxis","isTrigger","position","rotation","material"],PlaneColliderShape:["isTrigger","position","rotation","material"],SphereColliderShape:["radius","isTrigger","position","rotation","material"]};function ve(o){const t={};return Object.keys(o.props).forEach(e=>{je[o.class].includes(e)&&(t[e]=o.props[e])}),t}const ze=async(o,t,e)=>{const i=o.engineObject,n=i.shapes;if(n.length===e.length&&e.every((s,a)=>Oe(s.class,n[a]))){for(let s=0;s<e.length;s++)await H(n[s],e[s]),Q(n[s],e[s]);return}i.clearShapes();for(let s=0;s<e.length;s++){const a=e[s],d=De(a);await H(d,a),Q(d,a),i.addShape(d)}};async function H(o,t){const e=t.props.material;if(e!=null&&e.refId)try{const i=await ae.assetStore.getAssetByRef(e);i!=null&&i.engineObject&&(o.material=i.engineObject)}catch(i){console.error(i)}}function Oe(o,t){switch(o){case"BoxColliderShape":return t instanceof N;case"CapsuleColliderShape":return t instanceof I;case"PlaneColliderShape":return t instanceof J;case"SphereColliderShape":return t instanceof B;default:return!1}}function De(o){switch(o.class){case"BoxColliderShape":return new N;case"CapsuleColliderShape":return new I;case"PlaneColliderShape":return new J;case"SphereColliderShape":return new B}}function Q(o,t){const e=t.props;if(o instanceof N&&e.size){const s=o.size;s.copyFrom(e.size),o.size=s}else o instanceof I?(e.radius!==void 0&&(o.radius=e.radius),e.height!==void 0&&(o.height=e.height),e.upAxis!==void 0&&(o.upAxis=e.upAxis)):o instanceof B&&e.radius!==void 0&&(o.radius=e.radius);o.isTrigger=e.isTrigger;const i=o.position;i.copyFrom(e.position),o.position=i;const n=o.rotation;n.copyFrom(e.rotation),o.rotation=n}const _e=o=>o.map(t=>{if(t instanceof N)return{class:"BoxColliderShape",props:{isTrigger:t.isTrigger,size:{x:t.size.x,y:t.size.y,z:t.size.z},position:{x:t.position.x,y:t.position.y,z:t.position.z},rotation:{x:t.rotation.x,y:t.rotation.y,z:t.rotation.z}}};if(t instanceof I)return{class:"CapsuleColliderShape",props:{isTrigger:t.isTrigger,radius:t.radius,height:t.height,upAxis:t.upAxis,position:{x:t.position.x,y:t.position.y,z:t.position.z},rotation:{x:t.rotation.x,y:t.rotation.y,z:t.rotation.z}}};if(t instanceof J)return{class:"PlaneColliderShape",props:{isTrigger:t.isTrigger,position:{x:t.position.x,y:t.position.y,z:t.position.z},rotation:{x:t.rotation.x,y:t.rotation.y,z:t.rotation.z}}};if(t instanceof B)return{class:"SphereColliderShape",props:{isTrigger:t.isTrigger,radius:t.radius,position:{x:t.position.x,y:t.position.y,z:t.position.z},rotation:{x:t.rotation.x,y:t.rotation.y,z:t.rotation.z}}}}),we=j(({item:o,onItemChange:t})=>{const{t:e}=z();return l.jsx(l.Fragment,{children:l.jsx(X,{label:e("physics.shape.box.size.title"),info:e("physics.shape.box.size.info"),min:0,value:{x:o.props.size.x,y:o.props.size.y,z:o.props.size.z},onChange:(i,n)=>{const s=i==null?void 0:i[n];typeof s=="number"&&t(a=>{a.props.size={...a.props.size,[n]:s}})}})})}),Te=j(()=>l.jsx(l.Fragment,{})),Ae=j(({item:o,onItemChange:t})=>{const{t:e}=z();return l.jsx(l.Fragment,{children:l.jsx(P,{label:e("physics.shape.sphere.radius.title"),info:e("physics.shape.sphere.radius.info"),value:o.props.radius,min:0,onChange:i=>{typeof i=="number"&&t(n=>{n.props.radius=i})}})})}),Me=j(({item:o,onItemChange:t})=>{const{t:e}=z();return l.jsxs(l.Fragment,{children:[l.jsx(P,{label:e("physics.shape.capsule.radius.title"),info:e("physics.shape.capsule.radius.info"),value:o.props.radius,min:0,onChange:i=>{typeof i=="number"&&t(n=>{n.props.radius=i})}}),l.jsx(P,{label:e("physics.shape.capsule.height.title"),info:e("physics.shape.capsule.height.info"),value:o.props.height,min:0,onChange:i=>{typeof i=="number"&&t(n=>{n.props.height=i})}}),l.jsx(oe,{label:e("physics.shape.capsule.up-axis.title"),info:e("physics.shape.capsule.up-axis.info"),options:[{label:"X",value:L.X},{label:"Y",value:L.Y},{label:"Z",value:L.Z}],value:o.props.upAxis,onChange:i=>{t(n=>{n.props.upAxis=i})}})]})}),Fe={BoxColliderShape:we,CapsuleColliderShape:Me,PlaneColliderShape:Te,SphereColliderShape:Ae},Z={BoxColliderShape:{class:"BoxColliderShape",props:{isTrigger:!1,material:{refId:"0000401"},size:{x:1,y:1,z:1},position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0}}},CapsuleColliderShape:{class:"CapsuleColliderShape",props:{isTrigger:!1,material:{refId:"0000401"},radius:.5,height:2,upAxis:L.Y,position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0}}},PlaneColliderShape:{class:"PlaneColliderShape",props:{isTrigger:!1,material:{refId:"0000401"},position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0}}},SphereColliderShape:{class:"SphereColliderShape",props:{isTrigger:!1,material:{refId:"0000401"},radius:.5,position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0}}}},Ve=j(({item:o,onItemChange:t})=>{var d;const{t:e}=z(),i=Fe[o.class],n=ae.assetStore,s=Object.values(n.assets).filter(c=>c.getMetaConfig().type==="PhysicsMaterial"),a=n.assets[(d=o.props.material)==null?void 0:d.refId];return l.jsxs(l.Fragment,{children:[l.jsx(ne,{label:e("physics.collider.trigger.title"),info:e("physics.collider.trigger.info"),value:o.props.isTrigger,onChange:c=>{t(f=>{f.props.isTrigger=c})}}),l.jsx(de,{label:e("physics.collider.material.title"),info:e("physics.collider.material.info"),dropLayer:ye.PhysicsMaterial,value:a==null?void 0:a.name,assets:s,onSelect:c=>{t(f=>{f.props.material=c.getCurrentRef()})},onLocate:()=>{a&&a.id&&n.selectAsset(a.id)}}),l.jsx(i,{item:o,onItemChange:t}),l.jsx(X,{label:e("physics.collider.local-position.title"),info:e("physics.collider.local-position.info"),value:{x:o.props.position.x,y:o.props.position.y,z:o.props.position.z},onChange:(c,f)=>{const u=c==null?void 0:c[f];typeof u=="number"&&t(b=>{b.props.position={...b.props.position,[f]:u}})}}),l.jsx(X,{label:e("physics.collider.rotation.title"),info:e("physics.collider.rotation.info"),value:{x:o.props.rotation.x,y:o.props.rotation.y,z:o.props.rotation.z},onChange:(c,f)=>{const u=c==null?void 0:c[f];typeof u=="number"&&t(b=>{b.props.rotation={...b.props.rotation,[f]:u}})}})]})}),Be=j(({collider:o,item:t,index:e,onModelChange:i})=>{const{t:n}=z(),s=[{label:n("physics.shape.box.title"),value:"BoxColliderShape"},{label:n("physics.shape.capsule.title"),value:"CapsuleColliderShape"}];o.engineObject instanceof q||(s.push({label:n("physics.shape.plane.title"),value:"PlaneColliderShape"}),s.push({label:n("physics.shape.sphere.title"),value:"SphereColliderShape"}));const d=c=>{const f=o.colliderShapes,u=E(f),b=u[e];b&&(c(b),i==null||i("colliderShapes",u))};return l.jsxs(l.Fragment,{children:[l.jsx(oe,{label:n("physics.shape.type.title"),info:n("physics.shape.type.info"),value:t.class,options:s,onChange:c=>{Z[c].class!==t.class&&d(u=>{Object.assign(u,E(Z[c]))})}}),l.jsx(Ve,{item:t,onItemChange:d})]})}),Ie=j(({model:o,inspectorConfig:t,onModelChange:e})=>{const{label:i}=t,n=o.colliderShapes,{t:s}=z(),a=d=>{const c=E(n);d(c),e==null||e("colliderShapes",c)};return l.jsx(Pe,{label:i,items:n.map((d,c)=>({removable:!0,children:l.jsx(Be,{collider:o,item:d,index:c,onModelChange:e}),id:`${c}`,name:s("physics.shape.item-name",{index:c})})),addable:!0,onAdd:()=>{a(d=>{d.push(E(Z.BoxColliderShape))})},onDelete:d=>{a(c=>{c.splice(+d.id,1)})},addItemText:s("physics.shape.add")})});var Ne=Object.defineProperty,$e=Object.getOwnPropertyDescriptor,Le=(o,t,e,i)=>{for(var n=i>1?void 0:i?$e(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&Ne(t,e,n),n};async function Ee(o,t){let e;switch(o.class){case"BoxColliderShape":{e=new N;const i=e.size,n=o.props.size;n&&(i.set(n.x,n.y,n.z),e.size=i);break}case"CapsuleColliderShape":{e=new I,o.props.radius!==void 0&&(e.radius=o.props.radius),o.props.height!==void 0&&(e.height=o.props.height),o.props.upAxis!==void 0&&(e.upAxis=o.props.upAxis);break}case"PlaneColliderShape":{e=new J;break}case"SphereColliderShape":{e=new B,o.props.radius!==void 0&&(e.radius=o.props.radius);break}default:throw new Error(`Unknown collider shape class: ${o.class}`)}if(o.props.isTrigger!==void 0&&(e.isTrigger=o.props.isTrigger),o.props.position){const i=o.props.position,n=e.position;n.set(i.x,i.y,i.z),e.position=n}if(o.props.rotation){const i=o.props.rotation,n=e.rotation;n.set(i.x,i.y,i.z),e.rotation=n}if(o.props.material){const i=o.props.material;if(i.refId){const n=await t.getAssetByRef({refId:i.refId});if(!(n!=null&&n.engineObject))throw ue(`Physics material is not ready for refId: ${i.refId}`);e.material=n.engineObject}}return e}class R extends se{constructor(){super(...arguments);p(this,"colliderShapes",[])}}Le([he({engineKey:"addShape",editorKey:"colliderShapes",getPath:"shapes",valueType:me.Object,getEngineValue:o=>o.shapes,getEditorValue:_e}),y({type:"methods",key:"addShape",canonicalizeToProps:!0,onSerialize:o=>o.map(t=>[{class:t.class,props:ve(t)}]),onDeserialize:o=>o.map(t=>t[0]),resolveMethodArguments:async(o,t)=>{const e=[];for(const i of o)if(i&&typeof i=="object"&&"class"in i&&"props"in i){const s=await Ee(i,t.root.assetStore);e.push(s)}else e.push(i);return e}}),h({label:r("physics.collider.title"),info:r("physics.collider.info"),customComponent:Ie,onChange:ze})],R.prototype,"colliderShapes",2);var Je=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,Xe=(o,t,e,i)=>{for(var n=i>1?void 0:i?Re(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&Je(t,e,n),n};let k=class extends R{constructor(o,t){super(o,t)}};k=Xe([A({type:"StaticCollider",componentsMenu:{group:"physics",label:"component.static-collider.title"}})],k);const ee=o=>Object.keys(S).filter(t=>(o&S[t])!==0).map(t=>String(S[t])),qe=j(({model:o,onModelChange:t})=>{const e=n=>{const a=n.map(d=>parseInt(d)).reduce((d,c)=>d|c,S.None);t==null||t("constraints",a)},{t:i}=z();return l.jsxs(l.Fragment,{children:[l.jsx(U,{label:i("physics.collider-constraints.freeze-position.title"),info:i("physics.collider-constraints.freeze-position.info"),type:"multiple",value:ee(o.constraints),options:[{value:S.FreezePositionX.toString(),label:"X"},{value:S.FreezePositionY.toString(),label:"Y"},{value:S.FreezePositionZ.toString(),label:"Z"}],onChange:e}),l.jsx(U,{label:i("physics.collider-constraints.freeze-rotation.title"),info:i("physics.collider-constraints.freeze-rotation.info"),type:"multiple",value:ee(o.constraints),options:[{value:S.FreezeRotationX.toString(),label:"X"},{value:S.FreezeRotationY.toString(),label:"Y"},{value:S.FreezeRotationZ.toString(),label:"Z"}],onChange:e})]})});var Ye=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,C=(o,t,e,i)=>{for(var n=i>1?void 0:i?Ze(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&Ye(t,e,n),n};let g=class extends R{constructor(t,e){super(t,e);p(this,"isKinematic",!1);p(this,"collisionDetectionMode",V.Discrete);p(this,"constraints",S.None);p(this,"mass",1);p(this,"useGravity",!0);p(this,"linearDamping",0);p(this,"angularDamping",.05);p(this,"automaticCenterOfMass",!0);p(this,"centerOfMass",{x:0,y:0,z:0});p(this,"automaticInertiaTensor",!0);p(this,"inertiaTensor",{x:1,y:1,z:1});p(this,"linearVelocity",{x:0,y:0,z:0});p(this,"angularVelocity",{x:0,y:0,z:0});p(this,"maxAngularVelocity",100);p(this,"maxDepenetrationVelocity",10000000331813535e16);p(this,"sleepThreshold",.005);p(this,"solverIterations",4)}onEnabled(){this.applyBoundPathChange("enabled",m.Toggle,!1)}onInitComplete(){this.applyBoundPathChange("enabled",m.Toggle,!1)}};C([y(),h({label:r("physics.dynamic-collider.kinematic.title"),info:r("physics.dynamic-collider.kinematic.info"),type:m.Boolean,bindPath:"isKinematic"})],g.prototype,"isKinematic",2);C([y(),h({label:r("physics.dynamic-collider.collision-detection-mode.title"),type:m.Select,bindPath:"collisionDetectionMode",options:[{label:r("physics.dynamic-collider.collision-detection-mode.discrete"),value:V.Discrete},{label:r("physics.dynamic-collider.collision-detection-mode.continuous"),value:V.Continuous},{label:r("physics.dynamic-collider.collision-detection-mode.continuous-dynamic"),value:V.ContinuousDynamic},{label:r("physics.dynamic-collider.collision-detection-mode.continuous-speculative"),value:V.ContinuousSpeculative}]})],g.prototype,"collisionDetectionMode",2);C([y(),h({label:r("physics.dynamic-collider.constraints.title"),info:r("physics.dynamic-collider.constraints.info"),customComponent:qe,bindPath:"constraints"})],g.prototype,"constraints",2);C([y(),h({label:r("physics.dynamic-collider.mass.title"),info:r("physics.dynamic-collider.mass.info"),bindPath:"mass",min:0,type:m.Number})],g.prototype,"mass",2);C([y(),h({label:r("physics.dynamic-collider.gravity.title"),info:r("physics.dynamic-collider.gravity.info"),bindPath:"useGravity",type:m.Boolean})],g.prototype,"useGravity",2);C([y(),h({label:r("physics.dynamic-collider.linear-damping.title"),info:r("physics.dynamic-collider.linear-damping.info"),bindPath:"linearDamping",min:0,type:m.Number})],g.prototype,"linearDamping",2);C([y(),h({label:r("physics.dynamic-collider.angular-damping.title"),info:r("physics.dynamic-collider.angular-damping.info"),bindPath:"angularDamping",min:0,type:m.Number})],g.prototype,"angularDamping",2);C([y(),h({label:r("physics.dynamic-collider.automatic-center-of-mass.title"),info:r("physics.dynamic-collider.automatic-center-of-mass.info"),bindPath:"automaticCenterOfMass",type:m.Boolean,onChange:(o,t,e)=>{if(e){const i=o.engineObject.centerOfMass;o.centerOfMass={x:i.x,y:i.y,z:i.z}}}})],g.prototype,"automaticCenterOfMass",2);C([y(),h({label:r("physics.dynamic-collider.center-of-mass.title"),info:r("physics.dynamic-collider.center-of-mass.info"),type:m.Vector3,bindPath:"centerOfMass",when:o=>!o.automaticCenterOfMass})],g.prototype,"centerOfMass",2);C([y(),h({label:r("physics.dynamic-collider.automatic-inertia-tensor.title"),info:r("physics.dynamic-collider.automatic-inertia-tensor.info"),bindPath:"automaticInertiaTensor",type:m.Boolean,onChange:(o,t,e)=>{if(e){const i=o.engineObject.inertiaTensor;o.inertiaTensor={x:i.x,y:i.y,z:i.z}}}})],g.prototype,"automaticInertiaTensor",2);C([y(),h({label:r("physics.dynamic-collider.inertia-tensor.title"),info:r("physics.dynamic-collider.inertia-tensor.info"),type:m.Vector3,bindPath:"inertiaTensor",when:o=>!o.automaticInertiaTensor})],g.prototype,"inertiaTensor",2);C([y(),h({label:r("physics.dynamic-collider.linear-velocity.title"),info:r("physics.dynamic-collider.linear-velocity.info"),type:m.Vector3,bindPath:"linearVelocity"})],g.prototype,"linearVelocity",2);C([y(),h({label:r("physics.dynamic-collider.angular-velocity.title"),info:r("physics.dynamic-collider.angular-velocity.info"),type:m.Vector3,bindPath:"angularVelocity"})],g.prototype,"angularVelocity",2);C([y(),h({label:r("physics.dynamic-collider.max-angular-velocity.title"),info:r("physics.dynamic-collider.max-angular-velocity.info"),bindPath:"maxAngularVelocity",min:0,type:m.Number})],g.prototype,"maxAngularVelocity",2);C([y(),h({label:r("physics.dynamic-collider.max-depenetration-velocity.title"),info:r("physics.dynamic-collider.max-depenetration-velocity.info"),bindPath:"maxDepenetrationVelocity",min:0,type:m.Number})],g.prototype,"maxDepenetrationVelocity",2);C([y(),h({label:r("physics.dynamic-collider.sleep-threshold.title"),info:r("physics.dynamic-collider.sleep-threshold.info"),bindPath:"sleepThreshold",min:0,type:m.Number})],g.prototype,"sleepThreshold",2);C([y(),h({label:r("physics.dynamic-collider.solver-iterations.title"),info:r("physics.dynamic-collider.solver-iterations.info"),bindPath:"solverIterations",min:0,max:10,dragStep:1,type:m.Slider})],g.prototype,"solverIterations",2);g=C([A({type:"DynamicCollider",componentsMenu:{group:"physics",label:"component.dynamic-collider.title"}})],g);var Ge=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,$=(o,t,e,i)=>{for(var n=i>1?void 0:i?Ke(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&Ge(t,e,n),n};let T=class extends R{constructor(t,e){super(t,e);p(this,"stepOffset",.5);p(this,"upDirection",{x:0,y:1,z:0});p(this,"slopeLimit",45);p(this,"nonWalkableMode",Y.PreventClimbing)}async bindEngineObject(t){await super.bindEngineObject(t),t.enabled=!1}};$([y(),h({label:r("physics.character.step-offset.title"),info:r("physics.character.step-offset.info"),bindPath:"stepOffset",min:0,type:m.Number})],T.prototype,"stepOffset",2);$([y(),h({label:r("physics.character.up-direction.title"),info:r("physics.character.up-direction.info"),type:m.Vector3,bindPath:"upDirection"})],T.prototype,"upDirection",2);$([y(),h({label:r("physics.character.slop-limit.title"),info:r("physics.character.slop-limit.info"),bindPath:"slopeLimit",min:0,max:180,type:m.Number})],T.prototype,"slopeLimit",2);$([y(),h({label:r("physics.character.non-walkable-mode.title"),info:r("physics.character.non-walkable-mode.info"),bindPath:"nonWalkableMode",type:m.Select,options:[{label:r("physics.character.non-walkable-mode.prevent-climbing"),value:Y.PreventClimbing},{label:r("physics.character.non-walkable-mode.prevent-climbing-and-force-sliding"),value:Y.PreventClimbingAndForceSliding}]})],T.prototype,"nonWalkableMode",2);T=$([A({type:"CharacterController",componentsMenu:{label:r("component.physics.character.title"),group:"physics"}})],T);function Ue(o,t){if(!t)return null;const e=o.entities.get(t),i=(e==null?void 0:e.getComponentByTypeName("DynamicCollider"))||(e==null?void 0:e.getComponentByTypeName("StaticCollider"));return i?{ownerId:t,componentId:i.id}:null}const We=j(o=>{const{inspectorConfig:t,model:e,onModelChange:i}=o,{property:n,label:s,disabled:a,info:d}=t,{ownerId:c}=e[n]||{},f=o.model.root.sceneStore,u=c&&f.entities.get(c),b=F=>{i==null||i(n,Ue(f,F))},{t:x}=z(),le=Array.from(f.entities.values());return l.jsx(l.Fragment,{children:l.jsx(fe,{label:x(s),info:x(d),entities:le,value:c,disabled:a,customFilter:F=>{let K=null;return e.entityModelId!==F.id&&(K=F.getComponentByTypeName("DynamicCollider")||F.getComponentByTypeName("StaticCollider")),K},displayValue:u==null?void 0:u.name,placeholder:x("physics.collider-picker.placeholder"),onSelect:b,onLocate:()=>{o.model.root.sceneStore.selectEntity(c)},onDelete:()=>{b(null)}})})});var He=Object.defineProperty,Qe=Object.getOwnPropertyDescriptor,D=(o,t,e,i)=>{for(var n=i>1?void 0:i?Qe(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&He(t,e,n),n};class v extends se{constructor(){super(...arguments);p(this,"connectedCollider",null);p(this,"anchor",{x:0,y:0,z:0});p(this,"automaticConnectedAnchor",!0);p(this,"connectedAnchor",{x:0,y:0,z:0});p(this,"breakForce",Number.MAX_VALUE);p(this,"breakTorque",Number.MAX_VALUE);p(this,"massScale",1);p(this,"connectedMassScale",1)}async applyBoundPathChange(e,i,n){var s,a;if(e==="connectedCollider"){const d=n,c=((a=(s=this.root.sceneStore.entities.get(d==null?void 0:d.ownerId))==null?void 0:s.getComponentById(d==null?void 0:d.componentId))==null?void 0:a.engineObject)??null;await super.applyBoundPathChange(e,i,c);return}await super.applyBoundPathChange(e,i,n)}}D([y(),h({label:r("physics.joint.connected-collider.title"),info:r("physics.joint.connected-collider.info"),customComponent:We,bindPath:"connectedCollider"})],v.prototype,"connectedCollider",2);D([y(),h({label:r("physics.joint.anchor.title"),type:m.Vector3,bindPath:"anchor",onChange(o,t,e){if(o.automaticConnectedAnchor){const i=o.engineObject.connectedAnchor;o.connectedAnchor={x:i.x,y:i.y,z:i.z}}}})],v.prototype,"anchor",2);D([y(),h({label:r("physics.joint.automatic-connected-anchor.title"),type:m.Boolean,bindPath:"automaticConnectedAnchor",onChange(o,t,e){if(e){const i=o.engineObject.connectedAnchor;o.connectedAnchor={x:i.x,y:i.y,z:i.z}}}})],v.prototype,"automaticConnectedAnchor",2);D([y(),h({label:r("physics.joint.connected-anchor.title"),type:m.Vector3,bindPath:"connectedAnchor",when:o=>!o.automaticConnectedAnchor})],v.prototype,"connectedAnchor",2);D([y(),h({label:r("physics.joint.break-force.title"),type:m.Number,bindPath:"breakForce"})],v.prototype,"breakForce",2);D([y(),h({label:r("physics.joint.break-torque.title"),type:m.Number,bindPath:"breakTorque"})],v.prototype,"breakTorque",2);D([y(),h({label:r("physics.joint.mass-scale.title"),type:m.Number,bindPath:"massScale"})],v.prototype,"massScale",2);D([y(),h({label:r("physics.joint.connected-mass-scale.title"),type:m.Number,bindPath:"connectedMassScale"})],v.prototype,"connectedMassScale",2);var ke=Object.defineProperty,et=Object.getOwnPropertyDescriptor,tt=(o,t,e,i)=>{for(var n=i>1?void 0:i?et(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&ke(t,e,n),n};let te=class extends v{constructor(o,t){super(o,t)}};te=tt([A({type:"FixedJoint",componentsMenu:{label:r("component.physics.fixed-joint.title"),group:"physics"},dependentComponent:{type:"DynamicCollider",dependentMode:G.AutoAdd}})],te);const it=j(o=>{const{inspectorConfig:t,model:e,onModelChange:i}=o,{property:n,label:s,info:a}=t,d=e.useLimits,c=e.useSpring,f=e[n],u=f.props,{t:b}=z();return l.jsx(l.Fragment,{children:d?l.jsxs(re,{label:b(s),info:b(a),children:[l.jsx(P,{label:b("physics.joint-limits.min"),value:u.min,onChange:x=>{u.max<x&&(u.max=x),u.min=x,i(n,f)}}),l.jsx(P,{label:b("physics.joint-limits.max"),value:u.max,onChange:x=>{x<u.min&&(x=u.min),u.max=x,i(n,f)}}),c?l.jsxs(l.Fragment,{children:[l.jsx(P,{label:b("physics.joint-limits.stiffness"),value:u.stiffness,onChange:x=>{u.stiffness=x,i(n,f)}}),l.jsx(P,{label:b("physics.joint-limits.damping"),value:u.damping,onChange:x=>{u.damping=x,i(n,f)}})]}):l.jsx(P,{label:b("physics.joint-limits.contact-distance"),value:u.contactDistance,onChange:x=>{u.contactDistance=x,i(n,f)}})]}):null})}),ot=j(o=>{const{inspectorConfig:t,model:e,onModelChange:i}=o,{property:n,label:s,info:a}=t,d=e.useMotor,c=e[n],f=c.props,{t:u}=z();return l.jsx(l.Fragment,{children:d?l.jsxs(re,{label:u(s),info:u(a),children:[l.jsx(P,{label:u("physics.joint-motor.target-velocity"),value:f.targetVelocity,onChange:b=>{f.targetVelocity=b,i(n,c)}}),l.jsx(P,{label:u("physics.joint-motor.force-limit"),value:f.forceLimit,onChange:b=>{f.forceLimit=b,i(n,c)}}),l.jsx(P,{label:u("physics.joint-motor.gear-ratio"),value:f.gearRatio,onChange:b=>{f.gearRatio=b,i(n,c)}}),l.jsx(ne,{label:u("physics.joint-motor.free-spin"),value:f.freeSpin,onChange:b=>{f.freeSpin=b,i(n,c)}})]}):null})});var nt=Object.defineProperty,st=Object.getOwnPropertyDescriptor,w=(o,t,e,i)=>{for(var n=i>1?void 0:i?st(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&nt(t,e,n),n};let O=class extends v{constructor(t,e){super(t,e);p(this,"axis",{x:1,y:0,z:0});p(this,"useLimits",!1);p(this,"useSpring",!1);p(this,"limits",{class:"JointLimits",props:{max:0,min:0,contactDistance:-1,stiffness:0,damping:0}});p(this,"useMotor",!1);p(this,"motor",{class:"JointMotor",props:{targetVelocity:0,forceLimit:Number.MAX_VALUE,gearRatio:1,freeSpin:!1}})}async applyBoundPathChange(t,e,i){if(t==="limits"){const n=this._buildLimitsFromModel(i);if(!n)return;await super.applyBoundPathChange(t,e,n);return}if(t==="motor"){const n=this._buildMotorFromModel(i);if(!n)return;await super.applyBoundPathChange(t,e,n);return}await super.applyBoundPathChange(t,e,i)}_buildLimitsFromModel(t){const e=t==null?void 0:t.props;if(!e)return null;const i=new be;return i.max=e.max,i.min=e.min,i.contactDistance=e.contactDistance,i.stiffness=e.stiffness,i.damping=e.damping,i}_buildMotorFromModel(t){const e=t==null?void 0:t.props;if(!e)return null;const i=new ge;return i.targetVelocity=e.targetVelocity,i.forceLimit=e.forceLimit,i.gearRatio=e.gearRatio,i.freeSpin=e.freeSpin,i}};w([y(),h({label:r("physics.hinge-joint.axis.title"),type:m.Vector3,bindPath:"axis"})],O.prototype,"axis",2);w([y(),h({label:r("physics.hinge-joint.use-limits.title"),type:m.Boolean,bindPath:"useLimits"})],O.prototype,"useLimits",2);w([y(),h({label:r("physics.hinge-joint.use-spring.title"),type:m.Boolean,bindPath:"useSpring"})],O.prototype,"useSpring",2);w([y(),h({label:r("physics.hinge-joint.limits.title"),customComponent:it,bindPath:"limits"})],O.prototype,"limits",2);w([y(),h({label:r("physics.hinge-joint.use-motor.title"),type:m.Boolean,bindPath:"useMotor"})],O.prototype,"useMotor",2);w([y(),h({label:r("physics.hinge-joint.motor.title"),customComponent:ot,bindPath:"motor"})],O.prototype,"motor",2);O=w([A({type:"HingeJoint",componentsMenu:{label:r("component.physics.hinge-joint.title"),group:"physics"},dependentComponent:{type:"DynamicCollider",dependentMode:G.AutoAdd}})],O);var rt=Object.defineProperty,at=Object.getOwnPropertyDescriptor,M=(o,t,e,i)=>{for(var n=i>1?void 0:i?at(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&rt(t,e,n),n};let _=class extends v{constructor(t,e){super(t,e);p(this,"spring",10);p(this,"damper",.2);p(this,"minDistance",0);p(this,"maxDistance",0);p(this,"tolerance",.025)}};M([y(),h({label:r("physics.spring-joint.spring.title"),type:m.Number,bindPath:"spring"})],_.prototype,"spring",2);M([y(),h({label:r("physics.spring-joint.damper.title"),type:m.Number,bindPath:"damper"})],_.prototype,"damper",2);M([y(),h({label:r("physics.spring-joint.min-distance.title"),type:m.Number,bindPath:"minDistance"})],_.prototype,"minDistance",2);M([y(),h({label:r("physics.spring-joint.max-distance.title"),type:m.Number,bindPath:"maxDistance"})],_.prototype,"maxDistance",2);M([y(),h({label:r("physics.spring-joint.tolerance.title"),type:m.Number,bindPath:"tolerance"})],_.prototype,"tolerance",2);_=M([A({type:"SpringJoint",componentsMenu:{label:r("component.physics.spring-joint.title"),group:"physics"},dependentComponent:{type:"DynamicCollider",dependentMode:G.AutoAdd}})],_);class lt extends Ce{constructor(){super(...arguments);p(this,"_isPlaying",!1)}onPlay(e){this._isPlaying=e,this._toggleAll(e)}onAddComponent(e){!this._isPlaying&&(e instanceof W||e instanceof q)&&(e.enabled=!1)}_toggleAll(e){var a;const i=(a=this.engine.sceneManager.activeScene)==null?void 0:a.rootEntities;if(!i)return;const n=[],s=[];i.forEach(d=>{d.getComponentsIncludeChildren(W,n),d.getComponentsIncludeChildren(q,s)}),n.forEach(d=>{d.enabled=e}),s.forEach(d=>{d.enabled=e})}}var ct=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,dt=(o,t,e,i)=>{for(var n=i>1?void 0:i?pt(t,e):t,s=o.length-1,a;s>=0;s--)(a=o[s])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&ct(t,e,n),n};let ie=class{constructor(){p(this,"script")}init(){this.script=xe.addScript(lt)}};ie=dt([Se({type:"physicsStore"})],ie);export{T as C,g as D,te as F,O as H,ie as P,k as S,_ as a};
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty;var c=(o,t,e)=>t in o?m(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var a=(o,t,e)=>(c(o,typeof t!="symbol"?t+"":t,e),e);import{s as f,p as h,C as g}from"./index-aec7e708.js";import"./index-e8a45e82.js";import{c as b}from"./Component-ed7aa0ab.js";import"./postmen-2f47f6bb.js";import{L as u}from"./LightBaseComponent-12dc27d1.js";var P=Object.defineProperty,d=Object.getOwnPropertyDescriptor,l=(o,t,e,p)=>{for(var n=p>1?void 0:p?d(t,e):t,i=o.length-1,r;i>=0;i--)(r=o[i])&&(n=(p?r(t,e,n):r(n))||n);return p&&n&&P(t,e,n),n};let s=class extends u{constructor(t,e){super(t,e);a(this,"distance",60)}};l([f(),h({type:g.Number,bindPath:"distance",label:"light.point.distance.label",info:"light.point.distance.info"})],s.prototype,"distance",2);s=l([b({type:"PointLight",componentsMenu:{group:"light",label:"component.light.point.title"}})],s);export{s as PointLightComponent};
@@ -0,0 +1,6 @@
1
+ var $=Object.defineProperty;var G=(e,t,s)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var E=(e,t,s)=>(G(e,typeof t!="symbol"?t+"":t,s),s);import{aG as _,aU as q,aS as l,aX as Q,dC as H,e as u,aD as J,aP as D,dD as K,aT as M,dE as U,aQ as A,dF as S,dG as W,dH as X,dI as Y,bm as Z,dJ as ee,dK as te,dL as se,bN as oe,q as re,dM as ne,dN as ae,dO as ce,bl as le,t as ie,dP as fe,dQ as pe,dR as me,cC as ue,dS as B,dT as L,cy as be,E as de,a as z,s as C,p as T,C as w,l as ye,g as he}from"./index-aec7e708.js";import{u as ge}from"./index-e8a45e82.js";import{c as Pe}from"./Component-ed7aa0ab.js";import{D as je,M as Ee}from"./Menu-0b8da92f.js";import{A as xe,a as Ce}from"./Accordion-3d330bc6.js";/**
2
+ * @license @tabler/icons-react v3.24.0 - MIT
3
+ *
4
+ * This source code is licensed under the MIT license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */var Te=_("outline","edit","IconEdit",[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]]);function ke(e){const{renameable:t,onDelete:s,removable:a,checkable:c,defaultChecked:r,onCheckedChange:o}=e;return l.jsxs(D,{align:"v",css:{flex:1,justifyContent:"space-between"},children:[l.jsxs(D,{children:[c&&l.jsx(K,{style:{marginRight:"5px"},checked:r,onCheckedChange:o,onClick:n=>n.stopPropagation()}),l.jsx("span",{children:e.title})]}),l.jsxs(D,{gap:"xxs",children:[t&&l.jsx(M,{as:"div",variant:"subtle","aria-hidden":!0,tabIndex:-1,size:"xs",onClick:n=>{n.preventDefault(),n.stopPropagation(),s&&s()},children:l.jsx(Te,{size:"14px"})}),a&&l.jsx(M,{as:"div",variant:"subtle","aria-hidden":!0,tabIndex:-1,size:"xs",onClick:n=>{n.preventDefault(),n.stopPropagation(),s&&s()},children:l.jsx(U,{size:"14px"})})]})]})}const O={TonemappingEffect:"post-process.effects.tone-mapping.title",BloomEffect:"post-process.effects.bloom.title"};function Ie(e){const{label:t,info:s,items:a=[],menuItems:c=[],onClickMenu:r,onDelete:o,addItemText:n="Add Item",defaultValue:p,onCheckedChange:f}=e,b=i=>()=>{o&&o(i)},P=q.useMemo(()=>a.length?a.map(i=>`${i.id}`):[],[a]),j=l.jsxs(Q,{size:"sm",variant:"soft",css:{width:"100%",marginTop:"$1","& > svg":{marginRight:"$1"}},children:[l.jsx(H,{size:"12px"}),String(u(n))]});return l.jsxs(J,{label:u(t),info:s,direction:"column",children:[a.length&&l.jsx(xe,{type:"multiple",defaultValue:p??P,"data-state":"closed",children:a.map(i=>l.jsx(Ce,{value:`${i.id}`,title:l.jsx(ke,{title:u(O[i.name]),onDelete:b(i),removable:i.removable,renameable:i.renameable,checkable:i.checkable,defaultChecked:i.defaultChecked,onCheckedChange:k=>{f&&f(k,i)}}),arrow:!!i.children,children:i.children&&l.jsx(D,{direction:"column",children:i.children})},i.name))}),l.jsx(je,{trigger:j,children:c.map(i=>l.jsx(Ee,{name:u(O[i.name]),onClick:()=>{r&&r(i)}},i.id))})]})}const h={TonemappingEffect:{constructor:B},BloomEffect:{constructor:L,defaultValue:{intensity:1,dirtIntensity:1}}},d={highQualityFiltering:{label:"post-process.effects.bloom.high-quality-filtering.label",info:"post-process.effects.bloom.high-quality-filtering.info"},scatter:{label:"post-process.effects.bloom.scatter.label",info:"post-process.effects.bloom.scatter.info"},downScale:{label:"post-process.effects.bloom.down-scale.label",info:"post-process.effects.bloom.down-scale.info"},threshold:{label:"post-process.effects.bloom.threshold.label",info:"post-process.effects.bloom.threshold.info"},intensity:{label:"post-process.effects.bloom.intensity.label",info:"post-process.effects.bloom.intensity.info"},tint:{label:"post-process.effects.bloom.tint.label",info:"post-process.effects.bloom.tint.info"},dirtTexture:{label:"post-process.effects.bloom.dirt-texture.label",info:"post-process.effects.bloom.dirt-texture.info"},dirtIntensity:{label:"post-process.effects.bloom.dirt-intensity.label",info:"post-process.effects.bloom.dirt-intensity.info"},mode:{label:"post-process.effects.tone-mapping.mode.label",info:"post-process.effects.tone-mapping.mode.info"}},De=A(({item:e,effectIndex:t,effect:s,onParameterChange:a})=>{const{assetStore:c}=ge();return s?l.jsx(l.Fragment,{children:e.parameters.map((r,o)=>{var b,P,j,i,k,F,V,v,N;const{name:n,value:p}=r,f=s[n];if(!(f instanceof S))return null;switch(f.constructor){case me:return l.jsx(ue,{label:u(((b=d[n])==null?void 0:b.label)??n),min:f.min,max:f.max,value:Number(p),dragStep:.01,onChange:m=>{a(t,o,m)}},o);case fe:return l.jsx(pe,{label:u(((P=d[n])==null?void 0:P.label)??n),value:!!p,onChange:m=>{a(t,o,m)}},o);case ce:return l.jsx(le,{label:u(((j=d[n])==null?void 0:j.label)??n),options:ie(f.enumType,void 0,m=>u(`post-process.effects.options.${m.toLocaleLowerCase()}`)),value:p,onChange:m=>{a(t,o,m)}},o);case ne:return l.jsx(ae,{label:u(((i=d[n])==null?void 0:i.label)??n),value:p,onChange:m=>{a(t,o,m)}},o);case se:{const m=c.assets,I=m[(k=r.value)==null?void 0:k.refId],R=Object.values(m).filter(y=>y.getMetaConfig().type==="Texture"&&!y.isSubAsset);return l.jsx(oe,{label:u(((F=d[n])==null?void 0:F.label)??n),dropLayer:re.Texture,assets:R,asset:I,value:I==null?void 0:I.name,placeholder:u("texture.select-texture"),onSelect:y=>{a(t,o,y.getCurrentRef())},onLocate:()=>{var y;c.selectAsset((y=r.value)==null?void 0:y.refId)},onDelete:()=>{a(t,o,null)}},o)}case ee:return l.jsx(te,{label:u(((V=d[n])==null?void 0:V.label)??n),value:p,onChange:m=>{a(t,o,m)}},o);case Y:return l.jsx(Z,{label:u(((v=d[n])==null?void 0:v.label)??n),value:p,onChange:m=>{a(t,o,m)}},o);case W:return l.jsx(X,{label:u(((N=d[n])==null?void 0:N.label)??n),value:p,onChange:m=>{a(t,o,m)}},o);default:return null}})}):null}),we=A(({model:e,onModelChange:t})=>{const s=e.effects,a=r=>{const o=be(s);r(o),t==null||t("effects",o)},c=(r,o,n)=>{a(p=>{var b;const f=p[r];(b=f==null?void 0:f.parameters)!=null&&b[o]&&(f.parameters[o]={...f.parameters[o],value:n})})};return l.jsx(Ie,{label:u("post-process.effects.title"),addItemText:u("post-process.effects.add"),menuItems:Object.keys(h).map(r=>({id:r,name:r})),onClickMenu:r=>{const o=r.name;a(n=>{n.some(p=>p.name===o)||n.push({name:o,enabled:!0,parameters:[]})})},onCheckedChange:(r,o)=>{a(n=>{const p=n[Number(o.id)];p&&(p.enabled=r)})},onDelete:r=>{a(o=>{o.splice(Number(r.id),1)})},items:s.map((r,o)=>{var f;const n=(f=h[r.name])==null?void 0:f.constructor,p=n?e.engineObject.getEffect(n):null;return{children:l.jsx(De,{item:r,effectIndex:o,effect:p,onParameterChange:c}),id:String(o),name:r.name,removable:!0,checkable:!0,defaultChecked:r.enabled}})})});function ze(e){return e==null||typeof e!="object"?e:"r"in e&&"g"in e&&"b"in e&&"a"in e?{r:e.r,g:e.g,b:e.b,a:e.a}:"x"in e&&"y"in e&&"z"in e&&"w"in e?{x:e.x,y:e.y,z:e.z,w:e.w}:"x"in e&&"y"in e&&"z"in e?{x:e.x,y:e.y,z:e.z}:"x"in e&&"y"in e?{x:e.x,y:e.y}:e}function Se(e,t,s){if(s.parameters.length>0)return;const a=h[e].defaultValue??{},c=[];for(const r in t){const o=t[r];if(!(o instanceof S))continue;const n=a[r];n!==void 0&&(o.value=n),c.push({name:r,value:ze(n??o.value)??null})}s.parameters=c}async function Fe(e,t,s){var a;if(s!=null&&s.refId){const c=await e.root.assetStore.getAssetByRef(s);t.value=(c==null?void 0:c.engineObject)??null;return}if((a=t.value)!=null&&a.copyFrom&&s&&typeof s=="object"){t.value.copyFrom(s);return}t.value=s}async function Ve(e,t){const s=e.engineObject,a=new Set;for(let c=0;c<t.length;c++){const r=t[c],{name:o,enabled:n}=r;if(!h[o])continue;const p=h[o].constructor;a.add(p);let f=s.getEffect(p);if(f||(f=s.addEffect(p)),!!f){Se(o,f,r),f.enabled=n;for(let b=0;b<r.parameters.length;b++){const{name:P,value:j}=r.parameters[b],i=f[P];i instanceof S&&await Fe(e,i,j)}}}for(const c of Object.keys(h)){const r=h[c].constructor;a.has(r)||s.getEffect(r)&&s.removeEffect(r)}}function ve(e){const t={};return e.forEach(s=>{t[s.name]={value:s.value}}),t}function Ne(e){const t=[];for(const s in e)s!=="enabled"&&t.push({name:s,value:e[s].value});return t}function Me(e){return e.map(t=>({params:[{classType:t.name}],result:{props:Object.assign(ve(t.parameters),{enabled:t.enabled})}}))}function Oe(e){return e.map(t=>({name:t.params[0].classType,enabled:t.result.props.enabled,parameters:Ne(t.result.props)}))}var Ae=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,x=(e,t,s,a)=>{for(var c=a>1?void 0:a?Be(t,s):t,r=e.length-1,o;r>=0;r--)(o=e[r])&&(c=(a?o(t,s,c):o(c))||c);return a&&c&&Ae(t,s,c),c};const Le={TonemappingEffect:{constructor:B},BloomEffect:{constructor:L,defaultValue:{intensity:1,dirtIntensity:1}}};let g=class extends de{constructor(t,s){super(t,s);E(this,"isGlobal",!0);E(this,"blendDistance",0);E(this,"priority",0);E(this,"layer",[z.Layer0]);E(this,"effects",[])}};x([C(),T({label:"post-process.global.title",info:"post-process.global.info",type:w.Toggle,bindPath:"isGlobal"})],g.prototype,"isGlobal",2);x([C(),T({label:"post-process.blend-distance.title",info:"post-process.blend-distance.info",type:w.Number,bindPath:"blendDistance",min:0,dragStep:.01,when:e=>!e.isGlobal})],g.prototype,"blendDistance",2);x([C(),T({label:"post-process.priority.title",info:"post-process.priority.info",type:w.Number,bindPath:"priority",dragStep:1})],g.prototype,"priority",2);x([C(ye()),T({label:"post-process.layer.title",info:"post-process.layer.info",type:w.Select,...he([z.Nothing,z.Everything]),bindPath:"layer"})],g.prototype,"layer",2);x([C({type:"methods",key:"addEffect",onSerialize:Me,onDeserialize:Oe,resolveMethodArguments:async e=>e.map(t=>{var s;if(t&&typeof t=="object"&&"classType"in t){const a=t.classType,c=(s=Le[a])==null?void 0:s.constructor;if(!c)throw new Error(`Effect constructor not found for: ${a}`);return c}return t})}),T({customComponent:we,onChange:async(e,t,s)=>{await Ve(e,s)}})],g.prototype,"effects",2);g=x([Pe({type:"PostProcess",componentsMenu:{label:"component.post-process.title"}})],g);export{g as P};
@@ -0,0 +1 @@
1
+ var z=Object.defineProperty;var k=(d,t,e)=>t in d?z(d,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[t]=e;var b=(d,t,e)=>(k(d,typeof t!="symbol"?t+"":t,e),e);import{dX as N,dY as F,aQ as j,aR as L,aS as C,bN as R,q as O,aV as G,aD as $,dZ as U,C as V,ct as J,d_ as P,by as K,e as S,d$ as D,e0 as W,e1 as Q,e2 as q,e3 as X,dV as Y,de as Z,e4 as H,_ as v,m as tt,a$ as et,x as st,aL as B,n as nt,dr as it}from"./index-aec7e708.js";import{T as at}from"./TaskQueue-05c94a4d.js";import{u as x,I as rt}from"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";import{A as ot}from"./AssetViewer-64cd01fa.js";class w{static update(t,e){!this.entity&&(this.entity=t.createChild("prefab"));const s=this.tempCloneEntity=e.engineObject.instantiate();this.entity.addChild(s)}static clear(){this.entity.clearChildren(),this.tempCloneEntity&&this.tempCloneEntity.destroy()}}b(w,"entity"),b(w,"tempCloneEntity");const M=new F("buildGltfAssetTemplateDiffs");function dt(d,t){var s;M.info("START",{sceneRootName:d==null?void 0:d.name,sceneRootRotation:(s=d==null?void 0:d.transform)!=null&&s.rotation?{x:d.transform.rotation.x,y:d.transform.rotation.y,z:d.transform.rotation.z}:null,sceneChildCount:d==null?void 0:d.childCount,baselineRootName:t==null?void 0:t.name,baselineChildCount:t==null?void 0:t.childCount});const e=N(d,t);return M.info("RESULT",{diffCount:e?Object.keys(e.entityProps??{}).length:0,paths:e?Object.keys(e.entityProps??{}):[]}),e}const ct=j(({asset:d})=>{const{dependentAssets:t}=d,{configDataStore:e}=x(),{t:s}=L(),a=j(({dependentAssetInfo:n})=>{const{assetStore:i}=x(),r=Object.values(i.assets).filter(c=>{const l=c.getMetaConfig().type,y=c.id===n.id,u=c.id===d.id,h=!y&&!u&&!c.isSubAsset;return n.type==="glTF"||n.type==="Prefab"?l==="glTF"||l==="Prefab"&&h:c.getMetaConfig().type===n.type&&h}),o=i.assets[n.id],p=o==null?void 0:o.name;return C.jsx(R,{dropLayer:O.Asset,placeholder:s("prefab.inspector.missed"),assets:r,onSelect:c=>{d.replaceDependentAsset(n,c)},onLocate:()=>{i.selectAsset(n.id)},value:p,asset:o})});return C.jsxs(C.Fragment,{children:[C.jsx(G,{title:s("prefab.inspector.basic-info"),defaultOpen:!0,children:e.isBuc&&C.jsx($,{label:s("prefab.inspector.url")})}),C.jsx(U,{label:s("prefab.inspector.dependent-assets"),children:t.map((n,i)=>C.jsx(a,{dependentAssetInfo:n},`${n.id}-${i}`))})]})}),pt={entities:[{id:"defaultPrefab",name:"prefab",isActive:!0,transform:{class:"Transform",props:{position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1}}},parent:null,children:[],isClone:!1,components:[]}]};class lt extends ot{constructor(){super(...arguments);b(this,"_animators",[]);b(this,"_particles",[])}setViewAsset(e,s){const a=e.entityManager.rootEntities[0];this._entity=a.engineObject,s.addChild(this._entity),a.getComponentsIncludeChildren("Animator",this._animators).forEach(r=>{r.applyBoundPathChange("enabled",V.Toggle,r.enabled)}),this._entity.getComponentsIncludeChildren(J,this._particles).forEach(r=>{r.generator.stop(!1,P.StopEmittingAndClear),r.generator.main.simulationSpeed=1,r.generator.play()})}stopViewAsset(){super.stopViewAsset(),this._particles.forEach(e=>{e.generator.stop(!1,P.StopEmittingAndClear)})}}var ft=Object.defineProperty,ht=Object.getOwnPropertyDescriptor,E=(d,t,e,s)=>{for(var a=s>1?void 0:s?ht(t,e):t,n=d.length-1,i;n>=0;n--)(i=d[n])&&(a=(s?i(t,e,a):i(a))||a);return s&&a&&ft(t,e,a),a};const I=it("PrefabAsset"),T=new F("PrefabAsset");let _=class extends rt{constructor(t){super(t);b(this,"acceptDragLayer",O.Entity);b(this,"_entityManager");b(this,"_contentQueue",new at);b(this,"entities",[]);b(this,"dependentAssets",[]);b(this,"_skipInitUpdateContent",!1);this._entityManager=new q(t)}static async createByEntity(t){var e,s,a;if(t.isPrefabSubEntity||t.isGLTFRefEntity){K.error(S("prefab.error.create-from-sub"));return}D()&&W();try{T.info("createByEntity START",{entityName:t.name,entityId:t.id,isGLTFWrap:t.isGLTFWrapEntity,childCount:(e=t.children)==null?void 0:e.length,childNames:(s=t.children)==null?void 0:s.map(i=>i.name),hasGLTFChild:(a=t.children)==null?void 0:a.some(i=>i.isGLTFRefEntity)});const{assetFacade:n}=t.root;await t.root.runInUndoGroup("asset.create",async()=>{const i=await n.createAssetByAdd({assetType:"Prefab",name:t.name});i.addInstance(t,{undoable:!0}),await i.updateByEntity(t,!1,{undoable:!0})})}finally{D()&&Q()}}get entityManager(){return this._entityManager}async initByMain(t,e){const{dependentAssets:s}=this.meta;this.url=e;const a=JSON.parse(await t.text());if(this.entities=a.entities,this.dependentAssets=s,this._skipInitUpdateContent){this._skipInitUpdateContent=!1;return}await this._updateContent()}async initByCreation(){return this.entities=pt.entities,this._skipInitUpdateContent=!0,this.getMainData()}async updateByEntity(t,e=!1,s){var r;T.info("updateByEntity START",{entityName:t.name,entityId:t.id,isGLTFWrap:t.isGLTFWrapEntity,updateInstanceFrom:e});const{entities:a,assets:n}=this._getEntityDataIncludeChildren(t,[],new Set);T.info("updateByEntity serialized",{entityCount:a.length,entities:a.map(o=>{var p;return{name:o.name,isClone:o.isClone,instanceAssetId:(p=o.instance)==null?void 0:p.assetId,hasAssetTemplateDiffs:!!o.assetTemplateDiffs,assetTemplateDiffKeys:o.assetTemplateDiffs?Object.keys(o.assetTemplateDiffs.entityProps??{}):[]}})});const i=a[0];(r=i.transform)!=null&&r.props&&(i.transform.props.position={x:0,y:0,z:0}),i.parent=null,this.entities=a,this.dependentAssets=Array.from(n,o=>({id:o.id,name:o.name,type:o.getMetaConfig().type})),this._updateCreateByAddResumeSnapshot(),e&&this.addInstance(t),await this._updateContent(s!=null&&s.undoable?{undoable:!0}:void 0)}async refreshFromData(t){await this._updateContent(t)}replaceDependentAsset(t,e){const s=JSON.stringify(this.entities);this.entities=JSON.parse(s.replace(new RegExp(t.id,"g"),e.id)),t.id=e.id,t.name=e.name,this._updateContent()}destroy(){super.destroy(),this.engineObject&&(this.engineObject._root.destroy(),this.engineObject.destroy())}unpackAllInstances(){this._instances.forEach((t,e)=>{const s=t.entities.get(e);s==null||s.unpackPrefab()}),super.unpackAllInstances()}async instantiate(t,e,s){var o,p;const a=this._entityManager.rootEntities[0].id,n=this._entityManager.getEntityFilesById(a);e&&((p=(o=n[0])==null?void 0:o.transform)!=null&&p.props)&&(n[0].transform.props.position=e.position,n[0].transform.props.rotation=e.rotation,n[0].transform.props.scale=e.scale),s!=null&&s.expectedRootId&&n[0]&&(n[0].id=s.expectedRootId);const r=(await t.deserializeEntities(n))[0];return r.convertToPrefabRefEntity(),this.addInstance(r,s),this._bindInstantiatedEntity(r,s),r}_updateCreateByAddResumeSnapshot(){const t=this.getMainData(),e=this.getMetaData(),s=this.name??"Prefab",a=t==null?null:new Blob([t instanceof ArrayBuffer||typeof t=="string"?t:JSON.stringify(t)]);this.root.assetStore.updateCreateByAddResumeSnapshot(this.id,{assetName:s,serializedMeta:JSON.stringify(e),mainBlob:a})}_bindInstantiatedEntity(t,e){const s=this._entityManager.rootEntities[0];if(!s)return;const{entityMappings:a,componentMappings:n}=this._collectInstanceMappings(s,t);if(!a.length)return;const{prefab:i}=this.root.domainStore.state,r=i.byAssetId[this.id]??[];for(const p of r){const c=i.bindings[p];if((c==null?void 0:c.instanceRootEntityId)===t.id){const l=[],y=this.root.domainStore.getNormalizedState(),u=y.entities[t.id];if(u){l.push({op:u.instance?"replace":"add",path:`/entities/${t.id}/instance`,value:{bindingId:p,assetId:this.id,assetKind:"Prefab",role:"root",sourceEntityId:c.sourceRootEntityId}});for(const h of n){const f=X(y,t.id,h.sceneComponentId);f&&l.push({op:f.instance?"replace":"add",path:`/entities/${t.id}/components/${h.sceneComponentId}/instance`,value:{bindingId:p,role:"linked",sourceComponentKey:h.sourceComponentKey}})}}l.length>0&&this.root.domainStore.applySystem(l);return}}let o=1;for(const p of r){const c=i.bindings[p];c&&c.sourceRevision>o&&(o=c.sourceRevision)}this.root.prefabFacade.bindExistingInstance({assetId:this.id,instanceRootEntityId:t.id,sourceRevision:o,entityMappings:a,componentMappings:n,undoable:(e==null?void 0:e.undoable)===!0})}_collectInstanceMappings(t,e){const s=[],a=[],n=(i,r,o)=>{var h;const p=(i==null?void 0:i.id)??r.id;s.push({sceneEntityId:r.id,sourceEntityId:p,role:o});const c=(i==null?void 0:i.components)??[],l=r.components??[];for(let f=0;f<l.length;f++){const m=l[f];if(!(m!=null&&m.id))continue;const g=((h=c[f])==null?void 0:h.id)??m.id;a.push({sceneEntityId:r.id,sceneComponentId:m.id,sourceComponentKey:g})}const y=(i==null?void 0:i.selfChildren)??[],u=r.selfChildren??[];for(let f=0;f<u.length;f++)n(y[f],u[f],"linked")};return n(t,e,"root"),{entityMappings:s,componentMappings:a}}async replaceInstance(t,e,s){var o;const a=e.entities.get(t),n=(o=a==null?void 0:a.engineObject)==null?void 0:o.transform,i=n?{position:{x:n.position.x,y:n.position.y,z:n.position.z},rotation:{x:n.rotation.x,y:n.rotation.y,z:n.rotation.z},scale:{x:n.scale.x,y:n.scale.y,z:n.scale.z}}:void 0,r=await this.instantiate(e,i,s);return r.convertToPrefabRefEntity(),e.replaceEntity(t,r),r}_instantiateEngineObject(){return this.engineObject.instantiate()}_onDrop(t,e){if(!e||e.id===this.id)return;this.dropping=!1;const{sceneStore:s,sceneUIStore:a}=this.root,n=Array.from(a.selectedKeys);if(n.length>1)for(let i=0;i<n.length;i++)_.createByEntity(s.entities.get(n[i]));else Y({title:S("prefab.replace.title").toString(),description:S("prefab.replace.description",{name:this.name}).toString(),confirmText:S("prefab.replace.confirm").toString(),onConfirm:()=>{const i=s.entities.get(n[0]);this.updateByEntity(i,!0)}})}_rebaseInstanceRevisions(){const{prefabFacade:t,domainStore:e}=this.root,s=e.state.prefab.byAssetId[this.id];if(!s||s.length===0)return;let a=0;for(const n of s){const i=e.state.prefab.bindings[n];i&&i.sourceRevision>a&&(a=i.sourceRevision)}t.updatePrefabContent(this.id,a+1)}_getEntityDataIncludeChildren(t,e,s){var i,r,o,p;const a=this.root.assetStore,n=t.toJSON(!0);if(e.push(n),!t.isGLTFRefEntity)t.components.forEach(c=>{var y;const l=Z(c);for(const u in l)if(l[u].type==="AssetPicker"){const h=(y=c[u])==null?void 0:y.refId;if(h){const f=a.assets[h];f&&s.add(f)}}}),t.children.map(c=>!c.prefabEntityRemoved&&this._getEntityDataIncludeChildren(c,e,s)),(i=t.strippedEntity)==null||i.clear();else{const c=a.assets[t.instanceAssetId];s.add(c);let l=null;try{l=(r=c.instantiateEngineObject)==null?void 0:r.call(c),T.info("_getEntityDataIncludeChildren glTF branch",{entityName:t.name,instanceAssetId:t.instanceAssetId,hasBaseline:!!l,sceneChildCount:(o=t.selfChildren??t.children)==null?void 0:o.length,sceneChildRotations:(p=t.selfChildren??t.children)==null?void 0:p.map(g=>{const A=g.transform;return A!=null&&A.rotation?{x:A.rotation.x,y:A.rotation.y,z:A.rotation.z}:null})});const m=(l==null?void 0:l.childCount)>0?l.getChild(0):l;if(m&&t.engineObject){const g=dt(t.engineObject,m);T.info("diffs result",{diffs:g}),g&&(n.assetTemplateDiffs=g)}}finally{l==null||l.destroy()}const y=t.entityManager.strippedEntities,u=t.getAddedComponents(),h=t.getAddedEntities(),f=new Set;u.forEach(m=>{f.add(m.strippedId)}),h.forEach(m=>{f.add(m.strippedId)}),f.forEach(m=>{const g=y.get(m);this._getEntityDataIncludeChildren(g,e,s)})}return{entities:e,assets:s}}_updateContent(t){return this._contentQueue.enqueue(async()=>{try{await this._updateContentInternal(t)}catch(e){if(e instanceof Error&&e.message==="cancelled")return;I.error("_updateContent failed:",e)}})}async _updateContentInternal(t){const{url:e,dependentAssets:s}=this,a=(t==null?void 0:t.persist)!==!1;await Promise.all(s.map(p=>this.root.assetStore.getAssetByRef({refId:p.id}))),await this._entityManager.init(this);const n=this.engineObject;if(n){this.root.assetStore.engineObjectToAssetMap.delete(n);try{n.destroy()}catch(p){I.warn("failed to destroy oldEngineObject:",p)}}const i=new H(this.engine,e);this.bindEngineObject(i),this.root.assetStore.engineObjectToAssetMap.set(i,this);let r=this._entityManager.rootEntities[0];r||(r=this._entityManager.createEntity("prefab","defaultPrefab"),r.bindEngineObject(new v(this.engine,"prefab")),I.error(`The prefab which id is ${this.id} is broken, use default prefab instead.`)),r.engineObject||(I.warn("rootEntity engineObject is null, binding new Entity"),r.bindEngineObject(new v(this.engine,"prefab"))),this._markAsTemplate(r),i._root=r.engineObject,r.once("delete",()=>{I.error(`The prefab which id is ${this.id} is broken.`),this._updateContent().catch(p=>{I.error(`Failed to rebuild broken prefab which id is ${this.id}.`,p)})}),this._updateDragTempEntity(),this.updateThumbnail(),a&&(this.root.assetFacade.persistAssetMeta(this.id),this.root.assetFacade.persistAssetMain(this.id));const o=t!=null&&t.undoable?{undoable:!0}:void 0;await Promise.all(Array.from(this._instances,([p,c])=>this.replaceInstance(p,c,o))),this._rebaseInstanceRevisions()}_markAsTemplate(t){const e=t.engineObject;if(!e){I.warn("_markAsTemplate: engineObject is null",{prefabId:this.id,entityModelId:t.id});return}const s=e;s._templateResource||s._markAsTemplate(this.engineObject),t.selfChildren.forEach(a=>{this._markAsTemplate(a)})}};E([tt()],_.prototype,"entities",2);E([et(),st],_.prototype,"dependentAssets",2);E([B],_.prototype,"replaceDependentAsset",1);E([B],_.prototype,"_onDrop",1);_=E([nt({type:"Prefab",label:S("asset.prefab.title"),extname:"prefab",dragLayer:O.Prefab,customInspector:ct,viewer:lt,thumbnail:w,async bundle(d){return{content:new Blob([d.content],{type:"application/json"})}}})],_);export{_ as PrefabAsset};
@@ -0,0 +1 @@
1
+ var wt=Object.defineProperty;var Mt=(C,s,n)=>s in C?wt(C,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):C[s]=n;var A=(C,s,n)=>(Mt(C,typeof s!="symbol"?s+"":s,n),n);import{K as it,U as q,bE as Rt,af as dt,ag as mt,ah as ft,aj as yt,bF as Pt,ad as at,bG as ct,ae as rt,bH as It,j as At,_ as Ht,O as _t,p as B,e as b,C as T,t as Bt,m as V,n as Tt,o as Vt,q as Nt}from"./index-aec7e708.js";import"./index-e8a45e82.js";import"./meshopt_simplifier.module-cd99529d.js";import{a as Et}from"./bundlers-9b0d37fc.js";import{M as Dt}from"./MeshThumbnail-ab28b3b8.js";const z=class z{static createSphere(s=.5,n=18){n=Math.max(2,Math.floor(n));const e=n+1,o=e*e,c=n*n,p=z._generateIndices(o,c*6),R=Math.PI,t=R*2,a=1/e,y=1/n,m=8,h=new Float32Array(o*m);for(let x=0;x<o;++x){const u=x%e,d=x*a|0,l=u*y,i=d*y,M=l*t,f=i*R,v=Math.sin(f),I=-s*Math.cos(M)*v,P=s*Math.cos(f),S=s*Math.sin(M)*v;let r=x*m;h[r++]=I,h[r++]=P,h[r++]=S,h[r++]=I,h[r++]=P,h[r++]=S,h[r++]=l,h[r++]=i}let w=0;for(let x=0;x<c;++x){const u=x%n,l=(x*y|0)*e+u,i=l+1,M=l+e,f=M+1;p[w++]=i,p[w++]=l,p[w++]=f,p[w++]=l,p[w++]=M,p[w++]=f}const g=new q;return g.min.set(-s,-s,-s),g.max.set(s,s,s),{indices:p,vertices:h,bounds:g}}static createCuboid(s=1,n=1,e=1){const o=s/2,c=n/2,p=e/2,R=8,t=new Float32Array(24*R);t[0]=-o,t[1]=c,t[2]=-p,t[6]=0,t[7]=0,t[8]=o,t[9]=c,t[10]=-p,t[14]=1,t[15]=0,t[16]=o,t[17]=c,t[18]=p,t[22]=1,t[23]=1,t[24]=-o,t[25]=c,t[26]=p,t[30]=0,t[31]=1;for(let m=0;m<4;m++){let h=R*m+3;t[h++]=0,t[h++]=1,t[h++]=0}t[32]=-o,t[33]=-c,t[34]=-p,t[38]=0,t[39]=1,t[40]=o,t[41]=-c,t[42]=-p,t[46]=1,t[47]=1,t[48]=o,t[49]=-c,t[50]=p,t[54]=1,t[55]=0,t[56]=-o,t[57]=-c,t[58]=p,t[62]=0,t[63]=0;for(let m=0;m<4;m++){let h=R*m+35;t[h++]=0,t[h++]=-1,t[h++]=0}t[64]=-o,t[65]=c,t[66]=-p,t[70]=0,t[71]=0,t[72]=-o,t[73]=c,t[74]=p,t[78]=1,t[79]=0,t[80]=-o,t[81]=-c,t[82]=p,t[86]=1,t[87]=1,t[88]=-o,t[89]=-c,t[90]=-p,t[94]=0,t[95]=1;for(let m=0;m<4;m++){let h=R*m+67;t[h++]=-1,t[h++]=0,t[h++]=0}t[96]=o,t[97]=c,t[98]=-p,t[102]=1,t[103]=0,t[104]=o,t[105]=c,t[106]=p,t[110]=0,t[111]=0,t[112]=o,t[113]=-c,t[114]=p,t[118]=0,t[119]=1,t[120]=o,t[121]=-c,t[122]=-p,t[126]=1,t[127]=1;for(let m=0;m<4;m++){let h=R*m+99;t[h++]=1,t[h++]=0,t[h++]=0}t[128]=-o,t[129]=c,t[130]=p,t[134]=0,t[135]=0,t[136]=o,t[137]=c,t[138]=p,t[142]=1,t[143]=0,t[144]=o,t[145]=-c,t[146]=p,t[150]=1,t[151]=1,t[152]=-o,t[153]=-c,t[154]=p,t[158]=0,t[159]=1;for(let m=0;m<4;m++){let h=R*m+131;t[h++]=0,t[h++]=0,t[h++]=1}t[160]=-o,t[161]=c,t[162]=-p,t[166]=1,t[167]=0,t[168]=o,t[169]=c,t[170]=-p,t[174]=0,t[175]=0,t[176]=o,t[177]=-c,t[178]=-p,t[182]=0,t[183]=1,t[184]=-o,t[185]=-c,t[186]=-p,t[190]=1,t[191]=1;for(let m=0;m<4;m++){let h=R*m+163;t[h++]=0,t[h++]=0,t[h++]=-1}const a=new Uint16Array(36);a[0]=0,a[1]=2,a[2]=1,a[3]=2,a[4]=0,a[5]=3,a[6]=4,a[7]=6,a[8]=7,a[9]=6,a[10]=4,a[11]=5,a[12]=8,a[13]=10,a[14]=9,a[15]=10,a[16]=8,a[17]=11,a[18]=12,a[19]=14,a[20]=15,a[21]=14,a[22]=12,a[23]=13,a[24]=16,a[25]=18,a[26]=17,a[27]=18,a[28]=16,a[29]=19,a[30]=20,a[31]=22,a[32]=23,a[33]=22,a[34]=20,a[35]=21;const y=new q;return y.min.set(-o,-c,-p),y.max.set(o,c,p),{vertices:t,bounds:y,indices:a}}static createPlane(s=1,n=1,e=1,o=1){e=Math.max(1,Math.floor(e)),o=Math.max(1,Math.floor(o));const c=e+1,p=o+1,R=s/2,t=n/2,a=s/e,y=n/o,m=c*p,h=o*e,w=z._generateIndices(m,h*6),g=1/c,x=1/e,u=1/o,d=8,l=new Float32Array(m*d);for(let f=0;f<m;++f){const v=f%c,I=f*g|0;let P=f*d;l[P++]=v*a-R,l[P++]=0,l[P++]=I*y-t,l[P++]=0,l[P++]=1,l[P++]=0,l[P++]=v*x,l[P++]=I*u}let i=0;for(let f=0;f<h;++f){const v=f%e,P=(f*x|0)*c+v,S=P+1,r=P+c,E=r+1;w[i++]=P,w[i++]=r,w[i++]=S,w[i++]=r,w[i++]=E,w[i++]=S}const M=new q;return M.min.set(-R,0,-t),M.max.set(R,0,t),{bounds:M,vertices:l,indices:w}}static createCylinder(s=.5,n=.5,e=2,o=20,c=1){o=Math.floor(o),c=Math.floor(c);const p=o+1,R=c+1,t=e*.5,a=e/c,y=p*R,m=o*c,h=o*2,w=y+2+h,g=z._generateIndices(w,m*6+h*3),x=1/p,u=1/o,d=1/c,l=8,i=new Float32Array(w*l);let M=0;const f=Math.PI,v=Math.PI*2,I=n-s,P=I/e,S=I/c;for(let F=0;F<y;++F){const Z=F%p,W=F*x|0,O=Z*u,J=W*d,$=f+O*v,et=Math.sin($),ht=Math.cos($),ut=n-W*S,xt=ut*et,vt=W*a-t,Ct=ut*ht;let L=F*l;i[L++]=xt,i[L++]=vt,i[L++]=Ct,i[L++]=et,i[L++]=P,i[L++]=ht,i[L++]=O,i[L++]=1-J}for(let F=0;F<m;++F){const Z=F%o,O=(F*u|0)*p+Z,J=O+1,$=O+p,et=$+1;g[M++]=J,g[M++]=$,g[M++]=O,g[M++]=J,g[M++]=et,g[M++]=$}let r=y*l;i[r++]=0,i[r++]=-t,i[r++]=0,i[r++]=0,i[r++]=-1,i[r++]=0,i[r++]=.5,i[r++]=.5,i[r++]=0,i[r++]=t,i[r++]=0,i[r++]=0,i[r++]=1,i[r++]=0,i[r++]=.5,i[r++]=.5,r=(y+2)*l;const E=1/(s*2),j=1/(n*2),D=p*c;for(let F=0;F<o;++F){const Z=F*l;let W=i[Z],O=i[Z+2];i[r++]=W,i[r++]=-t,i[r++]=O,i[r++]=0,i[r++]=-1,i[r++]=0,i[r++]=W*j+.5,i[r++]=.5-O*j;const J=(F+D)*l;W=i[J],O=i[J+2],i[r++]=W,i[r++]=t,i[r++]=O,i[r++]=0,i[r++]=1,i[r++]=0,i[r++]=W*E+.5,i[r++]=.5-O*E}const Y=y+1,X=y+2,U=X+1;for(let F=0;F<o;++F){const Z=F*2,W=F===o-1?0:Z+2;g[M++]=y,g[M++]=X+W,g[M++]=X+Z,g[M++]=Y,g[M++]=U+Z,g[M++]=U+W}const Q=new q,K=Math.max(s,n);return Q.min.set(-K,-t,-K),Q.max.set(K,t,K),{bounds:Q,vertices:i,indices:g}}static createTorus(s=.5,n=.1,e=30,o=30,c=360){e=Math.floor(e),o=Math.floor(o);const p=(e+1)*(o+1),R=e*o,t=z._generateIndices(p,R*6),a=8,y=new Float32Array(p*a);c=c/180*Math.PI;let m=0;const h=z._tempVec30;for(let x=0;x<=e;x++)for(let u=0;u<=o;u++){const d=u/o*c,l=x/e*Math.PI*2,i=Math.cos(l),M=Math.sin(l),f=Math.cos(d),v=Math.sin(d),I=(s+n*i)*f,P=(s+n*i)*v,S=n*M;y[m++]=I,y[m++]=P,y[m++]=S;const r=s*f,E=s*v;h.set(I-r,P-E,S).normalize(),y[m++]=h.x,y[m++]=h.y,y[m++]=h.z,y[m++]=u/o,y[m++]=x/e}m=0;for(let x=1;x<=e;x++)for(let u=1;u<=o;u++){const d=(o+1)*x+u-1,l=(o+1)*(x-1)+u-1,i=(o+1)*(x-1)+u,M=(o+1)*x+u;t[m++]=d,t[m++]=l,t[m++]=M,t[m++]=l,t[m++]=i,t[m++]=M}const w=new q,g=s+n;return w.min.set(-g,-g,-n),w.max.set(g,g,n),{bounds:w,vertices:y,indices:t}}static createCone(s=.5,n=2,e=20,o=1){e=Math.floor(e),o=Math.floor(o);const c=e+1,p=o+1,R=n*.5,t=n/o,a=c*p,y=e*o,m=a+1+e,h=z._generateIndices(m,y*6+e*3),w=1/c,g=1/e,x=1/o,u=8,d=new Float32Array(m*8);let l=0;const i=Math.PI,M=Math.PI*2,f=s/n;for(let r=0;r<a;++r){const E=r%c,j=r*w|0,D=E*g,Y=j*x,X=i+D*M,U=Math.sin(X),Q=Math.cos(X),K=s-j*s,F=K*U,Z=j*t-R,W=K*Q;let O=r*u;d[O++]=F,d[O++]=Z,d[O++]=W,d[O++]=U,d[O++]=f,d[O++]=Q,d[O++]=D,d[O++]=1-Y}for(let r=0;r<y;++r){const E=r%e,D=(r*g|0)*c+E,Y=D+1,X=D+c,U=X+1;h[l++]=Y,h[l++]=X,h[l++]=D,h[l++]=Y,h[l++]=U,h[l++]=X}let v=a*u;d[v++]=0,d[v++]=-R,d[v++]=0,d[v++]=0,d[v++]=-1,d[v++]=0,d[v++]=.5,d[v++]=.5,v=(a+1)*u;const I=1/(s*2);for(let r=0;r<e;++r){const E=d[r*u],j=d[r*u+2];d[v++]=E,d[v++]=-R,d[v++]=j,d[v++]=0,d[v++]=-1,d[v++]=0,d[v++]=E*I+.5,d[v++]=.5-j*I}const P=a+1;for(let r=0;r<e;++r){const E=r,j=r===e-1?0:E+1;h[l++]=a,h[l++]=P+j,h[l++]=P+E}const S=new q;return S.min.set(-s,-R,-s),S.max.set(s,R,s),{bounds:S,vertices:d,indices:h}}static createCapsule(s=.5,n=2,e=6,o=1){e=Math.max(2,Math.floor(e)),o=Math.floor(o);const c=e+1,p=o+1,R=n*.5,t=n/o,a=c*p,y=e*o,m=c*c,h=e*e,w=a+2*m,g=z._generateIndices(w,(y+2*h)*6),x=1/c,u=1/e,d=1/o,l=Math.PI,i=Math.PI*2,M=8,f=new Float32Array(w*M);let v=0;for(let P=0;P<a;++P){const S=P%c,r=P*x|0,E=S*u,j=r*d,D=l+E*i,Y=Math.sin(D),X=Math.cos(D);let U=P*M;f[U++]=s*Y,f[U++]=r*t-R,f[U++]=s*X,f[U++]=Y,f[U++]=0,f[U++]=X,f[U++]=E,f[U++]=1-j}for(let P=0;P<y;++P){const S=P%e,E=(P*u|0)*c+S,j=E+1,D=E+c,Y=D+1;g[v++]=j,g[v++]=D,g[v++]=E,g[v++]=j,g[v++]=Y,g[v++]=D}z._createCapsuleCap(s,n,e,l,i,a,1,f,g,v),z._createCapsuleCap(s,n,e,l,-i,a+m,-1,f,g,v+6*h);const I=new q;return I.min.set(-s,-s-R,-s),I.max.set(s,s+R,s),{bounds:I,vertices:f,indices:g}}static _generateIndices(s,n){let e=null;return s>65535?e=new Uint32Array(n):e=new Uint16Array(n),e}static _createCapsuleCap(s,n,e,o,c,p,R,t,a,y){const m=e+1,h=n*.5*R,w=m*m,g=e*e,x=1/m,u=1/e,d=8;for(let l=0;l<w;++l){const i=l%m,M=l*x|0,f=i*u,v=M*u,I=o+f*c,P=v*Math.PI*.5,S=Math.sin(P),r=s*Math.sin(I)*S,E=s*Math.cos(P)*R+h,j=s*Math.cos(I)*S;let D=(l+p)*d;t[D++]=r,t[D++]=E,t[D++]=j,t[D++]=r,t[D++]=E-h,t[D++]=j,t[D++]=f,t[D++]=v}for(let l=0;l<g;++l){const i=l%e,f=(l*u|0)*m+i+p,v=f+1,I=f+m,P=I+1;a[y++]=v,a[y++]=f,a[y++]=P,a[y++]=f,a[y++]=I,a[y++]=P}}static createSubdivisionSurfaceSphereData(s=.5,n=3){n=Rt.clamp(Math.floor(n),1,6);const e=new Float32Array(3*(6*Math.pow(4,n)+2)),o=new Float32Array(24*Math.pow(4,n));this._subdiveCatmullClark(n,e,o);const c=e.length/3,p=o.length/4,R=c+Math.pow(2,n+1)-1,t=R+16,a=new Float32Array(t*8),y=this._generateIndices(c,p*6);let m=0;const h={};for(let x=0;x<c;x++){let u=3*x,d=e[u],l=e[u+1],i=e[u+2];const M=1/Math.sqrt(d*d+l*l+i*i);if(d*=M,l*=M,i*=M,u=8*x,a[u]=d*s,a[u+1]=l*s,a[u+2]=i*s,a[u+3]=d,a[u+4]=l,a[u+5]=i,a[u+6]=(Math.PI-Math.atan2(i,d))/(2*Math.PI),a[u+7]=Math.acos(l)/Math.PI,a[u+6]===0){const f=8*(c+m++);a.set(a.subarray(u,u+8),f),a[f+6]=1,h[u/8]=f/8}}let w=0;this._spherePoleIdx=0;for(let x=0;x<p;x++){const u=4*x;let d=o[u],l=o[u+1],i=o[u+2],M=o[u+3];const f=8*d,v=8*l,I=8*i,P=8*M;a[f+2]+a[v+2]+a[I+2]<0&&(a[f+6]===0&&(d=h[d]),a[v+6]===0&&(l=h[l]),a[I+6]===0&&(i=h[i]),a[P+6]===0&&(M=h[M])),y[w]=d,y[w+1]=l,y[w+2]=i,this._generateAndReplacePoleUV(y,a,w,R),y[w+3]=d,y[w+4]=i,y[w+5]=M,this._generateAndReplacePoleUV(y,a,w+3,R),w+=6}const g=new q;return g.min.set(-s,-s,-s),g.max.set(s,s,s),{indices:y,vertices:a,bounds:g}}static _generateAndReplacePoleUV(s,n,e,o){const c=n[8*s[e]+7];if(c===0||c===1){const p=8*s[e],R=8*(o+this._spherePoleIdx);n.set(n.subarray(p,p+8),R),n[R+6]=.5*(n[p+6]+n[8*s[e+1]+6]+n[8*s[e+2]+6]-.5),s[e]=o+this._spherePoleIdx++}}static _subdiveCatmullClark(s,n,e){const o=new Map,c=new Array;n.set(this._sphereSeedPositions),e.set(this._sphereSeedCells);for(let p=0;p<s;p++){const R=6*Math.pow(4,p),t=4*R+2;o.clear(),c.length=0;for(let w=0;w<R;w++){const g=c[w]={facePoint:new it,adjacentEdges:new Array(4)};for(let x=0;x<4;x++){const u=3*e[4*w+x];g.facePoint.x+=.25*n[u],g.facePoint.y+=.25*n[u+1],g.facePoint.z+=.25*n[u+2]}for(let x=0;x<4;x++){const u=e[4*w+x],d=e[4*w+(x+1)%4],l=Math.min(u,d)*t+Math.max(u,d);if(!o.has(l)){const v={edgePoint:new it,edgePointIndex:void 0},I=3*u,P=3*d;v.edgePoint.set(.25*(n[I]+n[P]),.25*(n[I+1]+n[P+1]),.25*(n[I+2]+n[P+2])),o.set(l,v)}const i=o.get(l);g.adjacentEdges[x]=i;const M=i.edgePoint,f=g.facePoint;M.x+=.25*f.x,M.y+=.25*f.y,M.z+=.25*f.z}}const a=R+2,y=a+R;let m=0;this._sphereEdgeIdx=0;const h=e.slice(0,4*R);for(let w=0;w<R;w++){const g=c[w];g.facePoint.copyToArray(n,3*(a+w));const x=a+w;let u,d,l;for(let i=0;i<4;i++){const M=h[m++];switch(i){case 0:{const v=g.adjacentEdges[i%4],I=g.adjacentEdges[(i+3)%4];d=this._calculateEdgeIndex(n,v,y),u=this._calculateEdgeIndex(n,I,y),l=u;break}case 1:case 2:{const v=g.adjacentEdges[i%4];u=d,d=this._calculateEdgeIndex(n,v,y);break}case 3:{u=d,d=l;break}}const f=4*(4*w+i);e[f]=M,e[f+1]=d,e[f+2]=x,e[f+3]=u}}}}static _calculateEdgeIndex(s,n,e){if(n.edgePointIndex!==void 0)return n.edgePointIndex;{n.edgePoint.copyToArray(s,3*(e+this._sphereEdgeIdx));const o=e+this._sphereEdgeIdx++;return n.edgePointIndex=o,o}}};A(z,"_tempVec30",new it),A(z,"_sphereSeedPositions",new Float32Array([-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1])),A(z,"_sphereSeedCells",new Float32Array([0,1,2,3,3,2,4,5,5,4,6,7,7,0,3,5,7,6,1,0,6,4,2,1])),A(z,"_sphereEdgeIdx",0),A(z,"_spherePoleIdx",0);let k=z;function Ft(){return[new at(ct.Position,0,rt.Vector3,0),new at(ct.Normal,12,rt.Vector3,0),new at(ct.UV,24,rt.Vector2,0)]}function lt(C,s,{vertices:n,indices:e,bounds:o}){const c=new dt(s,mt.VertexBuffer,n,ft.Static),p=new dt(s,mt.IndexBuffer,e,ft.Static);C.setVertexElements(Ft()),C.setIndexBufferBinding(p,e instanceof Uint16Array?yt.UInt16:yt.UInt32),C.setVertexBufferBinding(c,32),C.bounds=o,C.subMesh?C.subMesh.count=e.length:C.addSubMesh(0,e.length)}class St extends It{constructor(s,n,e){super(s),this.engine=n,this.generateData=e}restoreContent(){lt(this.resource,this.engine,this.generateData())}}function Ot(C,s,n){s.resourceManager.addContentRestorer(new St(C,s,n))}function jt(C,s,n){const e=new Pt(C,s);return Ot(e,C,n),lt(e,C,n()),e}var Ut=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,_=(C,s,n,e)=>{for(var o=e>1?void 0:e?zt(s,n):s,c=C.length-1,p;c>=0;c--)(p=C[c])&&(o=(e?p(s,n,o):p(o))||o);return e&&o&&Ut(s,n,o),o},bt=(C=>(C.Sphere="sphere",C.Cuboid="cuboid",C.Plane="plane",C.Cylinder="cylinder",C.Torus="torus",C.Cone="cone",C.Capsule="capsule",C))(bt||{});const gt=C=>C.type==="sphere",ot=C=>C.type==="capsule",st=C=>C.type==="cone",pt=C=>C.type==="cuboid",G=C=>C.type==="cylinder",tt=C=>C.type==="torus",nt=C=>C.type==="plane",N=C=>C._updateData();let H=class extends At{constructor(s){super(s);A(this,"type","sphere");A(this,"sphereRadius",.5);A(this,"sphereStep",3);A(this,"capsuleRadius",.5);A(this,"capsuleHeight",2);A(this,"capsuleRadialSegments",6);A(this,"capsuleHeightSegments",1);A(this,"coneRadius",.5);A(this,"coneHeight",2);A(this,"coneRadialSegment",20);A(this,"coneHeightSegment",1);A(this,"cuboidWidth",1);A(this,"cuboidHeight",1);A(this,"cuboidDepth",1);A(this,"cylinderRadiusTop",.5);A(this,"cylinderRadiusBottom",.5);A(this,"cylinderHeight",2);A(this,"cylinderRadialSegment",20);A(this,"cylinderHeightSegment",1);A(this,"planeWidth",1);A(this,"planeHeight",1);A(this,"planeHorizontalSegments",1);A(this,"planeVerticalSegments",1);A(this,"torusRadius",.5);A(this,"torusTubeRadius",.1);A(this,"torusRadialSegments",30);A(this,"torusTubularSegments",30);A(this,"torusArc",360)}async initByCreation(s,n,e){const c=(typeof(e==null?void 0:e.primitiveType)=="string"?e.primitiveType:"").trim().toLowerCase();return{type:{sphere:"sphere",cube:"cuboid",cuboid:"cuboid",cylinder:"cylinder",plane:"plane",capsule:"capsule",cone:"cone",torus:"torus"}[c]??"sphere"}}async initByMain(s,n){const e=JSON.parse(await s.text()),o=this.engine,c=e.type;for(const y in e)this[y]=e[y];const p=jt(o,c,()=>this._generateDataByType(this.type));this.bindEngineObject(p);const R=new Ht(o,c&&c.charAt(0).toUpperCase()+c.slice(1)),t=R.addComponent(_t);t.mesh=this.engineObject;const a=await this.root.assetStore.getAssetByRef({refId:"0000200"});t.setMaterial(a.engineObject),this.setDragTempEntity(R)}instantiate(){const s=this.root.sceneStore.createEntity(),n=this.getDragTempEntity();return s.initByEngineObject(n.clone()),s}_updateData(){const s=this.engine,n=this._engineObject;lt(n,s,this._generateDataByType(this.type))}_generateDataByType(s){switch(s){case"sphere":return k.createSubdivisionSurfaceSphereData(this.sphereRadius,this.sphereStep);case"capsule":return k.createCapsule(this.capsuleRadius,this.capsuleHeight,this.capsuleRadialSegments,this.capsuleHeightSegments);case"cone":return k.createCone(this.coneRadius,this.coneHeight,this.coneRadialSegment,this.coneHeightSegment);case"cuboid":return k.createCuboid(this.cuboidWidth,this.cuboidHeight,this.cuboidDepth);case"cylinder":return k.createCylinder(this.cylinderRadiusTop,this.cylinderRadiusBottom,this.cylinderHeight,this.cylinderRadialSegment,this.cylinderHeightSegment);case"plane":return k.createPlane(this.planeWidth,this.planeHeight,this.planeHorizontalSegments,this.planeVerticalSegments);case"torus":return k.createTorus(this.torusRadius,this.torusTubeRadius,this.torusRadialSegments,this.torusTubularSegments,this.torusArc);default:return k.createSphere(this.sphereRadius,this.sphereStep)}}};_([B({label:b("asset.primitive-mesh.type.label"),info:b("asset.primitive-mesh.type.info"),type:T.Select,value:"sphere",options:Bt(bt),onChange(C){C._updateData()}}),V()],H.prototype,"type",2);_([B({label:b("asset.primitive-mesh.sphere.radius.label"),info:b("asset.primitive-mesh.sphere.radius.info"),type:T.Number,min:0,dragStep:.1,when:gt,onChange:N}),V()],H.prototype,"sphereRadius",2);_([B({label:b("asset.primitive-mesh.sphere.step.label"),info:b("asset.primitive-mesh.sphere.step.info"),type:T.Number,min:1,dragStep:1,when:gt,onChange:N}),V()],H.prototype,"sphereStep",2);_([B({label:b("asset.primitive-mesh.capsule.radius.label"),info:b("asset.primitive-mesh.capsule.radius.info"),type:T.Number,min:0,dragStep:.1,when:ot,onChange:N}),V()],H.prototype,"capsuleRadius",2);_([B({label:b("asset.primitive-mesh.capsule.height.label"),info:b("asset.primitive-mesh.capsule.height.info"),type:T.Number,min:0,dragStep:.1,when:ot,onChange:N}),V()],H.prototype,"capsuleHeight",2);_([B({label:b("asset.primitive-mesh.capsule.radial-segments.label"),info:b("asset.primitive-mesh.capsule.radial-segments.info"),type:T.Number,min:1,dragStep:1,when:ot,onChange:N}),V()],H.prototype,"capsuleRadialSegments",2);_([B({label:b("asset.primitive-mesh.capsule.height-segments.label"),info:b("asset.primitive-mesh.capsule.height-segments.info"),type:T.Number,min:1,dragStep:1,when:ot,onChange:N}),V()],H.prototype,"capsuleHeightSegments",2);_([B({label:b("asset.primitive-mesh.cone.radius.label"),info:b("asset.primitive-mesh.cone.radius.info"),type:T.Number,min:0,dragStep:.1,when:st,onChange:N}),V()],H.prototype,"coneRadius",2);_([B({label:b("asset.primitive-mesh.cone.height.label"),info:b("asset.primitive-mesh.cone.height.info"),type:T.Number,min:0,dragStep:.1,when:st,onChange:N}),V()],H.prototype,"coneHeight",2);_([B({label:b("asset.primitive-mesh.cone.radial-segments.label"),info:b("asset.primitive-mesh.cone.radial-segments.info"),type:T.Number,min:1,dragStep:1,when:st,onChange:N}),V()],H.prototype,"coneRadialSegment",2);_([B({label:b("asset.primitive-mesh.cone.height-segments.label"),info:b("asset.primitive-mesh.cone.height-segments.info"),type:T.Number,min:1,dragStep:1,when:st,onChange:N}),V()],H.prototype,"coneHeightSegment",2);_([B({label:b("asset.primitive-mesh.cuboid.width.label"),info:b("asset.primitive-mesh.cuboid.width.info"),type:T.Number,min:0,dragStep:.1,when:pt,onChange:N}),V()],H.prototype,"cuboidWidth",2);_([B({label:b("asset.primitive-mesh.cuboid.height.label"),info:b("asset.primitive-mesh.cuboid.height.info"),type:T.Number,min:0,dragStep:.1,when:pt,onChange:N}),V()],H.prototype,"cuboidHeight",2);_([B({label:b("asset.primitive-mesh.cuboid.depth.label"),info:b("asset.primitive-mesh.cuboid.depth.info"),type:T.Number,min:0,dragStep:.1,when:pt,onChange:N}),V()],H.prototype,"cuboidDepth",2);_([B({label:b("asset.primitive-mesh.cylinder.radius-top.label"),info:b("asset.primitive-mesh.cylinder.radius-top.info"),type:T.Number,min:0,dragStep:.1,when:G,onChange:N}),V()],H.prototype,"cylinderRadiusTop",2);_([B({label:b("asset.primitive-mesh.cylinder.radius-bottom.label"),info:b("asset.primitive-mesh.cylinder.radius-bottom.info"),type:T.Number,min:0,dragStep:.1,when:G,onChange:N}),V()],H.prototype,"cylinderRadiusBottom",2);_([B({label:b("asset.primitive-mesh.cylinder.height.label"),info:b("asset.primitive-mesh.cylinder.height.info"),type:T.Number,min:0,dragStep:.1,when:G,onChange:N}),V()],H.prototype,"cylinderHeight",2);_([B({label:b("asset.primitive-mesh.cylinder.radial-segments.label"),info:b("asset.primitive-mesh.cylinder.radial-segments.info"),type:T.Number,min:1,dragStep:1,when:G,onChange:N}),V()],H.prototype,"cylinderRadialSegment",2);_([B({label:b("asset.primitive-mesh.cylinder.height-segments.label"),info:b("asset.primitive-mesh.cylinder.height-segments.info"),type:T.Number,min:1,dragStep:1,when:G,onChange:N}),V()],H.prototype,"cylinderHeightSegment",2);_([B({label:b("asset.primitive-mesh.plane.width.label"),info:b("asset.primitive-mesh.plane.width.info"),type:T.Number,min:0,dragStep:.1,when:nt,onChange:N}),V()],H.prototype,"planeWidth",2);_([B({label:b("asset.primitive-mesh.plane.height.label"),info:b("asset.primitive-mesh.plane.height.info"),type:T.Number,min:0,dragStep:.1,when:nt,onChange:N}),V()],H.prototype,"planeHeight",2);_([B({label:b("asset.primitive-mesh.plane.horizontal-segments.label"),info:b("asset.primitive-mesh.plane.horizontal-segments.info"),type:T.Number,min:1,dragStep:1,when:nt,onChange:N}),V()],H.prototype,"planeHorizontalSegments",2);_([B({label:b("asset.primitive-mesh.plane.vertical-segments.label"),info:b("asset.primitive-mesh.plane.vertical-segments.info"),type:T.Number,min:1,dragStep:1,when:nt,onChange:N}),V()],H.prototype,"planeVerticalSegments",2);_([B({label:b("asset.primitive-mesh.torus.radius.label"),info:b("asset.primitive-mesh.torus.radius.info"),type:T.Number,min:0,dragStep:.1,when:tt,onChange:N}),V()],H.prototype,"torusRadius",2);_([B({label:b("asset.primitive-mesh.torus.tube-radius.label"),info:b("asset.primitive-mesh.torus.tube-radius.info"),type:T.Number,min:0,dragStep:.1,when:tt,onChange:N}),V()],H.prototype,"torusTubeRadius",2);_([B({label:b("asset.primitive-mesh.torus.radial-segments.label"),info:b("asset.primitive-mesh.torus.radial-segments.info"),type:T.Number,min:1,dragStep:1,when:tt,onChange:N}),V()],H.prototype,"torusRadialSegments",2);_([B({label:b("asset.primitive-mesh.torus.tubular-segments.label"),info:b("asset.primitive-mesh.torus.tubular-segments.info"),type:T.Number,min:1,dragStep:1,when:tt,onChange:N}),V()],H.prototype,"torusTubularSegments",2);_([B({label:b("asset.primitive-mesh.torus.arc.label"),info:b("asset.primitive-mesh.torus.arc.info"),type:T.Number,min:0,dragStep:.1,when:tt,onChange:N}),V()],H.prototype,"torusArc",2);H=_([Tt({type:"PrimitiveMesh",label:b("asset.primitive-mesh.title"),loaderType:"PrimitiveMesh",importMenuConfig:{type:Vt.Add},defaultName:"Mesh",dragLayer:Nt.PrimitiveMesh,thumbnail:Dt,async bundle({content:C}){return{content:new Blob([Et(await C.text())])}}})],H);export{H as PrimitiveMesh};
@@ -0,0 +1 @@
1
+ import{C as n,z as g,T as A,V as C,B as I,R as h,F as x,t as R,G as y,H as m,I as P,J as E,K as B,N as V}from"./index-aec7e708.js";import"./index-e8a45e82.js";var w=(e=>(e.Vector2="Vector2",e.Vector3="Vector3",e.Vector4="Vector4",e.Color="Color",e.Float="Float",e.Texture="Texture",e.Boolean="Boolean",e.Integer="Integer",e))(w||{});function t(e,r){return e.indexOf(r)!==-1}function u(e,r,a){const o=r.engineObject.shaderData;a==="enable"?o.enableMacro(e):o.disableMacro(e)}async function l(e,r,a,o,d){var T;const i=e.engineObject.shaderData;let s;const p=r.toString();switch(o){case n.Slider:case n.Number:case"Float":i.setFloat(p,a);break;case n.Toggle:case n.Boolean:case n.Select:case"Integer":i.setInt(p,Number(a));break;case n.AssetPicker:case"Texture":if(a){const c=await e.root.assetStore.getAssetByRef(a);if(c){const b=c.engineObject;i.setTexture(p,b),d&&u(d,e,"enable")}else i.setTexture(p,null),d&&u(d,e,"disable"),console.error(`${p} in ${e.name} is missing.`)}else i.setTexture(p,null),d&&u(d,e,"disable");break;case n.Vector2:case"Vector2":s=i.getVector2(p),a==null?i.setVector2(p,a):s?(s.x=a.x,s.y=a.y):i.setVector2(p,new V(a.x,a.y));break;case n.Vector3:case"Vector3":s=i.getVector3(p),a==null?i.setVector3(p,a):s?(s.x=a.x,s.y=a.y,s.z=a.z):i.setVector3(p,new B(a.x,a.y,a.z));break;case n.Vector4:case"Vector4":s=i.getVector4(p),a==null?i.setVector4(p,a):s?(s.x=a.x,s.y=a.y,s.z=a.z,s.w=a.w):i.setVector4(p,new C(a.x,a.y,a.z,a.w));break;case n.Color:case"Color":{s=i.getColor(p);let{r:c,g:b,b:S}=a;const{a:_,intensity:f=1}=a;c*=f,b*=f,S*=f,a==null?i.setColor(p,new I(c,b,S,_)):s?(s.r=c,s.g=b,s.b=S,s.a=_):i.setColor(p,new I(c,b,S,_));break}}(T=e.updateThumbnail)==null||T.call(e)}const M=[{prop:"material_IOR",defaultValue:1.5,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.ior",type:n.Slider,min:1,max:5,dragStep:.01,group:"Base"},engineType:"Float"},{prop:"material_BaseColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.base-color",type:n.Color,group:"Base"},engineType:"Color"},{prop:"material_BaseTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_BASETEXTURE")},bundleType:"shaderData",when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.base-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Base"},engineType:"Texture"},{prop:"material_Metal",defaultValue:1,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.metallic",type:n.Slider,min:0,max:1,dragStep:.01,group:"Metal roughness"},engineType:"Float"},{prop:"material_Roughness",defaultValue:1,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.roughness",type:n.Slider,min:0,max:1,dragStep:.01,group:"Metal roughness"},engineType:"Float"},{prop:"material_RoughnessMetallicTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.roughness-metallic-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Metal roughness"},engineType:"Texture"},{prop:"material_SpecularIntensity",defaultValue:1,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.pbr-specular-intensity",type:n.Slider,min:0,max:2,dragStep:.01,group:"Specular"},engineType:"Float"},{prop:"material_SpecularColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.pbr-specular-color",type:n.Color,group:"Specular"}},{prop:"material_SpecularIntensityTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SPECULAR_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.pbr-specular-intensity-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Specular"},engineType:"Texture"},{prop:"material_SpecularColorTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SPECULAR_COLOR_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.pbr-specular-color-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Specular"},engineType:"Texture"},{prop:"material_AnisotropyInfo",defaultValue:{x:1,y:0,z:0},bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Vector3)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.anisotropy-info",type:n.Vector3,group:"Anisotropy",hide:!0},engineType:"Vector3"},{prop:"anisotropy",defaultValue:0,bundleType:"other",async onChange(e,r,a){const o=e.material_AnisotropyInfo;a===0?u("MATERIAL_ENABLE_ANISOTROPY",e,"disable"):u("MATERIAL_ENABLE_ANISOTROPY",e,"enable"),o.z=a,e.material_AnisotropyInfo=o,await l(e,"material_AnisotropyInfo",o,n.Vector3)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.anisotropy",type:n.Slider,min:0,max:1,dragStep:.01,group:"Anisotropy"},setPath:"shaderData.getVector3('material_AnisotropyInfo').z",getPath:"shaderData.getVector3('material_AnisotropyInfo').z",valueType:g.Float},{prop:"anisotropyRotation",defaultValue:0,bundleType:"other",async onChange(e,r,a){const o=e.material_AnisotropyInfo,d=Math.PI/180*a;o.x=Math.cos(d),o.y=Math.sin(d),e.material_AnisotropyInfo=o,await l(e,"material_AnisotropyInfo",o,n.Vector3)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.anisotropy-rotation",type:n.Slider,min:0,max:360,dragStep:1,group:"Anisotropy"}},{prop:"material_AnisotropyTexture",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_ANISOTROPY_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.anisotropy-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Anisotropy"},engineType:"Texture"},{prop:"material_NormalTexture",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_NORMALTEXTURE")},bundleType:"shaderData",when:t.bind(null,["BlinnPhong","PBR","PbrSpecular"]),uiInfo:{label:"shader.material.normal-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Normal"},engineType:"Texture"},{prop:"material_NormalIntensity",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["BlinnPhong","PBR","PbrSpecular"]),uiInfo:{label:"shader.material.normal-intensity",type:n.Slider,min:0,max:5,dragStep:.1,group:"Normal"},engineType:"Float"},{prop:"material_EmissiveColor",defaultValue:{r:0,g:0,b:0,a:1,intensity:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.emissive-color",type:n.Color,mode:"hdr",group:"Emissive"}},{prop:"material_EmissiveTexture",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_EMISSIVETEXTURE")},bundleType:"shaderData",when:t.bind(null,["BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.emissive-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Emissive"},engineType:"Texture"},{prop:"material_SpecularColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["BlinnPhong"]),uiInfo:{label:"shader.material.specular-color",type:n.Color,group:"Blinn Phong"}},{prop:"material_SpecularTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SPECULAR_TEXTURE")},when:t.bind(null,["BlinnPhong"]),uiInfo:{label:"shader.material.specular-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Blinn Phong"},engineType:"Texture"},{prop:"material_Shininess",defaultValue:16,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["BlinnPhong"]),uiInfo:{label:"shader.material.shininess",type:n.Slider,min:0,max:100,dragStep:1,group:"Blinn Phong"},engineType:"Float"},{prop:"material_OcclusionTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_OCCLUSION_TEXTURE")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.occlusion-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Occlusion"},engineType:"Texture"},{prop:"material_OcclusionIntensity",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.occlusion-intensity",type:n.Slider,min:0,max:5,dragStep:.1,group:"Occlusion"},engineType:"Float"},{prop:"material_OcclusionTextureCoord",defaultValue:A.UV0,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.occlusion-texture-coord",type:n.Select,value:A.UV0,options:[{label:"shader.material.uv.uv0",value:A.UV0},{label:"shader.material.uv.uv1",value:A.UV1}],group:"Occlusion"},engineType:"Float"},{prop:"material_ClearCoat",defaultValue:0,bundleType:"other",async onChange(e,r,a){l(e,r,a,n.Slider),a===0?u("MATERIAL_ENABLE_CLEAR_COAT",e,"disable"):u("MATERIAL_ENABLE_CLEAR_COAT",e,"enable")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clearcoat",type:n.Slider,min:0,max:1,dragStep:.01,group:"Clear coat"},engineType:"Float",setPath:"shaderData.setFloat('material_ClearCoat', $value)",getPath:"shaderData.getFloat('material_ClearCoat')",valueType:g.Float},{prop:"material_ClearCoatTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_CLEAR_COAT_TEXTURE")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clear-coat-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Clear coat"},engineType:"Texture"},{prop:"material_ClearCoatRoughness",defaultValue:0,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clear-coat-roughness",type:n.Slider,min:0,max:1,dragStep:.01,group:"Clear coat"},engineType:"Float"},{prop:"material_ClearCoatRoughnessTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clear-coat-roughness-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Clear coat"},engineType:"Texture"},{prop:"material_ClearCoatNormalTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE")},when:t.bind(null,["PBR","PbrSpecular"]),uiInfo:{label:"shader.material.clear-coat-normal-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Clear coat"},engineType:"Texture"},{prop:"material_IridescenceInfo",defaultValue:{x:0,y:1.3,z:100,w:400},bundleType:"shaderData",async onChange(e,r,a){e.iridescence=a.x,e.iridescenceIOR=a.y,e.iridescenceRange.x=a.z,e.iridescenceRange.y=a.w},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence",type:n.Vector4,group:"Iridescence",hide:!0},engineType:"Vector4"},{prop:"iridescence",defaultValue:0,bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getVector4("material_IridescenceInfo");o?(o.x=a,l(e,"material_IridescenceInfo",o,n.Vector4)):l(e,"material_IridescenceInfo",new C(a,1.3,100,400),n.Vector4),a?u("MATERIAL_ENABLE_IRIDESCENCE",e,"enable"):u("MATERIAL_ENABLE_IRIDESCENCE",e,"disable")},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence",type:n.Slider,min:0,max:1,dragStep:.01,group:"Iridescence"},setPath:"shaderData.getVector4('material_IridescenceInfo').x",getPath:"shaderData.getVector4('material_IridescenceInfo').x",valueType:g.Float},{prop:"iridescenceIOR",defaultValue:1.3,bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getVector4("material_IridescenceInfo");o?(o.y=a,l(e,"material_IridescenceInfo",o,n.Vector4)):l(e,"material_IridescenceInfo",new C(0,a,100,400),n.Vector4)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence-ior",type:n.Slider,min:1,max:5,dragStep:.01,group:"Iridescence"},setPath:"shaderData.getVector4('material_IridescenceInfo').y",getPath:"shaderData.getVector4('material_IridescenceInfo').y",valueType:g.Float},{prop:"iridescenceRange",defaultValue:{x:100,y:400},bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getVector4("material_IridescenceInfo");o?(o.z=a.x,o.w=a.y,l(e,"material_IridescenceInfo",o,n.Vector4)):l(e,"material_IridescenceInfo",new C(0,1.3,a.x,a.y),n.Vector4)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence-range",type:n.Vector2,group:"Iridescence"},engineType:"Vector2"},{prop:"material_IridescenceThicknessTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence-thickness-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Iridescence"},engineType:"Texture"},{prop:"material_IridescenceTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_IRIDESCENCE_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.iridescence-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Iridescence"},engineType:"Texture"},{prop:"material_SheenColor",defaultValue:{r:0,g:0,b:0,a:1},bundleType:"shaderData",async onChange(e,r,a){if(e.sheenIntensity===1){const o=e.sheenColor;o.r=a.r,o.g=a.g,o.b=a.b}},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-color",type:n.Color,group:"Sheen",hide:!0},engineType:"Color"},{prop:"sheenColor",defaultValue:{r:0,g:0,b:0,a:1},bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getColor("material_SheenColor"),d=e.sheenIntensity??1,i=a.r*d,s=a.g*d,p=a.b*d;i+s+p>0?u("MATERIAL_ENABLE_SHEEN",e,"enable"):u("MATERIAL_ENABLE_SHEEN",e,"disable"),o?(o.set(i,s,p,a.a),l(e,"material_SheenColor",o,n.Color)):l(e,"material_SheenColor",new I(i,s,p,a.a),n.Color)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-color",type:n.Color,group:"Sheen"}},{prop:"sheenIntensity",defaultValue:1,bundleType:"other",async onChange(e,r,a){const o=e.engineObject.shaderData.getColor("material_SheenColor"),d=e.sheenColor,i=a,s=d.r*i,p=d.g*i,T=d.b*i,c=d.a;s+p+T>0?u("MATERIAL_ENABLE_SHEEN",e,"enable"):u("MATERIAL_ENABLE_SHEEN",e,"disable"),o?(o.set(s,p,T,c),l(e,"material_SheenColor",o,n.Color)):l(e,"material_SheenColor",new I(s,p,T,c),n.Color)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-intensity",type:n.Slider,min:0,max:1,dragStep:.01,group:"Sheen"}},{prop:"material_SheenRoughness",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-roughness",type:n.Slider,min:0,max:1,dragStep:.01,group:"Sheen"},engineType:"Float"},{prop:"material_SheenTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SHEEN_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Sheen"},engineType:"Texture"},{prop:"material_SheenRoughnessTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.sheen-roughness-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Sheen"},engineType:"Texture"},{prop:"material_Transmission",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){a?(u("MATERIAL_ENABLE_TRANSMISSION",e,"enable"),e.setRenderQueueType(h.Transparent)):(u("MATERIAL_ENABLE_TRANSMISSION",e,"disable"),e.isTransparent?e.setRenderQueueType(h.Transparent):e.material_AlphaCutoff?e.setRenderQueueType(h.AlphaTest):e.setRenderQueueType(h.Opaque)),l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.transmission",type:n.Slider,min:0,max:1,dragStep:.01,group:"Transmission"},engineType:"Float"},{prop:"material_TransmissionTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_TRANSMISSION_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.transmission-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Transmission"},engineType:"Texture"},{prop:"material_Thickness",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){a?u("MATERIAL_HAS_THICKNESS",e,"enable"):u("MATERIAL_HAS_THICKNESS",e,"disable"),l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.transmission-thickness",type:n.Slider,min:0,max:5,dragStep:.01,group:"Transmission"},engineType:"Float"},{prop:"material_ThicknessTexture",async onChange(e,r,a){return l(e,r,a,n.AssetPicker,"MATERIAL_HAS_THICKNESS_TEXTURE")},bundleType:"shaderData",when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.transmission-thickness-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Transmission"},engineType:"Texture"},{prop:"refractionMode",defaultValue:x.Planar,bundleType:"other",async onChange(e,r,a){e.engineObject.shaderData.enableMacro("REFRACTION_MODE",a.toString())},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.refraction-mode",type:n.Select,options:R(x),group:"Transmission"}},{prop:"material_AttenuationColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.attenuation-color",type:n.Color,group:"Transmission"},engineType:"Color"},{prop:"material_AttenuationDistance",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["PBR"]),uiInfo:{label:"shader.material.attenuation-distance",type:n.Slider,min:0,max:5,dragStep:.01,group:"Transmission"},engineType:"Float"},{prop:"u_lightMapTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker,"LIGHTMAP_TEXTURE")},when:t.bind(null,["bake-pbr"]),uiInfo:{label:"shader.material.lightmap-texture",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape!=="Cube",group:"Base"},engineType:"Texture"},{prop:"u_lightMapIntensity",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when(e){return e==="bake-pbr"},uiInfo:{label:"shader.material.lightmap-intensity",type:n.Slider,min:0,max:10,dragStep:.1,when(e){return e==="bake-pbr"},group:"Base"},engineType:"Float"},{prop:"material_TintColor",defaultValue:{r:1,g:1,b:1,a:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["SkyBox"]),uiInfo:{label:"shader.material.tint-color",type:n.Color,group:"Base"}},{prop:"material_Exposure",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyBox","SkyProcedural"]),uiInfo:{label:"shader.material.exposure",type:n.Slider,min:0,max:8,dragStep:.1,group:"Base"},engineType:"Float"},{prop:"material_Rotation",defaultValue:0,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyBox"]),uiInfo:{label:"shader.material.rotation",type:n.Slider,min:0,max:360,dragStep:1,group:"Base"},engineType:"Float"},{prop:"material_CubeTexture",bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.AssetPicker)},when:t.bind(null,["SkyBox"]),uiInfo:{label:"shader.material.texture-cube",type:n.AssetPicker,assetType:"Texture",customFilter:e=>e.shape==="Cube",group:"Base"},engineType:"Texture"},{prop:"sunMode",defaultValue:y.HighQuality,bundleType:"other",async onChange(e,r,a){switch(a){case y.HighQuality:u("MATERIAL_SUN_SIMPLE",e,"disable"),u("MATERIAL_SUN_HIGH_QUALITY",e,"enable");break;case y.Simple:u("MATERIAL_SUN_HIGH_QUALITY",e,"disable"),u("MATERIAL_SUN_SIMPLE",e,"enable");break;case y.None:u("MATERIAL_SUN_HIGH_QUALITY",e,"disable"),u("MATERIAL_SUN_SIMPLE",e,"disable");break;default:throw"SkyBoxProceduralMaterial: unknown sun value."}},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.sun-mode",type:n.Select,options:R(y),group:"Base"}},{prop:"material_SunSize",defaultValue:.04,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.sun-size",type:n.Slider,min:0,max:1,dragStep:.01,group:"Base"},engineType:"Float"},{prop:"material_SunSizeConvergence",defaultValue:5,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.sun-size-convergence",type:n.Slider,min:0,max:20,dragStep:.1,group:"Base"},engineType:"Float"},{prop:"material_AtmosphereThickness",defaultValue:1,bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Slider)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.atmosphere-thickness",type:n.Slider,min:0,max:5,dragStep:.1,group:"Base"},engineType:"Float"},{prop:"material_SkyTint",defaultValue:{r:.21404114048223255,g:.21404114048223255,b:.21404114048223255,a:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.sky-tint",type:n.Color,group:"Base"},engineType:"Color"},{prop:"material_GroundTint",defaultValue:{r:.11216882039252905,g:.09988709277986121,b:.09520561068319185,a:1},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Color)},when:t.bind(null,["SkyProcedural"]),uiInfo:{label:"shader.material.ground-tint",type:n.Color,group:"Base"},engineType:"Color"},{prop:"isTransparent",defaultValue:!1,bundleType:"other",async onChange(e,r,a){if(e.setBlendStateEnabled(a),e.setDepthWriteEnabled(!a),a?(e.setRenderQueueType(h.Transparent),u("MATERIAL_IS_TRANSPARENT",e,"enable")):(e.setRenderQueueType(e.material_AlphaCutoff?h.AlphaTest:h.Opaque),u("MATERIAL_IS_TRANSPARENT",e,"disable")),e.material_Transmission>0&&e.setRenderQueueType(h.Transparent),a)l(e,"material_ShadowCasterRenderQueue",h.AlphaTest,n.Number),l(e,"material_DepthOnlyRenderQueue",h.Transparent,n.Number);else{const d=e.material_AlphaCutoff?h.AlphaTest:h.Opaque;l(e,"material_ShadowCasterRenderQueue",d,n.Number),l(e,"material_DepthOnlyRenderQueue",d,n.Number)}},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.is-transparent",type:n.Toggle,group:"Common"}},{prop:"material_AlphaCutoff",defaultValue:0,bundleType:"shaderData",async onChange(e,r,a){const{shaderData:o}=e.engineObject,d=e.isTransparent;if(a){u("MATERIAL_IS_ALPHA_CUTOFF",e,"enable");const i=d?h.Transparent:h.AlphaTest;e.setRenderQueueType(i),o.setFloat("material_ShadowCasterRenderQueue",h.AlphaTest),o.setFloat("material_DepthOnlyRenderQueue",i)}else{u("MATERIAL_IS_ALPHA_CUTOFF",e,"disable");const i=d?h.Transparent:h.Opaque;e.setRenderQueueType(i);const s=d?h.AlphaTest:h.Opaque;o.setFloat("material_ShadowCasterRenderQueue",s),o.setFloat("material_DepthOnlyRenderQueue",i)}o.setFloat("material_AlphaCutoff",a),e.material_Transmission>0&&e.setRenderQueueType(h.Transparent)},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.alpha-cutoff",type:n.Slider,min:0,max:1,dragStep:.01,group:"Common"},engineType:"Float"},{prop:"renderFace",defaultValue:m.Front,bundleType:"other",async onChange(e,r,a){if(!["SkyBox","SkyProcedural"].includes(e.engineObject.shader.name))switch(a){case m.Front:e.setCullMode(P.Back);break;case m.Back:e.setCullMode(P.Front);break;case m.Double:e.setCullMode(P.Off);break}},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.render-face",type:n.Select,options:R(m),group:"Common"}},{prop:"blendMode",defaultValue:E.Normal,bundleType:"other",async onChange(e,r,a){e.setBlendMode(a)},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular","Particle","Trail"]),uiInfo:{label:"shader.material.blend-mode",type:n.Select,options:[{label:"shader.material.blend-mode-options.normal",value:E.Normal},{label:"shader.material.blend-mode-options.additive",value:E.Additive}],group:"Common"}},{prop:"material_TilingOffset",defaultValue:{x:1,y:1,z:0,w:0},bundleType:"shaderData",onChange(e,r,a){return l(e,r,a,n.Vector4)},when:t.bind(null,["Unlit","BlinnPhong","PBR","PbrSpecular"]),uiInfo:{label:"shader.material.tiling-offset",type:n.Vector4,group:"Common"},engineType:"Vector4"}];export{w as E,M as b,l as s};
@@ -0,0 +1 @@
1
+ import{aO as n,aP as s,aQ as o,aR as i,aS as t,aT as d,aU as c,aV as g}from"./index-aec7e708.js";import{M as h}from"./MaterialInspector-e8242674.js";const m=n("div",{marginLeft:"5px"}),u=n(s,{borderRadius:"$3",padding:"$1_5",marginLeft:"-$1_5",marginRight:"-$0_5",marginBottom:"$1",color:"$gray11",cursor:"pointer",backgroundColor:"transparent",transition:"background-color 0.2s","&:hover":{backgroundColor:"$grayA3"},variants:{open:{true:{boxShadow:"inset 0 0 0 1px $colors$grayA3",backgroundColor:"$grayA5","&:hover":{backgroundColor:"$grayA5"}}}}});function x(r){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...r,children:t.jsx("path",{fill:"currentColor",d:"m12 17.4l-3.9 3.9q-.275.275-.7.275t-.7-.275t-.275-.7t.275-.7l3.875-3.875q.575-.575 1.425-.575t1.425.575L17.3 19.9q.275.275.275.7t-.275.7t-.7.275t-.7-.275zm0-10.8l3.9-3.9q.275-.275.7-.275t.7.275t.275.7t-.275.7l-3.875 3.875Q12.85 8.55 12 8.55t-1.425-.575L6.7 4.1q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275z"})})}function p(r){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...r,children:t.jsx("path",{fill:"currentColor",d:"m12 19.15l3.875-3.875q.3-.3.7-.3t.7.3t.3.713t-.3.712l-3.85 3.875q-.575.575-1.425.575t-1.425-.575L6.7 16.7q-.3-.3-.288-.712t.313-.713t.713-.3t.712.3zm0-14.3L8.15 8.7q-.3.3-.7.288t-.7-.288q-.3-.3-.312-.712t.287-.713l3.85-3.85Q11.15 2.85 12 2.85t1.425.575l3.85 3.85q.3.3.288.713t-.313.712q-.3.275-.7.288t-.7-.288z"})})}const b=o(function(e){const{t:a}=i();return t.jsxs(u,{align:"v",justifyContent:"between",open:e.open,children:[t.jsxs(s,{align:"v",gap:"xs",children:[t.jsx("img",{src:e.thumbnailUrl,alt:a("mesh-renderer.material.thumbnail"),width:"20px",height:"20px"}),t.jsxs(m,{children:[a("mesh-renderer.material.title"),"(",e.name,")"]})]}),t.jsx(d,{size:"xs",variant:"subtle",children:e.open?t.jsx(x,{}):t.jsx(p,{})})]})}),f=r=>{const{materialAsset:e}=r,[a,l]=c.useState(!1);return t.jsx(g,{nesting:!0,title:t.jsx(b,{open:a,thumbnailUrl:e.thumbnailUrl,name:e.name}),defaultOpen:!1,open:a,onOpenChange:l,children:t.jsx(h,{asset:e})})};export{f as R};
@@ -0,0 +1 @@
1
+ var C=Object.defineProperty;var M=(s,t,e)=>t in s?C(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var h=(s,t,e)=>(M(s,typeof t!="symbol"?t+"":t,e),e);import{$ as R,a9 as y,bJ as l,j as x,bI as v,bK as S,p as b,C as m,m as f,n as G,e as F,o as O,q as D}from"./index-aec7e708.js";import"./index-e8a45e82.js";import{A as B}from"./AssetViewer-64cd01fa.js";class A{static update(t,e){var o;this.spriteEntity?this.spriteEntity.isActive=!0:this.initScene(t),this.entity=this.spriteEntity;const i=(o=e.engineObject)==null?void 0:o.getColorTexture(0);i&&(this.sprite.texture=i)}static clear(){this.spriteEntity&&(this.spriteEntity.isActive=!1)}static initScene(t){const e=this.spriteEntity=t.createChild("rt-thumbnail");this.spriteRenderer=e.addComponent(R),this.spriteRenderer.sprite=this.sprite=new y(t.engine)}}h(A,"entity"),h(A,"spriteEntity"),h(A,"spriteRenderer"),h(A,"sprite");class j extends B{constructor(){super(...arguments);h(this,"_asset");h(this,"_sprite");h(this,"_onRebuild",()=>{var e;if(this._sprite&&((e=this._asset)!=null&&e.engineObject)){const i=this._asset.engineObject.getColorTexture(0);i&&(this._sprite.texture=i)}})}setViewAsset(e,i){var _;this._asset=e;const o=i.engine,r=i.createChild("rt_preview"),n=(_=e.engineObject)==null?void 0:_.getColorTexture(0),a=new y(o,n),c=r.addComponent(R);c.sprite=a,this._sprite=a,this._entity=r,e.onRebuild(this._onRebuild)}stopViewAsset(){super.stopViewAsset(),this._asset&&this._asset.offRebuild(this._onRebuild),this._asset=null,this._sprite=null}getDescription(e){return`${e.width}x${e.height}`}}var E=Object.defineProperty,V=Object.getOwnPropertyDescriptor,g=(s,t,e,i)=>{for(var o=i>1?void 0:i?V(t,e):t,r=s.length-1,n;r>=0;r--)(n=s[r])&&(o=(i?n(t,e,o):n(o))||o);return i&&o&&E(t,e,o),o};const I=[{label:"R8G8B8A8",value:l.R8G8B8A8},{label:"R8G8B8",value:l.R8G8B8},{label:"R16G16B16A16",value:l.R16G16B16A16},{label:"R32G32B32A32",value:l.R32G32B32A32},{label:"R11G11B10_UFloat",value:l.R11G11B10_UFloat}],w=-1,L=[{label:"None",value:w},{label:"Depth",value:l.Depth},{label:"Depth16",value:l.Depth16},{label:"Depth24",value:l.Depth24},{label:"Depth32",value:l.Depth32},{label:"Depth24Stencil8",value:l.Depth24Stencil8},{label:"Depth32Stencil8",value:l.Depth32Stencil8}],U=[{label:"1",value:1},{label:"2",value:2},{label:"4",value:4},{label:"8",value:8}];let u=class extends x{constructor(){super(...arguments);h(this,"_onRebuildCallbacks",[]);h(this,"width",512);h(this,"height",512);h(this,"colorFormat",l.R8G8B8A8);h(this,"depthFormat",l.Depth);h(this,"antiAliasing",1);h(this,"autoGenerateMipmaps",!0)}registerThumbnail(){}onRebuild(t){this._onRebuildCallbacks.push(t)}offRebuild(t){const e=this._onRebuildCallbacks.indexOf(t);e!==-1&&this._onRebuildCallbacks.splice(e,1)}async initByCreation(){return this.getMainData()}getMainData(){var i;const t={width:this.width,height:this.height,colorFormats:[this.colorFormat],depthFormat:this.depthFormat,antiAliasing:this.antiAliasing,autoGenerateMipmaps:this.autoGenerateMipmaps},e=(i=this.engineObject)==null?void 0:i.getColorTexture(0);return e&&(t.colorTextures=[{isSRGBColorSpace:e.isSRGBColorSpace,mipmap:e.mipmapCount>1,filterMode:e.filterMode,wrapModeU:e.wrapModeU,wrapModeV:e.wrapModeV,anisoLevel:e.anisoLevel}]),JSON.stringify(t)}async initByMain(t){const e=JSON.parse(await t.text());this.width=Math.round(e.width??512),this.height=Math.round(e.height??512);const i=e.colorFormats??[e.colorFormat??l.R8G8B8A8];this.colorFormat=i[0],this.depthFormat=e.depthFormat??l.Depth,this.antiAliasing=e.antiAliasing??1,this.autoGenerateMipmaps=e.autoGenerateMipmaps??!1;const r=(e.colorTextures??(e.colorTexture?[e.colorTexture]:[]))[0],n=this._buildRenderTarget((r==null?void 0:r.mipmap)??!0,r==null?void 0:r.isSRGBColorSpace);await this.bindEngineObject(n);const a=n.getColorTexture(0);a&&r&&(r.filterMode!=null&&(a.filterMode=r.filterMode),r.wrapModeU!=null&&(a.wrapModeU=r.wrapModeU),r.wrapModeV!=null&&(a.wrapModeV=r.wrapModeV),r.anisoLevel!=null&&(a.anisoLevel=r.anisoLevel)),await this._generateSubAssets()}destroy(){this._destroySubAssets(),this.engineObject&&this._replaceCameraRenderTarget(this.engineObject,null),this._onRebuildCallbacks.length=0,this._destroyRenderTarget(),super.destroy()}async _rebuild(){var _;if(!this.engineObject)return;const t=this.engineObject,e=t.getColorTexture(0),i=(_=this._subAssets)==null?void 0:_[0],o=i?i.mipmap??!0:!0,r=i?i.isSRGBColorSpace??this.colorFormat===l.R8G8B8A8:this.colorFormat===l.R8G8B8A8,n=e&&e.format===this.colorFormat&&e.width===this.width&&e.height===this.height&&e.isSRGBColorSpace===r&&o===e.mipmapCount>1;let a;try{a=n?this._buildRenderTargetWithTexture(e):this._buildRenderTarget(o,r)}catch(p){console.warn("Failed to create RenderTarget:",p);return}if(!n&&e){const p=a.getColorTexture(0);p&&(p.filterMode=e.filterMode,p.wrapModeU=e.wrapModeU,p.wrapModeV=e.wrapModeV,p.anisoLevel=e.anisoLevel)}const c=this._replaceCameraRenderTarget(t,a);if(t.destroy(),await this.bindEngineObject(a),n||(e==null||e.destroy(),this._destroySubAssets(),await this._generateSubAssets()),c.length>0){const p=c.map(d=>d.enabled);c.forEach(d=>d.enabled=!0),requestAnimationFrame(()=>{this._onRebuildCallbacks.forEach(d=>d()),c.forEach((d,T)=>d.enabled=p[T])})}else this._onRebuildCallbacks.forEach(p=>p())}_buildRenderTarget(t=!0,e){const{width:i,height:o,colorFormat:r}=this;e===void 0&&(e=r===l.R8G8B8A8);const n=new v(this.engine,i,o,r,t,e);return n.isGCIgnored=!0,this._buildRenderTargetWithTexture(n)}_buildRenderTargetWithTexture(t){const{width:e,height:i,depthFormat:o,antiAliasing:r,autoGenerateMipmaps:n}=this,a=o===w?null:o,c=new S(this.engine,e,i,t,a,r);return c.isGCIgnored=!0,c.autoGenerateMipmaps=n,c}_destroyRenderTarget(){var e;const t=this.engineObject;t&&((e=t.getColorTexture(0))==null||e.destroy(),t.destroy())}_replaceCameraRenderTarget(t,e){const i=this.root.projectStore.currentScene;if(!i)return[];const o=[];for(const r of i.entities.values())for(const n of r.components)if(n.type==="Camera"){const a=n.engineObject;(a==null?void 0:a.renderTarget)===t&&(a.renderTarget=e,o.push(a))}return o}async _generateSubAssets(){const t=this.engineObject,e=[],i=t.getColorTexture(0);if(i){i.name=`${this.name}-color`;const o=await this.root.assetStore.createSubAsset("Texture",i,this.id,"colorTextures[0]");o._editable=!0,e.push(o)}this._subAssets=e}_destroySubAssets(){if(this._subAssets){for(const t of this._subAssets)this.root.assetStore.deleteSubAsset(t.id);this._subAssets=[]}}};g([b({type:m.Number,label:"Width",min:1,max:8192,triggerAfterInit:!1,onChange:s=>{s.width=Math.round(s.width),s._rebuild()}}),f()],u.prototype,"width",2);g([b({type:m.Number,label:"Height",min:1,max:8192,triggerAfterInit:!1,onChange:s=>{s.height=Math.round(s.height),s._rebuild()}}),f()],u.prototype,"height",2);g([b({type:m.Select,label:"Color Format",options:I,triggerAfterInit:!1,onChange:s=>s._rebuild()}),f()],u.prototype,"colorFormat",2);g([b({type:m.Select,label:"Depth Format",options:L,triggerAfterInit:!1,onChange:s=>s._rebuild()}),f()],u.prototype,"depthFormat",2);g([b({type:m.Select,label:"Anti-Aliasing",options:U,triggerAfterInit:!1,onChange:s=>s._rebuild()}),f()],u.prototype,"antiAliasing",2);g([b({type:m.Toggle,label:"Auto Generate Mipmaps",triggerAfterInit:!1,onChange:s=>{const t=s.engineObject;t&&(t.autoGenerateMipmaps=s.autoGenerateMipmaps)}}),f()],u.prototype,"autoGenerateMipmaps",2);u=g([G({type:"RenderTarget",label:F("asset.render-target.title"),extname:"renderTarget",importMenuConfig:{type:O.Add},dragLayer:D.RenderTarget,viewer:j,thumbnail:A,async bundle({content:s}){return{content:s}}})],u);export{u as RenderTargetAsset};
@@ -0,0 +1 @@
1
+ var l=Object.defineProperty;var p=(s,e,t)=>e in s?l(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var o=(s,e,t)=>(p(s,typeof e!="symbol"?e+"":e,t),t);import{j as m,u as h,b2 as d,n as u,e as y,o as f}from"./index-aec7e708.js";import"./index-e8a45e82.js";const D={entities:[{id:"1000000",name:"Camera",isActive:!0,position:{x:0,y:0,z:10},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},children:[],isClone:!1,components:[{id:"1000100",class:"Camera",props:{isOrthographic:!1,nearClipPlane:.1,farClipPlane:100,viewport:{x:0,y:0,z:1,w:1}},methods:{}}]},{id:"1000001",name:"DirectLight",isActive:!0,position:{x:0,y:3,z:0},rotation:{x:-45,y:-45,z:0},scale:{x:1,y:1,z:1},children:[],isClone:!1,components:[{id:"1000101",class:"DirectLight",props:{enabled:!0,intensity:.6,color:{r:1,g:1,b:1,a:1}},methods:{}}]}],scene:{background:{mode:0,color:{r:.0157,g:.0157,b:.0157,a:1}},ambient:{},shadow:{},fog:{}}};var v=Object.defineProperty,b=Object.getOwnPropertyDescriptor,S=(s,e,t,n)=>{for(var a=n>1?void 0:n?b(e,t):e,i=s.length-1,r;i>=0;i--)(r=s[i])&&(a=(n?r(e,t,a):r(a))||a);return n&&a&&v(e,t,a),a};let c=class extends m{constructor(e){super(e);o(this,"sceneData",null);h(this)}async initByMain(e,t){this.sceneData=JSON.parse(await e.text())}getMainData(){return JSON.stringify(this.sceneData)}async rename(e){await super.rename(e),await this.root.assetFacade.persistAssetMain(this.id)}saveMainImmediately(){const e=this.root.sceneStore;if(this.id===e.refId){if(e.destroyed){d(this.root.projectStore.id,this.serverId);return}return this.sceneData=e.toJSON(),this.sceneData.name=this.name,super.saveMainImmediately()}else{const t=this.sceneData;if(t&&t.name!==this.name)return t.name=this.name,super.saveMainImmediately()}}async initByCreation(e,t,n){return this.sceneData={name:this._name,...D}}onDoubleClick(){this.root.projectStore.switchScene({scene:this.id})}};c=S([u({type:"Scene",label:y("asset.scene.title"),defaultName:"Scene",extname:"scene",importMenuConfig:{type:f.Add},async bundle(s){return{content:new Blob([s.content],{type:"application/json"})}}})],c);export{c as SceneAsset};