@limrun/ui 0.21.0 → 0.22.0
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/README.md +36 -8
- package/dist/BufferGeometryUtils-Dm5SmmmT.mjs +64 -0
- package/dist/BufferGeometryUtils-Dne8i0aT.js +1 -0
- package/dist/GLTFLoader-DzSwAt9C.js +1 -0
- package/dist/{GLTFLoader-D4AITfgZ.mjs → GLTFLoader-L51A9w-A.mjs} +138 -137
- package/dist/components/device-view.d.ts +29 -0
- package/dist/components/duo-frame.d.ts +5 -1
- package/dist/components/duo-model.d.ts +2 -1
- package/dist/components/macbook-frame.d.ts +30 -0
- package/dist/components/macbook-geometry.d.ts +77 -0
- package/dist/components/model-source.d.ts +8 -0
- package/dist/components/remote-control.d.ts +40 -1
- package/dist/components/studio-environment.d.ts +6 -0
- package/dist/core/mac-pointer.d.ts +56 -0
- package/dist/{core-CRIachT9.mjs → core-nbvkIrvp.mjs} +24 -24
- package/dist/core.js +12 -12
- package/dist/duo-frame-CHI6g7BR.mjs +758 -0
- package/dist/duo-frame-Cj-xHHW3.js +11 -0
- package/dist/duo-model-BYgtCaCR.mjs +4 -0
- package/dist/duo-model-CDWgmLRF.js +1 -0
- package/dist/duo-model.d.ts +2 -0
- package/dist/{duo-view-BeqYIqfQ.mjs → duo-view-Biy9MAlH.mjs} +84 -86
- package/dist/duo-view-D0Ndj2Ee.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +32 -25
- package/dist/lite.cjs +1 -1
- package/dist/lite.js +2 -2
- package/dist/macbook-frame-BHQtQNGV.mjs +349 -0
- package/dist/macbook-frame-CQyZhRFn.js +3 -0
- package/dist/macbook-model-BiMxLpmf.mjs +4 -0
- package/dist/macbook-model-BpUdvtlU.js +1 -0
- package/dist/macbook-model.d.ts +2 -0
- package/dist/meshopt_decoder.module-C4Z_evpr.mjs +217 -0
- package/dist/meshopt_decoder.module-DxJdu6ez.js +1 -0
- package/dist/{duo-frame-D1JK_cRk.mjs → model-source-BjSq5Any.mjs} +5353 -6125
- package/dist/model-source-S12HoOoQ.js +4049 -0
- package/dist/remote-control-BGKETUbE.mjs +1746 -0
- package/dist/remote-control-OLgfUSR1.js +1 -0
- package/package.json +1 -1
- package/dist/GLTFLoader-C25N9Y4j.js +0 -1
- package/dist/duo-frame-B1NXSk6a.js +0 -4059
- package/dist/duo-view-PsR5b045.js +0 -1
- package/dist/remote-control-DNr0Pyrx.js +0 -1
- package/dist/remote-control-rdm3mDtI.mjs +0 -1299
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require('./index.css');const g=require("react/jsx-runtime"),r=require("./core-BCBQrYsk.js"),l=require("react"),Qo=require("react-dom"),te={sideBezel:1.7,topBezel:2.4,chin:2.4,baseHeight:2.2,baseOverhang:4,screenRadius:.9,lidThickness:.7},kt=100+2*te.sideBezel,it=kt+2*te.baseOverhang,Dt=te.topBezel+te.chin+te.baseHeight,en=(Dt-2*te.topBezel)/2,tn=8;function on(d){const t=100/d,s=t+te.topBezel+te.chin;return{screenHeight:t,lidHeight:s,depth:s}}const nn=Math.PI/2,rn=135,sn=100,cn=2400;function an(d){return nn-d*Math.PI/180}function ln(d){const t=Math.max(0,Math.min(1,d));return 1-Math.pow(1-t,3)}function Ye(d,t,s,u=6){const v=[],A=[[d/2-s.top,t/2-s.top,s.top,0],[-d/2+s.top,t/2-s.top,s.top,Math.PI/2],[-d/2+s.bottom,-t/2+s.bottom,s.bottom,Math.PI],[d/2-s.bottom,-t/2+s.bottom,s.bottom,Math.PI*1.5]];for(const[p,E,M,x]of A)for(let k=0;k<=u;k++){const R=x+k*Math.PI/2/u;v.push({x:p+M*Math.cos(R),y:E+M*Math.sin(R),nx:Math.cos(R),ny:Math.sin(R)})}return v}function dn(d){const{screenHeight:t,lidHeight:s,depth:u}=on(d),v=[],A=(m,T,O)=>v.push({part:m,kind:T,vertices:new Float32Array(O)}),p=(m,T,O,L,P)=>{const Y=O.map(Z=>Z.x),U=O.map(Z=>Z.y),[ie,q,ue,F]=[Math.min(...Y),Math.max(...Y),Math.min(...U),Math.max(...U)],G=(ie+q)/2,N=(ue+F)/2,be=(Z,j)=>[...L(Z,j),...P,(Z-ie)/(q-ie||1),(j-ue)/(F-ue||1)],rt=[];for(let Z=0;Z<O.length;Z++){const j=O[Z],Me=O[(Z+1)%O.length];for(const We of[be(G,N),be(j.x,j.y),be(Me.x,Me.y)])rt.push(...We)}A(m,T,rt)},E=(m,T,O,L,P,Y,U)=>{const ie=[];for(let q=0;q<O.length;q++){const ue=O[q],F=O[(q+1)%O.length],G=(N,be)=>[...L(N.x,N.y,be),...P(N.nx,N.ny),0,0];for(const N of[G(ue,Y),G(F,Y),G(F,U),G(ue,Y),G(F,U),G(ue,U)])ie.push(...N)}A(m,T,ie)},M=Ye(kt,s,{top:2.2,bottom:.4}),x=m=>m+s/2,k=te.lidThickness;E("lid","shell",M,(m,T,O)=>[m,x(T),O],(m,T)=>[m,T,0],-k,0),p("lid","shell",M,(m,T)=>[m,x(T),-k],[0,0,-1]),p("lid","glass",Ye(kt-.5,s-.5,{top:1.95,bottom:.2}),(m,T)=>[m,x(T),.01],[0,0,1]);const R=te.chin;p("lid","screen",Ye(100,t,{top:te.screenRadius,bottom:0}),(m,T)=>[m,R+t/2+T,.02],[0,0,1]),p("lid","camera",Ye(.5,.5,{top:.25,bottom:.25},4),(m,T)=>[m,s-te.topBezel/2+T,.02],[0,0,1]);const H=Ye(it,u+k,{top:3,bottom:3}),K=m=>(u-k)/2-m;E("base","shell",H,(m,T,O)=>[m,O,K(T)],(m,T)=>[m,0,-T],-2.2,0),p("base","shell",H,(m,T)=>[m,0,K(T)],[0,1,0]),p("base","shell",H,(m,T)=>[m,-2.2,K(T)],[0,-1,0]);const oe=(m,T,O,L,P,Y,U)=>p("base",m,Ye(L,P,{top:U,bottom:U},3),(ie,q)=>[T+ie,Y,O-q],[0,1,0]),ve=it*.72,ae=u*.08,I=[.55,1,1,1,1,1],ne=u*.4/I.reduce((m,T)=>m+T,0);oe("well",0,ae+u*.4/2,ve+1.4,u*.4+1.4,.01,.8);let $=ae;for(const[m,T]of I.entries()){const O=T*ne,L=ve/14;for(let P=0;P<14;P++){if(m===5&&P>4&&P<9)continue;const Y=m===5&&P===4?5:1;oe("keys",-ve/2+L*(P+Y/2),$+O/2,L*Y-.5,O-.5,.03,.3)}$+=O}oe("trackpad",0,u*.72,it*.4,u*.36,.01,1.2),p("base","scoop",Ye(14,.9,{top:0,bottom:.45},3),(m,T)=>[m,-.45+T,u+.01],[0,0,1]);const D=new Map;for(const m of v){const T=`${m.part}:${m.kind}`;D.set(T,[...D.get(T)??[],m])}return[...D.values()].map(m=>{const T=new Float32Array(m.reduce((L,P)=>L+P.vertices.length,0));let O=0;for(const L of m)T.set(L.vertices,O),O+=L.vertices.length;return{part:m[0].part,kind:m[0].kind,vertices:T}})}function un(d,t,s=0){const u=1-s,v=t/u,A=d>=v?1:d/v,p=(d>=v?v/d:1)*u,E=(1-A)/2,M=s>0?u-p:(u-p)/2;return{repeat:[1/A,1/p],offset:[(0-E)/A,(0-M)/p]}}function hn(d,t,s){const u=d*s.repeat[0]+s.offset[0],v=t*s.repeat[1]+s.offset[1],A=1e-9;if(u<-A||u>1+A||v<-A||v>1+A)return;const p=E=>Math.max(0,Math.min(1,E));return{x:p(u),y:p(1-v)}}const fn=150,mn=8;class pn{constructor(t,s=()=>!1){this.send=t,this.blocked=s}send;blocked;last;gesture;screen;pointer(t,s,u){const v=t===r.MAC_INPUT_ACTION.UP&&!!this.last?.buttons;this.blocked()&&!v||(this.last={...s,buttons:u},this.send(r.createMouseControlMessage(t,s.width,s.height,s.x,s.y,u)))}scroll(t,s,u){this.blocked()||this.send(r.createMacScrollMessage(t.width,t.height,t.x,t.y,s,u))}touch(t,s,u){const v=this.gesture;if(s.length>=2){const p={x:s.reduce((E,M)=>E+M.x,0)/s.length,y:s.reduce((E,M)=>E+M.y,0)/s.length};if(v?.mode==="scroll"){const E=u.map(p.x,p.y);E&&t==="touchmove"&&this.scroll(E,(v.x-p.x)*u.scale,(v.y-p.y)*u.scale)}else v?.mode==="press"?this.lift(v,u):v?.mode==="pending"&&clearTimeout(v.timer);return this.gesture={mode:"scroll",...p},!1}const A=s[0];if(A&&t==="touchstart"&&!v)return this.blocked()||!u.contains(A.x,A.y)?!1:(this.screen=u,this.gesture={mode:"pending",x:A.x,y:A.y,timer:setTimeout(()=>this.press(),fn)},!0);if(A&&v?.mode==="pending"){if(Math.hypot(A.x-v.x,A.y-v.y)<mn)return!1;this.press()}if(A&&this.gesture?.mode==="press"){this.gesture={mode:"press",x:A.x,y:A.y};const p=u.map(A.x,A.y);return p&&this.pointer(r.MAC_INPUT_ACTION.MOVE,p,1),!1}if(s.length===0){v?.mode==="pending"&&(t==="touchcancel"?clearTimeout(v.timer):this.press());const p=this.gesture;p?.mode==="press"&&this.lift(p,u),this.gesture=void 0}return!1}release(){clearTimeout(this.gesture?.timer),this.gesture=void 0;const t=this.last;t?.buttons&&this.pointer(r.MAC_INPUT_ACTION.UP,t,0)}press(){const t=this.gesture;if(t?.mode!=="pending")return;clearTimeout(t.timer),this.gesture={mode:"press",x:t.x,y:t.y};const s=this.screen?.map(t.x,t.y);s&&this.pointer(r.MAC_INPUT_ACTION.DOWN,s,1)}lift(t,s){const u=s.map(t.x,t.y);u&&this.pointer(r.MAC_INPUT_ACTION.UP,u,0)}}function gn(d,t){return t.type==="choose"?t.mode===d.mode?d:t.mode==="3d"?{...d,mode:"3d",selection:d.selection+1}:{...d,mode:"2d"}:d.mode!=="3d"||t.selection!==d.selection||d.ready===t.selection?d:{...d,ready:t.selection}}function yo(d){const[t,s]=l.useReducer(gn,{mode:"2d",selection:0,ready:0}),u=l.useRef(t);u.current=t;const v=l.useRef(d);v.current=d;const{mode:A,selection:p,ready:E}=t,M=l.useCallback(R=>s({type:"choose",mode:R}),[]),x=l.useCallback(()=>{const R=u.current;R.mode!=="3d"||R.selection!==p||R.ready===p||(v.current?.(),s({type:"ready",selection:p}))},[p]),k=A==="3d"&&E!==p;return{mode:A,shown:A==="3d"&&!k?"3d":"2d",loading:k,choose:M,onReady:x}}function vo({view:d,label:t}){return g.jsxs("div",{className:"rc-duo-mode",role:"group","aria-label":t,children:[g.jsx("button",{type:"button","aria-pressed":d.mode==="2d",onClick:()=>d.choose("2d"),children:"2D"}),g.jsx("button",{type:"button","aria-pressed":d.mode==="3d","aria-busy":d.loading,title:d.loading?"Loading 3D":void 0,onClick:()=>d.choose("3d"),children:"3D"})]})}const yn=async d=>{if(!d)return!1;try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(d),!0}catch{}try{const t=document.createElement("textarea");t.value=d,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const s=document.execCommand("copy");return document.body.removeChild(t),s}catch{return!1}},vn=l.memo(function({element:t,screen:s,highlighted:u,selected:v,selectable:A,onClick:p}){const E=r.clampAxFrameForScreen(t.frame,s);if(!E)return null;const M=r.axElementSummary(t);return g.jsx("button",{type:"button",className:t.enabled?"rc-inspect-box":"rc-inspect-box rc-inspect-box-disabled","data-ax-id":t.id,"data-ax-path":t.path,"data-ax-label":t.label||void 0,"data-ax-role":t.role||void 0,"data-highlighted":u?"true":"false","data-selected":v?"true":"false","aria-label":M,onClick:x=>{A&&(x.preventDefault(),x.stopPropagation(),p(t,{x:x.clientX,y:x.clientY}))},style:{left:`${E.x/s.width*100}%`,top:`${E.y/s.height*100}%`,width:`${E.width/s.width*100}%`,height:`${E.height/s.height*100}%`}})},(d,t)=>d.highlighted===t.highlighted&&d.selected===t.selected&&d.selectable===t.selectable&&d.screen.width===t.screen.width&&d.screen.height===t.screen.height&&d.onClick===t.onClick&&r.axElementsEqual(d.element,t.element)),bn=260,Tn=220,An=6,En=8,On=l.memo(function({element:t,platform:s,anchor:u,cursorAnchored:v,showActions:A,onTap:p}){const[E,M]=l.useState(null);l.useEffect(()=>{if(!E)return;const I=window.setTimeout(()=>M(null),1100);return()=>window.clearTimeout(I)},[E]);const x=l.useMemo(()=>{const I=bn,ne=Tn,$=An,D=En,m=typeof window<"u"?window.innerWidth:1024,T=typeof window<"u"?window.innerHeight:768,O=u.x+$+I<=m-D,L=u.y-$-ne>=D;let P=O?u.x+$:u.x-$,Y=L?u.y-$:u.y+$;const q=`translate(${O?"0":"-100%"}, ${L?"-100%":"0"})`;return P=Math.max(D+(O?0:I),Math.min(m-D-(O?I:0),P)),Y=Math.max(D+(L?ne:0),Math.min(T-D-(L?0:ne),Y)),{left:`${P}px`,top:`${Y}px`,transform:q}},[u.x,u.y]),k=l.useMemo(()=>r.axElementSelectorExpression(t,s),[t,s]),R=s==="ios"?t.selectors.AXUniqueId:t.selectors.resourceId,H=s==="ios"?"AXUniqueId":"resourceId",K=l.useCallback(async(I,ne)=>{if(!I)return;await yn(I)&&M(ne)},[]),oe=r.axElementRoleLabel(t),ve=t.label||t.value||oe,ae=r.axElementSummary(t);return Qo.createPortal(g.jsxs("div",{className:"rc-inspect-card","data-cursor-anchored":v?"true":"false",style:x,onClick:I=>I.stopPropagation(),onMouseDown:I=>I.stopPropagation(),onMouseMove:I=>I.stopPropagation(),children:[g.jsxs("div",{className:"rc-inspect-card-header",children:[g.jsx("span",{className:"rc-inspect-card-role",children:oe}),!t.enabled&&g.jsx("span",{className:"rc-inspect-card-tag",children:"disabled"}),t.focused&&g.jsx("span",{className:"rc-inspect-card-tag rc-inspect-card-tag-blue",children:"focused"})]}),g.jsx("p",{className:"rc-inspect-card-title",title:ae,children:ve}),R&&g.jsxs("div",{className:"rc-inspect-card-row",children:[g.jsxs("span",{className:"rc-inspect-card-row-label",children:[H,":"]}),g.jsx("span",{className:"rc-inspect-card-row-value",children:R})]}),t.value&&t.value!==t.label&&g.jsxs("div",{className:"rc-inspect-card-row",children:[g.jsx("span",{className:"rc-inspect-card-row-label",children:"value:"}),g.jsx("span",{className:"rc-inspect-card-row-value",children:t.value})]}),g.jsxs("div",{className:"rc-inspect-card-row",children:[g.jsx("span",{className:"rc-inspect-card-row-label",children:"frame:"}),g.jsxs("span",{className:"rc-inspect-card-row-value",children:[Math.round(t.frame.width),"×",Math.round(t.frame.height)," @ ",Math.round(t.frame.x),",",Math.round(t.frame.y)]})]}),A&&g.jsxs("div",{className:"rc-inspect-card-actions",children:[g.jsx("button",{type:"button",className:"rc-inspect-card-btn rc-inspect-card-btn-primary",disabled:!p,onClick:()=>p?.(t,u),children:"Tap"}),g.jsx("button",{type:"button",className:E==="selector"?"rc-inspect-card-btn rc-inspect-card-btn-copied":"rc-inspect-card-btn",disabled:!k,title:k??"No usable selector for this element",onClick:()=>K(k??void 0,"selector"),children:E==="selector"?"Copied!":"Copy selector"}),g.jsx("button",{type:"button",className:E==="id"?"rc-inspect-card-btn rc-inspect-card-btn-copied":"rc-inspect-card-btn",disabled:!R,title:R??`No ${H}`,onClick:()=>K(R,"id"),children:E==="id"?"Copied!":`Copy ${H}`})]})]}),document.body)}),Mn=l.memo(function({snapshot:t,geometry:s,highlightedId:u,selectedId:v,mode:A,cursorPosition:p,frozenCursorPosition:E,onSelectChange:M,onTapElement:x}){const k=A==="select",R=k?u!==null&&u!==v:u!==null,H=k?u??v:u,K=l.useMemo(()=>{const D=new Map;if(!t)return D;for(const m of t.elements)D.set(m.id,m);return D},[t]),oe=l.useMemo(()=>H?K.get(H)??null:null,[H,K]);if(!(!!t&&!!s&&t.screen.width>0&&t.screen.height>0&&t.elements.length>0))return null;const ae=R?p:E??p,I=R,ne=k&&!R&&v!==null,$=D=>{k&&D.target===D.currentTarget&&M(null,null)};return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:k?"rc-inspect-overlay rc-inspect-overlay-select":"rc-inspect-overlay",style:{left:`${s.left}px`,top:`${s.top}px`,width:`${s.width}px`,height:`${s.height}px`},onClick:$,children:t.elements.map(D=>g.jsx(vn,{element:D,screen:t.screen,highlighted:D.id===u,selected:D.id===v,selectable:k,onClick:M},D.id))}),oe&&ae&&g.jsx(On,{element:oe,platform:t.platform,anchor:ae,cursorAnchored:I,showActions:ne,onTap:x})]})});function Nn(d,t){if(!t.startsWith("lim_st_"))return!1;try{const s=new URL(d).pathname.split("/").map(decodeURIComponent).find(x=>/^(ios|android)_[a-z0-9_]+$/.test(x));if(!s)return!1;const u=s.split("_")[0],v=t.slice(7).split(".");if(v.length!==3||v.some(x=>!x))return!1;const A=atob(v[1].replace(/-/g,"+").replace(/_/g,"/")),p=JSON.parse(new TextDecoder().decode(Uint8Array.from(A,x=>x.charCodeAt(0))));if(!p||typeof p!="object"||!("scopes"in p))return!1;const E=p.scopes;if(!Array.isArray(E)||!E.every(x=>typeof x=="string"))return!1;let M=!1;for(const x of E){const[k,R,H,K]=x.split(":");if(!(K!==void 0||k!==u&&k!=="*")&&!(R!==s&&R!=="*")){if(H==="stream"||H==="all")return!1;H==="watch"&&(M=!0)}}return M}catch{return!1}}const wn=l.lazy(()=>Promise.resolve().then(()=>require("./duo-view-D0Ndj2Ee.js")).then(d=>d.duoView)),In=l.lazy(()=>Promise.resolve().then(()=>require("./macbook-frame-CQyZhRFn.js"))),gt=d=>Object.entries(r.AMOTION_EVENT).find(([s,u])=>s.startsWith("ACTION_")&&u===d)?.[0]??String(d),po=1920,go=1200,_n=(d,t)=>d===po&&t===go||d===go&&t===po,Rn={ios:{videoBorderRadiusMultiplier:.15,loadingLogoSize:"20%",videoPosition:{portrait:{heightMultiplier:.9678},landscape:{widthMultiplier:.9678}}},android:{videoBorderRadiusMultiplier:.13,loadingLogoSize:"40%",videoPosition:{portrait:{heightMultiplier:.967},landscape:{widthMultiplier:.962}}},macos:{videoBorderRadiusMultiplier:0,loadingLogoSize:"10%",videoPosition:{portrait:{heightMultiplier:1},landscape:{widthMultiplier:1}}}},Cn={"iphone-se":{videoBorderRadiusMultiplier:0,loadingLogoSize:"20%",videoPosition:{portrait:{heightMultiplier:667/889},landscape:{widthMultiplier:667/889}},homeButton:{offset:389/889,diameter:64/889}},"iphone-17e":{videoBorderRadiusMultiplier:47.33/452,loadingLogoSize:"20%",videoPosition:{portrait:{heightMultiplier:844/888},landscape:{widthMultiplier:844/888}}}},St=16/10,yt=44,xn={videoBorderRadiusMultiplier:32/1837,loadingLogoSize:"40%",videoPosition:{portrait:{heightMultiplier:2560/2798},landscape:{widthMultiplier:2560/2798}}};function Sn(d){const t=d.code,s=r.codeMap[t];if(!s)return r.debugWarn(`Unknown event.code: ${t}, key: ${d.key}`),null;let u=r.ANDROID_KEYS.META_NONE;const v=t>="KeyA"&&t<="KeyZ",A=d.getModifierState("CapsLock"),p=d.shiftKey;let E=p;return v&&(E=p!==A),E&&(u|=r.ANDROID_KEYS.META_SHIFT_ON),d.ctrlKey&&(u|=r.ANDROID_KEYS.META_CTRL_ON),d.altKey&&(u|=r.ANDROID_KEYS.META_ALT_ON),d.metaKey&&(u|=r.ANDROID_KEYS.META_META_ON),{keycode:s,metaState:u}}function nt(d,t){const s=Object.keys(d);return s.length===Object.keys(t).length&&s.every(u=>d[u]===t[u])}const kn=l.forwardRef(({className:d,url:t,token:s,sessionId:u,openUrl:v,watchOnly:A=!1,showFrame:p=!0,animateLid:E=!0,deviceModel:M,duoModelUrl:x,macbookModelUrl:k,autoReconnect:R,jitterBufferTargetMs:H,onPlaybackStats:K,onTerminated:oe,assets:ve,onConnectionStateChange:ae,inspectMode:I,onAxSnapshotChange:ne,onInspectSelectionChange:$,onAxStatusChange:D,axPollIntervalMs:m,axMaxBackoffMs:T,androidElementTreeOptions:O,onCameraDemandChange:L,onCameraStats:P,onTrace:Y,microphoneEnabled:U=!1,onMicrophoneStateChange:ie},q)=>{const ue=l.useMemo(()=>Nn(t,s),[t,s]),F=A||ue,G=l.useRef(null),N=l.useRef(null),be=l.useRef(null),[rt,Z]=l.useState(!1),j=M==="iphone-duo"||rt,Me=M==="iphone-duo"?M:void 0,We=l.useRef(null),[Pt,bo]=l.useState(null),[Lt,To]=l.useState(),[Ao,Eo]=l.useState(!1),[Oo,Mo]=l.useState(!1),[No,wo]=l.useState(!1),[vt,Ht]=l.useState(!1),[Yt,Wt]=l.useState(!1),[Io,Xt]=l.useState({}),[Kt,jt]=l.useState(null),[bt,_o]=l.useState(null),[Tt,Ro]=l.useState(null),Vt=l.useRef(null),[Bt,Co]=l.useState(null),[$t,Ut]=l.useState(null),Ge=yo(()=>ut.current?.release()),st=l.useRef(!1),At=l.useRef(null),B=l.useRef(new Map),Ne=l.useRef(!1),[xo,So]=l.useState(!1),W=l.useRef(null),Xe=l.useRef(null),Ze=l.useRef({handle:()=>{},end:()=>{}}),[we,ct]=l.useState(null),[Ft,Et]=l.useState(null),[Ot,Je]=l.useState(null),[Mt,at]=l.useState(null),[ko,zt]=l.useState(null),[Do,qt]=l.useState(null),lt=l.useRef(null),he=l.useRef(void 0),Gt=e=>{lt.current=e,he.current===void 0&&(he.current=window.requestAnimationFrame(()=>{he.current=void 0,qt(lt.current)}))},[Po,Ke]=l.useState(null),Ie=l.useRef(null);Ie.current=Ft;const je=l.useRef($);je.current=$;const _e=I===!0||I==="hover-only",Zt=l.useRef(_e);Zt.current=_e;const Lo=I==="hover-only"?"hover-only":"select",V=l.useMemo(()=>r.detectPlatform(t),[t]),Ho=l.useMemo(()=>u||Array.from(crypto.getRandomValues(new Uint32Array(4)),e=>e.toString(36)).join(""),[u]),Qe=V==="ios"&&M&&M!=="iphone-duo"?M:void 0,Re=V==="android"&&Yt?xn:Qe?Cn[Qe]:Rn[V],re=ve?.[V],Jt=Qe&&re?.modelFrames?.[Qe],Qt=V==="android"&&Yt?vt?re?.tabletFrameLandscape:re?.tabletFrame:Qe?vt?Jt?.frameLandscape:Jt?.frame:vt?re?.frameLandscape:re?.frame,eo=re?.loadingLogo,et=!j&&V!=="macos"&&p&&!!Qt,le=V==="macos"&&p,fe=le&&re?.frame&&re.screen?{src:re.frame,screen:re.screen}:void 0,Nt=l.useRef(null),Yo=le&&Ge.mode==="3d",me=le&&Ge.shown==="3d";st.current=me;const to=Ge.choose;l.useEffect(()=>{le||to("2d")},[le,to]);const oo=!!fe&&!me&&!!Tt;l.useEffect(()=>{const e=N.current,n=Vt.current,i=n?.getContext("2d");if(!oo||!e||!n||!i)return;const o=()=>{if(e.videoWidth){n.width!==e.videoWidth&&(n.width=e.videoWidth);try{i.drawImage(e,0,0,e.videoWidth,1,0,0,n.width,1)}catch{}}};let c=!1,h;const a=()=>{c||(o(),h=e.requestVideoFrameCallback(a))},f="requestVideoFrameCallback"in e?void 0:window.setInterval(o,1e3/30);return f===void 0&&(h=e.requestVideoFrameCallback(a)),o(),()=>{c=!0,h!==void 0&&e.cancelVideoFrameCallback(h),window.clearInterval(f)}},[oo]);const C=l.useRef(null),ce=e=>C.current?.sendControl(e),dt=l.useRef(new Set),no=l.useRef(!1);no.current=I===!0;const ut=l.useRef(null);ut.current||(ut.current=new pn(e=>C.current?.sendControl(e),()=>no.current));const Ce=ut.current;l.useEffect(()=>()=>Ce.release(),[Ce]);const tt=l.useCallback(()=>{for(const e of dt.current)C.current?.sendControl(r.createMacKeyMessage(r.MAC_INPUT_ACTION.UP,e));dt.current.clear()},[]),wt=(e,n)=>C.current?.sendDuoControl(e,n)??Promise.reject(new Error("Simulator disconnected")),io=-10,ro=(e,n)=>{const i=Be();if(!i)return;const o=pe(i,e,n);if(!o)return;const{videoX:c,videoY:h,videoWidth:a,videoHeight:f}=o,y=r.createTouchControlMessage(r.AMOTION_EVENT.ACTION_DOWN,io,a,f,c,h,1,r.AMOTION_EVENT.BUTTON_PRIMARY,r.AMOTION_EVENT.BUTTON_PRIMARY);y&&ce(y),window.setTimeout(()=>{const w=r.createTouchControlMessage(r.AMOTION_EVENT.ACTION_UP,io,a,f,c,h,0,r.AMOTION_EVENT.BUTTON_PRIMARY,r.AMOTION_EVENT.BUTTON_PRIMARY);w&&ce(w)},60)},Wo=(e,n)=>{const i=Be();if(!i||n.screen.width<=0||n.screen.height<=0)return;const o=e.frame.x+e.frame.width/2,c=e.frame.y+e.frame.height/2,h=o/n.screen.width*i.actualWidth,a=c/n.screen.height*i.actualHeight,f=i.videoRect.left+i.offsetX+h,y=i.videoRect.top+i.offsetY+a;ro(f,y)},ht=-1,ft=-2,xe=-3,Ve=(e,n,i,o,c,h)=>{const a=r.createTouchControlMessage(e,n,i,o,c,h,1,r.AMOTION_EVENT.BUTTON_PRIMARY,r.AMOTION_EVENT.BUTTON_PRIMARY);a&&(r.debugLog("[rc-touch] sendSingleTouch",{action:e,actionName:gt(e),pointerId:n,x:c,y:h,video:{width:i,height:o}}),ce(a))},Se=(e,n,i)=>{if(!i)return;const{videoX:o,videoY:c,videoWidth:h,videoHeight:a}=i;let f=null,y=null,w=1;const S=r.AMOTION_EVENT.BUTTON_PRIMARY;switch(n){case"down":e!==xe&&Ze.current.end(),f=B.current.size===0?r.AMOTION_EVENT.ACTION_DOWN:r.AMOTION_EVENT.ACTION_POINTER_DOWN,y={x:o,y:c},B.current.set(e,y),e===-1&&N.current?.focus();break;case"move":B.current.has(e)&&(f=r.AMOTION_EVENT.ACTION_MOVE,y={x:o,y:c},B.current.set(e,y));break;case"up":case"cancel":B.current.has(e)&&(y=B.current.get(e),B.current.delete(e),n==="cancel"?f=r.AMOTION_EVENT.ACTION_CANCEL:f=B.current.size===0?r.AMOTION_EVENT.ACTION_UP:r.AMOTION_EVENT.ACTION_POINTER_UP);break}if(f!==null&&y!==null){r.debugLog("[rc-touch][mouse->touch] sending",{pointerId:e,eventType:n,action:f,actionName:gt(f),positionToSend:y,video:{width:h,height:a},altHeld:Ne.current,activePointersAfter:Array.from(B.current.entries()).map(([Q,X])=>({id:Q,x:X.x,y:X.y}))});const b=r.createTouchControlMessage(f,e,h,a,y.x,y.y,w,S,S);b&&(r.debugLog("[rc-touch][mouse->touch] buffer",{pointerId:e,actionName:gt(f),byteLength:b.byteLength}),ce(b))}else(n==="up"||n==="cancel")&&B.current.delete(e)},It=e=>{if(Ne.current!==e&&(Ne.current=e,So(e),e||ct(null),r.debugLog("[rc-touch][alt] updateAltHeld",{nextHeld:e,activePointerIds:Array.from(B.current.keys())}),V==="ios"&&C.current?.getState().controlReady)){const n=e?r.ANDROID_KEYS.ACTION_DOWN:r.ANDROID_KEYS.ACTION_UP,i=r.createInjectKeycodeMessage(n,r.ANDROID_KEYS.KEYCODE_ALT_LEFT,0,r.ANDROID_KEYS.META_NONE);r.debugLog("[rc-touch][alt] sending Indigo modifier keycode",{action:n,keycode:r.ANDROID_KEYS.KEYCODE_ALT_LEFT}),i&&ce(i)}},Be=()=>{const e=N.current,n=G.current;if(!e||!n)return null;const i=e.videoWidth,o=e.videoHeight;if(!i||!o)return null;const c=e.getBoundingClientRect(),h=n.getBoundingClientRect(),a=c.width,f=c.height,y=i/o,w=a/f;let S=a,b=f;y>w?b=a/y:S=f*y;const Q=(a-S)/2,X=(f-b)/2;return{videoWidth:i,videoHeight:o,videoRect:c,containerRect:h,actualWidth:S,actualHeight:b,offsetX:Q,offsetY:X}},pe=(e,n,i)=>{const o=n-e.videoRect.left-e.offsetX,c=i-e.videoRect.top-e.offsetY,h=Math.max(0,Math.min(e.actualWidth,o)),a=Math.max(0,Math.min(e.actualHeight,c)),f=Math.max(0,Math.min(e.videoWidth,h/e.actualWidth*e.videoWidth)),y=Math.max(0,Math.min(e.videoHeight,a/e.actualHeight*e.videoHeight));return{videoX:f,videoY:y,videoWidth:e.videoWidth,videoHeight:e.videoHeight}},Xo=(e,n,i)=>{const o=n-e.videoRect.left-e.offsetX,c=i-e.videoRect.top-e.offsetY,h=Math.max(0,Math.min(e.actualWidth,o)),a=Math.max(0,Math.min(e.actualHeight,c)),f=Math.max(0,Math.min(e.videoWidth,h/e.actualWidth*e.videoWidth)),y=Math.max(0,Math.min(e.videoHeight,a/e.actualHeight*e.videoHeight)),w=e.videoWidth-f,S=e.videoHeight-y,b=e.videoRect.left+e.offsetX,Q=e.videoRect.top+e.offsetY,X=b-e.containerRect.left+h,z=Q-e.containerRect.top+a,se=b-e.containerRect.left+(e.actualWidth-h),_=Q-e.containerRect.top+(e.actualHeight-a);return{containerX:X,containerY:z,mirrorContainerX:se,mirrorContainerY:_,videoX:f,videoY:y,mirrorVideoX:w,mirrorVideoY:S,videoWidth:e.videoWidth,videoHeight:e.videoHeight}},Ko=(e,n,i,o,c,h,a)=>{const f=r.createTwoFingerTouchControlMessage(e,n,i,o,c,h,a);r.debugLog("[rc-touch2] sendTwoFingerMessage (iOS)",{actionName:gt(e),video:{width:n,height:i},p0:{x:o,y:c},p1:{x:h,y:a},byteLength:f.byteLength}),ce(f)},$e=(e,n,i,o,c,h,a,f,y)=>{if(r.debugLog("[rc-touch2] applyTwoFingerEvent",{platform:V,eventType:e,video:{width:n,height:i},p0:{x:o,y:c,id:f},p1:{x:h,y:a,id:y}}),e==="down"&&Ze.current.end(),V==="ios"){const w=e==="down"?r.AMOTION_EVENT.ACTION_DOWN:e==="move"?r.AMOTION_EVENT.ACTION_MOVE:r.AMOTION_EVENT.ACTION_UP;Ko(w,n,i,o,c,h,a)}else e==="down"?(Ve(r.AMOTION_EVENT.ACTION_DOWN,f,n,i,o,c),Ve(r.AMOTION_EVENT.ACTION_POINTER_DOWN,y,n,i,h,a)):e==="move"?(Ve(r.AMOTION_EVENT.ACTION_MOVE,f,n,i,o,c),Ve(r.AMOTION_EVENT.ACTION_MOVE,y,n,i,h,a)):(Ve(r.AMOTION_EVENT.ACTION_POINTER_UP,y,n,i,h,a),Ve(r.AMOTION_EVENT.ACTION_UP,f,n,i,o,c))},jo=(e,n,i)=>{if(!Ne.current){we!==null&&ct(null);return}const o=Xo(e,n,i);ct(o)},Vo=(e,n,i)=>{const o=Ie.current;if(!o||o.screen.width<=0||o.screen.height<=0)return null;const c=n-e.videoRect.left-e.offsetX,h=i-e.videoRect.top-e.offsetY;if(c<0||h<0||c>e.actualWidth||h>e.actualHeight)return null;const a=c/e.actualWidth*o.screen.width,f=h/e.actualHeight*o.screen.height;return r.axElementAtPoint(o,a,f)},Bo=e=>({map:(n,i)=>{const o=pe(e,n,i);if(o)return{x:o.videoX,y:o.videoY,width:o.videoWidth,height:o.videoHeight}},contains:(n,i)=>{const o=n-e.videoRect.left-e.offsetX,c=i-e.videoRect.top-e.offsetY;return o>=0&&o<=e.actualWidth&&c>=0&&c<=e.actualHeight},scale:e.actualWidth>0?e.videoWidth/e.actualWidth:1}),Te=e=>{if(j||st.current)return;e.preventDefault(),e.stopPropagation();const n=Be();if((I===!0||I==="hover-only")&&!("touches"in e))if(e.type==="mousemove"){if(Gt({x:e.clientX,y:e.clientY}),n){const o=Vo(n,e.clientX,e.clientY);Je(o?.id??null)}}else e.type==="mouseleave"&&(Gt(null),Je(null));if(I!==!0){if(V==="macos"){if(!n||!C.current?.getState().controlReady)return;if("touches"in e){const a=Array.from(e.touches,f=>({x:f.clientX,y:f.clientY}));Ce.touch(e.type,a,Bo(n))&&N.current?.focus();return}const o=pe(n,e.clientX,e.clientY);if(!o)return;const c=e.type==="mousedown"?r.MAC_INPUT_ACTION.DOWN:e.type==="mouseup"?r.MAC_INPUT_ACTION.UP:r.MAC_INPUT_ACTION.MOVE,h=e.type==="mouseleave"?0:e.buttons;e.type==="mousedown"&&N.current?.focus(),Ce.pointer(c,{x:o.videoX,y:o.videoY,width:o.videoWidth,height:o.videoHeight},h);return}if(!("touches"in e)&&n&&(e.type==="mousemove"?jo(n,e.clientX,e.clientY):e.type==="mouseleave"&&ct(null)),!(!C.current?.getState().controlReady||!N.current||!n))if("touches"in e){const o=e.touches,c=e.changedTouches;let h;switch(e.type){case"touchstart":h="down";break;case"touchmove":h="move";break;case"touchend":h="up";break;case"touchcancel":h="cancel";break;default:return}if(o.length===2){const a=o[0],f=o[1],y=pe(n,a.clientX,a.clientY),w=pe(n,f.clientX,f.clientY);if(!y||!w)return;W.current?W.current.source==="real-touch"&&(W.current.finger0={x:y.videoX,y:y.videoY},W.current.finger1={x:w.videoX,y:w.videoY},$e("move",y.videoWidth,y.videoHeight,y.videoX,y.videoY,w.videoX,w.videoY,W.current.pointerId0,W.current.pointerId1)):(W.current={finger0:{x:y.videoX,y:y.videoY},finger1:{x:w.videoX,y:w.videoY},videoSize:{width:y.videoWidth,height:y.videoHeight},source:"real-touch",pointerId0:a.identifier,pointerId1:f.identifier},$e("down",y.videoWidth,y.videoHeight,y.videoX,y.videoY,w.videoX,w.videoY,a.identifier,f.identifier))}else if(o.length<2&&W.current?.source==="real-touch"){const a=W.current;$e("up",a.videoSize.width,a.videoSize.height,a.finger0.x,a.finger0.y,a.finger1.x,a.finger1.y,a.pointerId0,a.pointerId1),W.current=null;return}else{if(o.length>2)return;{const a=c[0];if(a){const f=pe(n,a.clientX,a.clientY);Se(a.identifier,h,f)}}}}else{let c=null;const h=W.current?.source==="alt-mouse";switch(e.type){case"mousedown":e.button===0&&(c="down");break;case"mousemove":(h||B.current.has(-1))&&(c="move");break;case"mouseup":e.button===0&&(c="up");break;case"mouseleave":(h||B.current.has(-1))&&(c="up");break}if(c){const a=pe(n,e.clientX,e.clientY);if(!a)return;r.debugLog("[rc-touch][mouse] event",{domType:e.type,eventType:c,button:e.button,buttons:e.buttons,client:{x:e.clientX,y:e.clientY},altHeldRef:Ne.current,inTwoFingerMode:h,geometry:{videoX:a.videoX,videoY:a.videoY,videoWidth:a.videoWidth,videoHeight:a.videoHeight},activePointerIds:Array.from(B.current.keys())}),Ne.current||h?$o(c,a):Se(-1,c,a)}}}},$o=(e,n)=>{const{videoX:i,videoY:o,videoWidth:c,videoHeight:h}=n,a=c-i,f=h-o;if(e==="down"){W.current={finger0:{x:i,y:o},finger1:{x:a,y:f},videoSize:{width:c,height:h},source:"alt-mouse",pointerId0:ht,pointerId1:ft},N.current?.focus(),$e("down",c,h,i,o,a,f,ht,ft);return}if(e==="move"){W.current?.source==="alt-mouse"&&(W.current.finger0={x:i,y:o},W.current.finger1={x:a,y:f},$e("move",c,h,i,o,a,f,ht,ft));return}if(e==="up"||e==="cancel"){const y=W.current;if(y?.source==="alt-mouse"){const{finger0:w,finger1:S,videoSize:b}=y;$e("up",b.width,b.height,w.x,w.y,S.x,S.y,ht,ft),W.current=null}return}},Uo=150,so=()=>{const e=Xe.current;e&&(window.clearTimeout(e.endTimer),Se(xe,"up",e.pos),Xe.current=null)},Fo=e=>{if(!C.current?.getState().controlReady||e.ctrlKey)return;if(V==="macos"){if(st.current)return;const _=Be();if(!_)return;const ke=e.clientX-_.videoRect.left-_.offsetX,ge=e.clientY-_.videoRect.top-_.offsetY;if(ke<0||ke>_.actualWidth||ge<0||ge>_.actualHeight)return;const de=pe(_,e.clientX,e.clientY);if(!de)return;e.preventDefault();const Fe=e.deltaMode===WheelEvent.DOM_DELTA_LINE?16:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?_.actualHeight:1;Ce.scroll({x:de.videoX,y:de.videoY,width:de.videoWidth,height:de.videoHeight},e.deltaX*Fe,e.deltaY*Fe);return}if(Ne.current||W.current)return;const n=B.current.size;if(n>1||n===1&&!B.current.has(xe))return;const i=Be();if(!i)return;const o=e.clientX-i.videoRect.left-i.offsetX,c=e.clientY-i.videoRect.top-i.offsetY;if(o<0||o>i.actualWidth||c<0||c>i.actualHeight)return;const h=pe(i,e.clientX,e.clientY);if(!h)return;e.preventDefault();const a=(e.deltaMode===1?16:e.deltaMode===2?i.actualWidth:1)*(i.videoWidth/i.actualWidth),f=(e.deltaMode===1?16:e.deltaMode===2?i.actualHeight:1)*(i.videoHeight/i.actualHeight),y=-e.deltaX*a,w=-e.deltaY*f,S=_=>{window.clearTimeout(_.endTimer),_.endTimer=window.setTimeout(so,Uo)};if(y===0&&w===0){Xe.current&&S(Xe.current);return}const b=()=>({videoWidth:h.videoWidth,videoHeight:h.videoHeight,videoX:Math.abs(y)>Math.abs(w)?Math.min(Math.max(h.videoX,h.videoWidth*.2),h.videoWidth*.8):h.videoX,videoY:Math.abs(w)>=Math.abs(y)?Math.min(Math.max(h.videoY,h.videoHeight*.2),h.videoHeight*.8):h.videoY}),Q=_=>({..._,videoX:Math.min(Math.max(_.videoX+y,0),_.videoWidth),videoY:Math.min(Math.max(_.videoY+w,0),_.videoHeight)});let X=Xe.current;if(X)window.clearTimeout(X.endTimer);else{const _=b();Se(xe,"down",_),X={pos:_,endTimer:0},Xe.current=X}let z=X.pos,se=Q(z);se.videoX===z.videoX&&se.videoY===z.videoY&&(Se(xe,"up",z),z=b(),Se(xe,"down",z),se=Q(z)),Se(xe,"move",se),X.pos=se,S(X)};l.useEffect(()=>{Ze.current={handle:Fo,end:so}}),l.useEffect(()=>{const e=G.current;if(!e)return;const n=i=>Ze.current.handle(i);return e.addEventListener("wheel",n,{passive:!1}),()=>{Ze.current.end(),e.removeEventListener("wheel",n)}},[]),l.useEffect(()=>{const e=c=>{c.key==="Alt"&&It(!0)},n=c=>{c.key==="Alt"&&It(!1)},i=()=>{It(!1),tt()},o=()=>{document.hidden&&tt()};return window.addEventListener("keydown",e,!0),window.addEventListener("keyup",n,!0),window.addEventListener("blur",i),document.addEventListener("visibilitychange",o),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("keyup",n,!0),window.removeEventListener("blur",i),document.removeEventListener("visibilitychange",o)}},[tt]);const Ue=e=>{e.preventDefault(),e.stopPropagation();const n=document.activeElement===N.current||(j||st.current)&&document.activeElement===e.currentTarget;if(r.debugLog("Keyboard event:",{type:e.type,key:e.key,keyCode:e.keyCode,code:e.code,target:e.target.tagName,focused:n}),!n){r.debugWarn("Simulator input not focused, skipping keyboard event");return}if(!C.current?.getState().controlReady){r.debugWarn("Data channel not ready for keyboard event:",C.current?.getState().connection);return}if(V==="macos"){if(e.type==="keydown"&&e.repeat)return;const o=r.macKeyCodeFor(e.code);if(o===void 0){r.debugLog(`Ignoring unmapped key for macOS: code=${e.code}`);return}e.type==="keydown"?dt.current.add(o):dt.current.delete(o),ce(r.createMacKeyMessage(e.type==="keydown"?r.MAC_INPUT_ACTION.DOWN:r.MAC_INPUT_ACTION.UP,o));return}if(e.type==="keydown"){if(e.key.toLowerCase()==="v"&&(e.metaKey||e.ctrlKey)){r.debugLog("Paste shortcut detected"),navigator.clipboard.readText().then(o=>{if(o){r.debugLog("Pasting text via SET_CLIPBOARD:",o.substring(0,20)+(o.length>20?"...":""));const c=r.createSetClipboardMessage(o,!0);ce(c)}}).catch(o=>{console.error("Failed to read clipboard contents: ",o)});return}if(e.key.toLowerCase()==="m"&&(e.metaKey||e.ctrlKey)){r.debugLog("Menu shortcut detected");const o=r.createInjectKeycodeMessage(r.ANDROID_KEYS.ACTION_DOWN,r.ANDROID_KEYS.MENU,0,r.ANDROID_KEYS.META_NONE);ce(o);const c=r.createInjectKeycodeMessage(r.ANDROID_KEYS.ACTION_UP,r.ANDROID_KEYS.MENU,0,r.ANDROID_KEYS.META_NONE);ce(c);return}}const i=Sn(e);if(i){const{keycode:o,metaState:c}=i,h=e.type==="keydown"?r.ANDROID_KEYS.ACTION_DOWN:r.ANDROID_KEYS.ACTION_UP;r.debugLog(`Sending Keycode: key=${e.key}, code=${o}, action=${h}, meta=${c}`);const a=r.createInjectKeycodeMessage(h,o,0,c);ce(a)}else r.debugLog(`Ignoring unhandled key event: type=${e.type}, key=${e.key}`)},zo=e=>{e.stopPropagation(),C.current?.reconnect()},J=l.useRef({onAxSnapshotChange:ne,onAxStatusChange:D,onCameraDemandChange:L,onCameraStats:P,onMicrophoneStateChange:ie,onTrace:Y,onTerminated:oe,onConnectionStateChange:ae,onPlaybackStats:K});J.current={onAxSnapshotChange:ne,onAxStatusChange:D,onCameraDemandChange:L,onCameraStats:P,onMicrophoneStateChange:ie,onTrace:Y,onTerminated:oe,onConnectionStateChange:ae,onPlaybackStats:K};const _t=!!Y;l.useEffect(()=>{At.current=null,Ht(!1),Wt(!1),Xt({}),jt(null)},[t,Me]),l.useEffect(()=>{let e=!0;Ie.current!==null&&(Ie.current=null,Et(null),r.safeInvoke("onAxSnapshotChange",J.current.onAxSnapshotChange,null));const n=r.createDeviceStream({url:t,token:s,sessionId:Ho,watchOnly:F,deviceModel:Me,autoReconnect:R,jitterBufferTargetMs:H,openUrl:v,inspectMode:I,axPollIntervalMs:m,axMaxBackoffMs:T,androidElementTreeOptions:O,microphoneEnabled:U,onStateChange:o=>{(o.videoReady||o.connection==="idle"||o.connection==="connecting"||o.connection==="reconnecting")&&Eo(o.videoReady),Mo(o.connection==="failed"),wo(o.connection==="terminated"),Z(o.duo),bo(o.duoState),To(o.duoError)},onAxSnapshotChange:o=>{e&&(Et(c=>r.axSnapshotsEqual(c,o)?c:o),J.current.onAxSnapshotChange?.(o))},onAxStatusChange:(...o)=>J.current.onAxStatusChange?.(...o),onCameraDemandChange:(...o)=>J.current.onCameraDemandChange?.(...o),onCameraStats:P?(...o)=>J.current.onCameraStats?.(...o):void 0,onMicrophoneStateChange:(...o)=>J.current.onMicrophoneStateChange?.(...o),onTrace:_t?(...o)=>J.current.onTrace?.(...o):void 0,onTerminated:()=>J.current.onTerminated?.(),onConnectionStateChange:(...o)=>J.current.onConnectionStateChange?.(...o),onPlaybackStats:K?(...o)=>J.current.onPlaybackStats?.(...o):void 0});C.current=n;const i=N.current?n.attachVideo(N.current):void 0;return n.start(),()=>{e=!1,n.dispose(),i?.(),C.current=null}},[t,u,Me,_t,F]),l.useEffect(()=>{if(j&&We.current)return C.current?.attachVideo(We.current,"inner")},[j,t,u,Me,_t,F]),l.useEffect(()=>{C.current?.updateOptions({token:s,openUrl:v,axPollIntervalMs:m,axMaxBackoffMs:T,androidElementTreeOptions:O,autoReconnect:R,jitterBufferTargetMs:H,microphoneEnabled:U,inspectMode:I,onPlaybackStats:K?(...e)=>J.current.onPlaybackStats?.(...e):void 0,onCameraStats:P?(...e)=>J.current.onCameraStats?.(...e):void 0})},[s,R,H,U,I,!!K,!!P,v,m,T,O]);const ot=()=>{if(!Zt.current)return;const e=Be();if(!e){zt(null);return}const n={left:e.videoRect.left-e.containerRect.left+e.offsetX,top:e.videoRect.top-e.containerRect.top+e.offsetY,width:e.actualWidth,height:e.actualHeight};zt(i=>i&&i.left===n.left&&i.top===n.top&&i.width===n.width&&i.height===n.height?i:n)};l.useEffect(()=>{const e=N.current,n=be.current,i=G.current;if(!e)return;const o=S=>Xt(b=>nt(b,S)?b:S),c=S=>jt(b=>b&&S&&nt(b,S)?b:S),h=S=>_o(b=>b&&S&&nt(b,S)?b:S),a=()=>{const S=e.videoWidth>0&&e.videoHeight>0;S&&(At.current={width:e.videoWidth,height:e.videoHeight});const b=At.current,Q=b?`${b.width} / ${b.height}`:void 0,X=Nt.current;if(fe&&i){if(Ut(b?b.width/b.height:St),!X?.naturalWidth)return;const De=X.naturalWidth/X.naturalHeight,mt=i.clientHeight-yt,Pe=i.clientHeight>0?Math.min(i.clientWidth,mt*De):i.clientWidth;if(Pe<=0)return;const Ae=Pe/De,Ee=i.clientHeight>0?yt/2:0,{screen:ee}=fe,Le=ee.notch??0,ze=ee.left*Pe,He=ee.top*Ae,pt=ee.width*Pe,ao=He+Le*ee.height*Ae,lo=(1-Le)*ee.height*Ae,uo=b?b.width/b.height:St,qe=Math.min(pt,lo*uo),Rt=qe/uo,ho=ze+(pt-qe)/2,fo=Le>0?ao:ao+(lo-Rt)/2,Ct=(ye,Oe,Zo,Jo)=>`translate(calc(-50% + ${ye+Zo/2-Pe/2}px), calc(-50% + ${Oe+Jo/2-Ae/2+Ee}px))`;o({width:`${qe}px`,height:`${Rt}px`,transform:Ct(ho,fo,qe,Rt)});const xt=fo-He;Ro(ye=>{const Oe=Le>0&&xt>0?{width:`${qe}px`,height:`${xt+1}px`,transform:Ct(ho,He,qe,xt+1)}:null;return ye&&Oe&&nt(ye,Oe)?ye:Oe});const mo=ee.height*Ae;Co(ye=>{const Oe={width:`${pt}px`,height:`${mo}px`,transform:Ct(ze,He,pt,mo)};return ye&&nt(ye,Oe)?ye:Oe}),h({width:`${Pe}px`,height:`${Ae}px`,transform:Ee?`translateY(${Ee}px)`:void 0}),c(null),ot();return}if(le&&i){const De=b?b.width/b.height:St,mt=i.clientWidth*100/it,Ae=(i.clientHeight-yt)/(1/De+Dt/100),Ee=i.clientHeight>0?Math.min(mt,Ae):mt;if(Ee<=0)return;const ee=Ee/100,Le=Ee/De,ze=i.clientHeight>0?yt/2:0,He=`${ee*te.screenRadius}px`;o({aspectRatio:`${De}`,width:`${Ee}px`,height:`${Le}px`,borderRadius:`${He} ${He} 0 0`,transform:`translate(-50%, calc(-50% - ${ee*en-ze}px))`}),h({width:`${ee*it}px`,height:`${Le+ee*Dt}px`,transform:ze?`translateY(${ze}px)`:void 0,"--rc-macbook-unit":`${ee}px`}),Ut(De),c(null),ot();return}if(h(null),!et||!n){o(!S&&b?{aspectRatio:Q,contain:"size",containIntrinsicSize:`${b.width}px ${b.height}px`}:{}),c(null),ot();return}const z=n.clientWidth,se=n.clientHeight;if(z===0||se===0)return;const _=b?b.width>b.height:!1;Ht(_),Wt(V==="android"&&!!b&&_n(b.width,b.height));const ke=_?Re.videoPosition.landscape:Re.videoPosition.portrait;let ge={aspectRatio:Q};ke.heightMultiplier?(ge.height=`${se*ke.heightMultiplier}px`,ge.width="auto"):ke.widthMultiplier&&(ge.width=`${z*ke.widthMultiplier}px`,ge.height="auto"),ge.borderRadius=`${_?se*Re.videoBorderRadiusMultiplier:z*Re.videoBorderRadiusMultiplier}px`,o(ge);const de=Re.homeButton,Fe=_?z:se,co=`calc(50% + ${Fe*(de?.offset??0)}px)`;c(de?{width:`${Fe*de.diameter}px`,height:`${Fe*de.diameter}px`,left:_?co:"50%",top:_?"50%":co}:null),ot()},f=new ResizeObserver(()=>{a()});n&&f.observe(n),f.observe(e),i&&f.observe(i),n&&n.addEventListener("load",a);const y=Nt.current;y?.addEventListener("load",a),e.addEventListener("loadedmetadata",a),e.addEventListener("resize",a);const w=()=>C.current?.bumpActivity();return e.addEventListener("resize",w),a(),()=>{f.disconnect(),e.removeEventListener("loadedmetadata",a),e.removeEventListener("resize",a),e.removeEventListener("resize",w),n&&n.removeEventListener("load",a),y?.removeEventListener("load",a)}},[Re,et,le,fe?.src,me,t,M]),l.useEffect(()=>{_e?ot():(Et(null),Je(null),at(null),qt(null),Ke(null),lt.current=null,he.current!==void 0&&(window.cancelAnimationFrame(he.current),he.current=void 0))},[_e]),l.useEffect(()=>()=>{he.current!==void 0&&(window.cancelAnimationFrame(he.current),he.current=void 0)},[]),l.useEffect(()=>{if(!_e)return;const e=n=>{n.key==="Escape"&&(Mt||Ot)&&(at(null),Je(null),Ke(null),r.safeInvoke("onInspectSelectionChange",je.current,null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[_e,Mt,Ot]);const qo=()=>{N.current&&N.current.focus()};l.useImperativeHandle(q,()=>({openUrl:e=>C.current?.openUrl(e),sendKeyEvent:e=>C.current?.sendKeyEvent(e),screenshot:e=>C.current?.screenshot(e)??Promise.reject(new Error("Simulator disconnected")),terminateApp:e=>C.current?.terminateApp(e)??Promise.reject(new Error("Simulator disconnected")),reconnect:()=>C.current?.reconnect(),refreshAxTree:()=>C.current?.refreshAxTree()??Promise.reject(new Error("Simulator disconnected")),getAxSnapshot:()=>C.current?.getAxSnapshot()??null,setInspectHighlight:e=>{Je(e?.id??null)},setInspectSelection:e=>{at(e?.id??null),Ke(e?lt.current:null);const n=Ie.current;e&&n?r.safeInvoke("onInspectSelectionChange",je.current,{element:e,snapshot:n}):r.safeInvoke("onInspectSelectionChange",je.current,null)},getAxStatus:()=>C.current?.getAxStatus()??"idle"}));const Go=xo&&we!==null;return g.jsxs("div",{ref:G,className:["rc-container",d].filter(Boolean).join(" "),style:{touchAction:"none"},onMouseDown:Te,onMouseMove:Te,onMouseUp:Te,onMouseLeave:Te,onTouchStart:Te,onTouchMove:Te,onTouchEnd:Te,onTouchCancel:Te,onContextMenu:V==="macos"?e=>e.preventDefault():void 0,children:[Go&&we&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"rc-touch-indicator",style:{left:`${we.containerX}px`,top:`${we.containerY}px`}}),g.jsx("div",{className:"rc-touch-indicator",style:{left:`${we.mirrorContainerX}px`,top:`${we.mirrorContainerY}px`}})]}),et&&g.jsx("img",{ref:be,src:Qt,alt:"",className:V==="ios"?"rc-phone-frame rc-phone-frame-ios":"rc-phone-frame",draggable:!1}),fe&&!me&&Bt&&g.jsx("div",{className:"rc-macbook-screen",style:Bt,"aria-hidden":"true"}),fe&&!me&&Tt&&g.jsx("canvas",{ref:Vt,className:"rc-macbook-band",style:Tt,height:1}),fe&&!me&&g.jsx("img",{ref:Nt,src:fe.src,alt:"",className:"rc-macbook-image",style:bt??{visibility:"hidden"},draggable:!1}),le&&!fe&&bt&&!me&&g.jsxs("div",{className:"rc-macbook",style:bt,"aria-hidden":"true",children:[g.jsx("div",{className:"rc-macbook-lid",children:g.jsx("div",{className:"rc-macbook-camera"})}),g.jsx("div",{className:"rc-macbook-base"})]}),et&&Kt&&!F&&g.jsx("button",{type:"button",className:"rc-home-button","aria-label":"Home",title:"Home",style:Kt,onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onTouchEnd:e=>{e.stopPropagation(),e.preventDefault(),C.current?.pressButton("home")},onClick:e=>{e.stopPropagation(),C.current?.pressButton("home")}}),g.jsx("video",{ref:N,className:["rc-video",!et&&!le&&"rc-video-frameless",!Ao&&(V==="macos"?"rc-video-loading-desktop":"rc-video-loading")].filter(Boolean).join(" "),style:{...Io,...j||me?{opacity:0,width:1,height:1,pointerEvents:"none"}:{},...eo?{backgroundImage:`url("${eo}")`,backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:Re.loadingLogoSize}:{}},autoPlay:!0,playsInline:!0,muted:!0,tabIndex:j||me?-1:0,onKeyDown:Ue,onKeyUp:Ue,onClick:qo,onFocus:()=>{N.current&&(N.current.style.outline="none")},onBlur:()=>{N.current&&(N.current.style.outline="none"),tt()}}),Yo&&$t&&g.jsx(l.Suspense,{fallback:null,children:g.jsx(In,{video:N.current,aspect:$t,model:k??re?.model,animateLid:E,watchOnly:F,onReady:Ge.onReady,pointer:(e,n,i,o)=>{const c=N.current;!c?.videoWidth||!C.current?.getState().controlReady||Ce.pointer(e==="down"?r.MAC_INPUT_ACTION.DOWN:e==="up"?r.MAC_INPUT_ACTION.UP:r.MAC_INPUT_ACTION.MOVE,{x:n*c.videoWidth,y:i*c.videoHeight,width:c.videoWidth,height:c.videoHeight},o)},scroll:(e,n,i,o)=>{const c=N.current;!c?.videoWidth||!C.current?.getState().controlReady||Ce.scroll({x:e*c.videoWidth,y:n*c.videoHeight,width:c.videoWidth,height:c.videoHeight},i,o)},onKeyDown:Ue,onKeyUp:Ue,onBlur:tt})}),le&&g.jsx(vo,{view:Ge,label:"MacBook rendering"}),j&&g.jsx("video",{ref:We,autoPlay:!0,playsInline:!0,muted:!0,style:{position:"absolute",width:1,height:1,opacity:0,pointerEvents:"none"}}),j&&Pt&&g.jsx(l.Suspense,{fallback:g.jsx("div",{children:"Loading iPhone Duo…"}),children:g.jsx(wn,{watchOnly:F,showFrame:p,model:x??re?.model,outer:N.current,inner:We.current,state:Pt,setAngle:e=>wt("setHingeAngle",{angleDegrees:e}),setOrientation:e=>wt("setDuoOrientation",{orientation:e}),button:(e,n)=>wt("performActions",{actions:[{type:n?"buttonDown":"buttonUp",button:e}]}),touch:(e,n,i,o)=>{C.current?.sendDisplayTouch(e,n,i,o)},onKeyDown:Ue,onKeyUp:Ue})}),j&&Lt&&g.jsx("div",{role:"alert",className:"rc-duo-error",children:Lt}),!j&&_e&&g.jsx(Mn,{snapshot:Ft,geometry:ko,highlightedId:Ot,selectedId:Mt,mode:Lo,cursorPosition:Do,frozenCursorPosition:Po,onSelectChange:(e,n)=>{at(e?.id??null),e&&n?Ke(n):e||Ke(null);const i=Ie.current;e&&i?r.safeInvoke("onInspectSelectionChange",je.current,{element:e,snapshot:i}):r.safeInvoke("onInspectSelectionChange",je.current,null)},onTapElement:F?void 0:((e,n)=>{if(n){ro(n.x,n.y);return}const i=Ie.current;i&&Wo(e,i)})}),No?g.jsxs("div",{className:"rc-terminated",role:"status",children:[g.jsx("div",{className:"rc-terminated-title",children:"Instance terminated"}),g.jsx("div",{className:"rc-terminated-message",children:"This instance no longer exists and can't be reconnected."})]}):Oo&&g.jsx("button",{type:"button",className:"rc-retry-button",onClick:zo,children:"Retry"})]})});exports.DeviceModeToggle=vo;exports.MACBOOK_LID_MAX_DEGREES=rn;exports.MACBOOK_LID_OPENING_MS=cn;exports.MACBOOK_LID_OPEN_DEGREES=sn;exports.MACBOOK_VERTEX_FLOATS=tn;exports.RemoteControl=kn;exports.lidEase=ln;exports.lidRotation=an;exports.macbookMeshes=dn;exports.streamFit=un;exports.streamPoint=hn;exports.useDeviceView=yo;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./duo-frame-B1NXSk6a.js");function Q(d){const t=new Map,e=new Map,n=d.clone();return q(d,n,function(s,r){t.set(r,s),e.set(s,r)}),n.traverse(function(s){if(!s.isSkinnedMesh)return;const r=s,o=t.get(s),a=o.skeleton.bones;r.skeleton=o.skeleton.clone(),r.bindMatrix.copy(o.bindMatrix),r.skeleton.bones=a.map(function(i){return e.get(i)}),r.bind(r.skeleton,r.bindMatrix)}),n}function q(d,t,e){e(d,t);for(let n=0;n<d.children.length;n++)q(d.children[n],t.children[n],e)}class J extends h.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new ne(e)}),this.register(function(e){return new se(e)}),this.register(function(e){return new fe(e)}),this.register(function(e){return new de(e)}),this.register(function(e){return new pe(e)}),this.register(function(e){return new ie(e)}),this.register(function(e){return new oe(e)}),this.register(function(e){return new ae(e)}),this.register(function(e){return new ce(e)}),this.register(function(e){return new te(e)}),this.register(function(e){return new le(e)}),this.register(function(e){return new re(e)}),this.register(function(e){return new he(e)}),this.register(function(e){return new ue(e)}),this.register(function(e){return new $(e)}),this.register(function(e){return new K(e,T.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new K(e,T.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new me(e)})}load(t,e,n,s){const r=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const c=h.LoaderUtils.extractUrlBase(t);o=h.LoaderUtils.resolveURL(c,this.path)}else o=h.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const a=function(c){s?s(c):console.error(c),r.manager.itemError(t),r.manager.itemEnd(t)},i=new h.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(t,function(c){try{r.parse(c,o,function(u){e(u),r.manager.itemEnd(t)},a)}catch(u){a(u)}},n,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,n,s){let r;const o={},a={},i=new TextDecoder;if(typeof t=="string")r=JSON.parse(t);else if(t instanceof ArrayBuffer)if(i.decode(new Uint8Array(t,0,4))===W){try{o[T.KHR_BINARY_GLTF]=new ge(t)}catch(l){s&&s(l);return}r=JSON.parse(o[T.KHR_BINARY_GLTF].content)}else r=JSON.parse(i.decode(t));else r=t;if(r.asset===void 0||r.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Ne(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const l=this.pluginCallbacks[u](c);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,o[l.name]=!0}if(r.extensionsUsed)for(let u=0;u<r.extensionsUsed.length;++u){const l=r.extensionsUsed[u],f=r.extensionsRequired||[];switch(l){case T.KHR_MATERIALS_UNLIT:o[l]=new ee;break;case T.KHR_DRACO_MESH_COMPRESSION:o[l]=new Te(r,this.dracoLoader);break;case T.KHR_TEXTURE_TRANSFORM:o[l]=new Re;break;case T.KHR_MESH_QUANTIZATION:o[l]=new Me;break;default:f.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(n,s)}parseAsync(t,e){const n=this;return new Promise(function(s,r){n.parse(t,e,s,r)})}}function Z(){let d={};return{get:function(t){return d[t]},add:function(t,e){d[t]=e},remove:function(t){delete d[t]},removeAll:function(){d={}}}}function _(d,t,e){const n=d.json.materials[t];return n.extensions&&n.extensions[e]?n.extensions[e]:null}const T={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ${constructor(t){this.parser=t,this.name=T.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,s=e.length;n<s;n++){const r=e[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(t){const e=this.parser,n="light:"+t;let s=e.cache.get(n);if(s)return s;const r=e.json,i=((r.extensions&&r.extensions[this.name]||{}).lights||[])[t];let c;const u=new h.Color(16777215);i.color!==void 0&&u.setRGB(i.color[0],i.color[1],i.color[2],h.LinearSRGBColorSpace);const l=i.range!==void 0?i.range:0;switch(i.type){case"directional":c=new h.DirectionalLight(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new h.PointLight(u),c.distance=l;break;case"spot":c=new h.SpotLight(u),c.distance=l,i.spot=i.spot||{},i.spot.innerConeAngle=i.spot.innerConeAngle!==void 0?i.spot.innerConeAngle:0,i.spot.outerConeAngle=i.spot.outerConeAngle!==void 0?i.spot.outerConeAngle:Math.PI/4,c.angle=i.spot.outerConeAngle,c.penumbra=1-i.spot.innerConeAngle/i.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+i.type)}return c.position.set(0,0,0),w(c,i),i.intensity!==void 0&&(c.intensity=i.intensity),c.name=e.createUniqueName(i.name||"light_"+t),s=Promise.resolve(c),e.cache.add(n,s),s}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,n=this.parser,r=n.json.nodes[t],a=(r.extensions&&r.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(i){return n._getNodeRef(e.cache,a,i)})}}class ee{constructor(){this.name=T.KHR_MATERIALS_UNLIT}getMaterialType(){return h.MeshBasicMaterial}extendParams(t,e,n){const s=[];t.color=new h.Color(1,1,1),t.opacity=1;const r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const o=r.baseColorFactor;t.color.setRGB(o[0],o[1],o[2],h.LinearSRGBColorSpace),t.opacity=o[3]}r.baseColorTexture!==void 0&&s.push(n.assignTexture(t,"map",r.baseColorTexture,h.SRGBColorSpace))}return Promise.all(s)}}class te{constructor(t){this.parser=t,this.name=T.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const n=_(this.parser,t,this.name);return n===null||n.emissiveStrength!==void 0&&(e.emissiveIntensity=n.emissiveStrength),Promise.resolve()}}class ne{constructor(t){this.parser=t,this.name=T.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){return _(this.parser,t,this.name)!==null?h.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=_(this.parser,t,this.name);if(n===null)return Promise.resolve();const s=[];if(n.clearcoatFactor!==void 0&&(e.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&s.push(this.parser.assignTexture(e,"clearcoatMap",n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&s.push(this.parser.assignTexture(e,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(s.push(this.parser.assignTexture(e,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){const r=n.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new h.Vector2(r,r)}return Promise.all(s)}}class se{constructor(t){this.parser=t,this.name=T.KHR_MATERIALS_DISPERSION}getMaterialType(t){return _(this.parser,t,this.name)!==null?h.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=_(this.parser,t,this.name);return n===null||(e.dispersion=n.dispersion!==void 0?n.dispersion:0),Promise.resolve()}}class re{constructor(t){this.parser=t,this.name=T.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){return _(this.parser,t,this.name)!==null?h.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=_(this.parser,t,this.name);if(n===null)return Promise.resolve();const s=[];return n.iridescenceFactor!==void 0&&(e.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&s.push(this.parser.assignTexture(e,"iridescenceMap",n.iridescenceTexture)),n.iridescenceIor!==void 0&&(e.iridescenceIOR=n.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&s.push(this.parser.assignTexture(e,"iridescenceThicknessMap",n.iridescenceThicknessTexture)),Promise.all(s)}}class ie{constructor(t){this.parser=t,this.name=T.KHR_MATERIALS_SHEEN}getMaterialType(t){return _(this.parser,t,this.name)!==null?h.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=_(this.parser,t,this.name);if(n===null)return Promise.resolve();const s=[];if(e.sheenColor=new h.Color(0,0,0),e.sheenRoughness=0,e.sheen=1,n.sheenColorFactor!==void 0){const r=n.sheenColorFactor;e.sheenColor.setRGB(r[0],r[1],r[2],h.LinearSRGBColorSpace)}return n.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&s.push(this.parser.assignTexture(e,"sheenColorMap",n.sheenColorTexture,h.SRGBColorSpace)),n.sheenRoughnessTexture!==void 0&&s.push(this.parser.assignTexture(e,"sheenRoughnessMap",n.sheenRoughnessTexture)),Promise.all(s)}}class oe{constructor(t){this.parser=t,this.name=T.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){return _(this.parser,t,this.name)!==null?h.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=_(this.parser,t,this.name);if(n===null)return Promise.resolve();const s=[];return n.transmissionFactor!==void 0&&(e.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&s.push(this.parser.assignTexture(e,"transmissionMap",n.transmissionTexture)),Promise.all(s)}}class ae{constructor(t){this.parser=t,this.name=T.KHR_MATERIALS_VOLUME}getMaterialType(t){return _(this.parser,t,this.name)!==null?h.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=_(this.parser,t,this.name);if(n===null)return Promise.resolve();const s=[];e.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0&&s.push(this.parser.assignTexture(e,"thicknessMap",n.thicknessTexture)),e.attenuationDistance=n.attenuationDistance||1/0;const r=n.attenuationColor||[1,1,1];return e.attenuationColor=new h.Color().setRGB(r[0],r[1],r[2],h.LinearSRGBColorSpace),Promise.all(s)}}class ce{constructor(t){this.parser=t,this.name=T.KHR_MATERIALS_IOR}getMaterialType(t){return _(this.parser,t,this.name)!==null?h.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=_(this.parser,t,this.name);return n===null||(e.ior=n.ior!==void 0?n.ior:1.5),Promise.resolve()}}class le{constructor(t){this.parser=t,this.name=T.KHR_MATERIALS_SPECULAR}getMaterialType(t){return _(this.parser,t,this.name)!==null?h.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=_(this.parser,t,this.name);if(n===null)return Promise.resolve();const s=[];e.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0&&s.push(this.parser.assignTexture(e,"specularIntensityMap",n.specularTexture));const r=n.specularColorFactor||[1,1,1];return e.specularColor=new h.Color().setRGB(r[0],r[1],r[2],h.LinearSRGBColorSpace),n.specularColorTexture!==void 0&&s.push(this.parser.assignTexture(e,"specularColorMap",n.specularColorTexture,h.SRGBColorSpace)),Promise.all(s)}}class ue{constructor(t){this.parser=t,this.name=T.EXT_MATERIALS_BUMP}getMaterialType(t){return _(this.parser,t,this.name)!==null?h.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=_(this.parser,t,this.name);if(n===null)return Promise.resolve();const s=[];return e.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0&&s.push(this.parser.assignTexture(e,"bumpMap",n.bumpTexture)),Promise.all(s)}}class he{constructor(t){this.parser=t,this.name=T.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){return _(this.parser,t,this.name)!==null?h.MeshPhysicalMaterial:null}extendMaterialParams(t,e){const n=_(this.parser,t,this.name);if(n===null)return Promise.resolve();const s=[];return n.anisotropyStrength!==void 0&&(e.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(e.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&s.push(this.parser.assignTexture(e,"anisotropyMap",n.anisotropyTexture)),Promise.all(s)}}class fe{constructor(t){this.parser=t,this.name=T.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,n=e.json,s=n.textures[t];if(!s.extensions||!s.extensions[this.name])return null;const r=s.extensions[this.name],o=e.options.ktx2Loader;if(!o){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,o)}}class de{constructor(t){this.parser=t,this.name=T.EXT_TEXTURE_WEBP}loadTexture(t){const e=this.name,n=this.parser,s=n.json,r=s.textures[t];if(!r.extensions||!r.extensions[e])return null;const o=r.extensions[e],a=s.images[o.source];let i=n.textureLoader;if(a.uri){const c=n.options.manager.getHandler(a.uri);c!==null&&(i=c)}return n.loadTextureImage(t,o.source,i)}}class pe{constructor(t){this.parser=t,this.name=T.EXT_TEXTURE_AVIF}loadTexture(t){const e=this.name,n=this.parser,s=n.json,r=s.textures[t];if(!r.extensions||!r.extensions[e])return null;const o=r.extensions[e],a=s.images[o.source];let i=n.textureLoader;if(a.uri){const c=n.options.manager.getHandler(a.uri);c!==null&&(i=c)}return n.loadTextureImage(t,o.source,i)}}class K{constructor(t,e){this.name=e,this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const s=n.extensions[this.name],r=this.parser.getDependency("buffer",s.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){const i=s.byteOffset||0,c=s.byteLength||0,u=s.count,l=s.byteStride,f=new Uint8Array(a,i,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,l,f,s.mode,s.filter).then(function(p){return p.buffer}):o.ready.then(function(){const p=new ArrayBuffer(u*l);return o.decodeGltfBuffer(new Uint8Array(p),u,l,f,s.mode,s.filter),p})})}else return null}}class me{constructor(t){this.name=T.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,n=e.nodes[t];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const s=e.meshes[n.mesh];for(const c of s.primitives)if(c.mode!==S.TRIANGLES&&c.mode!==S.TRIANGLE_STRIP&&c.mode!==S.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=n.extensions[this.name].attributes,a=[],i={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(u=>(i[c]=u,i[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{const u=c.pop(),l=u.isGroup?u.children:[u],f=c[0].count,p=[];for(const m of l){const M=new h.Matrix4,g=new h.Vector3,R=new h.Quaternion,A=new h.Vector3(1,1,1),x=new h.InstancedMesh(m.geometry,m.material,f);for(let E=0;E<f;E++)i.TRANSLATION&&g.fromBufferAttribute(i.TRANSLATION,E),i.ROTATION&&R.fromBufferAttribute(i.ROTATION,E),i.SCALE&&A.fromBufferAttribute(i.SCALE,E),x.setMatrixAt(E,M.compose(g,R,A));for(const E in i)if(E==="_COLOR_0"){const L=i[E];x.instanceColor=new h.InstancedBufferAttribute(L.array,L.itemSize,L.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&m.geometry.setAttribute(E,i[E]);h.Object3D.prototype.copy.call(x,m),this.parser.assignFinalMaterial(x),p.push(x)}return u.isGroup?(u.clear(),u.add(...p),u):p[0]}))}}const W="glTF",F=12,j={JSON:1313821514,BIN:5130562};class ge{constructor(t){this.name=T.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,F),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==W)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-F,r=new DataView(t,F);let o=0;for(;o<s;){const a=r.getUint32(o,!0);o+=4;const i=r.getUint32(o,!0);if(o+=4,i===j.JSON){const c=new Uint8Array(t,F+o,a);this.content=n.decode(c)}else if(i===j.BIN){const c=F+o;this.body=t.slice(c,c+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Te{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=T.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const n=this.json,s=this.dracoLoader,r=t.extensions[this.name].bufferView,o=t.extensions[this.name].attributes,a={},i={},c={};for(const u in o){const l=B[u]||u.toLowerCase();a[l]=o[u]}for(const u in t.attributes){const l=B[u]||u.toLowerCase();if(o[u]!==void 0){const f=n.accessors[t.attributes[u]],p=O[f.componentType];c[l]=p.name,i[l]=f.normalized===!0}}return e.getDependency("bufferView",r).then(function(u){return new Promise(function(l,f){s.decodeDracoFile(u,function(p){for(const m in p.attributes){const M=p.attributes[m],g=i[m];g!==void 0&&(M.normalized=g)}l(p)},a,c,h.LinearSRGBColorSpace,f)})})}}class Re{constructor(){this.name=T.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return(e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class Me{constructor(){this.name=T.KHR_MESH_QUANTIZATION}}class Y extends h.Interpolant{constructor(t,e,n,s){super(t,e,n,s)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=t*s*3+s;for(let o=0;o!==s;o++)e[o]=n[r+o];return e}interpolate_(t,e,n,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,i=a*2,c=a*3,u=s-e,l=(n-e)/u,f=l*l,p=f*l,m=t*c,M=m-c,g=-2*p+3*f,R=p-f,A=1-g,x=R-f+l;for(let E=0;E!==a;E++){const L=o[M+E+a],b=o[M+E+i]*u,y=o[m+E+a],P=o[m+E]*u;r[E]=A*L+x*b+g*y+R*P}return r}}const Ee=new h.Quaternion;class xe extends Y{interpolate_(t,e,n,s){const r=super.interpolate_(t,e,n,s);return Ee.fromArray(r).normalize().toArray(r),r}}const S={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},O={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},V={9728:h.NearestFilter,9729:h.LinearFilter,9984:h.NearestMipmapNearestFilter,9985:h.LinearMipmapNearestFilter,9986:h.NearestMipmapLinearFilter,9987:h.LinearMipmapLinearFilter},z={33071:h.ClampToEdgeWrapping,33648:h.MirroredRepeatWrapping,10497:h.RepeatWrapping},D={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},B={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},N={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ae={CUBICSPLINE:void 0,LINEAR:h.InterpolateLinear,STEP:h.InterpolateDiscrete},G={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function _e(d){return d.DefaultMaterial===void 0&&(d.DefaultMaterial=new h.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:h.FrontSide})),d.DefaultMaterial}function I(d,t,e){for(const n in e.extensions)d[n]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=e.extensions[n])}function w(d,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(d.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Le(d,t,e){let n=!1,s=!1,r=!1;for(let c=0,u=t.length;c<u;c++){const l=t[c];if(l.POSITION!==void 0&&(n=!0),l.NORMAL!==void 0&&(s=!0),l.COLOR_0!==void 0&&(r=!0),n&&s&&r)break}if(!n&&!s&&!r)return Promise.resolve(d);const o=[],a=[],i=[];for(let c=0,u=t.length;c<u;c++){const l=t[c];if(n){const f=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):d.attributes.position;o.push(f)}if(s){const f=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):d.attributes.normal;a.push(f)}if(r){const f=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):d.attributes.color;i.push(f)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(i)]).then(function(c){const u=c[0],l=c[1],f=c[2];return n&&(d.morphAttributes.position=u),s&&(d.morphAttributes.normal=l),r&&(d.morphAttributes.color=f),d.morphTargetsRelative=!0,d})}function Se(d,t){if(d.updateMorphTargets(),t.weights!==void 0)for(let e=0,n=t.weights.length;e<n;e++)d.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(d.morphTargetInfluences.length===e.length){d.morphTargetDictionary={};for(let n=0,s=e.length;n<s;n++)d.morphTargetDictionary[e[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function ye(d){let t;const e=d.extensions&&d.extensions[T.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+v(e.attributes):t=d.indices+":"+v(d.attributes)+":"+d.mode,d.targets!==void 0)for(let n=0,s=d.targets.length;n<s;n++)t+=":"+v(d.targets[n]);return t}function v(d){let t="";const e=Object.keys(d).sort();for(let n=0,s=e.length;n<s;n++)t+=e[n]+":"+d[e[n]]+";";return t}function U(d){switch(d){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function we(d){return d.search(/\.jpe?g($|\?)/i)>0||d.search(/^data\:image\/jpeg/)===0?"image/jpeg":d.search(/\.webp($|\?)/i)>0||d.search(/^data\:image\/webp/)===0?"image/webp":d.search(/\.ktx2($|\?)/i)>0||d.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const be=new h.Matrix4;class Ne{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new Z,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,s=-1,r=!1,o=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;const i=a.match(/Version\/(\d+)/);s=n&&i?parseInt(i[1],10):-1,r=a.indexOf("Firefox")>-1,o=r?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&s<17||r&&o<98?this.textureLoader=new h.TextureLoader(this.options.manager):this.textureLoader=new h.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new h.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const n=this,s=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(o){const a={scene:o[0][s.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:s.asset,parser:n,userData:{}};return I(r,a,s),w(a,s),Promise.all(n._invokeAll(function(i){return i.afterRoot&&i.afterRoot(a)})).then(function(){for(const i of a.scenes)i.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let s=0,r=e.length;s<r;s++){const o=e[s].joints;for(let a=0,i=o.length;a<i;a++)t[o[a]].isBone=!0}for(let s=0,r=t.length;s<r;s++){const o=t[s];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(n[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,n){if(t.refs[e]<=1)return n;const s=n.clone(),r=(o,a)=>{const i=this.associations.get(o);i!=null&&this.associations.set(a,i);for(const[c,u]of o.children.entries())r(u,a.children[c])};return r(n,s),s.name+="_instance_"+t.uses[e]++,s}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){const s=t(e[n]);if(s)return s}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const n=[];for(let s=0;s<e.length;s++){const r=t(e[s]);r&&n.push(r)}return n}getDependency(t,e){const n=t+":"+e;let s=this.cache.get(n);if(!s){switch(t){case"scene":s=this.loadScene(e);break;case"node":s=this._invokeOne(function(r){return r.loadNode&&r.loadNode(e)});break;case"mesh":s=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(e)});break;case"accessor":s=this.loadAccessor(e);break;case"bufferView":s=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(e)});break;case"buffer":s=this.loadBuffer(e);break;case"material":s=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(e)});break;case"texture":s=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(e)});break;case"skin":s=this.loadSkin(e);break;case"animation":s=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(e)});break;case"camera":s=this.loadCamera(e);break;default:if(s=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(t,e)}),!s)throw new Error("Unknown type: "+t);break}this.cache.add(n,s)}return s}getDependencies(t){let e=this.cache.get(t);if(!e){const n=this,s=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(s.map(function(r,o){return n.getDependency(t,o)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],n=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[T.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(r,o){n.load(h.LoaderUtils.resolveURL(e.uri,s.path),r,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(n){const s=e.byteLength||0,r=e.byteOffset||0;return n.slice(r,r+s)})}loadAccessor(t){const e=this,n=this.json,s=this.json.accessors[t];if(s.bufferView===void 0&&s.sparse===void 0){const o=D[s.type],a=O[s.componentType],i=s.normalized===!0,c=new a(s.count*o);return Promise.resolve(new h.BufferAttribute(c,o,i))}const r=[];return s.bufferView!==void 0?r.push(this.getDependency("bufferView",s.bufferView)):r.push(null),s.sparse!==void 0&&(r.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(r).then(function(o){const a=o[0],i=D[s.type],c=O[s.componentType],u=c.BYTES_PER_ELEMENT,l=u*i,f=s.byteOffset||0,p=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,m=s.normalized===!0;let M,g;if(p&&p!==l){const R=Math.floor(f/p),A="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+R+":"+s.count;let x=e.cache.get(A);x||(M=new c(a,R*p,s.count*p/u),x=new h.InterleavedBuffer(M,p/u),e.cache.add(A,x)),g=new h.InterleavedBufferAttribute(x,i,f%p/u,m)}else a===null?M=new c(s.count*i):M=new c(a,f,s.count*i),g=new h.BufferAttribute(M,i,m);if(s.sparse!==void 0){const R=D.SCALAR,A=O[s.sparse.indices.componentType],x=s.sparse.indices.byteOffset||0,E=s.sparse.values.byteOffset||0,L=new A(o[1],x,s.sparse.count*R),b=new c(o[2],E,s.sparse.count*i);a!==null&&(g=new h.BufferAttribute(g.array.slice(),g.itemSize,g.normalized)),g.normalized=!1;for(let y=0,P=L.length;y<P;y++){const C=L[y];if(g.setX(C,b[y*i]),i>=2&&g.setY(C,b[y*i+1]),i>=3&&g.setZ(C,b[y*i+2]),i>=4&&g.setW(C,b[y*i+3]),i>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}g.normalized=m}return g})}loadTexture(t){const e=this.json,n=this.options,r=e.textures[t].source,o=e.images[r];let a=this.textureLoader;if(o.uri){const i=n.manager.getHandler(o.uri);i!==null&&(a=i)}return this.loadTextureImage(t,r,a)}loadTextureImage(t,e,n){const s=this,r=this.json,o=r.textures[t],a=r.images[e],i=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[i])return this.textureCache[i];const c=this.loadImageSource(e,n).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const f=(r.samplers||{})[o.sampler]||{};return u.magFilter=V[f.magFilter]||h.LinearFilter,u.minFilter=V[f.minFilter]||h.LinearMipmapLinearFilter,u.wrapS=z[f.wrapS]||h.RepeatWrapping,u.wrapT=z[f.wrapT]||h.RepeatWrapping,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==h.NearestFilter&&u.minFilter!==h.LinearFilter,s.associations.set(u,{textures:t}),u}).catch(function(){return null});return this.textureCache[i]=c,c}loadImageSource(t,e){const n=this,s=this.json,r=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(l=>l.clone());const o=s.images[t],a=self.URL||self.webkitURL;let i=o.uri||"",c=!1;if(o.bufferView!==void 0)i=n.getDependency("bufferView",o.bufferView).then(function(l){c=!0;const f=new Blob([l],{type:o.mimeType});return i=a.createObjectURL(f),i});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const u=Promise.resolve(i).then(function(l){return new Promise(function(f,p){let m=f;e.isImageBitmapLoader===!0&&(m=function(M){const g=new h.Texture(M);g.needsUpdate=!0,f(g)}),e.load(h.LoaderUtils.resolveURL(l,r.path),m,void 0,p)})}).then(function(l){return c===!0&&a.revokeObjectURL(i),w(l,o),l.userData.mimeType=o.mimeType||we(o.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",i),l});return this.sourceCache[t]=u,u}assignTexture(t,e,n,s){const r=this;return this.getDependency("texture",n.index).then(function(o){if(!o)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(o=o.clone(),o.channel=n.texCoord),r.extensions[T.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[T.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const i=r.associations.get(o);o=r.extensions[T.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),r.associations.set(o,i)}}return s!==void 0&&(o.colorSpace=s),t[e]=o,o})}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const s=e.attributes.tangent===void 0,r=e.attributes.color!==void 0,o=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+n.uuid;let i=this.cache.get(a);i||(i=new h.PointsMaterial,h.Material.prototype.copy.call(i,n),i.color.copy(n.color),i.map=n.map,i.sizeAttenuation=!1,this.cache.add(a,i)),n=i}else if(t.isLine){const a="LineBasicMaterial:"+n.uuid;let i=this.cache.get(a);i||(i=new h.LineBasicMaterial,h.Material.prototype.copy.call(i,n),i.color.copy(n.color),i.map=n.map,this.cache.add(a,i)),n=i}if(s||r||o){let a="ClonedMaterial:"+n.uuid+":";s&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let i=this.cache.get(a);i||(i=n.clone(),r&&(i.vertexColors=!0),o&&(i.flatShading=!0),s&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),this.cache.add(a,i),this.associations.set(i,this.associations.get(n))),n=i}t.material=n}getMaterialType(){return h.MeshStandardMaterial}loadMaterial(t){const e=this,n=this.json,s=this.extensions,r=n.materials[t];let o;const a={},i=r.extensions||{},c=[];if(i[T.KHR_MATERIALS_UNLIT]){const l=s[T.KHR_MATERIALS_UNLIT];o=l.getMaterialType(),c.push(l.extendParams(a,r,e))}else{const l=r.pbrMetallicRoughness||{};if(a.color=new h.Color(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const f=l.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],h.LinearSRGBColorSpace),a.opacity=f[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,h.SRGBColorSpace)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(t,a)})))}r.doubleSided===!0&&(a.side=h.DoubleSide);const u=r.alphaMode||G.OPAQUE;if(u===G.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===G.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&o!==h.MeshBasicMaterial&&(c.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new h.Vector2(1,1),r.normalTexture.scale!==void 0)){const l=r.normalTexture.scale;a.normalScale.set(l,l)}if(r.occlusionTexture!==void 0&&o!==h.MeshBasicMaterial&&(c.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&o!==h.MeshBasicMaterial){const l=r.emissiveFactor;a.emissive=new h.Color().setRGB(l[0],l[1],l[2],h.LinearSRGBColorSpace)}return r.emissiveTexture!==void 0&&o!==h.MeshBasicMaterial&&c.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,h.SRGBColorSpace)),Promise.all(c).then(function(){const l=new o(a);return r.name&&(l.name=r.name),w(l,r),e.associations.set(l,{materials:t}),r.extensions&&I(s,l,r),l})}createUniqueName(t){const e=h.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,n=this.extensions,s=this.primitiveCache;function r(a){return n[T.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(i){return X(i,a,e)})}const o=[];for(let a=0,i=t.length;a<i;a++){const c=t[a],u=ye(c),l=s[u];if(l)o.push(l.promise);else{let f;c.extensions&&c.extensions[T.KHR_DRACO_MESH_COMPRESSION]?f=r(c):f=X(new h.BufferGeometry,c,e),s[u]={primitive:c,promise:f},o.push(f)}}return Promise.all(o)}loadMesh(t){const e=this,n=this.json,s=this.extensions,r=n.meshes[t],o=r.primitives,a=[];for(let i=0,c=o.length;i<c;i++){const u=o[i].material===void 0?_e(this.cache):this.getDependency("material",o[i].material);a.push(u)}return a.push(e.loadGeometries(o)),Promise.all(a).then(function(i){const c=i.slice(0,i.length-1),u=i[i.length-1],l=[];for(let p=0,m=u.length;p<m;p++){const M=u[p],g=o[p];let R;const A=c[p];if(g.mode===S.TRIANGLES||g.mode===S.TRIANGLE_STRIP||g.mode===S.TRIANGLE_FAN||g.mode===void 0)R=r.isSkinnedMesh===!0?new h.SkinnedMesh(M,A):new h.Mesh(M,A),R.isSkinnedMesh===!0&&R.normalizeSkinWeights(),g.mode===S.TRIANGLE_STRIP?R.geometry=h.toTrianglesDrawMode(R.geometry,h.TriangleStripDrawMode):g.mode===S.TRIANGLE_FAN&&(R.geometry=h.toTrianglesDrawMode(R.geometry,h.TriangleFanDrawMode));else if(g.mode===S.LINES)R=new h.LineSegments(M,A);else if(g.mode===S.LINE_STRIP)R=new h.Line(M,A);else if(g.mode===S.LINE_LOOP)R=new h.LineLoop(M,A);else if(g.mode===S.POINTS)R=new h.Points(M,A);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+g.mode);Object.keys(R.geometry.morphAttributes).length>0&&Se(R,r),R.name=e.createUniqueName(r.name||"mesh_"+t),w(R,r),g.extensions&&I(s,R,g),e.assignFinalMaterial(R),l.push(R)}for(let p=0,m=l.length;p<m;p++)e.associations.set(l[p],{meshes:t,primitives:p});if(l.length===1)return r.extensions&&I(s,l[0],r),l[0];const f=new h.Group;r.extensions&&I(s,f,r),e.associations.set(f,{meshes:t});for(let p=0,m=l.length;p<m;p++)f.add(l[p]);return f})}loadCamera(t){let e;const n=this.json.cameras[t],s=n[n.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?e=new h.PerspectiveCamera(h.MathUtils.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(e=new h.OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),w(e,n),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],n=[];for(let s=0,r=e.joints.length;s<r;s++)n.push(this._loadNodeShallow(e.joints[s]));return e.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",e.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(s){const r=s.pop(),o=s,a=[],i=[];for(let c=0,u=o.length;c<u;c++){const l=o[c];if(l){a.push(l);const f=new h.Matrix4;r!==null&&f.fromArray(r.array,c*16),i.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new h.Skeleton(a,i)})}loadAnimation(t){const e=this.json,n=this,s=e.animations[t],r=s.name?s.name:"animation_"+t,o=[],a=[],i=[],c=[],u=[];for(let l=0,f=s.channels.length;l<f;l++){const p=s.channels[l],m=s.samplers[p.sampler],M=p.target,g=M.node,R=s.parameters!==void 0?s.parameters[m.input]:m.input,A=s.parameters!==void 0?s.parameters[m.output]:m.output;M.node!==void 0&&(o.push(this.getDependency("node",g)),a.push(this.getDependency("accessor",R)),i.push(this.getDependency("accessor",A)),c.push(m),u.push(M))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(i),Promise.all(c),Promise.all(u)]).then(function(l){const f=l[0],p=l[1],m=l[2],M=l[3],g=l[4],R=[];for(let x=0,E=f.length;x<E;x++){const L=f[x],b=p[x],y=m[x],P=M[x],C=g[x];if(L===void 0)continue;L.updateMatrix&&L.updateMatrix();const k=n._createAnimationTracks(L,b,y,P,C);if(k)for(let H=0;H<k.length;H++)R.push(k[H])}const A=new h.AnimationClip(r,void 0,R);return w(A,s),A})}createNodeMesh(t){const e=this.json,n=this,s=e.nodes[t];return s.mesh===void 0?null:n.getDependency("mesh",s.mesh).then(function(r){const o=n._getNodeRef(n.meshCache,s.mesh,r);return s.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let i=0,c=s.weights.length;i<c;i++)a.morphTargetInfluences[i]=s.weights[i]}),o})}loadNode(t){const e=this.json,n=this,s=e.nodes[t],r=n._loadNodeShallow(t),o=[],a=s.children||[];for(let c=0,u=a.length;c<u;c++)o.push(n.getDependency("node",a[c]));const i=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([r,Promise.all(o),i]).then(function(c){const u=c[0],l=c[1],f=c[2];f!==null&&u.traverse(function(p){p.isSkinnedMesh&&p.bind(f,be)});for(let p=0,m=l.length;p<m;p++)u.add(l[p]);if(u.userData.pivot!==void 0&&l.length>0){const p=u.userData.pivot,m=l[0];u.pivot=new h.Vector3().fromArray(p),u.position.x-=p[0],u.position.y-=p[1],u.position.z-=p[2],m.position.set(0,0,0),delete u.userData.pivot}return u})}_loadNodeShallow(t){const e=this.json,n=this.extensions,s=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const r=e.nodes[t],o=r.name?s.createUniqueName(r.name):"",a=[],i=s._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(t)});return i&&a.push(i),r.camera!==void 0&&a.push(s.getDependency("camera",r.camera).then(function(c){return s._getNodeRef(s.cameraCache,r.camera,c)})),s._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(t)}).forEach(function(c){a.push(c)}),this.nodeCache[t]=Promise.all(a).then(function(c){let u;if(r.isBone===!0?u=new h.Bone:c.length>1?u=new h.Group:c.length===1?u=c[0]:u=new h.Object3D,u!==c[0])for(let l=0,f=c.length;l<f;l++)u.add(c[l]);if(r.name&&(u.userData.name=r.name,u.name=o),w(u,r),r.extensions&&I(n,u,r),r.matrix!==void 0){const l=new h.Matrix4;l.fromArray(r.matrix),u.applyMatrix4(l)}else r.translation!==void 0&&u.position.fromArray(r.translation),r.rotation!==void 0&&u.quaternion.fromArray(r.rotation),r.scale!==void 0&&u.scale.fromArray(r.scale);if(!s.associations.has(u))s.associations.set(u,{});else if(r.mesh!==void 0&&s.meshCache.refs[r.mesh]>1){const l=s.associations.get(u);s.associations.set(u,{...l})}return s.associations.get(u).nodes=t,u}),this.nodeCache[t]}loadScene(t){const e=this.extensions,n=this.json.scenes[t],s=this,r=new h.Group;n.name&&(r.name=s.createUniqueName(n.name)),w(r,n),n.extensions&&I(e,r,n);const o=n.nodes||[],a=[];for(let i=0,c=o.length;i<c;i++)a.push(s.getDependency("node",o[i]));return Promise.all(a).then(function(i){for(let u=0,l=i.length;u<l;u++){const f=i[u];f.parent!==null?r.add(Q(f)):r.add(f)}const c=u=>{const l=new Map;for(const[f,p]of s.associations)(f instanceof h.Material||f instanceof h.Texture)&&l.set(f,p);return u.traverse(f=>{const p=s.associations.get(f);p!=null&&l.set(f,p)}),l};return s.associations=c(r),r})}_createAnimationTracks(t,e,n,s,r){const o=[],a=t.name?t.name:t.uuid,i=[];N[r.path]===N.weights?t.traverse(function(f){f.morphTargetInfluences&&i.push(f.name?f.name:f.uuid)}):i.push(a);let c;switch(N[r.path]){case N.weights:c=h.NumberKeyframeTrack;break;case N.rotation:c=h.QuaternionKeyframeTrack;break;case N.translation:case N.scale:c=h.VectorKeyframeTrack;break;default:n.itemSize===1?c=h.NumberKeyframeTrack:c=h.VectorKeyframeTrack;break}const u=s.interpolation!==void 0?Ae[s.interpolation]:h.InterpolateLinear,l=this._getArrayFromAccessor(n);for(let f=0,p=i.length;f<p;f++){const m=new c(i[f]+"."+N[r.path],e.array,l,u);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(m),o.push(m)}return o}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const n=U(e.constructor),s=new Float32Array(e.length);for(let r=0,o=e.length;r<o;r++)s[r]=e[r]*n;e=s}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(n){const s=this instanceof h.QuaternionKeyframeTrack?xe:Y;return new s(this.times,this.values,this.getValueSize()/3,n)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Ie(d,t,e){const n=t.attributes,s=new h.Box3;if(n.POSITION!==void 0){const a=e.json.accessors[n.POSITION],i=a.min,c=a.max;if(i!==void 0&&c!==void 0){if(s.set(new h.Vector3(i[0],i[1],i[2]),new h.Vector3(c[0],c[1],c[2])),a.normalized){const u=U(O[a.componentType]);s.min.multiplyScalar(u),s.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=t.targets;if(r!==void 0){const a=new h.Vector3,i=new h.Vector3;for(let c=0,u=r.length;c<u;c++){const l=r[c];if(l.POSITION!==void 0){const f=e.json.accessors[l.POSITION],p=f.min,m=f.max;if(p!==void 0&&m!==void 0){if(i.setX(Math.max(Math.abs(p[0]),Math.abs(m[0]))),i.setY(Math.max(Math.abs(p[1]),Math.abs(m[1]))),i.setZ(Math.max(Math.abs(p[2]),Math.abs(m[2]))),f.normalized){const M=U(O[f.componentType]);i.multiplyScalar(M)}a.max(i)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(a)}d.boundingBox=s;const o=new h.Sphere;s.getCenter(o.center),o.radius=s.min.distanceTo(s.max)/2,d.boundingSphere=o}function X(d,t,e){const n=t.attributes,s=[];function r(o,a){return e.getDependency("accessor",o).then(function(i){d.setAttribute(a,i)})}for(const o in n){const a=B[o]||o.toLowerCase();a in d.attributes||s.push(r(n[o],a))}if(t.indices!==void 0&&!d.index){const o=e.getDependency("accessor",t.indices).then(function(a){d.setIndex(a)});s.push(o)}return h.ColorManagement.workingColorSpace!==h.LinearSRGBColorSpace&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${h.ColorManagement.workingColorSpace}" not supported.`),w(d,t),Ie(d,t,e),Promise.all(s).then(function(){return t.targets!==void 0?Le(d,t.targets,e):d})}exports.GLTFLoader=J;
|