import{b1 as C,b2 as w,C as c,b3 as k,V as d,ai as F,F as I}from"./index-03b6134d.js";var a=(t=>(t.Vector2="Vector2",t.Vector3="Vector3",t.Vector4="Vector4",t.Color="Color",t.Float="Float",t.Texture="Texture",t.Boolean="Boolean",t.Integer="Integer",t))(a||{});async function B(t,V,e,n,i){var S;const s=t.engineObject.shaderData;let r;const o=V.toString(),h=C.getByName(o).type;switch(h===w.Float?(n===a.Integer||n===c.Toggle||n===c.Boolean||n===c.Select)&&(n=a.Float):h===w.Int&&(n===a.Float||n===c.Slider||n===c.Number)&&(n=a.Integer),n){case c.Slider:case c.Number:case a.Float:s.setFloat(o,e);break;case c.Toggle:case c.Boolean:case c.Select:case a.Integer:s.setInt(o,Number(e));break;case c.AssetPicker:case a.Texture:if(e){const l=await t.root.assetStore.getAssetByRef(e);if(l){const b=l.engineObject;s.setTexture(o,b),i&&x(i,t,"enable")}else s.setTexture(o,null),i&&x(i,t,"disable"),console.error(`${o} in ${t.name} is missing.`)}else s.setTexture(o,null),i&&x(i,t,"disable");break;case c.Vector2:case a.Vector2:r=s.getVector2(o),e==null?s.setVector2(o,e):r?(r.x=e.x,r.y=e.y):s.setVector2(o,new I(e.x,e.y));break;case c.Vector3:case a.Vector3:r=s.getVector3(o),e==null?s.setVector3(o,e):r?(r.x=e.x,r.y=e.y,r.z=e.z):s.setVector3(o,new F(e.x,e.y,e.z));break;case c.Vector4:case a.Vector4:r=s.getVector4(o),e==null?s.setVector4(o,e):r?(r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w):s.setVector4(o,new d(e.x,e.y,e.z,e.w));break;case c.Color:case a.Color:{if(e==null){s.setColor(o,null);break}let{r:l,g:b,b:f}=e;const{a:m,intensity:g=1}=e;l*=g,b*=g,f*=g,r=s.getColor(o),r?(r.r=l,r.g=b,r.b=f,r.a=m):s.setColor(o,new k(l,b,f,m));break}}(S=t.updateThumbnail)==null||S.call(t)}function x(t,V,e){const n=V.engineObject.shaderData;e==="enable"?n.enableMacro(t):n.disableMacro(t)}export{a as E,B as s};
