@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.
- package/dist/cli.bundle.cjs +3171 -2951
- package/dist/viewport-client/_static/Accordion-3d330bc6.js +1 -0
- package/dist/viewport-client/_static/AmbientLightAsset-bdbc4e1d.js +5 -0
- package/dist/viewport-client/_static/AnimationClipAsset-9167378a.js +1 -0
- package/dist/viewport-client/_static/AnimatorControllerAsset-21dc6332.js +1 -0
- package/dist/viewport-client/_static/AnimatorStore-18d3c551.js +1 -0
- package/dist/viewport-client/_static/AssetViewer-64cd01fa.js +1 -0
- package/dist/viewport-client/_static/AudioAsset-0c828c80.js +1 -0
- package/dist/viewport-client/_static/AudioComponent-fbff3825.js +1 -0
- package/dist/viewport-client/_static/Callout-ba7e2adf.js +1 -0
- package/dist/viewport-client/_static/CameraComponent-74975570.js +1 -0
- package/dist/viewport-client/_static/Component-ed7aa0ab.js +1 -0
- package/dist/viewport-client/_static/DirectLight-b884e7db.js +1 -0
- package/dist/viewport-client/_static/FontAsset-d1ced18d.js +5 -0
- package/dist/viewport-client/_static/FormItemArray-6d69acd4.js +6 -0
- package/dist/viewport-client/_static/GlTFAsset-2723b84a.js +20 -0
- package/dist/viewport-client/_static/IconEdit-ab77303f.js +6 -0
- package/dist/viewport-client/_static/IconPointFilled-811fc660.js +6 -0
- package/dist/viewport-client/_static/LightBaseComponent-12dc27d1.js +1 -0
- package/dist/viewport-client/_static/LottieAnimationComponent-c48c5eb5.js +1 -0
- package/dist/viewport-client/_static/LottieAsset-3692580d.js +6 -0
- package/dist/viewport-client/_static/MarkdownAsset-bcb90be4.js +1 -0
- package/dist/viewport-client/_static/MaterialAsset-6ef9b4ed.js +1 -0
- package/dist/viewport-client/_static/MaterialInspector-e8242674.js +1 -0
- package/dist/viewport-client/_static/Menu-0b8da92f.js +17 -0
- package/dist/viewport-client/_static/MeshAsset-ca9305e5.js +1 -0
- package/dist/viewport-client/_static/MeshRendererBaseComponent-9efd3943.js +1 -0
- package/dist/viewport-client/_static/MeshRendererComponent-c9a03641.js +1 -0
- package/dist/viewport-client/_static/MeshThumbnail-ab28b3b8.js +1 -0
- package/dist/viewport-client/_static/ParticleRendererComponent-96947c1d.js +26 -0
- package/dist/viewport-client/_static/PhysicsMaterialAsset-4a1e5ea3.js +1 -0
- package/dist/viewport-client/_static/PhysicsStore-33cac578.js +1 -0
- package/dist/viewport-client/_static/PointLight-fd514526.js +1 -0
- package/dist/viewport-client/_static/PostProcessComponent-d0ea27a4.js +6 -0
- package/dist/viewport-client/_static/PrefabAsset-9179b95c.js +1 -0
- package/dist/viewport-client/_static/PrimitiveMesh-0572a073.js +1 -0
- package/dist/viewport-client/_static/ProxyConfigs-3a5fd860.js +1 -0
- package/dist/viewport-client/_static/ReferencedMaterial-5773c9d2.js +1 -0
- package/dist/viewport-client/_static/RenderTargetAsset-ab6e06d2.js +1 -0
- package/dist/viewport-client/_static/SceneAsset-385fa837.js +1 -0
- package/dist/viewport-client/_static/ShaderAsset-f4514b03.js +185 -0
- package/dist/viewport-client/_static/ShaderChunkAsset-34116f2c.js +5 -0
- package/dist/viewport-client/_static/ShaderUIScriptAsset-fc503291.js +516 -0
- package/dist/viewport-client/_static/SkinnedMeshRendererComponent-494ad439.js +1 -0
- package/dist/viewport-client/_static/SpineAnimationComponent-3918d7b5.js +1 -0
- package/dist/viewport-client/_static/SpineSkeletonDataAsset-27244892.js +1 -0
- package/dist/viewport-client/_static/SpotLight-f9972dc0.js +1 -0
- package/dist/viewport-client/_static/SpriteAsset-558ffca8.js +6 -0
- package/dist/viewport-client/_static/SpriteAtlasAsset-cdc34386.js +1 -0
- package/dist/viewport-client/_static/SpriteBaseComponent-3edafa31.js +1 -0
- package/dist/viewport-client/_static/SpriteMaskComponent-de2e5231.js +1 -0
- package/dist/viewport-client/_static/SpriteRendererComponent-e999e735.js +1 -0
- package/dist/viewport-client/_static/TaskQueue-05c94a4d.js +1 -0
- package/dist/viewport-client/_static/TextBaseComponent-ce1402c3.js +11 -0
- package/dist/viewport-client/_static/TextRendererComponent-f7c0deae.js +1 -0
- package/dist/viewport-client/_static/TextureAsset-39fb07fe.js +36 -0
- package/dist/viewport-client/_static/Tooltip-82063435.js +1 -0
- package/dist/viewport-client/_static/TrailRendererComponent-37f5c981.js +1 -0
- package/dist/viewport-client/_static/TransformBaseComponent-713d57e9.js +1 -0
- package/dist/viewport-client/_static/TransformComponent-40a57948.js +1 -0
- package/dist/viewport-client/_static/XRReferenceImageAsset-2f6ff226.js +1 -0
- package/dist/viewport-client/_static/assetEditorActions-c4e5962f.js +1 -0
- package/dist/viewport-client/_static/audio-7120ec91.js +1 -0
- package/dist/viewport-client/_static/bundlers-9b0d37fc.js +1 -0
- package/dist/viewport-client/_static/createOnModelChange-b57a0da8.js +1 -0
- package/dist/viewport-client/_static/encode-ac4bb64e.js +1 -0
- package/dist/viewport-client/_static/enum-58295f88.js +1 -0
- package/dist/viewport-client/_static/glTFIO-79bbca27.js +1 -0
- package/dist/viewport-client/_static/index-483b5738.js +1 -0
- package/dist/viewport-client/_static/index-74130ff3.js +1 -0
- package/dist/viewport-client/_static/index-78269e76.js +1 -0
- package/dist/viewport-client/_static/index-7834b582.js +1 -0
- package/dist/viewport-client/_static/index-7917f782.js +20 -0
- package/dist/viewport-client/_static/index-7acd49d2.js +1 -0
- package/dist/viewport-client/_static/index-9d3917da.js +1 -0
- package/dist/viewport-client/_static/index-a9b2675e.js +1 -0
- package/dist/viewport-client/_static/index-aec7e708.js +11487 -0
- package/dist/viewport-client/_static/index-b5582401.js +1 -0
- package/dist/viewport-client/_static/index-bfe6f30e.js +16 -0
- package/dist/viewport-client/_static/index-c63c9606.js +2 -0
- package/dist/viewport-client/_static/index-cd1fee9d.js +1 -0
- package/dist/viewport-client/_static/index-e73ceaed.js +1 -0
- package/dist/viewport-client/_static/index-e8a45e82.js +1 -0
- package/dist/viewport-client/_static/index-f2cb64af.js +1 -0
- package/dist/viewport-client/_static/index-fbe040bf.js +31 -0
- package/dist/viewport-client/_static/ktx2-encoder-53b21bdc.js +1 -0
- package/dist/viewport-client/_static/ktx2-worker-a04f41ea.js +1 -0
- package/dist/viewport-client/_static/meshopt_simplifier.module-cd99529d.js +1 -0
- package/dist/viewport-client/_static/module-220b3921.js +1 -0
- package/dist/viewport-client/_static/module-8816772d.js +1 -0
- package/dist/viewport-client/_static/module-ffeaf99f.js +56 -0
- package/dist/viewport-client/_static/postmen-2f47f6bb.js +1 -0
- package/dist/viewport-client/_static/scriptPropertyActions-d3a583d2.js +1 -0
- package/dist/viewport-client/index.html +20 -0
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b5 as oe,b6 as te,b7 as T,b8 as c,aC as r,b9 as D,ba as re,bb as ne,bc as ie,bd as O,be as ae,bf as ce,bg as se,bh as de,bi as V,aO as b,bj as le}from"./index-aec7e708.js";var u="Accordion",pe=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[P,ue,fe]=oe(u),[C,Ee]=te(u,[fe,T]),H=T(),M=c.forwardRef((o,i)=>{const{type:e,...n}=o,a=n,t=n;return r.jsx(P.Provider,{scope:o.__scopeAccordion,children:e==="multiple"?r.jsx(me,{...t,ref:i}):r.jsx(be,{...a,ref:i})})});M.displayName=u;var[B,ge]=C(u),[L,he]=C(u,{collapsible:!1}),be=c.forwardRef((o,i)=>{const{value:e,defaultValue:n,onValueChange:a=()=>{},collapsible:t=!1,...s}=o,[d,l]=D({prop:e,defaultProp:n,onChange:a});return r.jsx(B,{scope:o.__scopeAccordion,value:d?[d]:[],onItemOpen:l,onItemClose:c.useCallback(()=>t&&l(""),[t,l]),children:r.jsx(L,{scope:o.__scopeAccordion,collapsible:t,children:r.jsx(K,{...s,ref:i})})})}),me=c.forwardRef((o,i)=>{const{value:e,defaultValue:n,onValueChange:a=()=>{},...t}=o,[s=[],d]=D({prop:e,defaultProp:n,onChange:a}),l=c.useCallback(h=>d((f=[])=>[...f,h]),[d]),g=c.useCallback(h=>d((f=[])=>f.filter($=>$!==h)),[d]);return r.jsx(B,{scope:o.__scopeAccordion,value:s,onItemOpen:l,onItemClose:g,children:r.jsx(L,{scope:o.__scopeAccordion,collapsible:!0,children:r.jsx(K,{...t,ref:i})})})}),[xe,A]=C(u),K=c.forwardRef((o,i)=>{const{__scopeAccordion:e,disabled:n,dir:a,orientation:t="vertical",...s}=o,d=c.useRef(null),l=re(d,i),g=ue(e),f=ne(a)==="ltr",$=ie(o.onKeyDown,m=>{var E;if(!pe.includes(m.key))return;const Z=m.target,S=g().filter(R=>{var N;return!((N=R.ref.current)!=null&&N.disabled)}),x=S.findIndex(R=>R.ref.current===Z),z=S.length;if(x===-1)return;m.preventDefault();let p=x;const I=0,w=z-1,y=()=>{p=x+1,p>w&&(p=I)},j=()=>{p=x-1,p<I&&(p=w)};switch(m.key){case"Home":p=I;break;case"End":p=w;break;case"ArrowRight":t==="horizontal"&&(f?y():j());break;case"ArrowDown":t==="vertical"&&y();break;case"ArrowLeft":t==="horizontal"&&(f?j():y());break;case"ArrowUp":t==="vertical"&&j();break}const ee=p%z;(E=S[ee].ref.current)==null||E.focus()});return r.jsx(xe,{scope:e,disabled:n,direction:a,orientation:t,children:r.jsx(P.Slot,{scope:e,children:r.jsx(O.div,{...s,"data-orientation":t,ref:l,onKeyDown:n?void 0:$})})})}),v="AccordionItem",[ve,k]=C(v),U=c.forwardRef((o,i)=>{const{__scopeAccordion:e,value:n,...a}=o,t=A(v,e),s=ge(v,e),d=H(e),l=ae(),g=n&&s.value.includes(n)||!1,h=t.disabled||o.disabled;return r.jsx(ve,{scope:e,open:g,disabled:h,triggerId:l,children:r.jsx(ce,{"data-orientation":t.orientation,"data-state":J(g),...d,...a,ref:i,disabled:h,open:g,onOpenChange:f=>{f?s.onItemOpen(n):s.onItemClose(n)}})})});U.displayName=v;var G="AccordionHeader",W=c.forwardRef((o,i)=>{const{__scopeAccordion:e,...n}=o,a=A(u,e),t=k(G,e);return r.jsx(O.h3,{"data-orientation":a.orientation,"data-state":J(t.open),"data-disabled":t.disabled?"":void 0,...n,ref:i})});W.displayName=G;var _="AccordionTrigger",Y=c.forwardRef((o,i)=>{const{__scopeAccordion:e,...n}=o,a=A(u,e),t=k(_,e),s=he(_,e),d=H(e);return r.jsx(P.ItemSlot,{scope:e,children:r.jsx(se,{"aria-disabled":t.open&&!s.collapsible||void 0,"data-orientation":a.orientation,id:t.triggerId,...d,...n,ref:i})})});Y.displayName=_;var q="AccordionContent",F=c.forwardRef((o,i)=>{const{__scopeAccordion:e,...n}=o,a=A(u,e),t=k(q,e),s=H(e);return r.jsx(de,{role:"region","aria-labelledby":t.triggerId,"data-orientation":a.orientation,...s,...n,ref:i,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...o.style}})});F.displayName=q;function J(o){return o?"open":"closed"}var Ce=M,Ae=U,$e=W,Se=Y,Ie=F;const we=V({from:{height:0,opacity:0},to:{height:"var(--radix-accordion-content-height)",opacity:1}}),ye=V({from:{height:"var(--radix-accordion-content-height)",opacity:1},to:{height:0,opacity:0}}),Q=c.createContext({size:"sm"}),je=b(Ce,{width:"100%",display:"flex",flexDirection:"column"}),Re=b(Ae,{position:"relative",boxSizing:"border-box",width:"100%",backgroundColor:"$surface",border:"1px solid $border",borderBottom:"none",overflow:"hidden","&:first-child":{borderTopLeftRadius:"$sm",borderTopRightRadius:"$sm"},"&:last-child":{borderBottomLeftRadius:"$sm",borderBottomRightRadius:"$sm",borderBottom:"1px solid $border"},"&[data-state=open]":{borderColor:"$borderStrong","&:not(:first-child)":{borderTopColor:"$borderStrong"},"& + &":{borderTopColor:"$borderStrong"}},"&:has(+ [data-state=open])":{borderBottomColor:"$borderStrong"}}),X=b(le,{width:"$iconSm",height:"$iconSm",color:"currentColor",flexShrink:0,transform:"rotate(0deg)",transition:"transform .2s ease, color .2s ease"}),_e=b($e,{all:"unset",display:"block"}),Pe=b(Se,{all:"unset",display:"flex",width:"100%",minHeight:"30px",padding:"0 $3",alignItems:"center",justifyContent:"space-between",gap:"$2",fontSize:"$2",lineHeight:"$lineHeights$2",fontWeight:500,color:"$text",overflow:"hidden",boxSizing:"border-box",userSelect:"none",backgroundColor:"$grayA2",transition:"$backgroundColor, $borderColor, $color","& > span":{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'&[data-state="open"]':{[`& ${X}`]:{transform:"rotate(90deg)"}},"&:hover":{backgroundColor:"$grayA3",color:"$textStrong"},"&:focus-visible":{outline:"none",boxShadow:"$focus"},variants:{size:{sm:{minHeight:"27px",padding:"0 $2",fontSize:"$1",lineHeight:"$lineHeights$1"},md:{minHeight:"30px",padding:"0 $3",fontSize:"$2",lineHeight:"$lineHeights$2"}}},defaultVariants:{size:"sm"}}),He=b(Ie,{overflow:"hidden",fontSize:"$1",color:"$text",backgroundColor:"$grayA2",'&[data-state="open"]':{animation:`${we} 200ms cubic-bezier(0.16, 1, 0.3, 1)`},'&[data-state="closed"]':{animation:`${ye} 180ms cubic-bezier(0.16, 1, 0.3, 1)`},"@media (prefers-reduced-motion: reduce)":{'&[data-state="open"], &[data-state="closed"]':{animation:"none"}}}),ke=b("div",{color:"$text",borderTop:"1px solid $border",variants:{size:{sm:{padding:"$2",fontSize:"$1",lineHeight:"$lineHeights$1"},md:{padding:"$3",fontSize:"$1",lineHeight:"$lineHeights$2"}}},defaultVariants:{size:"sm"}}),Ne=function(i){const{size:e="sm",...n}=i;return r.jsx(Q.Provider,{value:{size:e},children:r.jsx(je,{...n})})};function Te(o){const{size:i}=c.useContext(Q),{children:e,title:n,arrow:a=!0,...t}=o;return r.jsxs(Re,{...t,children:[r.jsx(_e,{children:r.jsxs(Pe,{size:i,children:[r.jsx("span",{children:n}),a&&r.jsx(X,{"aria-hidden":!0})]})}),r.jsx(He,{children:r.jsx(ke,{size:i,children:e})})]})}export{Ne as A,Te as a};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var nt=Object.defineProperty;var st=(r,t,n)=>t in r?nt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n;var k=(r,t,n)=>(st(r,typeof t!="symbol"?t+"":t,n),n);import{bW as R,O as rt,bX as ot,Q as it,j as at,bY as z,bZ as Q,b_ as ct,b$ as ut,c0 as ht,c1 as lt,c2 as ft,a7 as mt,n as bt,e as dt,c3 as gt,c4 as yt}from"./index-aec7e708.js";import{H as pt}from"./enum-58295f88.js";import"./index-e8a45e82.js";import{k as wt}from"./ktx2-encoder-53b21bdc.js";import"./TaskQueue-05c94a4d.js";class D{static getWorker(t){const n=this.getWorkerCodeByFunctionList(t);if(this._workerCache[n])return this._workerCache[n];const e=this.getWorkerURLByCode(n),s=new Worker(e);return this._workerCache[n]=s,this.registerWorkerEvent(s),s}static registerWorkerEvent(t){t.onmessage=n=>{const e=n.data,{type:s,taskID:i}=e;switch(s){case"calculateSHFromTextureCube":const a=this._callbacks[i],o=e.result;a.resolve(o);break}}}static getURLByWorker(t){for(let n in this._workerCache)if(this._workerCache[n]===t)return n}static getWorkerCodeByFunctionList(t){const n=kt.toString(),e=n.substring(n.indexOf("{")+1,n.lastIndexOf("}"));return`
|
|
2
|
+
${t.map(i=>i.toString()).join(`
|
|
3
|
+
`)}
|
|
4
|
+
${e}
|
|
5
|
+
`}static getWorkerURLByCode(t){return URL.createObjectURL(new Blob([t],{type:"application/javascript"}))}static calculateSHFromTextureCube(t,n,e,s,i,a,o){return new Promise(h=>{const l=this._taskID++,f=this.getWorker([j,F,Y,E,V,A]);this._callbacks[l]={resolve:h},f.postMessage({type:"calculateSHFromTextureCube",taskID:l,textureSize:o,dataPX:t,dataNX:n,dataPY:e,dataNY:s,dataPZ:i,dataNZ:a})})}}k(D,"_callbacks",{}),k(D,"_workerCache",{}),k(D,"_taskID",0);function kt(){self.onmessage=function(t){const n=t.data,{type:e,taskID:s}=n;switch(e){case"calculateSHFromTextureCube":const{textureSize:i,dataPX:a,dataNX:o,dataPY:h,dataNY:l,dataPZ:f,dataNZ:b}=n,u=new Float32Array(27);let c=0;c=A(a,0,i,c,u),c=A(o,1,i,c,u),c=A(h,2,i,c,u),c=A(l,3,i,c,u),c=A(f,4,i,c,u),c=A(b,5,i,c,u),V(u,4*Math.PI/c),self.postMessage({type:"calculateSHFromTextureCube",taskID:s,result:u});break}}}class St{static async fromTextureCube(t,n){const s=t.width,i=new Uint16Array(s*s*4),a=new Uint16Array(s*s*4),o=new Uint16Array(s*s*4),h=new Uint16Array(s*s*4),l=new Uint16Array(s*s*4),f=new Uint16Array(s*s*4);t.getPixelBuffer(R.PositiveX,0,0,s,s,0,i),t.getPixelBuffer(R.NegativeX,0,0,s,s,0,a),t.getPixelBuffer(R.PositiveY,0,0,s,s,0,o),t.getPixelBuffer(R.NegativeY,0,0,s,s,0,h),t.getPixelBuffer(R.PositiveZ,0,0,s,s,0,l),t.getPixelBuffer(R.NegativeZ,0,0,s,s,0,f);const b=await D.calculateSHFromTextureCube(i,a,o,h,l,f,s),u=new Float32Array(b);return Tt(u),n.copyFromArray(u),n}}function j(r){const t=r&32768?-1:1,n=r>>10&31,e=r&1023;return n===31?e===0?t*(1/0):NaN:n===0?t*2**-14*(e/1024):t*2**(n-15)*(1+e/1024)}function E(r,t,n,e){const s=r[0],i=r[1],a=r[2],o=t[0]*n,h=t[1]*n,l=t[2]*n,f=.282095,b=-.488603*i,u=.488603*a,c=-.488603*s,m=1.092548*(s*i),d=-1.092548*(i*a),g=.315392*(3*a*a-1),w=-1.092548*(s*a),S=.546274*(s*s-i*i);e[0]+=o*f,e[1]+=h*f,e[2]+=l*f,e[3]+=o*b,e[4]+=h*b,e[5]+=l*b,e[6]+=o*u,e[7]+=h*u,e[8]+=l*u,e[9]+=o*c,e[10]+=h*c,e[11]+=l*c,e[12]+=o*m,e[13]+=h*m,e[14]+=l*m,e[15]+=o*d,e[16]+=h*d,e[17]+=l*d,e[18]+=o*g,e[19]+=h*g,e[20]+=l*g,e[21]+=o*w,e[22]+=h*w,e[23]+=l*w,e[24]+=o*S,e[25]+=h*S,e[26]+=l*S}function F(r,t){return Math.atan2(r*t,Math.sqrt(r*r+t*t+1))}function Y(r,t,n){const e=1/r,s=(t+.5)*2*e-1,i=(n+.5)*2*e-1,a=s-e,o=i-e,h=s+e,l=i+e;return F(a,o)-F(a,l)-F(h,o)+F(h,l)}function I(r,t){return t*(t+1)+r}function K(r,t){if(r===0)return 1;if(r>=t)return 0;let n=Math.PI*r/t;return n=Math.sin(n)/n,Math.pow(n,4)}function _t(r,t){const n=-r[1],e=r[2],s=-r[0],i=-t[0][1]*n+t[0][2]*e+-t[0][0]*s,a=-t[1][1]*n+t[1][2]*e+-t[1][0]*s,o=-t[2][1]*n+t[2][2]*e+-t[2][0]*s;return[i,a,o]}function Lt(r,t){const n=1.7320508076,e=Math.SQRT1_2;function s(u,c,m){return[c*u,-(c*m),1/(2*n)*(3*m*m-1),-(m*u),.5*(u*u-c*c)]}const i=t[0],a=t[1],o=t[2],h=[s(i[0],i[1],i[2]),s(o[0],o[1],o[2]),s(e*(i[0]+a[0]),e*(i[1]+a[1]),e*(i[2]+a[2])),s(e*(i[0]+o[0]),e*(i[1]+o[1]),e*(i[2]+o[2])),s(e*(a[0]+o[0]),e*(a[1]+o[1]),e*(a[2]+o[2]))],l=[[0,1,2,0,0],[-1,0,0,0,-2],[0,n,0,0,0],[1,1,0,-2,0],[2,1,0,0,0]],f=[0,0,0,0,0];for(let u=0;u<5;u++)for(let c=0;c<5;c++)f[u]+=l[u][c]*r[c];const b=[0,0,0,0,0];for(let u=0;u<5;u++)for(let c=0;c<5;c++)b[u]+=h[u][c]*f[c];return b}function Bt(r){const t=1.7724538509,n=1.7320508076,e=2.2360679775,s=3.8729833462,i=[1/(2*t),-n/(2*t),n/(2*t),-n/(2*t),s/(2*t),-s/(2*t),e/(4*t),-s/(2*t),s/(4*t)],a=Math.sqrt(r[3]*r[3]+r[1]*r[1]+r[2]*r[2]);if(a<1e-8)return i[0]*r[0];const o=-r[3]/a,h=-r[1]/a,l=r[2]/a,f=-o,b=-h,u=-l;let c=u,m=0,d=-f;const g=Math.sqrt(c*c+d*d);g<1e-8?(c=1,m=0,d=0):(c/=g,d/=g);const w=m*u-d*b,S=d*f-c*u,O=c*b-m*f,x=[[c,w,-f],[m,S,-b],[d,O,-u]],_=_t([r[1],r[2],r[3]],x),L=Lt([r[4],r[5],r[6],r[7],r[8]],x),y=[r[0],_[0],_[1],_[2],L[0],L[1],L[2],L[3],L[4]],q=i[8]*Math.sqrt(y[8]*y[8]+y[4]*y[4]),B=3*i[6]*y[6]+q,T=i[2]*y[2],H=i[0]*y[0]-i[6]*y[6]-q,C=-T/(2*B),$=B*C*C+T*C+H,G=Math.min(B+T+H,B-T+H),J=B>0&&C>=-1&&C<=1?$:G,v=i[4]*Math.sqrt(y[5]*y[5]+y[7]*y[7]);let U=J-.5*v;if(U<0){const W=p=>B*p*p+T*p+H+v*p*Math.sqrt(1-p*p),tt=p=>{const P=p*p,et=Math.sqrt(1-P);return(P-1)*(v-2*v*P+(T+2*B*p)*et)/(3*v*p-2*v*P*p-2*B*Math.pow(1-P,1.5))};let M=-Math.SQRT1_2,X;do U=W(M),X=tt(M),M=M-X;while(Math.abs(M)<=1&&Math.abs(X)>1e-5);Math.abs(M)>1&&(U=Math.min(W(1),W(-1)))}return U}function At(r,t){const e=r.slice();for(let s=0;s<3;s++){const i=K(s,t);e[I(0,s)]*=i;for(let a=1;a<=s;a++)e[I(-a,s)]*=i,e[I(a,s)]*=i}return e}function Tt(r){let n=13;for(let e=0;e<3;e++){const s=[];for(let o=0;o<9;o++)s[o]=r[o*3+e];let i=3,a=n;for(let o=0;o<16&&i+.1<a;o++){const h=.5*(i+a),l=At(s,h);Bt(l)<0?a=h:i=h}n=Math.min(n,i)}for(let e=0;e<3;e++){const s=K(e,n);for(let i=-e;i<=e;i++){const a=I(i,e);r[a*3]*=s,r[a*3+1]*=s,r[a*3+2]*=s}}}function V(r,t){const n=r;n[0]*=t,n[1]*=t,n[2]*=t,n[3]*=t,n[4]*=t,n[5]*=t,n[6]*=t,n[7]*=t,n[8]*=t,n[9]*=t,n[10]*=t,n[11]*=t,n[12]*=t,n[13]*=t,n[14]*=t,n[15]*=t,n[16]*=t,n[17]*=t,n[18]*=t,n[19]*=t,n[20]*=t,n[21]*=t,n[22]*=t,n[23]*=t,n[24]*=t,n[25]*=t,n[26]*=t}function A(r,t,n,e,s){const a=[],o=[];let h=e;for(let l=0;l<n;l++)for(let f=0;f<n;f++){const b=l*n*4+f*4;a[0]=j(r[b]),a[1]=j(r[b+1]),a[2]=j(r[b+2]);const u=1/n,c=(f+.5)*2*u-1,m=(l+.5)*2*u-1;switch(t){case 0:o[0]=1,o[1]=-m,o[2]=-c;break;case 1:o[0]=-1,o[1]=-m,o[2]=c;break;case 2:o[0]=c,o[1]=1,o[2]=m;break;case 3:o[0]=c,o[1]=-1,o[2]=-m;break;case 4:o[0]=c,o[1]=-m,o[2]=1;break;case 5:o[0]=-c,o[1]=-m,o[2]=-1;break}const d=o[0]*o[0]+o[1]*o[1]+o[2]*o[2],g=Math.sqrt(d);o[0]/=g,o[1]/=g,o[2]/=g;const w=Y(n,f,l);h+=w,E(o,a,w,s)}return h}class N{static update(t,n){this.entity?this.entity.isActive=!0:this.initScene(t);const e=t.scene;e&&(this._scene=e,this.preAmbientLight=e.ambientLight,e.ambientLight=n.engineObject)}static clear(){this.entity.isActive=!1,this._scene&&(this._scene.ambientLight=this.preAmbientLight,this._scene=null)}static initScene(t){const{engine:n}=t,s=(this.entity=t.createChild("material")).addComponent(rt);s.mesh=ot.createSphere(n,2,64,!0);const i=new it(n);i.roughness=.5,i.metallic=.5,s.setMaterial(i)}}k(N,"entity",null),k(N,"preAmbientLight"),k(N,"_scene");var vt=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,Rt=(r,t,n,e)=>{for(var s=e>1?void 0:e?Mt(t,n):t,i=r.length-1,a;i>=0;i--)(a=r[i])&&(s=(e?a(t,n,s):a(s))||s);return e&&s&&vt(t,n,s),s};const xt=1;let Z=class extends at{constructor(t){super(t);k(this,"_sh",new z);k(this,"_bakerData")}async bakeFromScene(t){const n=this.root.sceneStore.engineObject,e=Q.fromScene(n,this.root.sceneStore.bakerResolution);await this._applyBakeResult(t,e,e)}async bakeFromTexture(t){const n=Q.fromTextureCubeMap(t,this.root.sceneStore.bakerResolution,ct.Linear);await this._applyBakeResult(t.engine,n,t)}async _applyBakeResult(t,n,e){const s=this._sh;if(await St.fromTextureCube(e,s),this._bakerData=ut(n,s),!this.engineObject){const a=new ht(t);a.diffuseMode=lt.SphericalHarmonics,this.bindEngineObject(a)}const i=this.engineObject;i.specularTexture=n,i.diffuseSphericalHarmonics=s}async initByCreation(t,n,e){return(e==null?void 0:e.from)==="Scene"?await this.bakeFromScene(this.engine):(e==null?void 0:e.from)==="Texture"&&await this.bakeFromTexture(e.srcTexture),this.getMainData()}async initByMain(t,n){const e=await t.arrayBuffer();if(!ft(e,xt)){this.root.sceneStore.bake();return}const s=await this.engine.resourceManager.load({url:n,type:mt.AmbientLight});this.bindEngineObject(s),this._bakerData=e}getMainData(){return this._bakerData}};Z=Rt([bt({type:"AmbientLight",label:dt("asset.ambient-light.title"),loaderType:"AmbientLight",defaultName:"ambient_light.ambLight",extname:"ambLight",thumbnail:N,async bundle({content:r},t){if(t.assetOptions.textureOptions.textureType==="ktx2")try{const e=await r.arrayBuffer(),i=gt.decode(e).headerLength,a=27*4,o=i+a,h=new Uint8Array(e,o,4);if(h[0]===171&&h[1]===75&&h[2]===84&&h[3]===88)return{content:r};const l=new z;l.copyFromArray(new Float32Array(e,i,27));const f=new Uint16Array(e,o,1)[0],b=Math.floor(Math.log2(f))+1;let u=o+2;const c=[];for(let g=0;g<b;g++){const w=f>>g,S=[];for(let O=0;O<6;O++){const x=w*w*4,_=new Uint16Array(e,u,x);u+=x*2;const L=new Uint8Array(_.byteLength);L.set(new Uint8Array(_.buffer,_.byteOffset,_.byteLength)),S.push(L.buffer)}c.push(S)}const m=await wt.encode(c,{isUASTC:!0,isHDR:!0,imageType:pt.RGBAHalfFloat,width:f,height:f,generateMipmap:!1,isPerceptual:!1,isSetKTX2SRGBTransferFunc:!1,needSupercompression:!0}),d=yt(l,m);return{content:new Blob([d])}}catch(e){console.error("AmbientLight KTX2 encoding failed, fallback to raw:",e)}return{content:r}}})],Z);export{Z as AmbientLightAsset};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var ht=Object.defineProperty;var ut=(_,t,n)=>t in _?ht(_,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):_[t]=n;var g=(_,t,n)=>(ut(_,typeof t!="symbol"?t+"":t,n),n);import{aQ as X,aS as V,bl as yt,e as j,cB as et,cC as dt,aV as mt,aO as ft,aP as gt,u as st,S as ot,c8 as Pt,x as D,aL as E,bo as _t,br as vt,cD as bt,cE as Ct,O as Tt,cF as wt,ct as Et,cG as At,cH as St,cI as xt,$ as Mt,a1 as Vt,cJ as It,cK as Ot,cL as jt,cM as Bt,cN as Rt,cO as Ft,cP as Dt,cQ as Lt,cR as $t,cS as Kt,cT as Nt,cU as kt,cV as zt,cW as Ut,z as y,cX as Gt,cr as I,cY as Ht,cZ as Qt,c_ as Jt,c$ as Wt,d0 as Yt,d1 as qt,d2 as Xt,d3 as Zt,d4 as te,d5 as ee,d6 as re,j as ne,d7 as O,by as W,d8 as G,bP as Y,d9 as x,cb as q,da as ae,db as rt,aw as se,dc as oe,am as nt,dd as F,K as at,de as ie,X as pe,df as ce,aA as le,aB as he,V as ue,N as ye,B as de,dg as H,cu as me,m as fe,a$ as ge,bD as Pe,n as _e,o as ve,dh as be}from"./index-aec7e708.js";import{a as it}from"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";import{A as Ce}from"./AssetViewer-64cd01fa.js";import{o as Te}from"./assetEditorActions-c4e5962f.js";import{e as pt}from"./encode-ac4bb64e.js";import"./meshopt_simplifier.module-cd99529d.js";import{L as we}from"./module-8816772d.js";import{a as Ee}from"./module-ffeaf99f.js";const Ae=X(()=>{const _=it("animationClipStore"),{selectedEvent:t}=_,{paramType:n}=t;return V.jsxs("div",{children:[V.jsx(yt,{label:j("animation.clip.param-type.title"),options:[{value:"string",label:String(j("animation.clip.param-type.string"))},{value:"number",label:String(j("animation.clip.param-type.number"))},{value:"null",label:String(j("animation.clip.param-type.null"))}],value:n||"null",onChange:r=>{t.paramType=r,_.updateEvents([t])}}),V.jsx(et,{label:j("animation.clip.function-name"),value:t.functionName,onChange:r=>{t.functionName=r,_.updateEvents([t])}}),n==="number"&&V.jsx(dt,{label:j("animation.clip.number"),value:t.number,onChange:r=>{t.number=r,_.updateEvents([t])}}),n==="string"&&V.jsx(et,{label:j("animation.clip.string"),value:t.string,onChange:r=>{t.string=r,_.updateEvents([t])}})]})}),Se=X(function(){const t=it("animationClipStore"),{selectedEvent:n}=t;return n?V.jsx(mt,{title:j("animation.clip.event"),defaultOpen:!0,children:V.jsx(V.Fragment,{children:V.jsx(Ae,{})})}):null});var xe=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,N=(_,t,n,r)=>{for(var e=r>1?void 0:r?Me(t,n):t,a=_.length-1,o;a>=0;a--)(o=_[a])&&(e=(r?o(t,n,e):o(e))||e);return r&&e&&xe(t,n,e),e};const Ve=ft(gt,{position:"absolute",top:0,left:0,margin:"auto",width:"100%",height:228,alignItems:"center",justifyContent:"center"});class $ extends Ce{constructor(){super();g(this,"frameTime",0);g(this,"duration",0);g(this,"playing",!1);g(this,"_clip");g(this,"_updateComponent");g(this,"animationNames");g(this,"overridePreviewer",X(({asset:n,viewer:r})=>V.jsx(V.Fragment,{children:n.isSubAsset||n.root.sceneUIStore.lastSelectedId?V.jsx(Pt,{asset:n,viewer:r}):V.jsx(Ve,{children:V.jsx(V.Fragment,{children:j("animation.clip.select-entity-preview")})})})));st(this)}selectAnimation(n){}async setViewAsset(n,r){var o,s;let e;if(n.isSubAsset){const i=await n.root.assetStore.getAssetByRef({refId:n.mainId}),{defaultSceneRoot:c}=i.engineObject;e=((o=n.root.sceneStore.lastSelectedEntity)==null?void 0:o.engineObject)||c}else e=(s=n.root.sceneStore.lastSelectedEntity)==null?void 0:s.engineObject;if(!e)return;this._clip=n.engineObject,this.animationNames=[n.name],this._entity=e.clone(),r.addChild(this._entity);const a=this;this._updateComponent=this._entity.addComponent(class extends ot{onUpdate(i){a._onUpdate(100/3)}}),this.frameTime=0,this.duration=this._clip.length}stopViewAsset(){var n;super.stopViewAsset(),this.frameTime=0,this.pauseAnimation(),(n=this._updateComponent)==null||n.destroy()}setFrameTime(n){this.frameTime=n,this._sampleAnimation()}playAnimation(){this._clip&&(this.playing=!0)}pauseAnimation(){this.playing=!1}_onUpdate(n){!this.playing||!this._clip||!this.duration||(this.frameTime+=n/1e3,this.frameTime>this.duration&&(this.frameTime%=this.duration),this._sampleAnimation())}_sampleAnimation(){try{this._clip._sampleAnimation(this._entity,this.frameTime)}catch(n){console.warn(n)}}}N([D],$.prototype,"frameTime",2);N([D],$.prototype,"duration",2);N([D],$.prototype,"playing",2);N([E],$.prototype,"setViewAsset",1);N([E],$.prototype,"setFrameTime",1);N([E],$.prototype,"playAnimation",1);N([E],$.prototype,"pauseAnimation",1);N([E],$.prototype,"_onUpdate",1);const K=new Map([[_t,"Transform"],[vt,"Animator"],[bt,"DirectLight"],[Ct,"Camera"],[Tt,"MeshRenderer"],[wt,"SkinnedMeshRenderer"],[Et,"ParticleRenderer"],[At,"PointLight"],[St,"SpotLight"],[ot,"Script"],[xt,"SpriteMask"],[Mt,"SpriteRenderer"],[Vt,"TextRenderer"],[It,"UITransform"],[Ot,"UICanvas"],[jt,"UIGroup"],[Bt,"Button"],[Rt,"Image"],[Ft,"Text"],[Dt,"DynamicCollider"],[Lt,"StaticCollider"],[$t,"CharacterController"],[Kt,"SpringJoint"],[Nt,"FixedJoint"],[kt,"HingeJoint"],[zt,"AudioSource"],[Ut,"PostProcess"],[Ee,"SpineAnimationRenderer"],[we,"LottieAnimation"]]);var Ie=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,T=(_,t,n,r)=>{for(var e=r>1?void 0:r?Oe(t,n):t,a=_.length-1,o;a>=0;a--)(o=_[a])&&(e=(r?o(t,n,e):o(e))||e);return r&&e&&Ie(t,n,e),e};const Z=new Map([[y.Float,{curveClass:Gt,name:"AnimationFloatCurve",defaultInterpolation:I.Hermite}],[y.FloatArray,{curveClass:Ht,name:"AnimationFloatArrayCurve",defaultInterpolation:I.Hermite}],[y.Vector2,{curveClass:Qt,name:"AnimationVector2Curve",defaultInterpolation:I.Hermite}],[y.Vector3,{curveClass:Jt,name:"AnimationVector3Curve",defaultInterpolation:I.Hermite}],[y.Vector4,{curveClass:Wt,name:"AnimationVector4Curve",defaultInterpolation:I.Hermite}],[y.Quaternion,{curveClass:Yt,name:"AnimationQuaternionCurve",defaultInterpolation:I.Hermite}],[y.Color,{curveClass:qt,name:"AnimationColorCurve",defaultInterpolation:I.Hermite}],[y.ReferResource,{curveClass:Xt,name:"AnimationRefCurve",defaultInterpolation:I.Step}],[y.Rect,{curveClass:Zt,name:"AnimationRectCurve",defaultInterpolation:I.Step}],[y.Boolean,{curveClass:te,name:"AnimationBoolCurve",defaultInterpolation:I.Step}],[y.String,{curveClass:ee,name:"AnimationStringCurve",defaultInterpolation:I.Step}],[y.Array,{curveClass:re,name:"AnimationArrayCurve",defaultInterpolation:I.Hermite}]]),ct=new Map;Z.forEach((_,t)=>{ct.set(_.curveClass,t)});const lt=new Map;Z.forEach(_=>{lt.set(_.curveClass,_.name)});let C=class extends ne{constructor(t){super(t);g(this,"samples",60);g(this,"properties",[]);g(this,"pathPropertyMap",new Map);g(this,"keyframeDataList",[]);g(this,"events",{});g(this,"data");g(this,"selectedEventId");g(this,"rootEntityId");g(this,"showEditor");g(this,"readOnly",!1);g(this,"_propertyCurveMap",{});g(this,"_originValueStore",new Map);g(this,"_initKeyframeDataPromise");g(this,"_parseKeyframeValuePromise");g(this,"_colorList",["#3477FA","#67FEBB","#C201BF","#F6ED17","#FE6C02","#FD86C2","#A2B44B","#68D8F0","#008225","#A56A02"]);g(this,"_colorIndex",0);g(this,"_openIndex",0);g(this,"_componentsChangedListenerDisposer");g(this,"_propertyPathCache",new Map);g(this,"_propertyLabelMap",new Map);g(this,"_editorPathCache",new Map);st(this),this.onDoubleClick=this.onDoubleClick.bind(this)}get rootEntity(){return this.root.sceneStore.entities.get(this.rootEntityId)}get addedPropertiesTreeData(){return this.properties.map(t=>this._convertPropertyToTreeItem(t))}persistMainViaFacade(){this.root.assetFacade.persistAssetMain(this.id)}persistMetaViaFacade(){this.root.assetFacade.persistAssetMeta(this.id)}addProperty(t){const{type:n,parentProperty:r}=t,e=F(t),a=this.pathPropertyMap.get(e),o=this.properties;let s;if(a)W.error(j("animation.clip.error.property-existed"));else{if(n===O.Property)s=this._addPropertyToList(o,t,null);else{const i=o.find(c=>c.propertyPath===r.propertyPath&&c.relativePath===r.relativePath&&c.componentType===r.componentType);if(i)i.properties.find(p=>p.path===e)?W.error(j("animation.clip.error.sub-property-existed")):s=this._addPropertyToList(i.properties,t,i);else{const c=this._addPropertyToList(o,r,null,!1);s=this._addPropertyToList(c.properties,t,c)}}return this._sortProperties(),this.properties=o.slice(0),this._updateCurveBindings(),this.persistMetaViaFacade(),this.persistMainViaFacade(),s}}delProperty(t){const n=new Set;t.forEach(r=>{if(n.add(r.path),this.pathPropertyMap.delete(r.path),r.type===O.Property)r.properties.forEach(e=>{n.add(e.path),this.pathPropertyMap.delete(e.path)}),this._delPropertyFromList(this.properties,r);else{const e=this.properties.find(a=>a.path===r.parentPath);e&&(this._delPropertyFromList(e.properties,r),e.hasSubProperty&&!e.properties.length&&this._delPropertyFromList(this.properties,e))}}),this._sortProperties(),this.properties=this.properties.slice(0),this._removeCurveBindings(n),this._updateCurveBindings(),this.updateKeyframes(this.keyframeDataList.filter(r=>!n.has(r.path))),this.persistMetaViaFacade(),this.persistMainViaFacade()}async addKeyframe(t,n){const{rootEntity:r}=this,e=this.pathPropertyMap.get(n),{type:a,path:o,parentPath:s,properties:i,supported:c}=e;if(!c){W.error(j("animation.clip.error.property-not-supported"));return}const p=a===O.SubProperty?this.pathPropertyMap.get(s):null,{editorReference:h,editorPropertyPath:u,propertyPos:d}=await this._getReferenceAndActualPropertyPath(r,e),l=u[d],m=G(h)[l];let f=h[l];m!=null&&m.getActualEditorValue&&(f=m.getActualEditorValue(f));let A=e.valueType;a===O.Property&&(m!=null&&m.valueType)&&(A=m.valueType),a===O.SubProperty&&(f=f[u[d+1]]);const P=Y(f);if(i.length)i.forEach(b=>{const{path:v}=b,w=P[b.name],S=this.keyframeDataList.find(M=>M.path===v&&M.frame===t);if(S)S.value=w,S.inTangentMode=x.Linear,S.outTangentMode=x.Linear;else{const M=this._createKeyframeData(t,w,b.valueType,void 0,void 0,b,e);this.keyframeDataList.push(M)}});else{const b=this.keyframeDataList.find(v=>v.path===o&&v.frame===t);if(b)b.value=P,b.inTangent=void 0,b.outTangent=void 0;else{const v=this._createKeyframeData(t,P,A,void 0,void 0,e,a===O.SubProperty?p:null);this.keyframeDataList.push(v)}}this.updateKeyframes(this.keyframeDataList)}addKeyframeByRecording(t,n){const r=this._ensurePropertyExists(n);r&&this.addKeyframe(t,r.path)}deleteKeyframes(t){t.forEach(n=>{const r=this.keyframeDataList.indexOf(n);r>-1&&this.keyframeDataList.splice(r,1)}),this.updateKeyframes(this.keyframeDataList)}updateKeyframes(t,n=!0){const r={};t.length&&t.sort((e,a)=>e.frame-a.frame),t.forEach(e=>{const a=e.path;r[a]??(r[a]=[]),r[a].push(e),r[a].sort((o,s)=>o.frame-s.frame)});for(const e in r)for(let a=0,o=r[e].length;a<o;++a){const s=r[e][a];if(s.interpolationType===I.Step)continue;const i=r[e][a-1],c=r[e][a+1];s.isFirst=a===0,s.isLast=a===o-1,a>0&&(s.frame-i.frame===0?s.linearInTangent=0:s.linearInTangent=(s.value-i.value)/((s.frame-i.frame)/this.samples),s.inTangent=s.inTangentMode===x.Linear?s.linearInTangent:s.inTangent,isNaN(s.inTangent)&&(s.inTangent=-1/0)),a<o-1&&(c.frame-s.frame===0?s.linearOutTangent=0:s.linearOutTangent=(c.value-s.value)/((c.frame-s.frame)/this.samples),s.outTangent=s.outTangentMode===x.Linear?s.linearOutTangent:s.outTangent,isNaN(s.outTangent)&&(s.outTangent=-1/0))}this.keyframeDataList=t.slice(0),this.isSubAsset||(this._generateEngineKeyframes(t),n&&this.persistMainViaFacade())}addEvent(t){const n={id:q(),time:t/this.samples,functionName:"onEvent"};this.events[n.id]=n,this.updateEvents(this.events)}deleteEvent(t){delete this.events[t.id],this.updateEvents(this.events)}updateEvents(t,n=!0){const r=this.engineObject;if(this.events={...t},r.clearEvents(),Object.values(this.events).map(e=>{const a=e.paramType==="string"?e.string:e.number;r.addEvent(e.functionName,e.time,a)}),this.data.events=Object.values(this.events).map(e=>({time:e.time,functionName:e.functionName,parameter:e.paramType==="string"?e.string:e.number})),n){const{isSubAsset:e}=this;if(e){const{assets:a}=this.root.assetStore,o=a[this.mainId];if(o){const s=o.engineObject.animations.indexOf(this._engineObject);o.updateAnimationEvents(s,this.data.events)}}this.persistMainViaFacade()}}updateSamples(t){this.samples=+t.toFixed(0)}updateRootEntity(t){if(!(!t||t.id===this.rootEntityId)){if(this.rootEntityId=t.id,this.engineObject){this._clearPropertyMappings();const n=this._init().then(async()=>{await this._generateKeyframeDataList(),await this._updateCurveBindings(),this.showEditor&&(await this.saveEditorOriginValue(),await this.sampleAnimation(this.root.animationClipStore.currentFrame))}).catch(r=>{console.warn("AnimationClipAsset:updateRootEntity rebuild failed",this.name,r)});this._initKeyframeDataPromise=n}this._listenRootEntityChanged(),this.persistMetaViaFacade()}}setTangentMode(t,n,r){t.forEach(e=>{if(n===ae.In)switch(e.inTangentMode=r,r){case x.Linear:e.inTangent=e.linearInTangent;break;case x.Constant:e.inTangent=-1/0;break;case x.Free:break}else switch(e.outTangentMode=r,r){case x.Linear:e.outTangent=e.linearOutTangent;break;case x.Constant:e.outTangent=-1/0;break;case x.Free:break}}),this.persistMetaViaFacade(),this.updateKeyframes(this.keyframeDataList)}async checkPropertiesSupport(t){const{properties:n}=this;let r=!1;const e=n.map(async a=>{const o=!!a.supported,{editorReference:s}=await this._getReferenceAndActualPropertyPath(t,a);s?a.supported=!0:a.supported=!1,!o&&a.supported&&(r=!0)});await Promise.all(e),r&&(this.properties=this.properties.slice(0),await this._generateKeyframeDataList(),this.updateKeyframes(this.keyframeDataList,!1),await this.saveEditorOriginValue(),await this.sampleAnimation(this.root.animationClipStore.currentFrame))}updateSelectedEvent(t){this.selectedEventId=t}async openEditor(t){if(t&&!this.showEditor){this._initKeyframeDataPromise||(this._initKeyframeDataPromise=this._generateKeyframeDataList()),this.showEditor=t,this.root.projectStore.animationEditing=t;const n=++this._openIndex;if(await this._initKeyframeDataPromise,n!==this._openIndex)return;this.saveEditorOriginValue(),this.sampleAnimation(this.root.animationClipStore.currentFrame),rt()}!t&&this.showEditor&&(this.showEditor=t,this.root.projectStore.animationEditing=t,this.revertValue())}async sampleAnimation(t){const n=this.rootEntity;if(n){const r=n.engineObject;try{await this._parseKeyframeValuePromise,this.engineObject._sampleAnimation(r,t/this.samples),this._syncToEditor()}catch(e){console.warn(e)}}}async saveEditorOriginValue(){const{_originValueStore:t}=this,{curveBindings:n}=this.engineObject,r=n.map(async e=>{const{relativePath:a,type:o,property:s}=e,i=K.get(o),{editorReference:c,editorPropertyPath:p,propertyPos:h}=await this._getReferenceAndActualPropertyPath(this.rootEntity,{relativePath:a,componentType:i,propertyPath:s});if(!c)return;const u=p[h];if(!t.has(e)){let d=u;u==="rotationQuaternion"&&(d="rotation"),t.set(e,Y(c[d]))}});await Promise.all(r)}async revertValue(){const{_originValueStore:t}=this,n=Array.from(t).map(async([r,e])=>{const{relativePath:a,type:o,property:s}=r,i=K.get(o),{editorReference:c,editorPropertyPath:p,propertyPos:h}=await this._getReferenceAndActualPropertyPath(this.rootEntity,{relativePath:a,componentType:i,propertyPath:s});if(!c)return;const u=p[h];let d=u;u==="rotationQuaternion"&&(d="rotation"),this._setEditorValue(c,d,e)});await Promise.all(n),t.clear()}async initByMain(t){const{engine:n,meta:r}=this;r.rootEntityId&&(this.rootEntityId=r.rootEntityId),this._listenRootEntityChanged();try{const e=JSON.parse(await t.text()),a=pt(e,{type:"AnimationClip",name:e.name}),o=await se(a,n);this.bindEngineObject(o),await this._init()}catch(e){console.error(`[AnimationClipAsset] Failed to load "${this.name}"`,e)}}async initByEngineObject(t){this.bindEngineObject(t),this._name=t.name,await this._init()}async initByCreation(t,n){this.setNameByIncrease(n||"AnimationClip");const r=new oe(this.name);return this.bindEngineObject(r),this.data={name:this.name,curveBindings:r.curveBindings,events:[]},await this._init(),this.getMainData()}_clearPropertyMappings(){this.pathPropertyMap.clear(),this._propertyCurveMap={},this._propertyPathCache.clear(),this._propertyLabelMap.clear(),this._editorPathCache.clear(),this.properties.length=0,this._colorIndex=0,this._originValueStore.clear()}_sortProperties(){this.properties.sort((t,n)=>(t.level??0)-(n.level??0))}async _init(){const t=this.engineObject;this._clearPropertyMappings();const r=(await this._groupCurveBindingsByParent(t.curveBindings)).map(async a=>{if(await this._generatePropertiesFromBindingGroup(a),this.isSubAsset)return Promise.resolve();const o=a.bindings.flatMap(s=>{const{curve:i}=s;return i.keys.map(c=>this._editorValueToEngineValue(c.value,this._getValueTypeByCurve(i)).then(p=>{c.value=p}))});return Promise.all(o)});if(!this.isSubAsset){const{properties:a,pathPropertyMap:o}=this;a.forEach(s=>{s.properties.length||this._colorIndex++,o.set(s.path,s),s.properties.forEach(i=>{this._colorIndex++,o.set(i.path,i)})})}await Promise.all(r),this._sortProperties();const e={};t.events.forEach(a=>{const o=q(),s=a.parameter?typeof a.parameter:"null";e[o]={id:o,time:a.time,functionName:a.functionName,paramType:s,string:s==="string"?a.parameter:void 0,number:s==="number"?a.parameter:void 0}}),this.data={name:t.name,curveBindings:t.curveBindings,events:[]},this.updateEvents(e,!1)}async onDoubleClick(){Te(this.root,"AnimationClip",{afterOpen:()=>{rt()}})}getMainData(){const t=this.data,n={...t,curveBindings:t.curveBindings.map(r=>{const{curve:e}=r,a=lt.get(e.constructor);return{...r,type:K.get(r.type)||r.type,curveType:a,curve:{interpolation:e.interpolation,keys:e.keys.map(o=>{const s=o.value,i=s instanceof nt?this.root.assetStore.engineObjectToAssetMap.get(s).getCurrentRef():s;return{...o,value:Y(i)}})}}})};return JSON.stringify(n)}async _syncToEditor(){const t=this.rootEntity,{curveBindings:n}=this.engineObject,r=n.map(async e=>{const{relativePath:a,type:o,property:s,getProperty:i}=e,c=K.get(o);if(!e.curve.keys.length)return;const p=await this._getActualPropertyPath(i??s,a,c),{editorReference:h,engineGetReference:u,editorPropertyPath:d,enginePropertyGetPath:l,propertyPos:m}=await this._getReferenceAndActualPropertyPath(t,{relativePath:a,componentType:c,propertyPath:p});if(!u||!h)return;const f=F({relativePath:a,componentType:c,propertyPath:d.slice(0,m+1).join(".")}),A=this.pathPropertyMap.get(f);let P=d[m],b=this._getEngineValue(u,l[m]),v=A.valueType;P==="rotationQuaternion"&&(P="rotation",b=b.toEuler(new at).scale(180/Math.PI),v=y.Vector3);const w=this._engineValueToEditorValue(b,v,!1);this._setEditorValue(h,P,w)});await Promise.all(r)}async _setEditorValue(t,n,r){var o,s;const e=(o=ie(t))==null?void 0:o[n],a=(s=G(t))==null?void 0:s[n];if(a!=null&&a.getEditorValue&&(r=a.getEditorValue(r)),a!=null&&a.setActualEditorValue?a==null||a.setActualEditorValue(t,n,r):t[n]=r,e!=null&&e.onChange){const i=r!=null&&r.refId?await t.root.assetStore.getAssetByRef(r):r;await e.onChange(t,n,i)}}_removeCurveBindings(t){const n=this.engineObject;if(!n)return;const r=new Set;for(const e of t){const a=this._propertyCurveMap[e];a&&(r.add(a),delete this._propertyCurveMap[e])}if(r.size>0){const e=n.curveBindings;for(let a=e.length-1;a>=0;a--){const o=e[a];r.has(o.curve)&&(e.splice(a,1),this._originValueStore.delete(o))}}}async _updateCurveBindings(){var n;const t=this.rootEntity;if(t)for(const r of this.properties)try{const{relativePath:e,componentType:a,valueType:o,properties:s,interpolationType:i}=r,c=F(r),p=await this._getReferenceAndActualPropertyPath(t,r),{editorReference:h,enginePropertySetPath:u,enginePropertyGetPath:d,editorPropertyPath:l,propertyPos:m}=p||{};if(!h||!u||!d||m===void 0)continue;const f=l[m],A=(n=G(h))==null?void 0:n[f],P=u.join("."),b=d.join(".");if(s.length)for(const v of s){const w=F(v),S=this._createCurve(w,v.valueType,v.interpolationType),M=v.name;await this._addCurveBinding(e,a,`${P}.${M}`,`${b}.${M}`,S),this._propertyCurveMap[w]=S}else{let v=o;A!=null&&A.valueType&&(v=A.valueType);const w=this._createCurve(c,v,i);await this._addCurveBinding(e,a,P,b,w),this._propertyCurveMap[c]=w}}catch(e){console.warn("updateCurveBindings skipped property (unresolved):",r==null?void 0:r.propertyPath,e);continue}}_createCurve(t,n,r){let e=this._propertyCurveMap[t];if(!e){const a=Z.get(n);a?(e=new a.curveClass,e.interpolation=r??a.defaultInterpolation):console.warn(`Unsupported curve value type: ${n}`)}return e}async _addCurveBinding(t,n,r,e,a){const o=pe.getClass(n),s=this.engineObject;let i=!0;for(let c=0,p=s.curveBindings.length;c<p;++c){const h=s.curveBindings[c];h.relativePath===t&&h.type===o&&h.property===r&&h.getProperty===e&&(h.curve=a,i=!1)}i&&(s.addCurveBinding(t,o,r,e,a),await this.saveEditorOriginValue())}_addPropertyToList(t,n,r,e=!0){var i;const a=this._covertToPropertyData(n,r),o=t.push(a),s=t[o-1];return this.pathPropertyMap.set(s.path,s),e&&((i=n.children)!=null&&i.length)&&n.children.forEach(c=>{this._addPropertyToList(s.properties,c,s,e)}),s}_delPropertyFromList(t,n){const r=t.findIndex(e=>e.path===n.path);r>-1&&(t.splice(r,1),this.pathPropertyMap.delete(n.path))}_covertToPropertyData(t,n){const{name:r,label:e,relativePath:a,componentType:o,propertyPath:s,type:i,valueType:c,interpolationType:p,children:h}=t,u=F(t),d=F(n),l=a.split("/").length-1;return{name:e||r,level:l,path:u,type:i,valueType:c,interpolationType:p,propertyPath:s,componentType:o,relativePath:a,hasSubProperty:h.length>0,curveColor:c===y.Float?this._getRandomColor():null,supported:!0,properties:[],parentPath:d}}async _getReferenceAndActualPropertyPath(t,n){if(!t)return{};const{relativePath:r,componentType:e,propertyPath:a}=n,o=t.findByPath(r);if(!o)return{};const s=o.getComponentByTypeName(e);if(!s)return{};const i=[],c=[],p=[],h=a.split("."),u=h.length-1;let d=-1,l=s;for(let P=0,b=u;P<=b;++P){const v=h[P];if(!l)return{};const w=G(l);let S="",M=v,k=v,z=v,R=P;for(let B=P,Q=u;B<=Q;++B){S+=h[B];const J=(w==null?void 0:w[S])||{},{getPath:U,setPath:L,editorKey:tt}=J;L&&(k=L,R=B),(U||L)&&(B===u&&L?k=L:k=U??L,z=U??L,R=B),tt&&(M=tt,R=B),B<u&&(S+=".")}P=R,c.push(k),p.push(z),i.push(M),ce(l,M)&&(d=i.length-1),P<u&&(l=l[M],l!=null&&l.refId&&(l=await this.root.assetStore.getAssetByRef(l)))}const m=d>-1?d-1:i.length-1;l=s;for(let P=0,b=m;P<b;++P)l=l[i[P]],l!=null&&l.refId&&(l=await this.root.assetStore.getAssetByRef(l));const f=this._getEngineValue(s.engineObject,c.slice(0,m).join(".")),A=this._getEngineValue(s.engineObject,p.slice(0,m).join("."));return{editorReference:l,engineSetReference:f,engineGetReference:A,enginePropertySetPath:c,enginePropertyGetPath:p,editorPropertyPath:i,propertyPos:m,subPropertyPos:d}}_getEngineValue(t,n){if(!n)return t;let r=t;const e=n.split(".");for(let a=0,o=e.length;a<o;a++){const s=e[a];if(s.indexOf("[")>-1){const i=s.indexOf("[");r=r[s.slice(0,i)],r=r[parseInt(s.slice(i+1,-1))]}else if(s.endsWith(")")){const i=s.slice(0,s.indexOf("(")),c=s.match(/\w+\(([^)]*)\)/)[1].split(",").map(p=>p.trim().replace(/['"]+/g,"")).filter(p=>p!=="");r=r[i](...c)}else r=r[s]}return r}async _generateKeyframeDataList(){const t=this.engineObject,n=[],r=this.pathPropertyMap,e=t.curveBindings.map(async a=>{const{relativePath:o,type:s,getProperty:i,property:c,curve:p}=a,h=K.get(s),u=i??c,d=await this._convertPropertyProxyPath(u,h,o),m=F({relativePath:o,componentType:h,propertyPath:d||u});d||console.warn(`无法转换引擎路径到编辑器路径: ${u},使用原路径`);const f=r.get(m);if(!f){d&&console.warn(`转换后的路径仍未找到属性定义: ${m}, 原引擎路径: ${u}`);return}this._propertyCurveMap[m]=p;const A=f.valueType;p.keys.forEach(P=>{const{time:b,value:v,inTangent:w,outTangent:S}=P,M=Math.floor(b*this.samples),k=this._engineValueToEditorValue(v,A,!0),z=this._getSubProperties(A,p);if(z)z.forEach(R=>{const B=`${m}.${R}`,Q=r.get(B),J=w&&w[R],U=S&&S[R],L=this._createKeyframeData(M,k[R],y.Float,J,U,Q,f);n.push(L)});else{const R=r.get(f.parentPath),B=this._createKeyframeData(M,k,A,w,S,f,R);n.push(B)}})});await Promise.all(e),this.updateKeyframes(n,!1)}_createKeyframeData(t,n,r,e,a,o,s){const{path:i,curveColor:c}=o,{path:p=""}=s||{};return{id:q(),frame:t,path:i,value:n,isActive:!0,valueType:r??y.Float,curveColor:c,parentPath:p,inTangent:e,outTangent:a,interpolationType:o.interpolationType,inTangentMode:e===void 0?x.Linear:e===-1/0?x.Constant:x.Free,outTangentMode:a===void 0?x.Linear:a===-1/0?x.Constant:x.Free}}_generateEngineKeyframes(t){const{_propertyCurveMap:n,samples:r,engineObject:e}=this,a=this._groupKeyframesByPath(t),s=this._collectPathsToSync(n,a).map(i=>this._syncCurveForPath(i,n[i],a.get(i)||[],r,e));this._parseKeyframeValuePromise=Promise.all(s)}_groupKeyframesByPath(t){return t.reduce((n,r)=>{const e=n.get(r.path)||[];return e.push(r),n.set(r.path,e),n},new Map)}_collectPathsToSync(t,n){const r=new Set;return Object.keys(t).forEach(e=>r.add(e)),n.forEach((e,a)=>r.add(a)),Array.from(r)}async _syncCurveForPath(t,n,r,e,a){if(!n)return;const o=await this._convertToEngineKeyframes(r,e);this._removeObsoleteKeyframes(n,o),this._addOrUpdateKeyframes(n,o,a)}async _convertToEngineKeyframes(t,n){const r=new Map;for(const e of t){const a=e.frame/n,o=await this._editorValueToEngineValue(e.value,e.valueType);o===void 0&&e.valueType===y.ReferResource||r.set(a,{value:o,inTangent:e.inTangent,outTangent:e.outTangent})}return r}_removeObsoleteKeyframes(t,n){const r=new Set(n.keys());for(let e=t.keys.length-1;e>=0;e--){const a=t.keys[e];r.has(a.time)||t.keys.splice(e,1)}}_addOrUpdateKeyframes(t,n,r){const e=new Map;t.keys.forEach(a=>{e.set(a.time,a)});for(const[a,{value:o,inTangent:s,outTangent:i}]of n){const c=e.get(a);if(c)c.value=o,c.inTangent=s,c.outTangent=i;else{const p=new be;p.time=a,p.value=o,p.inTangent=s,p.outTangent=i,t.addKey(p)}a>r._length&&(r._length=a)}}async _editorValueToEngineValue(t,n){var r;switch(n){case y.ReferResource:return t!=null&&t.refId?(r=await this.root.assetStore.getAssetByRef(t))==null?void 0:r.engineObject:t;case y.Color:return new de(t.r,t.g,t.b,t.a);case y.Vector2:return new ye(t.x,t.y);case y.Vector3:return new at(t.x,t.y,t.z);case y.Vector4:return new ue(t.x,t.y,t.z,t.w);case y.Quaternion:return new he(t.x,t.y,t.z,t.w);case y.Rect:return new le(t.x,t.y,t.width,t.height);case y.Float:return t;default:return t}}_engineValueToEditorValue(t,n,r){var a,o,s;let e;switch(n){case y.MethodParam:{if(e=[],r)for(let i=0,c=t.length;i<c;i++){const p=t[i];e[i]??(e[i]=[]);for(let h=0,u=p.length;h<u;h++){const d=p[h];e[i][h]=((a=this.root.assetStore.engineObjectToAssetMap.get(d))==null?void 0:a.getCurrentRef())??d}}else t&&t instanceof nt?e=[[((o=this.root.assetStore.engineObjectToAssetMap.get(t))==null?void 0:o.getCurrentRef())??t]]:t instanceof Array?e=t:e=[[t]];break}case y.ReferResource:{e=(s=this.root.assetStore.engineObjectToAssetMap.get(t))==null?void 0:s.getCurrentRef();break}case y.Color:{e={r:t.r,g:t.g,b:t.b,a:t.a},["r","g","b","a"].forEach(i=>{e[i]=Math.round(e[i]*1e3)/1e3});break}case y.Vector2:{e={x:t.x,y:t.y},["x","y"].forEach(i=>{e[i]=Math.round(e[i]*1e3)/1e3});break}case y.Vector3:{e={x:t.x,y:t.y,z:t.z},["x","y","z"].forEach(i=>{e[i]=Math.round(e[i]*1e3)/1e3});break}case y.Vector4:case y.Quaternion:{e={x:t.x,y:t.y,z:t.z,w:t.w},["x","y","z","w"].forEach(i=>{e[i]=Math.round(e[i]*1e3)/1e3});break}case y.Rect:{e={x:t.x,y:t.y,width:t.width,height:t.height},["x","y","width","height"].forEach(i=>{e[i]=Math.round(e[i]*1e3)/1e3});break}case y.Float:{e=Math.round(t*1e3)/1e3;break}default:e=t}return e}_getValueTypeByCurve(t){return ct.get(t.constructor)}_parsePropertyPath(t){const n=this._propertyPathCache.get(t);if(n)return n;const r=t.lastIndexOf("."),e=r===-1?{parentPath:t,subProperty:null}:{parentPath:t.substring(0,r),subProperty:t.substring(r+1)};return this._propertyPathCache.set(t,e),e}_isSubPropertyName(t){return/^([xyzw]|[rgba]|width|height)$/.test(t)}async _convertPropertyProxyPath(t,n,r){try{const e=this._resolveProxyHost(n,r,t);if(!e)return null;const a=`${r}|${n}|${t}`;if(this._editorPathCache.has(a))return this._editorPathCache.get(a);const o=await this._recursiveConvert(t,e,0);return o&&o!==t&&await this._buildLabelMappingsForPath(o,r,n,e),this._editorPathCache.set(a,o??null),o}catch{const a=`${r}|${n}|${t}`;return this._editorPathCache.set(a,null),null}}async _buildLabelMappingsForPath(t,n,r,e){try{const a=await this._getReferenceAndActualPropertyPath(this.rootEntity,{relativePath:n,componentType:r,propertyPath:t}),o=(a==null?void 0:a.editorPropertyPath)||t.split("."),s=typeof(a==null?void 0:a.propertyPos)=="number"?a.propertyPos:o.length-1;for(let i=0;i<=s;i++){const c=o.slice(0,i+1).join("."),p=F({relativePath:n,componentType:r,propertyPath:c});if(!this._propertyLabelMap.has(p)){const h=await this._extractLabelForPartialPath(c,e);h&&this._propertyLabelMap.set(p,h)}}}catch(a){console.warn("建立标签映射失败:",a)}}async _extractLabelForPartialPath(t,n){try{const r=t.split("."),e=r[r.length-1];let a=n,o=null;for(let s=0;s<r.length;s++){const i=r[s],c=a==null?void 0:a[H];if(c&&c[i]){const p=c[i];p.label&&(o=p.label),s<r.length-1&&(a=await this._getNextObject(a,i))}else break}return o||e}catch{return t.split(".").pop()||t}}async _recursiveConvert(t,n,r){if(r>6)return t;const e=n[H];if(!e)return t;for(const[a,o]of Object.entries(e)){if(!this._isPathMatch(t,o))continue;const s=o.getPath||o.setPath;if(s){if(s.endsWith("()")&&t.startsWith(s+".")){const i=t.substring(s.length+1),c=await this._getNextObject(n,a);if(!c)return`${a}.${i}`;const p=await this._recursiveConvert(i,c,r+1);return p?`${a}.${p}`:`${a}.${i}`}return this._buildEditorPath(a,t,o)}}return t}async _getNextObject(t,n){var r;try{let e=t[n];if(!e){const a=`get${n.charAt(0).toUpperCase()+n.slice(1)}`;typeof t[a]=="function"&&(e=t[a]())}if(e!=null&&e.refId&&((r=this.root)!=null&&r.assetStore)){let a=this.root.assetStore.engineObjectToAssetMap.get(e);if(!a)try{a=await this.root.assetStore.getAssetByRef(e)}catch{return e}if(a)return a}return e}catch{return null}}_resolveProxyHost(t,n,r){try{if(!this.rootEntity)return null;const e=n?this.rootEntity.findByPath(n):this.rootEntity;if(!e)return null;const a=e.getComponentByTypeName(t);return a?r?this._resolvePropertyProxyHolder(a,r):a:null}catch(e){return console.warn(`获取代理宿主失败: ${t}, ${n}`,r,e),null}}_resolvePropertyProxyHolder(t,n){try{const r=[t];this._addRelatedObjectCandidates(t,r);for(const e of r)if(this._hasMatchingProxyConfig(e,n))return e;return t}catch(r){return console.warn(`解析 PropertyProxy 持有者失败: ${n}`,r),t}}_addRelatedObjectCandidates(t,n){try{const r=t[H];if(!r)return;const e=new Set;for(const a of Object.values(r)){const o=this._extractObjectPathFromConfig(a);o&&e.add(o)}for(const a of e){const o=this._getEngineValue(t.engineObject,a);if(o){const s=this.root.assetStore.engineObjectToAssetMap.get(o);s&&!n.includes(s)&&n.push(s)}}}catch{}}_extractObjectPathFromConfig(t){const n=t.getPath||t.setPath;if(!n)return null;const r=n.match(/^([^.]+\([^)]*\))/);return r?r[1]:null}_hasMatchingProxyConfig(t,n){const r=t[H];if(!r)return!1;for(const e of Object.values(r))if(this._isPathMatch(n,e))return!0;return!1}_isPathMatch(t,n){return n?n.getPath&&this._isExactPathMatch(t,n.getPath)||n.setPath&&this._isExactPathMatch(t,n.setPath)||n.engineKey&&t.includes(n.engineKey):!1}_isExactPathMatch(t,n){if(!n)return!1;const r=p=>p.replace(/['"`\s]/g,""),e=p=>{let h="";for(let u=0;u<p.length;u++){const d=p[u];if(d==="("){for(;u<p.length&&p[u]!==")";)u++;h+="()"}else h+=d}return h},a=p=>e(r(p).replace(/\$value/g,"value")),o=a(t),s=a(n);if(o===s||((p,h)=>p.startsWith(h+".")||p.startsWith(h+"["))(o,s))return!0;if(!n.includes(".")&&!n.includes("(")&&!n.includes("[")){const p=o.split(".");for(const h of p){const u=h.indexOf("[");if((u>=0?h.slice(0,u):h)===s)return!0}}return!1}_buildEditorPath(t,n,r){if(!r)return t;const e=r.getPath||r.setPath;if(!e)return t;if(e.endsWith("()")&&n.startsWith(e+".")){const s=n.substring(e.length+1);return`${t}.${s}`}const a=n.replace(/['"`]/g,"").replace(/\$value/g,"value"),o=e.replace(/['"`]/g,"").replace(/\$value/g,"value");if(a.includes(o))return a.replace(o,t);if(!e.includes(".")&&!e.includes("(")){const s=n.match(/\.([a-zA-Z_]\w*)$/);if(s){const i=s[1];if(i!==e)return`${t}.${i}`}}return t}_validateCurveBinding(t){const{relativePath:n,type:r,getProperty:e,property:a}=t;return K.get(r)?e??a?!0:(console.warn(`绑定缺少属性路径: ${n}`),!1):(console.warn(`未知组件类型: ${r},跳过绑定`),!1)}async _groupCurveBindingsByParent(t){const n=new Map;return await Promise.all(t.map(async r=>{if(!this._validateCurveBinding(r))return;const{relativePath:e,type:a,getProperty:o,property:s}=r,i=K.get(a),c=o??s,h=await this._convertPropertyProxyPath(c,i,e)||c,u=this._parsePropertyPath(h),d=u.subProperty&&this._isSubPropertyName(u.subProperty);let l,m;d&&u.subProperty?(m=u.parentPath,l=`${e}.${i}.${m}`):(m=h,l=`${e}.${i}.${h}`),n.has(l)||n.set(l,{parentPath:m,relativePath:e,componentType:i,bindings:[]}),n.get(l).bindings.push(r)})),Array.from(n.values())}_validateAndGetParentValueType(t){if(t.length===1){const l=t[0],m=l.getProperty??l.property,{subProperty:f}=this._parsePropertyPath(m);return!f||!this._isSubPropertyName(f)?null:y.Float}if(!t.every(l=>this._getValueTypeByCurve(l.curve)===y.Float)){const l=t.map(m=>this._getValueTypeByCurve(m.curve));return console.warn(`分组中的绑定类型不一致: ${l.join(", ")},无法创建父属性`),null}const r=t.map(l=>l.curve.interpolation),e=r[0];r.every(l=>l===e)||console.warn(`子属性插值类型不一致: ${r.join(", ")}`);const o=t.map(l=>{const m=l.getProperty??l.property,f=m.lastIndexOf(".");return f===-1?null:m.substring(f+1)}).filter(Boolean).sort(),s=o.join(",");switch(s){case"x,y":return y.Vector2;case"x,y,z":return y.Vector3;case"w,x,y,z":return y.Vector4;case"a,b,g,r":return y.Color;case"height,width,x,y":return y.Rect}const i=new Set(["x","y","z","w"]),c=new Set(["r","g","b","a"]),p=new Set(["x","y","width","height"]),h=o.every(l=>i.has(l)),u=o.every(l=>c.has(l)),d=o.every(l=>p.has(l));return h?o.some(l=>l==="w")?y.Vector4:o.some(l=>l==="z")?y.Vector3:y.Vector2:u?y.Color:d?y.Rect:(console.warn(`无法识别的子属性组合: ${s}`),null)}_validateBindingGroup(t){const{bindings:n}=t;return n.every(r=>this._validateCurveBinding(r))&&this._validateAndGetParentValueType(n)!==null}_createParentProperty(t,n){const{parentPath:r,relativePath:e,componentType:a}=t,o=F({relativePath:e,componentType:a,propertyPath:r}),s=I.Linear,i=this._propertyLabelMap.get(o),c=r.split(".").pop()||r;return{name:i||c,level:e.split("/").length-1,path:o,type:O.Property,valueType:n,interpolationType:s,componentType:a,relativePath:e,hasSubProperty:!0,curveColor:null,supported:!0,properties:[],propertyPath:r}}async _createSubPropertiesFromBindings(t,n,r,e){return Promise.all(t.map(async a=>{const{getProperty:o,property:s,curve:i}=a,c=o??s,p=await this._convertPropertyProxyPath(c,e,r)||c,h=p.lastIndexOf("."),u=h===-1?p:p.substring(h+1),d=`${n}.${u}`,l={name:u,level:r.split("/").length,path:d,type:O.SubProperty,valueType:y.Float,interpolationType:i.interpolation,componentType:e,relativePath:r,hasSubProperty:!1,curveColor:this._getRandomColor(),supported:!0,properties:[],propertyPath:p,parentPath:n};return this.pathPropertyMap.set(d,l),l}))}_registerPropertyGroup(t,n){t.properties=n,this.pathPropertyMap.has(t.path)&&console.warn(`覆盖已存在的属性路径: ${t.path}`),this.pathPropertyMap.set(t.path,t),this.properties.push(t)}async _generatePropertiesFromBindingGroup(t){const{parentPath:n,relativePath:r,componentType:e,bindings:a}=t;if(!this.rootEntity){await Promise.all(a.map(p=>this._generatePropertyByEngineObject(p)));return}const o=await this._convertPropertyProxyPath(n,e,r)||n;if(!this._validateBindingGroup(t)){this.rootEntity&&a.length>1&&console.debug("AnimationClipAsset: grouping skipped",this.name,e,r,n),await Promise.all(a.map(p=>this._generatePropertyByEngineObject(p)));return}const s=this._validateAndGetParentValueType(a);if(s===null){console.error("验证通过但获取不到父属性类型"),await Promise.all(a.map(p=>this._generatePropertyByEngineObject(p)));return}const i=this._createParentProperty({...t,parentPath:o},s),c=await this._createSubPropertiesFromBindings(a,i.path,r,e);this._registerPropertyGroup(i,c)}async _generatePropertyByEngineObject(t){const{pathPropertyMap:n}=this,{relativePath:r,type:e,curve:a,getProperty:o,property:s}=t,i=K.get(e),c=o??s,p=await this._convertPropertyProxyPath(c,i,r)??c,h=this._getValueTypeByCurve(a),u=F({relativePath:r,componentType:i,propertyPath:p}),d=this._propertyLabelMap.get(u),l=p.lastIndexOf("."),m=l===-1?p:p.substring(l+1),f={name:d||m,level:r.split("/").length-1,path:u,type:O.Property,valueType:h,interpolationType:a.interpolation,componentType:i,relativePath:r,hasSubProperty:!1,curveColor:this._getRandomColor(),supported:!0,properties:[],propertyPath:p},A=this._getSubProperties(h,a);A&&(f.curveColor=null,f.hasSubProperty=!0,f.properties=A.map(P=>{const b=`${u}.${P}`,v={name:P,level:r.split("/").length,path:b,type:O.SubProperty,valueType:y.Float,interpolationType:a.interpolation,componentType:i,relativePath:r,hasSubProperty:!1,curveColor:this._getRandomColor(),supported:!0,properties:[],propertyPath:`${p}.${P}`};return n.set(b,v),v})),n.set(u,f),this.properties.push(f)}async _getActualPropertyPath(t,n,r){if(!this.isSubAsset){const{editorPropertyPath:e=[]}=await this._getReferenceAndActualPropertyPath(this.rootEntity,{relativePath:n,componentType:r,propertyPath:t});t=e.join(".")}return t}_getRandomColor(){const{_colorList:t}=this,n=(e,a)=>{const o=parseInt(e.slice(1),16),s=parseInt(a.slice(1),16);return`#${parseInt(`${(o+s)/2}`).toString(16).toUpperCase()}`},r=()=>{const e=[];for(let o=0,s=t.length-1;o<s;o++){const i=n(t[o],t[o+1]);e.push(i)}const a=t.slice(0,t.length-1);for(let o=0,s=a.length+e.length;o<s;o++)t[o]=o%2===0?a[o/2]:e[(o-1)/2]};for(;this._colorIndex>=t.length;)r();return t[this._colorIndex++]}_getSubProperties(t,n){let r;switch(t){case y.Vector2:{r=["x","y"];break}case y.Vector3:{r=["x","y","z"];break}case y.Vector4:{r=["x","y","z","w"];break}case y.Quaternion:{r=["x","y","z","w"];break}case y.Color:{r=["r","g","b","a"];break}case y.Array:case y.FloatArray:n.keys[0]&&(r=Array.from(n.keys[0].value).map((e,a)=>a))}return r}_listenRootEntityChanged(){var n;const t=this.rootEntity;t&&(this.showEditor&&(this.openEditor(!1),this.openEditor(!0)),(n=this._componentsChangedListenerDisposer)==null||n.call(this),this._componentsChangedListenerDisposer=me(()=>t.components.length,()=>{this.checkPropertiesSupport(t),this.engineObject.curveBindings.forEach(r=>{r._tempCurveOwner={}})}))}_convertPropertyToTreeItem(t){var m;const{name:n,label:r,properties:e=[],relativePath:a,componentType:o,path:s,type:i,curveColor:c,supported:p,level:h}=t,u=((m=this.rootEntity.findByPath(a))==null?void 0:m.name)||a.split("/").pop(),d=r||n;return{name:i===O.Property?`${u}:${o}.${d}`:d,id:s,canAddKeyframe:i===O.Property||i===O.SubProperty,curveColor:c,supported:p,level:h,children:e.map(f=>this._convertPropertyToTreeItem(f))}}_ensurePropertyExists(t){const n=F(t);let r=this.pathPropertyMap.get(n);return r||(r=this.addProperty(t)),t.children&&t.children.length&&t.children.forEach(e=>{this._ensurePropertyExists(e)}),r}destroy(){var t;super.destroy(),(t=this._componentsChangedListenerDisposer)==null||t.call(this),this._propertyPathCache.clear(),this.pathPropertyMap.clear(),this._propertyCurveMap={},this._propertyLabelMap.clear(),this._editorPathCache.clear(),this._originValueStore.clear()}};T([D],C.prototype,"samples",2);T([D],C.prototype,"properties",2);T([D],C.prototype,"keyframeDataList",2);T([D],C.prototype,"events",2);T([fe()],C.prototype,"data",2);T([D],C.prototype,"selectedEventId",2);T([D,ge()],C.prototype,"rootEntityId",2);T([D],C.prototype,"readOnly",2);T([Pe],C.prototype,"addedPropertiesTreeData",1);T([E],C.prototype,"addProperty",1);T([E],C.prototype,"delProperty",1);T([E],C.prototype,"addKeyframe",1);T([E],C.prototype,"deleteKeyframes",1);T([E],C.prototype,"updateKeyframes",1);T([E],C.prototype,"addEvent",1);T([E],C.prototype,"deleteEvent",1);T([E],C.prototype,"updateEvents",1);T([E],C.prototype,"updateSamples",1);T([E],C.prototype,"updateRootEntity",1);T([E],C.prototype,"setTangentMode",1);T([E],C.prototype,"checkPropertiesSupport",1);T([E],C.prototype,"updateSelectedEvent",1);T([E],C.prototype,"openEditor",1);C=T([_e({type:"AnimationClip",label:j("asset.animation-clip.title"),icon:"animate-clip",extname:"anim",importMenuConfig:{type:ve.Add},customInspector:Se,viewer:$,async bundle({content:_},t,n){var a;const r=JSON.parse(await _.text());for(const o of r.curveBindings)if(o.curveType==="AnimationRefCurve"){for(const s of o.curve.keys)if((a=s.value)!=null&&a.refId){const i=n.resolveRef(s.value.refId);i&&(s.value=i)}}const e=pt(r,{type:"AnimationClip",name:r.name});return{content:new Blob([e])}}})],C);export{C as A,Se as a,$ as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var D=Object.defineProperty;var O=(r,t,a)=>t in r?D(r,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):r[t]=a;var c=(r,t,a)=>(O(r,typeof t!="symbol"?t+"":t,a),a);import{aQ as x,aR as v,aU as N,aS as _,aP as B,aX as I,j as L,aY as U,aZ as z,a_ as F,x as M,a$ as R,m as A,b0 as V,n as $,e as q,o as J,q as Q,b1 as W}from"./index-aec7e708.js";import{u as X}from"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";import"./meshopt_simplifier.module-cd99529d.js";import{b as Y}from"./bundlers-9b0d37fc.js";import{o as Z}from"./assetEditorActions-c4e5962f.js";const k=x(function(){const{layoutStore:t}=X(),{t:a}=v(),e=N.useCallback(()=>{t.toggleTabVisibility("AnimatorController")},[]);return _.jsx(B,{align:"both",css:{padding:"$1"},fullWidth:!0,children:_.jsx(I,{size:"sm",onClick:e,children:a("animation.animator-controller.editor.open")})})});var G=Object.defineProperty,H=Object.getOwnPropertyDescriptor,y=(r,t,a,e)=>{for(var s=e>1?void 0:e?H(t,a):t,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=(e?n(t,a,s):n(s))||s);return e&&s&&G(t,a,s),s};let d=class extends L{constructor(t){super(t);c(this,"statesNameMap",{});c(this,"internalDataUpdated",!1);c(this,"layers",[]);c(this,"parameters",[]);c(this,"_syncing");c(this,"_syncingPromise");this.onDoubleClick=this.onDoubleClick.bind(this)}applyPropertyFromDomain(t,a){super.applyPropertyFromDomain(t,a),(t==="layers"||t==="parameters")&&this.applyControllerData().catch(e=>{console.error("[AnimatorControllerAsset] applyControllerData failed:",e)})}initByEngineObject(t){return this.setNameByIncrease("AnimatorController"),this.bindEngineObject(t),this.layers=t.layers.map(a=>{const e=a.stateMachine,o={states:e.states.map(n=>({name:n.name,speed:n.speed,wrapMode:n.wrapMode,clipStartNormalizedTime:n.clipStartTime,clipEndNormalizedTime:n.clipEndTime,clip:this.root.assetStore.engineObjectToAssetMap.get(n.clip).getCurrentRef(),transitions:[],scripts:[],isEntryState:n===e.defaultState,isExitState:!1,isAnyState:!1})),transitions:[],entryTransitions:[],anyTransitions:[]};return{name:a.name,blendingMode:a.blendingMode,weight:a.weight,stateMachine:o}}),this.internalDataUpdated=!0,this.getMainData()}async initByMain(t){const{internalDataUpdated:a}=this.meta;a&&(this.internalDataUpdated=!0);const e=JSON.parse(await t.text()),s=new U(this.engine);this.bindEngineObject(s),this.layers=e.layers||[],this.parameters=e.parameters||[],await this.applyControllerData()}async applyControllerData(){this._syncing&&await this._syncingPromise,this._syncing=!0;try{this.statesNameMap={};const t=this.engineObject;t.clearLayers(),t._parameters.length=0,t._parametersMap={};const{layers:a,parameters:e}=this;this._syncingPromise=Promise.all(a.map((s,o)=>{const{name:n,blendingMode:m,weight:u}=s,l=new z(n);return t.addLayer(l),l.blendingMode=m,l.weight=u,this._applyStateMachineData(o)})),e.forEach(s=>{const{isTrigger:o,name:n,defaultValue:m}=s;o?t.addTriggerParameter(n):t.addParameter(n,m)}),await this._syncingPromise}finally{this._syncing=!1}}async initByCreation(){return this.layers=[{name:"Base",weight:1,blendingMode:F.Override,stateMachine:{states:[],transitions:[],entryTransitions:[],anyTransitions:[]}}],this.getMainData()}onDoubleClick(){Z(this.root,"AnimatorController",{clearSceneSelection:!0})}async _applyStateMachineData(t){const a=this.engineObject.layers[t],{stateMachine:e}=this.layers[t],s=a.stateMachine;if(e){const{states:o=[],transitions:n=[],entryTransitions:m=[],anyTransitions:u=[]}=e,l={},T={},w=o.map(async i=>{var S,E;const{id:h,name:f,speed:b,wrapMode:g,clipStartNormalizedTime:P,clipEndNormalizedTime:j,clip:C}=i;(S=this.statesNameMap)[t]||(S[t]={}),this.statesNameMap[t][i.name]=i;const p=s.addState(f);p.speed=b,p.wrapMode=g,p.clipStartTime=P,p.clipEndTime=j,l[h]=p,C&&(p.clip=(E=await this.root.assetStore.getAssetByRef(C))==null?void 0:E.engineObject)});n.forEach(i=>{const h=this._createTransition(i,l[i.destinationStateId]);T[i.id]=h}),o.forEach(i=>{const{id:h,transitions:f}=i;f.forEach(b=>{const g=T[b];g&&l[h].addTransition(g)})}),m.forEach(i=>{s.addEntryStateTransition(this._createTransition(i,l[i.destinationStateId]))}),u.forEach(i=>{s.addAnyStateTransition(this._createTransition(i,l[i.destinationStateId]))}),await Promise.all(w),this.engineObject._updateFlagManager.dispatch()}}_createTransition(t,a){const e=new W;return e.duration=t.duration,e.offset=t.offset,e.exitTime=t.exitTime,e.solo=t.solo,e.mute=t.mute,e.hasExitTime=t.hasExitTime,e._isExit=t.isExit,e.destinationState=a,t.conditions.forEach(s=>{e.addCondition(s.parameterName,s.mode,s.threshold)}),e}};y([M,R()],d.prototype,"internalDataUpdated",2);y([A(),M],d.prototype,"layers",2);y([A(),M],d.prototype,"parameters",2);y([V],d.prototype,"applyPropertyFromDomain",1);d=y([$({type:"AnimatorController",label:q("asset.animator-controller.title"),icon:"animate-controller",extname:"animCtrl",importMenuConfig:{type:J.Add},dragLayer:Q.AnimationController,customInspector:k,async bundle({content:r}){return{content:new Blob([Y(await r.text())])}}})],d);export{d as AnimatorControllerAsset};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=Object.defineProperty;var P=(n,o,t)=>o in n?f(n,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[o]=t;var i=(n,o,t)=>(P(n,typeof o!="symbol"?o+"":o,t),t);import{E as y,bp as d,s as c,p as m,C as u,t as h,e as C,bq as _,br as v,u as S,bs as g,bt as O}from"./index-aec7e708.js";import"./index-e8a45e82.js";import{c as A}from"./Component-ed7aa0ab.js";import"./postmen-2f47f6bb.js";var w=Object.defineProperty,E=Object.getOwnPropertyDescriptor,p=(n,o,t,r)=>{for(var e=r>1?void 0:r?E(o,t):o,a=n.length-1,l;a>=0;a--)(l=n[a])&&(e=(r?l(o,t,e):l(e))||e);return r&&e&&w(o,t,e),e};let s=class extends y{constructor(o,t){super(o,t);i(this,"animatorController",null);i(this,"cullingMode",d.None);i(this,"speed",1)}async bindEngineObject(o){await super.bindEngineObject(o),o.enabled=!1}};p([c(),m({type:u.AssetPicker,assetType:"AnimatorController",label:"animation.animator-controller.controller.title",info:"animation.animator-controller.controller.info",bindPath:"animatorController"})],s.prototype,"animatorController",2);p([c(),m({type:u.Select,label:"animation.animator-controller.culling-mode.title",info:"animation.animator-controller.culling-mode.info",options:h(d,void 0,n=>C(`animation.animator-controller.culling-mode.${n.toLowerCase()}`)),bindPath:"cullingMode"})],s.prototype,"cullingMode",2);p([c(),m({type:u.Number,label:"animation.animator-controller.speed.title",info:"animation.animator-controller.speed.info",bindPath:"speed"})],s.prototype,"speed",2);s=p([A({type:"Animator",componentsMenu:{label:"component.animator.title"},unique:!0})],s);class M extends _{constructor(){super(...arguments);i(this,"_animatorComponents",[]);i(this,"onScriptPlay")}init(t){this.onScriptPlay=t.onScriptPlay}onPlay(t){this.engine.sceneManager.scenes[0].rootEntities.forEach(e=>{e.getComponentsIncludeChildren(v,this._animatorComponents)}),this._animatorComponents.forEach(e=>{e.enabled=t,t||e._reset()}),this.onScriptPlay&&this.onScriptPlay(t)}}var j=Object.defineProperty,D=Object.getOwnPropertyDescriptor,$=(n,o,t,r)=>{for(var e=r>1?void 0:r?D(o,t):o,a=n.length-1,l;a>=0;a--)(l=n[a])&&(e=(r?l(o,t,e):l(e))||e);return r&&e&&j(o,t,e),e};let b=class{constructor(n){i(this,"script");i(this,"root");S(this),this.root=n}init(){this.script=g.addScript(M),this.script.init({onScriptPlay:n=>{var o;(o=this.root.animatorControllerStore)==null||o.updateGlobalPlayState(n)}})}};b=$([O({type:"animatorStore"})],b);export{s as A,b as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r=Object.defineProperty;var n=(t,e,s)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var i=(t,e,s)=>(n(t,typeof e!="symbol"?e+"":e,s),s);import{U as o}from"./index-aec7e708.js";class _{constructor(){i(this,"overridePreviewer");i(this,"_entity");i(this,"_requestResetCamera");i(this,"_boundingBox",new o)}stopViewAsset(){this._entity&&(this._entity=null)}getDescription(e){return""}}export{_ as A};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var b=Object.defineProperty;var y=(t,e,r)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var p=(t,e,r)=>(y(t,typeof e!="symbol"?e+"":e,r),r);import{aO as O,aQ as c,aS as n,u as f,x as d,j,a7 as A,n as w,e as m,o as P}from"./index-aec7e708.js";import"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";import{A as _}from"./AssetViewer-64cd01fa.js";var g=Object.defineProperty,x=Object.getOwnPropertyDescriptor,v=(t,e,r,o)=>{for(var s=o>1?void 0:o?x(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(s=(o?i(e,r,s):i(s))||s);return o&&s&&g(e,r,s),s};const h=O("div",{position:"absolute",top:"100px",backgroundColor:"$panelBg",variants:{sticky:{true:{position:"absolute",top:0}}}}),R=c(({asset:t})=>n.jsx(h,{children:n.jsx("audio",{src:t.url,controls:!0,children:"Your browser does not support the audio element."})}));class l extends _{constructor(){super();p(this,"duration",0);p(this,"playing",!1);p(this,"audioName");p(this,"overridePreviewer",c(({asset:r})=>n.jsx(R,{asset:r})));f(this)}setViewAsset(r,o){}}v([d],l.prototype,"duration",2);v([d],l.prototype,"playing",2);var U=Object.defineProperty,C=Object.getOwnPropertyDescriptor,D=(t,e,r,o)=>{for(var s=o>1?void 0:o?C(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(s=(o?i(e,r,s):i(s))||s);return o&&s&&U(e,r,s),s};let u=class extends j{constructor(e){super(e);p(this,"urlObj")}async initByMain(e){this.urlObj=e;const r=URL.createObjectURL(e);try{const o=await this.engine.resourceManager.load({url:r,type:A.Audio});this.bindEngineObject(o)}finally{URL.revokeObjectURL(r)}}};u=D([w({type:"Audio",label:m("asset.audio.title"),loaderType:"Audio",importMenuConfig:{type:P.Upload,tooltip:"请上传音频文件(支持 OGG, WAV, MP3)",accept:".ogg,.wav,.mp3"},viewer:l,bundle({content:t}){return{content:t}}})],u);export{u as AudioAsset};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var b=Object.defineProperty;var d=(p,e,o)=>e in p?b(p,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):p[e]=o;var n=(p,e,o)=>(d(p,typeof e!="symbol"?e+"":e,o),o);import{E as f,p as r,C as a,s as u}from"./index-aec7e708.js";import"./index-e8a45e82.js";import{c}from"./Component-ed7aa0ab.js";import"./postmen-2f47f6bb.js";var P=Object.defineProperty,v=Object.getOwnPropertyDescriptor,i=(p,e,o,s)=>{for(var t=s>1?void 0:s?v(e,o):e,m=p.length-1,y;m>=0;m--)(y=p[m])&&(t=(s?y(e,o,t):y(t))||t);return s&&t&&P(e,o,t),t};let l=class extends f{constructor(e,o){super(e,o);n(this,"clip",null);n(this,"playOnEnabled",!0);n(this,"loop",!0);n(this,"volume",0);n(this,"mute",!1)}};i([r({label:"Audio resource",info:"Audio resource info",type:a.AssetPicker,assetType:"Audio",bindPath:"clip"}),u()],l.prototype,"clip",2);i([r({label:"playOnEnabled",info:"playOnEnabled info",type:a.Toggle,bindPath:"playOnEnabled"}),u()],l.prototype,"playOnEnabled",2);i([r({label:"IsLooping",info:"IsLooping info",type:a.Toggle,bindPath:"loop"}),u()],l.prototype,"loop",2);i([r({label:"Volume",info:"Volume info",type:a.Slider,min:0,max:1,bindPath:"volume"}),u()],l.prototype,"volume",2);i([r({label:"Mute",info:"Mute info",type:a.Toggle,bindPath:"mute"}),u()],l.prototype,"mute",2);l=i([c({type:"AudioSource",componentsMenu:{label:"component.audio.title"}})],l);export{l as AudioComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aO as o,aP as r}from"./index-aec7e708.js";const a=o(r,{borderRadius:"$2",fontSize:"$1",padding:"$1 $2",userSelect:"none",fontWeight:500,variants:{type:{info:{backgroundColor:"$blue3",color:"$blueA11"},warning:{backgroundColor:"$amber3",color:"$amber11"},error:{backgroundColor:"$red3",color:"$red11"},success:{backgroundColor:"$green3",color:"$green11"}}}});export{a as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _=Object.defineProperty;var q=(e,l,a)=>l in e?_(e,l,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[l]=a;var t=(e,l,a)=>(q(e,typeof l!="symbol"?l+"":l,a),a);import{L as m,a as f,E as k,V as L,b as w,d as P,D as C,c as x,A as O,M as A,C as s,s as o,p as i,t as g,e as b,l as R,g as S,f as M,h as E,r as D,S as F}from"./index-aec7e708.js";import"./index-e8a45e82.js";import{c as z}from"./Component-ed7aa0ab.js";var V=Object.defineProperty,j=Object.getOwnPropertyDescriptor,n=(e,l,a,p)=>{for(var c=p>1?void 0:p?j(l,a):l,u=e.length-1,h;u>=0;u--)(h=e[u])&&(c=(p?h(l,a,c):h(c))||c);return p&&c&&V(l,a,c),c};const d=[...Object.values(m),f.Nothing,f.Everything];class T extends F{constructor(){super(...arguments);t(this,"_originalMask");t(this,"_onEndRenderOnce",null)}onBeginRender(a){this._originalMask=a.cullingMask,a.cullingMask&=~(m.Viewport|m.Outline|m.NavigationGizmo|m.Gizmo)}onEndRender(a){if(a.cullingMask=this._originalMask,this._onEndRenderOnce){const p=this._onEndRenderOnce;this._onEndRenderOnce=null,p(a)}}executeAfterRender(a){this._onEndRenderOnce=a}}let r=class extends k{constructor(){super(...arguments);t(this,"_lastRTAsset",null);t(this,"isOrthographic",!1);t(this,"nearClipPlane",.1);t(this,"farClipPlane",100);t(this,"fieldOfView",45);t(this,"orthographicSize",10);t(this,"viewport",new L(0,0,1,1));t(this,"priority",0);t(this,"enableFrustumCulling",!0);t(this,"clearFlags",w.All);t(this,"cullingMask",P(f.Everything,d));t(this,"postProcessMask",P(f.Everything,d));t(this,"depthTextureMode",C.None);t(this,"opaqueTextureEnabled",!1);t(this,"opaqueTextureDownsampling",x.TwoX);t(this,"antiAliasing",O.None);t(this,"msaaSamples",A.FourX);t(this,"enableHDR",!1);t(this,"enablePostProcess",!0);t(this,"isAlphaOutputRequired",!1);t(this,"renderTarget",null)}onEnabled(){this.applyBoundPathChange("enabled",s.Toggle,!1)}onInitComplete(){if(this.engineObject.entity.addComponent(T),this.renderTarget){const l=this.root.assetStore.assets[this.renderTarget.refId];if(l){this._lastRTAsset=l;const a=this.engineObject.entity.getComponent(T);a&&a.executeAfterRender(()=>{var p;l.updateThumbnail(),(p=l.subAssets)==null||p.forEach(c=>c.updateThumbnail())})}}else this.applyBoundPathChange("enabled",s.Toggle,!1)}};n([o(),i({label:"camera.is-orthographic",bindPath:"isOrthographic"})],r.prototype,"isOrthographic",2);n([o(),i({label:"camera.near-clip-plane",bindPath:"nearClipPlane"})],r.prototype,"nearClipPlane",2);n([o(),i({label:"camera.far-clip-plane",bindPath:"farClipPlane"})],r.prototype,"farClipPlane",2);n([o(),i({label:"camera.field-of-view",bindPath:"fieldOfView",when:e=>!e.isOrthographic})],r.prototype,"fieldOfView",2);n([o(),i({label:"camera.orthographic-size",bindPath:"orthographicSize",when:e=>e.isOrthographic})],r.prototype,"orthographicSize",2);n([o(),i({type:s.Vector4,min:0,max:1,label:"camera.viewport.title",bindPath:"viewport"})],r.prototype,"viewport",2);n([o(),i({label:"camera.priority.title",bindPath:"priority"})],r.prototype,"priority",2);n([o(),i({label:"camera.enable-frustum-culling",bindPath:"enableFrustumCulling"})],r.prototype,"enableFrustumCulling",2);n([o(),i({label:"camera.clear-flags.title",bindPath:"clearFlags",type:s.Select,options:g(w,void 0,e=>b(`camera.clear-flags.${e.toLocaleLowerCase()}`))})],r.prototype,"clearFlags",2);n([o(R(d)),i({label:"camera.culling-mask",bindPath:"cullingMask",type:s.Select,...S(d)}),M(E(d))],r.prototype,"cullingMask",2);n([o(R(d)),i({label:"camera.post-process-mask",bindPath:"postProcessMask",type:s.Select,...S(d)}),M(E(d))],r.prototype,"postProcessMask",2);n([o(),i({label:"camera.depth-texture-mode.title",info:"camera.depth-texture-mode.info",bindPath:"depthTextureMode",type:s.Select,options:g(C,void 0,e=>b(`camera.depth-texture-mode.${e.toLowerCase()}`))})],r.prototype,"depthTextureMode",2);n([o(),i({label:"camera.opaque-texture-enabled.title",info:"camera.opaque-texture-enabled.info",bindPath:"opaqueTextureEnabled",type:s.Toggle})],r.prototype,"opaqueTextureEnabled",2);n([o(),i({label:"camera.opaque-texture-down-sampling.title",info:"camera.opaque-texture-down-sampling.info",bindPath:"opaqueTextureDownsampling",type:s.Select,options:g(x,void 0,e=>b(`camera.opaque-texture-down-sampling.${e.toLowerCase()}`)),when:e=>e.opaqueTextureEnabled})],r.prototype,"opaqueTextureDownsampling",2);n([o(),i({label:"camera.anti-aliasing.title",info:"camera.anti-aliasing.info",bindPath:"antiAliasing",type:s.Select,options:g(O,void 0,e=>b(`camera.anti-aliasing.${e.toLowerCase()}`))})],r.prototype,"antiAliasing",2);n([o(),i({label:"camera.msaa-samples.title",info:"camera.msaa-samples.info",bindPath:"msaaSamples",type:s.Select,options:g(A,void 0,e=>b(`camera.msaa-samples.${e.toLowerCase()}`))})],r.prototype,"msaaSamples",2);n([o(),i({label:"camera.enable-hdr.title",info:"camera.enable-hdr.info",bindPath:"enableHDR",type:s.Toggle})],r.prototype,"enableHDR",2);n([o(),i({label:"camera.enable-post-process.title",info:"camera.enable-post-process.info",bindPath:"enablePostProcess",type:s.Toggle})],r.prototype,"enablePostProcess",2);n([o(),i({label:"camera.is-alpha-output-required.title",info:"camera.is-alpha-output-required.info",bindPath:"isAlphaOutputRequired",type:s.Toggle})],r.prototype,"isAlphaOutputRequired",2);n([i({label:"camera.render-target.title",type:s.AssetPicker,assetType:"RenderTarget",onChange:async(e,l,a)=>{var h;const p=e._lastRTAsset;p&&!a&&D(()=>{var y;p.thumbnailUrl="",(y=p.subAssets)==null||y.forEach(v=>{v.thumbnailUrl=""})}),e._lastRTAsset=a??null,e.renderTarget=a?a.getCurrentRef():null,await e.applyBoundPathChange("renderTarget",s.AssetPicker,e.renderTarget);const c=e.root.projectStore.currentViewport.previewManager;c.hasUserRT=!!a;const u=e.engineObject;a?(u.enabled=!0,a.updateThumbnail(),(h=a.subAssets)==null||h.forEach(y=>y.updateThumbnail())):c.isPreviewOn||(u.enabled=!1)}}),o()],r.prototype,"renderTarget",2);r=n([z({type:"Camera",componentsMenu:{label:"component.camera.title"}})],r);export{r as CameraComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as r}from"./index-aec7e708.js";function a(e){return function(n){e.class=n,e.componentsMenu={label:e.type,...e.componentsMenu},e.refMap=new Set,e.external=e.external??!1,r.registerComponent(e.type,e)}}export{a as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var m=Object.defineProperty;var y=(e,a,o)=>a in e?m(e,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[a]=o;var r=(e,a,o)=>(y(e,typeof a!="symbol"?a+"":a,o),o);import{i as f,e as g,p,C as i,t as b,s as l,v as c}from"./index-aec7e708.js";import"./index-e8a45e82.js";import{c as P}from"./Component-ed7aa0ab.js";import{L as N}from"./LightBaseComponent-12dc27d1.js";var u=Object.defineProperty,S=Object.getOwnPropertyDescriptor,h=(e,a,o,n)=>{for(var t=n>1?void 0:n?S(a,o):a,d=e.length-1,w;d>=0;d--)(w=e[d])&&(t=(n?w(a,o,t):w(t))||t);return n&&t&&u(a,o,t),t};let s=class extends N{constructor(a,o){super(a,o);r(this,"shadowType",f.None);r(this,"shadowBias",1);r(this,"shadowNormalBias",1);r(this,"shadowNearPlaneOffset",.1);r(this,"shadowStrength",1);this.formSchema.addGroup(g("light.shadow.title"),["shadowType","shadowBias","shadowNormalBias","shadowNearPlaneOffset","shadowStrength"],{collapsible:!1})}};h([p({type:i.Select,options:b(f,void 0,e=>g(`light.shadow.type.${e.toLowerCase()}`)),bindPath:"shadowType",property:"shadowType",label:"light.shadow.type.label",info:"light.shadow.type.info"}),l(),c()],s.prototype,"shadowType",2);h([p({type:i.Number,bindPath:"shadowBias",property:"shadowBias",dragStep:.01,label:"light.shadow.bias.label",info:"light.shadow.bias.info"}),l()],s.prototype,"shadowBias",2);h([p({type:i.Number,bindPath:"shadowNormalBias",property:"shadowNormalBias",dragStep:.01,label:"light.shadow.normal-bias.label",info:"light.shadow.normal-bias.info"}),l()],s.prototype,"shadowNormalBias",2);h([p({type:i.Number,bindPath:"shadowNearPlaneOffset",property:"shadowNearPlaneOffset",dragStep:.01,label:"light.shadow.near-plane-offset.label",info:"light.shadow.near-plane-offset.info"}),l()],s.prototype,"shadowNearPlaneOffset",2);h([p({type:i.Slider,bindPath:"shadowStrength",property:"shadowStrength",min:0,max:1,dragStep:.01,label:"light.shadow.strength.label",info:"light.shadow.strength.info"}),l()],s.prototype,"shadowStrength",2);s=h([P({type:"DirectLight",componentsMenu:{group:"light",label:"component.light.direct.title"}})],s);export{s as DirectLightComponent};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var d=Object.defineProperty;var u=(s,e,t)=>e in s?d(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var a=(s,e,t)=>(u(s,typeof e!="symbol"?e+"":e,t),t);import{c7 as m,cc as y,cd as h,ce as b,by as w,aQ as v,aS as x,c8 as j,a1 as f,j as F,a7 as O,n as U,e as A,o as R}from"./index-aec7e708.js";import"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";import{A as g}from"./AssetViewer-64cd01fa.js";async function C(s){const e={uploadFiles:[],errors:[]};for(const t in s){const n=s[t],r=n.name.toLocaleLowerCase();(r.endsWith(".ttf")||r.endsWith(".otf")||r.endsWith(".woff"))&&e.uploadFiles.push({main:n})}return e}async function L(s){const e=m(s.main,"font.ttf");try{const t=e.name,n=y(t),r=h(t,n),o=await b.uploadBlob(`${t}.json`,e),i={fontName:r,fontUrl:encodeURI(o.url).replace(/\(/g,"%28").replace(/\)/g,"%29")};return new File([JSON.stringify(i)],r)}catch(t){console.error(t),w.error(`parse font file fail ${t}`)}return e}class p extends g{constructor(){super()}setViewAsset(e,t){const n=t.createChild("font_entity"),r=n.addComponent(f);r.font=e.engineObject,r.text=`ABCDEFGHIJKLM
|
|
2
|
+
NOPQRSTUVWXYZ
|
|
3
|
+
abcdefghijklm
|
|
4
|
+
nopqrstuvwxyz
|
|
5
|
+
1234567890`,this._entity=n}}const P=v(({asset:s})=>x.jsx(j,{asset:s}));p.previewer=P;class c{static update(e,t){this.entity?this.entity.isActive=!0:this.initScene(e),this.textRenderer.font=t.engineObject}static clear(){this.entity.isActive=!1}static initScene(e){const t=this.entity=e.createChild("font"),n=this.textRenderer=t.addComponent(f);n.text="Aa",n.fontSize=60}}a(c,"entity"),a(c,"textRenderer");var _=Object.defineProperty,S=Object.getOwnPropertyDescriptor,T=(s,e,t,n)=>{for(var r=n>1?void 0:n?S(e,t):e,o=s.length-1,i;o>=0;o--)(i=s[o])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&_(e,t,r),r};let l=class extends F{constructor(e){super(e);a(this,"urlObj")}async initByMain(e){this.urlObj=e;const t=URL.createObjectURL(e),n=await this.engine.resourceManager.load({url:t,type:O.Font});URL.revokeObjectURL(t),this.bindEngineObject(n)}};l=T([U({type:"Font",label:A("asset.font.title"),loaderType:"Font",extname:"font",viewer:p,thumbnail:c,importMenuConfig:{type:R.Upload,tooltip:"请上传字体文件(支持 TTF, OTF, WOFF)",accept:".ttf,.otf,.woff"},filterUploadFiles:C,preUpload:L})],l);export{l as FontAsset};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{aH as x,aO as h,aX as m,b3 as v,aC as e,aD as f,aE as b,aP as i,b4 as j,aT as l}from"./index-aec7e708.js";import{A as I,a as g}from"./Accordion-3d330bc6.js";import{I as y}from"./IconEdit-ab77303f.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 A=x("outline","trash","IconTrash",[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]]);const k=h(m,{width:"100%",border:"none",position:"relative",borderRadius:0,"& > svg":{marginRight:"$1"},"&::after":{content:"''",position:"absolute",top:0,left:0,width:"100%",borderTop:"1px solid $grayA2"}});function D(r){const{renameable:n,onDelete:s,removable:o}=r;return e.jsxs(i,{align:"v",css:{flex:1,justifyContent:"space-between"},children:[e.jsx("span",{children:r.title}),e.jsxs(i,{gap:"xxs",children:[n&&e.jsx(l,{as:"div",variant:"subtle","aria-hidden":!0,tabIndex:-1,size:"xs",onClick:t=>{t.preventDefault(),t.stopPropagation(),s&&s()},children:e.jsx(y,{size:"14px"})}),o&&e.jsx(l,{as:"div",variant:"subtle","aria-hidden":!0,tabIndex:-1,size:"xs",onClick:t=>{t.preventDefault(),t.stopPropagation(),s&&s()},children:e.jsx(A,{size:"14px"})})]})]})}function T(r){const{items:n=[],onAdd:s,onDelete:o,addItemText:t="Add Item",defaultValue:d,addable:c=!1}=r,u=a=>()=>{o&&o(a)},p=v.useMemo(()=>n.length?n.map(a=>`${a.id}`):[],[n]);return e.jsx(f,{...b(r),direction:"column",children:e.jsxs(I,{type:"multiple",defaultValue:d??p,children:[n.map(a=>e.jsx(g,{value:`${a.id}`,title:e.jsx(D,{title:a.name,onDelete:u(a),removable:a.removable,renameable:a.renameable}),arrow:!!a.children,children:a.children&&e.jsx(i,{direction:"column",children:a.children})},a.id)),c&&e.jsxs(k,{size:"sm",variant:"soft",onClick:s,children:[e.jsx(j,{size:"12px"})," ",t]})]})})}export{T as F};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var Lt=Object.defineProperty;var $t=(e,t,s)=>t in e?Lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var w=(e,t,s)=>($t(e,typeof t!="symbol"?t+"":t,s),s);import{eN as Ut,aO as Vt,aQ as ht,aS as I,bN as Ft,q as gt,aR as Dt,aV as $e,aD as te,e5 as be,dQ as se,bM as Ue,aU as qt,dZ as Ve,c7 as Bt,u as pt,S as Gt,x as R,aL as G,br as Wt,eO as Ht,by as Fe,e as dt,_ as Xt,cF as Qt,eP as De,a7 as Kt,O as qe,v as Jt,a$ as W,b0 as Yt,n as Zt,o as es,dr as ts}from"./index-aec7e708.js";import{B as N,P,a as v,A as Ie,b as Pe,K as mt,N as ss,M as U,E as ie,D as ze,u as ve,R as me,S as ns,T as Me,c as yt,d as bt,e as vt,C as rs,f as as,g as is,G as Ae,h as Be,F as os,i as _e}from"./glTFIO-79bbca27.js";import{a as le}from"./meshopt_simplifier.module-cd99529d.js";import{u as At,I as ls}from"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";import{A as cs}from"./AssetViewer-64cd01fa.js";import{M as fs}from"./MaterialAsset-6ef9b4ed.js";import{k as us}from"./ktx2-encoder-53b21bdc.js";function Ge(e){const t=e%4;return t===0?e:e+(4-t)}function hs(e){return e.toLowerCase().endsWith(".png")?"image/png":e.toLowerCase().endsWith(".jpg")||e.toLowerCase().endsWith(".jpeg")?"image/jpeg":e.toLowerCase().endsWith(".webp")?"image/webp":"application/octet-stream"}function _t(e){const{json:t,resources:s}=e,n=new Uint32Array([1179937895,2,12]),r=JSON.stringify(t),a=N.pad(N.encodeText(r),32),i=N.toView(new Uint32Array([a.byteLength,1313821514])),l=N.concat([i,a]);n[n.length-1]+=l.byteLength;const o=Object.values(s)[0];if(!o||!o.byteLength)return N.concat([N.toView(n),l]);const u=N.pad(o,0),c=N.toView(new Uint32Array([u.byteLength,5130562])),h=N.concat([c,u]);return n[n.length-1]+=h.byteLength,N.concat([N.toView(n),l,h])}function gs(e){const t=e.json,s=[],n=[];let r=0;function a(h){return h.uri===void 0?void 0:e.resources[h.uri]}const i=t.buffers??[],l=new Map;i.forEach((h,f)=>{const g=a(h);g!==void 0&&(s.push(new Uint8Array(g)),n.push(r),delete h.uri,h.byteLength=g.byteLength,l.set(f,r),r+=Ge(g.byteLength))});let o=i.length;(t.images||[]).forEach(h=>{const f=a(h);if(!f){delete h.uri;return}const g={buffer:0,byteOffset:r,byteLength:f.byteLength};l.set(o++,r),r+=Ge(f.byteLength);const p=t.bufferViews??[];h.bufferView=p.length,h.mimeType=hs(h.uri),delete h.uri,p.push(g),s.push(new Uint8Array(f)),n.push(g.byteOffset)});for(const h of t.bufferViews??[])h.byteOffset=(h.byteOffset??0)+(l.get(h.buffer)??0),h.buffer=0;const c=new Uint8Array(r);return s.forEach((h,f)=>{c.set(h,n[f])}),t.buffers=[{byteLength:r}],_t({json:t,resources:{"buffer.bin":c}})}function ps(e){for(var t=new Array(e),s=0;s<e;++s)t[s]=s;return t}var ds=ps;/*!
|
|
2
|
+
* Determine if an object is a Buffer
|
|
3
|
+
*
|
|
4
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/var ms=function(e){return e!=null&&(Tt(e)||ys(e)||!!e._isBuffer)};function Tt(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function ys(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&Tt(e.slice(0,0))}var bs=ds,vs=ms,As=typeof Float64Array<"u";function _s(e,t){return e[0]-t[0]}function Ts(){var e=this.stride,t=new Array(e.length),s;for(s=0;s<t.length;++s)t[s]=[Math.abs(e[s]),s];t.sort(_s);var n=new Array(t.length);for(s=0;s<n.length;++s)n[s]=t[s][1];return n}function Es(e,t){var s=["View",t,"d",e].join("");t<0&&(s="View_Nil"+e);var n=e==="generic";if(t===-1){var r="function "+s+"(a){this.data=a;};var proto="+s+".prototype;proto.dtype='"+e+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+s+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+s+"(a){return new "+s+"(a);}",m=new Function(r);return m()}else if(t===0){var r="function "+s+"(a,d) {this.data = a;this.offset = d};var proto="+s+".prototype;proto.dtype='"+e+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+s+"_copy() {return new "+s+"(this.data,this.offset)};proto.pick=function "+s+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+s+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+s+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+s+"(a,b,c,d){return new "+s+"(a,d)}",m=new Function("TrivialArray",r);return m(ce[e][0])}var r=["'use strict'"],a=bs(t),i=a.map(function(d){return"i"+d}),l="this.offset+"+a.map(function(d){return"this.stride["+d+"]*i"+d}).join("+"),o=a.map(function(d){return"b"+d}).join(","),u=a.map(function(d){return"c"+d}).join(",");r.push("function "+s+"(a,"+o+","+u+",d){this.data=a","this.shape=["+o+"]","this.stride=["+u+"]","this.offset=d|0}","var proto="+s+".prototype","proto.dtype='"+e+"'","proto.dimension="+t),r.push("Object.defineProperty(proto,'size',{get:function "+s+"_size(){return "+a.map(function(d){return"this.shape["+d+"]"}).join("*"),"}})"),t===1?r.push("proto.order=[0]"):(r.push("Object.defineProperty(proto,'order',{get:"),t<4?(r.push("function "+s+"_order(){"),t===2?r.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):t===3&&r.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):r.push("ORDER})")),r.push("proto.set=function "+s+"_set("+i.join(",")+",v){"),n?r.push("return this.data.set("+l+",v)}"):r.push("return this.data["+l+"]=v}"),r.push("proto.get=function "+s+"_get("+i.join(",")+"){"),n?r.push("return this.data.get("+l+")}"):r.push("return this.data["+l+"]}"),r.push("proto.index=function "+s+"_index(",i.join(),"){return "+l+"}"),r.push("proto.hi=function "+s+"_hi("+i.join(",")+"){return new "+s+"(this.data,"+a.map(function(d){return["(typeof i",d,"!=='number'||i",d,"<0)?this.shape[",d,"]:i",d,"|0"].join("")}).join(",")+","+a.map(function(d){return"this.stride["+d+"]"}).join(",")+",this.offset)}");var c=a.map(function(d){return"a"+d+"=this.shape["+d+"]"}),h=a.map(function(d){return"c"+d+"=this.stride["+d+"]"});r.push("proto.lo=function "+s+"_lo("+i.join(",")+"){var b=this.offset,d=0,"+c.join(",")+","+h.join(","));for(var f=0;f<t;++f)r.push("if(typeof i"+f+"==='number'&&i"+f+">=0){d=i"+f+"|0;b+=c"+f+"*d;a"+f+"-=d}");r.push("return new "+s+"(this.data,"+a.map(function(d){return"a"+d}).join(",")+","+a.map(function(d){return"c"+d}).join(",")+",b)}"),r.push("proto.step=function "+s+"_step("+i.join(",")+"){var "+a.map(function(d){return"a"+d+"=this.shape["+d+"]"}).join(",")+","+a.map(function(d){return"b"+d+"=this.stride["+d+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var f=0;f<t;++f)r.push("if(typeof i"+f+"==='number'){d=i"+f+"|0;if(d<0){c+=b"+f+"*(a"+f+"-1);a"+f+"=ceil(-a"+f+"/d)}else{a"+f+"=ceil(a"+f+"/d)}b"+f+"*=d}");r.push("return new "+s+"(this.data,"+a.map(function(d){return"a"+d}).join(",")+","+a.map(function(d){return"b"+d}).join(",")+",c)}");for(var g=new Array(t),p=new Array(t),f=0;f<t;++f)g[f]="a[i"+f+"]",p[f]="b[i"+f+"]";r.push("proto.transpose=function "+s+"_transpose("+i+"){"+i.map(function(d,y){return d+"=("+d+"===undefined?"+y+":"+d+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+s+"(this.data,"+g.join(",")+","+p.join(",")+",this.offset)}"),r.push("proto.pick=function "+s+"_pick("+i+"){var a=[],b=[],c=this.offset");for(var f=0;f<t;++f)r.push("if(typeof i"+f+"==='number'&&i"+f+">=0){c=(c+this.stride["+f+"]*i"+f+")|0}else{a.push(this.shape["+f+"]);b.push(this.stride["+f+"])}");r.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),r.push("return function construct_"+s+"(data,shape,stride,offset){return new "+s+"(data,"+a.map(function(d){return"shape["+d+"]"}).join(",")+","+a.map(function(d){return"stride["+d+"]"}).join(",")+",offset)}");var m=new Function("CTOR_LIST","ORDER",r.join(`
|
|
7
|
+
`));return m(ce[e],Ts)}function ws(e){if(vs(e))return"buffer";if(As)switch(Object.prototype.toString.call(e)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(e)?"array":"generic"}var ce={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};function Is(e,t,s,n){if(e===void 0){var u=ce.array[0];return u([])}else typeof e=="number"&&(e=[e]);t===void 0&&(t=[e.length]);var r=t.length;if(s===void 0){s=new Array(r);for(var a=r-1,i=1;a>=0;--a)s[a]=i,i*=t[a]}if(n===void 0){n=0;for(var a=0;a<r;++a)s[a]<0&&(n-=(t[a]-1)*s[a])}for(var l=ws(e),o=ce[l];o.length<=r+1;)o.push(Es(l,o.length-1));var u=o[r+1];return u(e,t,s,n)}var Ms=Is;const Ns=Ut(Ms);var Cs={};function Ss(e,t){for(var s=1,n=e.length,r=e[0],a=e[0],i=1;i<n;++i)if(a=r,r=e[i],t(r,a)){if(i===s){s++;continue}e[s++]=r}return e.length=s,e}function Os(e){for(var t=1,s=e.length,n=e[0],r=e[0],a=1;a<s;++a,r=n)if(r=n,n=e[a],n!==r){if(a===t){t++;continue}e[t++]=n}return e.length=t,e}function xs(e,t,s){return e.length===0?e:t?(s||e.sort(t),Ss(e,t)):(s||e.sort(),Os(e))}var Rs=xs,js=Rs;function Et(e,t,s){var n=e.length,r=t.arrayArgs.length,a=t.indexArgs.length>0,i=[],l=[],o=0,u=0,c,h;for(c=0;c<n;++c)l.push(["i",c,"=0"].join(""));for(h=0;h<r;++h)for(c=0;c<n;++c)u=o,o=e[c],c===0?l.push(["d",h,"s",c,"=t",h,"p",o].join("")):l.push(["d",h,"s",c,"=(t",h,"p",o,"-s",u,"*t",h,"p",u,")"].join(""));for(l.length>0&&i.push("var "+l.join(",")),c=n-1;c>=0;--c)o=e[c],i.push(["for(i",c,"=0;i",c,"<s",o,";++i",c,"){"].join(""));for(i.push(s),c=0;c<n;++c){for(u=o,o=e[c],h=0;h<r;++h)i.push(["p",h,"+=d",h,"s",c].join(""));a&&(c>0&&i.push(["index[",u,"]-=s",u].join("")),i.push(["++index[",o,"]"].join(""))),i.push("}")}return i.join(`
|
|
8
|
+
`)}function Ps(e,t,s,n){for(var r=t.length,a=s.arrayArgs.length,i=s.blockSize,l=s.indexArgs.length>0,o=[],u=0;u<a;++u)o.push(["var offset",u,"=p",u].join(""));for(var u=e;u<r;++u)o.push(["for(var j"+u+"=SS[",t[u],"]|0;j",u,">0;){"].join("")),o.push(["if(j",u,"<",i,"){"].join("")),o.push(["s",t[u],"=j",u].join("")),o.push(["j",u,"=0"].join("")),o.push(["}else{s",t[u],"=",i].join("")),o.push(["j",u,"-=",i,"}"].join("")),l&&o.push(["index[",t[u],"]=j",u].join(""));for(var u=0;u<a;++u){for(var c=["offset"+u],h=e;h<r;++h)c.push(["j",h,"*t",u,"p",t[h]].join(""));o.push(["p",u,"=(",c.join("+"),")"].join(""))}o.push(Et(t,s,n));for(var u=e;u<r;++u)o.push("}");return o.join(`
|
|
9
|
+
`)}function zs(e){for(var t=0,s=e[0].length;t<s;){for(var n=1;n<e.length;++n)if(e[n][t]!==e[0][t])return t;++t}return t}function Te(e,t,s){for(var n=e.body,r=[],a=[],i=0;i<e.args.length;++i){var l=e.args[i];if(!(l.count<=0)){var o=new RegExp(l.name,"g"),u="",c=t.arrayArgs.indexOf(i);switch(t.argTypes[i]){case"offset":var h=t.offsetArgIndex.indexOf(i),f=t.offsetArgs[h];c=f.array,u="+q"+h;case"array":u="p"+c+u;var g="l"+i,p="a"+c;if(t.arrayBlockIndices[c]===0)l.count===1?s[c]==="generic"?l.lvalue?(r.push(["var ",g,"=",p,".get(",u,")"].join("")),n=n.replace(o,g),a.push([p,".set(",u,",",g,")"].join(""))):n=n.replace(o,[p,".get(",u,")"].join("")):n=n.replace(o,[p,"[",u,"]"].join("")):s[c]==="generic"?(r.push(["var ",g,"=",p,".get(",u,")"].join("")),n=n.replace(o,g),l.lvalue&&a.push([p,".set(",u,",",g,")"].join(""))):(r.push(["var ",g,"=",p,"[",u,"]"].join("")),n=n.replace(o,g),l.lvalue&&a.push([p,"[",u,"]=",g].join("")));else{for(var m=[l.name],d=[u],y=0;y<Math.abs(t.arrayBlockIndices[c]);y++)m.push("\\s*\\[([^\\]]+)\\]"),d.push("$"+(y+1)+"*t"+c+"b"+y);if(o=new RegExp(m.join(""),"g"),u=d.join("+"),s[c]==="generic")throw new Error("cwise: Generic arrays not supported in combination with blocks!");n=n.replace(o,[p,"[",u,"]"].join(""))}break;case"scalar":n=n.replace(o,"Y"+t.scalarArgs.indexOf(i));break;case"index":n=n.replace(o,"index");break;case"shape":n=n.replace(o,"shape");break}}}return[r.join(`
|
|
10
|
+
`),n,a.join(`
|
|
11
|
+
`)].join(`
|
|
12
|
+
`).trim()}function ks(e){for(var t=new Array(e.length),s=!0,n=0;n<e.length;++n){var r=e[n],a=r.match(/\d+/);a?a=a[0]:a="",r.charAt(0)===0?t[n]="u"+r.charAt(1)+a:t[n]=r.charAt(0)+a,n>0&&(s=s&&t[n]===t[n-1])}return s?t[0]:t.join("")}function Ls(e,t){for(var s=t[1].length-Math.abs(e.arrayBlockIndices[0])|0,n=new Array(e.arrayArgs.length),r=new Array(e.arrayArgs.length),a=0;a<e.arrayArgs.length;++a)r[a]=t[2*a],n[a]=t[2*a+1];for(var i=[],l=[],o=[],u=[],c=[],a=0;a<e.arrayArgs.length;++a){e.arrayBlockIndices[a]<0?(o.push(0),u.push(s),i.push(s),l.push(s+e.arrayBlockIndices[a])):(o.push(e.arrayBlockIndices[a]),u.push(e.arrayBlockIndices[a]+s),i.push(0),l.push(e.arrayBlockIndices[a]));for(var h=[],f=0;f<n[a].length;f++)o[a]<=n[a][f]&&n[a][f]<u[a]&&h.push(n[a][f]-o[a]);c.push(h)}for(var g=["SS"],p=["'use strict'"],m=[],f=0;f<s;++f)m.push(["s",f,"=SS[",f,"]"].join(""));for(var a=0;a<e.arrayArgs.length;++a){g.push("a"+a),g.push("t"+a),g.push("p"+a);for(var f=0;f<s;++f)m.push(["t",a,"p",f,"=t",a,"[",o[a]+f,"]"].join(""));for(var f=0;f<Math.abs(e.arrayBlockIndices[a]);++f)m.push(["t",a,"b",f,"=t",a,"[",i[a]+f,"]"].join(""))}for(var a=0;a<e.scalarArgs.length;++a)g.push("Y"+a);if(e.shapeArgs.length>0&&m.push("shape=SS.slice(0)"),e.indexArgs.length>0){for(var d=new Array(s),a=0;a<s;++a)d[a]="0";m.push(["index=[",d.join(","),"]"].join(""))}for(var a=0;a<e.offsetArgs.length;++a){for(var y=e.offsetArgs[a],T=[],f=0;f<y.offset.length;++f)y.offset[f]!==0&&(y.offset[f]===1?T.push(["t",y.array,"p",f].join("")):T.push([y.offset[f],"*t",y.array,"p",f].join("")));T.length===0?m.push("q"+a+"=0"):m.push(["q",a,"=",T.join("+")].join(""))}var A=js([].concat(e.pre.thisVars).concat(e.body.thisVars).concat(e.post.thisVars));m=m.concat(A),m.length>0&&p.push("var "+m.join(","));for(var a=0;a<e.arrayArgs.length;++a)p.push("p"+a+"|=0");e.pre.body.length>3&&p.push(Te(e.pre,e,r));var b=Te(e.body,e,r),_=zs(c);_<s?p.push(Ps(_,c[0],e,b)):p.push(Et(c[0],e,b)),e.post.body.length>3&&p.push(Te(e.post,e,r)),e.debug&&console.log("-----Generated cwise routine for ",t,`:
|
|
13
|
+
`+p.join(`
|
|
14
|
+
`)+`
|
|
15
|
+
----------`);var E=[e.funcName||"unnamed","_cwise_loop_",n[0].join("s"),"m",_,ks(r)].join(""),x=new Function(["function ",E,"(",g.join(","),"){",p.join(`
|
|
16
|
+
`),"} return ",E].join(""));return x()}var $s=Ls,Us=$s;function Vs(e){var t=["'use strict'","var CACHED={}"],s=[],n=e.funcName+"_cwise_thunk";t.push(["return function ",n,"(",e.shimArgs.join(","),"){"].join(""));for(var r=[],a=[],i=[["array",e.arrayArgs[0],".shape.slice(",Math.max(0,e.arrayBlockIndices[0]),e.arrayBlockIndices[0]<0?","+e.arrayBlockIndices[0]+")":")"].join("")],l=[],o=[],u=0;u<e.arrayArgs.length;++u){var c=e.arrayArgs[u];s.push(["t",c,"=array",c,".dtype,","r",c,"=array",c,".order"].join("")),r.push("t"+c),r.push("r"+c),a.push("t"+c),a.push("r"+c+".join()"),i.push("array"+c+".data"),i.push("array"+c+".stride"),i.push("array"+c+".offset|0"),u>0&&(l.push("array"+e.arrayArgs[0]+".shape.length===array"+c+".shape.length+"+(Math.abs(e.arrayBlockIndices[0])-Math.abs(e.arrayBlockIndices[u]))),o.push("array"+e.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[0])+"]===array"+c+".shape[shapeIndex+"+Math.max(0,e.arrayBlockIndices[u])+"]"))}e.arrayArgs.length>1&&(t.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),t.push("for(var shapeIndex=array"+e.arrayArgs[0]+".shape.length-"+Math.abs(e.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),t.push("if (!("+o.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),t.push("}"));for(var u=0;u<e.scalarArgs.length;++u)i.push("scalar"+e.scalarArgs[u]);s.push(["type=[",a.join(","),"].join()"].join("")),s.push("proc=CACHED[type]"),t.push("var "+s.join(",")),t.push(["if(!proc){","CACHED[type]=proc=compile([",r.join(","),"])}","return proc(",i.join(","),")}"].join("")),e.debug&&console.log(`-----Generated thunk:
|
|
17
|
+
`+t.join(`
|
|
18
|
+
`)+`
|
|
19
|
+
----------`);var h=new Function("compile",t.join(`
|
|
20
|
+
`));return h(Us.bind(void 0,e))}var Fs=Vs,Ds=Fs;function qs(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function Bs(e){var t=new qs;t.pre=e.pre,t.body=e.body,t.post=e.post;var s=e.args.slice(0);t.argTypes=s;for(var n=0;n<s.length;++n){var r=s[n];if(r==="array"||typeof r=="object"&&r.blockIndices){if(t.argTypes[n]="array",t.arrayArgs.push(n),t.arrayBlockIndices.push(r.blockIndices?r.blockIndices:0),t.shimArgs.push("array"+n),n<t.pre.args.length&&t.pre.args[n].count>0)throw new Error("cwise: pre() block may not reference array args");if(n<t.post.args.length&&t.post.args[n].count>0)throw new Error("cwise: post() block may not reference array args")}else if(r==="scalar")t.scalarArgs.push(n),t.shimArgs.push("scalar"+n);else if(r==="index"){if(t.indexArgs.push(n),n<t.pre.args.length&&t.pre.args[n].count>0)throw new Error("cwise: pre() block may not reference array index");if(n<t.body.args.length&&t.body.args[n].lvalue)throw new Error("cwise: body() block may not write to array index");if(n<t.post.args.length&&t.post.args[n].count>0)throw new Error("cwise: post() block may not reference array index")}else if(r==="shape"){if(t.shapeArgs.push(n),n<t.pre.args.length&&t.pre.args[n].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(n<t.body.args.length&&t.body.args[n].lvalue)throw new Error("cwise: body() block may not write to array shape");if(n<t.post.args.length&&t.post.args[n].lvalue)throw new Error("cwise: post() block may not write to array shape")}else if(typeof r=="object"&&r.offset)t.argTypes[n]="offset",t.offsetArgs.push({array:r.array,offset:r.offset}),t.offsetArgIndex.push(n);else throw new Error("cwise: Unknown argument type "+s[n])}if(t.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(t.pre.args.length>s.length)throw new Error("cwise: Too many arguments in pre() block");if(t.body.args.length>s.length)throw new Error("cwise: Too many arguments in body() block");if(t.post.args.length>s.length)throw new Error("cwise: Too many arguments in post() block");return t.debug=!!e.printCode||!!e.debug,t.funcName=e.funcName||"cwise",t.blockSize=e.blockSize||64,Ds(t)}var Gs=Bs;(function(e){var t=Gs,s={body:"",args:[],thisVars:[],localVars:[]};function n(f){if(!f)return s;for(var g=0;g<f.args.length;++g){var p=f.args[g];g===0?f.args[g]={name:p,lvalue:!0,rvalue:!!f.rvalue,count:f.count||1}:f.args[g]={name:p,lvalue:!1,rvalue:!0,count:1}}return f.thisVars||(f.thisVars=[]),f.localVars||(f.localVars=[]),f}function r(f){return t({args:f.args,pre:n(f.pre),body:n(f.body),post:n(f.proc),funcName:f.funcName})}function a(f){for(var g=[],p=0;p<f.args.length;++p)g.push("a"+p);var m=new Function("P",["return function ",f.funcName,"_ndarrayops(",g.join(","),") {P(",g.join(","),");return a0}"].join(""));return m(r(f))}var i={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};(function(){for(var f in i){var g=i[f];e[f]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+g+"c"},funcName:f}),e[f+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a"+g+"=b"},rvalue:!0,funcName:f+"eq"}),e[f+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+g+"s"},funcName:f+"s"}),e[f+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a"+g+"=s"},rvalue:!0,funcName:f+"seq"})}})();var l={not:"!",bnot:"~",neg:"-",recip:"1.0/"};(function(){for(var f in l){var g=l[f];e[f]=a({args:["array","array"],body:{args:["a","b"],body:"a="+g+"b"},funcName:f}),e[f+"eq"]=a({args:["array"],body:{args:["a"],body:"a="+g+"a"},rvalue:!0,count:2,funcName:f+"eq"})}})();var o={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};(function(){for(var f in o){var g=o[f];e[f]=a({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+g+"c"},funcName:f}),e[f+"s"]=a({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+g+"s"},funcName:f+"s"}),e[f+"eq"]=a({args:["array","array"],body:{args:["a","b"],body:"a=a"+g+"b"},rvalue:!0,count:2,funcName:f+"eq"}),e[f+"seq"]=a({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+g+"s"},rvalue:!0,count:2,funcName:f+"seq"})}})();var u=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];(function(){for(var f=0;f<u.length;++f){var g=u[f];e[g]=a({args:["array","array"],pre:{args:[],body:"this_f=Math."+g,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:g}),e[g+"eq"]=a({args:["array"],pre:{args:[],body:"this_f=Math."+g,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:g+"eq"})}})();var c=["max","min","atan2","pow"];(function(){for(var f=0;f<c.length;++f){var g=c[f];e[g]=a({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+g,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:g}),e[g+"s"]=a({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+g,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:g+"s"}),e[g+"eq"]=a({args:["array","array"],pre:{args:[],body:"this_f=Math."+g,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:g+"eq"}),e[g+"seq"]=a({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+g,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:g+"seq"})}})();var h=["atan2","pow"];(function(){for(var f=0;f<h.length;++f){var g=h[f];e[g+"op"]=a({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+g,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:g+"op"}),e[g+"ops"]=a({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+g,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:g+"ops"}),e[g+"opeq"]=a({args:["array","array"],pre:{args:[],body:"this_f=Math."+g,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:g+"opeq"}),e[g+"opseq"]=a({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+g,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:g+"opseq"})}})(),e.any=t({args:["array"],pre:s,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"}),e.all=t({args:["array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"}),e.sum=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"}),e.prod=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"}),e.norm2squared=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"}),e.norm2=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"}),e.norminf=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),e.norm1=t({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),e.sup=t({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),e.inf=t({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),e.argmin=t({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),e.argmax=t({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),e.random=a({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),e.assign=a({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),e.assigns=a({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),e.equals=t({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})})(Cs);function Ws(e,t){if(!(e instanceof Uint8Array))throw new Error("[ndarray-pixels] Input must be Uint8Array or Buffer.");const s=new Blob([e],{type:t}),n=URL.createObjectURL(s);return new Promise((r,a)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=function(){URL.revokeObjectURL(n);const o=new OffscreenCanvas(i.width,i.height).getContext("2d");o.drawImage(i,0,0);const u=o.getImageData(0,0,i.width,i.height);r(Ns(new Uint8Array(u.data),[i.width,i.height,4],[4,4*i.width,1],0))},i.onerror=l=>{URL.revokeObjectURL(n),a(l)},i.src=n})}async function Hs(e,t){return Ws(e,t)}function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)({}).hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},B.apply(null,arguments)}P.Mode;function D(e,t){return Object.defineProperty(t,"name",{value:e}),t}function H(e,t){const s=B({},e);for(const n in t)t[n]!==void 0&&(s[n]=t[n]);return s}class Ee{constructor(){this._map=new Map}get size(){return this._map.size}has(t){return this._map.has(t)}add(t,s){let n=this._map.get(t);return n||(n=new Set,this._map.set(t,n)),n.add(s),this}get(t){return this._map.get(t)||new Set}keys(){return this._map.keys()}}const Xs=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function We(e){return Xs.format(e)}function Qs(e,t,s=2){const n=e>t?"–":"+",r="%";return n+(Math.abs(e-t)/e*100).toFixed(s)+r}function Ks(e,t){return`${We(e)} → ${We(t)} (${Qs(e,t)})`}function wt(e){const t=[];for(const s of e.listAttributes())t.push(s);for(const s of e.listTargets())for(const n of s.listAttributes())t.push(n);return Array.from(new Set(t))}function Js(e,t){if(e==null&&t==null)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}function ee(e,t){return e.createAccessor(t.getName()).setArray(t.getArray()).setType(t.getType()).setBuffer(t.getBuffer()).setNormalized(t.getNormalized()).setSparse(t.getSparse())}function Ys(e,t=e){const s=It(e,t);for(let n=0;n<s.length;n++)s[n]=n;return s}function It(e,t=e){return t<=65534?new Uint16Array(e):new Uint32Array(e)}function Mt(e){for(const t in e)return!1;return!0}var fe=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function Zs(e,t){var s=t[0],n=t[1],r=t[2],a=t[3],i=t[4],l=t[5],o=t[6],u=t[7],c=t[8],h=t[9],f=t[10],g=t[11],p=t[12],m=t[13],d=t[14],y=t[15],T=s*l-n*i,A=s*o-r*i,b=s*u-a*i,_=n*o-r*l,E=n*u-a*l,x=r*u-a*o,L=c*m-h*p,X=c*d-f*p,Q=c*y-g*p,K=h*d-f*m,J=h*y-g*m,Y=f*y-g*d,M=T*Y-A*J+b*K+_*Q-E*X+x*L;return M?(M=1/M,e[0]=(l*Y-o*J+u*K)*M,e[1]=(r*J-n*Y-a*K)*M,e[2]=(m*x-d*E+y*_)*M,e[3]=(f*E-h*x-g*_)*M,e[4]=(o*Q-i*Y-u*X)*M,e[5]=(s*Y-r*Q+a*X)*M,e[6]=(d*b-p*x-y*A)*M,e[7]=(c*x-f*b+g*A)*M,e[8]=(i*J-l*Q+u*L)*M,e[9]=(n*Q-s*J-a*L)*M,e[10]=(p*E-m*b+y*T)*M,e[11]=(h*b-c*E-g*T)*M,e[12]=(l*X-i*K-o*L)*M,e[13]=(s*K-n*X+r*L)*M,e[14]=(m*A-p*_-d*T)*M,e[15]=(c*_-h*A+f*T)*M,e):null}function ke(e,t,s){var n=t[0],r=t[1],a=t[2],i=t[3],l=t[4],o=t[5],u=t[6],c=t[7],h=t[8],f=t[9],g=t[10],p=t[11],m=t[12],d=t[13],y=t[14],T=t[15],A=s[0],b=s[1],_=s[2],E=s[3];return e[0]=A*n+b*l+_*h+E*m,e[1]=A*r+b*o+_*f+E*d,e[2]=A*a+b*u+_*g+E*y,e[3]=A*i+b*c+_*p+E*T,A=s[4],b=s[5],_=s[6],E=s[7],e[4]=A*n+b*l+_*h+E*m,e[5]=A*r+b*o+_*f+E*d,e[6]=A*a+b*u+_*g+E*y,e[7]=A*i+b*c+_*p+E*T,A=s[8],b=s[9],_=s[10],E=s[11],e[8]=A*n+b*l+_*h+E*m,e[9]=A*r+b*o+_*f+E*d,e[10]=A*a+b*u+_*g+E*y,e[11]=A*i+b*c+_*p+E*T,A=s[12],b=s[13],_=s[14],E=s[15],e[12]=A*n+b*l+_*h+E*m,e[13]=A*r+b*o+_*f+E*d,e[14]=A*a+b*u+_*g+E*y,e[15]=A*i+b*c+_*p+E*T,e}function en(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function tn(e,t,s,n){var r=t[0],a=t[1],i=t[2],l=t[3],o=r+r,u=a+a,c=i+i,h=r*o,f=r*u,g=r*c,p=a*u,m=a*c,d=i*c,y=l*o,T=l*u,A=l*c,b=n[0],_=n[1],E=n[2];return e[0]=(1-(p+d))*b,e[1]=(f+A)*b,e[2]=(g-T)*b,e[3]=0,e[4]=(f-A)*_,e[5]=(1-(h+d))*_,e[6]=(m+y)*_,e[7]=0,e[8]=(g+T)*E,e[9]=(m-y)*E,e[10]=(1-(h+p))*E,e[11]=0,e[12]=s[0],e[13]=s[1],e[14]=s[2],e[15]=1,e}function sn(){var e=new fe(3);return fe!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function nn(e,t,s){return e[0]=t[0]*s[0],e[1]=t[1]*s[1],e[2]=t[2]*s[2],e}function Ne(e,t,s){return e[0]=Math.min(t[0],s[0]),e[1]=Math.min(t[1],s[1]),e[2]=Math.min(t[2],s[2]),e}function Ce(e,t,s){return e[0]=Math.max(t[0],s[0]),e[1]=Math.max(t[1],s[1]),e[2]=Math.max(t[2],s[2]),e}function He(e,t,s){return e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e}function rn(e,t,s){var n=t[0],r=t[1],a=t[2],i=s[3]*n+s[7]*r+s[11]*a+s[15];return i=i||1,e[0]=(s[0]*n+s[4]*r+s[8]*a+s[12])/i,e[1]=(s[1]*n+s[5]*r+s[9]*a+s[13])/i,e[2]=(s[2]*n+s[6]*r+s[10]*a+s[14])/i,e}var an=nn;(function(){var e=sn();return function(t,s,n,r,a,i){var l,o;for(s||(s=3),n||(n=0),r?o=Math.min(r*s+n,t.length):o=t.length,l=n;l<o;l+=s)e[0]=t[l],e[1]=t[l+1],e[2]=t[l+2],a(e,e,i),t[l]=e[0],t[l+1]=e[1],t[l+2]=e[2];return t}})();const F="dedup",we={keepUniqueNames:!1,propertyTypes:[v.ACCESSOR,v.MESH,v.TEXTURE,v.MATERIAL,v.SKIN]};function on(e=we){const t=H(we,e),s=new Set(t.propertyTypes);for(const n of t.propertyTypes)if(!we.propertyTypes.includes(n))throw new Error(`${F}: Unsupported deduplication on type "${n}".`);return D(F,n=>{const r=n.getLogger();s.has(v.ACCESSOR)&&ln(n),s.has(v.TEXTURE)&&fn(n,t),s.has(v.MATERIAL)&&un(n,t),s.has(v.MESH)&&cn(n,t),s.has(v.SKIN)&&hn(n,t),r.debug(`${F}: Complete.`)})}function ln(e){const t=e.getLogger(),s=new Map,n=new Map,r=new Map,a=new Map,i=e.getRoot().listMeshes();i.forEach(h=>{h.listPrimitives().forEach(f=>{f.listAttributes().forEach(g=>l(g,n)),l(f.getIndices(),s)})});for(const h of e.getRoot().listAnimations())for(const f of h.listSamplers())l(f.getInput(),r),l(f.getOutput(),a);function l(h,f){if(!h)return;const g=[h.getCount(),h.getType(),h.getComponentType(),h.getNormalized(),h.getSparse()].join(":");let p=f.get(g);p||f.set(g,p=new Set),p.add(h)}function o(h,f){for(let g=0;g<h.length;g++){const p=h[g],m=N.toView(p.getArray());if(!f.has(p))for(let d=g+1;d<h.length;d++){const y=h[d];f.has(y)||N.equals(m,N.toView(y.getArray()))&&f.set(y,p)}}}let u=0;const c=new Map;for(const h of[n,s,r,a])for(const f of h.values())u+=f.size,o(Array.from(f),c);t.debug(`${F}: Merged ${c.size} of ${u} accessors.`),i.forEach(h=>{h.listPrimitives().forEach(f=>{f.listAttributes().forEach(p=>{c.has(p)&&f.swap(p,c.get(p))});const g=f.getIndices();g&&c.has(g)&&f.swap(g,c.get(g))})});for(const h of e.getRoot().listAnimations())for(const f of h.listSamplers()){const g=f.getInput(),p=f.getOutput();g&&c.has(g)&&f.swap(g,c.get(g)),p&&c.has(p)&&f.swap(p,c.get(p))}Array.from(c.keys()).forEach(h=>h.dispose())}function cn(e,t){const s=e.getLogger(),n=e.getRoot(),r=new Map;n.listAccessors().forEach((l,o)=>r.set(l,o)),n.listMaterials().forEach((l,o)=>r.set(l,o));const a=n.listMeshes().length,i=new Map;for(const l of n.listMeshes()){const o=[];for(const c of l.listPrimitives())o.push(Nt(c,r));let u="";if(t.keepUniqueNames&&(u+=l.getName()+";"),u+=o.join(";"),i.has(u)){const c=i.get(u);l.listParents().forEach(h=>{h.propertyType!==v.ROOT&&h.swap(l,c)}),l.dispose()}else i.set(u,l)}s.debug(`${F}: Merged ${a-i.size} of ${a} meshes.`)}function fn(e,t){const s=e.getLogger(),n=e.getRoot(),r=n.listTextures(),a=new Map;for(let i=0;i<r.length;i++){const l=r[i],o=l.getImage();if(!a.has(l))for(let u=i+1;u<r.length;u++){const c=r[u],h=c.getImage();if(a.has(c)||l.getMimeType()!==c.getMimeType()||t.keepUniqueNames&&l.getName()!==c.getName())continue;const f=l.getSize(),g=c.getSize();!f||!g||f[0]===g[0]&&f[1]===g[1]&&(!o||!h||N.equals(o,h)&&a.set(c,l))}}s.debug(`${F}: Merged ${a.size} of ${n.listTextures().length} textures.`),Array.from(a.entries()).forEach(([i,l])=>{i.listParents().forEach(o=>{o instanceof me||o.swap(i,l)}),i.dispose()})}function un(e,t){const s=e.getLogger(),r=e.getRoot().listMaterials(),a=new Map,i=new Map,l=new Set;t.keepUniqueNames||l.add("name");for(let o=0;o<r.length;o++){const u=r[o];if(!a.has(u)&&!Xe(u,i))for(let c=o+1;c<r.length;c++){const h=r[c];a.has(h)||Xe(h,i)||u.equals(h,l)&&a.set(h,u)}}s.debug(`${F}: Merged ${a.size} of ${r.length} materials.`),Array.from(a.entries()).forEach(([o,u])=>{o.listParents().forEach(c=>{c instanceof me||c.swap(o,u)}),o.dispose()})}function hn(e,t){const s=e.getLogger(),r=e.getRoot().listSkins(),a=new Map,i=new Set(["joints"]);t.keepUniqueNames||i.add("name");for(let l=0;l<r.length;l++){const o=r[l];if(!a.has(o))for(let u=l+1;u<r.length;u++){const c=r[u];a.has(c)||o.equals(c,i)&&Js(o.listJoints(),c.listJoints())&&a.set(c,o)}}s.debug(`${F}: Merged ${a.size} of ${r.length} skins.`),Array.from(a.entries()).forEach(([l,o])=>{l.listParents().forEach(u=>{u instanceof me||u.swap(l,o)}),l.dispose()})}function Nt(e,t){const s=[];for(const n of e.listSemantics()){const r=e.getAttribute(n);s.push(n+":"+t.get(r))}if(e instanceof P){const n=e.getIndices();n&&s.push("indices:"+t.get(n));const r=e.getMaterial();r&&s.push("material:"+t.get(r)),s.push("mode:"+e.getMode());for(const a of e.listTargets())s.push("target:"+Nt(a,t))}return s.join(",")}function Xe(e,t){if(t.has(e))return t.get(e);const s=e.getGraph(),n=new Set,r=s.listParentEdges(e);for(;r.length>0;){const a=r.pop();if(a.getAttributes().modifyChild===!0)return t.set(e,!0),!0;const i=a.getChild();if(!n.has(i))for(const l of s.listChildEdges(i))r.push(l)}return t.set(e,!1),!1}function Ct(){var e=new fe(4);return fe!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function gn(e,t,s){return e[0]=t[0]+s[0],e[1]=t[1]+s[1],e[2]=t[2]+s[2],e[3]=t[3]+s[3],e}function pn(e,t,s){return e[0]=t[0]-s[0],e[1]=t[1]-s[1],e[2]=t[2]-s[2],e[3]=t[3]-s[3],e}function dn(e,t,s){return e[0]=t[0]*s[0],e[1]=t[1]*s[1],e[2]=t[2]*s[2],e[3]=t[3]*s[3],e}function mn(e,t,s){return e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e[3]=t[3]*s,e}function yn(e){var t=e[0],s=e[1],n=e[2],r=e[3];return Math.hypot(t,s,n,r)}var St=pn,bn=dn,Ot=yn;(function(){var e=Ct();return function(t,s,n,r,a,i){var l,o;for(s||(s=4),n||(n=0),r?o=Math.min(r*s+n,t.length):o=t.length,l=n;l<o;l+=s)e[0]=t[l],e[1]=t[l+1],e[2]=t[l+2],e[3]=t[l+3],a(e,e,i),t[l]=e[0],t[l+1]=e[1],t[l+2]=e[2],t[l+3]=e[3];return t}})();const vn=/color|emissive|diffuse/i;function An(e){return e.getGraph().listParentEdges(e).some(r=>r.getAttributes().isColor||vn.test(r.getName()))?"srgb":null}function _n(e){const t=e.getGraph(),s=new Set,n=new Set;function r(a){const i=new Set;for(const l of t.listChildEdges(a))l.getChild()instanceof Me&&i.add(l.getName()+"Info");for(const l of t.listChildEdges(a)){const o=l.getChild();s.has(o)||(s.add(o),o instanceof yt&&i.has(l.getName())?n.add(o):o instanceof bt&&r(o))}}return r(e),Array.from(n)}function Tn(e){const s=ze.fromGraph(e.getGraph()).getRoot(),n=e.getGraph().listParentEdges(e).filter(r=>r.getParent()!==s).map(r=>r.getName());return Array.from(new Set(n))}const q="prune",Se=3/255,Qe={propertyTypes:[v.NODE,v.SKIN,v.MESH,v.CAMERA,v.PRIMITIVE,v.PRIMITIVE_TARGET,v.ANIMATION,v.MATERIAL,v.TEXTURE,v.ACCESSOR,v.BUFFER],keepLeaves:!1,keepAttributes:!1,keepIndices:!1,keepSolidTextures:!1,keepExtras:!1};function xt(e=Qe){const t=H(Qe,e),s=new Set(t.propertyTypes),n=t.keepExtras;return D(q,async r=>{const a=r.getLogger(),i=r.getRoot(),l=r.getGraph(),o=new En,u=c=>o.dispose(c.target);if(l.addEventListener("node:dispose",u),s.has(v.MESH))for(const c of i.listMeshes())c.listPrimitives().length>0||c.dispose();if(s.has(v.NODE)){if(!t.keepLeaves)for(const c of i.listScenes())Rt(l,c,n);for(const c of i.listNodes())S(c,n)}if(s.has(v.SKIN))for(const c of i.listSkins())S(c,n);if(s.has(v.MESH))for(const c of i.listMeshes())S(c,n);if(s.has(v.CAMERA))for(const c of i.listCameras())S(c,n);if(s.has(v.PRIMITIVE)&&Ke(l,v.PRIMITIVE,n),s.has(v.PRIMITIVE_TARGET)&&Ke(l,v.PRIMITIVE_TARGET,n),!t.keepAttributes&&s.has(v.ACCESSOR)){const c=new Map;for(const h of i.listMeshes())for(const f of h.listPrimitives()){const g=f.getMaterial();if(!g)continue;const p=jt(r,f,g),m=In(f,p);Je(f,m),f.listTargets().forEach(d=>Je(d,m)),c.has(g)?c.get(g).add(f):c.set(g,new Set([f]))}for(const[h,f]of c)Mn(h,Array.from(f))}if(!t.keepIndices&&s.has(v.ACCESSOR))for(const c of i.listMeshes())for(const h of c.listPrimitives())wn(h);if(s.has(v.ANIMATION))for(const c of i.listAnimations()){for(const h of c.listChannels())h.getTargetNode()||h.dispose();if(c.listChannels().length)c.listSamplers().forEach(h=>S(h,n));else{const h=c.listSamplers();S(c,n),h.forEach(f=>S(f,n))}}if(s.has(v.MATERIAL)&&i.listMaterials().forEach(c=>S(c,n)),s.has(v.TEXTURE)&&(i.listTextures().forEach(c=>S(c,n)),t.keepSolidTextures||await Nn(r)),s.has(v.ACCESSOR)&&i.listAccessors().forEach(c=>S(c,n)),s.has(v.BUFFER)&&i.listBuffers().forEach(c=>S(c,n)),l.removeEventListener("node:dispose",u),o.empty())a.debug(`${q}: No unused properties found.`);else{const c=o.entries().map(([h,f])=>`${h} (${f})`).join(", ");a.info(`${q}: Removed types... ${c}`)}a.debug(`${q}: Complete.`)})}class En{constructor(){this.disposed={}}empty(){for(const t in this.disposed)return!1;return!0}entries(){return Object.entries(this.disposed)}dispose(t){this.disposed[t.propertyType]=this.disposed[t.propertyType]||0,this.disposed[t.propertyType]++}}function S(e,t){const s=e.listParents().filter(r=>!(r instanceof me||r instanceof Pe)),n=t&&!Mt(e.getExtras());!s.length&&!n&&e.dispose()}function Ke(e,t,s){for(const n of e.listEdges()){const r=n.getParent();r.propertyType===t&&S(r,s)}}function Rt(e,t,s){if(t.listChildren().forEach(i=>Rt(e,i,s)),t instanceof ns)return;const n=e.listParentEdges(t).some(i=>{const l=i.getParent().propertyType;return l!==v.ROOT&&l!==v.SCENE&&l!==v.NODE}),r=e.listChildren(t).length===0,a=s&&!Mt(t.getExtras());r&&!n&&!a&&t.dispose()}function Je(e,t){for(const s of t)e.setAttribute(s,null)}function wn(e){const t=e.getIndices(),s=t&&t.getArray(),n=e.listAttributes()[0];if(!(!s||!n)&&t.getCount()===n.getCount()){for(let r=0,a=s.length;r<a;r++)if(r!==s[r])return;e.setIndices(null)}}function In(e,t){const s=[];for(const n of e.listSemantics())(n==="NORMAL"&&!t.has(n)||n==="TANGENT"&&!t.has(n)||n.startsWith("TEXCOORD_")&&!t.has(n)||n.startsWith("COLOR_")&&n!=="COLOR_0")&&s.push(n);return s}function jt(e,t,s,n=new Set){const a=e.getGraph().listChildEdges(s),i=new Set;for(const u of a)u.getChild()instanceof Me&&i.add(u.getName());for(const u of a){const c=u.getName(),h=u.getChild();h instanceof yt&&i.has(c.replace(/Info$/,""))&&n.add(`TEXCOORD_${h.getTexCoord()}`),h instanceof Me&&c.match(/normalTexture/i)&&n.add("TANGENT"),h instanceof bt&&jt(e,t,h,n)}const l=s instanceof vt&&!s.getExtension("KHR_materials_unlit"),o=t.getMode()===P.Mode.POINTS;return l&&!o&&n.add("NORMAL"),n}function Mn(e,t){const s=_n(e),n=new Set(s.map(o=>o.getTexCoord())),r=Array.from(n).sort(),a=new Map(r.map((o,u)=>[o,u])),i=new Map(r.map((o,u)=>[`TEXCOORD_${o}`,`TEXCOORD_${u}`]));for(const o of s){const u=o.getTexCoord();o.setTexCoord(a.get(u))}for(const o of t){const u=o.listSemantics().filter(c=>c.startsWith("TEXCOORD_")).sort();l(o,u),o.listTargets().forEach(c=>l(c,u))}function l(o,u){for(const c of u){const h=o.getAttribute(c);if(!h)continue;const f=i.get(c);f!==c&&(o.setAttribute(f,h),o.setAttribute(c,null))}}}async function Nn(e){const t=e.getRoot(),s=e.getGraph(),n=e.getLogger(),a=t.listTextures().map(async i=>{var l;const o=await Sn(i);if(!o)return;An(i)==="srgb"&&rs.convertSRGBToLinear(o,o);const u=i.getName()||i.getURI(),c=(l=i.getSize())==null?void 0:l.join("x"),h=Tn(i);for(const f of s.listParentEdges(i)){const g=f.getParent();g!==t&&Cn(g,o,f.getName(),n)&&f.dispose()}i.listParents().length===1&&(i.dispose(),n.debug(`${q}: Removed solid-color texture "${u}" (${c}px ${h.join(", ")})`))});await Promise.all(a)}function Cn(e,t,s,n){if(e instanceof vt)switch(s){case"baseColorTexture":return e.setBaseColorFactor(bn(t,t,e.getBaseColorFactor())),!0;case"emissiveTexture":return e.setEmissiveFactor(an([0,0,0],t.slice(0,3),e.getEmissiveFactor())),!0;case"occlusionTexture":return Math.abs(t[0]-1)<=Se;case"metallicRoughnessTexture":return e.setRoughnessFactor(t[1]*e.getRoughnessFactor()),e.setMetallicFactor(t[2]*e.getMetallicFactor()),!0;case"normalTexture":return Ot(St(Ct(),t,[.5,.5,1,1]))<=Se}return n.warn(`${q}: Detected single-color ${s} texture. Pruning ${s} not yet supported.`),!1}async function Sn(e){const t=await On(e);if(!t)return null;const s=[1/0,1/0,1/0,1/0],n=[-1/0,-1/0,-1/0,-1/0],r=[0,0,0,0],[a,i]=t.shape;for(let l=0;l<a;l++){for(let o=0;o<i;o++)for(let u=0;u<4;u++)s[u]=Math.min(s[u],t.get(l,o,u)),n[u]=Math.max(n[u],t.get(l,o,u));if(Ot(St(r,n,s))/255>Se)return null}return mn(r,gn(r,n,s),.5/255)}async function On(e){try{return await Hs(e.getImage(),e.getMimeType())}catch{return null}}const Ye=2**32-1;var C;(function(e){e.RENDER="render",e.RENDER_CACHED="render-cached",e.UPLOAD="upload",e.UPLOAD_NAIVE="upload-naive",e.DISTINCT="distinct",e.DISTINCT_POSITION="distinct-position",e.UNUSED="unused"})(C||(C={}));function ue(e,t){const s=e.getAttribute("POSITION"),n=e.getIndices();switch(t){case C.RENDER:return n?n.getCount():s.getCount();case C.RENDER_CACHED:return n?new Set(n.getArray()).size:s.getCount();case C.UPLOAD_NAIVE:case C.UPLOAD:return s.getCount();case C.DISTINCT:case C.DISTINCT_POSITION:return xn(t);case C.UNUSED:return n?s.getCount()-new Set(n.getArray()).size:0;default:return Rn(t)}}function xn(e){throw new Error(`Not implemented: ${e}`)}function Rn(e){throw new Error(`Unexpected value: ${e}`)}function jn(e,t,s){const n=ze.fromGraph(e.getGraph());(!t||!s)&&([t,s]=Pn(e));const r=e.getIndices(),a=r?r.getArray():null,i=ue(e,C.RENDER),l=n.createAccessor(),o=i,u=It(o,s);for(let h=0;h<o;h++)u[h]=t[a?a[h]:h];e.setIndices(l.setArray(u));const c=wt(e);for(const h of e.listAttributes()){const f=ee(n,h);Oe(h,r,t,f,s),e.swap(h,f)}for(const h of e.listTargets())for(const f of h.listAttributes()){const g=ee(n,f);Oe(f,r,t,g,s),h.swap(f,g)}r&&r.listParents().length===1&&r.dispose();for(const h of c)h.listParents().length===1&&h.dispose();return e}function Oe(e,t,s,n,r){const a=e.getElementSize(),i=e.getArray(),l=t?t.getArray():null,o=t?t.getCount():e.getCount(),u=new i.constructor(r*a),c=new Uint8Array(r);for(let h=0;h<o;h++){const f=l?l[h]:h,g=s[f];if(!c[g]){for(let p=0;p<a;p++)u[g*a+p]=i[f*a+p];c[g]=1}}return n.setArray(u)}function Pn(e){const t=ue(e,C.UPLOAD),s=e.getIndices(),n=s?s.getArray():null;if(!s||!n)return[Ys(t,1e6),t];const r=new Uint32Array(t).fill(Ye);let a=0;for(let i=0;i<n.length;i++){const l=n[i];r[l]===Ye&&(r[l]=a++)}return[r,a]}Ie.ComponentType;P.Mode;P.Mode;const ne="reorder",zn={target:"size",cleanup:!0};function kn(e){const t=H(zn,e),s=t.encoder;if(!s)throw new Error(`${ne}: encoder dependency required — install "meshoptimizer".`);return D(ne,async n=>{const r=n.getLogger();await s.ready;const a=Ln(n);for(const i of a.indicesToAttributes.keys()){let l=i.getArray();l instanceof Uint32Array?l=l.slice():l=new Uint32Array(l);const[o,u]=s.reorderMesh(l,a.indicesToMode.get(i)===P.Mode.TRIANGLES,t.target==="size"),c=ee(n,i);c.setArray(u<=65534?new Uint16Array(l):l);for(const h of a.indicesToAttributes.get(i)){const f=ee(n,h);Oe(h,i,o,f,u);for(const g of a.indicesToPrimitives.get(i)){g.getIndices()===i&&g.swap(i,c),g.swap(h,f);for(const p of g.listTargets())p.swap(h,f)}}}t.cleanup&&await n.transform(xt({propertyTypes:[v.ACCESSOR],keepAttributes:!0,keepIndices:!0})),a.indicesToAttributes.size?r.debug(`${ne}: Complete.`):r.warn(`${ne}: No qualifying primitives found; may need to weld first.`)})}function Ln(e){const t=new Map,s=new Ee,n=new Ee,r=new Ee;for(const a of e.getRoot().listMeshes())for(const i of a.listPrimitives()){const l=i.getIndices();if(l){t.set(l,i.getMode()),s.add(l,i);for(const o of wt(i))n.add(l,o),r.add(o,i)}}return{indicesToPrimitives:s,indicesToAttributes:n,indicesToMode:t,attributesToPrimitives:r}}function $n(e,t=1/0){if(Number.isFinite(t)&&t%4||t<=0)throw new Error("Limit must be positive multiple of four.");const s=e.getAttribute("POSITION").getCount(),n=e.listSemantics().filter(u=>u.startsWith("WEIGHTS_")).length,r=new Uint16Array(n*4),a=new Float32Array(n*4),i=new Float32Array(n*4),l=new Uint32Array(n*4),o=new Uint32Array(n*4);for(let u=0;u<s;u++){he(e,u,"WEIGHTS",a),he(e,u,"JOINTS",l);for(let c=0;c<n*4;c++)r[c]=c;r.sort((c,h)=>a[c]>a[h]?-1:1);for(let c=0;c<r.length;c++)i[c]=a[r[c]],o[c]=l[r[c]];ge(e,u,"WEIGHTS",i),ge(e,u,"JOINTS",o)}for(let u=n;u*4>t;u--){const c=e.getAttribute(`WEIGHTS_${u-1}`),h=e.getAttribute(`JOINTS_${u-1}`);e.setAttribute(`WEIGHTS_${u-1}`,null),e.setAttribute(`JOINTS_${u-1}`,null),c.listParents().length===1&&c.dispose(),h.listParents().length===1&&h.dispose()}Un(e)}function Un(e){if(!Vn(e))return;const t=e.getAttribute("POSITION").getCount(),s=e.listSemantics().filter(h=>h.startsWith("WEIGHTS_")).length,n=e.getAttribute("WEIGHTS_0"),r=n.getArray(),a=n.getComponentType(),i=n.getNormalized(),l=i?a:void 0,o=i?U.decodeNormalizedInt(1,a):Number.EPSILON,u=new Uint32Array(s*4).fill(0),c=r.slice(0,s*4).fill(0);for(let h=0;h<t;h++){he(e,h,"JOINTS",u),he(e,h,"WEIGHTS",c,l);let f=Ze(c,l);if(f!==0&&f!==1){if(Math.abs(1-f)>o)for(let g=0;g<c.length;g++)if(i){const p=U.decodeNormalizedInt(c[g],a);c[g]=U.encodeNormalizedInt(p/f,a)}else c[g]/=f;if(f=Ze(c,l),i&&f!==1){for(let g=c.length-1;g>=0;g--)if(c[g]>0){const p=1-f;c[g]+=Math.sign(p)*U.encodeNormalizedInt(Math.abs(p),a);break}}}for(let g=c.length-1;g>=0;g--)c[g]===0&&(u[g]=0);ge(e,h,"JOINTS",u),ge(e,h,"WEIGHTS",c,l)}}function he(e,t,s,n,r){let a;const i=[0,0,0,0];for(let l=0;a=e.getAttribute(`${s}_${l}`);l++){a.getElement(t,i);for(let o=0;o<4;o++)r?n[l*4+o]=U.encodeNormalizedInt(i[o],r):n[l*4+o]=i[o]}return n}function ge(e,t,s,n,r){let a;const i=[0,0,0,0];for(let l=0;a=e.getAttribute(`${s}_${l}`);l++){for(let o=0;o<4;o++)r?i[o]=U.decodeNormalizedInt(n[l*4+o],r):i[o]=n[l*4+o];a.setElement(t,i)}}function Ze(e,t){let s=0;for(let n=0;n<e.length;n++)t?s+=U.decodeNormalizedInt(e[n],t):s+=e[n];return s}function Vn(e){const t=e.listSemantics().filter(r=>r.startsWith("WEIGHTS_")).map(r=>e.getAttribute(r)),s=t.map(r=>r.getNormalized()),n=t.map(r=>r.getComponentType());return new Set(s).size===1&&new Set(n).size===1}const V="quantize",Fn=[Int8Array,Int16Array,Int32Array],{TRANSLATION:Dn,ROTATION:qn,SCALE:Bn,WEIGHTS:Gn}=Pe.TargetPath,Wn=[Dn,qn,Bn],oe={pattern:/.*/,quantizationVolume:"mesh",quantizePosition:14,quantizeNormal:10,quantizeTexcoord:12,quantizeColor:8,quantizeWeight:8,quantizeGeneric:12,normalizeWeights:!0,cleanup:!0};function Le(e=oe){const t=H(oe,B({patternTargets:e.pattern||oe.pattern},e));return D(V,async s=>{const n=s.getLogger(),r=s.getRoot();let a;t.quantizationVolume==="scene"&&(a=tt(er(r.listMeshes().map(st))));for(const l of s.getRoot().listMeshes()){t.quantizationVolume==="mesh"&&(a=tt(st(l))),a&&t.pattern.test("POSITION")&&(Hn(s,l,a),Kn(l,1/a.scale));for(const o of l.listPrimitives()){const u=ue(o,C.RENDER),c=ue(o,C.UPLOAD);u<c/2&&jn(o),et(s,o,a,t);for(const h of o.listTargets())et(s,h,a,t)}}r.listMeshes().flatMap(l=>l.listPrimitives()).some(Pt)&&s.createExtension(mt).setRequired(!0),t.cleanup&&await s.transform(xt({propertyTypes:[v.ACCESSOR,v.SKIN,v.MATERIAL],keepAttributes:!0,keepIndices:!0,keepLeaves:!0,keepSolidTextures:!0}),on({propertyTypes:[v.ACCESSOR,v.MATERIAL,v.SKIN],keepUniqueNames:!0})),n.debug(`${V}: Complete.`)})}function et(e,t,s,n){const r=t instanceof as,a=e.getLogger();for(const i of t.listSemantics()){if(!r&&!n.pattern.test(i)||r&&!n.patternTargets.test(i))continue;const l=t.getAttribute(i),{bits:o,ctor:u}=Yn(i,l,a,n);if(!u)continue;if(o<8||o>16)throw new Error(`${V}: Requires bits = 8–16.`);if(l.getComponentSize()<=o/8)continue;const c=l.clone();if(i==="POSITION"){const h=s.scale,f=[];t instanceof P?Zs(f,ye(s)):en(f,[1/h,1/h,1/h]);for(let g=0,p=[0,0,0],m=c.getCount();g<m;g++)c.getElement(g,p),c.setElement(g,rn(p,p,f))}Jn(c,u,o),t.setAttribute(i,c)}if(n.normalizeWeights&&t.getAttribute("WEIGHTS_0")&&$n(t,1/0),t instanceof P&&t.getIndices()&&t.listAttributes().length&&t.listAttributes()[0].getCount()<65535){const i=t.getIndices();i.setArray(new Uint16Array(i.getArray()))}}function tt(e){const{min:t,max:s}=e,n=Math.max((s[0]-t[0])/2,(s[1]-t[1])/2,(s[2]-t[2])/2);return{offset:[t[0]+(s[0]-t[0])/2,t[1]+(s[1]-t[1])/2,t[2]+(s[2]-t[2])/2],scale:n}}function Hn(e,t,s){const n=ye(s);for(const r of t.listParents()){if(!(r instanceof ss))continue;const a=r.listParents().filter(f=>f instanceof Pe),i=a.some(f=>Wn.includes(f.getTargetPath())),l=r.listChildren().length>0,o=r.getSkin();if(o){r.setSkin(Xn(o,s));continue}const u=r.getExtension("EXT_mesh_gpu_instancing");if(u){r.setExtension("EXT_mesh_gpu_instancing",Qn(u,s));continue}let c;l||i?(c=e.createNode("").setMesh(t),r.addChild(c).setMesh(null),a.filter(f=>f.getTargetPath()===Gn).forEach(f=>f.setTargetNode(c))):c=r;const h=c.getMatrix();ke(h,h,n),c.setMatrix(h)}}function Xn(e,t){e=e.clone();const s=ye(t),n=e.getInverseBindMatrices().clone(),r=[];for(let a=0,i=n.getCount();a<i;a++)n.getElement(a,r),ke(r,r,s),n.setElement(a,r);return e.setInverseBindMatrices(n)}function Qn(e,t){var s,n,r;if(!e.getAttribute("TRANSLATION")&&!e.getAttribute("ROTATION")&&!e.getAttribute("SCALE"))return e;e=e.clone();const a=(s=e.getAttribute("TRANSLATION"))==null?void 0:s.clone(),i=(n=e.getAttribute("ROTATION"))==null?void 0:n.clone(),l=(r=e.getAttribute("SCALE"))==null?void 0:r.clone(),o=a||i||l,u=[0,0,0],c=[0,0,0,1],h=[1,1,1],f=[0,0,0],g=[0,0,0,1],p=[1,1,1],m=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],d=ye(t);for(let y=0,T=o.getCount();y<T;y++)U.compose(a?a.getElement(y,f):u,i?i.getElement(y,g):c,l?l.getElement(y,p):h,m),ke(m,m,d),U.decompose(m,f,g,p),a&&a.setElement(y,f),i&&i.setElement(y,g),l&&l.setElement(y,p);return a&&e.setAttribute("TRANSLATION",a),i&&e.setAttribute("ROTATION",i),l&&e.setAttribute("SCALE",l),e}function Kn(e,t){for(const s of e.listPrimitives()){let n=s.getMaterial();if(!n)continue;let r=n.getExtension("KHR_materials_volume");!r||r.getThicknessFactor()<=0||(r=r.clone().setThicknessFactor(r.getThicknessFactor()*t),n=n.clone().setExtension("KHR_materials_volume",r),s.setMaterial(n))}}function Jn(e,t,s){const n=new t(e.getArray().length),r=Fn.includes(t)?1:0,a=s-r,i=t.BYTES_PER_ELEMENT*8-r,l=Math.pow(2,a)-1,o=i-a,u=2*a-i,c=[r>0?-1:0,1];for(let h=0,f=0,g=[];h<e.getCount();h++){e.getElement(h,g);for(let p=0;p<g.length;p++){let m=tr(g[p],c);m=Math.round(Math.abs(m)*l),m=m<<o|m>>u,n[f++]=m*Math.sign(g[p])}}e.setArray(n).setNormalized(!0).setSparse(!1)}function Yn(e,t,s,n){const r=t.getMinNormalized([]),a=t.getMaxNormalized([]);let i,l;if(e==="POSITION")i=n.quantizePosition,l=i<=8?Int8Array:Int16Array;else if(e==="NORMAL"||e==="TANGENT")i=n.quantizeNormal,l=i<=8?Int8Array:Int16Array;else if(e.startsWith("COLOR_"))i=n.quantizeColor,l=i<=8?Uint8Array:Uint16Array;else if(e.startsWith("TEXCOORD_")){if(r.some(o=>o<0)||a.some(o=>o>1))return s.warn(`${V}: Skipping ${e}; out of [0,1] range.`),{bits:-1};i=n.quantizeTexcoord,l=i<=8?Uint8Array:Uint16Array}else{if(e.startsWith("JOINTS_"))return i=Math.max(...t.getMax([]))<=255?8:16,l=i<=8?Uint8Array:Uint16Array,t.getComponentSize()>i/8&&t.setArray(new l(t.getArray())),{bits:-1};if(e.startsWith("WEIGHTS_")){if(r.some(o=>o<0)||a.some(o=>o>1))return s.warn(`${V}: Skipping ${e}; out of [0,1] range.`),{bits:-1};i=n.quantizeWeight,l=i<=8?Uint8Array:Uint16Array}else if(e.startsWith("_")){if(r.some(o=>o<-1)||a.some(o=>o>1))return s.warn(`${V}: Skipping ${e}; out of [-1,1] range.`),{bits:-1};i=n.quantizeGeneric,l=r.some(o=>o<0)?l=i<=8?Int8Array:Int16Array:l=i<=8?Uint8Array:Uint16Array}else throw new Error(`${V}: Unexpected semantic, "${e}".`)}return{bits:i,ctor:l}}function st(e){const t=[],s=[];for(const r of e.listPrimitives()){const a=r.getAttribute("POSITION");a&&t.push(a);for(const i of r.listTargets()){const l=i.getAttribute("POSITION");l&&s.push(l)}}if(t.length===0)throw new Error(`${V}: Missing "POSITION" attribute.`);const n=nt(t,3);if(s.length>0){const{min:r,max:a}=nt(s,3);Ne(n.min,n.min,Ne(r,He(r,r,2),[0,0,0])),Ce(n.max,n.max,Ce(a,He(a,a,2),[0,0,0]))}return n}function Zn(e,t){const s=t.getComponentSize();if(e==="POSITION"||e==="NORMAL"||e==="TANGENT")return s<4;if(e.startsWith("TEXCOORD_")){const n=t.getComponentType(),r=t.getNormalized();return s<4&&!(r&&n===Ie.ComponentType.UNSIGNED_BYTE)&&!(r&&n===Ie.ComponentType.UNSIGNED_SHORT)}return!1}function Pt(e){for(const t of e.listSemantics()){const s=e.getAttribute("POSITION");if(Zn(t,s))return!0}return e.propertyType===v.PRIMITIVE?e.listTargets().some(Pt):!1}function nt(e,t){const s=new Array(t).fill(1/0),n=new Array(t).fill(-1/0),r=[],a=[];for(const i of e){i.getMinNormalized(r),i.getMaxNormalized(a);for(let l=0;l<t;l++)s[l]=Math.min(s[l],r[l]),n[l]=Math.max(n[l],a[l])}return{min:s,max:n}}function er(e){const t=e[0];for(const s of e)Ne(t.min,t.min,s.min),Ce(t.max,t.max,s.max);return t}function ye(e){return tn([],[0,0,0,1],e.offset,[e.scale,e.scale,e.scale])}function tr(e,t){return Math.min(Math.max(e,t[0]),t[1])}const sr=B({level:"high"},oe),rt="meshopt";function zt(e){const t=H(sr,e),s=t.encoder;if(!s)throw new Error(`${rt}: encoder dependency required — install "meshoptimizer".`);return D(rt,async n=>{let r,a,i=t.quantizeNormal;n.getRoot().listAccessors().length!==0&&(t.level==="medium"?(r=/.*/,a=/.*/):(r=/^(POSITION|TEXCOORD|JOINTS|WEIGHTS|COLOR)(_\d+)?$/,a=/^(POSITION|TEXCOORD|JOINTS|WEIGHTS|COLOR|NORMAL|TANGENT)(_\d+)?$/,i=Math.min(i,8)),await n.transform(kn({encoder:s,target:"size"}),Le(B({},t,{pattern:r,patternTargets:a,quantizeNormal:i}))),n.createExtension(ie).setRequired(!0).setEncoderOptions({method:t.level==="medium"?ie.EncoderMethod.QUANTIZE:ie.EncoderMethod.FILTER}))})}const xe="unweld",nr={};function rr(e=nr){return D(xe,t=>{const s=t.getLogger(),n=new Map;for(const r of t.getRoot().listMeshes())for(const a of r.listPrimitives())ar(a,n);s.debug(`${xe}: Complete.`)})}function ar(e,t=new Map){const s=e.getIndices();if(!s)return;const n=e.getGraph(),r=ze.fromGraph(n),a=r.getLogger(),i=e.getAttribute("POSITION").getCount();for(const o of e.listAttributes())e.swap(o,at(r,o,s,t)),o.listParents().length===1&&o.dispose();for(const o of e.listTargets())for(const u of o.listAttributes())o.swap(u,at(r,u,s,t)),u.listParents().length===1&&u.dispose();const l=e.getAttribute("POSITION").getCount();a.debug(`${xe}: ${Ks(i,l)} vertices.`),e.setIndices(null),s.listParents().length===1&&s.dispose()}function at(e,t,s,n){if(n.has(t)&&n.get(t).has(s))return n.get(t).get(s);const r=t.getArray(),a=r.constructor,i=new a(s.getCount()*t.getElementSize()),l=s.getArray(),o=t.getElementSize();for(let c=0,h=s.getCount();c<h;c++)for(let f=0;f<o;f++)i[c*o+f]=r[l[c]*o+f];n.has(t)||n.set(t,new Map);const u=ee(e,t).setArray(i);return n.get(t).set(s,u),u}var it;(function(e){e[e.STEP=0]="STEP",e[e.LERP=1]="LERP",e[e.SLERP=2]="SLERP"})(it||(it={}));const ir=1e-6;function or(e,t,s,n=1e-4){const r=t.length/e.length,a=new Array(r).fill(0),i=new Array(r).fill(0),l=new Array(r).fill(0),o=new Array(r).fill(0),u=e.length-1;let c=1;for(let h=1;h<u;++h){const f=e[c-1],g=e[h],p=e[h+1],m=(g-f)/(p-f);let d=!1;if(g!==p&&(h!==1||g!==e[0]))if(Z(t,c-1,o),Z(t,h,i),Z(t,h+1,l),s==="slerp"){const y=fr(a,o,l,m),T=lt(o,i)+lt(i,l);d=!re(i,y,n)||T+Number.EPSILON>=Math.PI}else if(s==="lerp"){const y=cr(a,o,l,m);d=!re(i,y,n)}else s==="step"&&(d=!re(i,o)||!re(i,l));d&&(h!==c&&(e[c]=e[h],ot(t,c,Z(t,h,a))),c++)}return u>0&&(e[c]=e[u],ot(t,c,Z(t,u,a)),c++),c}function Z(e,t,s){for(let n=0,r=s.length;n<r;n++)s[n]=e[t*r+n];return s}function ot(e,t,s){for(let n=0,r=s.length;n<r;n++)e[t*r+n]=s[n]}function re(e,t,s=0){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(Math.abs(e[n]-t[n])>s)return!1;return!0}function lr(e,t,s){return e*(1-s)+t*s}function cr(e,t,s,n){for(let r=0;r<t.length;r++)e[r]=lr(t[r],s[r],n);return e}function fr(e,t,s,n){let r=t[0],a=t[1],i=t[2],l=t[3],o=s[0],u=s[1],c=s[2],h=s[3],f,g,p,m,d;return g=r*o+a*u+i*c+l*h,g<0&&(g=-g,o=-o,u=-u,c=-c,h=-h),1-g>ir?(f=Math.acos(g),p=Math.sin(f),m=Math.sin((1-n)*f)/p,d=Math.sin(n*f)/p):(m=1-n,d=n),e[0]=m*r+d*o,e[1]=m*a+d*u,e[2]=m*i+d*c,e[3]=m*l+d*h,e}function lt(e,t){const s=ur(e,t);return Math.acos(2*s*s-1)}function ur(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}Promise.resolve();P.Mode;var Re;(function(e){e.LANCZOS3="lanczos3",e.LANCZOS2="lanczos2"})(Re||(Re={}));Re.LANCZOS3;const $="tangents",ct={overwrite:!1};function hr(e=ct){const t=H(ct,e);if(!t.generateTangents)throw new Error(`${$}: generateTangents callback required — install "mikktspace".`);return D($,s=>{const n=s.getLogger(),r=new Map,a=new Map;let i=0;for(const l of s.getRoot().listMeshes()){const o=l.getName(),u=l.listPrimitives();for(let c=0;c<u.length;c++){const h=u[c];if(!pr(h,n,o,c,t.overwrite))continue;const f=gr(h),g=h.getAttribute("POSITION").getArray(),p=h.getAttribute("NORMAL").getArray(),m=h.getAttribute(f).getArray(),d=r.get(g)||ve();r.set(g,d);const y=r.get(p)||ve();r.set(p,y);const T=r.get(m)||ve();r.set(m,T);const A=h.getAttribute("TANGENT");A&&A.listParents().length===2&&A.dispose();const b=`${d}|${y}|${T}`;let _=a.get(b);if(_){n.debug(`${$}: Found cache for primitive ${c} of mesh "${o}".`),h.setAttribute("TANGENT",_),i++;continue}n.debug(`${$}: Generating for primitive ${c} of mesh "${o}".`);const E=h.getAttribute("POSITION").getBuffer(),x=t.generateTangents(g instanceof Float32Array?g:new Float32Array(g),p instanceof Float32Array?p:new Float32Array(p),m instanceof Float32Array?m:new Float32Array(m));for(let L=3;L<x.length;L+=4)x[L]*=-1;_=s.createAccessor().setBuffer(E).setArray(x).setType("VEC4"),h.setAttribute("TANGENT",_),a.set(b,_),i++}}i?n.debug(`${$}: Complete.`):n.warn(`${$}: No qualifying primitives found. See debug output.`)})}function gr(e){const t=e.getMaterial();if(!t)return"TEXCOORD_0";const s=t.getNormalTextureInfo();if(!s)return"TEXCOORD_0";const r=`TEXCOORD_${s.getTexCoord()}`;return e.getAttribute(r)?r:"TEXCOORD_0"}function pr(e,t,s,n,r){return e.getMode()!==P.Mode.TRIANGLES||!e.getAttribute("POSITION")||!e.getAttribute("NORMAL")||!e.getAttribute("TEXCOORD_0")?(t.debug(`${$}: Skipping primitive ${n} of mesh "${s}": primitives must have attributes=[POSITION, NORMAL, TEXCOORD_0] and mode=TRIANGLES.`),!1):e.getAttribute("TANGENT")&&!r?(t.debug(`${$}: Skipping primitive ${n} of mesh "${s}": TANGENT found.`),!1):e.getIndices()?(t.warn(`${$}: Skipping primitive ${n} of mesh "${s}": primitives must be unwelded.`),!1):!0}async function dr(e,t,s,n={}){var y;const{remapMaterials:r,animationEvents:a,textureOptions:i,optimizeOptions:l}=s,o=await t.readBinary(e),u=o.getRoot().listExtensionsUsed(),c=u.some(T=>T.extensionName==="EXT_meshopt_compression"),h=u.some(T=>T.extensionName==="KHR_mesh_quantization");if((i==null?void 0:i.textureType)==="ktx2"&&n.ktx2Encode){const T=o.getRoot().listTextures();T.length>0&&o.createExtension(is).setRequired(!0);const A=T.filter(b=>b.getMimeType()!=="image/ktx2");await Promise.all(A.map(async b=>{b.setMimeType("image/ktx2");const _=b.getImage(),E=await n.ktx2Encode(_.buffer,{isUASTC:i.mode==="UASTC",qualityLevel:i.quality??255});b.setImage(E)}))}r&&o.getRoot().listMaterials().forEach((T,A)=>{if(r[A]){const b=o.createExtension(Ae).createGlTFRemapping().setRefId(r[A].refId);T.setExtension(Ae.EXTENSION_NAME,b)}}),a&&o.getRoot().listAnimations().forEach((T,A)=>{if(a[A]){const b=o.createExtension(Be).createAnimationEvent().setEvents(a[A]);T.setExtension(Be.EXTENSION_NAME,b)}});const g=[];l!=null&&l.meshopt&&!c&&(await le.ready,g.push(zt({encoder:le}))),l!=null&&l.meshQuantize&&!h&&g.push(Le({quantizePosition:16,quantizeNormal:12,quantizeTexcoord:14})),g.length>0&&await o.transform(...g);const p=await t.writeJSON(o,{format:os.GLB});if(n.resolveRef&&r){const T=Ae.EXTENSION_NAME;(y=p.json.materials)==null||y.forEach(A=>{var _;const b=(_=A.extensions)==null?void 0:_[T];if(b!=null&&b.refId){const E=n.resolveRef(b.refId);E&&(A.extensions[T]={url:E.url})}})}return{name:s.name.replace(/\.[^.]+$/,"")+".glb",content:_t(p)}}const ft=Vt("div",{color:"$gray10"}),mr=ht(({asset:e,index:t,originMaterial:s})=>{const{assetStore:n}=At(),r=e.remapMaterials[t];let a=Object.values(n.assets);a=a.filter(l=>l.getMetaConfig().type==="Material"&&!l.isSubAsset);const i=n.assets[r==null?void 0:r.refId];return I.jsx(Ft,{dropLayer:gt.Material,assets:a,customFilter:l=>l.mainId!==e.id,onSelect:l=>{(!i||l.engineObject!==i.engineObject)&&e.replaceMaterial(t,l.getCurrentRef())},onDelete:()=>{r&&e.resetMaterial(t)},onLocate:()=>{r&&r.refId&&n.selectAsset(r.refId)},label:s.name,value:i==null?void 0:i.name,asset:i})}),yr=ht(({asset:e})=>{var l;const t=e.engineObject.materials,{inspectorFacade:s}=At(),n=e.glTFInfo,r=(l=n.issues)==null?void 0:l.messages,{t:a}=Dt();function i(o,u){s.assetChange(e.id,o,u,"asset-meta")}return I.jsxs(I.Fragment,{children:[I.jsxs($e,{title:a("asset.gltf.basic-info"),defaultOpen:!0,children:[n.triangles?I.jsx(te,{label:a("asset.gltf.triangles"),children:I.jsx(be,{value:n.triangles,disabled:!0})}):null,n.drawcall?I.jsx(te,{label:a("asset.gltf.drawcall"),children:I.jsx(be,{value:n.drawcall,disabled:!0})}):null,I.jsx(se,{label:a("asset.gltf.compute-tangents"),value:e.needComputeTangents,onChange:o=>{i("needComputeTangents",o)},checkboxLabel:I.jsx(ft,{children:a("asset.gltf.refresh-tip")})}),I.jsx(se,{label:a("asset.gltf.keep-mesh-data"),value:e.params.keepMeshData,onChange:o=>{e.params={...e.params,keepMeshData:o}},checkboxLabel:I.jsx(ft,{children:a("asset.gltf.refresh-tip")})})]}),I.jsx(Ue,{}),r?I.jsxs(qt.Fragment,{children:[I.jsxs($e,{title:`${a("asset.gltf.issues")}: ${r.length}`,defaultOpen:!1,children:[r.slice(0,15).map((o,u)=>I.jsx(te,{label:o.pointer,children:I.jsx(be,{value:o.message,css:{color:"red"},disabled:!0})},u)),r.length>15?I.jsx(te,{label:"..."}):null]}),I.jsx(Ue,{})]}):null,I.jsx(Ve,{label:a("asset.gltf.remapped-materials"),children:t==null?void 0:t.map((o,u)=>I.jsx(mr,{originMaterial:o,asset:e,index:u},`${e.id}-${u}`))}),I.jsxs(Ve,{label:a("asset.gltf.compression"),children:[!e.optimize.meshopt&&I.jsx(se,{label:a("asset.gltf.quantize"),value:e.optimize.meshQuantize,onChange:o=>{Tracert.click("c351684.d417982",{checked:o}),i("optimize",{...e.optimize,meshQuantize:o})}}),I.jsx(se,{label:a("asset.gltf.meshopt"),value:e.optimize.meshopt,onChange:o=>{Tracert.click("c351684.d417983",{checked:o}),i("optimize",{...e.optimize,meshopt:o})}})]})]})});function pe(e){return/^(?:http|blob|data:|\/)/.test(e)}function kt(e){return/^data:(.+?);base64,/.test(e)}function de(e,t){return t.charAt(0)==="."?ut(e+t):ut(e.substring(0,e.lastIndexOf("/")+1)+t)}function ut(e){const t=[],s=e.split("/");for(let n=0;n<s.length;n++){const r=s[n];if(!(!r||r===".")){if(r===".."){t.length>0&&t.pop();continue}t.push(r)}}return t.join("/")}async function br(e,t){const s=JSON.parse(await e.text()),n=s.images,r={},a="",i=[];if(n)for(let o=0;o<n.length;o++){const c=n[o].uri;if(c)if(pe(c))i.push(fetch(c).then(h=>h.arrayBuffer()).then(h=>{r[c]=new Uint8Array(h)}));else{const h=de(a,c);i.push(t[h].arrayBuffer().then(f=>{r[c]=new Uint8Array(f)}))}}const l=s.buffers;if(l)for(let o=0;o<l.length;o++){const c=l[o].uri;if(c)if(!pe(c)&&!kt(c)){const h=de(a,c);i.push(t[h].arrayBuffer().then(f=>{r[c]=new Uint8Array(f)}))}else i.push(fetch(c).then(h=>h.arrayBuffer()).then(h=>{r[c]=new Uint8Array(h)}))}return await Promise.all(i),gs({json:s,resources:r})}async function vr(e){const t={uploadFiles:[],errors:[]};for(const s in e){const n=e[s],a=n.name.toLowerCase();if(a.endsWith(".glb")||a.endsWith(".fbx"))t.uploadFiles.push({main:n});else if(a.endsWith(".gltf")){const i=await Ar(n,e);typeof i=="string"?t.errors.push(i):t.uploadFiles.push(i)}}return t}async function Ar(e,t){const s=JSON.parse(await e.text()),n=s.images,r=s.buffers,a="",i={main:e,subFiles:{},postfix:".glb"};if(n)for(let l=0;l<n.length;l++){const u=n[l].uri;if(u&&!pe(u)){const c=de(a,u);if(t[c])i.subFiles[c]=t[c];else return`${u} is not found in the files.`}}if(r)for(let l=0;l<r.length;l++){const u=r[l].uri;if(u&&!pe(u)&&!kt(u)){const c=de(a,u);if(t[c])i.subFiles[c]=t[c];else return`${u} is not found in the files.`}}return i}async function _r(e,t){const s=Bt(e.main,"model.gltf"),n=s.name.replace(/\.[^.]+$/,".glb");if(s.name.toLocaleLowerCase().endsWith(".gltf")){const r=e.subFiles??{},a=await br(s,r);return new File([a.buffer],n)}return s}function Tr(e){const t=Object.entries(e.remapMaterials).filter(([,s])=>!!s);if(!t.length){e.settleInitCompleted();return}e.onInitComplete(async()=>{try{await Promise.all(t.map(([s,n])=>e.replaceMaterial(Number(s),n,!1)))}catch{}finally{e.settleInitCompleted()}})}async function Er(e){e.notifySuccess("Success. page will reload, please wait...");try{await e.assetFacade.persistAssetMetaImmediate(e.assetId),e.reload()}catch(t){e.logError("Failed to persist optimize config before reload",t),e.notifyError("Failed to save optimize config, reload canceled.")}}class je{static update(t,s){!this.entity&&(this.entity=t.createChild("glTF"));const n=this.tempCloneEntity=s.engineObject.instantiateSceneRoot();this.entity.addChild(n)}static clear(){this.entity.clearChildren(),this.tempCloneEntity&&this.tempCloneEntity.destroy()}}w(je,"entity"),w(je,"tempCloneEntity");var wr=Object.defineProperty,Ir=Object.getOwnPropertyDescriptor,z=(e,t,s,n)=>{for(var r=n>1?void 0:n?Ir(t,s):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(r=(n?i(t,s,r):i(r))||r);return n&&r&&wr(t,s,r),r};class j extends cs{constructor(){super();w(this,"animationNames",[]);w(this,"frameTime",0);w(this,"duration",0);w(this,"playing",!1);w(this,"animationIndex",0);w(this,"selectedClip");w(this,"_updateComponent");w(this,"_clips",[]);pt(this)}setViewAsset(s,n){const{animations:r=[]}=s.engineObject;this._clips=r,this.animationIndex=0,this.animationNames=r.map(i=>i.name),this._entity=s.instantiateEngineObject(),n.addChild(this._entity);const a=this;r.length>0&&(this._updateComponent=this._entity.addComponent(class extends Gt{onUpdate(i){a._onUpdate(i)}})),this.duration=0}stopViewAsset(){var s;super.stopViewAsset(),this.frameTime=0,this.pauseAnimation(),(s=this._updateComponent)==null||s.destroy(),this.animationNames=null}selectAnimation(s){this.selectedClip=this._clips[s],this.frameTime=0,this.duration=this.selectedClip.length,this.animationIndex=s,this._sampleAnimation()}setFrameTime(s){this.frameTime=s,this._sampleAnimation()}playAnimation(){this.selectedClip&&(this.playing=!0)}pauseAnimation(){this.playing=!1}_onUpdate(s){!this.playing||!this.selectedClip||!this.duration||(this.frameTime+=s,this.frameTime>this.duration&&(this.frameTime%=this.duration),this._sampleAnimation())}_sampleAnimation(){try{this.selectedClip._sampleAnimation(this._entity.children[0],this.frameTime)}catch(s){console.warn(s)}}}z([R],j.prototype,"animationNames",2);z([R],j.prototype,"frameTime",2);z([R],j.prototype,"duration",2);z([R],j.prototype,"playing",2);z([R],j.prototype,"animationIndex",2);z([G],j.prototype,"selectAnimation",1);z([G],j.prototype,"setFrameTime",1);z([G],j.prototype,"playAnimation",1);z([G],j.prototype,"pauseAnimation",1);z([G],j.prototype,"_onUpdate",1);var Mr=Object.defineProperty,Nr=Object.getOwnPropertyDescriptor,k=(e,t,s,n)=>{for(var r=n>1?void 0:n?Nr(t,s):t,a=e.length-1,i;a>=0;a--)(i=e[a])&&(r=(n?i(t,s,r):i(r))||r);return n&&r&&Mr(t,s,r),r};const ae=ts("gltf");let O=class extends ls{constructor(t){super(t);w(this,"exportedUrl","");w(this,"glTFInfo",{drawcall:void 0,triangles:void 0,issues:void 0});w(this,"remapMaterials",{});w(this,"animationEvents",{});w(this,"needComputeTangents",!0);w(this,"fbxUrl",null);w(this,"optimize",{meshopt:!1,meshQuantize:!1});w(this,"params",{keepMeshData:!1});w(this,"initCompleted");w(this,"_rootKey","defaultSceneRoot");w(this,"mappedMaterialsPath",[]);w(this,"_initCompletedResolve");w(this,"_autorunDisposer",null);w(this,"_propertyChangeListeners",new Map);pt(this),this.initCompleted=new Promise(s=>{this._initCompletedResolve=s})}applyMetaFromDomain(t){if(super.applyMetaFromDomain(t),"needComputeTangents"in t&&(this.needComputeTangents=t.needComputeTangents),"optimize"in t&&typeof t.optimize=="object"){const s=t.optimize;this.optimize={...this.optimize,...s}}}async generateSubAssets(){const t=this.engineObject;if(this._subAssets=[],t.meshes)for(let s=0;s<t.meshes.length;s++){const n=t.meshes[s];for(let r=0;r<n.length;r++){const a=await this.root.assetStore.createSubAsset("Mesh",n[r],this.id,`meshes[${s}][${r}]`);this._subAssets.push(a)}}if(t.textures)for(let s=0;s<t.textures.length;s++){const n=await this.root.assetStore.createSubAsset("Texture",t.textures[s],this.id,`textures[${s}]`);this._subAssets.push(n)}if(t.animations){for(let r=0;r<t.animations.length;r++){const a=t.animations[r],i=this.animationEvents[r];i&&i.forEach(o=>{a.addEvent(o.functionName,o.time,o.parameter)});const l=await this.root.assetStore.createSubAsset("AnimationClip",a,this.id,`animations[${r}]`);this._subAssets.push(l)}const s=t.defaultSceneRoot.getComponent(Wt).animatorController,n=await this.root.assetStore.createSubAsset("AnimatorController",s,this.id,"animatorController[0]");this._subAssets.push(n)}if(t.materials)for(let s=0;s<t.materials.length;s++){const n=await this.root.assetStore.createSubAsset("Material",t.materials[s],this.id,`materials[${s}]`);this._subAssets.push(n)}}async initByMain(t,s){const{engine:n,meta:r}=this;this.url=s,this.animationEvents=r.animationEvents||{},this.optimize=r.optimize??this.optimize;let a=this.optimize.meshopt,i=this.optimize.meshQuantize;this._autorunDisposer=Ht(()=>{const o=this.optimize.meshQuantize;i!==o&&(this.optimize.meshQuantize=o,i=o,this._saveMetaAndReload());const u=this.optimize.meshopt;a!==u&&(this.optimize.meshopt=u,a=u,this._saveMetaAndReload())}),this.params=r.params??this.params;let l;try{l=URL.createObjectURL(t),await this.initByUrl(l+"#.glb",n)}finally{l!==void 0&&URL.revokeObjectURL(l)}this.needComputeTangents=r.needComputeTangents??!0,Tr({remapMaterials:r.remapMaterials||{},onInitComplete:o=>{this.on("initcomplete",o)},replaceMaterial:async(o,u,c)=>{await this.replaceMaterial(o,u,c)},settleInitCompleted:()=>{this._initCompletedResolve()}}),this.fbxUrl=r.fbxUrl}_saveMetaAndReload(){Er({assetFacade:this.root.assetFacade,assetId:this.id,reload:()=>window.location.reload(),notifySuccess:t=>Fe.success(dt(t)),notifyError:t=>Fe.error(t),logError:(t,s)=>ae.error(t,s)})}resetMaterial(t){const s=this._engineObject.materials[t];this._internalReplaceMaterial(t,s),this.remapMaterials[t]=void 0,this.root.assetFacade.persistAssetMeta(this.id)}async replaceMaterial(t,s,n=!0){this.remapMaterials[t]=s;const r=this._findComponentsByMaterialPathIndex(t),a=await this.root.assetStore.getAssetByRef(s);if(a instanceof fs){const i=a.engineObject;r.forEach(({component:c,materialIndex:h})=>{c.setMaterial(h,i)});const l=String(t),o=this._propertyChangeListeners.get(l);o&&a.off("propertychange",o);const u=()=>{this.updateThumbnail()};this._propertyChangeListeners.set(l,u),a.on("propertychange",u)}else ae.warn(`${s.refId} shouldn't be selected`);n&&await this.root.assetFacade.persistAssetMeta(this.id),this.updateThumbnail()}updateAnimationEvents(t,s){this.animationEvents[t]=s,this.root.assetFacade.persistAssetMeta(this.id)}async instantiate(t){await this.initCompleted;const s=t.createByEngineObject(this.instantiateEngineObject());s.isGLTFWrapEntity=!0,s.isPrefabRefEntity=!1,await s.ensureReady();const n=s.selfChildren[0];return n?this.addInstance(n):ae.warn(`[GlTFAsset] instantiate: wrap entity has no child, skip addInstance. asset=${this.id}`),s}destroy(){var s;(s=this._autorunDisposer)==null||s.call(this),this._autorunDisposer=null,this._propertyChangeListeners.clear();const t=this.engineObject;t&&(t._defaultSceneRoot.destroy(),t.destroy()),super.destroy()}instantiateEngineObject(){const t=super.instantiateEngineObject(),s=new Xt(this.engine,this.name.replace(/\.glb$/g,""));return s.addChild(t),this._fixClonedSkins(t),s}_fixClonedSkins(t){const s=t.getComponentsIncludeChildren(Qt,[]);for(const n of s){const r=n.skin;if(r&&r.bones.length>0&&!r._skinMatrices){const a=r.bones;r.bones=a}}}_instantiateEngineObject(){return this.engineObject.instantiateSceneRoot()}_destroyInstances(){this._instances.forEach((t,s)=>{const n=t.entities.get(s);if(n){const r=n.parentEntity;r?r.destroy():n.destroy()}}),this._instances.clear()}_internalReplaceMaterial(t,s){this._findComponentsByMaterialPathIndex(t).forEach(({component:r,materialIndex:a})=>{r.setMaterial(a,s)}),this.updateThumbnail()}_findComponentsByMaterialPathIndex(t){const s=[...this._clonedEntities,this._engineObject.defaultSceneRoot],n=this.mappedMaterialsPath[t],r=[];if(!n)return ae.warn(`${this._name} replaced material not found.(gltf may be replaced either)`),r;for(let a=0;a<s.length;a++){const i=s[a];n.forEach(l=>{const u=Sr(l.entityPath,i).getComponents(De,[]);r.push({component:u[l.componentIndex],materialIndex:l.materialIndex})})}return r}async initByUrl(t,s){const n=await s.resourceManager.load({type:Kt.GLTF,url:t,params:this.params});return this.initMappedMaterialPath(n),this.bindEngineObject(n),this._updateDragTempEntity(),await this.generateSubAssets(),await this.initBasicInfo(n),this}async getRemappedMaterial(t){var n;const s=this.remapMaterials[t];return s?(n=await this.root.assetStore.getAssetByRef(s))==null?void 0:n.engineObject:this._engineObject.materials[t]}initMappedMaterialPath(t){const s=t.materials,n=t.defaultSceneRoot;if(s){const r=t.defaultSceneRoot.getComponentsIncludeChildren(qe,[]);s.forEach(a=>{const i=[];this.mappedMaterialsPath.push(i);for(let l=0;l<r.length;l++){const o=r[l],u=o.getMaterials(),c=o.entity.getComponents(De,[]);for(let h=0;h<u.length;h++)u[h]===a&&i.push({entityPath:Cr(o.entity,n),componentIndex:c.indexOf(o),materialIndex:h})}})}}async initBasicInfo(t){this.glTFInfo.drawcall=t.defaultSceneRoot.getComponentsIncludeChildren(qe,[]).length}};k([R,Jt()],O.prototype,"exportedUrl",2);k([W(),R],O.prototype,"remapMaterials",2);k([W()],O.prototype,"animationEvents",2);k([W(),R],O.prototype,"needComputeTangents",2);k([W(),R],O.prototype,"fbxUrl",2);k([W(),R],O.prototype,"optimize",2);k([W(),R],O.prototype,"params",2);k([Yt],O.prototype,"applyMetaFromDomain",1);k([G],O.prototype,"resetMaterial",1);O=k([Zt({type:"glTF",label:dt("asset.gltf.title"),loaderType:"GLTF",importMenuConfig:{type:es.Upload,tooltip:"请上传模型文件(支持gltf,glb,fbx,obj)或包含模型和资源文件(bin、贴图等)的zip压缩包",accept:".zip,.fbx,.gltf,.glb,application/json",subAccept:".bin,.jpeg,.jpg,.png",multiple:!0},filterUploadFiles:vr,preUpload:_r,extname:"glb",dragLayer:gt.GlTF,customInspector:yr,viewer:j,thumbnail:je,async preInitialize({main:e,meta:t,name:s}){const n=new Uint8Array(await e.arrayBuffer()),r=await _e.readBinary(n),a=t.optimize||{},i=t.needComputeTangents??!0,l=a.meshQuantize,o=a.meshopt,u=[],c=r.getRoot().listExtensionsUsed(),h=c.some(p=>p.extensionName===mt.EXTENSION_NAME),f=c.some(p=>p.extensionName===ie.EXTENSION_NAME);l&&!h&&u.push(Le({quantizePosition:16,quantizeNormal:12,quantizeTexcoord:14})),o&&!f&&(await le.ready,u.push(zt({encoder:le})));try{i&&(u.push(rr()),u.push(hr({generateTangents:window.mikktspace.generateTangents,overwrite:!0}))),await r.transform(...u)}catch(p){console.error("The gltf-transform plugin encountered some errors when performing meshopt, quantize, or calculating tangents, we have disabled these features automatically.",p)}const g=await _e.writeBinary(r);return new File([g.buffer],s,{type:"model/gltf-binary"})},async bundle({content:e,name:t,meta:s},n,r){var l;const a=new Uint8Array(await e.arrayBuffer()),i=await dr(a,_e,{name:t,remapMaterials:s.remapMaterials,animationEvents:s.animationEvents??{},textureOptions:(l=n.assetOptions)==null?void 0:l.textureOptions,optimizeOptions:s.optimize},{resolveRef:r?o=>r.resolveRef(o):void 0,ktx2Encode:(o,u)=>us.encode(o,u)});return{name:i.name,content:new Blob([i.content],{type:"model/gltf-binary"})}}})],O);function Cr(e,t){const s=[];for(;e!==t;)s.unshift(e.siblingIndex),e=e.parent;return s}function Sr(e,t){let s=t;for(let n=0;n<e.length;n++)s=s.children[e[n]];return s}const Ur=Object.freeze(Object.defineProperty({__proto__:null,get GlTFAsset(){return O}},Symbol.toStringTag,{value:"Module"}));export{O as G,j as a,Ur as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{aH as a}from"./index-aec7e708.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 e=a("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"}]]);export{e as I};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{aG as e}from"./index-aec7e708.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 o=e("filled","point-filled","IconPointFilled",[["path",{d:"M12 7a5 5 0 1 1 -4.995 5.217l-.005 -.217l.005 -.217a5 5 0 0 1 4.995 -4.783z",key:"svg-0"}]]);export{o as I};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var m=Object.defineProperty;var u=(r,e,o)=>e in r?m(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o;var p=(r,e,o)=>(u(r,typeof e!="symbol"?e+"":e,o),o);import{a as n,s as y,aM as v,p as c,C as g,l as P,f as b,h as f,g as C,E as L,d as _}from"./index-aec7e708.js";import"./index-e8a45e82.js";var x=Object.defineProperty,M=Object.getOwnPropertyDescriptor,h=(r,e,o,l)=>{for(var a=l>1?void 0:l?M(e,o):e,s=r.length-1,i;s>=0;s--)(i=r[s])&&(a=(l?i(e,o,a):i(a))||a);return l&&a&&x(e,o,a),a};const t=[n.Everything,n.Nothing];class d extends L{constructor(){super(...arguments);p(this,"color",{r:1,g:1,b:1,a:1,intensity:1});p(this,"cullingMask",_(n.Everything,t))}}h([y(v()),c({label:"light.color",type:g.Color,mode:"hdr",bindPath:"color"})],d.prototype,"color",2);h([y(P(t)),b(f(t)),c({label:"light.culling-mask",type:g.Select,...C(t),bindPath:"cullingMask"})],d.prototype,"cullingMask",2);export{d as L};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=Object.defineProperty;var c=(o,e,t)=>e in o?f(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var p=(o,e,t)=>(c(o,typeof e!="symbol"?e+"":e,t),t);import{L as g}from"./module-8816772d.js";import{E as b,p as l,C as a,s}from"./index-aec7e708.js";import"./index-e8a45e82.js";import{c as P}from"./Component-ed7aa0ab.js";import"./postmen-2f47f6bb.js";var d=Object.defineProperty,L=Object.getOwnPropertyDescriptor,n=(o,e,t,y)=>{for(var i=y>1?void 0:y?L(e,t):e,u=o.length-1,m;u>=0;u--)(m=o[u])&&(i=(y?m(e,t,i):m(i))||i);return y&&i&&d(e,t,i),i};let r=class extends b{constructor(e,t){super(e,t);p(this,"resource",null);p(this,"autoPlay",!0);p(this,"isLooping",!0);p(this,"speed",1);p(this,"priority",0)}};n([l({label:"lottie.resource.label",info:"lottie.resource.info",type:a.AssetPicker,assetType:"Lottie",bindPath:"resource"}),s()],r.prototype,"resource",2);n([l({label:"lottie.auto-play.label",info:"lottie.auto-play.info",type:a.Toggle,bindPath:"autoPlay",onChange(o,e,t){t||o.engineObject.pause()}}),s()],r.prototype,"autoPlay",2);n([l({label:"lottie.is-looping.label",info:"lottie.is-looping.info",type:a.Toggle,bindPath:"isLooping"}),s()],r.prototype,"isLooping",2);n([l({label:"lottie.speed.label",info:"lottie.speed.info",type:a.Number,dragStep:.01,bindPath:"speed"}),s()],r.prototype,"speed",2);n([l({label:"lottie.priority.label",info:"lottie.priority.info",type:a.Number,bindPath:"priority"}),s()],r.prototype,"priority",2);r=n([P({type:"LottieAnimation",external:!0,componentsMenu:{group:"2D",label:"component.lottie-animation.title"}})],r);b.registerCustomEngineComponent("LottieAnimation",g);export{r as LottieAnimationComponent};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
var H=Object.defineProperty;var K=(i,s,t)=>s in i?H(i,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[s]=t;var c=(i,s,t)=>(K(i,typeof s!="symbol"?s+"":s,t),t);import{aG as Y,j as E,n as q,aO as Z,aR as Q,aS as M,e5 as $,aQ as k,aU as D,aV as tt,aP as et,aX as st,dC as at,c7 as it,by as F,ce as L,u as ot,S as rt,x as P,aL as G,an as B,a0 as x,e as m,_ as nt,cb as V,p as v,C as _,a$ as O,o as lt,q as pt,cd as R}from"./index-aec7e708.js";import{L as J}from"./module-8816772d.js";import{u as ct}from"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";import{c as mt}from"./SpriteAsset-558ffca8.js";import{A as ut}from"./AssetViewer-64cd01fa.js";import{c as W,S as dt}from"./SpriteAtlasAsset-cdc34386.js";import{c as ht}from"./TextureAsset-39fb07fe.js";import"./meshopt_simplifier.module-cd99529d.js";import"./bundlers-9b0d37fc.js";import"./FormItemArray-6d69acd4.js";import"./Accordion-3d330bc6.js";import"./IconEdit-ab77303f.js";import"./enum-58295f88.js";import"./encode-ac4bb64e.js";import"./Tooltip-82063435.js";import"./ktx2-encoder-53b21bdc.js";import"./TaskQueue-05c94a4d.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 ft=Y("outline","minus","IconMinus",[["path",{d:"M5 12l14 0",key:"svg-0"}]]),yt=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,wt=(i,s,t,e)=>{for(var a=e>1?void 0:e?gt(s,t):s,o=i.length-1,r;o>=0;o--)(r=i[o])&&(a=(e?r(s,t,a):r(a))||a);return e&&a&&yt(s,t,a),a};let z=class extends E{initByMain(i,s){return Promise.resolve()}};z=wt([q({type:"LottieAnimation",async bundle(i){const s=JSON.parse(await i.content.text());return{content:new Blob([JSON.stringify(s)])}}})],z);const bt=Z("div",{display:"grid",columnGap:"$1",gridColumn:2/-1,gridTemplateColumns:"minmax(0, 4fr) repeat(1, 2fr) repeat(1, auto) repeat(1, 2fr) repeat(1, auto)",marginBottom:"$1"}),vt=function({clip:i,removeClip:s,onClipChange:t}){const{t:e}=Q();return M.jsxs(bt,{children:[M.jsx($,{size:"sm",value:i.name??"",placeholder:e("lottie.clip.name"),onChange:a=>{t({name:a.currentTarget.value})}}),M.jsx($,{size:"sm",value:i.start??"",placeholder:e("lottie.clip.start"),onChange:a=>{t({start:+a.currentTarget.value})}}),M.jsx(ft,{width:12,onClick:s}),M.jsx($,{size:"sm",value:i.end??"",placeholder:e("lottie.clip.end"),onChange:a=>{t({end:+a.currentTarget.value})}})]})},Mt=k(function(i){const s=i.model,t=s.getViewer(),{inspectorFacade:e}=ct(),{t:a}=Q(),[o,r]=D.useState(()=>Array.isArray(s.clips)?[...s.clips]:[]);D.useEffect(()=>{r(Array.isArray(s.clips)?[...s.clips]:[])},[s,s.clips]),D.useEffect(()=>{t==null||t.setClips(o)},[o,t]);const p=n=>{r(n),e.assetChange(s.id,"clips",n,"asset-meta")},l=()=>{p([...o,{}])},d=n=>{n<0||n>=o.length||p(o.filter((u,y)=>y!==n))},h=(n,u)=>{if(n<0||n>=o.length)return;const y={...o[n],...u},C=o.map((A,b)=>b===n?y:A);p(C)};return M.jsxs(tt,{title:a("lottie.clips.title"),defaultOpen:!0,collapsible:!0,children:[o.map((n,u)=>M.jsx(vt,{clip:n,removeClip:()=>d(u),onClipChange:y=>h(u,y)},`${s.id}-${u}`)),M.jsx(et,{align:"h",css:{margin:"0 auto",padding:"$1 0 0 0"},children:M.jsx(st,{size:"sm",variant:"soft",startSlot:M.jsx(at,{size:"14px"}),onClick:l,children:a("lottie.clips.add")})})]})});async function xt(i,s,t={}){try{const e=JSON.parse(i),{assets:a}=e,o=[];for(let p=0,l=a.length;p<l;p++){const d=a[p],{p:h}=d;h&&o.push({name:d.id,src:h})}const r=await mt(o,{width:2048,height:2048,...t});return r.code!==0?(console.log("Atlas Error:",r.msg),r):(e.assets=a.filter(p=>!p.p),r.info.jsonFile=JSON.stringify(e),r)}catch{return{code:11,msg:"Parse lottie file error"}}}async function _t(i){const s={uploadFiles:[],errors:[]};for(const t in i){const e=i[t],a=e.name;if(a.endsWith(".json"))try{const o=await e.text(),r=JSON.parse(o);St(r)&&s.uploadFiles.push({main:e})}catch(o){s.errors.push(X(a,o))}}return s}async function Ct(i,s,t){const e=it(i.main,"lottie.json"),a=await e.text();let o;try{o=JSON.parse(a)}catch(l){return console.error(l),F.error(X(e.name,l)),e}const{nm:r}=o,p=await xt(a);if(p.code===0)try{const{imageFiles:l,atlasFile:d,jsonFile:h}=p.info,n=JSON.parse(d),{atlasItems:u}=n,y=u.length,C=jt(),A=At(r,e.name),b=[];for(let g=0;g<y;++g)l[g]&&b.push(L.uploadBlob(`${A}-${C}-${g}.png`,new Blob([l[g]])));const U=await Promise.all(b);for(let g=0;g<y;++g)u[g].img=U[g].url;const[S,T]=await Promise.all([L.uploadBlob(`${A}-${C}.atlas`,new Blob([JSON.stringify(n)])),L.uploadBlob(`${A}-${C}.json`,new Blob([h]))]),N={jsonUrl:T.url,atlasUrl:S.url};return new File([JSON.stringify(N)],e.name)}catch(l){console.error(l),F.error(`parse lottie file fail ${l}`)}else console.error(p.msg),F.error(p.msg);return e}function St(i){return i.nm&&i.w&&i.h&&i.assets&&i.assets.length>0&&i.layers&&i.layers.length>0}function jt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2,10)}function At(i,s){const t=s.replace(/\.[^.]+$/,"")||"lottie";return(typeof i=="string"&&i.length>0?i:t).trim().replace(/[^\w.-]+/g,"_")||"lottie"}function X(i,s){const t=s instanceof Error?s.message:String(s);return`Failed to parse JSON file "${i}": ${t}`}var Ot=Object.defineProperty,It=Object.getOwnPropertyDescriptor,I=(i,s,t,e)=>{for(var a=e>1?void 0:e?It(s,t):s,o=i.length-1,r;o>=0;o--)(r=i[o])&&(a=(e?r(s,t,a):r(a))||a);return e&&a&&Ot(s,t,a),a};class j extends ut{constructor(){super();c(this,"lottie");c(this,"_updateComponent");c(this,"_lottieAsset");c(this,"playing",!1);c(this,"frameTime",0);c(this,"animationNames",[]);c(this,"animationIndex",0);c(this,"_hasClips",!1);ot(this)}get duration(){const{_lottieAsset:t}=this;return this._hasClips&&t.clips[this.animationIndex]?t.clips[this.animationIndex].end-t.clips[this.animationIndex].start:this._lottieAsset.duration}_setAnimationNames(t){this.animationNames=this._hasClips?t==null?void 0:t.map(e=>e.name):[this._lottieAsset.engineObject.name]}setViewAsset(t,e){const a=t.engineObject,o=e.createChild("lottie_entity"),r=o.addComponent(J);this._entity=o,this.lottie=r,r.resource=a,this._lottieAsset=t,this._hasClips=t.clips&&t.clips.length>0,this._setAnimationNames(t.clips),this.animationIndex=0;const p=this;this._updateComponent=this._entity.addComponent(class extends rt{onUpdate(l){p._onUpdate()}}),this.frameTime=0}getSize(){var t;if((t=this.lottie)!=null&&t.resource){const{width:e,height:a}=this.lottie.resource;return{width:e/100,height:a/100}}return{width:0,height:0}}stopViewAsset(){var t;super.stopViewAsset(),this.lottie=null,(t=this._updateComponent)==null||t.destroy(),this.animationNames=null}setClips(t){this.lottie.resource.setClips(t),this._setAnimationNames(t)}play(t){this.lottie.isLooping=!0,this.lottie.play(t),this.playing=!0}pauseAnimation(){this.lottie.pause(),this.playing=!1}selectAnimation(t){this.animationIndex=t;const e=this._lottieAsset.clips[t];this.play(e==null?void 0:e.name)}playAnimation(){const t=this._lottieAsset.clips[this.animationIndex];this.play(t==null?void 0:t.name)}setFrameTime(t){}_onUpdate(){this.playing&&(this.frameTime=this.lottie.frame)}}I([P],j.prototype,"playing",2);I([P],j.prototype,"frameTime",2);I([P],j.prototype,"animationNames",2);I([P],j.prototype,"animationIndex",2);I([G],j.prototype,"play",1);I([G],j.prototype,"pauseAnimation",1);I([G],j.prototype,"_onUpdate",1);var Ut=Object.defineProperty,Bt=Object.getOwnPropertyDescriptor,w=(i,s,t,e)=>{for(var a=e>1?void 0:e?Bt(s,t):s,o=i.length-1,r;o>=0;o--)(r=i[o])&&(a=(e?r(s,t,a):r(a))||a);return e&&a&&Ut(s,t,a),a};let f=class extends E{constructor(s){super(s);c(this,"textureSet",new Set);c(this,"width",0);c(this,"height",0);c(this,"duration",0);c(this,"inPoint",0);c(this,"outPoint",0);c(this,"clips",[]);c(this,"mipmap",!1);c(this,"colorDilate",!1);c(this,"filterMode",B.Bilinear);c(this,"wrapModeU",x.Repeat);c(this,"wrapModeV",x.Repeat);c(this,"runtimeOptions",{overwrite:!1,textureType:"ktx2",mode:"ETC1S",quality:150,isNormal:!1});this.formSchema.addGroup(m("lottie.asset.atlas-export"),["filterMode","wrapModeU","wrapModeV","mipmap","colorDilate"])}destroy(){super.destroy(),this.textureSet.clear(),this.textureSet=null}async initByUploadFile(s){return await this._initByUrl(this.engine,s),this}async initByMain(s){const{engine:t,meta:e}=this;e.runtimeOptions&&(this.runtimeOptions=e.runtimeOptions),this.clips=e.clips||[],this.filterMode=e.filterMode??this.filterMode,this.wrapModeU=e.wrapModeU??this.wrapModeU,this.wrapModeV=e.wrapModeV??this.wrapModeV,this.mipmap=e.mipmap??this.mipmap,this.colorDilate=e.colorDilate??this.colorDilate,await this._initByUrl(t,s);const a=new nt(this.engine),o=a.addComponent(J);o.resource=this.engineObject,this.setDragTempEntity(a)}instantiate(){const s=this.root.sceneStore.createEntity(),t=this.getDragTempEntity(),{position:e,rotation:a}=t.transform,o={components:[{class:"LottieAnimation",id:V(),props:{resource:this.getCurrentRef(),priority:0,defaultState:{}}}],id:s.id,isActive:!0,isClone:!1,name:this.name?this.name:"lottie",transform:{class:"Transform",props:{position:{x:e.x,y:e.y,z:e.z},rotation:{x:a.x,y:a.y,z:a.z},scale:{x:1,y:1,z:1}}}};return s.initByFile(o),s}async _createLottieResource(s,t,e){return(await s.resourceManager.load({urls:[t,e],type:"lottie"})).getComponent(J).resource}async _initByUrl(s,t){const e=JSON.parse(await t.text()),{jsonUrl:a,atlasUrl:o}=e,r=await this._createLottieResource(s,a,o);this.bindEngineObject(r);const{sprites:p}=r.atlas,{textureSet:l}=this;for(let d=0,h=p.length;d<h;++d){const n=p[d].texture;l.has(n)||(l.add(n),n.filterMode=this.filterMode,n.wrapModeU=this.wrapModeU,n.wrapModeV=this.wrapModeV)}return this.width=r.width,this.height=r.height,this.duration=r.duration,this.inPoint=r.inPoint,this.outPoint=r.outPoint,this}};w([v({type:_.Input,disabled:!0,label:m("lottie.asset.width")})],f.prototype,"width",2);w([v({type:_.Input,disabled:!0,label:m("lottie.asset.height")})],f.prototype,"height",2);w([v({type:_.Input,disabled:!0,label:m("lottie.asset.duration")})],f.prototype,"duration",2);w([v({type:_.Input,disabled:!0,label:m("lottie.asset.in-point")})],f.prototype,"inPoint",2);w([v({type:_.Input,disabled:!0,label:m("lottie.asset.out-point")})],f.prototype,"outPoint",2);w([v({disabled:!0,customComponent:Mt}),O()],f.prototype,"clips",2);w([v({label:m("lottie.asset.mipmap"),type:_.Toggle}),O()],f.prototype,"mipmap",2);w([v({label:m("lottie.asset.color-dilate"),type:_.Toggle}),O()],f.prototype,"colorDilate",2);w([v({label:m("lottie.asset.filter-mode.title"),type:_.Select,value:B.Bilinear,options:[{label:m("lottie.asset.filter-mode.point"),value:B.Point},{label:m("lottie.asset.filter-mode.bilinear"),value:B.Bilinear},{label:m("lottie.asset.filter-mode.trilinear"),value:B.Trilinear}],onChange(i,s,t){const{textureSet:e}=i;e.forEach(a=>{a.filterMode=t})}}),O()],f.prototype,"filterMode",2);w([v({label:m("lottie.asset.wrap-mode.u"),type:_.Select,value:x.Repeat,options:[{label:m("lottie.asset.wrap-mode.clamp"),value:x.Clamp},{label:m("lottie.asset.wrap-mode.repeat"),value:x.Repeat},{label:m("lottie.asset.wrap-mode.mirror"),value:x.Mirror}],onChange(i,s,t){const{textureSet:e}=i;e.forEach(a=>{a.wrapModeU=t})}}),O()],f.prototype,"wrapModeU",2);w([v({label:m("lottie.asset.wrap-mode.v"),type:_.Select,value:x.Repeat,options:[{label:m("lottie.asset.wrap-mode.clamp"),value:x.Clamp},{label:m("lottie.asset.wrap-mode.repeat"),value:x.Repeat},{label:m("lottie.asset.wrap-mode.mirror"),value:x.Mirror}],onChange(i,s,t){const{textureSet:e}=i;e.forEach(a=>{a.wrapModeV=t})}}),O()],f.prototype,"wrapModeV",2);w([P,O()],f.prototype,"runtimeOptions",2);f=w([q({type:"Lottie",label:m("asset.lottie.title"),loaderType:"EditorLottie",importMenuConfig:{type:lt.Upload,accept:".json"},viewer:j,filterUploadFiles:_t,preUpload:Ct,dragLayer:pt.Lottie,customInspector:ht,async bundle(i,s,t){var N,g;const e=JSON.parse(await i.content.text()),a=i.meta,{jsonUrl:o,atlasUrl:r}=e,p=R(i.name).split(".")[0],l=i.dependencies||(i.dependencies=[]),d=t.vfs,h=((N=l[0])==null?void 0:N.ref.refId)??V();let n;l[0]||(l[0]={key:"atlasUrl",ref:{refId:h}});let u=d.getFileById(h);u?n=u.meta:(n=W(h,E.getRegisteredAssetMeta(dt).type,s,{ignorePack:!0}),t.addFile({name:p+"_atlas.atlas",assetId:h,url:null,parentId:i.parentId,main:null,meta:n}),u=d.getFileById(h),u.ignoreBundle=!0),n.colorDilate=a.colorDilate,n.filterMode=a.filterMode,n.wrapModeU=a.wrapModeU,n.wrapModeV=a.wrapModeV,n.mipmap=a.mipmap;const y=i.meta.runtimeOptions;let C=s.assetOptions.textureOptions;y!=null&&y.overwrite&&(C=Object.assign({},C,y)),n.runtimeOptions=C;const A=await(await fetch(r)).json();t.updateFile(h,{main:new Blob([JSON.stringify(A)]),meta:n}),await t.bundleSingleFile(u,s),e.atlasUrl="./"+R(u.exportPath);const b=((g=l[1])==null?void 0:g.ref.refId)??V();let U;l[1]||(l[1]={key:"jsonUrl",ref:{refId:b}});let S=d.getFileById(b);S?U=S.meta:(U=W(b,E.getRegisteredAssetMeta(z).type,s),t.addFile({name:p+"_clip.json",assetId:b,url:null,parentId:i.parentId,main:null,meta:U}),S=d.getFileById(b),S.ignoreBundle=!0);const T=await(await fetch(o)).json();return T.lolitaAnimations=a.clips,t.updateFile(b,{main:new Blob([JSON.stringify(T)])}),await t.bundleSingleFile(S,s),e.jsonUrl="./"+R(S.exportPath),{content:new Blob([JSON.stringify(e)])}}})],f);export{f as LottieAsset};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=Object.defineProperty;var u=(e,t,o)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var p=(e,t,o)=>(u(e,typeof t!="symbol"?t+"":t,o),o);import{j as d,u as m,w as b,x as h,n as w,e as f,o as y}from"./index-aec7e708.js";import"./index-e8a45e82.js";import"./postmen-2f47f6bb.js";var v=Object.defineProperty,D=Object.getOwnPropertyDescriptor,l=(e,t,o,r)=>{for(var n=r>1?void 0:r?D(t,o):t,s=e.length-1,a;s>=0;s--)(a=e[s])&&(n=(r?a(t,o,n):a(n))||n);return r&&n&&v(t,o,n),n};let i=class extends d{constructor(t){super(t);p(this,"content","");m(this),this.onDoubleClick=this.onDoubleClick.bind(this)}async initByMain(t){this.content=await t.text()}async initByCreation(){return""}getMainData(){return this.content}onDoubleClick(){b(this.root.projectStore.id,this.id)}};l([h],i.prototype,"content",2);i=l([w({type:"Markdown",label:f("asset.markdown.title"),defaultName:"Document.md",extname:"md",importMenuConfig:{type:y.Add},bundle({content:e}){return{content:new Blob([e],{type:"text/markdown; charset=utf-8"})}}})],i);export{i as MarkdownAsset};
|